If you go with a custom preference, then you do something like this in an
OnStartup event:
var xsiPrefs = Application.Preferences;
var renderPrefs = xsiPrefs.Categories("Acme Render");
// Custom preferences were not installed
if (renderPrefs == null)
{
var sceneRoot = Dictionary.GetObject("Scene_Root", false);
var customProperty = sceneRoot.AddProperty("AcmeRenderPreferences",
false, "AcmeRenderPreferences");
InstallCustomPreferences(customProperty, "Acme Render");
}
else
RefreshCustomPreferences();
On Wed, Feb 12, 2014 at 12:52 PM, Eric Thivierge <[email protected]>wrote:
> I've stored these types of prefs in an xml file in the user directory and
> read / write to it as needed. I do the same with the Species preferences as
> I cannot rely on the built in custom preferences or want to deal with the
> baggage they bring along. My recommendation is to go that route.
>
> Eric T.
>
> On Wednesday, February 12, 2014 12:25:25 PM, Simon Reeves wrote:
>
>> I've not used custom preferences before but they look handy so I've
>> given it a go.
>>
>> I have a plugin which is a timer event, and I want to set the interval
>> from a value in a custom preferences property that I have created
>>
>> But on startup I get this error in my plugin
>>
>> /*# ERROR : Traceback (most recent call last):*/
>> /*# File "<Script Block 2>", line 14, in <module>*/
>> /*# oSaveInterval = (oAnalogPrefs.AutobackInterval.value) * 60000*/
>> /*# AttributeError: 'NoneType' object has no attribute
>> 'AutobackInterval'*/
>>
>> That error being this line:
>> /*oAnalogPrefs = Application.Preferences.Categories('Analog')*/
>>
>> It can't find the custom pref, if I run those lines of code to get the
>> value, or just reload (update) all plugins then it finds it and it all
>> carries on fine - so this makes me think that soft loads the PLUGIN
>> first, then the custom pref?
>>
>> Any ideas?
>>
>>
>>
>>
>> Simon Reeves
>> London, UK
>> /[email protected] <mailto:[email protected]>/
>> /www.simonreeves.com <http://www.simonreeves.com>/
>> /www.analogstudio.co.uk <http://www.analogstudio.co.uk>//
>> /
>>
>
>