ParticleAttribute Class Reference
 
 
 
ParticleAttribute Class Reference

#include <xsi_particleattribute.h>


Class Description

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.

See also:
ParticleCloud, ParticleCloudPrimitive, X3DObject::AddParticleCloud, ParticleType
Since:
4.0
Deprecated:
8.0 (2010) Legacy particles are only kept for backward compatibility.
Example:
Creates the initial state with a user defined particle attribute for 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)) ;
                }
Inheritance diagram for ParticleAttribute:
SIObject CBase

List of all members.

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

Constructor & Destructor Documentation

Default constructor.

Default destructor.

ParticleAttribute ( const CRef in_ref )

Constructor.

Parameters:
in_ref constant reference object.
ParticleAttribute ( const ParticleAttribute in_obj )

Copy constructor.

Parameters:
in_obj constant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID ) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassID class type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from SIObject.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from SIObject.

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.

Parameters:
in_obj constant class object.
Returns:
The new ParticleAttribute 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.

Parameters:
in_ref constant class object.
Returns:
The new ParticleAttribute object.

Reimplemented from SIObject.

CStatus GetValue ( CValue out_val ) const

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.

Return values:
out_val container for the retrieved value.
Returns:
CStatus::OK success
CStatus::Fail failure
CStatus::InvalidArgument attempts to use the wrong overloaded version of this function.
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.

CStatus PutValue ( const CValue in_val ) const

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.

Parameters:
in_val new value to be set
Returns:
CStatus::OK success
CStatus::Fail failure
CStatus::InvalidArgument attempts to use the wrong overloaded version of this function.
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.

Returns:
The attribute type

The documentation for this class was generated from the following file: