AddAttribute (ParticleType)

Description

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

Scripting Syntax

    ParticleType.AddAttribute( Name, Type )

C# Syntax

    ParticleType.AddAttribute( String in_strName, siParticleAttributeType in_Type );

Parameters

Parameter | Type | Description
Name | String | Name of the defined attribute.
Type | siParticleAttributeType | Type of the defined attribute.

Examples

VBScript Example

    NewScene , false
    set oParticleType = CreateParticleType()(0)

    oParticleType.AddAttribute "ZetaFactor", siPAVector3
    'Oh no I meant MyZetaFactor
    oParticleType.RemoveAttribute "ZetaFactor"
    oParticleType.AddAttribute "MyZetaFactor", siPAVector3

    PrintParticleTypeUserAttributes oParticleType

    sub PrintParticleTypeUserAttributes(in_ParticleType)

       aNames = in_ParticleType.AttributeNames
       for i = 0 to UBound(aNames)
           Application.LogMessage aNames(i)
           str = "This attribute type is "
           select case in_ParticleType.AttributeType(aNames(i))
              case siPAVector4
                  str = str & "siPAVector4"
              case siPAVector3
                  str = str & "siPAVector3"
              case siPAFloat
                  str = str & "siPAFloat"
              case siPAInt
                  str = str & "siPAInt"
              case siPAULong
                  str = str & "siPAULong"
              case siPAUShort
                  str = str & "siPAUShort"
              case siPABool
                  str = str & "siPABool"
           end select
           Application.LogMessage str
       next
    end sub

    ' Expected results:
    'INFO : MyZetaFactor
    'INFO : This attribute type is siPAVector3

See Also

ParticleType.RemoveAttribute

Autodesk Softimage v7.5