ClipRelation

Object Hierarchy | Related C++ Class: ClipRelation

Inheritance

SIObject

ProjectItem

ClipRelation

Introduced

v4.0

Description

The ClipRelation object represents a relationship between two Clip objects in the animation mixer. Clip relations are particularly useful for maintaining a relationship between clips of different types, such as an animation clip and an audio clip. The ClipRelation object provides methods for establishing these links and getting and setting their properties without using the mixer.

By default a clip relation creates relationships among the start offset, clip in and clip out values of the linked clips's TimeControl. Clip relations are bi-directional in the sense that, by modifying the value of one of the related parameters (either on the master or slave clip) it proportionally affects the value of the other clip.

For each individual relationship there's an active state Parameter (StartActiveness, ClipInActiveness and ClipOutActiveness) and an offset. The offset represents the difference between the value of the master clip parameter and the slave clip parameter. Modifying the value of an offset results in changing the value of the slave clip relative to the master clip. You can inverse the master and slave clip by using ClipRelation.SwapMasterAndSlaveClip.

You can create a ClipRelation using ClipContainer.AddRelation and you can access a ClipRelation using either Clip.Relations or ClipContainer.NestedRelations. In order to access the master or slave clip you can use ClipRelation.MasterClip or ClipRelation.SlaveClip.

Methods

AddCustomOp AddICEAttribute AddScriptedOp AddScriptedOpFromFile
AnimatedParameters2 BelongsTo operator EvaluateAt GetICEAttributeFromName
IsA IsAnimated2 IsClassOf operator IsEqualTo operator
IsKindOf IsLocked operator IsSelected operator LockOwners
RemoveICEAttribute SetAsSelected operator SetCapabilityFlag operator SetLock
SwapMasterAndSlaveClip TaggedParameters UnSetLock  
       

Properties

Application BranchFlag operator Capabilities operator Categories
EvaluationID Families operator FullName operator Help
HierarchicalEvaluationID ICEAttributes LockLevel operator LockMasters operator
LockType operator MasterClip Model Name operator
NestedObjects ObjectID Origin OriginPath
Owners PPGLayout operator Parameters operator Parent
Parent3DObject Selected operator SlaveClip Type operator

Examples

JScript Example

/* --------------------------------------------------------------------------------------------------
	This example shows how to create a ClipRelation, how to access its offsets and how modifying
	one makes an impact on the TimeControl of the master and slave clip.
*/
NewScene(null, false);
// Set up scene with a cone and add some animation
CreatePrim("Cone", "MeshSurface", null, null);
Translate(null, 5.57429595406375, 0.195303936039821, -1.95303936039821E-02, 
	siRelative, siView, siObj, siXYZ, null, null, siXYZ, null, null, null, null, null, null, 0);
var myTforms = "cone.kine.local.sclx,cone.kine.local.scly,cone.kine.local.sclz,";
myTforms += "cone.kine.local.rotx,cone.kine.local.roty,cone.kine.local.rotz";
myTforms += "cone.kine.local.posx,cone.kine.local.posy,cone.kine.local.posz";
StoreAction(null, myTforms, 1, "StoredStaticPose", true, 1, 5, false, false);
SelectObj("cone", null, true);
// Add 2 tracks to the mixer and create 2 separate clips for the stored animation
AddTrack("Scene_Root", "Scene_Root", 0, null, null);
AddTrack("Scene_Root", "Scene_Root", 0, null, null);
var myClip = AddClip("Scene_Root", "Sources.Scene_Root.StoredStaticPose", null, 
	"Mixer.Mixer_Anim_Track", 19, null, null, null, null);
var myClip1 = AddClip("Scene_Root", "Sources.Scene_Root.StoredStaticPose", null, 
	"Mixer.Mixer_Anim_Track1", 47, null, null, null, null);
var oRootMixer = ActiveSceneRoot.Mixer;
// Set up a clip relation between the two clips
var myClipRelation = oRootMixer.AddRelation(myClip, myClip1, "myRelation");
LogMessage(">>>Original ClipRelation information.");
Print_ClipRelation_Info(myClipRelation);
LogMessage(">>>Modifying the startoffset value of the ClipRelation.");
myClipRelation.Parameters("StartOffset").value = myClipRelation.Parameters("StartOffset").Value + 3;
Print_ClipRelation_Info(myClipRelation);
LogMessage(">>>Modifying the start value of the TimeControl of the master clip.");
var myMasterClipTC = myClipRelation.MasterClip.TimeControl;
myMasterClipTC.Parameters("StartOffset").Value = myMasterClipTC.Parameters("StartOffset").Value + 4;
Print_ClipRelation_Info(myClipRelation);
LogMessage(">>>Swapping master and slave clip.");
myClipRelation.SwapMasterAndSlaveClip();
Print_ClipRelation_Info(myClipRelation);
LogMessage(">>>Modifying the startoffset value of the ClipRelation.");
myClipRelation.Parameters("StartOffset").Value = myClipRelation.Parameters("StartOffset").Value + 3;
Print_ClipRelation_Info(myClipRelation);
/* --------------------------------------------------------------------------------------------------
	Utility function to print relation information, including its name and offset values.
*/
function Print_ClipRelation_Info( in_ClipRelation )
{
	LogMessage( "The clip relation name is: " + in_ClipRelation.Name );
	// Printing the offset between the master and slave clips
	LogMessage( "The start offset is: " + in_ClipRelation.Parameters("StartOffset").Value );
	LogMessage( "The ClipIn offset is: " + in_ClipRelation.Parameters("ClipInOffset").Value );
	LogMessage( "The ClipOut offset is: " + in_ClipRelation.Parameters("ClipOutOffset").Value );
	// Printing the master clip values
	var masterClip = in_ClipRelation.MasterClip;
	LogMessage( "The master clip name is: " + masterClip.Name );
	var masterTimeControl = masterClip.TimeControl;
	LogMessage( "The master clip start value is: " + masterTimeControl.StartOffset);
	LogMessage( "The master clip ClipIn value is: " + masterTimeControl.ClipIn);
	LogMessage( "The master clip ClipOut value is: " + masterTimeControl.ClipOut );
	// Printing the slave clip values
	var slaveClip = in_ClipRelation.SlaveClip;
	LogMessage( "The slave clip name is: " + slaveClip.Name );
	var slaveTimeControl = slaveClip.TimeControl;
	LogMessage( "The slave clip start value is: " + slaveTimeControl.StartOffset );
	LogMessage( "The slave clip ClipIn value is: " + slaveTimeControl.ClipIn );
	LogMessage( "The slave clip ClipOut value is: " + slaveTimeControl.ClipOut );
	LogMessage( " ");
}

See Also

Clip.Relations ClipContainer.AddRelation AddClipRelation