Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / PPG persistence across multiple-scene sessions
  RSS 2.0 ATOM  

PPG persistence across multiple-scene sessions
Rate this thread
 
30100
 
Permlink of this thread  
avatar
  • saajjj
  • Posted: 14 September 2008 12:16 AM
  • Total Posts: 161
  • Joined: 10 June 2008 12:38 PM

Hello,
I have been using the [B]ActiveSceneRoot.AddProperty[/B] method to display my custom Properties. Since the above attaches to the current scene root, a new scene destroys the contents of that property. Is there anyway of making a PPG which is unaffected by New/Load Scene using scripting? If not, can this be done using the C++ API?
The SDK XSIGame example seems to be doing this, but before I start to deconstruct that I hope to find a quick explanation here :)

Thanks.



Replies: 0
avatar

You can make the property a custom preference.



Replies: 0
avatar
  • saajjj
  • Posted: 14 September 2008 02:08 AM

Thanks for that Stephen,
I’ve managed to make it work by using :

sePsetObject XSIFactory.CreateObject("scriptEditor");
        
sePsetObject.Name "scriptEditor";

previously I had been using

Application.ActiveSceneRoot.AddProperty"scriptEditor" )

The problem I have now is that commands which relied on PPG.name fail.  I suppose this makes sense, since in the scene there is no ‘scriptEditor’ object (Which is what PPG.name used to refer to). For instance I was getting object names using Dictionary.getObject like:

oEditor Dictionary.getObject(PPG.name ".editor" PPG.currentTab);

The above statement used to resolve to scriptEditor.editorx0, whose value I could set.
Now, the only way I can get my code to work is to give the exact object like:

oEditor PPG.editorx0;

Since I have multiple editors, I have tried (but failed) to use the following ways to get the same result:

oEditor PPG.PPGLayout.Item(oEditorIndex);
oEditor.value "bla";

where oEditorIndex is the index value of the text editor widget in the ppg. Although oEditor.name gets logged as ‘editorx0’ and oEditor.type shows up as ‘Text Editor Widget’ the value doesn’t change. Any idea as to what I’m missing?

edit: I realize now that I can’t set the ‘value’ of a PPGITem, which is what PPG.PPGLayout.Item(oEditorIndex) returns. Using oEditor = PPG.editorx0, however does return it’s type as parameter. What property do I use to set the contents of a Text Editor Widget?

Thanks



Replies: 0
avatar
  • saajjj
  • Posted: 14 September 2008 02:51 AM

Got it to work, by using;
var oEditor = PPG["editor" + PPG.currentTab];

I can’t believe I missed out on this, I had tested using PPG[B].[/B]["editor" + PPG.currentTab]; and was wondering what went wrong.



Replies: 0
avatar
  • mantom
  • Posted: 15 September 2008 08:42 AM

[quote=StephenBlair;11094]You can make the property a custom preference.

How do you delete a custom preference from within XSI when it’s no longer needed?



Replies: 0
avatar
  • saajjj
  • Posted: 15 September 2008 09:40 AM

If you want to do it manually, ‘File’ > ‘Preferences’, In the left column expand ‘Custom’ then right click and delete the custom preference.



Replies: 0
avatar

[QUOTE=saajjj;11234]If you want to do it manually, ‘File’ > ‘Preferences’, In the left column expand ‘Custom’ then right click and delete the custom preference.

I’m not sure that it is that easy. I’ll have to check.



Replies: 0
avatar
  • saajjj
  • Posted: 15 September 2008 11:36 AM

I had a feeling my solution was too simple :)



Replies: 0
avatar
  • mantom
  • Posted: 15 September 2008 04:13 PM

[quote=StephenBlair;11242]I’m not sure that it is that easy. I’ll have to check.


Yeah, exactly. My understanding is XSI creates a file in your user account when the user preference is installed. When you no longer want the user preference, you have to delete that file. I was hoping there’d be something more elegant, like Application.RemoveCustomPreference, or something like that.

I haven’t touched the subject in several months, but the issue I ran into is when I want to upgrade the custom preference, how to do it in one swoop from script.  Deleting the file wouldn’t necessarily uninstall the custom preference from XSI if XSI were running at the time the file were deleted.  XSI sometimes hangs onto instances of things in memory.


Matt



Replies: 0