FbxClip.kl

Types

FbxClip (object)

The FbxClip object manages loading animation data from an Fbx file and generating the curve values that can ben be evaluated to drive character poses.

/*
** Example: fbxClip.kl
*/

require Fbx, FbxHelpers;

operator entry(){
  // Load an Fbx file to provide the clip data. 

  FilePath path = FilePath("${FABRIC_SCENE_GRAPH_DIR}/Python/Apps/Resources/Fbx/BendyBox.fbx").expandEnvVars();
  FbxClip fbxClip(path.string());

  // Report a descrition string of the clip contents after loading.
  report(fbxClip.getDesc());

  // Evaluate the clip over time, reporiting the generated clip values
  Vec2 timeRange = fbxClip.getTimeRange();
  report("timeRange:" + timeRange);
  Integer keyIndices[][];
  Integer numSamples = 6;
  for(Integer i=0; i<=numSamples; i++){
    Scalar time = Math_linearInterpolate(timeRange.x, timeRange.y, Scalar(i)/Scalar(numSamples));

    IClipValues clipValues = fbxClip.evaluate(time, keyIndices);
    report("time:" + time);
    report(clipValues.getDesc());
  }
}

/*
** Output:

FbxClip { 
  animationLayerName: 
  Clip:{ 
    Bone002:    KeyframeTrackSet { 
      name: Bone002,
      valueType: Euler,
      flags: 8,
      tracks:[ 
        KeyframeTrack { 
          name: "euler.x",
          color: {r:+1.0,g:+0.0,b:+0.0,a:+1.0},
          defaultValue: +0.0,
          numKeys:3,
        },
        KeyframeTrack { 
          name: "euler.y",
          color: {r:+0.0,g:+1.0,b:+0.0,a:+1.0},
          defaultValue: +0.0,
          numKeys:3,
        },
        KeyframeTrack { 
          name: "euler.z",
          color: {r:+0.0,g:+0.0,b:+1.0,a:+1.0},
          defaultValue: +0.0,
          numKeys:3,
        },
      ],
    },
  }
}

timeRange:{x:+0.0,y:+3.333}
time:+0.0
ClipValues:{ 
  Bone002={v:{x:-0.619608e-5,y:+5.140464e-8,z:+0.745868e-2},w:+1.0} 
}
time:+0.5555
ClipValues:{ 
  Bone002={v:{x:-0.604055e-5,y:-1.382781e-6,z:+0.238494},w:+0.971191} 
}
time:+1.111
ClipValues:{ 
  Bone002={v:{x:-0.55572e-5,y:-2.742279e-6,z:+0.456604},w:+0.889648} 
}
time:+1.6665
ClipValues:{ 
  Bone002={v:{x:-0.477209e-5,y:-0.395253e-5,z:+0.649902},w:+0.760009} 
}
time:+2.222
ClipValues:{ 
  Bone002={v:{x:-0.477116e-5,y:-0.395346e-5,z:+0.650024},w:+0.759887} 
}
time:+2.7775
ClipValues:{ 
  Bone002={v:{x:-0.583846e-5,y:-2.077315e-6,z:+0.349975},w:+0.936767} 
}
time:+3.333
ClipValues:{ 
  Bone002={v:{x:-0.619608e-5,y:+5.140464e-8,z:+0.745868e-2},w:+1.0} 
}

*/

Members

String name  
ITrackSet[String] trackSets  
Integer[][] keyIndices  
String filePath  
FbxHandle handle  
ImporterIdentifier[] identifiers  
String animationLayerName  

Methods

  FbxClip ( in FbxClip other )
  FbxClip ( in FbxHandle handle )
  FbxClip ( in String filePath )
  FbxClip ( in String filePath, in Scalar scaleFactor )
  FbxClip ()
FbxClip clone ? ()
String getDesc ? ( in String indent )
String getDesc ? ()
String getFilePath ? ()
Clip toClip ? ()
IClip toIClip ? ()