public void EditSceneGUI() { Transform transform = m_LineRenderer.useWorldSpace ? null : m_LineRenderer.transform; if (m_LineRenderer.positionCount == 0) { return; } PointEditor.SelectPoints(this, transform, ref m_Selection); PointEditor.Draw(this, transform, m_Selection, true); PointEditor.MovePoints(this, transform, m_Selection); if (showWireframe) { DrawWireframe(); } HandleEditMenuHotKeyCommands(); }
public bool OnSceneGUI(Transform transform) { if (!m_Group.enabled) { return(m_Editing); } if (Event.current.type == EventType.Layout) { //If the group has moved / scaled since last frame need to retetra);) if (m_LastPosition != m_Group.transform.position || m_LastRotation != m_Group.transform.rotation || m_LastScale != m_Group.transform.localScale) { MarkSourcePositionsDirty(); } m_LastPosition = m_Group.transform.position; m_LastRotation = m_Group.transform.rotation; m_LastScale = m_Group.transform.localScale; } //Need to cache this as select points will use it! var mouseUpEvent = Event.current.type == EventType.MouseUp; if (m_Editing) { if (PointEditor.SelectPoints(this, transform, ref m_Selection)) { Undo.RegisterCompleteObjectUndo(new Object[] { m_Group, m_SerializedSelectedProbes }, "Select Probes"); } } //Special handling for paste (want to be able to paste when not in edit mode!) if ((Event.current.type == EventType.ValidateCommand || Event.current.type == EventType.ExecuteCommand) && Event.current.commandName == EventCommandNames.Paste) { if (Event.current.type == EventType.ValidateCommand) { if (CanPasteProbes()) { Event.current.Use(); } } if (Event.current.type == EventType.ExecuteCommand) { if (PasteProbes()) { Event.current.Use(); m_Editing = true; } } } if (drawTetrahedra) { DrawTetrahedra(); } PointEditor.Draw(this, transform, m_Selection, true); if (!m_Editing) { return(m_Editing); } HandleEditMenuHotKeyCommands(); if (m_Editing && PointEditor.MovePoints(this, transform, m_Selection)) { Undo.RegisterCompleteObjectUndo(new Object[] { m_Group, m_SerializedSelectedProbes }, "Move Probes"); if (LightProbeVisualization.dynamicUpdateLightProbes) { MarkSourcePositionsDirty(); } } if (m_Editing && mouseUpEvent && !LightProbeVisualization.dynamicUpdateLightProbes) { MarkSourcePositionsDirty(); } return(m_Editing); }
public bool OnSceneGUI(Transform transform) { if (!m_Group.enabled) { return(m_Editing); } if (Event.current.type == EventType.Layout) { //If the group has moved / scaled since last frame need to retetra);) if (m_LastPosition != m_Group.transform.position || m_LastRotation != m_Group.transform.rotation || m_LastScale != m_Group.transform.localScale) { MarkTetrahedraDirty(); } m_LastPosition = m_Group.transform.position; m_LastRotation = m_Group.transform.rotation; m_LastScale = m_Group.transform.localScale; } //See if we should enter edit mode! bool firstSelect = false; if (Event.current.type == EventType.MouseDown && Event.current.button == 0) { //We have no probes selected and have clicked the mouse... Did we click a probe if (SelectedCount == 0) { var selected = PointEditor.FindNearest(Event.current.mousePosition, transform, this); var clickedProbe = selected != -1; if (clickedProbe && !m_Editing) { m_Inspector.StartEditMode(); m_Editing = true; firstSelect = true; } } } //Need to cache this as select points will use it! var mouseUpEvent = Event.current.type == EventType.MouseUp; if (m_Editing) { if (PointEditor.SelectPoints(this, transform, ref m_Selection, firstSelect)) { Undo.RegisterCompleteObjectUndo(new Object[] { m_Group, m_SerializedSelectedProbes }, "Select Probes"); } } //Special handling for paste (want to be able to paste when not in edit mode!) if ((Event.current.type == EventType.ValidateCommand || Event.current.type == EventType.ExecuteCommand) && Event.current.commandName == EventCommandNames.Paste) { if (Event.current.type == EventType.ValidateCommand) { if (CanPasteProbes()) { Event.current.Use(); } } if (Event.current.type == EventType.ExecuteCommand) { if (PasteProbes()) { Event.current.Use(); m_Editing = true; } } } if (drawTetrahedra) { DrawTetrahedra(); } PointEditor.Draw(this, transform, m_Selection, true); if (!m_Editing) { return(m_Editing); } HandleEditMenuHotKeyCommands(); if (m_Editing && PointEditor.MovePoints(this, transform, m_Selection)) { Undo.RegisterCompleteObjectUndo(new Object[] { m_Group, m_SerializedSelectedProbes }, "Move Probes"); if (LightProbeVisualization.dynamicUpdateLightProbes) { MarkTetrahedraDirty(); } } if (m_Editing && mouseUpEvent && !LightProbeVisualization.dynamicUpdateLightProbes) { MarkTetrahedraDirty(); } return(m_Editing); }
public bool OnSceneGUI(Transform transform) { if (!this.m_Group.enabled) { return(this.m_Editing); } if (Event.current.type == EventType.Layout) { if (this.m_LastPosition != this.m_Group.transform.position || this.m_LastRotation != this.m_Group.transform.rotation || this.m_LastScale != this.m_Group.transform.localScale) { this.MarkTetrahedraDirty(); } this.m_LastPosition = this.m_Group.transform.position; this.m_LastRotation = this.m_Group.transform.rotation; this.m_LastScale = this.m_Group.transform.localScale; } bool firstSelect = false; if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && (this.SelectedCount == 0 && PointEditor.FindNearest(Event.current.mousePosition, transform, (IEditablePoint)this) != -1) && !this.m_Editing) { this.m_Editing = true; firstSelect = true; } bool flag = Event.current.type == EventType.MouseUp; if (this.m_Editing && PointEditor.SelectPoints((IEditablePoint)this, transform, ref this.m_Selection, firstSelect)) { Undo.RegisterCompleteObjectUndo(new UnityEngine.Object[2] { (UnityEngine.Object) this.m_Group, (UnityEngine.Object) this.m_SerializedSelectedProbes }, "Select Probes"); } if (this.m_Editing && flag && this.SelectedCount == 0) { this.m_Editing = false; this.MarkTetrahedraDirty(); } if ((Event.current.type == EventType.ValidateCommand || Event.current.type == EventType.ExecuteCommand) && Event.current.commandName == "Paste") { if (Event.current.type == EventType.ValidateCommand && LightProbeGroupEditor.CanPasteProbes()) { Event.current.Use(); } if (Event.current.type == EventType.ExecuteCommand && this.PasteProbes()) { Event.current.Use(); this.m_Editing = true; } } this.DrawTetrahedra(); PointEditor.Draw((IEditablePoint)this, transform, this.m_Selection, true); if (!this.m_Editing) { return(this.m_Editing); } this.HandleEditMenuHotKeyCommands(); if (this.m_Editing && PointEditor.MovePoints((IEditablePoint)this, transform, this.m_Selection)) { Undo.RegisterCompleteObjectUndo(new UnityEngine.Object[2] { (UnityEngine.Object) this.m_Group, (UnityEngine.Object) this.m_SerializedSelectedProbes }, "Move Probes"); if (LightmapVisualization.dynamicUpdateLightProbes) { this.MarkTetrahedraDirty(); } } if (this.m_Editing && flag && !LightmapVisualization.dynamicUpdateLightProbes) { this.MarkTetrahedraDirty(); } return(this.m_Editing); }