SetRelativeValues
 
 
 

SetRelativeValues

Description

Sets a key on the parameter function curve if the parameter is single-linked (l_fcv) or sets a set of relative values in the Interpolator object if the parameter is multiple-linked (l_interp) or object's orientation linked (l_interpOri).

An Interpolator object is created when linking a parameter with multiple driving parameters or with an object's orientation. It is used to access and store sets of relative values.

If A is single-linked with B, then there is a link function curve that animates the value of A as the value of B changes. On this function curve, the Y axis represents values of A, and the X axis represents values of B. SetRelativeValues "A" sets a key on this function curve using the current values of A and B.

Scripting Syntax

SetRelativeValues( [InputObj] );

Parameters

Parameter Type Description
InputObj String Parameter that is linked with (controlled by) another parameter.

Default Value: Currently selected and marked parameters

Examples

1. VBScript Example

' This example shows that relative values of a single-linked parameter (l_fcv) are represented by an FCurve function.
NewScene, false
CreatePrim "Cone", "MeshSurface"
CreatePrim "Cube", "MeshSurface"
SetExpr "cube.kine.local.posx", "l_fcv( cone.kine.global.posx )"
SetValue "cone.kine.local.posx", 1
SetValue "cube.kine.local.posx", 2.5
SetRelativeValues "cube.kine.local.posx"
SetValue "cone.kine.local.posx", 3
SetValue "cube.kine.local.posx", 4
SetRelativeValues "cube.kine.local.posx"
OpenView "Animation Editor"

2. VBScript Example

' This example shows that relative values of a multiple-linked parameter (l_interp) are stored in the Interpolator object.
NewScene, false
CreatePrim "Cone", "MeshSurface"
CreatePrim "Cube", "MeshSurface"
SetExpr "cube.kine.local.posx", "l_interp( cone.kine.global.posx, cone.kine.global.posy )"
SetValue "cone.kine.local.posx", 1.5
SetValue "cone.kine.local.posy", 2
SetValue "cube.kine.local.posx", 2.5
SetRelativeValues "cube.kine.local.posx"
SetValue "cone.kine.local.posx", 3
SetValue "cone.kine.local.posy", 3.5
SetValue "cube.kine.local.posx", 4
SetRelativeValues "cube.kine.local.posx"
numKeys = GetNumRelativeValues( "cube.kine.local.Expression.Interpolator" )
Application.LogMessage "The Interpolator object has " & numKeys & " sets of relative values"
for i = 0 to numKeys - 1
        Application.LogMessage "---------------------------"
        Application.LogMessage "Relative values set #" & i & ":"
        values = GetRelativeValue( "cube.kine.local.Expression.Interpolator", i )
        j = 0
        for each item in values
                if (j = 0) then
                        Application.LogMessage "Controlled value = " & item
                else
                        Application.LogMessage "Controlling #" & j & " value = " & item
                end if
                j = j + 1
        next
next
' INFO : The Interpolator object has 3 sets of relative values
' INFO : ---------------------------
' INFO : Relative values set #0:
' INFO : Controlled value = 0
' INFO : Controlling #1 value = 0
' INFO : Controlling #2 value = 0
' INFO : ---------------------------
' INFO : Relative values set #1:
' INFO : Controlled value = 2.5
' INFO : Controlling #1 value = 1.5
' INFO : Controlling #2 value = 2
' INFO : ---------------------------
' INFO : Relative values set #2:
' INFO : Controlled value = 4
' INFO : Controlling #1 value = 3
' INFO : Controlling #2 value = 3.5

3. VBScript Example

' This example shows how to deal with sets of relative values with an object's orientation linked parameter (l_interpOri).
NewScene , False
CreatePrim "Cone", "MeshSurface"
CreatePrim "Cube", "MeshSurface"
SetExpr "cube.kine.local.posx", "l_interpOri( cone.kine.local.rotx, cone.kine.local.roty, cone.kine.local.rotz )"
SetValue "cube.kine.local.posx", 2.5
SetValue "cone.kine.local.rotx", 45
SetRelativeValues "cube.kine.local.posx"
SetValue "cube.kine.local.posx", 5.5
SetValue "cone.kine.local.rotx", 90
SetRelativeValues "cube.kine.local.posx"
numKeys = GetNumRelativeValues( "cube.kine.local.Expression.Interpolator" )
Application.LogMessage "The Interpolator object has " & numKeys & " sets of relative values"
for i = 0 to numKeys - 1
        Application.LogMessage "---------------------------"
        Application.LogMessage "Relative values set #" & i & ":"
        values = GetRelativeValue( "cube.kine.local.Expression.Interpolator", i )
        Application.LogMessage "Controlled value (cube.kine.local.posx) : " & values(0)
        set quaternion = XSIMath.CreateQuaternion( values(1), values(2), values(3), values(4) )
        eulerValues = quaternion.GetXYZAngleValues2()
        Application.LogMessage "Controlling #1 value (cone.kine.local.rotx) : " & XSIMath.RadiansToDegrees( eulerValues(0) )
        Application.LogMessage "Controlling #2 value (cone.kine.local.roty) : " & XSIMath.RadiansToDegrees( eulerValues(1) )
        Application.LogMessage "Controlling #3 value (cone.kine.local.rotz) : " & XSIMath.RadiansToDegrees( eulerValues(2) )
next
' INFO : The Interpolator object has 3 sets of relative values
' INFO : ---------------------------
' INFO : Relative values set #0:
' INFO : Controlled value (cube.kine.local.posx) : 0
' INFO : Controlling #1 value (cone.kine.local.rotx) : 0
' INFO : Controlling #2 value (cone.kine.local.roty) : 0
' INFO : Controlling #3 value (cone.kine.local.rotz) : 0
' INFO : ---------------------------
' INFO : Relative values set #1:
' INFO : Controlled value (cube.kine.local.posx) : 2.5
' INFO : Controlling #1 value (cone.kine.local.rotx) : 45
' INFO : Controlling #2 value (cone.kine.local.roty) : 0
' INFO : Controlling #3 value (cone.kine.local.rotz) : 0
' INFO : ---------------------------
' INFO : Relative values set #2:
' INFO : Controlled value (cube.kine.local.posx) : 5.5
' INFO : Controlling #1 value (cone.kine.local.rotx) : 90
' INFO : Controlling #2 value (cone.kine.local.roty) : 0
' INFO : Controlling #3 value (cone.kine.local.rotz) : 0

See Also

AddExpr SetExpr GetRelativeValue GetNumRelativeValues RemoveRelativeValue RemoveAnimation Expression Parameter