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 / Custom UI _ Python,PPG Layout - execute command code instead of object model code
  RSS 2.0 ATOM  

Custom UI _ Python,PPG Layout - execute command code instead of object model code
Rate this thread
 
56896
 
Permlink of this thread  
avatar
  • Marty_H
  • Posted: 14 June 2011 01:58 AM
  • Total Posts: 5
  • Joined: 14 June 2011 08:22 AM

hi everybody,

To be mentioned first: I´m an mechanical engineer and not an information scientist.

So my question:

I´ve built an custom UI, and now I´m trying to execute the code I´ve readout from the script editor
within this UI.
On clicking the OK button the command code which was generated automatically through SI 2012,
should be executed.
But only the first line is being executed.
I´ve found an article about prefering object model code instead of command code,
but I would like to use the command code because the script with 642 lines already exist.

Is there any way to make this work.

Cheers,
Marty_H



Attachment Attachment
Replies: 0
avatar
  • luceric
  • Posted: 14 June 2011 03:43 AM

you can call commands, but you cannot call LoadScene in a property page logic.
Load scene will destroy your plug-in and your property page, right in the middle of the script, usually crashing the application.  You must not call any command that destroy the object that is being inspected.

If that what you need, you’re need to create user interface in some other ways, for example in a netview, synnopitic view, with buttons on a toolbar, or with a true UI toolkit such as QT. The property page user interface callbacks were not meant to implement a general user interface toolkit, it is mean for simple logic to enable/disable controls on a property page.



Replies: 0
avatar
  • Marty_H
  • Posted: 14 June 2011 06:32 AM

Ok.
Thanks for your answer. But even commands like

Application.CreatePrim("Sphere", “NurbsSurface”, “”, “")
Application.SetValue("sphere.sphere.radius", 120, “")
Application.SetValue("sphere.surfmsh.geom.subdivu", 6, “")
Application.SetValue("sphere.surfmsh.geom.subdivv", 6, “")
Application.SetValue("sphere.surfmsh.geom.startuangle", 0, “")
Application.SetValue("sphere.surfmsh.geom.enduangle", 180, “")
Application.SetValue("sphere.surfmsh.geom.endvangle", 160, “")
Application.SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.color_transparency_Greifraum.out", “Sources.Materials.DefaultLib.Scene_Material.surface”, False)
Application.ApplyCns("Position", “sphere”, “linke_Schulter”, “")

don´t work.
I already tried it with wxpython instead of QT, but that doesn´t work either.
Can I use synoptic view, when I have to connect with an excel sheet in dependence of the choice
I´ve made at the “buttons and items”.

Cheers,
Marty



Replies: 0
avatar
  • Marty_H
  • Posted: 14 June 2011 08:05 AM

OK finally it works.

but how can I make the script not to open all the
frames for my objects (scene_root).

Cheers,
Marty



Attachment Attachment
Replies: 0
avatar

If you are using commands to create objects, then the property editors will pop-up automatically.
There’s a preference that controls that:
SetValue("preferences.Interaction.autoinspect", false, null);

Using the OM to create objects would avoid that.



Replies: 1
/img/forum/dark/default_avatar.png

Using OM is not an option for me.
The command code I can readout of the script editor and the OM code Iwould have to write, right?
And I´m not familiar with this code.

At my script the command
SetValue("preferences.Interaction.autoinspect", false, null);
leads to an error warning.

How I have to integrate this command to my script????

Author: Marty_H

Replied: 14 June 2011 10:52 PM  
avatar

The SetValue command I posted is in JScript, you need Python, right?
So Application.SetValue.
Or open the Interaction preferences and change the pref, and copy that from the script log.



Replies: 1
/img/forum/dark/default_avatar.png

Ok, that was easy.
Thanks for helping the stupid ;-D

Author: Marty_H

Replied: 15 June 2011 06:19 AM