//============================================================ // <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 ScanTextures() { string rootDirectory = _folder.Directory; foreach (INamePair <FDrTexture> pair in RContent3dManager.TextureConsole.Textures) { FDrTexture texture = pair.Value; String name = texture.Name; FDrMaterialGroup materialGroup = FindGroup(name); if (materialGroup != null) { continue; } // 创建材质组 FDrFolder folder = texture.Folder; FObjects <FCfgFolder> stack = folder.FetchFolderStack(false); string materialPath = folder.FolderPath().Replace("tx-", "mt-"); string materialDirectory = rootDirectory + materialPath; RDirectory.MakeDirectories(materialDirectory); FDrTheme theme = RContent3dManager.ThemeConsole.DefaultTheme; // 创建材质组 materialGroup = new FDrMaterialGroup(); materialGroup.Name = name; materialGroup.ConfigFileName = materialDirectory + "/config.xml"; // 创建材质 FDrMaterial material = new FDrMaterial(); material.Theme = theme; material.EffectName = theme.EffectName; materialGroup.Materials.Push(material); foreach (FDrTextureBitmap bitmap in texture.Bitmaps) { FDrMaterialTexture materialTexture = new FDrMaterialTexture(); materialTexture.TypeCd = bitmap.TypeCd; materialTexture.Source = texture.Name; materialTexture.SourceTypeCd = bitmap.TypeCd; materialTexture.SourceIndex = bitmap.Index; materialGroup.Textures.Push(materialTexture); } // 存储材质 materialGroup.Store(); _materials.Set(name, materialGroup); _logger.Debug(this, "ScanTextures", "Create material. (name={0})", materialDirectory); } }