Object Hierarchy | Related C++ Class: Parameter
Parameter
v1.5
Represents a parameter value, which defines an attribute of an
object; for example, the angle parameter of the twist operator or
the color of a light. Parameters (sometimes called properties), are
the 'atomic' elements of a parameter set (the posx in
Cone.kine.ltransfo.pos.posx) whose values determine the behavior of
something.
Note: A parameter set (often called a 'property set') is a
collection of parameters whose values can determine the appearance,
behavior, or simply provide information about an element in a
scene. Parameter sets (the Property
object for scripting) define the visual aspect of objects as
displayed in the viewport; some provide motion information such as
time; and others are used internally to control the way specific
operations are performed.
In the user interface, you can edit and animate the parameters of
most parameter sets using property editors. Related parameters are
usually displayed as a property page within a property
editor.
In the object model, the Parameter object is a member of the
ParameterCollection, which
you can get using ProjectItem.Parameters. For
custom-defined parameters, you can create them on the CustomProperty object (see CustomProperty.AddParameter
and CustomProperty.AddParameter2).
Besides representing a regular parameter in Softimage, this object
is the base class for a number of specializations, including the
ArrayParameter, ShaderParameter, ProxyParameter, etc.
For more information, see "Object Hierarchy" in the Softimage user
guide.
' ' This example shows how to loop through all parameters on the object ' NewScene , false ' Access Parameters Directly Off the Object Set oRoot = Application.ActiveProject.ActiveScene.Root Set oCube = oRoot.AddGeometry("Cube", "MeshSurface", "MyCube") ' Print the names of all parameter exposed by the cube object For Each oParameter In oCube.Parameters LogMessage oParameter.ScriptName & " = " & oParameter.Value Next ' Expected results: 'INFO : "Name = MyCube" 'INFO : "blendweight = 1" 'INFO : "active = True" 'INFO : "posx = 0" 'INFO : "posy = 0" 'INFO : "posz = 0" 'INFO : "rotx = 0" 'INFO : "roty = 0" 'INFO : "rotz = 0" 'INFO : "quatw = 1" 'INFO : "quatx = 0" 'INFO : "quaty = 0" 'INFO : "quatz = 0" 'INFO : "sclx = 1" 'INFO : "scly = 1" 'INFO : "sclz = 1" 'INFO : "sclorix = 0" 'INFO : "scloriy = 0" 'INFO : "scloriz = 0" 'INFO : "cnsscl = True" 'INFO : "cnsori = True" 'INFO : "cnspos = True" 'INFO : "affbyscl = True" 'INFO : "affbyori = True" 'INFO : "posxmaxactive = False" 'INFO : "posxminactive = False" 'INFO : "posymaxactive = False" 'INFO : "posyminactive = False" 'INFO : "poszmaxactive = False" 'INFO : "poszminactive = False" 'INFO : "rotxmaxactive = False" 'INFO : "rotxminactive = False" 'INFO : "rotymaxactive = False" 'INFO : "rotyminactive = False" 'INFO : "rotzmaxactive = False" 'INFO : "rotzminactive = False" 'INFO : "siscaling = True" 'INFO : "rotorder = 0" 'INFO : "subdivu = 1" 'INFO : "subdivv = 1" 'INFO : "subdivbase = 1" 'INFO : "length = 8" |
' ' This example demonstrates how to get at individual parameters; if you change the value of ' a parameter you want to access through the UI, you can get its name to use in your script. ' For example, toggling the View Visibility parameter of a torus logs the following message ' to the Script Editor History pane: ' ' SetValue "torus.visibility.viewvis", False ' NewScene , false ' ' How to Access Parameters (the Long Way) ' ' First get the camera (Camera object) Set oCamera = ActiveSceneRoot.FindChild( , "camera" ) ' Underneath the camera are its properties (Properties returns the PropertyCollection) Set oProps = oCamera.Properties ' Once you have all the property sets (PropertyCollection) you can specify the one you ' want (the Property object is returned) Set oVis = oProps( "visibility" ) ' Now you have a single Property (property set), so you need to get all the ' parameters for that property set (Parameters returns the ParameterCollection) Set oParams = oVis.Parameters ' Again you choose the single parameter you want from the collection (the ' Parameter object is returned) Set oViewVis = oParams( "viewvis" ) ' ' How to Get Parameter Values ' ' And once you have a single Parameter object, you can get it's value... bOldValue = oViewVis.Value LogMessage "Parameter originally was set to " & oViewVis.Value ' ' How to Set Parameter Values ' ' ...or set it... oViewVis.Value = not(bOldValue) LogMessage "Parameter has been changed to " & oViewVis.Value ' ' How to Access Parameters (the Short Way) ' ' ...and you can make as many shortcuts as you like, so... oCamera.Properties("visibility").Parameters("viewvis").Value = not(bOldValue) LogMessage "Parameter is back to " & oViewVis.Value ' Expected result: 'INFO : "Parameter originally was set to False" 'INFO : "Parameter has been changed to True" 'INFO : "Parameter is back to True" |