public new static FbxAnimCurveNode Create(FbxObject pContainer, string pName)
        {
            global::System.IntPtr cPtr = NativeMethods.FbxAnimCurveNode_Create__SWIG_1(FbxObject.getCPtr(pContainer), pName);
            FbxAnimCurveNode      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimCurveNode(cPtr, false);

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #2
0
        public FbxAnimCurveNode GetCurveNode(bool pCreate)
        {
            global::System.IntPtr cPtr = NativeMethods.FbxProperty_GetCurveNode__SWIG_0(swigCPtr, pCreate);
            FbxAnimCurveNode      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimCurveNode(cPtr, false);

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #3
0
        public FbxAnimCurveNode GetPropertyCurveNode(FbxProperty pProperty, FbxAnimLayer pAnimLayer)
        {
            global::System.IntPtr cPtr = FbxWrapperNativePINVOKE.FbxAnimEvalState_GetPropertyCurveNode(swigCPtr, FbxProperty.getCPtr(pProperty), FbxAnimLayer.getCPtr(pAnimLayer));
            FbxAnimCurveNode      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimCurveNode(cPtr, false);

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        public static FbxAnimCurveNode CreateTypedCurveNode(FbxProperty pProperty, FbxScene pScene)
        {
            global::System.IntPtr cPtr = NativeMethods.FbxAnimCurveNode_CreateTypedCurveNode(FbxProperty.getCPtr(pProperty), FbxScene.getCPtr(pScene));
            FbxAnimCurveNode      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimCurveNode(cPtr, false);

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #5
0
        public FbxAnimCurveNode CreateCurveNode(FbxProperty pProperty)
        {
            global::System.IntPtr cPtr = fbx_wrapperPINVOKE.FbxAnimLayer_CreateCurveNode(swigCPtr, FbxProperty.getCPtr(pProperty));
            FbxAnimCurveNode      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimCurveNode(cPtr, false);

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #6
0
        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());
        }
예제 #7
0
        public void AnimCurveNodeTest_AddChannel_TwoPropertiesOneChannel()
        {
            // given:
            var acn = new FbxAnimCurveNode("");

            // require:
            Assert.AreEqual(0, acn.GetChannelsCount());
            Assert.AreEqual(1, CountProperties(acn));

            // when:
            acn.AddChannel <float>("channel1", 0.0f);

            // then:
            Assert.AreEqual(2, CountProperties(acn));
            Assert.AreEqual(1, acn.GetChannelsCount());
            Assert.AreEqual(0, acn.GetCurveCount(0));

            var prop = acn.GetFirstProperty();

            Assert.True(prop.IsValid());
            prop = acn.GetNextProperty(prop);
            Assert.True(prop.IsValid());
            Assert.AreEqual("channel1", prop.GetName());
        }
예제 #8
0
 public static void ReleaseCurveNode(FbxAnimCurveNode pCurveNode)
 {
     FbxWrapperNativePINVOKE.FbxAnimUtilities_ReleaseCurveNode(FbxAnimCurveNode.getCPtr(pCurveNode));
 }
예제 #9
0
        public override bool Apply(FbxAnimCurveNode pCurveNode, FbxStatus pStatus)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxAnimCurveFilterMatrixConverter_Apply__SWIG_0(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode), FbxStatus.getCPtr(pStatus));

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #10
0
 public static FbxAnimUtilities.CurveNodeIntfce GrabCurveNode(FbxAnimCurveNode pCN)
 {
     FbxAnimUtilities.CurveNodeIntfce ret = new FbxAnimUtilities.CurveNodeIntfce(FbxWrapperNativePINVOKE.FbxAnimUtilities_GrabCurveNode(FbxAnimCurveNode.getCPtr(pCN)), true);
     return(ret);
 }
예제 #11
0
        public override bool NeedApply(FbxAnimCurveNode pCurveNode)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxAnimCurveFilterKeySync_NeedApply__SWIG_5(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode));

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #12
0
        public override bool NeedApply(FbxAnimCurveNode pCurveNode)
        {
            bool ret = fbx_wrapperPINVOKE.FbxAnimCurveFilterGimbleKiller_NeedApply__SWIG_5(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode));

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #13
0
        public virtual bool Apply(FbxAnimCurveNode pCurveNode)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxAnimCurveFilter_Apply__SWIG_5(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode));

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        public void TestBasics()
        {
            // create a curve we can unroll.
            var fbxScene = FbxScene.Create(Manager, "scene");
            var fbxNode  = FbxNode.Create(fbxScene, "node");

            var fbxAnimNode = FbxAnimCurveNode.CreateTypedCurveNode(fbxNode.LclRotation, fbxScene);

            FbxAnimCurve[] fbxAnimCurves =
            {
                fbxAnimNode.CreateCurve(fbxAnimNode.GetName(), Globals.FBXSDK_CURVENODE_COMPONENT_X),
                fbxAnimNode.CreateCurve(fbxAnimNode.GetName(), Globals.FBXSDK_CURVENODE_COMPONENT_Y),
                fbxAnimNode.CreateCurve(fbxAnimNode.GetName(), Globals.FBXSDK_CURVENODE_COMPONENT_Z)
            };

            FbxAnimCurveFilterUnroll filter = new FbxAnimCurveFilterUnroll();

            Assert.That(filter.NeedApply(fbxAnimNode), Is.False, "expected not to need to unroll curves");
            Assert.That(filter.Apply(fbxAnimNode), Is.False, "expected to have nothing to do");

            // ensure coverage for function that takes an FbxStatus
            Assert.That(filter.NeedApply(fbxAnimNode, new FbxStatus()), Is.False);
            Assert.That(filter.Apply(fbxAnimNode, new FbxStatus()), Is.False);

            // configure the unroll condition
            foreach (float[] keydata in KeyTimeValues)
            {
                double seconds = keydata[0];

                foreach (var fbxAnimCurve in fbxAnimCurves)
                {
                    fbxAnimCurve.KeyModifyBegin();
                }

                using (var fbxTime = FbxTime.FromSecondDouble(seconds))
                {
                    for (int ci = 0; ci < fbxAnimCurves.Length; ci++)
                    {
                        int ki = fbxAnimCurves[ci].KeyAdd(fbxTime);
                        fbxAnimCurves[ci].KeySet(ki, fbxTime, keydata[ci + 1]);
                    }
                }

                foreach (var fbxAnimCurve in fbxAnimCurves)
                {
                    fbxAnimCurve.KeyModifyEnd();
                }
            }

            Assert.That(filter.NeedApply(fbxAnimNode), Is.True, "expected to need to unroll curves");
            Assert.That(filter.Apply(fbxAnimNode), Is.True, "expected to have unroll");

            IEnumerator origKeydata = KeyTimeValues.GetEnumerator();

            for (int ki = 0; ki < fbxAnimCurves[0].KeyGetCount(); ki++)
            {
                List <float> result = new List <float>()
                {
                    (float)fbxAnimCurves[0].KeyGetTime(ki).GetSecondDouble()
                };

                result = result.Concat((from ac in fbxAnimCurves select ac.KeyGetValue(ki))).ToList();

                origKeydata.MoveNext();
                if (ki == 0 || ki == 3 || ki == 4)
                {
                    Assert.That(result, Is.EqualTo(origKeydata.Current));
                }
                else
                {
                    Assert.That(result, Is.Not.EqualTo(origKeydata.Current));
                }
            }

            filter.Reset();
            filter.Dispose();
        }
