void Input_MouseButtonUp(MouseButtonUpEventArgs e) { if (prevSourceStaticModel != null && !prevSourceStaticModel.IsDeleted) { prevSourceStaticModel.Enabled = true; if (selectedStaticModel != null && !selectedStaticModel.IsDeleted) { selectedStaticModel.Remove(); } } var cursorPos = App.UI.CursorPosition; var cameraRay = App.Camera.GetScreenRay((float)cursorPos.X / App.Graphics.Width, (float)cursorPos.Y / App.Graphics.Height); var result = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 10000, DrawableFlags.Geometry); if (result != null) { var geometry = result.Value.Drawable as StaticModel; if (geometry != null) { prevSourceStaticModel = geometry; geometry.Enabled = false; selectedStaticModel = geometry.Node.CreateComponent <StaticModel>(); selectedStaticModel.Model = geometry.Model; selectedStaticModel.SetMaterial(CreateSelectionMaterial()); Editor?.HighlightXmlForNode(result.Value.Node); } } }
public void Destroy() { if (node != null) { node.Remove(); } if (model != null) { model.Remove(); } if (animCtrl != null) { animCtrl.Remove(); } animCtrl = null; node = null; model = null; }