Пример #1
0
            public static void Export(string path, IImported imported, bool eulerFilter, float filterPrecision,
                                      bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii)
            {
                var file = new FileInfo(path);
                var dir  = file.Directory;

                if (!dir.Exists)
                {
                    dir.Create();
                }

                var currentDir = Directory.GetCurrentDirectory();

                Directory.SetCurrentDirectory(dir.FullName);

                var name = Path.GetFileName(path);

                using (var exporter = new FbxExporter(name, imported, allNodes, skins, castToBone, boneSize, scaleFactor, versionIndex, isAscii))
                {
                    exporter.Initialize();
                    exporter.ExportAll(blendShape, animation, eulerFilter, filterPrecision);
                }

                Directory.SetCurrentDirectory(currentDir);
            }
Пример #2
0
        public ImportedEditor(IImported imported)
        {
            Imported = imported;

            if (Imported.MaterialList != null && Imported.MaterialList.Count > 0)
            {
                Materials = new List <WorkspaceMaterial>(Imported.MaterialList.Count);
                foreach (ImportedMaterial mat in Imported.MaterialList)
                {
                    WorkspaceMaterial wsMat = new WorkspaceMaterial(mat);
                    Materials.Add(wsMat);
                }
            }

            if ((Imported.FrameList != null) && (Imported.FrameList.Count > 0))
            {
                Frames = new List <ImportedFrame>();
                foreach (var frame in Imported.FrameList)
                {
                    InitFrames(frame);
                }
            }

            if (Imported.MeshList != null && Imported.MeshList.Count > 0)
            {
                Meshes = new List <WorkspaceMesh>(Imported.MeshList.Count);
                foreach (ImportedMesh mesh in Imported.MeshList)
                {
                    WorkspaceMesh wsMesh = new WorkspaceMesh(mesh);
                    Meshes.Add(wsMesh);
                }
            }

            if (Imported.MorphList != null && Imported.MorphList.Count > 0)
            {
                Morphs = new List <WorkspaceMorph>(Imported.MorphList.Count);
                foreach (ImportedMorph morph in Imported.MorphList)
                {
                    WorkspaceMorph wsMorph = new WorkspaceMorph(morph);
                    Morphs.Add(wsMorph);
                }
            }

            if (Imported.AnimationList != null && Imported.AnimationList.Count > 0)
            {
                Animations = new List <WorkspaceAnimation>(Imported.AnimationList.Count);
                foreach (ImportedAnimation animation in Imported.AnimationList)
                {
                    WorkspaceAnimation wsAnimation = new WorkspaceAnimation(animation);
                    Animations.Add(wsAnimation);
                }
            }
        }
Пример #3
0
 public FormWorkspace(string path, IImported importer, string editorVar, ImportedEditor editor)
     : this()
 {
     try
     {
         InitWorkspace(path, importer, editorVar, editor);
     }
     catch (Exception ex)
     {
         Utility.ReportException(ex);
     }
 }
Пример #4
0
        public static ImportedMesh FindMesh(String frameName, IImported imported)
        {
            foreach (ImportedMesh mesh in imported.MeshList)
            {
                if (mesh.Name == frameName)
                {
                    return(mesh);
                }
            }

            return(null);
        }
Пример #5
0
        public static ImportedMaterial FindMaterial(String name, IImported imported)
        {
            foreach (ImportedMaterial mat in imported.MaterialList)
            {
                if (mat.Name == name)
                {
                    return(mat);
                }
            }

            return(null);
        }
