Beispiel #1
0
        public bool GetTime(out int pHour, out int pMinute, out int pSecond, out int pFrame, out int pField, out int pResidual, FbxTime.EMode pTimeMode)
        {
            bool ret = NativeMethods.FbxTime_GetTime__SWIG_0(swigCPtr, out pHour, out pMinute, out pSecond, out pFrame, out pField, out pResidual, (int)pTimeMode);

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #2
0
        public char GetFrameSeparator(FbxTime.EMode pTimeMode)
        {
            char ret = FbxWrapperNativePINVOKE.FbxTime_GetFrameSeparator__SWIG_0(swigCPtr, (int)pTimeMode);

            return(ret);
        }
Beispiel #3
0
        public FbxString GetTimeString(FbxTime.EElement pStart, FbxTime.EElement pEnd, FbxTime.EMode pTimeMode)
        {
            FbxString ret = new FbxString(FbxWrapperNativePINVOKE.FbxTime_GetTimeString__SWIG_5(swigCPtr, (int)pStart, (int)pEnd, (int)pTimeMode), true);

            return(ret);
        }
Beispiel #4
0
        public double GetFrameCountPrecise(FbxTime.EMode pTimeMode)
        {
            double ret = FbxWrapperNativePINVOKE.FbxTime_GetFrameCountPrecise__SWIG_0(swigCPtr, (int)pTimeMode);

            return(ret);
        }
Beispiel #5
0
        public int GetResidual(FbxTime.EMode pTimeMode)
        {
            int ret = FbxWrapperNativePINVOKE.FbxTime_GetResidual__SWIG_0(swigCPtr, (int)pTimeMode);

            return(ret);
        }
Beispiel #6
0
 public FbxTime.EMode GetTimeMode()
 {
     FbxTime.EMode ret = (FbxTime.EMode)FbxWrapperNativePINVOKE.FbxIOInfo_GetTimeMode(swigCPtr);
     return(ret);
 }
Beispiel #7
0
        public bool GetTime(SWIGTYPE_p_int pHour, SWIGTYPE_p_int pMinute, SWIGTYPE_p_int pSecond, SWIGTYPE_p_int pFrame, SWIGTYPE_p_int pField, SWIGTYPE_p_int pResidual, FbxTime.EMode pTimeMode)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxTime_GetTime__SWIG_0(swigCPtr, SWIGTYPE_p_int.getCPtr(pHour), SWIGTYPE_p_int.getCPtr(pMinute), SWIGTYPE_p_int.getCPtr(pSecond), SWIGTYPE_p_int.getCPtr(pFrame), SWIGTYPE_p_int.getCPtr(pField), SWIGTYPE_p_int.getCPtr(pResidual), (int)pTimeMode);

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #8
0
        private static FbxTime FromTimeStringNoOptionalArgs(string pTime, FbxTime.EMode pTimeMode, FbxTime.EProtocol pTimeFormat)
        {
            FbxTime ret = new FbxTime(NativeMethods.FbxTime_FromTimeStringNoOptionalArgs(pTime, (int)pTimeMode, (int)pTimeFormat), true);

            return(ret);
        }
Beispiel #9
0
 public static void SetGlobalTimeMode(FbxTime.EMode pTimeMode)
 {
     NativeMethods.FbxTime_SetGlobalTimeMode((int)pTimeMode);
 }
Beispiel #10
0
        private static FbxTime FromTimeNoOptionalArgs(int pHour, int pMinute, int pSecond, int pFrame, int pField, int pResidual, FbxTime.EMode pTimeMode)
        {
            FbxTime ret = new FbxTime(NativeMethods.FbxTime_FromTimeNoOptionalArgs(pHour, pMinute, pSecond, pFrame, pField, pResidual, (int)pTimeMode), true);

            return(ret);
        }
Beispiel #11
0
        public static FbxTime FromFramePrecise(double pFrames, FbxTime.EMode pTimeMode)
        {
            FbxTime ret = new FbxTime(NativeMethods.FbxTime_FromFramePrecise__SWIG_0(pFrames, (int)pTimeMode), true);

            return(ret);
        }
Beispiel #12
0
        public static long GetOneFrameValue(FbxTime.EMode pTimeMode)
        {
            long ret = NativeMethods.FbxTime_GetOneFrameValue__SWIG_0((int)pTimeMode);

            return(ret);
        }
Beispiel #13
0
        private string GetTimeStringNoOptionalArgs(FbxTime.EElement pStart, FbxTime.EElement pEnd, FbxTime.EMode pTimeMode, FbxTime.EProtocol pTimeFormat)
        {
            string ret = NativeMethods.FbxTime_GetTimeStringNoOptionalArgs(swigCPtr, (int)pStart, (int)pEnd, (int)pTimeMode, (int)pTimeFormat);

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #14
0
        public static bool IsDropFrame(FbxTime.EMode pTimeMode)
        {
            bool ret = NativeMethods.FbxTime_IsDropFrame__SWIG_0((int)pTimeMode);

            return(ret);
        }
Beispiel #15
0
 public void SetTimeMode(FbxTime.EMode pTimeMode, double pCustomFrameRate)
 {
     FbxWrapperNativePINVOKE.FbxIOInfo_SetTimeMode__SWIG_0(swigCPtr, (int)pTimeMode, pCustomFrameRate);
 }
Beispiel #16
0
 public static FbxTime.EMode GetGlobalTimeMode()
 {
     FbxTime.EMode ret = (FbxTime.EMode)NativeMethods.FbxTime_GetGlobalTimeMode();
     return(ret);
 }
Beispiel #17
0
 public void SetTimeMode(FbxTime.EMode pTimeMode)
 {
     FbxWrapperNativePINVOKE.FbxIOInfo_SetTimeMode__SWIG_1(swigCPtr, (int)pTimeMode);
 }
Beispiel #18
0
        public static double GetFrameRate(FbxTime.EMode pTimeMode)
        {
            double ret = NativeMethods.FbxTime_GetFrameRate((int)pTimeMode);

            return(ret);
        }
Beispiel #19
0
 public void SetTime(int pHour, int pMinute, int pSecond, int pFrame, int pField, int pResidual, FbxTime.EMode pTimeMode)
 {
     FbxWrapperNativePINVOKE.FbxTime_SetTime__SWIG_4(swigCPtr, pHour, pMinute, pSecond, pFrame, pField, pResidual, (int)pTimeMode);
 }
Beispiel #20
0
 public static FbxTime.EMode ConvertFrameRateToTimeMode(double pFrameRate, double pPrecision)
 {
     FbxTime.EMode ret = (FbxTime.EMode)NativeMethods.FbxTime_ConvertFrameRateToTimeMode__SWIG_0(pFrameRate, pPrecision);
     return(ret);
 }
Beispiel #21
0
 public void SetFramePrecise(double pFrames, FbxTime.EMode pTimeMode)
 {
     FbxWrapperNativePINVOKE.FbxTime_SetFramePrecise__SWIG_0(swigCPtr, pFrames, (int)pTimeMode);
 }
Beispiel #22
0
 public static FbxTime.EMode ConvertFrameRateToTimeMode(double pFrameRate)
 {
     FbxTime.EMode ret = (FbxTime.EMode)NativeMethods.FbxTime_ConvertFrameRateToTimeMode__SWIG_1(pFrameRate);
     return(ret);
 }
Beispiel #23
0
        public SWIGTYPE_p_signed___int64 GetFieldCount(FbxTime.EMode pTimeMode)
        {
            SWIGTYPE_p_signed___int64 ret = new SWIGTYPE_p_signed___int64(FbxWrapperNativePINVOKE.FbxTime_GetFieldCount__SWIG_0(swigCPtr, (int)pTimeMode), true);

            return(ret);
        }
            /// <summary>
            /// Export an AnimationClip as a single take
            /// </summary>
            protected void ExportAnimationClip(AnimationClip unityAnimClip, GameObject unityRoot, FbxScene fbxScene)
            {
                if (Verbose)
                {
                    Debug.Log(string.Format("exporting clip {1} for {0}", unityRoot.name, unityAnimClip.name));
                }

                // 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));

                /* The major difficulty: Unity uses quaternions for rotation
                 * (which is how it should be) but FBX uses euler angles. So we
                 * need to gather up the list of transform curves per object. */
                var quaternions = new Dictionary <UnityEngine.GameObject, QuaternionCurve> ();

                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;
                    }

                    int index = QuaternionCurve.GetQuaternionIndex(unityCurveBinding.propertyName);
                    if (index == -1)
                    {
                        if (Verbose)
                        {
                            Debug.Log(string.Format("export binding {1} for {0}", unityCurveBinding.propertyName, unityObj.ToString()));
                        }

                        /* Some normal property (e.g. translation), export right away */
                        ExportAnimCurve(unityObj, unityAnimCurve, unityCurveBinding.propertyName,
                                        fbxScene, fbxAnimLayer);
                    }
                    else
                    {
                        /* Rotation property; save it to convert quaternion -> euler later. */

                        var unityGo = GetGameObject(unityObj);
                        if (!unityGo)
                        {
                            continue;
                        }

                        QuaternionCurve quat;
                        if (!quaternions.TryGetValue(unityGo, out quat))
                        {
                            quat = new QuaternionCurve();
                            quaternions.Add(unityGo, quat);
                        }
                        quat.SetCurve(index, unityAnimCurve);
                    }
                }

                /* now export all the quaternion curves */
                foreach (var kvp in quaternions)
                {
                    var unityGo = kvp.Key;
                    var quat    = kvp.Value;

                    FbxNode fbxNode;
                    if (!MapUnityObjectToFbxNode.TryGetValue(unityGo, out fbxNode))
                    {
                        Debug.LogError(string.Format("no fbxnode found for '0'", unityGo.name));
                        continue;
                    }
                    quat.Animate(unityGo.transform, fbxNode, fbxAnimLayer, Verbose);
                }
            }