예제 #15
0
        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());
        }
        public override bool Apply(FbxAnimCurveNode pCurveNode, FbxStatus pStatus)
        {
            bool ret = fbx_wrapperPINVOKE.FbxAnimCurveFilterResample_Apply__SWIG_4(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode), FbxStatus.getCPtr(pStatus));

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #17
0
        void Run()
        {
            FbxManager    manager = FbxManager.Create();
            FbxIOSettings setting = FbxIOSettings.Create(manager, "IOSRoot");

            manager.SetIOSettings(setting);

            FbxImporter impoter = FbxImporter.Create(manager, "");

            bool status = impoter.Initialize(@"D:\develop\FbxWrapper\1.fbx", -1, setting);

            Log.Info(status);

            if (!status)
            {
                return;
            }

            FbxScene scene = FbxScene.Create(manager, "scene1");

            status = impoter.Import(scene);
            Log.Info(status);


            int numTrack = scene.GetSrcObjectCount(FbxAnimStack.ClassId);

            Log.Info("num stack " + numTrack);

            FbxObject obj = scene.GetSrcObject(FbxAnimStack.ClassId, 0);

            FbxAnimStack stack = FbxAnimStack.Cast(obj);

            if (stack == null)
            {
                Log.Error("can not get anim stack!");
                return;
            }

            FbxCriteria cri      = FbxCriteria.ObjectTypeStrict(FbxAnimLayer.ClassId);
            int         numLayer = stack.GetMemberCount(cri);

            Log.Info("anim layer count : " + numLayer);

            FbxAnimLayer layer = null;

            if (numLayer > 0)
            {
                FbxObject layerobj = stack.GetMember(cri, 0);
                layer = FbxAnimLayer.Cast(layerobj);
                if (layer == null)
                {
                    Log.Error("anim layer is null!");
                    return;
                }

                Log.Info("anim layer name " + layer.GetName());
            }


            Log.Info("node count " + scene.GetNodeCount());
            for (int i = 0; i < scene.GetNodeCount(); i++)
            {
                FbxNode node = scene.GetNode(i);
                Log.Info("node " + i + " " + node.GetName());

                if (node.LclTranslation.IsAnimated(layer))
                {
                    FbxAnimCurveNode curveNode = node.LclTranslation.GetCurveNode(layer);
                    if (curveNode == null)
                    {
                        Log.Error("curve node is null");
                    }
                    else
                    {
                        for (int c = 0; c < curveNode.GetCurveCount(0); c++)
                        {
                            FbxAnimCurve curve = curveNode.GetCurve(0, (uint)c);
                            if (curve != null)
                            {
                                Log.Info("curve " + curve.GetName());
                                Log.Info("key count " + curve.KeyGetCount());
                                FbxAnimCurveKey key = curve.KeyGet(0);
                                FbxTime         t   = key.GetTime();
                                Log.Info("key " + t.GetTimeString() + " value " + key.GetValue());
                            }
                        }
                    }
                }



                if (node.GetNodeAttribute() != null)
                {
                    Log.Info("got attribu");
                    FbxNodeAttribute att = node.GetNodeAttribute();
                    PrintAttribute(att);
                }
                else
                {
                    Log.Info("att count " + node.GetNodeAttributeCount());
                    for (int j = 0; j < node.GetNodeAttributeCount(); j++)
                    {
                        FbxNodeAttribute att = node.GetNodeAttributeByIndex(j);
                        PrintAttribute(att);
                    }
                }

                FbxVector4    rot = node.GetPostRotation(FbxNode.EPivotSet.eSourcePivot);
                FbxQuaternion q;
            }
        }
예제 #18
0
        // tests that should work for any subclass of FbxProperty
        public static void GenericPropertyTests <T>(T property, FbxObject parent, string propertyName, FbxDataType dataType) where T : FbxProperty
        {
            Assert.IsTrue(property.IsValid());
            Assert.AreEqual(dataType, property.GetPropertyDataType());
            Assert.AreEqual(propertyName, property.GetName());
            Assert.AreEqual(propertyName, property.ToString());
            Assert.AreEqual(propertyName, property.GetHierarchicalName());
            Assert.AreEqual(propertyName, property.GetLabel(true));
            property.SetLabel("label");
            Assert.AreEqual("label", property.GetLabel());
            Assert.AreEqual(parent, property.GetFbxObject());
            Assert.AreEqual(property.GetFbxObject(), parent); // test it both ways just in case equals is busted

            // test the flags using the animatable flag
            property.ModifyFlag(FbxPropertyFlags.EFlags.eAnimatable, true);
            Assert.IsTrue(property.GetFlag(FbxPropertyFlags.EFlags.eAnimatable));
            Assert.AreNotEqual(0, property.GetFlags() | FbxPropertyFlags.EFlags.eAnimatable);
            property.SetFlagInheritType(FbxPropertyFlags.EFlags.eAnimatable, FbxPropertyFlags.EInheritType.eInherit);
            Assert.AreEqual(FbxPropertyFlags.EInheritType.eInherit, property.GetFlagInheritType(FbxPropertyFlags.EFlags.eAnimatable));

            // not clear when this ever returns true: whether we set animatable
            // to true or false it says it has the default value.
            Assert.IsFalse(property.ModifiedFlag(FbxPropertyFlags.EFlags.eAnimatable));

            // Test setting the value with the generic float accessor.
            // The value may not round-trip: a bool property will go to 1.0
            property.Set(5.0f);
            TestGetter(property.GetFloat());
            TestGetter(property.GetBool());
            TestGetter(property.GetDouble());
            TestGetter(property.GetFbxColor());
            TestGetter(property.GetFbxDouble3());
            TestGetter(property.GetString());
            TestGetter(property.GetInt());

            // Test setting the value with color accessor
            property.Set(new FbxColor());

            // test GetCurve(). Just make sure it doesn't crash. We can't
            // generically test actually getting curves, because the details
            // (channel names etc) depend on the type of property and its
            // flags.
            FbxAnimLayer layer = FbxAnimLayer.Create(parent, "layer");

            property.GetCurve(layer);
            property.GetCurve(layer, true);
            property.GetCurve(layer, "asdf");
            property.GetCurve(layer, "asdf", true);
            property.GetCurve(layer, "asdf", "hjkl", true);
            Assert.That(() => { property.GetCurve(null); }, Throws.Exception.TypeOf <System.ArgumentNullException>());

            // test GetCurveNode() (make sure it doesn't crash)
            FbxAnimCurveNode curveNode = property.GetCurveNode();

            Assert.IsNull(curveNode);  // didn't create one so should be null

            curveNode = property.GetCurveNode(true);
            // TODO: figure out why the curve node doesn't get created
            //Assert.IsNotNull (curveNode);

            property.GetCurveNode(FbxAnimStack.Create(parent, "anim stack"));
            property.GetCurveNode(FbxAnimStack.Create(parent, "anim stack"), true);
            property.GetCurveNode(FbxAnimLayer.Create(parent, "anim layer"));
            property.GetCurveNode(FbxAnimLayer.Create(parent, "anim layer"), true);

            Assert.That(() => { property.GetCurveNode((FbxAnimStack)null); }, Throws.Exception.TypeOf <System.ArgumentNullException>());
            Assert.That(() => { property.GetCurveNode((FbxAnimLayer)null); }, Throws.Exception.TypeOf <System.ArgumentNullException>());

            using (FbxManager manager = FbxManager.Create()) {
                // Test ConnectSrcObject functions
                FbxObject obj    = FbxObject.Create(manager, "obj");
                bool      result = property.ConnectSrcObject(obj);
                Assert.IsTrue(result);
                Assert.IsTrue(property.IsConnectedSrcObject(obj));
                Assert.AreEqual(1, property.GetSrcObjectCount());
                Assert.AreEqual(obj, property.GetSrcObject());
                Assert.AreEqual(obj, property.GetSrcObject(0));
                Assert.AreEqual(obj, property.FindSrcObject("obj"));
                Assert.IsNull(property.FindSrcObject("obj", 1));
                Assert.That(() => { property.FindSrcObject(null); }, Throws.Exception.TypeOf <System.ArgumentNullException>());

                Assert.IsTrue(property.DisconnectSrcObject(obj));
                Assert.IsFalse(property.IsConnectedSrcObject(obj));

                Assert.That(() => { property.ConnectSrcObject(null); }, Throws.Exception.TypeOf <System.ArgumentNullException>());

                Assert.IsTrue(property.ConnectSrcObject(obj, FbxConnection.EType.eData));

                Assert.IsTrue(property.DisconnectAllSrcObject());

                // Test ConnectDstObject functions
                result = property.ConnectDstObject(obj);
                Assert.IsTrue(result);
                Assert.IsTrue(property.IsConnectedDstObject(obj));
                Assert.AreEqual(1, property.GetDstObjectCount());
                Assert.AreEqual(obj, property.GetDstObject());
                Assert.AreEqual(obj, property.GetDstObject(0));
                Assert.AreEqual(obj, property.FindDstObject("obj"));
                Assert.IsNull(property.FindDstObject("obj", 1));
                Assert.That(() => { property.FindDstObject(null); }, Throws.Exception.TypeOf <System.ArgumentNullException>());

                Assert.IsTrue(property.DisconnectDstObject(obj));
                Assert.IsFalse(property.IsConnectedDstObject(obj));

                Assert.That(() => { property.ConnectDstObject(null); }, Throws.Exception.TypeOf <System.ArgumentNullException>());

                Assert.IsTrue(property.ConnectDstObject(obj, FbxConnection.EType.eData));

                Assert.IsTrue(property.DisconnectAllDstObject());
            }

            // verify this in the future: will dispose destroy?
            property.Dispose();
        }
예제 #19
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FbxAnimCurveNode obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #20
0
        public bool NeedApply(FbxAnimCurveNode pCurveNode, FbxStatus pStatus)
        {
            bool ret = NativeMethods.FbxAnimCurveFilterUnroll_NeedApply__SWIG_0(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode), FbxStatus.getCPtr(pStatus));

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #21
0
 public static void ReleaseCurveNode(FbxAnimCurveNode pCurveNode)
 {
     fbx_wrapperPINVOKE.FbxAnimUtilities_ReleaseCurveNode(FbxAnimCurveNode.getCPtr(pCurveNode));
 }
예제 #22
0
        public override bool Apply(FbxAnimCurveNode pCurveNode)
        {
            bool ret = fbx_wrapperPINVOKE.FbxAnimCurveFilterScaleCompensate_Apply__SWIG_5(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode));

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #23
0
        public override bool Apply(FbxAnimCurveNode pCurveNode)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxAnimCurveFilterConstantKeyReducer_Apply__SWIG_7(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode));

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #24
0
        public virtual bool Apply(FbxAnimCurveNode pCurveNode)
        {
            bool ret = NativeMethods.FbxAnimCurveFilterUnroll_Apply__SWIG_1(swigCPtr, FbxAnimCurveNode.getCPtr(pCurveNode));

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #25
0
        void Run()
        {
            FbxManager    manager = FbxManager.Create();
            FbxIOSettings setting = FbxIOSettings.Create(manager, "IOSRoot");

            //fbxiosettingspath.h
            //PostProcessSteps.CalculateTangentSpace = #define EXP_TANGENTSPACE				EXP_GEOMETRY "|" IOSN_TANGENTS_BINORMALS
            //PostProcessSteps.JoinIdenticalVertices = #define IOSN_DXF_WELD_VERTICES           "WeldVertices"
            //PostProcessSteps.Triangulate = #define IOSN_TRIANGULATE                "Triangulate"
            //PostProcessSteps.RemoveComponent =
            //PostProcessSteps.GenerateSmoothNormals =
            //setting.AddProperty()
            setting.SetBoolProp("Import|AdvOptGrp|Dxf|WeldVertices", true);
            setting.SetBoolProp("Triangulate", true);

            manager.SetIOSettings(setting);

            FbxImporter impoter = FbxImporter.Create(manager, "");

            bool status = impoter.Initialize(@"1.fbx", -1, setting);

            Log.Info(status);

            if (!status)
            {
                return;
            }

            FbxScene scene = FbxScene.Create(manager, "scene1");

            status = impoter.Import(scene);
            Log.Info(status);


            int numTrack = scene.GetSrcObjectCount(FbxCriteria.ObjectType(FbxAnimStack.ClassId));

            Log.Info("num stack " + numTrack);

            FbxObject obj = scene.GetSrcObject(FbxCriteria.ObjectType(FbxAnimStack.ClassId), 0);

            FbxAnimStack stack = FbxAnimStack.Cast(obj);

            if (stack == null)
            {
                Log.Error("can not get anim stack!");
                return;
            }

            FbxCriteria cri      = FbxCriteria.ObjectTypeStrict(FbxAnimLayer.ClassId);
            int         numLayer = stack.GetMemberCount(cri);

            Log.Info("anim layer count : " + numLayer);

            FbxAnimLayer layer = null;

            if (numLayer > 0)
            {
                FbxObject layerobj = stack.GetMember(cri, 0);
                layer = FbxAnimLayer.Cast(layerobj);
                if (layer == null)
                {
                    Log.Error("anim layer is null!");
                    return;
                }

                Log.Info("anim layer name " + layer.GetName());
            }


            Log.Info("node count " + scene.GetNodeCount());
            for (int i = 0; i < scene.GetNodeCount(); i++)
            {
                FbxNode node = scene.GetNode(i);
                Log.Info("node " + i + " " + node.GetName() + " ChildCount:" + node.GetChildCount());

                //----------------
                //node.LclTranslation.IsAnimated
                //----------------
                //ToDo :

                if (node.LclTranslation.IsAnimated(layer))
                {
                    FbxAnimCurveNode curveNode = node.LclTranslation.GetCurveNode(layer);
                    if (curveNode == null)
                    {
                        Log.Error("curve node is null");
                    }
                    else
                    {
                        for (int c = 0; c < curveNode.GetCurveCount(0); c++)
                        {
                            FbxAnimCurve curve = curveNode.GetCurve(0, (uint)c);
                            if (curve != null)
                            {
                                Log.Info("curve " + curve.GetName());
                                Log.Info("key count " + curve.KeyGetCount());
                                FbxAnimCurveKey key = curve.KeyGet(0);
                                FbxTime         t   = key.GetTime();
                                Log.Info("key " + t.GetTimeString() + " value " + key.GetValue());
                            }
                        }
                    }
                }



                if (node.GetNodeAttribute() != null)
                {
                    Log.Info("got attribu");
                    FbxNodeAttribute att = node.GetNodeAttribute();
                    PrintAttribute(manager, att);
                }
                else
                {
                    Log.Info("att count " + node.GetNodeAttributeCount());
                    for (int j = 0; j < node.GetNodeAttributeCount(); j++)
                    {
                        FbxNodeAttribute att = node.GetNodeAttributeByIndex(j);
                        PrintAttribute(manager, att);
                    }
                }

                FbxVector4    rot = node.GetPostRotation(FbxNode.EPivotSet.eSourcePivot);
                FbxQuaternion q;
            }
        }