IsAnimated

Categories

animation

Description

Returns True if an object has animated parameters.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference. Normally you can get the output arguments via either XSIApplication.ExecuteCommand method (C#) or the ISIVTCollection (scripting languages), but this command already returns a value.

The only available workaround in this case is to create a VBScript custom command which returns both the output arguments and the return value in one array. For details, see What Happens when the Function Already Returns a Value?.

Scripting Syntax

oBoolean = IsAnimated( [InputObj], SourceMask, [BranchFlag], [AnimComponents], [Local] );

Return Value

Boolean

Returns True if the objects have animated parameters, and False otherwise.

Parameters

Parameter Type Description
InputObj String Object to test.

Default Value: Currently selected object

SourceMask siSourceType Type of animation source.

Default Value: siAnySource

BranchFlag siBranchFlag Remove animation from the branch or just the node.

Default Value: siUnspecified

AnimComponents XSICollection Returns the animated parameters.
Local Boolean Specifies whether the animation to gather is local to the object or not. If the flag is true then all animated parameters that come from propagated properties or from intermediate nodes are ignored. Intermediate nodes are nested under the object but are not necessary owned by the object itself. For instance, the camera object nested under a Texture_Projection_Def property is not considered unless the target object is the projection property itself. When the flag is set to false, all parameters are considered.

Default Value: False

Examples

1. VBScript Example

' If an object has animated parameters, output a message
' that looks like this:
'
'       INFORMATION : "cone has the following animated parameters:
'
'               X Parameter (cone.kine.local.posx)
'               Y Parameter (cone.kine.local.posy)
'               Z Parameter (cone.kine.local.posz)"
sub myIsAnimated ()
        dim fcurves, expressions
        dim p, params
        dim object, button
        dim msg
        PickElement "object", "Pick object", "Pick object", object, button
        fcurves = IsAnimated( object, siFcurveSource, siUnspecified, params )
        expressions = IsAnimated( object, siExpressionSource, siUnspecified, params )
        if ( fcurves ) then
                msg = object & " has fcurves for the following parameters: " & Chr(10)
                for each p in params
                        msg = msg & Chr(10) & Chr(9) & p.name & " " & p.type & " (" & p & ")"
                next
                LogMessage msg
        end if
        if ( expressions ) then
                msg = object & " has expressions for the following parameters: " & Chr(10)
                for each p in params
                        msg = msg & Chr(10) & Chr(9) & p.name & " " & p.type & " (" & p & ")"
                next
                LogMessage msg
        end if
        if not ( fcurves or expressions ) then
                LogMessage object & " has no animated parameters"
        end if
end sub
' Remove animation from the parameters on a picked object
sub myRemoveAnimation ()
        dim animated, p, params
        dim object, button
        PickElement "object", "Pick object", "Pick object", object, button
        animated = IsAnimated( object, siAnySource, params )
        if ( animated ) then
                RemoveAnimation params
        end if
end sub

2. JScript Example

// JScript sample showing how to use the object model for getting the animated
// parameters of a 3D object.
var grid = CreatePrim( "Grid", "MeshSurface" );
SaveKey( "/kine.local.pos", null, 1 );
var params = grid.NodeAnimatedParameters( siAnySource );
for ( var i = 0; i < params.Count; i++ )
{
        LogMessage( params(i) );
}

See Also

RemoveAnimation ProjectItem.IsAnimated2 ProjectItem.AnimatedParameters2 X3DObject.IsNodeAnimated X3DObject.NodeAnimatedParameters Parameter.IsAnimated Parameter.AnimatedParameters