private BaseEditor GetObjectUnderMouse(Ray mouseRay, bool pickWidgets, bool pickTerrain) { Mogre.Entity result; Mogre.Vector3 hitLocation = new Mogre.Vector3(); Mogre.RaySceneQuery raySceneQuery = MogitorsRoot.Instance.SceneManager.CreateRayQuery(new Mogre.Ray()); BaseEditor selected = null; AxisType editorAxis = AxisType.None; if (pickWidgets && MogitorsRoot.Instance.PickGizmos(mouseRay, ref editorAxis)) { selected = MogitorsRoot.Instance.Selected; EditorAxis = editorAxis; } else { raySceneQuery.QueryMask = ~QueryFlags.Widget; if (MogitorsRoot.Instance.PickEntity(raySceneQuery, mouseRay, out result, hitLocation, "", -1.0f) && result.Name != "HydraxMeshEnt") { selected = MogitorsRoot.Instance.FindObject(result.Name, 0); } } MogitorsRoot.Instance.SceneManager.DestroyQuery(raySceneQuery); return(selected); }
public override BaseEditor CreateObject(ref BaseEditor parent, NameValuePairList parameters) { ViewportEditor obj = new ViewportEditor(); Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("ViewportIndex")) != parameters.End()) { obj.ViewportIndex = (uint)Mogre.StringConverter.ParseInt(ni.Value); if (lastZOrder < obj.ViewportIndex) { lastZOrder = obj.ViewportIndex; } } else { obj.ViewportIndex = ++lastZOrder; } if (obj.ViewportIndex == 1) { MogitorsRoot.Instance.ActiveViewport = obj; } parent = MogitorsRoot.Instance.RootEditor; obj.Parent = parent; obj.ProcessParameters(parameters); obj.Load(); InstanceCount++; return(obj); }
public override void DestroyObject(BaseEditor _object) { ViewportEditor editor = _object as ViewportEditor; MogitorsRoot.Instance.IsClearScreenNeeded = true; editor.DestroyAllChildren(); editor.UnLoad(); if (editor.Name != "") { MogitorsRoot.Instance.UnRegisterObjectName(editor.Name, editor); } InstanceCount--; NameObjectPairList viewports = MogitorsRoot.Instance.GetObjectsByType(EditorType.Viewport); lastZOrder = 0; foreach (ViewportEditor viewport in viewports.Values) { if (viewport.ViewportIndex > lastZOrder) { lastZOrder = viewport.ViewportIndex; } } }
private void SaveEditorStates(Ray mouseRay) { BaseEditor selected = MogitorsRoot.Instance.Selected; if (selected == null) { return; } PropertyInfo prop = selected.GetType().GetProperty("Scale"); if (prop != null) { this.lastScale = (Vector3)prop.GetValue(selected, null); } else { this.lastScale = new Vector3(1, 1, 1); } this.lastDerivedOrient = selected.DerivedOrientation; this.lastDerivedPosition = selected.DerivedPosition; this.lastUsedPlane = MogitorsRoot.Instance.FindGizmoTranslationPlane(mouseRay, EditorAxis); this.last3DDelta = MogitorsRoot.Instance.GetGizmoIntersect(mouseRay, this.lastUsedPlane, EditorAxis, this.lastDerivedPosition); }
public virtual void OnMouseLeftDown(Vector2 point, MouseDevice mouseDevice) { this.lastMouse = point; this.lastClickPoint = point; this.lastMouseDevice = mouseDevice; if (mouseDevice.RightButton == MouseButtonState.Pressed) { return; } Mogre.Ray mouseRay; GetMouseRay(this.lastMouse, out mouseRay); BaseEditor selected = MogitorsRoot.Instance.Selected; if (selected != null && selected == GetObjectUnderMouse(mouseRay, true, true)) { SaveEditorStates(mouseRay); isEditing = true; } else { isEditing = false; } }
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 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 virtual void DeleteSelectedObject(bool silent) { BaseEditor selected = MogitorsRoot.Instance.Selected; if (selected == null || !selected.Supports(EditFlags.CanDelete)) { return; } bool cont = false; if (!silent) { string strWarn; if (selected.IsNodeType) { strWarn = "Are you sure want to delete " + selected.Name + " and all of its children?"; } else if (selected.EditorType == EditorType.Multisel) { strWarn = "Are you sure want to delete all selected objects?"; } else { strWarn = "Are you sure want to delete " + selected.Name + "?"; } if (MogitorsSystem.Instance.DisplayMessageDialog(strWarn, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { cont = true; } } else { cont = true; } if (!cont) { return; } BaseEditor delEd = selected; if (delEd.EditorType == EditorType.Multisel) { throw new System.NotImplementedException("Delete MultiSelEditor"); } else { MogitorsRoot.Instance.DestroyEditorObject(delEd, true); } EditorAxis = AxisType.None; }
public virtual void DestroyObject(BaseEditor _object) { _object.UnLoad(); _object.DestroyAllChildren(); if (_object.Name != "") { MogitorsRoot.Instance.UnRegisterObjectName(_object.Name, _object); } InstanceCount--; }
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 void RegisterForPostSceneUpdates(BaseEditor obj) { if (IsSceneLoaded) { obj.PostSceneUpdate(this, new SceneUpdatedEventArgs(SceneManager, ActiveViewport.CameraEditor.Camera, RenderTarget)); } else { SceneUpdated += obj.PostSceneUpdate; } }
public void DestroyEditorObject(BaseEditor obj, bool removeFromTreeList) { // Index0 Viewport can not be deleted if (obj.EditorType == EditorType.Viewport) { ViewportEditor viewport = obj as ViewportEditor; if (viewport.ViewportIndex == 1) { MogitorsSystem.Instance.DisplayMessageDialog("Can not delete the main viewport!!", System.Windows.MessageBoxButton.OK); return; } if (ActiveViewport == viewport) { foreach (var vt in this.namesByType[(int)EditorType.Viewport]) { if (vt.Value == obj) { continue; } ActiveViewport = vt.Value as ViewportEditor; break; } } } if (this.selectedEditor == obj) { obj.IsSelected = false; obj.IsHighLighted = false; } if (removeFromTreeList) { this.system.DeleteTreeItem(obj.TreeItemHandle); } if (obj.Parent != null) { obj.Parent.RemoveChild(obj.Name); } obj.FactoryDynamic.DestroyObject(obj); IsSceneModified = true; }
public override BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { LightEditor obj = new LightEditor(); NameValuePairList.Iterator ni; if ((ni = parameters.Find("Init")) != parameters.End()) { parameters["Name"] = "Light" + MogitorsRoot.Instance.CreateUniqueID("Light", "", -1); } obj.ProcessParameters(parameters); obj.Parent = parent; InstanceCount++; return(obj); }
private void DoSelect(Ray mouseRay) { BaseEditor currentSelection = MogitorsRoot.Instance.Selected; BaseEditor newSelection = GetObjectUnderMouse(mouseRay, true, true); if (newSelection != null && newSelection != currentSelection) { newSelection.UpdateTreeView(); EditorAxis = AxisType.None; } else if (newSelection == null && currentSelection != null) { ClearSelection(); } }
public void UnRegisterObjectName(string name, BaseEditor obj) { if (this.nameList.ContainsKey(name)) { this.nameList.Remove(name); } if (this.namesByType[(int)obj.EditorType].ContainsKey(name)) { this.namesByType[(int)obj.EditorType].Remove(name); } if (this.namesByTypeID[(int)obj.ObjectTypeID].ContainsKey(name)) { this.namesByTypeID[(int)obj.ObjectTypeID].Remove(name); } }
private void RecurseFillTreeView(BaseEditor editor, object parent) { foreach (EditorType editorType in this.objectDisplayOrder) { foreach (KeyValuePair <string, BaseEditor> child in editor.Children) { if (child.Value.EditorType != editorType) { continue; } object item = this.system.InsertTreeItem(parent, child.Value.Name, child.Value.ObjectTypeID, Colors.Black); child.Value.TreeItemHandle = item; RecurseFillTreeView(child.Value, item); } } }
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); }
public override void ShowBoundingBox(bool bShow) { if (this.handle == null) { return; } this.handle.ShowBoundingBox = bShow; foreach (KeyValuePair <string, BaseEditor> child in Children) { BaseEditor current = child.Value; if (current.EditorType != EditorType.Movable && current.EditorType != EditorType.Entity && current.EditorType != EditorType.Base) { current.ShowBoundingBox(bShow); } } }
private void HighlightObjectAtPosition(Ray mouseRay) { BaseEditor selected = GetObjectUnderMouse(mouseRay, false, false); foreach (var iter in highLighted) { if (iter.Value != selected) { iter.Value.IsHighLighted = false; } } highLighted.Clear(); if (selected != null) { selected.IsHighLighted = true; highLighted.Add(selected.Name, selected); } }
public Mogre.Vector3 GetGizmoIntersectCameraPlane(BaseEditor obj, Mogre.Ray pickRay) { Mogre.Vector3 vPos = obj.DerivedPosition; Mogre.Pair <bool, float> result = pickRay.Intersects(new Mogre.Plane(-ActiveViewport.CameraEditor.Camera.DerivedDirection, vPos)); if (result.first) { Mogre.Vector3 AxisX = obj.DerivedOrientation.XAxis; Mogre.Vector3 AxisY = obj.DerivedOrientation.YAxis; Mogre.Vector3 AxisZ = obj.DerivedOrientation.ZAxis; Mogre.Vector3 Proj = pickRay.GetPoint(result.second) - vPos; Mogre.Vector3 vPos1 = (AxisX.DotProduct(Proj) * AxisX); Mogre.Vector3 vPos2 = (AxisY.DotProduct(Proj) * AxisY); Mogre.Vector3 vPos3 = (AxisZ.DotProduct(Proj) * AxisZ); vPos += vPos1 + vPos2 + vPos3; } return(vPos); }
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); }
private void CreateViewport() { Mogre.NameValuePairList parameters = new Mogre.NameValuePairList(); parameters["Name"] = "intViewCamera" + Mogre.StringConverter.ToString(ViewportIndex); parameters["ClipDistance"] = "0.1 40000"; BaseEditor scnMgr = MogitorsRoot.Instance.SceneManagerEditor; ViewCamera = CameraEditor.Factory.CreateObject(ref scnMgr, parameters) as CameraEditor; ViewCamera.Load(); this.handle = MogitorsRoot.Instance.RenderTarget.AddViewport(ViewCamera.Camera, (int)ViewportIndex, dimensions.x, dimensions.y, dimensions.z, dimensions.w); if (Name == "") { this.name = "Viewport" + Mogre.StringConverter.ToString(ViewportIndex); } ViewCamera.Camera.AspectRatio = (float)this.handle.ActualWidth / (float)this.handle.ActualHeight; ViewCamera.ShowHelper = false; ActiveCamera = ViewCamera; this.handle.BackgroundColour = this.colour; PopCompositors(); ProjectOptions opt = MogitorsRoot.Instance.ProjectOptions; if (opt.Cameras.Count > 0) { ViewCamera.Position = opt.Cameras[opt.Cameras.Count - 1].Position; ViewCamera.Orientation = opt.Cameras[opt.Cameras.Count - 1].Orientation; } LoadEditorObjects(); }
MogitorsRoot() { this.system = MogitorsSystem.Instance; this.namesByType = new NameObjectPairList[(int)EditorType.LastEditor]; for (int i = 0; i < this.namesByType.Count(); ++i) { this.namesByType[i] = new NameObjectPairList(); } this.namesByTypeID = new NameObjectPairList[MogitorSettings.Instance.MaxObjectType]; for (int i = 0; i < this.namesByTypeID.Count(); ++i) { this.namesByTypeID[i] = new NameObjectPairList(); } IsSceneLoaded = false; IsSceneModified = false; RegisterAllEditorObjects(); BaseEditor nullParent = null; this.rootEditor = BaseEditor.Factory.CreateObject(ref nullParent, null); this.objectDisplayOrder.Clear(); this.objectDisplayOrder.Add(EditorType.Viewport); this.objectDisplayOrder.Add(EditorType.SceneManager); this.objectDisplayOrder.Add(EditorType.CustomNamanger); this.objectDisplayOrder.Add(EditorType.Light); this.objectDisplayOrder.Add(EditorType.Camera); for (EditorType type = EditorType.Camera + 1; type < EditorType.LastEditor; ++type) { this.objectDisplayOrder.Add(type); } this.objectDisplayOrder.Add(EditorType.Node); IsClearScreenNeeded = false; ProjectOptions = new ProjectOptions(); }
public virtual void OnMouseMove(Vector2 point, MouseDevice mouseDevice, bool imitate) { this.lastMouseDevice = mouseDevice; if (isSettingPos) { isSettingPos = false; this.lastMouse = point; return; } float deltaX = (point.x - lastMouse.x) * 0.5f; float deltaY = (point.y - lastMouse.y) * 0.5f; MogitorsRoot mogRoot = MogitorsRoot.Instance; BaseEditor selected = mogRoot.Selected; Ray mouseRay; if (!imitate) { if (mouseDevice.MiddleButton == MouseButtonState.Pressed) { Vector3 vPos = ActiveCamera.DerivedPosition; Vector3 vDelta = new Vector3(deltaX * CameraSpeed / 3.0f, -deltaY * CameraSpeed / 3.0f, 0); ActiveCamera.DerivedPosition = (vPos + (ActiveCamera.DerivedOrientation * vDelta)); this.newCamPosition = Vector3.ZERO; MogitorsSystem.Instance.ShowMouseCursor(false); point.x -= (deltaX * 2.0f); point.y -= (deltaY * 2.0f); isSettingPos = true; MogitorsSystem.Instance.SetMousePosition(point + new Vector2(this.handle.ActualLeft, this.handle.ActualTop)); } else if (mouseDevice.RightButton == MouseButtonState.Pressed) { ActiveCamera.Yaw(new Degree(-deltaX / 4.0f)); ActiveCamera.Pitch(new Degree(-deltaY / 4.0f)); MogitorsSystem.Instance.ShowMouseCursor(false); point.x -= (deltaX * 2.0f); point.y -= (deltaY * 2.0f); isSettingPos = true; MogitorsSystem.Instance.SetMousePosition(point + new Vector2(this.handle.ActualLeft, this.handle.ActualTop)); if (!GetMouseRay(point, out mouseRay)) { return; } if (mogRoot.Selected != null) { this.lastUsedPlane = MogitorsRoot.Instance.FindGizmoTranslationPlane(mouseRay, EditorAxis); } } } if (!GetMouseRay(point, out mouseRay)) { return; } if (EditorTool != EditorTools.Rotate || selected == null) { this.lastMouse = point; } if (selected != null) { if (EditorAxis == AxisType.None) { AxisType axis = AxisType.None; mogRoot.PickGizmos(mouseRay, ref axis); mogRoot.HighlightGizmo(axis); } else { mogRoot.HighlightGizmo(EditorAxis); } } if (isEditing && selected != null) { if ((EditorTool == EditorTools.Move) && selected.Supports(EditFlags.CanMove)) { Vector3 vNewPos = Vector3.ZERO; vNewPos = mogRoot.GetGizmoIntersect(mouseRay, this.lastUsedPlane, EditorAxis, this.lastDerivedPosition); vNewPos = vNewPos - this.last3DDelta + this.lastDerivedPosition; selected.DerivedPosition = vNewPos; } else if ((EditorTool == EditorTools.Scale) && selected.Supports(EditFlags.CanScale)) { Vector3 vNewDist = mogRoot.GetGizmoIntersect(mouseRay, this.lastUsedPlane, EditorAxis, this.lastDerivedPosition); Vector3 vScale = this.lastScale; float fNewDist = vNewDist.Length; float fLength = this.last3DDelta.Length; if ((int)(EditorAxis & AxisType.X) != 0) { vScale.x *= (fNewDist / fLength); } if ((int)(EditorAxis & AxisType.Y) != 0) { vScale.y *= (fNewDist / fLength); } if ((int)(EditorAxis & AxisType.Z) != 0) { vScale.z *= (fNewDist / fLength); } PropertyInfo prop = selected.GetType().GetProperty("Scale"); if (prop != null) { prop.SetValue(selected, vScale, null); } } else if ((EditorTool == EditorTools.Rotate) && selected.Supports(EditFlags.CanRotate)) { Quaternion q1 = this.lastDerivedOrient; switch (EditorAxis) { case AxisType.X: q1 = q1 * new Quaternion(new Degree(-deltaY), new Vector3(1, 0, 0)); break; case AxisType.Y: q1 = q1 * new Quaternion(new Degree(-deltaY), new Vector3(0, 1, 0)); break; case AxisType.Z: q1 = q1 * new Quaternion(new Degree(-deltaY), new Vector3(0, 0, 1)); break; } selected.DerivedOrientation = q1; } } HighlightObjectAtPosition(mouseRay); }
public void UnRegisterForUpdates(BaseEditor obj) { this.updateList.Remove(obj.Name); }
public override BaseEditor CreateObject(ref BaseEditor parent, NameValuePairList parameters) { ViewportEditor obj = new ViewportEditor(); Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("ViewportIndex")) != parameters.End()) { obj.ViewportIndex = (uint)Mogre.StringConverter.ParseInt(ni.Value); if (lastZOrder < obj.ViewportIndex) lastZOrder = obj.ViewportIndex; } else { obj.ViewportIndex = ++lastZOrder; } if (obj.ViewportIndex == 1) MogitorsRoot.Instance.ActiveViewport = obj; parent = MogitorsRoot.Instance.RootEditor; obj.Parent = parent; obj.ProcessParameters(parameters); obj.Load(); InstanceCount++; return obj; }
public override void DestroyObject(BaseEditor _object) { ViewportEditor editor = _object as ViewportEditor; MogitorsRoot.Instance.IsClearScreenNeeded = true; editor.DestroyAllChildren(); editor.UnLoad(); if (editor.Name != "") MogitorsRoot.Instance.UnRegisterObjectName(editor.Name, editor); InstanceCount--; NameObjectPairList viewports = MogitorsRoot.Instance.GetObjectsByType(EditorType.Viewport); lastZOrder = 0; foreach (ViewportEditor viewport in viewports.Values) { if (viewport.ViewportIndex > lastZOrder) lastZOrder = viewport.ViewportIndex; } }
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 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; }
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 RecurseFillTreeView(BaseEditor editor, object parent) { foreach (EditorType editorType in this.objectDisplayOrder) { foreach (KeyValuePair<string, BaseEditor> child in editor.Children) { if (child.Value.EditorType != editorType) continue; object item = this.system.InsertTreeItem(parent, child.Value.Name, child.Value.ObjectTypeID, Colors.Black); child.Value.TreeItemHandle = item; RecurseFillTreeView(child.Value, item); } } }
public void RegisterForUpdates(BaseEditor obj) { this.updateList.Add(obj.Name, obj); }
public virtual BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { InstanceCount++; return new BaseEditor(); }
public override BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { LightEditor obj = new LightEditor(); NameValuePairList.Iterator ni; if ((ni = parameters.Find("Init")) != parameters.End()) { parameters["Name"] = "Light" + MogitorsRoot.Instance.CreateUniqueID("Light", "", -1); } obj.ProcessParameters(parameters); obj.Parent = parent; InstanceCount++; return obj; }
public void AddChild(BaseEditor child) { this.children.Add(child.Name, child); child.Parent = this; }
public virtual BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { InstanceCount++; return(new BaseEditor()); }
public void RegisterForPostSceneUpdates(BaseEditor obj) { if (IsSceneLoaded) obj.PostSceneUpdate(this, new SceneUpdatedEventArgs(SceneManager, ActiveViewport.CameraEditor.Camera, RenderTarget)); else SceneUpdated += obj.PostSceneUpdate; }
public virtual void DestroyObject(BaseEditor _object) { _object.UnLoad(); _object.DestroyAllChildren(); if (_object.Name != "") MogitorsRoot.Instance.UnRegisterObjectName(_object.Name, _object); InstanceCount--; }
public void RegisterObjectName(string name, BaseEditor obj) { this.nameList.Add(name, obj); this.namesByType[(int)obj.EditorType].Add(name, obj); this.namesByTypeID[(int)obj.ObjectTypeID].Add(name, obj); }
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; }