Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }