Represents a user-defined Particle attribute, which is a custom parameter for particles originating from a ParticleType.
The user-defined particle attribute can be used to customize a particle simulation.
using namespace XSI; Application app ; CValueArray args(2) ; CValue outArg; args[0] = (LONG) siSphereType ; app.ExecuteCommand( L"CreateParticleType", args, outArg ) ; ParticleType myParType = args[1] ; myParType.PutName( CString(L"CustomParType") ) ; myParType.AddAttribute(L"myVector3Attr", siPAVector3); CRefArray particleTypeArray ; particleTypeArray.Add( myParType ) ; // Create a particle cloud. This has no emittor, and no particle operator // so the cloud state is completely the responsibility of the plug-in // and will not change even if the current frame is changed ParticleCloud myParticleCloud ; app.GetActiveSceneRoot().AddParticleCloud( particleTypeArray, L"MyCloud", myParticleCloud ) ; ParticleCloudPrimitive myParticlePrim = myParticleCloud.GetActivePrimitive() ; // Our "CustomParType" will automatically be used because // we specified it in the call to AddParticleCloud myParticlePrim.AddParticles( 10, CRef() ) ; // Setting the user defined particle attribute for ( LONG i = 0 ; i < 10 ; i++ ) { Particle oParticle = myParticlePrim.GetParticle(i) ; CRefArray attributes = oParticle.GetAttributes() ; ParticleAttribute myPA(attributes.GetItem(L"myVector3Attr")); myPA.PutValue( MATH::CVector3(1.0,1.0, 1.0)) ; }
#include <xsi_particleattribute.h>
Public Member Functions | |
ParticleAttribute () | |
~ParticleAttribute () | |
ParticleAttribute (const CRef &in_ref) | |
ParticleAttribute (const ParticleAttribute &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
ParticleAttribute & | operator= (const ParticleAttribute &in_obj) |
ParticleAttribute & | operator= (const CRef &in_ref) |
CStatus | GetValue (CValue &out_val) const |
CStatus | GetValue (MATH::CVector3 &out_val) const |
CStatus | GetValue (MATH::CVector4 &out_val) const |
CStatus | PutValue (const CValue &in_val) const |
CStatus | PutValue (const MATH::CVector3 &in_val) const |
CStatus | PutValue (const MATH::CVector4 &in_val) const |
XSI::siParticleAttributeType | GetAttributeType () const |
Default constructor.
~ParticleAttribute | ( | ) |
Default destructor.
ParticleAttribute | ( | const CRef & | in_ref | ) |
Constructor.
in_ref | constant reference object. |
ParticleAttribute | ( | const ParticleAttribute & | in_obj | ) |
Copy constructor.
in_obj | constant class object. |
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from SIObject.
siClassID GetClassID | ( | ) | const [virtual] |
ParticleAttribute& operator= | ( | const ParticleAttribute & | in_obj | ) |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
ParticleAttribute& operator= | ( | const CRef & | in_ref | ) |
Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.
in_ref | constant class object. |
Reimplemented from SIObject.
Returns the value of this attribute. For all numeric types you should be using the CValue version of ParticleAttribute::GetValue. If the type of the argument does not match the function will return an invalid argument method.
out_val | container for the retrieved value. |
CStatus GetValue | ( | MATH::CVector3 & | out_val | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CStatus GetValue | ( | MATH::CVector4 & | out_val | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the value of this attribute. For all numeric types you should be using the CValue version of ParticleAttribute::PutValue. If the type of the argument does not match the method will return an invalid argument method.
in_val | new value to be set |
CStatus PutValue | ( | const MATH::CVector3 & | in_val | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CStatus PutValue | ( | const MATH::CVector4 & | in_val | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
XSI::siParticleAttributeType GetAttributeType | ( | ) | const |
Returns the particle attribute type.