Storing prefs
Philemo_Carrara
Posts: 1,175
Hi to all,
Does anybody has implemented a PrefComponent (or has a way to store preferences).
I've tried, following closely the documentation in ISHPrefsComponent (see below), but with no success (I have a crash when I do a get/set parameter on this component):
/// IShPrefsComponent is a component used to store the preferences of another component./// It can also store user defined key bindings/// Those preferences are stored on a per user basis. /// So far there is no "explicit" UI in Carrara to change the component's preferences, /// but this mechanism can be used for example to save the position of a component's toolbar (eg motion path in Carrara).////// To implement a prefs component:/// - derive a class from TBasicPrefsComponent (and make a pmap for it)/// - declare its 'COMP' resource (use kRID_PreferencesFamilyID for its family), and give it an ID (eg 'path')./// - declare its 'GUID' resource (use R_IID_IExPrefsComponent for its parent interface)/// - declare its 'PMap' resource.////// Now for the component that wants to store its preferences, declare a 'CINF' resource /// and put the ID of the prefs component in its fPrefsCompID field. Example:/// \verbatim/// resource 'CINF' (R_PathAnimationMethod, "Motion Path")/// {/// 'path',/// kAnyPlatform,/// kAnyAppKind,/// kAnyAppMode, /// };/// \endverbatim////// Now in the code of component that wants to access its preferences, you can call GetMyPrefsComponent /// (implemented by TBasicDataExchanger). Example:/// \code/// IShParameterComponent* myPrefsComp= GetMyPrefsComponent();/// if (MCVerify(myPrefsComp))/// {/// TMCPoint tbPos= kDefaultMPToolbarPos;/// myPrefsComp->GetParameter(kToolBarParamID, &tbPos);/// //.../// }/// \endcode
Comments
Hi
Maybe you can find some tricks from the Yatoon2 source?
https://bitbucket.org/zgock/yatoon/wiki/Home
https://bitbucket.org/zgock/yatoon/wiki/Reference
https://bitbucket.org/zgock/yatoon/src/
The wheels modifier by Sparrowhawke3d has a save and load icon in its window, another way to save settings.
Details, instructions and source here: http://www.sparrowhawke3d.com/WheelsModifierPage.html
@3drendero
Thanks a lot.
What I need (and that nice plugins don't do) is a way to store data that can be retrieved another time (like Carrara preferences).
For instance, in Luxus, you can store the path to luxrender. You set it once for all and it's always available.
OK, I found out what's what going wrong.
The bug was, as usual, between the chair and the keyboard (BCK bug, the most common one)
It's corrected now, the path to VWD can now be memorized
I would love to know how to save Carrara preferences. I set up a large number of keyboard shortcuts, and once in a while, Blammo..... some power outage or conflict with other software, and I need to uninstall, and re-install, and start over with entering the keyboard shortcuts. I am not seeing how the Sparrowhawk would help provide a way to save a preferences file as a back up to be re-loaded. Am I missing something?
Thank you,
Rick