ToggleParameterVal ue

Introduced

1.5

Description

Toggles boolean parameter values of selected objects.

Scripting Syntax

    ToggleParameterValue( [InputObjects], Parameters )

Parameters

Parameter | Type | Description
InputObjects | String | List of objects to toggle parameters on. Default Value: Current selection
Parameters | String | Names of which boolean parameters to toggle in a comma-delimited list. Note: It is the script writer's responsibility to make sure that the parameter specified here are actually boolean.

Examples

JScript Example

    /*
       This example demonstrates how to use the ToggleParameterValue() command and
       how to convert string names of parameters to Parameter objects (since the
       GetValue command returns the value of a parameter, not a pointer to it)
    */

    NewScene( null, false )

    var item1 = CreatePrim( "Cube", "MeshSurface" );
    var item2 = CreatePrim( "Cylinder", "MeshSurface" );

    var target = "visibility.ghosting";

    //INFO : Before toggling:
    //INFO : cube.visibility.ghosting = false
    //INFO : cylinder.visibility.ghosting = false
    LogMessage( "Before toggling: ");
    ReadValues( item1 + "." + target );
    ReadValues( item2 + "." + target );

    ToggleParameterValue( item1 + "," + item2, target )

    //INFO : After toggling:
    //INFO : cube.visibility.ghosting = true
    //INFO : cylinder.visibility.ghosting = true
    LogMessage( "After toggling: ");
    ReadValues( item1 + "." + target );
    ReadValues( item2 + "." + target );

    function ReadValues( in_param )
    {
       // First convert the string to a Parameter object
       var new_param = Dictionary.GetObject( in_param );

       // Then wrap the test in a try statement so it doesn't break
       // the script if anything goes wrong
       try {
           if ( ClassName(new_param) == "Parameter" ) {
              LogMessage( new_param.FullName + " = " + new_param.Value );
           }
       } catch(e) {
           LogMessage( "Item to test is not a valid parameter." );
       }
    }
    //

Autodesk Softimage v7.5