示例#1
0
        public void ImportFolder(string inFolder)
        {
            DirectoryInfo dir = new DirectoryInfo(inFolder);

            FileInfo[] files;

            files = dir.GetFiles();
            foreach (FileInfo info in files)
            {
                string ext = Path.GetExtension(info.FullName).ToUpper();
                if (ext == ".PNG" || ext == ".TGA" || ext == ".BMP" || ext == ".JPG" || ext == ".JPEG" || ext == ".GIF" || ext == ".TIF" || ext == ".TIFF")
                {
                    using (TextureConverterDialog dlg = new TextureConverterDialog())
                    {
                        dlg.ImageSource = info.FullName;
                        dlg.ShowDialog(null, this);
                    }
                }
                else if (ext == ".TEX0")
                {
                    TEX0Node node = NodeFactory.FromFile(null, info.FullName) as TEX0Node;
                    GetOrCreateFolder <TEX0Node>().AddChild(node);
                }
                else if (ext == ".MDL0")
                {
                    MDL0Node node = NodeFactory.FromFile(null, info.FullName) as MDL0Node;
                    GetOrCreateFolder <MDL0Node>().AddChild(node);
                }
                else if (ext == ".CHR0")
                {
                    CHR0Node node = NodeFactory.FromFile(null, info.FullName) as CHR0Node;
                    GetOrCreateFolder <CHR0Node>().AddChild(node);
                }
                else if (ext == ".CLR0")
                {
                    CLR0Node node = NodeFactory.FromFile(null, info.FullName) as CLR0Node;
                    GetOrCreateFolder <CLR0Node>().AddChild(node);
                }
                else if (ext == ".SRT0")
                {
                    SRT0Node node = NodeFactory.FromFile(null, info.FullName) as SRT0Node;
                    GetOrCreateFolder <SRT0Node>().AddChild(node);
                }
                else if (ext == ".SHP0")
                {
                    SHP0Node node = NodeFactory.FromFile(null, info.FullName) as SHP0Node;
                    GetOrCreateFolder <SHP0Node>().AddChild(node);
                }
                else if (ext == ".PAT0")
                {
                    PAT0Node node = NodeFactory.FromFile(null, info.FullName) as PAT0Node;
                    GetOrCreateFolder <PAT0Node>().AddChild(node);
                }
                else if (ext == ".VIS0")
                {
                    VIS0Node node = NodeFactory.FromFile(null, info.FullName) as VIS0Node;
                    GetOrCreateFolder <VIS0Node>().AddChild(node);
                }
            }
        }
 public void ApplyCLR(CLR0Node node, int index)
 {
     //Apply color changes
     if (_matList != null)
         foreach (MDL0MaterialNode m in _matList)
             m.ApplyCLR0(node, index);
 }
 internal void ApplyCLR0(CLR0Node node, int index)
 {
     if (node == null) return;
     CLR0MaterialNode mat = node.FindChild(Name, false) as CLR0MaterialNode;
     if (mat != null)
         foreach (CLR0MaterialEntryNode e in mat.Children)
         {
             ARGBPixel p = e.Colors.Count > index ? e.Colors[index] : new ARGBPixel();
             switch (e.Target)
             {
                 case EntryTarget.Ambient0: amb1 = (RGBAPixel)p; break;
                 case EntryTarget.Ambient1: amb2 = (RGBAPixel)p; break;
                 case EntryTarget.Color0: clr1 = (RGBAPixel)p; break;
                 case EntryTarget.Color1: clr2 = (RGBAPixel)p; break;
                 case EntryTarget.TevColorReg0: c1 = (GXColorS10)p; break;
                 case EntryTarget.TevColorReg1: c2 = (GXColorS10)p; break;
                 case EntryTarget.TevColorReg2: c3 = (GXColorS10)p; break;
                 case EntryTarget.TevKonstReg0: k1 = (GXColorS10)p; break;
                 case EntryTarget.TevKonstReg1: k2 = (GXColorS10)p; break;
                 case EntryTarget.TevKonstReg2: k3 = (GXColorS10)p; break;
                 case EntryTarget.TevKonstReg3: k4 = (GXColorS10)p; break;
             }
         }
 }