Introduced
3.0
Description
The UserDataItem object represents a single instance of user data that has been attached to a Softimage component. For example, each polygon on a Cluster with a UserDataMap will have its own instance of this UserDataItem object.
This object is provided for convenience but it is also possible to manipulate the user data using the methods UserDataMap.ItemValue, UserDataMap.ItemSize and UserDataMap.IsEmpty provided directly on the UserDataMap.
Properties
Examples
1. VBScript Example
' ' Example demonstrating the properties and methods on the ' UserDataItem object ' dim oRoot, oTorus, oCluster, oUserDataMap, oUserData set oRoot = Application.ActiveProject.ActiveScene.Root set oTorus = oRoot.AddGeometry("Torus","NurbsSurface") set oCluster = oTorus.ActivePrimitive.Geometry.AddCluster( siBoundaryCluster ) set oUserDataMap = oCluster.AddProperty("UserDataMap",, "NameOfProperty") set oUserData = oUserDataMap.Item( 0 ) Application.LogMessage oUserData.IsEmpty & "/" & oUserData.Size & "/" & oUserData.Value ' We can save strings in the user data oUserData.Value = "Some content" Application.LogMessage oUserData.IsEmpty & "/" & oUserData.Size & "/" & oUserData.Value ' Output of this script is: 'INFO : "True/0/" 'INFO : "False/24/Some content"
2. JScript Example
/* This example demonstrates how it is possible to enumerate UserDataItem objects on a UserDataMap with the Enumerator object */ NewScene( "", false ) ; // Create a particle simulation var oCloud = CreateParticleCloud().Item( 0 ) ; var oEmitter= CreatePrim( "Sphere", "MeshSurface", "ParticleEmitter" ) ; AddParticleEmitter( oCloud, oEmitter ) ; SetValue( "ParTypes.PType.Life", 100 ) ; // One particle per second SetValue( "ParticleEmitter.EmissionProp.Rate", 30 ) ; SetValue( "PlayControl.Current", 30 ) ; // A cluster of all the particles has been created automatically var oCluster = oCloud.ActivePrimitive.Geometry.Clusters(0) ; var oUDM = oCluster.AddProperty( "UserDataMap",false,"CloudData" ) ; // Enumerate user data items oEnum = new Enumerator( oUDM ); for ( ;!oEnum.atEnd(); oEnum.moveNext() ) { oEnum.item().value = "Initial Per-Particle User Data" ; }
See Also
Autodesk Softimage v7.5