public void Property_AttachCurveNode_IsAnimated() { // given: var node = new FbxNode("node"); var acn = new FbxAnimCurveNode("acn"); var x = new FbxAnimCurve("x"); var scene = new FbxScene("scene"); var layer = new FbxAnimLayer("layer"); var stack = new FbxAnimStack("stack"); var time = new FbxTime(0); var key = new FbxAnimCurveKey(time, 1.0f); x.KeyAdd(time, key); scene.ConnectSrcObject(node); scene.ConnectSrcObject(acn); scene.ConnectSrcObject(x); scene.ConnectSrcObject(layer); scene.ConnectSrcObject(stack); layer.ConnectSrcObject(acn); stack.ConnectSrcObject(layer); acn.AddChannel <double>("x", 1.0); acn.ConnectToChannel(x, 0U); // require: Assert.False(node.LclTranslation.IsAnimated()); // when: node.LclTranslation.ConnectSrcObject(acn); // then: Assert.True(node.LclTranslation.IsAnimated()); }
public void Scene_ConnectSrcObject_AddsPose() { // given: var scene = new FbxScene("Scene"); var pose = new FbxPose("Pose"); // require: Assert.AreEqual(3, scene.GetSrcObjectCount()); Assert.AreEqual(scene.GetRootNode(), scene.GetSrcObject(0)); Assert.AreEqual(scene.GetGlobalSettings(), scene.GetSrcObject(1)); Assert.AreEqual(scene.GetAnimationEvaluator(), scene.GetSrcObject(2)); Assert.AreEqual(0, scene.GetDstObjectCount()); Assert.AreEqual(0, scene.GetPoseCount()); Assert.AreEqual(0, pose.GetSrcObjectCount()); Assert.AreEqual(0, pose.GetDstObjectCount()); Assert.AreEqual(null, pose.GetScene()); // when: scene.ConnectSrcObject(pose); // then: Assert.AreEqual(4, scene.GetSrcObjectCount()); Assert.AreEqual(scene.GetRootNode(), scene.GetSrcObject(0)); Assert.AreEqual(scene.GetGlobalSettings(), scene.GetSrcObject(1)); Assert.AreEqual(scene.GetAnimationEvaluator(), scene.GetSrcObject(2)); Assert.AreEqual(pose, scene.GetSrcObject(3)); Assert.AreEqual(0, scene.GetDstObjectCount()); Assert.AreEqual(1, scene.GetPoseCount()); Assert.AreEqual(pose, scene.GetPose(0)); Assert.AreEqual(0, pose.GetSrcObjectCount()); Assert.AreEqual(1, pose.GetDstObjectCount()); Assert.AreEqual(scene, pose.GetDstObject(0)); Assert.AreEqual(scene, pose.GetScene()); }
public void Scene_AddObjectWithSrcObjects_AddsAllSrcObjects() { // given: var scene = new FbxScene("s"); var node = new FbxNode("n"); var m1 = new FbxMesh("m1"); var m2 = new FbxMesh("m2"); var v = new FbxVideo("v"); var c = new FbxCluster("c"); var n2 = new FbxNode("n2"); var c2 = new FbxCluster("c2"); node.ConnectSrcObject(m1); node.ConnectSrcObject(m2); node.ConnectSrcObject(v); node.ConnectSrcObject(c); c.ConnectSrcObject(n2);; n2.ConnectSrcObject(c2); // require: Assert.AreEqual(3, scene.GetSrcObjectCount()); Assert.AreEqual(4, node.GetSrcObjectCount()); Assert.AreSame(m1, node.GetSrcObject(0)); Assert.AreSame(m2, node.GetSrcObject(1)); Assert.AreSame(v, node.GetSrcObject(2)); Assert.AreSame(c, node.GetSrcObject(3)); Assert.AreEqual(0, node.GetDstObjectCount()); Assert.Null(node.GetScene()); Assert.AreEqual(0, m1.GetSrcObjectCount()); Assert.AreEqual(1, m1.GetDstObjectCount()); Assert.AreSame(node, m1.GetDstObject(0)); Assert.Null(m1.GetScene()); Assert.AreEqual(0, m2.GetSrcObjectCount()); Assert.AreEqual(1, m2.GetDstObjectCount()); Assert.AreSame(node, m2.GetDstObject(0)); Assert.Null(m2.GetScene()); Assert.AreEqual(0, v.GetSrcObjectCount()); Assert.AreEqual(1, v.GetDstObjectCount()); Assert.AreSame(node, v.GetDstObject(0)); Assert.Null(v.GetScene()); Assert.AreEqual(1, c.GetSrcObjectCount()); Assert.AreSame(n2, c.GetSrcObject());; Assert.AreEqual(1, c.GetDstObjectCount()); Assert.AreSame(node, c.GetDstObject(0)); Assert.Null(c.GetScene()); Assert.AreEqual(1, n2.GetSrcObjectCount()); Assert.AreSame(c2, n2.GetSrcObject());; Assert.AreEqual(1, n2.GetDstObjectCount()); Assert.AreSame(c, n2.GetDstObject(0)); Assert.Null(n2.GetScene()); Assert.AreEqual(0, c2.GetSrcObjectCount()); Assert.AreEqual(1, c2.GetDstObjectCount()); Assert.AreSame(n2, c2.GetDstObject(0)); Assert.Null(c2.GetScene()); // when: scene.ConnectSrcObject(node); // then: Assert.AreEqual(10, scene.GetSrcObjectCount()); Assert.AreSame(node, scene.GetSrcObject(3)); Assert.AreSame(m1, scene.GetSrcObject(4)); Assert.AreSame(m2, scene.GetSrcObject(5)); Assert.AreSame(v, scene.GetSrcObject(6)); Assert.AreSame(c, scene.GetSrcObject(7)); Assert.AreSame(n2, scene.GetSrcObject(8)); Assert.AreSame(c2, scene.GetSrcObject(9)); Assert.AreEqual(4, node.GetSrcObjectCount()); Assert.AreSame(m1, node.GetSrcObject(0)); Assert.AreSame(m2, node.GetSrcObject(1)); Assert.AreSame(v, node.GetSrcObject(2)); Assert.AreSame(c, node.GetSrcObject(3)); Assert.AreEqual(1, node.GetDstObjectCount()); Assert.AreSame(scene, node.GetDstObject(0)); Assert.AreSame(scene, node.GetScene()); Assert.AreEqual(0, m1.GetSrcObjectCount()); Assert.AreEqual(2, m1.GetDstObjectCount()); Assert.AreSame(node, m1.GetDstObject(0)); Assert.AreSame(scene, m1.GetDstObject(1)); Assert.AreSame(scene, m1.GetScene()); Assert.AreEqual(0, m2.GetSrcObjectCount()); Assert.AreEqual(2, m2.GetDstObjectCount()); Assert.AreSame(node, m2.GetDstObject(0)); Assert.AreSame(scene, m2.GetDstObject(1)); Assert.AreSame(scene, m2.GetScene()); Assert.AreEqual(0, v.GetSrcObjectCount()); Assert.AreEqual(2, v.GetDstObjectCount()); Assert.AreSame(node, v.GetDstObject(0)); Assert.AreSame(scene, v.GetDstObject(1)); Assert.AreSame(scene, v.GetScene()); Assert.AreEqual(1, c.GetSrcObjectCount()); Assert.AreSame(n2, c.GetSrcObject(0)); Assert.AreEqual(2, c.GetDstObjectCount()); Assert.AreSame(node, c.GetDstObject(0)); Assert.AreSame(scene, c.GetDstObject(1)); Assert.AreSame(scene, c.GetScene()); Assert.AreEqual(1, n2.GetSrcObjectCount()); Assert.AreSame(c2, n2.GetSrcObject());; Assert.AreEqual(2, n2.GetDstObjectCount()); Assert.AreSame(c, n2.GetDstObject(0)); Assert.AreSame(scene, n2.GetDstObject(1)); Assert.AreSame(scene, n2.GetScene()); Assert.AreEqual(0, c2.GetSrcObjectCount()); Assert.AreEqual(2, c2.GetDstObjectCount()); Assert.AreSame(n2, c2.GetDstObject(0)); Assert.AreSame(scene, c2.GetDstObject(1)); Assert.AreSame(scene, c2.GetScene()); }
public void Property_MultipleStacks_GetCurveNodeOnlyGetsCurvesOnTheCurrentStack() { // given: var node = new FbxNode("node"); var scene = new FbxScene("scene"); var acn1 = new FbxAnimCurveNode("acn1"); var ac1 = new FbxAnimCurve("ac1"); var layer1 = new FbxAnimLayer("layer1"); var stack1 = new FbxAnimStack("stack1"); var acn2 = new FbxAnimCurveNode("acn2"); var ac2 = new FbxAnimCurve("ac2"); var layer2 = new FbxAnimLayer("layer2"); var stack2 = new FbxAnimStack("stack2"); var time = new FbxTime(0); var key = new FbxAnimCurveKey(time, 1.0f); ac1.KeyAdd(time, key); var time2 = new FbxTime(0); var key2 = new FbxAnimCurveKey(time2, 1.0f); ac2.KeyAdd(time2, key2); scene.ConnectSrcObject(node); scene.ConnectSrcObject(acn1); scene.ConnectSrcObject(ac1); scene.ConnectSrcObject(layer1); scene.ConnectSrcObject(stack1); scene.ConnectSrcObject(acn2); scene.ConnectSrcObject(ac2); scene.ConnectSrcObject(layer2); scene.ConnectSrcObject(stack2); acn1.AddChannel <double>("x", 1.0); acn1.ConnectToChannel(ac1, 0U); layer1.ConnectSrcObject(acn1); stack1.ConnectSrcObject(layer1); acn2.AddChannel <double>("y", -1.0); acn2.ConnectToChannel(ac2, 0U); layer2.ConnectSrcObject(acn2); stack2.ConnectSrcObject(layer2); scene.SetCurrentAnimationStack(stack1); node.LclTranslation.ConnectSrcObject(acn1); node.LclRotation.ConnectSrcObject(acn2); // require: Assert.AreSame(stack1, scene.GetCurrentAnimationStack()); Assert.AreSame(acn1, node.LclTranslation.GetCurveNode()); Assert.Null(node.LclRotation.GetCurveNode()); // when: scene.SetCurrentAnimationStack(stack2); // then: Assert.Null(node.LclTranslation.GetCurveNode()); Assert.AreSame(acn2, node.LclRotation.GetCurveNode()); }