//============================================================ // <T>选中对象。</T> //============================================================ private void tvwCatalog_AfterSelect(object sender, TreeViewEventArgs e) { FDrFolder folder = e.Node.Tag as FDrFolder; if (null != folder) { SelectItem(folder.Tag); } }
//============================================================ // <T>Check 所有的复选框</T> //============================================================ private void lsbScenes_SelectedIndexChanged(object sender, System.EventArgs e) { FDrFolder folder = tvwCatalog.SelectedNode.Tag as FDrFolder; if (null != folder) { FDrSceneGroup group = folder.Tag as FDrSceneGroup; if (null != group) { FDrScene scene = group.Scenes[lsbScenes.SelectedIndex]; qdrSceneProperty.LoadScene(scene); } } }
//============================================================ // <T>加载树目录。</T> //============================================================ private void LoadCatalogNode(TreeNodeCollection nodes, FCfgFolder folder) { // 标志是否加载资源文件 bool loaded = true; // 取得文件中子文件的个数 int count = folder.Folders.Count; for (int n = 0; n < count; n++) { // 循环取得每个文件 FDrFolder subfolder = folder.Folders[n] as FDrFolder; // 生成节点 TreeNode childNode = new TreeNode(subfolder.Label); childNode.Tag = subfolder; subfolder.TreeNode = childNode; // 取得路径 string path = subfolder.ConfigFileName; object tag = subfolder.Tag; if (tag is FDrColorTexture) { childNode.ImageKey = "light"; childNode.SelectedImageKey = "light"; loaded = false; } else if (tag is FDrClipTexture) { childNode.ImageKey = "clip"; childNode.SelectedImageKey = "clip"; loaded = false; } else if (tag is FDrLayerTexture) { childNode.ImageKey = "layer"; childNode.SelectedImageKey = "layer"; loaded = false; } else { childNode.ImageKey = "folder"; childNode.SelectedImageKey = "folder"; } nodes.Add(childNode); if (loaded) { LoadCatalogNode(childNode.Nodes, subfolder); } } }
//============================================================ // <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); } }
//============================================================ // <T>扫描所有节点。</T> // // @param folder 文件夹 // @param path 路径 //============================================================ private void ScanNodes(FDrFolder folder, string path) { string fileTag = string.Empty; // 文件夹排序 folder.Folders.Sort(); // 循环取得每个文件 foreach (FDrFolder subfloder in folder.Folders) { // 获得经过处理的名称 string[] items = subfloder.Name.Split('-'); if (items.Length >= 3) { string type = items[0]; string dotPath = path + "\\" + items[1]; if (type == "fd") { subfloder.Type = "folder"; subfloder.Label = items[1] + " [" + items[2] + "]"; } else if (type == "mt") { subfloder.Type = "material"; FDrMaterialGroup materialGroup = new FDrMaterialGroup(); subfloder.Label = items[1] + " [" + items[2] + "]"; materialGroup.Name = dotPath; materialGroup.Label = items[2]; materialGroup.Directory = subfloder.Directory; materialGroup.DirectoryExprot = _exportDirectory; materialGroup.Scan(); // 存储对照表 if (materialGroup.OptionValid) { subfloder.Tag = materialGroup; _materials.Set(materialGroup.Code, materialGroup); _folders.Push(subfloder); } } ScanNodes(subfloder, dotPath); } } }
//============================================================ // <T>扫描所有节点。</T> // // @param folder 文件夹 // @param path 路径 //============================================================ protected void ScanNodes(FDrFolder folder, string path) { string fileTag = string.Empty; // 文件夹排序 folder.Folders.Sort(); // 循环取得每个文件 foreach (FDrFolder subfloder in folder.Folders) { // 获得经过处理的名称 string[] items = subfloder.Name.Split('-'); if (items.Length >= 3) { string type = items[0]; string dotPath = path + "\\" + items[1]; if ("fd" == type) { subfloder.Type = "folder"; subfloder.Label = items[1] + " [" + items[2] + "]"; } else if ("sc" == type) { subfloder.Type = "scene"; FDrSceneGroup group = new FDrSceneGroup(); subfloder.Label = items[1] + " [" + items[2] + "]"; group.Name = dotPath; group.Label = items[2]; group.Directory = subfloder.Directory; group.DirectoryExprot = _exportDirectory; group.Scan(); subfloder.Tag = group; // 存储对照表 _sceneGroups.Set(group.Code, group); _folders.Push(subfloder); } ScanNodes(subfloder, dotPath); } } }
//============================================================ // <T>扫描所有节点。</T> // // @param folder 文件夹 // @param path 路径 //============================================================ protected void ScanNodes(FDrFolder folder, string path) { string fileTag = string.Empty; // 文件夹排序 folder.Folders.Sort(); // 循环取得每个文件 foreach (FDrFolder subfloder in folder.Folders) { // 获得经过处理的名称 string[] items = subfloder.Name.Split('-'); if (items.Length >= 3) { string type = items[0]; string dotPath = path + "\\" + items[1]; if ("fd" == type) { subfloder.Type = "folder"; subfloder.Label = items[1] + " [" + items[2] + "]"; } else if ("tp" == type) { subfloder.Type = "template"; FDrTemplate template = new FDrTemplate(); subfloder.Label = items[1] + " [" + items[2] + "]"; template.Name = dotPath; template.Label = items[2]; template.Directory = subfloder.Directory; // template.ExportPath = _exportDirectory; template.Scan(); subfloder.Tag = template; // 存储对照表 _templates.Set(template.Code, template); _folders.Push(subfloder); } ScanNodes(subfloder, dotPath); } } }
//============================================================ // <T>扫描所有节点。</T> // // @param folder 文件夹 // @param path 路径 //============================================================ private void ScanNodes(FDrFolder folder, string path) { string fileTag = string.Empty; // 文件夹排序 folder.Folders.Sort(); // 循环取得每个文件 foreach (FDrFolder subfloder in folder.Folders) { // 获得经过处理的名称 string[] items = subfloder.Name.Split('-'); if (items.Length >= 3) { string type = items[0]; string dotPath = path + "\\" + items[1]; if ("fd" == type) { subfloder.Type = "folder"; subfloder.Label = items[1] + " [" + items[2] + "]"; } else if ("md" == type) { subfloder.Type = "material"; FDrModel model = new FDrModel(); subfloder.Label = items[1] + " [" + items[2] + "]"; model.Name = dotPath; model.Label = items[2]; model.Directory = subfloder.Directory; model.DirectoryExprot = _exportDirectory; model.Scan(); subfloder.Tag = model; // 存储对照表 _models.Set(model.Code, model); _folders.Push(subfloder); } ScanNodes(subfloder, dotPath); } } }
//============================================================ // <T>扫描所有节点。</T> // // @param folder 文件夹 // @param path 路径 //============================================================ protected void ScanNodes(FDrFolder folder, string path) { string fileTag = string.Empty; // 文件夹排序 folder.Folders.Sort(); // 循环取得每个文件 foreach (FDrFolder subfloder in folder.Folders) { // 获得经过处理的名称 string[] items = subfloder.Name.Split('-'); if (items.Length >= 3) { string type = items[0]; string dotPath = path + "\\" + items[1]; if ("fd" == type) { subfloder.Type = "folder"; subfloder.Label = items[1] + " [" + items[2] + "]"; } else if ("tp" == type) { subfloder.Type = "camera"; FDrCamera camera = new FDrCamera(); subfloder.Label = items[1] + " [" + items[2] + "]"; camera.Name = dotPath; camera.Label = items[2]; camera.Directory = subfloder.Directory; camera.Scan(); subfloder.Tag = camera; // 存储对照表 _cameras.Set(camera.Code, camera); _folders.Push(subfloder); } ScanNodes(subfloder, dotPath); } } }
//============================================================ // <T>扫描所有节点。</T> // // @param folder 文件夹 // @param path 路径 //============================================================ protected void ScanNodes(FDrFolder folder, string path) { string fileTag = string.Empty; // 文件夹排序 folder.Folders.Sort(); // 循环取得每个文件 foreach (FDrFolder subfloder in folder.Folders) { // 获得经过处理的名称 string[] items = subfloder.Name.Split('-'); if (items.Length >= 3) { string type = items[0]; string dotPath = path + "\\" + items[1]; if ("fd" == type) { // 存储文件夹 subfloder.Type = "folder"; subfloder.Label = items[1] + " [" + items[2] + "]"; } else if ("tx" == type) { // 纹理光源 subfloder.Type = "texture.light"; FDrTexture texture = new FDrColorTexture(); subfloder.Label = items[1] + " [" + items[2] + "]"; texture.Name = dotPath; texture.Label = items[2]; texture.Folder = subfloder; texture.Directory = subfloder.Directory; texture.DirectoryExprot = _exportDirectory; texture.Scan(); subfloder.Tag = texture; // 存储对照表 _textures.Set(texture.Code, texture); _folders.Push(subfloder); } else if ("tc" == type) { // 纹理剪辑 subfloder.Type = "texture.clip"; FDrTexture texture = new FDrClipTexture(); subfloder.Label = items[1] + " [" + items[2] + "]"; texture.Name = dotPath; texture.Label = items[2]; texture.Folder = subfloder; texture.Directory = subfloder.Directory; texture.DirectoryExprot = _exportDirectory; texture.Scan(); subfloder.Tag = texture; // 存储对照表 _textures.Set(texture.Code, texture); _folders.Push(subfloder); } else if ("tl" == type) { // 纹理分层 subfloder.Type = "texture.layer"; FDrTexture texture = new FDrLayerTexture(); subfloder.Label = items[1] + " [" + items[2] + "]"; texture.Name = dotPath; texture.Label = items[2]; texture.Folder = subfloder; texture.Directory = subfloder.Directory; texture.DirectoryExprot = _exportDirectory; texture.Scan(); subfloder.Tag = texture; // 存储对照表 _textures.Set(texture.Code, texture); _folders.Push(subfloder); } else if ("tt" == type) { // 纹理地形 subfloder.Type = "texture.terrain"; FDrTexture texture = new FDrTerrainTexture(); subfloder.Label = items[1] + " [" + items[2] + "]"; texture.Name = dotPath; texture.Label = items[2]; texture.Folder = subfloder; texture.Directory = subfloder.Directory; texture.DirectoryExprot = _exportDirectory; texture.Scan(); subfloder.Tag = texture; // 存储对照表 _textures.Set(texture.Code, texture); _folders.Push(subfloder); } ScanNodes(subfloder, dotPath); } } }