//============================================================ //<T>展现纹理图片<T> //============================================================ private void MaterialImage(FCfgFolder fol) { FDrMaterialGroup material = fol.Tag as FDrMaterialGroup; ListViewGroup group = new ListViewGroup(); int n = 1; material.Open(); foreach (FDrModelMaterialTexture mat in material.Textures) { if (null != mat && mat.Texture != null) { string path = mat.Texture.Directory + "\\icon\\" + mat.SourceType + ".jpg"; if (RFile.Exists(path)) { Bitmap bit = new Bitmap(path); imageList.Images.Add(bit); int count = imageList.Images.Count; imageList.Images.SetKeyName(count - 1, mat.SourceType + ".jpg"); n++; } } } group.Tag = material; group.Name = fol.Label + "-" + n.ToString(); listView1.Groups.Add(group); }
//============================================================ // <T>扫描工作路径,获得对象列表。</T> //============================================================ public override void Scan() { base.Scan(); _configFileName = _directory + "\\" + _techniqueName + ".xml"; // 设置目录 if (_techniqueName == "config") { _exportFileName = _directoryExprot + "\\sc_" + Code + ".swf"; } else { _exportFileName = _directoryExprot + "\\sc_" + Code + "." + _techniqueName + ".swf"; } // 加载设置文件 if (RFile.Exists(_configFileName)) { string fileName = _directory + "\\" + _techniqueName + ".xml"; try { LoadConfig(new FXmlDocument(fileName).Root); } catch (Exception e) { RMoCore.TrackConsole.Write(this, "Scan", "Load config file failure. (file_name={0}, error={1})", fileName, e.Message); LoadConfig(new FXmlDocument(fileName).Root); } } }
//============================================================ // <T>加载所有目录。</T> //============================================================ public virtual void LoadFolderAll() { // 加载所有子目录 foreach (string path in RDirectory.ListDirectories(_directory)) { // 跳过SVN目录 if (path.IndexOf(".svn") != -1) { continue; } // 加载子目录 OnLoadFolder(path); } if (_folders != null) { _folders.Sort(); } // 加载配置 if (RFile.Exists(ConfigFileName)) { FXmlDocument xdoc = new FXmlDocument(); try { xdoc.LoadFile(ConfigFileName); } catch (Exception e) { throw new FFatalException(e, "Open config file error. (file_name={0})", ConfigFileName); } LoadConfig(xdoc.Root); } }
//============================================================ // <T>扫描工作路径,获得对象列表。</T> //============================================================ public override void Scan() { base.Scan(); // 设置目录 _exportFileName = _directoryExprot + "\\tx_" + Code + ".swf"; // 查询图片 string resourceDirectory = RContent3dManager.TextureConsole.ResourceDirectory; foreach (string filename in RDirectory.ListFiles(_directory)) { if (filename.EndsWith(".jpg")) { FFileInfo info = new FFileInfo(filename); FDrTextureBitmap bitmap = new FDrTextureBitmap(); bitmap.TypeCd = EDrTexture.Diffuse; bitmap.Source = info.FullName.Substring(resourceDirectory.Length); bitmap.FileName = info.FullName; bitmap.Length = info.Info.Length; _bitmaps.Push(bitmap); } } // 加载设置文件 if (RFile.Exists(_configFileName)) { LoadConfigFile(_configFileName); } }
//============================================================ // <T>加载全部处理。</T> //============================================================ public virtual void LoadAll() { // 清空集合 if (_folders != null) { _folders.Clear(); } if (_objects != null) { _objects.Clear(); } // 加载所有子目录 foreach (string path in RDirectory.ListDirectories(_directory)) { // 跳过SVN目录 if (path.IndexOf(".svn") != -1) { continue; } // 加载子目录 OnLoadFolder(path); } if (_folders != null) { _folders.Sort(); } // 加载配置 if (RFile.Exists(ConfigFileName)) { FXmlDocument xdoc = new FXmlDocument(); xdoc.LoadFile(ConfigFileName); LoadConfig(xdoc.Root); } }
//============================================================ // <T>扫描资源。</T> //============================================================ public override void Scan() { base.Scan(); // 扫描所有文件 _optionValid = true; FStrings fileNames = RDirectory.ListFiles(_directory); fileNames.Sort(); foreach (string fileName in fileNames) { // 文件是否图片 string name = fileName.Substring(fileName.LastIndexOf("\\") + 1); if (name.EndsWith(".png")) { name = name.Substring(0, name.Length - 4); // 是否符合命名标准 if (5 == name.Length) { int direction = RInt.Parse(name.Substring(0, 1)); int frameIndex = RInt.Parse(name.Substring(1)) - 1; // 同步剪辑 FRsResourceClip clip = SyncClip(direction); FRsResourceFrame frame = new FRsResourceFrame(); frame.FileName = fileName; clip.PushFrame(frame); // 设置有效 _optionValid = true; } else { RMoCore.TrackConsole.Write(this, "Scan", "Invalid picture define. (file_name={0})", fileName); } } } // 检查剪辑帧数相等 FRsResourceClip firstClip = FristClip; if (null != firstClip) { foreach (FRsResourceClip clip in _clips) { if (clip != null) { if (firstClip.FrameCount != clip.FrameCount) { RMoCore.TrackConsole.Write(this, "Scan", "Animation clip frame is differenty. (first_frames={0}, clip_frames={1})", firstClip.FrameCount, clip.FrameCount); } } } } string _configName = _directory + "\\config.xml"; if (RFile.Exists(_configName)) { FXmlDocument xdoc = new FXmlDocument(); xdoc.LoadFile(_configName); LoadConfig(xdoc.Root); } }
//============================================================ // <T>扫描工作路径,获得对象列表。</T> //============================================================ public override void Scan() { base.Scan(); // 检查文件集合 FStrings fileNames = RDirectory.ListFiles(_directory); foreach (string fileName in fileNames) { if (fileName.EndsWith(".xml")) { string name = RFile.GetFileName(fileName); name = name.Substring(0, name.Length - 4); if (name.StartsWith("import.") || name.StartsWith("temp.")) { continue; } FDrScene scene = new FDrScene(); scene.Name = _name; scene.Label = _label; scene.TechniqueName = name; scene.Directory = _directory; scene.DirectoryExprot = _directoryExprot; scene.Scan(); _scenes.Push(scene); } } // 设置目录 _exportFileName = _directoryExprot + "\\sc_" + Code + ".swf"; // 加载设置文件 if (RFile.Exists(_configFileName)) { //LoadConfig(new FXmlDocument(_directory + "\\config.xml").Root); } }
//============================================================ // <T>打开材质信息。</T> //============================================================ public override void Scan() { base.Scan(); // 加载设置文件 _optionValid = RFile.Exists(_configFileName); if (_optionValid) { LoadConfigFile(_configFileName); } }
//============================================================ // <T>加载配置文件。</T> //============================================================ public void LoadDirectory() { // 获得文件名称 string fileName = _directory + @"\config.xml"; if (!RFile.Exists(fileName)) { return; } // 加载设置 using (FXmlDocument xmldoc = new FXmlDocument(fileName)) { LoadConfig(xmldoc.Root); } }
//============================================================ // <T>打开材质信息。</T> //============================================================ public override void Scan() { base.Scan(); _exportFileName = RContent3dManager.TemplateConsole.ExportDirectory + "\\tp_" + Code + ".swf"; _exportDataFileName = RContent3dManager.TemplateConsole.ExportDirectory + ".dt\\tp_" + Code + ".swf"; // 加载设置文件 if (RFile.Exists(_configFileName)) { LoadConfigFile(_configFileName); } }
//============================================================ // <T>加载路径。</T> // // @param directory 路径 //============================================================ public static void LoadDirectory(string directory) { _directory = directory; // 加载应用信息 string appFile = _directory + @"\Tools\Configuration\application.xml"; if (RFile.Exists(appFile)) { FXmlDocument xdoc = new FXmlDocument(); // 加载文件 xdoc.LoadFile(appFile); LoadConfig(xdoc.Root); } }
//============================================================ // <T>打开设置文件。</T> //============================================================ public override void Scan() { base.Scan(); // 设置文件名称 _modelFileName = _directory + "\\model.m3x"; _meshFileName = _directory + "\\model.msh"; _exportFileName = _directoryExprot + "\\md_" + Code + ".swf"; _exportDataFileName = _directoryExprot + ".dt\\md_" + Code + ".swf"; // 加载设置文件 if (RFile.Exists(_configFileName)) { LoadConfigFile(_configFileName); } }
//============================================================ // <T>打开材质信息。</T> //============================================================ public void Open() { if (!_initialized) { _configFileName = _path + "\\config.xml"; _exportFileName = _exprotPath + "\\mp_" + _name + ".swf"; // 加载设置文件 if (RFile.Exists(_configFileName)) { LoadConfigFile(_configFileName); } // 设置输出路径 _exportFilePath = _exprotPath + "\\" + RInt.Pad(_id, 4); RDirectory.MakeDirectories(_exportFilePath); _initialized = true; } }
//============================================================ // <T>导入设置信息。</T> //============================================================ public void ImportConfig() { Dispose(); // 加载设置文件 string fileName = _directory + "\\import." + _techniqueName + ".xml"; if (RFile.Exists(fileName)) { LoadOrignConfig(new FXmlDocument(fileName).Root); } // 压缩文件 FCompressFile file = new FCompressFile(); Serialize(file); file.Compress(_exportFileName); _logger.Debug(this, "Export", "Export scene success. (file_name={0})", _exportFileName); // 存储信息 Store(); _logger.Debug(this, "Import", "Import scene success. (file_name={0})", fileName); }
//============================================================ // <T>打开处理。</T> //============================================================ public void Open() { if (!RFile.Exists(_configFileName)) { return; } if (_opened) { return; } using (FXmlDocument xdocument = new FXmlDocument(_configFileName)){ FXmlNode xconfig = xdocument.Root; foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Constant")) { FTplConstant constant = new FTplConstant(); constant.LoadConfig(xnode); _constants.Push(constant); } } } _opened = true; }
//============================================================ // <T>打开处理。</T> //============================================================ public void Open() { if (!RFile.Exists(_configFileName)) { return; } if (_opened) { return; } using (FXmlDocument xdocument = new FXmlDocument(_configFileName)) { FXmlNode xconfig = xdocument.Root; foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Style")) { FTplStyle style = new FTplStyle(); style.LoadConfig(xnode); _styles.Push(style); } } } _opened = true; }
//============================================================ // <T>扫描工作路径,获得对象列表。</T> //============================================================ public override void Scan() { base.Scan(); // 设置目录 _exportFileName = _directoryExprot + "\\tx_" + Code + ".swf"; // 查询图片 string resourceDirectory = RContent3dManager.TextureConsole.ResourceDirectory; foreach (string filename in RDirectory.ListFiles(_directory)) { if (filename.EndsWith("layer.merge.jpg")) { // 加入和冰层 FFileInfo info = new FFileInfo(filename); FDrTextureBitmap bitmap = new FDrTextureBitmap(); bitmap.TypeCd = EDrTexture.LayerMerge; bitmap.Source = info.FullName.Substring(resourceDirectory.Length); bitmap.FileName = info.FullName; bitmap.Length = info.Info.Length; _bitmaps.Push(bitmap); } } foreach (string filename in RDirectory.ListFiles(_directory)) { if (filename.EndsWith("layer.merge.jpg")) { continue; } else if (filename.EndsWith(".jpg") && !filename.EndsWith(".m.jpg")) { // 加入纹理层 FFileInfo info = new FFileInfo(filename); FDrTextureBitmap bitmap = new FDrTextureBitmap(); if (filename.EndsWith("layer.1.jpg")) { bitmap.TypeCd = EDrTexture.Layer1; } else if (filename.EndsWith("layer.2.jpg")) { bitmap.TypeCd = EDrTexture.Layer2; } else if (filename.EndsWith("layer.3.jpg")) { bitmap.TypeCd = EDrTexture.Layer3; } else if (filename.EndsWith("layer.4.jpg")) { bitmap.TypeCd = EDrTexture.Layer4; } bitmap.Source = info.FullName.Substring(resourceDirectory.Length); bitmap.FileName = info.FullName; bitmap.Length = info.Info.Length; _bitmaps.Push(bitmap); } } // 加载设置文件 if (RFile.Exists(_configFileName)) { LoadConfigFile(_configFileName); } }