Exemplo n.º 1
0
        public static void ExportFbx([DefaultVar] UnityParser parser, object[] skinnedMeshRendererIDs, object[] animationParsers, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, double filterPrecision, string path, string exportFormat, bool allFrames, bool allBones, bool skins, bool compatibility)
        {
            List <double>       sMeshIDList = new List <double>(Utility.Convert <double>(skinnedMeshRendererIDs));
            List <MeshRenderer> sMeshes     = new List <MeshRenderer>(sMeshIDList.Count);

            for (int i = 0; i < sMeshIDList.Count; i++)
            {
                int sMeshID = (int)sMeshIDList[i];
                if (i > 0 && sMeshID < 0)
                {
                    for (sMeshID = (int)sMeshIDList[i - 1] + 1; sMeshID < -(int)sMeshIDList[i]; sMeshID++)
                    {
                        SkinnedMeshRenderer sMesh = parser.Cabinet.LoadComponent(sMeshID);
                        if (sMesh == null)
                        {
                            continue;
                        }
                        sMeshes.Add(sMesh);
                    }
                }
                else
                {
                    SkinnedMeshRenderer sMesh = parser.Cabinet.LoadComponent(sMeshID);
                    if (sMesh == null)
                    {
                        continue;
                    }
                    sMeshes.Add(sMesh);
                }
            }

            UnityConverter imp = new UnityConverter(parser, sMeshes, skins);

            FbxUtility.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, (float)filterPrecision, exportFormat, allFrames, allBones, skins, compatibility);
        }
Exemplo n.º 2
0
Arquivo: Fbx.cs Projeto: kkdevs/sb3u
        public static void ExportFbx([DefaultVar] Animator animator, object[] meshes, object[] animationClips, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, double filterPrecision, string path, string exportFormat, bool allFrames, bool allBones, bool skins, float boneSize, bool morphs, bool flatInbetween, bool compatibility)
        {
            List <MeshRenderer> meshList  = null;
            List <int[]>        morphList = null;

            if (meshes != null)
            {
                MeshRenderer[] meshArray = Utility.Convert <MeshRenderer>(meshes);
                meshList = new List <MeshRenderer>(meshArray);

                if (morphs)
                {
                    morphList = new List <int[]>(meshes.Length);
                    for (int i = 0; i < meshes.Length; i++)
                    {
                        morphList.Add(null);
                    }
                }
            }

            ImageFileFormat preferredUncompressedFormat = (string)Properties.Settings.Default["ExportUncompressedAs"] == "BMP"
                                ? ImageFileFormat.Bmp : (ImageFileFormat)(-1);

            Operations.UnityConverter imp = new Operations.UnityConverter(animator, meshList, skins, morphList, flatInbetween, preferredUncompressedFormat);
            if (animationClips != null)
            {
                AnimationClip[]      clipArray = Utility.Convert <AnimationClip>(animationClips);
                List <AnimationClip> clipList  = new List <AnimationClip>(clipArray);
                imp.ConvertAnimations(clipList);
            }

            FbxUtility.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, (float)filterPrecision, exportFormat, allFrames, allBones, skins, boneSize, flatInbetween, compatibility);
        }
Exemplo n.º 3
0
        public static void ExportFbx([DefaultVar] Animator animator, object[] meshes, object[] animationParsers, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, double filterPrecision, string path, string exportFormat, bool allFrames, bool allBones, bool skins, bool compatibility)
        {
            MeshRenderer[]      meshArray = Utility.Convert <MeshRenderer>(meshes);
            List <MeshRenderer> meshList  = new List <MeshRenderer>(meshArray);

            UnityConverter imp = new UnityConverter(animator, meshList, skins, false);

            FbxUtility.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, (float)filterPrecision, exportFormat, allFrames, allBones, skins, compatibility);
        }
Exemplo n.º 4
0
Arquivo: Fbx.cs Projeto: kkdevs/sb3u
        public static void ExportFbx([DefaultVar] UnityParser parser, object[] skinnedMeshRendererIDs, object[] animationParsers, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, double filterPrecision, string path, string exportFormat, bool allFrames, bool allBones, bool skins, float boneSize, bool compatibility)
        {
            List <double>       sMeshIDList = new List <double>(Utility.Convert <double>(skinnedMeshRendererIDs));
            List <MeshRenderer> sMeshes     = new List <MeshRenderer>(sMeshIDList.Count);

            for (int i = 0; i < sMeshIDList.Count; i++)
            {
                int sMeshID = (int)sMeshIDList[i];
                if (i > 0 && sMeshID < 0)
                {
                    for (sMeshID = (int)sMeshIDList[i - 1] + 1; sMeshID < -(int)sMeshIDList[i]; sMeshID++)
                    {
                        SkinnedMeshRenderer sMesh = parser.Cabinet.LoadComponent(sMeshID);
                        if (sMesh == null)
                        {
                            continue;
                        }
                        sMeshes.Add(sMesh);
                    }
                }
                else
                {
                    SkinnedMeshRenderer sMesh = parser.Cabinet.LoadComponent(sMeshID);
                    if (sMesh == null)
                    {
                        continue;
                    }
                    sMeshes.Add(sMesh);
                }
            }

            ImageFileFormat preferredUncompressedFormat = (string)Properties.Settings.Default["ExportUncompressedAs"] == "BMP"
                                ? ImageFileFormat.Bmp : (ImageFileFormat)(-1);

            Operations.UnityConverter imp = new Operations.UnityConverter(parser, sMeshes, skins, preferredUncompressedFormat);

            FbxUtility.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, (float)filterPrecision, exportFormat, allFrames, allBones, skins, boneSize, false, compatibility);
        }
Exemplo n.º 5
0
Arquivo: Fbx.cs Projeto: kkdevs/sb3u
        public static void ExportFbx([DefaultVar] remParser parser, object[] meshNames, object[] reaParsers, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, double filterPrecision, string path, string exportFormat, bool allFrames, bool skins, bool compatibility)
        {
            List <reaParser> reaParserList = null;

            if (reaParsers != null)
            {
                reaParserList = new List <reaParser>(Utility.Convert <reaParser>(reaParsers));
            }

            List <string>  meshStrList = new List <string>(Utility.Convert <string>(meshNames));
            List <remMesh> meshes      = new List <remMesh>(meshStrList.Count);

            foreach (string meshName in meshStrList)
            {
                remMesh mesh = rem.FindMesh(new remId(meshName), parser.MESC);
                if (mesh != null)
                {
                    meshes.Add(mesh);
                }
                else
                {
                    Report.ReportLog("Mesh " + meshName + " not found.");
                }
            }

            REMConverter imp = new REMConverter(parser, meshes);

            if (reaParserList != null)
            {
                foreach (reaParser reaParser in reaParserList)
                {
                    imp.ConvertAnimation(reaParser.ANIC, parser);
                }
            }

            FbxUtility.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, (float)filterPrecision, exportFormat, allFrames, false, skins, compatibility);
        }
Exemplo n.º 6
0
Arquivo: Fbx.cs Projeto: kkdevs/sb3u
        public static void ExportFbx([DefaultVar] odfParser parser, object[] meshNames, object[] animations, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, double filterPrecision, string path, string exportFormat, bool allFrames, bool skins, bool odaSkeleton, bool compatibility)
        {
            List <string>  meshStrList = new List <string>(Utility.Convert <string>(meshNames));
            List <odfMesh> meshes      = new List <odfMesh>(meshStrList.Count);

            foreach (string meshName in meshStrList)
            {
                odfMesh mesh = odf.FindMeshListSome(meshName, parser.MeshSection);
                if (mesh != null || (mesh = odf.FindMeshListSome(new ObjectID(meshName), parser.MeshSection)) != null)
                {
                    meshes.Add(mesh);
                }
                else
                {
                    Report.ReportLog("Mesh " + meshName + " not found.");
                }
            }

            ODFConverter imp = new ODFConverter(parser, meshes);

            if (animations != null)
            {
                for (int i = 0; i < animations.Length; i++)
                {
                    odfParser odaParser = animations[i] as odfParser;
                    if (odaParser != null)
                    {
                        string animName = animations[++i] as string;
                        if (animName == null)
                        {
                            imp.ConvertAnimations((odfParser)odaParser, odaSkeleton);
                        }
                        else
                        {
                            if (animName == "ANIM")
                            {
                                imp.ConvertAnimation(odaParser.AnimSection, odaParser, odaSkeleton);
                            }
                            else
                            {
                                bool found = false;
                                if (odaParser.BANMList != null)
                                {
                                    foreach (odfANIMSection anim in odaParser.BANMList)
                                    {
                                        if (anim.Name == animName)
                                        {
                                            imp.ConvertAnimation(anim, odaParser, odaSkeleton);
                                            found = true;
                                            break;
                                        }
                                    }
                                }
                                if (!found)
                                {
                                    Report.ReportLog("animation \"" + animName + "\" not found");
                                }
                            }
                        }
                    }
                    else
                    {
                        Report.ReportLog("bad argument type for parameter 'animations' " + odaParser.GetType().ToString());
                    }
                }
            }

            FbxUtility.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, (float)filterPrecision, exportFormat, allFrames, false, skins, compatibility);
        }