ofxMSAControlFreak icon indicating copy to clipboard operation
ofxMSAControlFreak copied to clipboard

thanks for sharing your idea! and some questions...

Open moebiussurfing opened this issue 6 years ago • 1 comments

hey @memo ,

I just tried the examples ofxMSAControlFreak / ofxMSAControlFreakGui / ofxMSAControlFreakImGui, and I am really curious to start using the system.

Btw I have some questions if you don't mind:

  1. Do you use this params as a ofParameter replacement? Di you never combined with ofParameter/ofParameterGroup?

  2. It makes some sense to you to be able to add ofParameters types too? Maybe not for a from scratch project, but maybe is useful for adding ofParameters from other addon/class included on the project (or old projects based on ofParameters).

params.setName("tutorial"); // THIS IS OPTIONAL
// create some simple parameters
params.addFloat("myfloat");  // create a float Parameter: can be any real number

//something like:
params.addOfParameter(myOfParameter);
params.addOfParametertGroup(myOfParameterGroup);

(with auto set range, type, name... from the original ofParameter)

  1. What's the point of using ofxMSAOrderedPointerMap? It's just a way to access parameters by name? or maybe also a "king of singleton" to access them from all the scope?

Thanks again, cheers

moebiussurfing avatar Oct 08 '19 13:10 moebiussurfing

Hey, I started writing/using this addon a long time before ofParameter existed (in fact I was mentioning this to Arturo and Zach a while back, and I think it might have been an inspiration for ofParameter). The first version was using boost (OF wasn't using Poco back then). When OF integrated Poco , I also switched to Poco.

  1. For me right now it is a replacement for ofParameter. And it has many advantages for my needs, mostly for very quick prototyping (Which I list in the readme), but also that it's fully dynamic (so I can e.g. load an xml file containing profile info on a bunch of DMX fixtures, have my gui automatically build on that, code responds, and updates dmx fixtures accordingly etc. of course this can be done with ofParameter, but I just want to minimize code :)

  2. but I have often thought about somehow merging with ofParameter. I just haven't found the best way to do it yet. I think I have written some helper functions that do what you suggest in #2, but I haven't made it part of the addon yet. I can't remember why. I think the problem was a storage/variable ownership issue. by default controlfreak stores the value, BUT it can also 'track' an external variable via a pointer. (E.g. if you already have a variable that you want to access directly). If you add an ofParameter, I can easily create a duplicate of that in controlfreak, but now there's two variables. To track (via) a pointer the ofParameter would require bigger changes (and AFAIR, maybe changes to ofParameter). I can't remember exactly, it was a while ago.

  3. ofxMSAOrderedPointerMap is legacy. It's basically an ordered std::map of smart pointers. E.g. so that when you add parameters to a group, their order is maintained when drawing etc. (i.e. std::vector), but you can also access them by name (i.e. std::map). And I wrote this addon before C+11 came out, so shared pointers weren't standard yet, so I rolled my own solution for keeping track of who owns the data (and is responsible for clearing it). Nowadays for new projects I don't use this, but use https://github.com/memo/ofxMSAOrderedMap with shared::ptr. It is about time for a rehaul :)

memoakten avatar Oct 09 '19 10:10 memoakten