|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| Custom UI _ Python,PPG Layout - execute command code instead of object model code
|
|
|
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
|
|
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
Ok, that was easy.
Thanks for helping the stupid ;-D
Author: Marty_H
|
| Replied: 15 June 2011 06:19 AM
|
|
|
|
|