Linked Parameters

When you link parameters, you create a relationship between them in which one parameter depends on the animation state of another. In Softimage, you can create simple one-to-one links with one parameter controlling another or you can have multiple parameters controlling one.

After you link parameters, you set the values that you want the parameters to have, relative to a certain condition (when A does this, B does this).

You can link any animatable parameter together—from translation to color—to create some very interesting or unusual animation conditions. For example, you could create a chameleon effect so that when object A approaches object B, it changes color. Basically, if you can animate it, you can link it.

• Simple linked parameters are parameters that are connected in a way defined by an expression.

When you link one parameter to another, a simple relationship is established that makes the value of the one parameter depend on the value of another.

• With multi-linked parameters, you can connect many parameters to one parameter.

This allows you to create more complex relationships, where many parameter inputs are interpolated to create an output for one parameter.

• Orientation-linked parameters let you link an object’s orientation to any animatable parameter.

| Linked parameters actually use three special types of expressions: l_fcv(), l_interp() and l_interpOri(). For more information about linked parameters, see the Softimage user guide.

Simple Links

When you link one parameter to another, you specify that its value is to be controlled by another parameter.

Linked parameters are similar to expressions, but the value of one parameter drives the other as dictated by a function curve rather than by a mathematical formula. They provide you with a quick and easy way to create relationships between parameters without having to work out the mathematical expressions involved.

They are especially useful with custom parameters, such as creating a custom control panel to control a rig with sliders.

Multiple Links

When you link many parameters to one parameter, its value is controlled by a combination of those parameters (many inputs to one output). Unlike simple linked parameters, where the link is represented by a function curve representing the one-to-one relationship, a multi-linked parameter has an interpolator (contained within an expression) that calculates how all the parameters are combined together to come up with a result.

Links to an Object’s Orientation

As well as linking multiple parameters, you can link the orientation of an object to an animatable parameter. You don’t link to the object’s individual Euler X, Y, and Z rotation parameters; instead you link to the “complete” orientation of an object (calculated in quaternion space).

The same interpolation technique used for multiple parameters is also used for linking an object’s orientation to a parameter. The interpolator for multi-linked parameters computes “how far” it is from one of its relative values by using a distance metric; for orientation, the interpolator uses the orientation (or quaternion) distance.

Creating and Accessing Links

When you link parameters you are basically setting an expression on a parameter that uses the path to another parameter in its definition. You can use the SetExpr command to create an expression using one of the following expression functions:

• l_fcv()—simple (one-to-one) link. Only one parameter appears inside parentheses.

• l_interp()—multiple link. List of parameters to link to appears inside parentheses.

• l_interpOri()—link to object’s orientation.

Accessing linked parameters is like accessing any regular parameter. However, because the linked parameters contain an Expression property, you can access its four parameters:

• Active—true by default; setting this parameter to false mutes the link.

• Target—returns the name of the target parameter (that is, the parameter that owns the expression). Read only.

• Definition—this is the real meat of the expression: you can change this string definition if you need to change the link or even remove the link entirely.

• Comment—nothing specified by default.

| While you can edit the definition of an existing expression entirely through the object model, there is no equivalent to the SetExpr command in the object model, and the Expression object does not implement any functionality of its own.

Example: setting and getting expressions on linked parameters

       '-----------------------------------------------------
       '   SETUP
       '
       ' Set up scene with a null, a cube and a disc
       NewScene , false
       set root = ActiveSceneRoot
       set actor1 = root.AddNull()
       set actor2 = root.AddGeometry( "Disc", "MeshSurface" )
       set target = root.AddGeometry( "Cube", "MeshSurface" )

       '-----------------------------------------------------
       '   CREATION
       '
       ' Set up a simple link using an expression with l_fcv()
       SetExpr target.posx, "l_fcv( " & actor1.posx & ")"

       ' Set up a multiple link using an expression with l_interp()
       SetExpr target.sclx, "l_interp( " & actor1.sclx & "," _
                  & actor1.scly & "," & actor1.sclz & " )"

       ' Set up a multiple link using an expression with l_interpOri()
       SetExpr target.rotx, "l_interpOri( " & actor2.rotx & "," _
                  & actor2.roty & "," & actor2.rotz & " )"

       '-----------------------------------------------------
       '   INFO
       '
       ' Get pointers to the linked parameters and print the info
       set lnk1 = target.posx
       TestLinks lnk1
       set lnk2 = target.sclx
       TestLinks lnk2
       set lnk3 = target.rotx
       TestLinks lnk3

       '-----------------------------------------------------
       '   HELPER
       '
       function TestLinks(lnk)
       ' NB: Since the definition is itself a parameter on the
       '     Expression object, we could just as easily assign
       '     a new definition to the expression using 'Value':
       '           expr.Parameters( "definition" ).Value = new_expr
           if TypeName(lnk) <> "Nothing" then
              LogMessage lnk.FullName & " is a " & TypeName(lnk)
              set expr = lnk.Source
              if TypeName(expr) <> "Nothing" then
                  LogMessage vbTab & "Name:" & vbTab & expr.FullName
                  LogMessage vbTab & "Type:" & vbTab & TypeName(expr)
                  LogMessage vbTab & "Definition:" & vbTab _
                     & expr.Parameters( "definition" ).Value
              else
                  LogMessage "No expression found."
              end if
           else
              LogMessage "Could not find linked parameter."
           end if
       end function

       '-----------------------------------------------------
       '   OUTPUT
       '
       'INFO : "cube.kine.local.posx is a Parameter"
       'INFO :  "Name: cube.kine.local.Expression"
       'INFO :  "Type: Expression"
       'INFO :  "Definition: l_fcv( null.kine.local.posx )"
       'INFO : "cube.kine.local.sclx is a Parameter"
       'INFO :  "Name: cube.kine.local.scl.sclx.Expression"
       'INFO :  "Type: Expression"
       'INFO :  "Definition: l_interp( null.kine.local.sclx, null.kine.local.scly, null.kine.local.sclz )"
       'INFO : "cube.kine.local.rotx is a Parameter"
       'INFO :  "Name: cube.kine.local.ori.euler.rotx.Expression"
       'INFO :  "Type: Expression"
       'INFO :  "Definition: l_interpOri( disc.kine.local.rotx, disc.kine.local.roty, disc.kine.local.rotz )"

Autodesk Softimage v7.5