Пример #6
0
        private void InitWorkspace(string path, IImported importer, string editorVar, ImportedEditor editor)
        {
            this.Text        = Path.GetFileName(path);
            this.ToolTipText = path;

            Watcher                     = new FileSystemWatcher();
            Watcher.Path                = Path.GetDirectoryName(path);
            Watcher.Filter              = Path.GetFileName(path);
            Watcher.Changed            += new FileSystemEventHandler(watcher_Changed);
            Watcher.Deleted            += new FileSystemEventHandler(watcher_Changed);
            Watcher.Renamed            += new RenamedEventHandler(watcher_Changed);
            Watcher.EnableRaisingEvents = automaticReopenToolStripMenuItem.Checked;

            if (editor.Frames != null)
            {
                TreeNode root = new TreeNode(typeof(ImportedFrame).Name);
                root.Checked = true;
                this.treeView.AddChild(root);

                for (int i = 0; i < importer.FrameList.Count; i++)
                {
                    var      frame = importer.FrameList[i];
                    TreeNode node  = new TreeNode(frame.Name);
                    node.Checked = true;
                    node.Tag     = new DragSource(editorVar, typeof(ImportedFrame), editor.Frames.IndexOf(frame));
                    this.treeView.AddChild(root, node);

                    foreach (var child in frame)
                    {
                        BuildTree(editorVar, child, node, editor);
                    }
                }
            }

            AddList(editor.Meshes, typeof(ImportedMesh).Name, editorVar);
            AddList(importer.MaterialList, typeof(ImportedMaterial).Name, editorVar);
            AddList(importer.TextureList, typeof(ImportedTexture).Name, editorVar);
            AddList(editor.Morphs, typeof(ImportedMorph).Name, editorVar);
            AddList(editor.Animations, typeof(ImportedAnimation).Name, editorVar);

            foreach (TreeNode root in this.treeView.Nodes)
            {
                root.Expand();
            }
            if (this.treeView.Nodes.Count > 0)
            {
                this.treeView.Nodes[0].EnsureVisible();
            }

            this.treeView.AfterCheck += treeView_AfterCheck;
        }
Пример #7
0
        private static void ExportFbx(IImported convert, string exportPath)
        {
            var eulerFilter     = (bool)Properties.Settings.Default["eulerFilter"];
            var filterPrecision = (float)(decimal)Properties.Settings.Default["filterPrecision"];
            var allFrames       = (bool)Properties.Settings.Default["allFrames"];
            var allBones        = (bool)Properties.Settings.Default["allBones"];
            var skins           = (bool)Properties.Settings.Default["skins"];
            var boneSize        = (int)(decimal)Properties.Settings.Default["boneSize"];
            var scaleFactor     = (float)(decimal)Properties.Settings.Default["scaleFactor"];
            var fbxVersion      = (int)Properties.Settings.Default["fbxVersion"];
            var fbxFormat       = (int)Properties.Settings.Default["fbxFormat"];

            ModelExporter.ExportFbx(exportPath, convert, eulerFilter, filterPrecision, allFrames, allBones, skins, boneSize, scaleFactor, fbxVersion, fbxFormat == 1);
        }
Пример #8
0
        internal FbxExporter(string fileName, IImported imported, bool allNodes, bool exportSkins, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii)
        {
            _context = new FbxExporterContext();

            _fileName     = fileName;
            _imported     = imported;
            _allNodes     = allNodes;
            _exportSkins  = exportSkins;
            _castToBone   = castToBone;
            _boneSize     = boneSize;
            _scaleFactor  = scaleFactor;
            _versionIndex = versionIndex;
            _isAscii      = isAscii;
        }
