protected override void CheckScene(FbxScene scene) { FbxScene origScene = CreateScene(FbxManager); FbxNode origAnimNode = origScene.GetRootNode().GetChild(0); FbxNode importAnimNode = scene.GetRootNode().GetChild(0); Assert.AreEqual(origScene.GetRootNode().GetChildCount(), scene.GetRootNode().GetChildCount()); Assert.IsNotNull(origAnimNode); Assert.IsNotNull(importAnimNode); Assert.AreEqual(origAnimNode.GetName(), importAnimNode.GetName()); FbxAnimStack origStack = origScene.GetCurrentAnimationStack(); FbxAnimStack importStack = scene.GetCurrentAnimationStack(); CheckAnimStack(origStack, importStack); FbxAnimLayer origLayer = origStack.GetAnimLayerMember(); FbxAnimLayer importLayer = importStack.GetAnimLayerMember(); Assert.IsNotNull(origLayer); Assert.IsNotNull(importLayer); Assert.AreEqual(FbxTime.EMode.eFrames30, scene.GetGlobalSettings().GetTimeMode()); CheckAnimCurve(origAnimNode, importAnimNode, origLayer, importLayer, PropertyComponentList); }
public new static FbxAnimStack Create(FbxObject pContainer, string pName) { global::System.IntPtr cPtr = fbx_wrapperPINVOKE.FbxAnimStack_Create__SWIG_1(FbxObject.getCPtr(pContainer), pName); FbxAnimStack ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimStack(cPtr, false); return(ret); }
public FbxAnimCurveNode GetCurveNode(FbxAnimStack pAnimStack) { global::System.IntPtr cPtr = FbxWrapperNativePINVOKE.FbxProperty_GetCurveNode__SWIG_3(swigCPtr, FbxAnimStack.getCPtr(pAnimStack)); FbxAnimCurveNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimCurveNode(cPtr, false); return(ret); }
public new static FbxAnimStack Create(FbxManager pManager, string pName) { global::System.IntPtr cPtr = FbxWrapperNativePINVOKE.FbxAnimStack_Create__SWIG_0(FbxManager.getCPtr(pManager), pName); FbxAnimStack ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimStack(cPtr, false); return(ret); }
public static FbxAnimStack Cast(FbxObject arg0) { global::System.IntPtr cPtr = FbxWrapperNativePINVOKE.FbxAnimStack_Cast(FbxObject.getCPtr(arg0)); FbxAnimStack ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimStack(cPtr, false); return(ret); }
public FbxAnimStack GetCurrentAnimationStack() { global::System.IntPtr cPtr = FbxWrapperNativePINVOKE.FbxScene_GetCurrentAnimationStack(swigCPtr); FbxAnimStack ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimStack(cPtr, false); return(ret); }
protected override FbxScene CreateScene(FbxManager manager) { // Create a scene with a single node that has an animation clip // attached to it FbxScene scene = FbxScene.Create(manager, "myScene"); FbxNode animNode = FbxNode.Create(scene, "animNode"); // setup anim stack FbxAnimStack fbxAnimStack = CreateAnimStack(scene); // add an animation layer FbxAnimLayer fbxAnimLayer = FbxAnimLayer.Create(scene, "animBaseLayer"); fbxAnimStack.AddMember(fbxAnimLayer); // set up the translation CreateAnimCurves( animNode, fbxAnimLayer, PropertyComponentList, (index) => { return(index * 2.0); }, (index) => { return(index * 3.0f - 1); } ); // TODO: avoid needing to this by creating typemaps for // FbxObject::GetSrcObjectCount and FbxCast. // Not trivial to do as both fbxobject.i and fbxemitter.i // have to be moved up before the ignore all statement // to allow use of templates. scene.SetCurrentAnimationStack(fbxAnimStack); scene.GetRootNode().AddChild(animNode); return(scene); }
public void FbxAnimStack_Create_HasNamespacePrefix() { // given: var obj = new FbxAnimStack("asdf"); // then: Assert.AreEqual("AnimStack::", obj.GetNameSpacePrefix()); }
public static void GetAllAnimCurves(FbxObject pObj, FbxAnimStack pAnimStack, SWIGTYPE_p_FbxArrayT_FbxAnimCurve_p_t pCurves) { fbx_wrapperPINVOKE.GetAllAnimCurves__SWIG_1(FbxObject.getCPtr(pObj), FbxAnimStack.getCPtr(pAnimStack), SWIGTYPE_p_FbxArrayT_FbxAnimCurve_p_t.getCPtr(pCurves)); if (fbx_wrapperPINVOKE.SWIGPendingException.Pending) { throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve(); } }
public bool Equals(FbxAnimStack other) { if (object.ReferenceEquals(other, null)) { return(false); } return(this.swigCPtr.Handle.Equals(other.swigCPtr.Handle)); }
public void ConvertPivotAnimationRecursive(FbxAnimStack pAnimStack, FbxNode.EPivotSet pConversionTarget, double pFrameRate) { NativeMethods.FbxNode_ConvertPivotAnimationRecursive__SWIG_1(swigCPtr, FbxAnimStack.getCPtr(pAnimStack), (int)pConversionTarget, pFrameRate); if (NativeMethods.SWIGPendingException.Pending) { throw NativeMethods.SWIGPendingException.Retrieve(); } }
public void SetCurrentAnimationStack(FbxAnimStack pAnimStack) { NativeMethods.FbxScene_SetCurrentAnimationStack(swigCPtr, FbxAnimStack.getCPtr(pAnimStack)); if (NativeMethods.SWIGPendingException.Pending) { throw NativeMethods.SWIGPendingException.Retrieve(); } }
/// <summary> /// Exports all animation /// </summary> private void ExportAnimationClip(AnimationClip unityAnimClip, GameObject unityRoot, FbxScene fbxScene) { if (unityAnimClip == null) { return; } // setup anim stack FbxAnimStack fbxAnimStack = FbxAnimStack.Create(fbxScene, unityAnimClip.name); fbxAnimStack.Description.Set("Animation Take: " + unityAnimClip.name); // add one mandatory animation layer FbxAnimLayer fbxAnimLayer = FbxAnimLayer.Create(fbxScene, "Animation Base Layer"); fbxAnimStack.AddMember(fbxAnimLayer); // Set up the FPS so our frame-relative math later works out // Custom frame rate isn't really supported in FBX SDK (there's // a bug), so try hard to find the nearest time mode. FbxTime.EMode timeMode = FbxTime.EMode.eCustom; double precision = 1e-6; while (timeMode == FbxTime.EMode.eCustom && precision < 1000) { timeMode = FbxTime.ConvertFrameRateToTimeMode(unityAnimClip.frameRate, precision); precision *= 10; } if (timeMode == FbxTime.EMode.eCustom) { timeMode = FbxTime.EMode.eFrames30; } FbxTime.SetGlobalTimeMode(timeMode); // set time correctly var fbxStartTime = FbxTime.FromSecondDouble(0); var fbxStopTime = FbxTime.FromSecondDouble(unityAnimClip.length); fbxAnimStack.SetLocalTimeSpan(new FbxTimeSpan(fbxStartTime, fbxStopTime)); foreach (EditorCurveBinding unityCurveBinding in AnimationUtility.GetCurveBindings(unityAnimClip)) { Object unityObj = AnimationUtility.GetAnimatedObject(unityRoot, unityCurveBinding); if (!unityObj) { continue; } AnimationCurve unityAnimCurve = AnimationUtility.GetEditorCurve(unityAnimClip, unityCurveBinding); if (unityAnimCurve == null) { continue; } ExportAnimCurve(unityObj, unityAnimCurve, unityCurveBinding.propertyName, fbxAnimLayer); } }
protected void CheckAnimStack(FbxAnimStack origStack, FbxAnimStack importStack) { Assert.IsNotNull(origStack); Assert.IsNotNull(importStack); Assert.AreEqual(origStack.GetName(), importStack.GetName()); Assert.AreEqual(origStack.Description.Get(), importStack.Description.Get()); Assert.AreEqual(origStack.GetMemberCount(), importStack.GetMemberCount()); Assert.AreEqual(origStack.GetLocalTimeSpan(), importStack.GetLocalTimeSpan()); }
public FbxAnimStack GetCurrentAnimationStack() { global::System.IntPtr cPtr = NativeMethods.FbxScene_GetCurrentAnimationStack(swigCPtr); FbxAnimStack ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimStack(cPtr, false); if (NativeMethods.SWIGPendingException.Pending) { throw NativeMethods.SWIGPendingException.Retrieve(); } return(ret); }
public new static FbxAnimStack Create(FbxObject pContainer, string pName) { global::System.IntPtr cPtr = NativeMethods.FbxAnimStack_Create__SWIG_1(FbxObject.getCPtr(pContainer), pName); FbxAnimStack ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimStack(cPtr, false); if (NativeMethods.SWIGPendingException.Pending) { throw NativeMethods.SWIGPendingException.Retrieve(); } return(ret); }
public FbxAnimCurveNode GetCurveNode(FbxAnimStack pAnimStack) { global::System.IntPtr cPtr = NativeMethods.FbxProperty_GetCurveNode__SWIG_3(swigCPtr, FbxAnimStack.getCPtr(pAnimStack)); FbxAnimCurveNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxAnimCurveNode(cPtr, false); if (NativeMethods.SWIGPendingException.Pending) { throw NativeMethods.SWIGPendingException.Retrieve(); } return(ret); }
protected override FbxScene CreateScene(FbxManager manager) { FbxScene scene = base.CreateScene(manager); FbxNode lightNode = scene.GetRootNode().GetChild(0); FbxLight light = FbxLight.Create(scene, "light"); light.LightType.Set(FbxLight.EType.eSpot); light.InnerAngle.Set(20); light.OuterAngle.Set(95); // Export bounceIntensity as custom property ExportFloatProperty(lightNode, 3, "bounceIntensity"); light.Color.Set(new FbxDouble3(0.3, 0.1, 0.75)); // Export colorTemperature as custom property ExportFloatProperty(lightNode, 6, "colorTemperature"); light.FileName.Set("/path/to/texture.png"); light.DrawGroundProjection.Set(true); light.DrawVolumetricLight.Set(true); light.DrawFrontFacingVolumetricLight.Set(false); ExportFloatProperty(lightNode, 4.2f, "cookieSize"); light.Intensity.Set(120); light.FarAttenuationStart.Set(0.01f /* none zero start */); light.FarAttenuationEnd.Set(9.8f); light.CastShadows.Set(true); FbxAnimStack animStack = scene.GetCurrentAnimationStack(); FbxAnimLayer animLayer = animStack.GetAnimLayerMember(); // TODO: (UNI-19438) figure out why trying to add anim curves to FbxNodeAttribute.sColor, // Intensity and InnerAngle fails // add animation CreateAnimCurves(lightNode, animLayer, new List <PropertyComponentPair> () { new PropertyComponentPair("colorTemperature", new string[] { null }), new PropertyComponentPair("cookieSize", new string[] { null }) }, (index) => { return((index + 1) / 2.0); }, (index) => { return(index % 2); }); // set ambient lighting scene.GetGlobalSettings().SetAmbientColor(new FbxColor(0.1, 0.2, 0.3)); lightNode.SetNodeAttribute(light); scene.GetRootNode().AddChild(lightNode); return(scene); }
public AnimationTrackInfo(FbxAnimStack pAnimStack, FbxNode pRootNode) { Name = pAnimStack.GetName(); //Duration = GetAnimationMaxTime(pRootNode, pAnimStack); int animLayersNum = FbxExtensions.GetAnimLayerCount(pAnimStack); mLayers = new List <FbxAnimLayer>(); for (int j = 0; j < animLayersNum; j++) { FbxAnimLayer pAnimLayer = FbxExtensions.GetAnimLayer(pAnimStack, j); mLayers.Add(pAnimLayer); } }
//void EnumerateNodeRecursive(FbxNode pNode) //{ // FbxMesh pMesh; // if (IsNodeMesh(pNode, out pMesh)) // { // CreateMaterialsFromNode(pNode); // CreateMeshesFromNode(pNode, pMesh); // } // for (int j = 0; j < pNode.GetChildCount(); j++) // EnumerateNodeRecursive(pNode.GetChild(j)); //} void LoadAnimations(FbxScene scene) { FbxTime.EMode timeMode = scene.GetGlobalSettings().GetTimeMode(); FrameRate = FbxTime.GetFrameRate(timeMode); int animationCount = FbxExtensions.GetAnimStackCount(scene); AnimationTracks = new List <AnimationTrackInfo>(); for (int i = 0; i < animationCount; i++) { FbxAnimStack pAnimStack = FbxExtensions.GetAnimStack(scene, i); AnimationTrackInfo pAnimationTrack = new AnimationTrackInfo(pAnimStack, scene.GetRootNode()); AnimationTracks.Add(pAnimationTrack); } }
public void TestSetCurrentAnimStack() { using (FbxScene newScene = FbxScene.Create(Manager, "")) { FbxAnimStack animStack = FbxAnimStack.Create(Manager, ""); newScene.SetCurrentAnimationStack(animStack); Assert.AreEqual(animStack, newScene.GetCurrentAnimationStack()); // test null Assert.That(() => { newScene.SetCurrentAnimationStack(null); }, Throws.Exception.TypeOf <System.ArgumentNullException>()); // test invalid animStack.Destroy(); Assert.That(() => { newScene.SetCurrentAnimationStack(animStack); }, Throws.Exception.TypeOf <System.ArgumentNullException>()); } }
protected FbxAnimStack CreateAnimStack(FbxScene scene) { FbxAnimStack fbxAnimStack = FbxAnimStack.Create(scene, "animClip"); fbxAnimStack.Description.Set("Animation Take"); FbxTime.EMode timeMode = FbxTime.EMode.eFrames30; scene.GetGlobalSettings().SetTimeMode(timeMode); // set time correctly var fbxStartTime = FbxTime.FromSecondDouble(0); var fbxStopTime = FbxTime.FromSecondDouble(25); fbxAnimStack.SetLocalTimeSpan(new FbxTimeSpan(fbxStartTime, fbxStopTime)); return(fbxAnimStack); }
protected override void CheckScene(FbxScene scene) { base.CheckScene(scene); FbxScene origScene = CreateScene(FbxManager); FbxNode origLightNode = origScene.GetRootNode().GetChild(0); FbxNode importLightNode = scene.GetRootNode().GetChild(0); Assert.IsNotNull(origLightNode); Assert.IsNotNull(importLightNode); FbxLight origLight = origLightNode.GetLight(); FbxLight importLight = importLightNode.GetLight(); Assert.IsNotNull(origLight); Assert.IsNotNull(importLight); Assert.AreEqual(origLight.GetName(), importLight.GetName()); // Check properties CheckProperties( origLightNode, importLightNode, origLight, importLight, new string[] { "bounceIntensity", "colorTemperature", "cookieSize" } ); // Check anim FbxAnimStack origAnimStack = origScene.GetCurrentAnimationStack(); FbxAnimLayer origAnimLayer = origAnimStack.GetAnimLayerMember(); Assert.IsNotNull(origAnimStack); Assert.IsNotNull(origAnimLayer); FbxAnimStack importAnimStack = scene.GetCurrentAnimationStack(); FbxAnimLayer importAnimLayer = importAnimStack.GetAnimLayerMember(); Assert.IsNotNull(importAnimStack); Assert.IsNotNull(importAnimLayer); // TODO: (UNI-19438) figure out why trying to add anim curves to FbxNodeAttribute.sColor, // Intensity and InnerAngle fails CheckAnimCurve(origLightNode, importLightNode, origAnimLayer, importAnimLayer, new List <PropertyComponentPair>() { new PropertyComponentPair("colorTemperature", new string[] { null }), new PropertyComponentPair("cookieSize", new string[] { null }) }, origLight, importLight); }
protected override void CheckScene(FbxScene scene) { base.CheckScene(scene); FbxScene origScene = CreateScene(FbxManager); FbxNode origCameraNode = origScene.GetRootNode().GetChild(0); FbxNode importCameraNode = scene.GetRootNode().GetChild(0); Assert.IsNotNull(origCameraNode); Assert.IsNotNull(importCameraNode); Assert.AreEqual(origScene.GetGlobalSettings().GetDefaultCamera(), scene.GetGlobalSettings().GetDefaultCamera()); FbxCamera origCamera = origCameraNode.GetCamera(); FbxCamera importCamera = importCameraNode.GetCamera(); Assert.IsNotNull(origCamera); Assert.IsNotNull(importCamera); CheckCameraSettings(origCamera, importCamera, origCameraNode, importCameraNode); // check anim FbxAnimStack origAnimStack = origScene.GetCurrentAnimationStack(); FbxAnimLayer origAnimLayer = origAnimStack.GetAnimLayerMember(); Assert.IsNotNull(origAnimStack); Assert.IsNotNull(origAnimLayer); FbxAnimStack importAnimStack = scene.GetCurrentAnimationStack(); FbxAnimLayer importAnimLayer = importAnimStack.GetAnimLayerMember(); Assert.IsNotNull(importAnimStack); Assert.IsNotNull(importAnimLayer); CheckAnimCurve(origCameraNode, importCameraNode, origAnimLayer, importAnimLayer, new List <PropertyComponentPair>() { new PropertyComponentPair("backgroundColor", new string[] { Globals.FBXSDK_CURVENODE_COLOR_RED, Globals.FBXSDK_CURVENODE_COLOR_GREEN, Globals.FBXSDK_CURVENODE_COLOR_BLUE, "W" }), new PropertyComponentPair("FocalLength", new string[] { null }), new PropertyComponentPair("clearFlags", new string[] { null }) }, origCamera, importCamera); }
protected override void CheckScene(FbxScene scene) { FbxScene origScene = CreateScene(FbxManager); Assert.That(origScene.GetRootNode().GetChildCount(), Is.EqualTo(scene.GetRootNode().GetChildCount())); // check nodes match FbxNode origSourceNode = origScene.GetRootNode().GetChild(0); FbxNode origConstrainedNode = origScene.GetRootNode().GetChild(1); FbxNode importSourceNode = scene.GetRootNode().GetChild(0); FbxNode importConstrainedNode = scene.GetRootNode().GetChild(1); Assert.That(origSourceNode, Is.Not.Null); Assert.That(importSourceNode, Is.Not.Null); Assert.That(origConstrainedNode, Is.Not.Null); Assert.That(importConstrainedNode, Is.Not.Null); Assert.That(importSourceNode.GetName(), Is.EqualTo(origSourceNode.GetName())); Assert.That(importConstrainedNode.GetName(), Is.EqualTo(origConstrainedNode.GetName())); // check constraints match // TODO: find a way to cast to FbxConstraint Assert.That(scene.GetSrcObjectCount(), Is.EqualTo(origScene.GetSrcObjectCount())); FbxObject origPosConstraint = origScene.FindSrcObject(ConstraintName); FbxObject importPosConstraint = scene.FindSrcObject(ConstraintName); Assert.That(origPosConstraint, Is.Not.Null); Assert.That(importPosConstraint, Is.Not.Null); Assert.That(importPosConstraint.GetName(), Is.EqualTo(origPosConstraint.GetName())); // check animation matches FbxAnimStack origStack = origScene.GetCurrentAnimationStack(); FbxAnimStack importStack = scene.GetCurrentAnimationStack(); CheckAnimStack(origStack, importStack); FbxAnimLayer origLayer = origStack.GetAnimLayerMember(); FbxAnimLayer importLayer = importStack.GetAnimLayerMember(); Assert.That(origLayer, Is.Not.Null); Assert.That(importLayer, Is.Not.Null); Assert.That(scene.GetGlobalSettings().GetTimeMode(), Is.EqualTo(FbxTime.EMode.eFrames30)); CheckAnimCurve(origPosConstraint, importPosConstraint, origLayer, importLayer, PropertyComponentList); }
protected override FbxScene CreateScene(FbxManager manager) { // Create a scene with a single node that has an animation clip // attached to it FbxScene scene = FbxScene.Create(manager, "myScene"); FbxNode sourceNode = FbxNode.Create(scene, "source"); FbxNode constrainedNode = FbxNode.Create(scene, "constrained"); scene.GetRootNode().AddChild(sourceNode); scene.GetRootNode().AddChild(constrainedNode); FbxConstraint posConstraint = CreatePositionConstraint(scene, sourceNode, constrainedNode); Assert.That(posConstraint, Is.Not.Null); bool result = posConstraint.ConnectDstObject(scene); Assert.That(result, Is.True); // animate weight + active // setup anim stack FbxAnimStack fbxAnimStack = CreateAnimStack(scene); // add an animation layer FbxAnimLayer fbxAnimLayer = FbxAnimLayer.Create(scene, "animBaseLayer"); fbxAnimStack.AddMember(fbxAnimLayer); // set up the translation CreateAnimCurves( posConstraint, fbxAnimLayer, PropertyComponentList, (index) => { return(index * 2.0); }, (index) => { return(index * 3 - 2); } ); // TODO: avoid needing to do this by creating typemaps for // FbxObject::GetSrcObjectCount and FbxCast. // Not trivial to do as both fbxobject.i and fbxemitter.i // have to be moved up before the ignore all statement // to allow use of templates. scene.SetCurrentAnimationStack(fbxAnimStack); return(scene); }
public void CreateDocument() { Scene = FbxScene.Create(SdkManager, ""); FbxDocumentInfo SceneInfo = FbxDocumentInfo.Create(SdkManager, "SceneInfo"); SceneInfo.mTitle = new FbxString("Unreal FBX Exporter"); SceneInfo.mSubject = new FbxString("Export FBX meshes from Unreal"); SceneInfo.Original_ApplicationVendor.Set(new FbxString("Epic Games")); SceneInfo.Original_ApplicationName.Set(new FbxString("Unreal Engine")); SceneInfo.Original_ApplicationVersion.Set(new FbxString("4.18")); SceneInfo.LastSaved_ApplicationVendor.Set(new FbxString("Epic Games")); SceneInfo.LastSaved_ApplicationName.Set(new FbxString("Unreal Engine")); SceneInfo.LastSaved_ApplicationVersion.Set(new FbxString("4.18")); FbxAxisSystem.EFrontVector FrontVector = (FbxAxisSystem.EFrontVector)(0 - FbxAxisSystem.EFrontVector.eParityOdd); if (bForceFrontXAxis) { FrontVector = FbxAxisSystem.EFrontVector.eParityEven; } FbxAxisSystem UnrealZUp = new FbxAxisSystem(FbxAxisSystem.EUpVector.eZAxis, FrontVector, FbxAxisSystem.ECoordSystem.eRightHanded); //const FbxAxisSystem UnrealZUp(FbxAxisSystem.EUpVector, FrontVector, FbxAxisSystem::eRightHanded); Scene.GetGlobalSettings().SetAxisSystem(FbxAxisSystem.Max); Scene.GetGlobalSettings().SetOriginalUpAxis(FbxAxisSystem.Max); Scene.GetGlobalSettings().SetSystemUnit(FbxSystemUnit.cm); Scene.SetSceneInfo(SceneInfo); // setup anim stack AnimStack = FbxAnimStack.Create(Scene, "Unreal Take"); //KFbxSet<KTime>(AnimStack.LocalStart, KTIME_ONE_SECOND); AnimStack.Description.Set((new FbxString("Animation Take for Unreal."))); // this take contains one base layer. In fact having at least one layer is mandatory. AnimLayer = FbxAnimLayer.Create(Scene, "Base Layer"); AnimStack.AddMember(AnimLayer); //if(Mathf) }
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 override bool Apply(FbxObject pObj, FbxAnimStack pAnimStack) { bool ret = fbx_wrapperPINVOKE.FbxAnimCurveFilterScaleCompensate_Apply__SWIG_3(swigCPtr, FbxObject.getCPtr(pObj), FbxAnimStack.getCPtr(pAnimStack)); return(ret); }
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; } }