Browse Source

GuiEditCtrl Clean Up

Fixed a few things with the way the Gui Editor selects controls with the goal of not clearing the selection unless absolutely necessary. This prevents the inspector from destroying all it's contents repeatedly every time any action is taken.
Peter Robinson 2 years ago
parent
commit
d3b96b93b4

+ 2 - 5
editor/GuiEditor/scripts/GuiEditorBrain.cs

@@ -53,12 +53,9 @@ function GuiEditorBrain::endRadioSilence(%this)
 }
 
 //Source callbacks - Events that happened with this control and need to be relayed to other controls.
-function GuiEditorBrain::onSelect(%this, %ctrl)
+function GuiEditorBrain::onEdit(%this, %ctrl)
 {
-	%this.clearSelection();
-	%this.select(%ctrl);
-    %this.postEvent("Inspect", %ctrl);
-    %this.toggleMenuItems();
+    %this.postEvent("Edit", %ctrl);
 }
 
 function GuiEditorBrain::onRemoveSelected(%this,%ctrl)

+ 0 - 12
editor/GuiEditor/scripts/GuiEditorExplorerWindow.cs

@@ -38,18 +38,6 @@ function GuiEditorExplorerWindow::inspect(%this, %object)
     %this.tree.inspect(%object);
 }
 
-function GuiEditorExplorerWindow::onInspect(%this, %ctrl)
-{
-	%this.tree.startRadioSilence();
-	%index = %this.tree.findItemID(%ctrl.getID());
-	if(%index != -1)
-	{
-		%this.tree.clearSelection();
-		%this.tree.setSelected(%index, true);
-	}
-	%this.tree.endRadioSilence();
-}
-
 function GuiEditorExplorerWindow::onAlsoInspect(%this, %ctrl)
 {
 	%this.tree.startRadioSilence();

+ 1 - 3
editor/GuiEditor/scripts/GuiEditorInspectorWindow.cs

@@ -69,10 +69,8 @@ function GuiEditorInspectorWindow::onRemove(%this)
     }
 }
 
-function GuiEditorInspectorWindow::onInspect(%this, %object)
+function GuiEditorInspectorWindow::onEdit(%this, %object)
 {
-    %this.inspectList.clear();
-    %this.inspectList.add(%object);
     %this.inspector.inspect(%object);
 }
 

File diff suppressed because it is too large
+ 1162 - 1167
engine/source/gui/editor/guiEditCtrl.cc


+ 4 - 4
engine/source/gui/editor/guiEditCtrl.h

@@ -30,9 +30,9 @@ class GuiEditCtrl : public GuiControl
 {
    typedef GuiControl Parent;
 
-   Vector<GuiControl *> mSelectedControls;
-   GuiControl*          mCurrentAddSet;
-   GuiControl*          mContentControl;
+   Vector<GuiControl *> mSelectedControls; //A list of selected controls.
+   GuiControl*          mCurrentAddSet; //The curent container (sim set) that is being worked in (controls are added to). Changed by right clicking.
+   GuiControl*          mEditorRoot; //The editor root which attempts to simulate the canvas. This can be the add set, but should never be selected.
    Point2I              mLastMousePos;
    Point2I              mSelectionAnchor;
    Point2I              mGridSnap;
@@ -72,7 +72,7 @@ class GuiEditCtrl : public GuiControl
 
    void select(GuiControl *ctrl);
    void setRoot(GuiControl *ctrl);
-   GuiControl* getRoot() { return mContentControl; }
+   GuiControl* getRoot() { return mEditorRoot; }
    void setEditMode(bool value);
    S32 getSizingHitKnobs(const Point2I &pt, const RectI &box);
    void getDragRect(RectI &b);

Some files were not shown because too many files changed in this diff