Have you looked at the InstallCustomPreferences command? The 2010 docs says it will take your property and convert it to the .preset.
-------------------------------------------- Eric Thivierge http://www.ethivierge.com On Sat, Apr 21, 2012 at 10:59 AM, Tim Crowson < [email protected]> wrote: > I agree and that sounds like a good plan, but I'm still unclear on how to > get it to install properly. If you were creating one from scratch, how > would you do this and what order would you do it in? I think I've got > everything where it needs to be (it frankly isn't that complicated). But > for some reason it insists on not installing. > > -Tim > > > > > On 4/20/2012 7:37 PM, Matt Lind wrote: > > I would advise creating a self installing custom property as your custom > user preference property.**** > > ** ** > > I would then write a self installing command which can manage the custom > user preference property. The advantage being you could write something > very simple and generic to operate on any custom user preference if you > decide to make more or perform maintenance on just the one.**** > > ** ** > > You would need to write two commands in support:**** > > ** ** > > - Install: Creates an instance of the custom user preference > property at the scene root, then calls InstallCustomPreference() to put it > into the user preferences.**** > > ** ** > > - Uninstall: Deletes the custom user preference from the user’s > preferences, then deletes the .preset file from the hard drive in the > user’s workgroup.**** > > ** ** > > That’s it.**** > > ** ** > > Going your route is the quick n’ dirty way. While it’ll require less > effort the first time you do it, it’ll also pull the most hair out of your > head when it comes to performing any kind of maintenance.**** > > ** ** > > ** ** > > Matt**** > > ** ** > > ** ** > > ** ** > > ** ** > > ** ** > > ** ** > > *From:* [email protected] [ > mailto:[email protected]<[email protected]>] > *On Behalf Of *Tim Crowson > *Sent:* Friday, April 20, 2012 5:27 PM > *To:* [email protected] > *Subject:* Re: can't load cusrom preference**** > > ** ** > > Thanks guys, > > In this particular case, I just want to create a preference to store the > path to an image editor. I was updating my old 'Open In PS' script (for > nodes in the shader tree) and ran into trouble when I tried to move it over > to the workgroup for the rest of my pals. > > One thing puzzles me. I'm supposed to create a self-installing property > and place it in Data\Preferences but with the extension *.Preset*. This > sounds like I just need to rename my extension from *.py* to *.Preset*. > But is that right? Sorry, I'm new to custom prefs this way. > > And it's still throwing the warning no matter what order I do things in. > Cryptic warning too. Wish it gave me a hint as to the reason... Right now > it might as well be *'# WARNING: 3000 - Too much noob detected'* > > -Tim > > On 4/20/2012 6:00 PM, Matt Lind wrote: **** > > In our pipeline we use Custom user Preferences for things that don’t > change much, such as server paths, database schemas, etc..**** > > **** > > I wrote a few simple commands which maintain custom user preferences and > found the best way to manage them is to treat them like self installing > Custom Properties using a versioning scheme. **** > > **** > > Every custom property I create for our production has a “version” and > “type” parameter. When a scene or model is loaded, an event script scans > all the custom properties and compares the version and type parameters in > the custom property to the values stored in the custom property’s plugin. > If the plugin is newer, the custom property is deleted and re-instanced > into the scene copying the old information across to the new instance. I > extend this same process to custom user preferences. The main difference > being that custom user preferences can only use a subset of the available > parameter value types available for custom properties.**** > > **** > > My code for managing custom user preferences is in the OnStartUp() event > and performs the same tasks as described above. The only difference is > newly instanced custom properties to be used as custom user preferences > must be installed at the scene root before calling > InstallCustomPreference(). When deleting a custom user preference, you > must first delete the custom property installed in the user preferences, > then delete the associated .preset file in the user’s workgroup location. > If you do it in any other order, you’ll get flakey behaviors.**** > > **** > > **** > > You may still get the error you report when installing the custom user > preference for the first time, but it’ll go away in future sessions of the > application. However, I have noticed the error is more frequent in 2012 > and 2013. Appears to be an order-of-operations thing. Just the other day > one of our artists activated “Load last scene at startup” preference, and > that triggered a bunch of errors. It seems softimage loads the last scene > before workgroups are parsed/scanned/loaded.**** > > **** > > **** > > **** > > Matt**** > > **** > > **** > > **** > > **** > > **** > > *From:* [email protected] [ > mailto:[email protected]<[email protected]>] > *On Behalf Of *Eric Thivierge > *Sent:* Friday, April 20, 2012 3:40 PM > *To:* [email protected] > *Subject:* Re: can't load cusrom preference**** > > **** > > I stay away from the built in preferences myself because they get a bit > hairy trying to delete them eventually.**** > > **** > > What you could do instead is have a text file holding your pref data which > is stored as a Python dictionary (as a string) and then creating a plugin > for the user that reads that string evals it back to a dictionary and > builds the UI dynamically and allows the users to set the proper prefs. You > could either store the prefs in the workgroup / addon directory or in the > users xsi folder. I've found this to be cleaner. **** > > **** > > - 2 cents**** > > > -------------------------------------------- > Eric Thivierge > http://www.ethivierge.com > > > **** > > On Sat, Apr 21, 2012 at 7:34 AM, Tim Crowson < > [email protected]> wrote:**** > > The warning in my first email is all I get. > -Tim**** > > > > On 4/20/2012 4:26 PM, Stephen Blair wrote: **** > > Works for me.**** > > Do you have the actual error message?**** > > **** > > **** > > From: [email protected] > [mailto:[email protected] > <[email protected]>] On Behalf Of Tim Crowson**** > > Sent: April-20-12 4:36 PM**** > > To: [email protected]**** > > Subject: can't load cusrom preference**** > > **** > > Gents,**** > > **** > > I created a custom property in Python to house a single string and want to > install it in our workgroup as a custom preference. I have placed it in the > workgroup in \Addons\myTool\Data\Preferences\myCustomPref.Preset But when I > run Application.RefreshCustomPreferences() I get the following warning:**** > > **** > > # WARNING : 3000 - Not able to load a custom preference: > Path\to\my\customPref.Preset**** > > **** > > Any of you Jedis have insight into what might be wrong? I'm using 2012 SAP on > Windows, FWIW.**** > > --**** > > **** > > **** > > **** > > Tim Crowson**** > > Lead CG Artist**** > > **** > > **** > > [cid:[email protected]]**** > > **** > > **** > > Magnetic Dreams Animation Studio, Inc.**** > > 2525 Lebanon Pike, Building C. Nashville, TN 37214**** > > Ph 615.885.6801 | Fax 615.889.4768 | > www.magneticdreams.com<http://www.magneticdreams.com> > <http://www.magneticdreams.com>**** > > [email protected]<mailto:[email protected]> > <[email protected]>**** > > **** > > **** > > -- **** > > **** > > *Tim Crowson > **Lead CG Artist***** > > **** > > *Magnetic Dreams Animation Studio, Inc.***** > > 2525 Lebanon Pike, Building C. Nashville, TN 37214 > *Ph* 615.885.6801 | *Fax* 615.889.4768 | www.magneticdreams.com**** > > [email protected]**** > > **** > > **** > > ** ** > > -- **** > > **** > > > -- > > >
<<image/gif>>

