AddUserParameter

Introduced

3.5

Description

Adds a user parameter to the particle types given either explicitely (list of particle types) or implicitely (list of clouds).

If one or several particles types are passed as arguments, the user parameter is added to these particle types. If one or several clouds are passed as arguments, the user parameter is added to all the particle types present under the clouds.

Scripting Syntax

    AddUserParameter( [Target], Name, Type )

Parameters

Parameter | Type | Description
Target | String | One or several particle types or clouds. Default Value: Current selection
Name | String | The name of the parameter to add.
Type | siParticleAttributeType | The type of the parameter to add.

Examples

JScript Example

    /*
       This example demonstrates how to use the AddUserParameter command
       to create a new attribute on a particle type
    */
    NewScene( null, false );
    var ptype = CreateParticleType()(0);

    AddUserParameter( ptype, "ZetaFactor", siPAVector3 );
    // Oh no I meant MyZetaFactor
    RemoveUserParameter( ptype, "ZetaFactor" );
    AddUserParameter( ptype, "MyZetaFactor", siPAVector3 );

    PrintParticleTypeUserAttributes( ptype );

    function PrintParticleTypeUserAttributes( in_ParticleType )
    {
       var aNames = in_ParticleType.AttributeNames().toArray();
       for ( var i=0; i<aNames.length; i++ ) {
           Application.LogMessage( aNames[i] );
           var str = "This attribute type is ";

           switch ( in_ParticleType.AttributeType(aNames[i]) ) {
              case siPAVector4 : str += "siPAVector4"; break;
              case siPAVector3 : str += "siPAVector3"; break;
              case siPAFloat : str += "siPAFloat"; break;
              case siPAInt : str += "siPAInt"; break;
              case siPAULong : str += "siPAULong"; break;
              case siPAUShort : str += "siPAUShort"; break;
              case siPABool : str += "siPABool"; break;
              default: str += "unknown.";
           }
           Application.LogMessage( str );
       }
    }

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

See Also

RemoveUserParameter | ParticleAttribute | ParticleType.AddAttribute | ParticleType
Particle |  |  |

Autodesk Softimage v7.5