Object Hierarchy | Related C++ Class: CustomProperty
CustomProperty
v1.5
Represents a custom property object. A custom property holds a set of parameters which can be created by the user or by scripting. A custom property can be used to store user defined data such as attributes for a game engine. Using the object model this data can be manipulated just like any other property within a Softimage scene.
'VBScript example : find the custom properties on an object set oSphere = ActiveProject.ActiveScene.Root.AddGeometry("Sphere", "NurbsSurface") 'Add two empty custom property sets oSphere.AddProperty "Custom_parameter_list",,"MyFirstCustomProperty" oSphere.AddProperty "Custom_parameter_list",,"MySecondCustomProperty" 'List all the custom property sets on the object for each oLocalProp in oSphere.LocalProperties if ( oLocalProp.Type = "customparamset" ) then logmessage oLocalProp.Name & ", " & oLocalProp.Type & ", " & typename(oLocalProp) end if next 'Results of running this script: 'INFO : "MyFirstCustomProperty, customparamset, CustomProperty" 'INFO : "MySecondCustomProperty, customparamset, CustomProperty" |
'VBScript example : Demonstrate creating a cluster with custom property set based on the ' selected points 'Setup the scenario CreatePrim "Grid", "MeshSurface" DeselectAll ActivateVertexSelTool SelectGeometryComponents "grid.pnt[34,35,42-44]" 'Now based on selection we create a cluster and property set on the cluster dim oObj, oNewCluster, oPSet dim item set oObj = application.selection set item = oObj.Item(0) if ( item.Type = "pntSubComponent" ) then set oNewCluster = item.SubComponent.CreateCluster( "MyPointCluster" ) 'Add custom property set to the new cluster set oPSet = oNewCluster.AddProperty("Custom_parameter_list",,"MyClusterPSet") oPSet.AddParameter "StrCustomParam", siString oPSet.Parameters( "StrCustomParam" ).Value = "TestValue" logmessage oPSet.Parameters( "StrCustomParam" ).FullName end if 'Results of running this script 'INFO : "grid.polymsh.cls.MyPointCluster.MyClusterPSet.StrCustomParam" |
var app = Application; var root = app.ActiveSceneRoot; var nullobj; nullobj = root.AddNull( "" ); var cpset; cpset = nullobj.AddCustomProperty("MyCustomPSet", false ); var x, y, bitfield, label, flag, unused; x = cpset.AddParameter( "x", siDouble, siClassifUnknown, siAnimatable, "Double", "Double X", unused, 10.0, 0.0, 100.0, 10.0, 90.0 ); y = cpset.AddParameter( "y", siInt4, siClassifUnknown, siAnimatable, "Integer", "Integer Y", unused, 10, 0, 100, 10, 90 ); z = cpset.AddParameter( "x", siDouble, siClassifUnknown, siAnimatable, "Double", "Double Z" ); label = cpset.AddParameter( "label", siString, siClassifUnknown, siAnimatable, "Text", "Text Field", unused, "Hello World" ); flag = cpset.AddParameter( "flag", siBool, siClassifUnknown, siAnimatable, "Flag", "Boolean Field", unused, true ); bitfield = cpset.AddParameter( "bitfield", siUByte, siClassifUnknown, siAnimatable, "UByte", "Bitfield", 32 ); |