Beispiel #1
0
        // export all morphs as fbx
        private void aSFbxToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PccTreeNode pccNode = LeftTree.SelectedNode as PccTreeNode;

            if (pccNode != null)
            {
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                fbd.Description = "Select folder where to save the morphs";
                if (fbd.ShowDialog() == DialogResult.OK)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    var exporter         = new MEMeshMorphExporter.Exporters.MeshExporter(pccNode.pcc);
                    int morphNotExported = exporter.ExportMorphsToFbx(fbd.SelectedPath);
                    Cursor.Current = Cursors.Default;
                    if (morphNotExported == 0)
                    {
                        MessageBox.Show("Done.");
                    }
                    else
                    {
                        MessageBox.Show("Done, but " + morphNotExported + " could not be exported because basemesh was not found.");
                    }
                }
            }
        }
Beispiel #2
0
        // Export all morphs as json
        private void aSJsonToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PccTreeNode pccNode = LeftTree.SelectedNode as PccTreeNode;

            if (pccNode != null)
            {
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                fbd.Description = "Select folder where to save the morphs";
                if (fbd.ShowDialog() == DialogResult.OK)
                {
                    this.Cursor = Cursors.WaitCursor;
                    var exporter = new MEMeshMorphExporter.Exporters.MeshExporter(pccNode.pcc);
                    exporter.ExportMorphsToJson(fbd.SelectedPath);
                    this.Cursor = Cursors.Default;
                    MessageBox.Show("Done.");
                }
            }
        }
Beispiel #3
0
        public TreeNode BuildPccTree(string pcc)
        {
            if (!_isPackageHandlerInitialized)
            {
                MEPackageHandler.Initialize();
                _isPackageHandlerInitialized = true;;
            }

            // check first if this pcc has already been added in the tree
            bool IsPccAlreadyInTree = PccList.Find(ptn => ptn.pcc.FileName == pcc) != null;

            if (IsPccAlreadyInTree)
            {
                return(null);
            }

            var Pcc = MEPackageHandler.OpenMEPackage(pcc);

            /*
             * ME3Package me3Pcc = Pcc as ME3Package;
             *
             * if (me3Pcc == null)
             * {
             *  // supports only ME3 for the time being
             *  throw new ArgumentException("This is not a ME3 package. The tool only supports ME3 at this time.");
             * }
             * */

            PccTreeNode pccRootNode = null;

            var MorphExpIndexes = Pcc.Exports.Select((value, index) => new { value, index })
                                  .Where(z => z.value.ClassName == "BioMorphFace")
                                  .Select(z => z.index);

            if (MorphExpIndexes.Count() > 0)
            {
                pccRootNode = new PccTreeNode(Pcc);

                // Morphs
                TreeNode ParentMorphNode = new TreeNode();
                ParentMorphNode.Text = "BioMorphFace";

                foreach (int morphIndex in MorphExpIndexes)
                {
                    var           morph     = new Unreal.BioMorphFace(Pcc, morphIndex);
                    MorphTreeNode morphNode = new MorphTreeNode(morph);
                    ParentMorphNode.Nodes.Add(morphNode);
                }

                // Meshes
                TreeNode ParentMeshNode = new TreeNode();
                ParentMeshNode.Text = "SkeletalMesh";

                var MeshExpIndexes = Pcc.Exports.Select((value, index) => new { value, index })
                                     .Where(z => z.value.ClassName == "SkeletalMesh")
                                     .Select(z => z.index);

                foreach (int meshIndex in MeshExpIndexes)
                {
                    IExportEntry exp = Pcc.Exports[meshIndex];
                    //SkeletalMesh skMesh = new SkeletalMesh((ME3Package)Pcc, meshIndex);
                    var          skMesh   = new Unreal.MESkeletalMesh(Pcc, meshIndex);
                    MeshTreeNode meshNode = new MeshTreeNode(skMesh, exp);
                    ParentMeshNode.Nodes.Add(meshNode);
                }

                // build hierarchy
                pccRootNode.Nodes.Add(ParentMeshNode);
                pccRootNode.Nodes.Add(ParentMorphNode);

                // add in the list
                PccList.Add(pccRootNode);
            }
            else
            {
                Pcc = null;
            }
            return(pccRootNode);
        }