Value (ParticleAttribute)
Description
Returns or sets the particle attribute value as a Variant. If the type (ParticleAttribute.AttributeType is a siPAVector3 or siPAVector4 then the variant value is SIVector3 or SIQuaternion.
C# Syntax
// get accessor Object rtn = ParticleAttribute.Value; // set accessor ParticleAttribute.Value = Object;
Examples
JScript Example
/* This example demonstrates how to work with ParticleAttribute objects. In particular, it shows how to access goal information (which is a kind of ParticleAttribute) in a particle event script */ NewScene( null, false ); // Note: Since the CreateParticleCloud command returns the newly created ParticleCloud wrapped in // an XSICollection, we can get a pointer to the new cloud by extracting just the first member var myParticleCloud = CreateParticleCloud()(0); var myParticleEmitter = ActiveSceneRoot.AddGeometry( "Sphere","MeshSurface", "ParticleEmitter" ); AddParticleEmitter( myParticleCloud, myParticleEmitter ); var myParticleGoal = ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface", "ParticleGoal" ); myParticleGoal.posx = 10.0; myParticleGoal.posy = 15.0; // Note: The AddParticleGoal command uses an input/output type of parameter to specify which // particle cloud object to use. Unfortunately, if you pass the actual ParticleCloud object // for this parameter, the command will convert it to an XSICollection again, so avoid this // by passing in only the name (SIObject.Name property) of the ParticleCloud object AddParticleGoal( myParticleCloud.Name, myParticleGoal ); var myParticleCloudPrimitive = myParticleCloud.ActivePrimitive; var oEventColl = AddParticleEvent( myParticleCloudPrimitive.ParticleTypes(0))(0); // Converting the event collection into a Property var oEvent = oEventColl(0); oEvent.Parameters("EventAction").value = 6; // script oEvent.ScriptLanguage.Value = 1; // using JScript oEvent.EventTrigger.Value = 3; // Every NFrame oEvent.TriggerValue.Value = 50; // Every 50 frames oEvent.ScriptContext.Value = 1; // Per particle oEvent.Script.Value = "for (var i=0; i<inParticle.Attributes.Count; i++) {\n" + "\tvar oAttr = inParticle.Attributes(i);\n" + "\tApplication.LogMessage( \"Attribute Name: \" + oAttr.Name );\n" + "\tApplication.LogMessage( \"Attribute Type: \" + oAttr.AttributeType );\n" + "\tif ( typeof(oAttr.Value) == \"object\" ) {\n" + "\t\tApplication.LogMessage( \"Attribute Value: \" + Application.ClassName(oAttr.Value) );\n" + "\t} else {\n" + "\t\tApplication.LogMessage( \"Attribute Value: \" + typeof(oAttr.Value) );\n" + "\t}\n" + "}"; PlayForwardsFromStart(); // Output of the above script: //INFO : Attribute Name: Goal_0_UVWI //INFO : Attribute Type: 0 //INFO : Attribute Value: ISIQuaternion //INFO : Attribute Name: Goal_0_Offset //INFO : Attribute Type: 1 //INFO : Attribute Value: ISIVector3 //INFO : Attribute Name: Goal_0_Weight //INFO : Attribute Type: 2 //INFO : Attribute Value: number // ... //INFO : Attribute Name: Goal_0_UVWI //INFO : Attribute Type: 0 //INFO : Attribute Value: ISIQuaternion //INFO : Attribute Name: Goal_0_Offset //INFO : Attribute Type: 1 //INFO : Attribute Value: ISIVector3 //INFO : Attribute Name: Goal_0_Weight //INFO : Attribute Type: 2 //INFO : Attribute Value: number
Autodesk Softimage v7.5