Ejemplo n.º 1
0
        public FbxTakeInfo GetTakeInfo(int pIndex)
        {
            global::System.IntPtr cPtr = fbx_wrapperPINVOKE.FbxImporter_GetTakeInfo(swigCPtr, pIndex);
            FbxTakeInfo           ret  = (cPtr == global::System.IntPtr.Zero) ? null : new FbxTakeInfo(cPtr, false);

            return(ret);
        }
Ejemplo n.º 2
0
 public FbxTakeInfo(FbxTakeInfo pTakeInfo) : this(FbxWrapperNativePINVOKE.new_FbxTakeInfo__SWIG_1(FbxTakeInfo.getCPtr(pTakeInfo)), true)
 {
     if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
     {
         throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 3
0
 public void CopyLayers(FbxTakeInfo pTakeInfo)
 {
     FbxWrapperNativePINVOKE.FbxTakeInfo_CopyLayers(swigCPtr, FbxTakeInfo.getCPtr(pTakeInfo));
     if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
     {
         throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 4
0
        public bool SetTakeInfo(FbxTakeInfo pTakeInfo)
        {
            bool ret = fbx_wrapperPINVOKE.FbxDocument_SetTakeInfo(swigCPtr, FbxTakeInfo.getCPtr(pTakeInfo));

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 5
0
        public FbxTakeInfo assign(FbxTakeInfo pTakeInfo)
        {
            FbxTakeInfo ret = new FbxTakeInfo(FbxWrapperNativePINVOKE.FbxTakeInfo_assign(swigCPtr, FbxTakeInfo.getCPtr(pTakeInfo)), false);

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 6
0
        public FbxTakeInfo GetTakeInfo(FbxString pTakeName)
        {
            global::System.IntPtr cPtr = fbx_wrapperPINVOKE.FbxDocument_GetTakeInfo(swigCPtr, FbxString.getCPtr(pTakeName));
            FbxTakeInfo           ret  = (cPtr == global::System.IntPtr.Zero) ? null : new FbxTakeInfo(cPtr, false);

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 7
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FbxTakeInfo obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 8
0
 public void Reset(FbxTakeInfo pTakeInfo)
 {
     FbxWrapperNativePINVOKE.FbxAnimStack_Reset__SWIG_0(swigCPtr, FbxTakeInfo.getCPtr(pTakeInfo));
 }
Ejemplo n.º 9
0
 public void Reset(FbxTakeInfo pTakeInfo)
 {
     fbx_wrapperPINVOKE.FbxAnimStack_Reset__SWIG_0(swigCPtr, FbxTakeInfo.getCPtr(pTakeInfo));
 }
Ejemplo n.º 10
0
            /// <summary>
            /// Import all from scene.
            /// Return the number of objects we imported.
            /// </summary>
            public int ImportAll(IEnumerable <UnityEngine.Object> unitySelectionSet)
            {
                // Create the FBX manager
                using (var fbxManager = FbxManager.Create())
                {
                    FbxIOSettings fbxIOSettings = FbxIOSettings.Create(fbxManager, Globals.IOSROOT);

                    // Configure the IO settings.
                    fbxManager.SetIOSettings(fbxIOSettings);

                    // Get the version number of the FBX files generated by the
                    // version of FBX SDK that you are using.
                    int sdkMajor = -1, sdkMinor = -1, sdkRevision = -1;

                    FbxManager.GetFileFormatVersion(out sdkMajor, out sdkMinor, out sdkRevision);

                    // Create the importer
                    var fbxImporter = FbxImporter.Create(fbxManager, "Importer");

                    // Initialize the importer.
                    int fileFormat = -1;

                    bool      status    = fbxImporter.Initialize(LastFilePath, fileFormat, fbxIOSettings);
                    FbxStatus fbxStatus = fbxImporter.GetStatus();

                    // Get the version number of the FBX file format.
                    int fileMajor = -1, fileMinor = -1, fileRevision = -1;
                    fbxImporter.GetFileVersion(out fileMajor, out fileMinor, out fileRevision);

                    // Check that initialization of the fbxImporter was successful
                    if (!status)
                    {
                        Debug.LogError(string.Format("failed to initialize FbxImporter, error returned {0}",
                                                     fbxStatus.GetErrorString()));

                        if (fbxStatus.GetCode() == FbxStatus.EStatusCode.eInvalidFileVersion)
                        {
                            Debug.LogError(string.Format("Invalid file version detected\nSDK version: {0}.{1}.{2}\nFile version: {3}.{4}.{5}",
                                                         sdkMajor, sdkMinor, sdkRevision,
                                                         fileMajor, fileMinor, fileRevision));
                        }

                        return(0);
                    }

                    MsgLine.Add("Import Scene Report");
                    MsgLine.Add(kBorderLine);

                    MsgLine.Add(kPadding + string.Format("FilePath: {0}", LastFilePath));
                    MsgLine.Add(kPadding + string.Format("SDK version: {0}.{1}.{2}",
                                                         sdkMajor, sdkMinor, sdkRevision));

                    if (!fbxImporter.IsFBX())
                    {
                        Debug.LogError(string.Format("file does not contain FBX data {0}", LastFilePath));
                        return(0);
                    }

                    MsgLine.Add(kPadding + string.Format("File version: {0}.{1}.{2}",
                                                         fileMajor, fileMinor, fileRevision));

                    MsgLine.Add(kBorderLine);
                    MsgLine.Add("Animation");
                    MsgLine.Add(kBorderLine);

                    int numAnimStack = fbxImporter.GetAnimStackCount();

                    MsgLine.Add(kPadding + string.Format("number of stacks: {0}", numAnimStack));
                    MsgLine.Add(kPadding + string.Format("active animation stack: \"{0}\"\n", fbxImporter.GetActiveAnimStackName()));

                    for (int i = 0; i < numAnimStack; i++)
                    {
#if UNI_18972
                        FbxTakeInfo fbxTakeInfo = fbxImporter.GetTakeInfo(i);
                        MsgLine.Add(kPadding + string.Format("Animation Stack ({0})", i));
                        MsgLine.Add(kPadding + string.Format("name: \"{0}\"", fbxTakeInfo.mName) + string.kNewLine);
                        MsgLine.Add(kPadding + string.Format("description: \"{0}\"", fbxTakeInfo.mDescription));
                        MsgLine.Add(kPadding + string.Format("import name: \"{0}\"", fbxTakeInfo.mImportName));
                        MsgLine.Add(kPadding + string.Format("import state: \"{0}\"", fbxTakeInfo.mSelect));
#endif
                    }

                    // Import options. Determine what kind of data is to be imported.
                    // The default is true, but here we set the options explictly.
                    fbxIOSettings.SetBoolProp(Globals.IMP_FBX_MATERIAL, false);
                    fbxIOSettings.SetBoolProp(Globals.IMP_FBX_TEXTURE, false);
                    fbxIOSettings.SetBoolProp(Globals.IMP_FBX_ANIMATION, false);
                    fbxIOSettings.SetBoolProp(Globals.IMP_FBX_EXTRACT_EMBEDDED_DATA, false);
                    fbxIOSettings.SetBoolProp(Globals.IMP_FBX_GLOBAL_SETTINGS, true);

                    // Create a scene
                    var fbxScene = FbxScene.Create(fbxManager, "Scene");

                    // Import the scene to the file.
                    status    = fbxImporter.Import(fbxScene);
                    fbxStatus = fbxImporter.GetStatus();

                    if (status == false)
                    {
                        if (fbxStatus.GetCode() == FbxStatus.EStatusCode.ePasswordError)
                        {
                            Debug.LogError(string.Format("failed to import, file is password protected ({0})", fbxStatus.GetErrorString()));
                        }
                        else
                        {
                            Debug.LogError(string.Format("failed to import file ({0})", fbxStatus.GetErrorString()));
                        }
                    }
                    else
                    {
                        // import data into scene
                        ProcessScene(fbxScene, unitySelectionSet);
                    }

                    // cleanup
                    fbxScene.Destroy();
                    fbxImporter.Destroy();

                    return(status == true ? NumNodes : 0);
                }
            }