Browse Source

Minor Bug Fixes

Fixed a few more items that were spamming the console.
Peter Robinson 2 years ago
parent
commit
5d2b348ff5

+ 1 - 1
editor/GuiEditor/scripts/GuiEditorBrain.cs

@@ -7,7 +7,7 @@ function GuiEditorBrain::onAdd(%this)
 
 function GuiEditorBrain::onControlDragged(%this, %payload, %position)
 {
-	%pos = VectorSub(%position, %this.getLocalPosition());
+	%pos = VectorSub(%position, %this.root.getGlobalPosition());
 	%x = getWord(%pos, 0);
 	%y = getWord(%pos, 1);
 	%target = GuiEditor.content.findHitControl(%x, %y);

+ 0 - 1
editor/GuiEditor/scripts/GuiEditorControlListWindow.cs

@@ -56,7 +56,6 @@ function GuiEditorControlListWindow::populate(%this)
             getSubStr(%field, 0, 12) !$= "GuiInspector" && %field !$= "GuiMessageVectorCtrl" &&
             %field !$= "GuiParticleGraphInspector" && %field !$= "GuiGraphCtrl" && %field !$= "GuiSceneObjectCtrl")
         {
-			echo("adding item "@ %field);
 		    %this.listBox.addItem(%field);
         }
 	}

+ 14 - 4
editor/GuiEditor/scripts/GuiEditorExplorerWindow.cs

@@ -42,8 +42,11 @@ function GuiEditorExplorerWindow::onInspect(%this, %ctrl)
 {
 	%this.tree.startRadioSilence();
 	%index = %this.tree.findItemID(%ctrl.getID());
-	%this.tree.clearSelection();
-	%this.tree.setSelected(%index, true);
+	if(%index != -1)
+	{
+		%this.tree.clearSelection();
+		%this.tree.setSelected(%index, true);
+	}
 	%this.tree.endRadioSilence();
 }
 
@@ -51,14 +54,21 @@ function GuiEditorExplorerWindow::onAlsoInspect(%this, %ctrl)
 {
 	%this.tree.startRadioSilence();
 	%index = %this.tree.findItemID(%ctrl.getID());
-	%this.tree.setSelected(%index, true);
+	if(%index != -1)
+	{
+		%this.tree.setSelected(%index, true);
+	}
 	%this.tree.endRadioSilence();
 }
 
 function GuiEditorExplorerWindow::onClearInspect(%this, %ctrl)
 {
 	%this.tree.startRadioSilence();
-	%this.tree.setSelected(%ctrl, false);
+	%index = %this.tree.findItemID(%ctrl.getID());
+	if(%index != -1)
+	{
+		%this.tree.setSelected(%ctrl, false);
+	}
 	%this.tree.endRadioSilence();
 }
 

+ 0 - 5
editor/GuiEditor/scripts/GuiEditorSaveGuiDialog.cs

@@ -107,11 +107,6 @@ function GuiEditorSaveGuiDialog::Validate(%this)
 	%folderPath = %this.getFolderPath();
 	%guiName = %this.guiNameBox.getText();
 
-	if(%this.folderBox.getText() $= "")
-	{
-		%this.folderBox.setText(mgetMainDotCsDir());
-	}
-
 	if(%folderPath !$= %this.prevFolder)
 	{
 		%modSig = EditorCore.findModuleOfPath(%folderPath @ "a.txt");

+ 2 - 2
engine/source/gui/editor/guiInspector.cc

@@ -942,7 +942,7 @@ bool GuiInspectorDynamicGroup::createContent()
 
       char commandBuf[64];
       dSprintf(commandBuf, 64, "%d.addDynamicField();", this->getId());
-      addFieldBtn->setField("profile", "GuiButtonDynProfile");
+      addFieldBtn->setField("profile", "GuiButtonProfile");
       addFieldBtn->setField("command", commandBuf);
       addFieldBtn->setField("text", "+");
       addFieldBtn->setExtent(Point2I(30, 30));
@@ -1233,7 +1233,7 @@ GuiControl* GuiInspectorDynamicField::constructRenameControl()
    {
       dSprintf(szBuffer, 512, "%d.%s = \"\";%d.inspectGroup();", mTarget->getId(), getFieldName(), mGroup->getId());
 
-      delButt->setField("profile", "GuiButtonDynProfile");
+      delButt->setField("profile", "GuiButtonProfile");
       delButt->setField("Text", "X");
       delButt->setPosition(Point2I((getExtent().x - 40), 0));
       delButt->setField("extent", "30 30");

+ 14 - 5
engine/source/gui/editor/guiInspectorTypes.cc

@@ -75,6 +75,7 @@ void GuiInspectorTypeEnum::consoleInit()
 
 void GuiInspectorTypeEnum::updateValue( StringTableEntry newValue )
 {
+	newValue = StringTable->insert(newValue, true);//despite the type already being a StringTableEntry, sometimes plain const char* are sent instead.
 	GuiDropDownCtrl *ctrl = dynamic_cast<GuiDropDownCtrl*>( mEdit );
 	if (ctrl != NULL)
 	{
@@ -196,7 +197,11 @@ GuiControl* GuiInspectorTypeGuiProfile::constructEditControl(S32 width)
       GuiControlProfile * profile = dynamic_cast<GuiControlProfile *>(*i);
       if(profile && profile->getName())
       {
-         entries.push_back(profile->getName());
+		StringTableEntry name = StringTable->insert(profile->getName());
+		if(name != StringTable->EmptyString)
+		{
+			entries.push_back(name);
+		}
       }
    }
 
@@ -259,10 +264,14 @@ GuiControl* GuiInspectorTypeGuiBorderProfile::constructEditControl(S32 width)
    for (SimGroup::iterator i = grp->begin(); i != grp->end(); i++)
    {
       GuiBorderProfile * profile = dynamic_cast<GuiBorderProfile *>(*i);
-      if (profile)
-      {
-         entries.push_back(profile->getName());
-      }
+	  if (profile && profile->getName())
+	  {
+		  StringTableEntry name = StringTable->insert(profile->getName());
+		  if (name != StringTable->EmptyString)
+		  {
+			  entries.push_back(name);
+		  }
+	  }
    }
 
    retCtrl->getList()->sortByText();