Public Member Functions
ParticleType Class Reference

## Detailed Description

Represents a particle type. A particle type serves as a definition of the particles on the initial state of a particle simulation.

A particle cloud contains one or more particle type(s). All particle types in a scene can be found under Scene.Particles container.

See also:
  ParticleCloud, ParticleCloudPrimitive, X3DObject::AddParticleCloud, ParticleAttribute

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)) ;
              }

`#include <xsi_particletype.h>`

Inheritance diagram for ParticleType:
[legend]

List of all members.

## Public Member Functions
| ParticleType ()
| ~ParticleType ()
| ParticleType (const CRef &in_ref)
| ParticleType (const ParticleType &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
ParticleType & | operator= (const ParticleType &in_obj)
ParticleType & | operator= (const CRef &in_ref)
LONG | GetID () const
CStatus | AddAttribute (const CString &in_name, XSI::siParticleAttributeType in_type) const
CStatus | RemoveAttribute (const CString &in_name) const
CStringArray | GetAttributeNames () const
XSI::siParticleAttributeType | GetAttributeType (const CString &in_name) const

## Constructor & Destructor Documentation

ParticleType | ( |  | ) |

Default constructor.

~ParticleType | ( |  | ) |

Default destructor.

ParticleType | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  in_ref | constant reference object.

ParticleType | ( | const ParticleType & | 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 Property.

siClassID GetClassID | ( |  | ) | const `[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from Property.

ParticleType& operator= | ( | const ParticleType & | 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 ParticleType object.

ParticleType& 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 ParticleType object.

Reimplemented from Property.

LONG GetID | ( |  | ) | const

Returns the scene index for this particle type, which corresponds to the index of this particle type under the Scene.Particles container.

Returns:
  The ParticleType ID.

CStatus AddAttribute | ( | const CString & | in_name,
|  | XSI::siParticleAttributeType | in_type
| ) |  | const

Adds a new user-defined attribute to this particle type. You must specify a type (ParticleAttribute.GetAttributeType) and a unique name for the new attribute. This function fails if another user-defined attribute with the same name exists.

Parameters:

  in_name | name of the defined attribute
  in_type | type of the defined attribute

Returns:
  CStatus::OK success
  CStatus::Fail other failure
  CStatus::InvalidArgument if in_type is siPAUndefined

CStatus RemoveAttribute | ( | const CString & | in_name | ) | const

Removes a user-defined attribute from this particle type by specifying the name.

Parameters:

  in_name | name of the attribute to remove.

Returns:
  CStatus::OK success
  CStatus::Fail other failure
  CStatus::False the attribute of name in_name was not found on the ParticleType.

CStringArray GetAttributeNames | ( |  | ) | const

Returns an array containing the names of all user-defined attributes for this particle type.

Returns:
  Array of custom attribute names.

XSI::siParticleAttributeType GetAttributeType | ( | const CString & | in_name | ) | const

Returns the data type of the specified attribute. If no attribute matches the specified name, it returns siPAUndefined.

Parameters:

  in_name | name of the attribute to remove.

Returns:
  Type of a given attribute.
  siPAUndefined if no match is found

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

- xsi_particletype.h