public DragData(object source, object sourceObject) { Source = source; SourceObject = sourceObject; Parameters = new Mogre.NameValuePairList(); }
public override void ProcessParameters(Mogre.NameValuePairList parameters) { Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("Name")) != parameters.End()) { this.name = ni.Value; } if ((ni = parameters.Find("Position")) != parameters.End()) { this.position = Mogre.StringConverter.ParseVector3(ni.Value); } if ((ni = parameters.Find("Orientation")) != parameters.End()) { this.orientation = Mogre.StringConverter.ParseQuaternion(ni.Value); } if ((ni = parameters.Find("ClipDistance")) != parameters.End()) { this.clipDistance = MogreX.StringConverter.ParseVector2(ni.Value); } if ((ni = parameters.Find("FOV")) != parameters.End()) { this.fov = Mogre.StringConverter.ParseReal(ni.Value); } }
public override void ProcessParameters(Mogre.NameValuePairList parameters) { Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("Name")) != parameters.End()) { this.name = ni.Value; } if ((ni = parameters.Find("Position")) != parameters.End()) { this.position = Mogre.StringConverter.ParseVector3(ni.Value); } if ((ni = parameters.Find("Orientation")) != parameters.End()) { this.orientation = Mogre.StringConverter.ParseQuaternion(ni.Value); } if ((ni = parameters.Find("Scale")) != parameters.End()) { this.scale = Mogre.StringConverter.ParseVector3(ni.Value); } if ((ni = parameters.Find("AutoTrackTarget")) != parameters.End()) { this.autoTrackTarget = ni.Value; } }
public override void GetObjectProperties(Mogre.NameValuePairList retList) { retList.Clear(); retList["Name"] = this.name; retList["SceneManagerType"] = SceneMangerType; retList["Ambient"] = Mogre.StringConverter.ToString(this.ambient); retList["SkyBoxActive"] = Mogre.StringConverter.ToString(this.skyBoxActive); retList["SkyBoxMaterial"] = this.skyBoxMaterial; retList["SkyBoxDistance"] = Mogre.StringConverter.ToString(this.skyBoxDistance); switch (this.fogMode) { case Mogre.FogMode.FOG_NONE: retList["FogMode"] = "None"; break; case Mogre.FogMode.FOG_LINEAR: retList["FogMode"] = "Linear"; break; case Mogre.FogMode.FOG_EXP: retList["FogMode"] = "Exp"; break; case Mogre.FogMode.FOG_EXP2: retList["FogMode"] = "Exp2"; break; } retList["FogColour"] = Mogre.StringConverter.ToString(this.fogColour); retList["FogStart"] = Mogre.StringConverter.ToString(this.fogStart); retList["FogEnd"] = Mogre.StringConverter.ToString(this.fogEnd); retList["FogDensity"] = Mogre.StringConverter.ToString(this.fogDensity); }
private void ClearEditors() { this.activeDragData = null; DestroyGizmo(); // Make sure to unload all the viewports first, since they are dependent on SceneManager // but they share the same parent with scene manager and scene manager may get deleted before they do foreach (KeyValuePair <string, BaseEditor> it in this.namesByType[(int)EditorType.Viewport]) { it.Value.UnLoad(); } this.rootEditor.Destroy(false); this.rootEditor = null; ActiveViewport = null; this.sceneManager = null; this.sceneManagerEditor = null; this.selectedEditor = null; this.objCounter = 0; IsSceneModified = false; IsSceneLoaded = false; this.nameList.Clear(); this.updateList.Clear(); SceneUpdated = null; foreach (KeyValuePair <string, BaseEditorFactory> it in this.editorObjectFactories) { if (it.Value != null) { it.Value.InstanceCount = 0; } } foreach (NameObjectPairList it in this.namesByType) { it.Clear(); } foreach (NameObjectPairList it in this.namesByTypeID) { it.Clear(); } BaseEditor parent = null; Mogre.NameValuePairList parameters = new Mogre.NameValuePairList(); this.rootEditor = BaseEditor.Factory.CreateObject(ref parent, parameters); this.gizmoNode = null; this.gizmoX = null; this.gizmoY = null; this.gizmoZ = null; this.oldGizmoMode = EditorTools.None; this.oldGizmoAxis = AxisType.None; }
public override void GetObjectProperties(Mogre.NameValuePairList retList) { retList.Clear(); retList["Name"] = this.name; retList["Position"] = Mogre.StringConverter.ToString(this.position); retList["Orientation"] = Mogre.StringConverter.ToString(this.orientation); retList["Scale"] = Mogre.StringConverter.ToString(this.scale); retList["AutoTrackTarget"] = this.autoTrackTarget; }
public override void GetObjectProperties(Mogre.NameValuePairList retList) { retList.Clear(); retList["Name"] = Name; retList["Position"] = Mogre.StringConverter.ToString(Position); retList["Orientation"] = Mogre.StringConverter.ToString(Orientation); retList["ClipDistance"] = Mogre.StringConverter.ToString(ClipDistance); retList["FOV"] = Mogre.StringConverter.ToString(FOV); }
public override void ProcessParameters(Mogre.NameValuePairList parameters) { Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("Name")) != parameters.End()) { this.name = ni.Value; } }
public override BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { SceneManagerEditor editor = new SceneManagerEditor(); editor.ProcessParameters(parameters); editor.Parent = parent; editor.Load(); InstanceCount++; return(editor); }
public override void GetObjectProperties(Mogre.NameValuePairList retList) { base.GetObjectProperties(retList); retList["MeshFile"] = this.meshFile; retList["CastShadows"] = Mogre.StringConverter.ToString(this.castShadows); for (int i = 0; i < this.subMeshes.Count; ++i) { string paramName = "SubEntity" + Mogre.StringConverter.ToString(i) + "."; retList[paramName + "Visible"] = Mogre.StringConverter.ToString(this.subMeshes[i].Visible); retList[paramName + "Material"] = this.subMeshes[i].Material; } }
public override BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { CameraEditor obj = new CameraEditor(); Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("Init")) != parameters.End()) { parameters["Name"] = "Camera" + MogitorsRoot.Instance.CreateUniqueID("Camera", "", -1); } obj.ProcessParameters(parameters); obj.Parent = parent; InstanceCount++; return(obj); }
public override BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { MaterialEditor obj = new MaterialEditor(); Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("Init")) != parameters.End()) { parameters["Name"] = "Material" + MogitorsRoot.Instance.CreateUniqueID("Material", "", 1); } obj.ProcessParameters(parameters); parent = MogitorsRoot.Instance.SceneManagerEditor; obj.Parent = parent; InstanceCount++; return(obj); }
void MogitorsRoot.IDragDropHandler.OnDragDrop(DragData dragData, Mogre.Viewport vp, Mogre.Vector2 position) { if (dragData.Object != null) { Mogre.NameValuePairList parameters = new Mogre.NameValuePairList(); dragData.Object.GetObjectProperties(parameters); dragData.Object.Destroy(false); dragData.Object = null; dragData.Parameters["Position"] = parameters["Position"]; MogitorsRoot.Instance.CreateEditorObject(null, dragData.ObjectType, dragData.Parameters, true, true); } dragData.Parameters.Clear(); dragData.ObjectType = ""; dragData.Object = null; }
public override BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { EntityEditor editor = new EntityEditor(); if (parameters.Find("MeshFile") == parameters.End()) { parameters["MeshFile"] = "scbCamera.mesh"; } if (parameters.Find("Init") != parameters.End()) { string entName = Path.GetFileNameWithoutExtension(parameters["MeshFile"]); parameters["Name"] = entName + MogitorsRoot.Instance.CreateUniqueID(entName, "", -1); } editor.ProcessParameters(parameters); editor.Parent = parent; InstanceCount++; return(editor); }
public override void ProcessParameters(Mogre.NameValuePairList parameters) { base.ProcessParameters(parameters); Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("MeshFile")) != parameters.End()) { this.meshFile = ni.Value; } if ((ni = parameters.Find("CastShadows")) != parameters.End()) { this.castShadows = Mogre.StringConverter.ParseBool(ni.Value); } foreach (KeyValuePair <string, string> param in parameters) { if (!param.Key.StartsWith("SubEntity")) { continue; } string valStr = param.Key; valStr = valStr.Remove(0, 9); if (valStr.EndsWith("Visible")) { valStr = valStr.Remove(valStr.Length - 8, 8); int ID = Mogre.StringConverter.ParseInt(valStr); GetSubMesh(ID).Visible = Mogre.StringConverter.ParseBool(param.Value); } else if (valStr.EndsWith("Material")) { valStr = valStr.Remove(valStr.Length - 9, 9); int ID = Mogre.StringConverter.ParseInt(valStr); GetSubMesh(ID).Material = param.Value; } } }
public void AfterLoadScene() { CreateGizmo(); GizmoMode = EditorTools.Select; ViewportEditor.ResetCommonValues(); if (ActiveViewport == null) { Mogre.NameValuePairList parameters = new Mogre.NameValuePairList(); parameters.Clear(); parameters["Name"] = "Viewport1"; parameters["Colour"] = "0 0 0"; parameters["Index"] = "1"; ActiveViewport = CreateEditorObject(null, "Viewport Object", parameters, false, false) as ViewportEditor; } system.UpdateLoadProgress(60, "Loading scene objects"); this.rootEditor.Load(); this.rootEditor.LoadAllChildren(); if (SceneUpdated != null) { SceneUpdated(this, new SceneUpdatedEventArgs(SceneManager, ActiveViewport.CameraEditor.Camera, RenderTarget)); } SceneUpdated = null; FillTreeView(); system.UpdateLoadProgress(100, "Rendering..."); IsSceneLoaded = true; IsSceneModified = false; if (SceneLoaded != null) { SceneLoaded(this, EventArgs.Empty); } }
public BaseEditor CreateEditorObject(BaseEditor parent, string objectTypeString, Mogre.NameValuePairList param, bool addToTreeList, bool display) { if (parent == null) { Mogre.NameValuePairList.Iterator ni; if ((ni = param.Find("ParentNode")) != param.End()) { parent = FindObject(ni.Value, 0); } if (parent == null) { if (SceneManager == null) { parent = this.rootEditor; } else { parent = SceneManagerEditor; } } } BaseEditorFactory factory = GetEditorObjectFactory(objectTypeString); if (factory == null) { return(null); } BaseEditor obj = factory.CreateObject(ref parent, param); if (obj == null) { return(null); } RegisterObjectName(obj.Name, obj); parent.AddChild(obj); if (addToTreeList) { object handle = this.system.InsertTreeItem(parent.TreeItemHandle, obj.Name, obj.ObjectTypeID, System.Windows.Media.Colors.Black); obj.TreeItemHandle = handle; } if (display) { obj.Load(); obj.UpdateTreeView(); } IsSceneModified = true; return(obj); }
public override void GetObjectProperties(Mogre.NameValuePairList retList) { retList.Clear(); retList["Name"] = this.name; }
public override void ProcessParameters(Mogre.NameValuePairList parameters) { Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("Name")) != parameters.End()) { this.name = ni.Value; } if ((ni = parameters.Find("SkyBoxMaterial")) != parameters.End()) { this.skyBoxMaterial = ni.Value; } if ((ni = parameters.Find("Ambient")) != parameters.End()) { this.ambient = Mogre.StringConverter.ParseColourValue(ni.Value); } if ((ni = parameters.Find("FogColour")) != parameters.End()) { this.fogColour = Mogre.StringConverter.ParseColourValue(ni.Value); } if ((ni = parameters.Find("SkyBoxActive")) != parameters.End()) { this.skyBoxActive = Mogre.StringConverter.ParseBool(ni.Value); } if ((ni = parameters.Find("SkyBoxDistance")) != parameters.End()) { this.skyBoxDistance = Mogre.StringConverter.ParseReal(ni.Value); } if ((ni = parameters.Find("FogStart")) != parameters.End()) { this.fogStart = Mogre.StringConverter.ParseReal(ni.Value); } if ((ni = parameters.Find("FogEnd")) != parameters.End()) { this.fogEnd = Mogre.StringConverter.ParseReal(ni.Value); } if ((ni = parameters.Find("FogDensity")) != parameters.End()) { this.fogDensity = Mogre.StringConverter.ParseReal(ni.Value); } if ((ni = parameters.Find("FogMode")) != parameters.End()) { string val = ni.Value.ToLower(); if (val == "none") { this.fogMode = Mogre.FogMode.FOG_NONE; } else if (val == "linear") { this.fogMode = Mogre.FogMode.FOG_LINEAR; } else if (val == "exp") { this.fogMode = Mogre.FogMode.FOG_EXP; } else if (val == "exp2") { this.fogMode = Mogre.FogMode.FOG_EXP2; } } }
public override SceneFileResult Export(bool saveAs) { MogitorsRoot mogRoot = MogitorsRoot.Instance; MogitorsSystem system = MogitorsSystem.Instance; ProjectOptions opt = mogRoot.ProjectOptions; string fileName = system.CombinePath(opt.ProjectDir, opt.ProjectName + ".mogscene"); // If saveAs is true, use the MogitorsSystem Function to retrieve // a FileName and also copy the contents of current scene to the new location if (saveAs) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = ""; dlg.DefaultExt = ".mogscene"; dlg.Filter = "Mogitor Scene File (.mogscene)|*.mogscene"; Nullable <bool> result = dlg.ShowDialog(); if (result != true) { return(SceneFileResult.Cancel); } fileName = dlg.FileName; string oldProjDir = opt.ProjectDir; string oldProjName = opt.ProjectName; opt.ProjectName = system.ExtractFileName(fileName); opt.ProjectDir = system.ExtractFilePath(fileName); mogRoot.AdjustUserResourceDirectories(oldProjDir); string newDir = opt.ProjectDir; system.MakeDirectory(newDir); system.CopyFilesEx(oldProjDir, newDir); string delFileStr = system.GetFullPath(system.CombinePath(opt.ProjectDir, oldProjName + ".mogscene")); system.DeleteFile(delFileStr); } XmlTextWriter textWriter = new XmlTextWriter(fileName, System.Text.Encoding.Unicode); textWriter.Formatting = Formatting.Indented; textWriter.WriteStartDocument(); textWriter.WriteStartElement("MogitorScene"); mogRoot.WriteProjectOptions(textWriter, true); ObjectVector objectList = new ObjectVector(); for (EditorType type = 0; type < EditorType.LastEditor; ++type) { mogRoot.GetObjectList(type, objectList); foreach (BaseEditor obj in objectList) { // If object does not have a parent, then it is not part of the scene if (obj.Parent == null) { continue; } if (obj.IsSerializable) { textWriter.WriteStartElement("Object"); textWriter.WriteStartAttribute("Type"); textWriter.WriteValue(obj.ObjectTypeName); textWriter.WriteEndAttribute(); // If obj's parent name is "" then the parent is this.rootEditor if (obj.Parent.Name != "") { textWriter.WriteStartAttribute("ParentNode"); textWriter.WriteValue(obj.Parent.Name); textWriter.WriteEndAttribute(); } Mogre.NameValuePairList theList = new Mogre.NameValuePairList(); obj.GetObjectProperties(theList); foreach (KeyValuePair <string, string> it in theList) { textWriter.WriteStartAttribute(it.Key); textWriter.WriteValue(it.Value); textWriter.WriteEndAttribute(); } textWriter.WriteEndElement(); } obj.OnSave(); } } textWriter.WriteEndElement(); textWriter.WriteEndDocument(); textWriter.Close(); mogRoot.IsSceneModified = false; if (saveAs) { mogRoot.TerminateScene(); mogRoot.LoadScene(fileName); } return(SceneFileResult.Ok); }
public override SceneFileResult Import(string importFile) { MogitorsRoot mogRoot = MogitorsRoot.Instance; MogitorsSystem system = MogitorsSystem.Instance; if (importFile == "") { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = ""; dlg.DefaultExt = ".mogscene"; dlg.Filter = "Mogitor Scene File (.mogscene)|*.mogscene"; Nullable <bool> result = dlg.ShowDialog(); if (result != true) { return(SceneFileResult.Cancel); } importFile = dlg.FileName; } string filePath = system.ExtractFilePath(importFile); string fileName = system.ExtractFileName(importFile); XmlTextReader textReader = new XmlTextReader(importFile); system.UpdateLoadProgress(5, "Loading scene objects"); if (!textReader.ReadToFollowing("MogitorScene")) { return(SceneFileResult.ErrParse); } // Check version string fileVersion = textReader.GetAttribute("Version"); if (fileVersion != null) { if (int.Parse(fileVersion) != 1) { return(SceneFileResult.ErrParse); } } // Read project options if (textReader.ReadToFollowing("ProjectOptions") == true) { system.UpdateLoadProgress(15, "Parsing project options"); mogRoot.LoadProjectOptions(textReader); mogRoot.ProjectOptions.ProjectDir = filePath; mogRoot.ProjectOptions.ProjectName = fileName; mogRoot.PrepareProjectResources(); } //// Moves the reader back to the "MogitorScene" element node. //textReader.MoveToElement(); system.UpdateLoadProgress(30, "Creating scene objects"); // Load objects Mogre.NameValuePairList param = new Mogre.NameValuePairList(); while (textReader.ReadToNextSibling("Object")) { string objectType = textReader.GetAttribute("Type"); if (objectType == "") { continue; } param.Clear(); while (textReader.MoveToNextAttribute()) { param.Insert(textReader.Name, textReader.Value); } BaseEditor result = MogitorsRoot.Instance.CreateEditorObject(null, objectType, param, false, false); } mogRoot.AfterLoadScene(); return(SceneFileResult.Ok); }
public void AfterLoadScene() { CreateGizmo(); GizmoMode = EditorTools.Select; ViewportEditor.ResetCommonValues(); if (ActiveViewport == null) { Mogre.NameValuePairList parameters = new Mogre.NameValuePairList(); parameters.Clear(); parameters["Name"] = "Viewport1"; parameters["Colour"] = "0 0 0"; parameters["Index"] = "1"; ActiveViewport = CreateEditorObject(null, "Viewport Object", parameters, false, false) as ViewportEditor; } system.UpdateLoadProgress(60, "Loading scene objects"); this.rootEditor.Load(); this.rootEditor.LoadAllChildren(); if (SceneUpdated != null) SceneUpdated(this, new SceneUpdatedEventArgs(SceneManager, ActiveViewport.CameraEditor.Camera, RenderTarget)); SceneUpdated = null; FillTreeView(); system.UpdateLoadProgress(100, "Rendering..."); IsSceneLoaded = true; IsSceneModified = false; if (SceneLoaded != null) SceneLoaded(this, EventArgs.Empty); }
public override SceneFileResult Export(bool saveAs) { MogitorsRoot mogRoot = MogitorsRoot.Instance; MogitorsSystem system = MogitorsSystem.Instance; ProjectOptions opt = mogRoot.ProjectOptions; string fileName = system.CombinePath(opt.ProjectDir, opt.ProjectName + ".mogscene"); // If saveAs is true, use the MogitorsSystem Function to retrieve // a FileName and also copy the contents of current scene to the new location if (saveAs) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = ""; dlg.DefaultExt = ".mogscene"; dlg.Filter = "Mogitor Scene File (.mogscene)|*.mogscene"; Nullable<bool> result = dlg.ShowDialog(); if (result != true) return SceneFileResult.Cancel; fileName = dlg.FileName; string oldProjDir = opt.ProjectDir; string oldProjName = opt.ProjectName; opt.ProjectName = system.ExtractFileName(fileName); opt.ProjectDir = system.ExtractFilePath(fileName); mogRoot.AdjustUserResourceDirectories(oldProjDir); string newDir = opt.ProjectDir; system.MakeDirectory(newDir); system.CopyFilesEx(oldProjDir, newDir); string delFileStr = system.GetFullPath(system.CombinePath(opt.ProjectDir, oldProjName + ".mogscene")); system.DeleteFile(delFileStr); } XmlTextWriter textWriter = new XmlTextWriter(fileName, System.Text.Encoding.Unicode); textWriter.Formatting = Formatting.Indented; textWriter.WriteStartDocument(); textWriter.WriteStartElement("MogitorScene"); mogRoot.WriteProjectOptions(textWriter, true); ObjectVector objectList = new ObjectVector(); for (EditorType type = 0; type < EditorType.LastEditor; ++type) { mogRoot.GetObjectList(type, objectList); foreach (BaseEditor obj in objectList) { // If object does not have a parent, then it is not part of the scene if (obj.Parent == null) continue; if (obj.IsSerializable) { textWriter.WriteStartElement("Object"); textWriter.WriteStartAttribute("Type"); textWriter.WriteValue(obj.ObjectTypeName); textWriter.WriteEndAttribute(); // If obj's parent name is "" then the parent is this.rootEditor if (obj.Parent.Name != "") { textWriter.WriteStartAttribute("ParentNode"); textWriter.WriteValue(obj.Parent.Name); textWriter.WriteEndAttribute(); } Mogre.NameValuePairList theList = new Mogre.NameValuePairList(); obj.GetObjectProperties(theList); foreach (KeyValuePair<string, string> it in theList) { textWriter.WriteStartAttribute(it.Key); textWriter.WriteValue(it.Value); textWriter.WriteEndAttribute(); } textWriter.WriteEndElement(); } obj.OnSave(); } } textWriter.WriteEndElement(); textWriter.WriteEndDocument(); textWriter.Close(); mogRoot.IsSceneModified = false; if (saveAs) { mogRoot.TerminateScene(); mogRoot.LoadScene(fileName); } return SceneFileResult.Ok; }
public override SceneFileResult Import(string importFile) { MogitorsRoot mogRoot = MogitorsRoot.Instance; MogitorsSystem system = MogitorsSystem.Instance; if (importFile == "") { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = ""; dlg.DefaultExt = ".mogscene"; dlg.Filter = "Mogitor Scene File (.mogscene)|*.mogscene"; Nullable<bool> result = dlg.ShowDialog(); if (result != true) { return SceneFileResult.Cancel; } importFile = dlg.FileName; } string filePath = system.ExtractFilePath(importFile); string fileName = system.ExtractFileName(importFile); XmlTextReader textReader = new XmlTextReader(importFile); system.UpdateLoadProgress(5, "Loading scene objects"); if (!textReader.ReadToFollowing("MogitorScene")) return SceneFileResult.ErrParse; // Check version string fileVersion = textReader.GetAttribute("Version"); if (fileVersion != null) { if (int.Parse(fileVersion) != 1) return SceneFileResult.ErrParse; } // Read project options if (textReader.ReadToFollowing("ProjectOptions") == true) { system.UpdateLoadProgress(15, "Parsing project options"); mogRoot.LoadProjectOptions(textReader); mogRoot.ProjectOptions.ProjectDir = filePath; mogRoot.ProjectOptions.ProjectName = fileName; mogRoot.PrepareProjectResources(); } //// Moves the reader back to the "MogitorScene" element node. //textReader.MoveToElement(); system.UpdateLoadProgress(30, "Creating scene objects"); // Load objects Mogre.NameValuePairList param = new Mogre.NameValuePairList(); while (textReader.ReadToNextSibling("Object")) { string objectType = textReader.GetAttribute("Type"); if (objectType == "") continue; param.Clear(); while (textReader.MoveToNextAttribute()) { param.Insert(textReader.Name, textReader.Value); } BaseEditor result = MogitorsRoot.Instance.CreateEditorObject(null, objectType, param, false, false); } mogRoot.AfterLoadScene(); return SceneFileResult.Ok; }
private void treeControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { TreeViewItem treeItem = e.NewValue as TreeViewItem; if (treeItem == null) return; if (treeItem.Parent == null) { if (MogitorsRoot.Instance.Selected != null) MogitorsRoot.Instance.Selected.IsSelected = false; MogitorsRoot.Instance.RootEditor.IsSelected = true; return; } IconTextItem item = treeItem.Header as IconTextItem; if (item == null) { e.Handled = true; return; } int id = (treeItem.Tag != null) ? (int)treeItem.Tag : 0; int level = 0; while (treeItem.Tag != null) { treeItem = treeItem.Parent as TreeViewItem; item = treeItem.Header as IconTextItem; ++level; } string name = item.Name; MogitorsRoot mogRoot = MogitorsRoot.Instance; if (this.materialEditor == null || name != this.materialEditor.Name || level != this.materialEditor.PropertyLevel || id != this.materialEditor.PropertyId) { if (mogRoot.Selected != null) mogRoot.Selected.IsSelected = false; if (this.materialEditor != null) this.materialEditor.Destroy(false); BaseEditor parentEd = null; Mogre.NameValuePairList parameters = new Mogre.NameValuePairList(); parameters["Name"] = name; this.materialEditor = MaterialEditor.Factory.CreateObject(ref parentEd, parameters) as MaterialEditor; if (this.materialEditor != null && this.materialEditor.Load()) { this.materialEditor.TreeItemHandle = treeItem; this.materialEditor.SetPropertiesLevel(level, id); this.materialEditor.IsSelected = true; } } }
public virtual void ProcessParameters(Mogre.NameValuePairList parameters) { }
public virtual BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { InstanceCount++; return(new BaseEditor()); }
public virtual void GetObjectProperties(Mogre.NameValuePairList retList) { retList.Clear(); retList["Name"] = Name; }
private void treeControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { TreeViewItem treeItem = e.NewValue as TreeViewItem; if (treeItem == null) { return; } if (treeItem.Parent == null) { if (MogitorsRoot.Instance.Selected != null) { MogitorsRoot.Instance.Selected.IsSelected = false; } MogitorsRoot.Instance.RootEditor.IsSelected = true; return; } IconTextItem item = treeItem.Header as IconTextItem; if (item == null) { e.Handled = true; return; } int id = (treeItem.Tag != null) ? (int)treeItem.Tag : 0; int level = 0; while (treeItem.Tag != null) { treeItem = treeItem.Parent as TreeViewItem; item = treeItem.Header as IconTextItem; ++level; } string name = item.Name; MogitorsRoot mogRoot = MogitorsRoot.Instance; if (this.materialEditor == null || name != this.materialEditor.Name || level != this.materialEditor.PropertyLevel || id != this.materialEditor.PropertyId) { if (mogRoot.Selected != null) { mogRoot.Selected.IsSelected = false; } if (this.materialEditor != null) { this.materialEditor.Destroy(false); } BaseEditor parentEd = null; Mogre.NameValuePairList parameters = new Mogre.NameValuePairList(); parameters["Name"] = name; this.materialEditor = MaterialEditor.Factory.CreateObject(ref parentEd, parameters) as MaterialEditor; if (this.materialEditor != null && this.materialEditor.Load()) { this.materialEditor.TreeItemHandle = treeItem; this.materialEditor.SetPropertiesLevel(level, id); this.materialEditor.IsSelected = true; } } }