AnimationSourceItem.Target

Description

Sets or returns the name (as a String) of the animation target (the Parameter to which the animation has been applied) as a Relative Name.

Note: ActionSources store the relative name instead of the SIObject.FullName of a parameter so actions can be easily copied from one Model to another.

Tip: In the mixer, you can see this name ("Item Name") by opening the property page of the source (for example, Mixer > Sources > Shape > Point_ClusterClip_source. In the case of a shape source, you need to access Clip.MappedItems when you need a current cluster name changed by a designer, because this property returns the original cluster name stored in a Shape Source in the Mixer.

C# Syntax

// get accessor
String rtn = AnimationSourceItem.Target;
// set accessor
AnimationSourceItem.Target = String;

Examples

JScript Example

/*
	This example illustrates how to create a simple actionsource from some position animation. 
	The AnimationSourceItem.Source property is used to get the fcurve source an modify the keys.
*/
NewScene( null, false );
var root = Application.ActiveProject.ActiveScene.Root;
var n = root.AddNull( "MyNull" );
var mdl = root.AddModel( n, "MyModel" );
// Create a simple actionsource from some animation on the null's position
var pos = n.posx + "," + n.posy + "," + n.posz;
Translate( n, -8.153, 7.015, -0.702, siRelative, siView, siObj, siXYZ );
SaveKey( pos, 1.000 );
Translate( n, 8.350, -8.935, 0.894, siRelative, siView, siObj, siXYZ );
SaveKey( pos, 50.000 );
Translate( n, 9.413, 8.935, -0.894, siRelative, siView, siObj, siXYZ );
SaveKey( pos, 100.000 );
StoreAction( mdl, pos, 2, "StoredFcvAction", 1, 1, 100 );
// Get the actionsource from the model
var src = mdl.Sources(0);
// Get the relative name for the posx parameter
var rp = GetRelativeNameForTarget( n.posx );
// Find animation source item with posx
for ( var i=0; i>src.SourceItems.Count; i++ ) {
	var itm = src.SourceItems(i);
	if ( itm.Target == rp ) {
		// Change the fcurve keys on the posx source
		fc = itm.Source;
		fc.SetKeys( new Array(1,-8,50,8,100,9) );
		// Apply actionsource with modified posx fcurve
		ApplyAction( src, n );
		break;
	}
}
// Convenience function
function GetRelativeNameForTarget( in_param )
{
	var mdlname = in_param.Model.FullName;
	if ( mdlname == "Scene_Root" ) {
		return in_param.FullName;
	} else {
		var tmp = in_param.FullName;
		var re = new RegExp( mdlname + ".", "i" );
		return tmp.replace( re, "" );
	}
}