Пример #9
0
        public FormWorkspace(string path, IImported importer, string editorVar, ImportedEditor editor)
        {
            try
            {
                InitializeComponent();
                Init();

                InitWorkspace(path, importer, editorVar, editor);

                Gui.Docking.ShowDockContent(this, Gui.Docking.DockFiles, ContentCategory.Others);
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Пример #10
0
        private static void ExportFbx(IImported convert, string exportPath)
        {
            var eulerFilter      = (bool)Properties.Settings.Default["eulerFilter"];
            var filterPrecision  = (float)(decimal)Properties.Settings.Default["filterPrecision"];
            var exportAllNodes   = (bool)Properties.Settings.Default["exportAllNodes"];
            var exportSkins      = (bool)Properties.Settings.Default["exportSkins"];
            var exportAnimations = (bool)Properties.Settings.Default["exportAnimations"];
            var exportBlendShape = (bool)Properties.Settings.Default["exportBlendShape"];
            var castToBone       = (bool)Properties.Settings.Default["castToBone"];
            var boneSize         = (int)(decimal)Properties.Settings.Default["boneSize"];
            var scaleFactor      = (float)(decimal)Properties.Settings.Default["scaleFactor"];
            var fbxVersion       = (int)Properties.Settings.Default["fbxVersion"];
            var fbxFormat        = (int)Properties.Settings.Default["fbxFormat"];

            ModelExporter.ExportFbx(exportPath, convert, eulerFilter, filterPrecision,
                                    exportAllNodes, exportSkins, exportAnimations, exportBlendShape, castToBone, boneSize, scaleFactor, fbxVersion, fbxFormat == 1);
        }
Пример #11
0
        public void Dispose()
        {
            HashSet <string> importedRefs = new HashSet <string>();

            foreach (KeyValuePair <string, object> var in Gui.Scripting.Variables)
            {
                IImported imp = var.Value as IImported;
                if (imp == Imported)
                {
                    importedRefs.Add(var.Key);
                }
            }
            foreach (string var in importedRefs)
            {
                Gui.Scripting.Variables.Remove(var);
            }
        }
Пример #12
0
        private static void ExportFbx(IImported convert, string exportPath)
        {
            var eulerFilter      = Properties.Settings.Default.eulerFilter;
            var filterPrecision  = (float)Properties.Settings.Default.filterPrecision;
            var exportAllNodes   = Properties.Settings.Default.exportAllNodes;
            var exportSkins      = Properties.Settings.Default.exportSkins;
            var exportAnimations = Properties.Settings.Default.exportAnimations;
            var exportBlendShape = Properties.Settings.Default.exportBlendShape;
            var castToBone       = Properties.Settings.Default.castToBone;
            var boneSize         = (int)Properties.Settings.Default.boneSize;
            var scaleFactor      = (float)Properties.Settings.Default.scaleFactor;
            var fbxVersion       = Properties.Settings.Default.fbxVersion;
            var fbxFormat        = Properties.Settings.Default.fbxFormat;

            ModelExporter.ExportFbx(exportPath, convert, eulerFilter, filterPrecision,
                                    exportAllNodes, exportSkins, exportAnimations, exportBlendShape, castToBone, boneSize, scaleFactor, fbxVersion, fbxFormat == 1);
        }
Пример #13
0
        public static ImportedTexture FindTexture(String name, IImported imported)
        {
            if (name == null || name == String.Empty)
            {
                return(null);
            }

            foreach (ImportedTexture tex in imported.TextureList)
            {
                if (tex.Name == name)
                {
                    return(tex);
                }
            }

            return(null);
        }
Пример #14
0
        public ImportedEditor(IImported imported)
        {
            Imported = imported;

            if ((Imported.FrameList != null) && (Imported.FrameList.Count > 0))
            {
                Frames = new List<ImportedFrame>();
                foreach (var frame in Imported.FrameList)
                {
                    InitFrames(frame);
                }
            }

            if (Imported.MeshList != null && Imported.MeshList.Count > 0)
            {
                Meshes = new List<WorkspaceMesh>(Imported.MeshList.Count);
                foreach (ImportedMesh mesh in Imported.MeshList)
                {
                    WorkspaceMesh wsMesh = new WorkspaceMesh(mesh);
                    Meshes.Add(wsMesh);
                }
            }

            if (Imported.MorphList != null && Imported.MorphList.Count > 0)
            {
                Morphs = new List<WorkspaceMorph>(Imported.MorphList.Count);
                foreach (ImportedMorph morph in Imported.MorphList)
                {
                    WorkspaceMorph wsMorph = new WorkspaceMorph(morph);
                    Morphs.Add(wsMorph);
                }
            }

            if (Imported.AnimationList != null && Imported.AnimationList.Count > 0)
            {
                Animations = new List<WorkspaceAnimation>(Imported.AnimationList.Count);
                foreach (ImportedAnimation animation in Imported.AnimationList)
                {
                    WorkspaceAnimation wsAnimation = new WorkspaceAnimation(animation);
                    Animations.Add(wsAnimation);
                }
            }
        }
Пример #15
0
        private void InitWorkspace(string path, IImported importer, string editorVar, ImportedEditor editor)
        {
            this.Text        = Path.GetFileName(path);
            this.ToolTipText = path;

            if (editor.Frames != null)
            {
                TreeNode root = new TreeNode(typeof(ImportedFrame).Name);
                root.Checked = true;
                this.treeView.AddChild(root);

                for (int i = 0; i < importer.FrameList.Count; i++)
                {
                    var      frame = importer.FrameList[i];
                    TreeNode node  = new TreeNode(frame.Name);
                    node.Checked = true;
                    node.Tag     = new DragSource(editorVar, typeof(ImportedFrame), editor.Frames.IndexOf(frame));
                    this.treeView.AddChild(root, node);

                    foreach (var child in frame)
                    {
                        BuildTree(editorVar, child, node, editor);
                    }
                }
            }

            AddList(editor.Meshes, typeof(ImportedMesh).Name, editorVar);
            AddList(importer.MaterialList, typeof(ImportedMaterial).Name, editorVar);
            AddList(importer.TextureList, typeof(ImportedTexture).Name, editorVar);
            AddList(editor.Morphs, typeof(ImportedMorph).Name, editorVar);
            AddList(editor.Animations, typeof(ImportedAnimation).Name, editorVar);

            foreach (TreeNode root in this.treeView.Nodes)
            {
                root.Expand();
            }
            if (this.treeView.Nodes.Count > 0)
            {
                this.treeView.Nodes[0].EnsureVisible();
            }

            this.treeView.AfterCheck += treeView_AfterCheck;
        }
Пример #16
0
 public static void Export(String path, IImported imp, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, float filterPrecision, String exportFormat, bool allFrames, bool skins)
 {
     Fbx.Exporter.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, filterPrecision, exportFormat, allFrames, skins);
 }
Пример #17
0
Файл: Fbx.cs Проект: kkdevs/sb3u
 public static void ExportMorph(String path, IImported imp, String exportFormat, bool morphMask, bool flatInbetween, bool skins, float boneSize, bool compatibility)
 {
     Fbx.Exporter.ExportMorph(path, imp, exportFormat, morphMask, flatInbetween, skins, boneSize, compatibility);
 }
Пример #18
0
 public static void ExportFbx(string path, IImported imported, bool eulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, bool flatInbetween, int versionIndex, bool isAscii)
 {
     Fbx.Exporter.Export(path, imported, eulerFilter, filterPrecision, allFrames, allBones, skins, boneSize, scaleFactor, flatInbetween, versionIndex, isAscii);
 }
Пример #19
0
 public static void Export(String path, IImported imp, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, float filterPrecision, String exportFormat, bool allFrames, bool skins)
 {
     Fbx.Exporter.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, filterPrecision, exportFormat, allFrames, skins);
 }
Пример #20
0
Файл: Fbx.cs Проект: kkdevs/sb3u
 public static void Export(String path, IImported imp, int startKeyframe, int endKeyframe, bool linear, bool EulerFilter, float filterPrecision, String exportFormat, bool allFrames, bool allBones, bool skins, float boneSize, bool flatInbetween, bool compatibility)
 {
     Fbx.Exporter.Export(path, imp, startKeyframe, endKeyframe, linear, EulerFilter, filterPrecision, exportFormat, allFrames, allBones, skins, boneSize, flatInbetween, compatibility);
 }
Пример #21
0
 public static void ExportFbx(string path, IImported imported, bool eulerFilter, float filterPrecision,
                              bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii)
 {
     Fbx.Exporter.Export(path, imported, eulerFilter, filterPrecision, allNodes, skins, animation, blendShape, castToBone, boneSize, scaleFactor, versionIndex, isAscii);
 }
Пример #22
0
 public static void ExportMorph(String path, IImported imp, String exportFormat, bool oneBlendShape, bool compatibility)
 {
     Fbx.Exporter.ExportMorph(path, imp, exportFormat, oneBlendShape, compatibility);
 }