Object Hierarchy | Related C++ Class: ClipEffect
ClipEffect
v4.0
The ClipEffect object represents the set of effects associated with a clip. Each ClipEffect
object contains one item corresponding to a MappedItem. These
ClipEffectItems contain expressions that control the clip without affecting
the Source on which the clip was instantiated. For example, you can create a
walk cycle with a progressive offset by using an expression similar to this: '(cid * 10) + this'
ClipEffects are available from the Clip object using the Clip.Effect property.
Application | Categories | FullName | Help |
IsActive | IsPoseEffectActive | Items | Name |
NestedObjects | Origin | OriginPath | Parent |
PoseEffect | TimeReference | Type | Variables |
oRoot = Application.ActiveSceneRoot oCube = oRoot.AddGeometry("Cube", "MeshSurface") #Creating the first animation source oSource = Application.StoreAction(oRoot, "cube.kine.local.posx,cube.kine.local.posy,cube.kine.local.posz", 1, "StoredStaticPose", 1, 1, 5, 0, 0) #Creating the first clip oClip = Application.AddClip(oRoot, oSource) for i in range(oClip.MappedItems.Count): oCurrMappedItem = oClip.MappedItems(i) oParam = oCurrMappedItem.Destination if oParam.FullName == "cube.kine.local.posy": Application.SetMappingRule(oClip.FullName + ".ActionClip",oParam,"frame",i+1) break Application.LogMessage("The expression associated with the posy item is " + oCurrMappedItem.ClipEffectItem.Expression) |
/* This example demonstrates how to get at the ClipEffect objects by creating some sources and clips with clip effects and then finding them again through the mapped items on the clips in the mixer. */ NewScene( ActiveProject, false ); // Set up some sources and clips in the scene (see end of example for details) CreateFCurveAction( ActiveSceneRoot ); // Get all the clips in the mixer and then the sources var clips = ActiveSceneRoot.Mixer.Clips; for ( var i=0; i<clips.Count; i++ ) { // Look at their mapped items, but avoid the audio clips if ( clips(i).Type != siClipAudioType && clips(i).MappedItems ) { var clp = clips(i); LogMessage( "Found " + clp.MappedItems.Count + " mapped items(s)" ); for ( var j=0; j<clp.MappedItems.Count; j++ ) { var mapping = clp.MappedItems(j); if ( mapping.ClipEffectItem.Expression != "" ) { LogMessage( "\t...this clip has a clip effect item matching this expression:" ); LogMessage( "\t\t" + mapping.ClipEffectItem.Expression ); } LogMessage( "\t...destination parameter: " + mapping.Destination ); } } } // Expected results: //INFO : Found 3 mapped items(s) //INFO : ...this clip has a clip effect item matching this expression: //INFO : this+5 //INFO : ...destination parameter: null.kine.local.sclx //INFO : ...destination parameter: null.kine.local.scly //INFO : ...destination parameter: null.kine.local.sclz // Convenience function function CreateFCurveAction( in_model ) { var obj = in_model.AddNull(); // Set FCurves on the null's scaling var keys = new Array( 5, 1.2, 20, 1.7, 45, 2.0, 90, 2.5 ); obj.sclx.AddFCurve2( keys ); var keyfactor = Math.random() * 10; var posfactor = Math.random(); for ( var i=0; i<keys.length; i=i+2 ) { keys[i] = keys[i] + keyfactor; keys[i+1] = keys[i+1] * posfactor; } obj.scly.AddFCurve2( keys ); var keyfactor = Math.random() * 10; var posfactor = Math.random(); for ( var i=0; i<keys.length; i=i+2 ) { keys[i] = keys[i] - keyfactor; keys[i+1] = keys[i+1] * posfactor; } obj.sclz.AddFCurve2( keys ); // Get list of parameters to mark var params = obj.sclx.FullName + ","; params += obj.scly.FullName + ","; params += obj.sclz.FullName; // Make the FCurves into an Action var src = StoreAction( in_model, params, 2, "StoredAnimFCrvAction" ); var clip = AddClip( in_model, src ); // Add some clip effects to it var toclip = clip+".ActionClip"; var rtn = GetMappingRule( toclip, 0 ); var from = rtn.Value( "From" ); SetMappingRule( toclip, from, "this+5", 1 ); } |