private JointMapView(LUtfNode node)
 {
     unique     = uniqueCount--;
     name       = node.Name;
     scriptName = node.Parent.Name;
     map        = new JointMap(EditableUtf.NodeToEngine(node));
 }
Example #2
0
        bool Finish(out EditableUtf result)
        {
            result = null;
            var utf = new EditableUtf();
            //Vanity
            var expv = new LUtfNode()
            {
                Name = "Exporter Version", Parent = utf.Root
            };

            expv.Data = System.Text.Encoding.UTF8.GetBytes(EXPORTER_VERSION);
            utf.Root.Children.Add(expv);
            //Actual stuff
            if (output.Count == 1)
            {
                if (output[0].Children.Count == 0)
                {
                    Export3DB(utf.Root, output[0]);
                }
                else
                {
                    return(false); //TODO: CMP
                }
                result = utf;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 public UtfTab(MainWindow main, EditableUtf utf, string title)
 {
     this.main = main;
     Utf       = utf;
     Title     = title;
     text      = new TextBuffer();
 }
Example #4
0
 public UtfTab(MainWindow main, EditableUtf utf, string title)
 {
     this.main = main;
     Utf       = utf;
     Title     = title;
     text      = new TextBuffer();
     main.Resources.AddResources(utf.Export(), Unique.ToString());
 }
Example #5
0
 public UtfTab(MainWindow main, EditableUtf utf, string title)
 {
     this.main    = main;
     Utf          = utf;
     DocumentName = title;
     Title        = string.Format("{0}##{1}", title, Unique);
     text         = new TextBuffer();
     main.Resources.AddResources(utf.Export(), Unique.ToString());
     RegisterPopups();
 }
Example #6
0
 //generated parameter is used for utf generated internally, like from the collada exporter
 //saves a bunch of copies when opening a large UTF from disk
 public UtfTab(MainWindow main, EditableUtf utf, string title, bool generated = false)
 {
     this.main    = main;
     Utf          = utf;
     DocumentName = title;
     Title        = title;
     text         = new TextBuffer();
     if (generated)
     {
         utf.Source = utf.Export();
     }
     if (utf.Source != null)
     {
         main.Resources.AddResources(utf.Source, Unique.ToString());
         utf.Source = null;
     }
     RegisterPopups();
 }
Example #7
0
        bool Finish(out EditableUtf result)
        {
            result = null;
            var utf = new EditableUtf();
            //Vanity
            var expv = new LUtfNode()
            {
                Name = "Exporter Version", Parent = utf.Root
            };

            expv.Data = System.Text.Encoding.UTF8.GetBytes(EXPORTER_VERSION);
            utf.Root.Children.Add(expv);
            //Apply Material names
            foreach (var mdl in output)
            {
                ApplyMatNames(mdl);
            }
            //Actual stuff
            if (output.Count == 1)
            {
                var modelName = modelNameBuffer.GetText();
                if (string.IsNullOrEmpty(modelName))
                {
                    modelName = modelNameDefault;
                }
                if (output[0].Children.Count == 0)
                {
                    Export3DB(modelName, utf.Root, output[0]);
                }
                else
                {
                    var suffix = (new Random().Next()) + ".3db";
                    var vmslib = new LUtfNode()
                    {
                        Name = "VMeshLibrary", Parent = utf.Root, Children = new List <LUtfNode>()
                    };
                    utf.Root.Children.Add(vmslib);
                    var cmpnd = new LUtfNode()
                    {
                        Name = "Cmpnd", Parent = utf.Root, Children = new List <LUtfNode>()
                    };
                    utf.Root.Children.Add(cmpnd);
                    ExportModels(modelName, utf.Root, suffix, vmslib, output[0]);
                    int            cmpndIndex = 1;
                    FixConstructor fix        = new FixConstructor();
                    cmpnd.Children.Add(CmpndNode(cmpnd, "Root", output[0].Name + suffix, "Root", 0));
                    foreach (var child in output[0].Children)
                    {
                        ProcessConstruct("Root", child, cmpnd, fix, suffix, ref cmpndIndex);
                    }
                    var cons = new LUtfNode()
                    {
                        Name = "Cons", Parent = cmpnd, Children = new List <LUtfNode>()
                    };
                    var trs = new LUtfNode()
                    {
                        Name = "Fix", Parent = cons, Data = fix.GetData()
                    };
                    cons.Children.Add(trs);
                    cmpnd.Children.Add(cons);
                }
                if (generateMaterials)
                {
                    List <string> materials = new List <string>();
                    foreach (var mdl in output)
                    {
                        IterateMaterials(materials, mdl);
                    }
                    var mats = new LUtfNode()
                    {
                        Name = "material library", Parent = utf.Root
                    };
                    mats.Children = new List <LUtfNode>();
                    int i = 0;
                    foreach (var mat in materials)
                    {
                        mats.Children.Add(DefaultMaterialNode(mats, mat, i++));
                    }
                    var txms = new LUtfNode()
                    {
                        Name = "texture library", Parent = utf.Root
                    };
                    txms.Children = new List <LUtfNode>();
                    foreach (var mat in materials)
                    {
                        txms.Children.Add(DefaultTextureNode(txms, mat));
                    }
                    utf.Root.Children.Add(mats);
                    utf.Root.Children.Add(txms);
                }
                result = utf;
                return(true);
            }
            else
            {
                return(false);
            }
        }