Beispiel #25
0
        public static bool IsDropFrame(FbxTime.EMode pTimeMode)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxTime_IsDropFrame__SWIG_0((int)pTimeMode);

            return(ret);
        }
Beispiel #26
0
 public void SetTimeMode(FbxTime.EMode pTimeMode)
 {
     fbx_wrapperPINVOKE.FbxIOInfo_SetTimeMode__SWIG_1(swigCPtr, (int)pTimeMode);
 }
Beispiel #27
0
        public string GetTimeString(string pTimeString, ushort pTimeStringSize, int pInfo, FbxTime.EMode pTimeMode)
        {
            string ret = FbxWrapperNativePINVOKE.FbxTime_GetTimeString__SWIG_1(swigCPtr, pTimeString, pTimeStringSize, pInfo, (int)pTimeMode);

            return(ret);
        }
Beispiel #28
0
 public FbxTime.EMode GetTimeMode()
 {
     FbxTime.EMode ret = (FbxTime.EMode)fbx_wrapperPINVOKE.FbxIOInfo_GetTimeMode(swigCPtr);
     return(ret);
 }
Beispiel #29
0
        public bool SetTimeString(string pTime, FbxTime.EMode pTimeMode)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxTime_SetTimeString__SWIG_1(swigCPtr, pTime, (int)pTimeMode);

            return(ret);
        }
Beispiel #30
0
 public FbxTime.EMode GetTimeMode()
 {
     FbxTime.EMode ret = (FbxTime.EMode)fbx_wrapperPINVOKE.FbxGlobalSettings_GetTimeMode(swigCPtr);
     return(ret);
 }