Browse Source

Quality of Life Improvements for the Gui Editor

This makes a number of improvements to the Gui Editor: Reduced the number of fields saved for a taml gui file. Added the "Is Container" field back to the inspector. Added support for Hidden and Locked controls. Fixed the text edit boxes to apply their value on enter and revert values on escape. Fixes the editor fields for fluid colors used by the sprite control.
Peter Robinson 8 months ago
parent
commit
e720e5398e
35 changed files with 262 additions and 172 deletions
  1. 1 1
      editor/GuiEditor/scripts/GuiEditorInspectorWindow.cs
  2. 4 1
      engine/source/2d/gui/SceneWindow.cc
  3. 8 8
      engine/source/2d/gui/guiSpriteCtrl.cc
  4. 8 0
      engine/source/2d/gui/guiSpriteCtrl.h
  5. 1 0
      engine/source/gui/buttons/guiButtonCtrl.cc
  6. 9 6
      engine/source/gui/buttons/guiDropDownCtrl.cc
  7. 7 0
      engine/source/gui/buttons/guiDropDownCtrl.h
  8. 1 1
      engine/source/gui/containers/guiChainCtrl.cc
  9. 0 1
      engine/source/gui/containers/guiExpandCtrl.cc
  10. 0 1
      engine/source/gui/containers/guiFrameSetCtrl.cc
  11. 0 1
      engine/source/gui/containers/guiGridCtrl.cc
  12. 0 1
      engine/source/gui/containers/guiPanelCtrl.cc
  13. 2 2
      engine/source/gui/containers/guiScrollCtrl.cc
  14. 0 1
      engine/source/gui/containers/guiTabBookCtrl.cc
  15. 0 1
      engine/source/gui/containers/guiTabPageCtrl.cc
  16. 0 1
      engine/source/gui/containers/guiWindowCtrl.cc
  17. 62 2
      engine/source/gui/editor/guiEditCtrl.cc
  18. 4 1
      engine/source/gui/editor/guiEditCtrl.h
  19. 40 0
      engine/source/gui/editor/guiInspectorTypes.cc
  20. 14 105
      engine/source/gui/editor/guiInspectorTypes.h
  21. 0 1
      engine/source/gui/guiArrayCtrl.cc
  22. 1 0
      engine/source/gui/guiColorPickerCtrl.cc
  23. 1 0
      engine/source/gui/guiColorPopupCtrl.cc
  24. 15 18
      engine/source/gui/guiControl.cc
  25. 16 1
      engine/source/gui/guiControl.h
  26. 1 0
      engine/source/gui/guiInputCtrl.cc
  27. 1 0
      engine/source/gui/guiListBoxCtrl.cc
  28. 1 0
      engine/source/gui/guiMessageVectorCtrl.cc
  29. 1 0
      engine/source/gui/guiProgressCtrl.cc
  30. 1 0
      engine/source/gui/guiSliderCtrl.cc
  31. 54 14
      engine/source/gui/guiTextEditCtrl.cc
  32. 7 0
      engine/source/gui/guiTextEditCtrl.h
  33. 0 1
      engine/source/gui/guiTextEditSliderCtrl.cc
  34. 0 1
      engine/source/gui/guiTreeViewCtrl.cc
  35. 2 2
      engine/source/sim/simObject.cc

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

@@ -56,7 +56,7 @@ function GuiEditorInspectorWindow::onAdd(%this)
 
     %this.inspectList = new SimSet();
 
-	%this.inspector.addHiddenField("isContainer");
+	//%this.inspector.addHiddenField("isContainer");
 	%this.inspector.addHiddenField("BindToGuiEditor");
 }
 

+ 4 - 1
engine/source/2d/gui/SceneWindow.cc

@@ -144,7 +144,10 @@ SceneWindow::SceneWindow() :    mpScene(NULL),
 	mTrackProfile = mScrollBar->mTrackProfile;
 	mThumbProfile->incRefCount();
 	mArrowProfile = mScrollBar->mArrowProfile;
-	mThumbProfile->incRefCount();
+	mThumbProfile->incRefCount(); 
+	
+	mRendersChildren = false;
+	mIsContainer = false;
 }
 
 //-----------------------------------------------------------------------------

+ 8 - 8
engine/source/2d/gui/guiSpriteCtrl.cc

@@ -90,14 +90,14 @@ void GuiSpriteCtrl::initPersistFields()
     addProtectedField("NamedFrame", TypeString, Offset(mNamedImageFrameId, GuiSpriteCtrl), &setNamedImageFrame, &defaultProtectedGetFn, &writeNamedImageFrame, "The named image frame used for the image.");
     addProtectedField("Animation", TypeAssetId, Offset(mAnimationAssetId, GuiSpriteCtrl), &setAnimation, &defaultProtectedGetFn, &writeAnimation, "The animation to use.");
 	addProtectedField("Bitmap", TypeFilename, Offset(mBitmapName, GuiSpriteCtrl), &setBitmapName, &getBitmapName, &writeBitmapName, "The bitmap to use in absence of an asset.");
-	addProtectedField("singleFrameBitmap", TypeBool, Offset(mSingleFrameBitmap, GuiSpriteCtrl), &defaultProtectedSetFn, &defaultProtectedGetFn, &writeBitmapName, "If true, will assume there is a single frame when scanning the bitmap.");
-	addField("tileImage", TypeBool, Offset(mTileImage, GuiSpriteCtrl));
-	addField("positionOffset", TypePoint2I, Offset(mPositionOffset, GuiSpriteCtrl));
-	addField("imageColor", TypeFluidColorI, Offset(mImageColor, GuiSpriteCtrl));
-	addField("imageSize", TypePoint2I, Offset(mImageSize, GuiSpriteCtrl));
-	addField("fullSize", TypeBool, Offset(mFullSize, GuiSpriteCtrl));
-	addField("clampImage", TypeBool, Offset(mClampImage, GuiSpriteCtrl));
-	addField("constrainProportions", TypeBool, Offset(mConstrainProportions, GuiSpriteCtrl));
+	addProtectedField("singleFrameBitmap", TypeBool, Offset(mSingleFrameBitmap, GuiSpriteCtrl), &defaultProtectedSetFn, &defaultProtectedGetFn, &writeSingleFrameBitmap, "If true, will assume there is a single frame when scanning the bitmap.");
+	addField("tileImage", TypeBool, Offset(mTileImage, GuiSpriteCtrl), &writeTileImage);
+	addField("positionOffset", TypePoint2I, Offset(mPositionOffset, GuiSpriteCtrl), &writePositionOffset);
+	addField("imageColor", TypeFluidColorI, Offset(mImageColor, GuiSpriteCtrl), &writeImageColor);
+	addField("imageSize", TypePoint2I, Offset(mImageSize, GuiSpriteCtrl), &writeImageSize);
+	addField("fullSize", TypeBool, Offset(mFullSize, GuiSpriteCtrl), &writeFullSize);
+	addField("clampImage", TypeBool, Offset(mClampImage, GuiSpriteCtrl), &writeClampImage);
+	addField("constrainProportions", TypeBool, Offset(mConstrainProportions, GuiSpriteCtrl), &writeConstrainProportions);
 	endGroup("GuiSpriteCtrl");
 }
 

+ 8 - 0
engine/source/2d/gui/guiSpriteCtrl.h

@@ -149,6 +149,14 @@ protected:
 	static bool setBitmapName(void *obj, const char *data) { static_cast<GuiSpriteCtrl *>(obj)->setBitmap(data); return false; }
 	static const char *getBitmapName(void *obj, const char *data) { return static_cast<GuiSpriteCtrl*>(obj)->getBitmapName(); }
 	static bool writeBitmapName(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); if( pCastObject->usesAsset() ) return false; return pCastObject->mBitmapName != StringTable->EmptyString; }
+	static bool writeSingleFrameBitmap(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); return !pCastObject->mSingleFrameBitmap && !pCastObject->usesAsset() && pCastObject->mBitmapName != StringTable->EmptyString; }
+	static bool writeTileImage(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); return pCastObject->mTileImage; }
+	static bool writePositionOffset(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); return !pCastObject->mPositionOffset.isZero(); }
+	static bool writeImageColor(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); return pCastObject->mImageColor.red != 255 || pCastObject->mImageColor.green != 255 || pCastObject->mImageColor.blue != 255 || pCastObject->mImageColor.alpha != 255; }
+	static bool writeImageSize(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); return pCastObject->mImageSize.x != 10 || pCastObject->mImageSize.y != 10; }
+	static bool writeFullSize(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); return !pCastObject->mFullSize; }
+	static bool writeClampImage(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); return !pCastObject->mClampImage; }
+	static bool writeConstrainProportions(void* obj, StringTableEntry pFieldName) { GuiSpriteCtrl* pCastObject = static_cast<GuiSpriteCtrl*>(obj); return !pCastObject->mConstrainProportions; }
 };
 
 #endif //_GUISPRITECTRL_H_

+ 1 - 0
engine/source/gui/buttons/guiButtonCtrl.cc

@@ -41,6 +41,7 @@ GuiButtonCtrl::GuiButtonCtrl()
 	mText = StringTable->insert("Button");
 	mTextID = StringTable->EmptyString;
 	mProfile = NULL;
+	mIsContainer = false;
 
 	setField("profile", "GuiButtonProfile");
 }

+ 9 - 6
engine/source/gui/buttons/guiDropDownCtrl.cc

@@ -69,11 +69,12 @@ IMPLEMENT_CONOBJECT(GuiDropDownCtrl);
 
 GuiDropDownCtrl::GuiDropDownCtrl()
 {
-	mMaxHeight = 300;
+	mMaxHeight = DEFAULT_MAX_HEIGHT;
 	mBounds.extent.set(140, 24);
 	mIsOpen = false;
 	mActive = true;
 	mText = StringTable->insert("none");
+	mRendersChildren = false;
 	mIsContainer = false;
 
 	setField("profile", "GuiDropDownProfile");
@@ -116,7 +117,7 @@ GuiDropDownCtrl::GuiDropDownCtrl()
 	mScroll->setField("constantThumbHeight", "0");
 	mUseConstantHeightThumb = false;
 	mScroll->setField("scrollBarThickness", "12");
-	mScrollBarThickness = 12;
+	mScrollBarThickness = DEFAULT_THICKNESS;
 	mScroll->setField("showArrowButtons", "0");
 	mShowArrowButtons = false;
 	
@@ -127,16 +128,18 @@ GuiDropDownCtrl::GuiDropDownCtrl()
 void GuiDropDownCtrl::initPersistFields()
 {
    Parent::initPersistFields();
-   addField("maxHeight", TypeBool, Offset(mMaxHeight, GuiDropDownCtrl));
+   addGroup("Drop Down");
+   addField("maxHeight", TypeS32, Offset(mMaxHeight, GuiDropDownCtrl), &writeMaxHeightFn);
    addField("scrollProfile", TypeGuiProfile, Offset(mScrollProfile, GuiDropDownCtrl));
    addField("thumbProfile", TypeGuiProfile, Offset(mThumbProfile, GuiDropDownCtrl));
    addField("arrowProfile", TypeGuiProfile, Offset(mArrowProfile, GuiDropDownCtrl));
    addField("trackProfile", TypeGuiProfile, Offset(mTrackProfile, GuiDropDownCtrl));
    addField("listBoxProfile", TypeGuiProfile, Offset(mListBoxProfile, GuiDropDownCtrl));
    addField("backgroundProfile", TypeGuiProfile, Offset(mBackgroundProfile, GuiDropDownCtrl));
-   addField("constantThumbHeight", TypeBool, Offset(mUseConstantHeightThumb, GuiDropDownCtrl));
-   addField("showArrowButtons", TypeBool, Offset(mShowArrowButtons, GuiDropDownCtrl));
-   addField("scrollBarThickness", TypeS32, Offset(mScrollBarThickness, GuiDropDownCtrl));
+   addField("constantThumbHeight", TypeBool, Offset(mUseConstantHeightThumb, GuiDropDownCtrl), &writeConstantThumbHeightFn);
+   addField("showArrowButtons", TypeBool, Offset(mShowArrowButtons, GuiDropDownCtrl), &writeShowArrowButtonsFn);
+   addField("scrollBarThickness", TypeS32, Offset(mScrollBarThickness, GuiDropDownCtrl), &writeScrollBarThicknessFn);
+   endGroup("Drop Down");
 }
 
 void GuiDropDownCtrl::onTouchUp(const GuiEvent &event)

+ 7 - 0
engine/source/gui/buttons/guiDropDownCtrl.h

@@ -65,6 +65,8 @@ class GuiDropDownCtrl : public GuiButtonCtrl
 private:
    typedef GuiButtonCtrl Parent;
 
+   const static S32 DEFAULT_MAX_HEIGHT = 300;
+   const static S32 DEFAULT_THICKNESS = 12;
    S32 mMaxHeight;
    bool mIsOpen;
 
@@ -113,6 +115,11 @@ public:
 
    inline GuiListBoxCtrl* getList() { return mListBox; }
 
+   static bool writeMaxHeightFn(void* obj, StringTableEntry pFieldName) { return static_cast<GuiDropDownCtrl*>(obj)->mMaxHeight != DEFAULT_MAX_HEIGHT; }
+   static bool writeConstantThumbHeightFn(void* obj, StringTableEntry pFieldName) { return static_cast<GuiDropDownCtrl*>(obj)->mUseConstantHeightThumb; }
+   static bool writeShowArrowButtonsFn(void* obj, StringTableEntry pFieldName) { return static_cast<GuiDropDownCtrl*>(obj)->mShowArrowButtons; }
+   static bool writeScrollBarThicknessFn(void* obj, StringTableEntry pFieldName) { return static_cast<GuiDropDownCtrl*>(obj)->mScrollBarThickness != DEFAULT_THICKNESS; }
+
    DECLARE_CONOBJECT(GuiDropDownCtrl);
 };
 

+ 1 - 1
engine/source/gui/containers/guiChainCtrl.cc

@@ -33,9 +33,9 @@ IMPLEMENT_CONOBJECT(GuiChainCtrl);
 
 GuiChainCtrl::GuiChainCtrl()
 {
-	mIsContainer = true;
 	mChildSpacing = 0;
 	mIsVertical = true;
+	mPrevIsVertical = true;
 	mBounds.extent.set(140, mEditOpenSpace);
 	mResizeGuard = false;
 }

+ 0 - 1
engine/source/gui/containers/guiExpandCtrl.cc

@@ -30,7 +30,6 @@ GuiExpandCtrl::GuiExpandCtrl()
 {
    mActive = true;
    mExpanded = false;
-   mIsContainer = true;
    mCollapsedExtent.set(64,64);
    mAnimationProgress = 1;
    mExpandedExtent.set(64, 64);

+ 0 - 1
engine/source/gui/containers/guiFrameSetCtrl.cc

@@ -336,7 +336,6 @@ IMPLEMENT_CONOBJECT(GuiFrameSetCtrl);
 
 GuiFrameSetCtrl::GuiFrameSetCtrl()
 {
-	mIsContainer = true;
 	setField("profile", "GuiDefaultProfile");
 
 	mRootFrame = Frame(this, nullptr);

+ 0 - 1
engine/source/gui/containers/guiGridCtrl.cc

@@ -56,7 +56,6 @@ IMPLEMENT_CONOBJECT(GuiGridCtrl);
 
 GuiGridCtrl::GuiGridCtrl()
 {
-	mIsContainer = true;
 	mCellModeX = CellMode::Absolute;
 	mCellModeY = CellMode::Absolute;
 	mCellSizeX = 20;

+ 0 - 1
engine/source/gui/containers/guiPanelCtrl.cc

@@ -30,7 +30,6 @@ IMPLEMENT_CONOBJECT(GuiPanelCtrl);
 GuiPanelCtrl::GuiPanelCtrl()
 {
    mActive = true;
-   mIsContainer = true;
 	mHeader = NULL;
 }
 

+ 2 - 2
engine/source/gui/containers/guiScrollCtrl.cc

@@ -58,7 +58,6 @@ GuiScrollCtrl::GuiScrollCtrl()
    mBaseThumbSize = (mScrollBarThickness * 2);
 
    mUseConstantHeightThumb = false;
-   mIsContainer = true;
 
    mForceVScrollBar = ScrollBarAlwaysOn;
    mForceHScrollBar = ScrollBarAlwaysOn;
@@ -87,6 +86,7 @@ void GuiScrollCtrl::initPersistFields()
 {
    Parent::initPersistFields();
 
+   addGroup("GuiScrollCtrl");
    addField("hScrollBar",           TypeEnum,    Offset(mForceHScrollBar, GuiScrollCtrl), 1, &gScrollBarTable);
    addField("vScrollBar",           TypeEnum,    Offset(mForceVScrollBar, GuiScrollCtrl), 1, &gScrollBarTable);
    addField("constantThumbHeight",  TypeBool,    Offset(mUseConstantHeightThumb, GuiScrollCtrl));
@@ -95,7 +95,7 @@ void GuiScrollCtrl::initPersistFields()
    addField("thumbProfile", TypeGuiProfile, Offset(mThumbProfile, GuiScrollCtrl));
    addField("trackProfile", TypeGuiProfile, Offset(mTrackProfile, GuiScrollCtrl));
    addField("arrowProfile", TypeGuiProfile, Offset(mArrowProfile, GuiScrollCtrl));
-
+   endGroup("GuiScrollCtrl");
 }
 
 void GuiScrollCtrl::resize(const Point2I &newPos, const Point2I &newExt)

+ 0 - 1
engine/source/gui/containers/guiTabBookCtrl.cc

@@ -66,7 +66,6 @@ GuiTabBookCtrl::GuiTabBookCtrl()
    mPages.reserve(12);
    mMinTabWidth = 64;
    mTabWidth = 64;
-   mIsContainer = true;
    mIsFrameSetGenerated = false;
 
    mTabProfile = NULL;

+ 0 - 1
engine/source/gui/containers/guiTabPageCtrl.cc

@@ -34,7 +34,6 @@ GuiTabPageCtrl::GuiTabPageCtrl(void)
 {
    mBounds.extent.set(100, 200);
    mActive = true;
-   mIsContainer = true;
 }
 
 GuiControl *GuiTabPageCtrl::findNextTabable(GuiControl *curResponder, bool firstCall)

+ 0 - 1
engine/source/gui/containers/guiWindowCtrl.cc

@@ -45,7 +45,6 @@ GuiWindowCtrl::GuiWindowCtrl(void)
    mTitleHeight = 20;
    mResizeRightWidth = 10;
    mResizeBottomHeight = 10;
-   mIsContainer = true;
    mDepressed = false;
    curHitRegion = None;
    mActive = true;

+ 62 - 2
engine/source/gui/editor/guiEditCtrl.cc

@@ -412,7 +412,7 @@ S32 GuiEditCtrl::getSizingHitKnobs(const Point2I& pt, const RectI& box)
 	return sizingNone;
 }
 
-void GuiEditCtrl::drawNuts(RectI& box, ColorI& outlineColor, ColorI& nutColor)
+void GuiEditCtrl::drawControlDecoration(GuiControl* ctrl, RectI& box, ColorI& outlineColor, ColorI& nutColor)
 {
 	S32 lx = box.point.x, rx = box.point.x + box.extent.x - 1;
 	S32 cx = (lx + rx) >> 1;
@@ -421,6 +421,63 @@ void GuiEditCtrl::drawNuts(RectI& box, ColorI& outlineColor, ColorI& nutColor)
 	ColorI fillColor = mProfile->getFillColor(DisabledState);
 	ColorI weakColor(fillColor.red, fillColor.green, fillColor.blue, 120);
 	ColorI strongColor(fillColor.red, fillColor.green, fillColor.blue, 200);
+	ColorI strongestColor(fillColor.red, fillColor.green, fillColor.blue, 255);
+	drawTargetLines(lx, ty, weakColor, by, rx, strongColor);
+	
+	if (ctrl->isHidden())
+	{
+		box.inset(-1, -1);
+		drawDashedLine(10, lx, ty, rx, ty, strongestColor);
+		drawDashedLine(10, lx, ty, lx, by, strongestColor);
+		drawDashedLine(10, rx, ty, rx, by, strongestColor);
+		drawDashedLine(10, lx, by, rx, by, strongestColor);
+
+		if (ctrl->isLocked())
+		{
+			box.inset(-1, -1);
+			dglDrawRect(box, outlineColor);
+		}
+	}
+	else if (ctrl->isLocked())
+	{
+		box.inset(-1, -1);
+		dglDrawRect(box, strongestColor);
+		box.inset(-1,-1);
+		dglDrawRect(box, outlineColor);
+	}
+	else
+	{
+		drawNuts(lx, ty, rx, by, outlineColor, nutColor, cy, cx);
+	}
+}
+
+void GuiEditCtrl::drawDashedLine(const F32& dashLength, const S32& x1, const S32& y1, const S32& x2, const S32& y2, ColorI& color)
+{
+	F32 dx = x2 - x1;
+	F32 dy = y2 - y1;
+	F32 lineLength = mSqrt(dx * dx + dy * dy);
+	S32 numSegments = mCeil(lineLength / dashLength);
+	F32 unitX = dx / lineLength;
+	F32 unitY = dy / lineLength;
+
+	for (int i = 0; i < numSegments; i++) 
+	{
+		F32 startX = x1 + (i * dashLength * unitX);
+		F32 startY = y1 + (i * dashLength * unitY);
+
+		F32 remainingLength = lineLength - (i * dashLength);
+		F32 currentDashLength = getMin((dashLength), remainingLength);
+		F32 endX = startX + (currentDashLength * unitX);
+		F32 endY = startY + (currentDashLength * unitY);
+
+		if (i % 2 == 0) {
+			dglDrawLine(startX, startY, endX, endY, color);
+		}
+	}
+}
+
+void GuiEditCtrl::drawTargetLines(const S32& lx, const S32& ty, ColorI& weakColor, const S32& by, const S32& rx, ColorI& strongColor)
+{
 	if (lx > 0 && ty > 0)
 	{
 		dglDrawLine(0, ty, lx, ty, weakColor);
@@ -443,7 +500,10 @@ void GuiEditCtrl::drawNuts(RectI& box, ColorI& outlineColor, ColorI& nutColor)
 	}
 	if (rx < extent.x && ty < extent.y)
 		dglDrawLine(rx, ty, extent.x, ty, strongColor);
+}
 
+void GuiEditCtrl::drawNuts(S32& lx, S32& ty, S32& rx, S32& by, ColorI& outlineColor, ColorI& nutColor, const S32& cy, const S32& cx)
+{
 	// adjust nuts, so they dont straddle the controls
 	lx -= NUT_SIZE;
 	ty -= NUT_SIZE;
@@ -521,7 +581,7 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI& updateRect)
 				outlineColor = border->getBorderColor(SelectedState);
 			}
 
-			drawNuts(box, outlineColor, nutColor);
+			drawControlDecoration(ctrl, box, outlineColor, nutColor);
 		}
 		if (mMouseDownMode == DragSelecting)
 		{

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

@@ -77,7 +77,10 @@ class GuiEditCtrl : public GuiControl
    S32 getSizingHitKnobs(const Point2I &pt, const RectI &box);
    void getDragRect(RectI &b);
    void drawNut(const Point2I &nut, ColorI &outlineColor, ColorI &nutColor);
-   void drawNuts(RectI &box, ColorI &outlineColor, ColorI &nutColor);
+   void drawControlDecoration(GuiControl* ctrl, RectI &box, ColorI &outlineColor, ColorI &nutColor);
+   void drawDashedLine(const F32& dashLength, const S32& x1, const S32& y1, const S32& x2, const S32& y2, ColorI& color);
+   void drawTargetLines(const S32& lx, const S32& ty, ColorI& weakColor, const S32& by, const S32& rx, ColorI& strongColor);
+   void drawNuts(S32& lx, S32& ty, S32& rx, S32& by, ColorI& outlineColor, ColorI& nutColor, const S32& cy, const S32& cx);
    void onPreRender();
    void onRender(Point2I offset, const RectI &updateRect);
    void addNewControl(GuiControl *ctrl);

+ 40 - 0
engine/source/gui/editor/guiInspectorTypes.cc

@@ -606,6 +606,46 @@ void GuiInspectorTypeColorF::finishControlConstruction()
 }
 
 
+IMPLEMENT_CONOBJECT(GuiInspectorTypeFluidColorI);
+
+void GuiInspectorTypeFluidColorI::consoleInit()
+{
+	Parent::consoleInit();
+
+	ConsoleBaseType::getType(TypeFluidColorI)->setInspectorFieldType("GuiInspectorTypeFluidColorI");
+}
+
+GuiInspectorTypeFluidColorI::GuiInspectorTypeFluidColorI()
+{
+	mColorFunction = StringTable->insert("getColorI");
+}
+
+void GuiInspectorTypeFluidColorI::updateValue(StringTableEntry newValue)
+{
+	if (Utility::mGetStringElementCount(newValue) != 4)
+	{
+		return;
+	}
+
+	S32 red = dAtoi(Utility::mGetStringElement(newValue, 0));
+	S32 green = dAtoi(Utility::mGetStringElement(newValue, 1));
+	S32 blue = dAtoi(Utility::mGetStringElement(newValue, 2));
+	S32 alpha = dAtoi(Utility::mGetStringElement(newValue, 3));
+
+	ColorF color = ColorI(red, green, blue, alpha);
+	mColorPopup->setColor(color);
+
+	mRedEdit->setText(Utility::mGetStringElement(newValue, 0));
+	mGreenEdit->setText(Utility::mGetStringElement(newValue, 1));
+	mBlueEdit->setText(Utility::mGetStringElement(newValue, 2));
+	mAlphaEdit->setText(Utility::mGetStringElement(newValue, 3));
+}
+
+void GuiInspectorTypeFluidColorI::finishControlConstruction()
+{
+}
+
+
 //////////////////////////////////////////////////////////////////////////
 // TypeSimObjectPtr GuiInspectorField Class
 //////////////////////////////////////////////////////////////////////////

+ 14 - 105
engine/source/gui/editor/guiInspectorTypes.h

@@ -75,9 +75,6 @@
 
 
 
-//////////////////////////////////////////////////////////////////////////
-// TypeEnum GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeEnum : public GuiInspectorField
 {
 private:
@@ -86,19 +83,12 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypeEnum);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl*        constructEditControl(S32 width);
    virtual void               setData( StringTableEntry data );
    virtual StringTableEntry   getData();
    virtual void               updateValue( StringTableEntry newValue );
 };
 
-
-//////////////////////////////////////////////////////////////////////////
-// GuiInspectorTypeCheckBox Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeCheckBox : public GuiInspectorField
 {
 private:
@@ -107,15 +97,9 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypeCheckBox);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields (Both are REQUIRED)
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl* constructEditControl(S32 width);
 };
 
-//////////////////////////////////////////////////////////////////////////
-// GuiInspectorTypeGuiProfile Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeGuiProfile : public GuiInspectorTypeEnum
 {
 private:
@@ -124,15 +108,9 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypeGuiProfile);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields (Both are REQUIRED)
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl* constructEditControl(S32 width);
 };
 
-//////////////////////////////////////////////////////////////////////////
-// GuiInspectorTypeGuiBorderProfile Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeGuiBorderProfile : public GuiInspectorTypeEnum
 {
 private:
@@ -141,15 +119,9 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypeGuiBorderProfile);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields (Both are REQUIRED)
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl* constructEditControl(S32 width);
 };
 
-//////////////////////////////////////////////////////////////////////////
-// GuiInspectorTypeGuiCursor Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeGuiCursor : public GuiInspectorTypeEnum
 {
 private:
@@ -158,16 +130,9 @@ public:
 	DECLARE_CONOBJECT(GuiInspectorTypeGuiCursor);
 	static void consoleInit();
 
-	//////////////////////////////////////////////////////////////////////////
-	// Override able methods for custom edit fields (Both are REQUIRED)
-	//////////////////////////////////////////////////////////////////////////
 	virtual GuiControl* constructEditControl(S32 width);
 };
 
-
-//////////////////////////////////////////////////////////////////////////
-// TypeFileName GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeFileName : public GuiInspectorField
 {
 private:
@@ -178,17 +143,10 @@ public:
 
    SimObjectPtr<GuiButtonCtrl>   mBrowseButton;
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl*        constructEditControl(S32 width);
    virtual void               resize(const Point2I &newPosition, const Point2I &newExtent);
 };
 
-
-//////////////////////////////////////////////////////////////////////////
-// TypeColor GuiInspectorField Class (Base for ColorI/ColorF)
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeColor : public GuiInspectorField
 {
 private:
@@ -206,16 +164,10 @@ protected:
 public:
    StringTableEntry  mColorFunction;
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl*        constructEditControl(S32 width);
    virtual void               finishControlConstruction() = 0;
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeColorI GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeColorI : public GuiInspectorTypeColor
 {
 private:
@@ -229,9 +181,6 @@ public:
    void finishControlConstruction();
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeColorF GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeColorF : public GuiInspectorTypeColor
 {
 private:
@@ -245,9 +194,19 @@ public:
    void finishControlConstruction();
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeSimObjectPtr GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
+class GuiInspectorTypeFluidColorI : public GuiInspectorTypeColor
+{
+private:
+	typedef GuiInspectorTypeColor Parent;
+public:
+	GuiInspectorTypeFluidColorI();
+
+	DECLARE_CONOBJECT(GuiInspectorTypeFluidColorI);
+	static void consoleInit();
+	void updateValue(StringTableEntry newValue);
+	void finishControlConstruction();
+};
+
 class GuiInspectorTypeSimObjectPtr : public GuiInspectorField
 {
 private:
@@ -256,16 +215,10 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypeSimObjectPtr);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl*        constructEditControl(S32 width);
    virtual StringTableEntry   getData();
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeS32 GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeS32 : public GuiInspectorField
 {
 private:
@@ -274,16 +227,10 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypeS32);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl*        constructEditControl(S32 width);
    virtual const char*        getData();
 };
 
-//////////////////////////////////////////////////////////////////////////
-// DualValue GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeDualValue : public GuiInspectorField
 {
 protected: 
@@ -295,9 +242,6 @@ public:
 	virtual void		updateValue(StringTableEntry newValue);
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypePoint2I GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypePoint2I : public GuiInspectorTypeDualValue
 {
 private:
@@ -306,15 +250,9 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypePoint2I);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl*        constructEditControl(S32 width);
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypePoint2F GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypePoint2F : public GuiInspectorTypeDualValue
 {
 private:
@@ -323,15 +261,9 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypePoint2F);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl*        constructEditControl(S32 width);
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeVector2 GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeVector2 : public GuiInspectorTypeDualValue
 {
 private:
@@ -340,15 +272,9 @@ public:
    DECLARE_CONOBJECT(GuiInspectorTypeVector2);
    static void consoleInit();
 
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
    virtual GuiControl*        constructEditControl(S32 width);
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeAsset GuiInspectorField Class Base for Assets
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeAsset : public GuiInspectorField
 {
 private:
@@ -359,15 +285,10 @@ public:
    StringTableEntry mAssetType;
 
    SimObjectPtr<GuiButtonCtrl>   mBrowseButton;
-   //////////////////////////////////////////////////////////////////////////
-   // Override able methods for custom edit fields
-   //////////////////////////////////////////////////////////////////////////
+
    virtual GuiControl*        constructEditControl(S32 width);
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeImageAssetPtr GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeImageAssetPtr : public GuiInspectorTypeAsset
 {
 private:
@@ -379,9 +300,6 @@ public:
    static void consoleInit();
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeAnimationAssetPtr GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeAnimationAssetPtr : public GuiInspectorTypeAsset
 {
 private:
@@ -393,9 +311,6 @@ public:
    static void consoleInit();
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeAudioAssetPtr GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeAudioAssetPtr : public GuiInspectorTypeAsset
 {
 private:
@@ -407,9 +322,6 @@ public:
    static void consoleInit();
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeFontAssetPtr GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeFontAssetPtr : public GuiInspectorTypeAsset
 {
 private:
@@ -421,9 +333,6 @@ public:
    static void consoleInit();
 };
 
-//////////////////////////////////////////////////////////////////////////
-// TypeParticleAssetPtr GuiInspectorField Class
-//////////////////////////////////////////////////////////////////////////
 class GuiInspectorTypeParticleAssetPtr : public GuiInspectorTypeAsset
 {
 private:

+ 0 - 1
engine/source/gui/guiArrayCtrl.cc

@@ -36,7 +36,6 @@ GuiArrayCtrl::GuiArrayCtrl()
    mSize = Point2I(5, 30);
    mSelectedCell.set(-1, -1);
    mMouseOverCell.set(-1, -1);
-   mIsContainer = true;
 }
 
 bool GuiArrayCtrl::onWake()

+ 1 - 0
engine/source/gui/guiColorPickerCtrl.cc

@@ -66,6 +66,7 @@ GuiColorPickerCtrl::GuiColorPickerCtrl()
 	mPositionChanged = true;
 	mActionOnMove = false;
 	mShowSelector = false;
+	mRendersChildren = false;
 	mIsContainer = false;
 
 	mProfile = NULL;

+ 1 - 0
engine/source/gui/guiColorPopupCtrl.cc

@@ -112,6 +112,7 @@ GuiColorPopupCtrl::GuiColorPopupCtrl()
 	mBounds.extent.set(140, 24);
 	mIsOpen = false;
 	mActive = true;
+	mRendersChildren = false;
 	mIsContainer = false;
 	mBaseColor = ColorF(0.5f, 0.5f, 0.5f);
 	mPopupSize = Point2I(240, 208);

+ 15 - 18
engine/source/gui/guiControl.cc

@@ -120,8 +120,9 @@ GuiControl::GuiControl()
    mVertSizing          = vertResizeBottom;
    mTooltipProfile      = NULL;
    mTooltip             = StringTable->EmptyString;
-   mTipHoverTime        = 1000;
-   mTooltipWidth		= 250;
+   mTipHoverTime        = DEFAULT_TOOLTIP_HOVERTIME;
+   mTooltipWidth        = DEFAULT_TOOLTIP_WIDTH;
+   mRendersChildren     = true;
    mIsContainer         = true;
    mAllowEventPassThru  = false;
    mTextWrap			= false;
@@ -142,10 +143,6 @@ bool GuiControl::onAdd()
    // Grab the classname of this object
    const char *cName = getClassName();
 
-   // if we're a pure GuiControl, then we're a container by default.
-   if(dStrcmp("GuiControl", cName) == 0)
-      mIsContainer = true;
-
    // Clamp to minExtent
    mBounds.extent.x = getMax( mMinExtent.x, mBounds.extent.x );
    mBounds.extent.y = getMax( mMinExtent.y, mBounds.extent.y );
@@ -208,9 +205,9 @@ void GuiControl::initPersistFields()
    Parent::initPersistFields();
 
    // Things relevant only to the editor.
-   addGroup("Gui Editing");
-   addField("isContainer",       TypeBool,      Offset(mIsContainer, GuiControl));
-   endGroup("Gui Editing");
+   addGroup("Editing");
+   addProtectedField("isContainer",       TypeBool,      Offset(mIsContainer, GuiControl), &setIsContainerFn, &defaultProtectedGetFn, &writeIsContainerFn, "True if the container should accept children in the editor. Some controls cannot be containers.");
+   endGroup("Editing");
 
    // Parent Group.
    addGroup("GuiControl");
@@ -222,9 +219,9 @@ void GuiControl::initPersistFields()
    addProtectedField("Position",          TypePoint2I,		Offset(mBounds.point, GuiControl), &setPositionFn, &defaultProtectedGetFn, "The location of the control in relation to its parent's content area.");
    addProtectedField("Extent",            TypePoint2I,		Offset(mBounds.extent, GuiControl), &setExtentFn, &defaultProtectedGetFn, "The size of the control writen as width and height.");
    addProtectedField("MinExtent",         TypePoint2I,		Offset(mMinExtent, GuiControl), &setMinExtentFn, &defaultProtectedGetFn, &writeMinExtentFn, "The extent will not shrink below this size.");
-   addField("canSave",           TypeBool,			Offset(mCanSave, GuiControl));
-   addField("Visible",           TypeBool,			Offset(mVisible, GuiControl));
-   addField("useInput",          TypeBool,          Offset(mUseInput, GuiControl));
+   addField("canSave",           TypeBool,          Offset(mCanSave, GuiControl), &defaultProtectedNotWriteFn);
+   addField("Visible",           TypeBool,          Offset(mVisible, GuiControl), &writeVisibleFn);
+   addField("useInput",          TypeBool,          Offset(mUseInput, GuiControl), &writeUseInputFn);
 
    addField("Variable",          TypeString,		Offset(mConsoleVariable, GuiControl));
    addField("Command",           TypeString,		Offset(mConsoleCommand, GuiControl));
@@ -236,8 +233,8 @@ void GuiControl::initPersistFields()
    addGroup("ToolTip");
    addField("tooltipprofile",    TypeGuiProfile,	Offset(mTooltipProfile, GuiControl));
    addField("tooltip",           TypeString,		Offset(mTooltip, GuiControl));
-   addField("tooltipWidth",      TypeS32,			Offset(mTooltipWidth, GuiControl));
-   addField("hovertime",         TypeS32,			Offset(mTipHoverTime, GuiControl));
+   addField("tooltipWidth",      TypeS32,			Offset(mTooltipWidth, GuiControl), &writeToolTipWidthFn);
+   addField("hovertime",         TypeS32,			Offset(mTipHoverTime, GuiControl), &writeToolTipHoverTimeFn);
    endGroup("ToolTip");
 
 
@@ -252,9 +249,9 @@ void GuiControl::initPersistFields()
    addField("textExtend", TypeBool, Offset(mTextExtend, GuiControl), &writeTextExtendFn, "If true, extent will change based on the size of the control's text when possible.");
    addField("align", TypeEnum, Offset(mAlignment, GuiControl), 1, &gAlignCtrlTable);
    addField("vAlign", TypeEnum, Offset(mVAlignment, GuiControl), 1, &gVAlignCtrlTable);
-   addField("fontSizeAdjust", TypeF32, Offset(mFontSizeAdjust, GuiControl), "A decimal value that is multiplied with the profile's fontSize to determine the control's actual font size.");
-   addField("overrideFontColor", TypeBool, Offset(mOverrideFontColor, GuiControl), "If true, the control's fontColor will override the profile's font color.");
-   addField("fontColor", TypeColorI, Offset(mFontColor, GuiControl), "A color to override the font color of the control's profile. OverrideFontColor must be set to true for this to work.");
+   addField("fontSizeAdjust", TypeF32, Offset(mFontSizeAdjust, GuiControl), &writeFontSizeAdjustFn, "A decimal value that is multiplied with the profile's fontSize to determine the control's actual font size.");
+   addField("overrideFontColor", TypeBool, Offset(mOverrideFontColor, GuiControl), &writeOverrideFontColorFn, "If true, the control's fontColor will override the profile's font color.");
+   addField("fontColor", TypeColorI, Offset(mFontColor, GuiControl), &writeFontColorFn, "A color to override the font color of the control's profile. OverrideFontColor must be set to true for this to work.");
    endGroup("Text");
 }
 
@@ -1003,7 +1000,7 @@ void GuiControl::renderChildControls(const Point2I& offset, const RectI& content
 			  Con::errorf( "GuiControl::renderChildControls() object %i is NULL", count );
 			continue;
 		  }
-		  if (ctrl->mVisible)
+		  if (ctrl->mVisible && (!isEditMode() || !ctrl->isHidden()))
 		  {
 			 renderChild(ctrl, offset, content, clipRect);
 		  }

+ 16 - 1
engine/source/gui/guiControl.h

@@ -130,16 +130,23 @@ public:
 
    GuiControlProfile *mProfile;
 
+   static const S32 DEFAULT_TOOLTIP_WIDTH = 250;
+   static const S32 DEFAULT_TOOLTIP_HOVERTIME = 1000;
+
     GuiControlProfile	*mTooltipProfile; 
     S32					mTipHoverTime;
     S32					mTooltipWidth;
 
+	static bool writeToolTipWidthFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); return ctrl->mTooltipWidth != DEFAULT_TOOLTIP_WIDTH; }
+	static bool writeToolTipHoverTimeFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); return ctrl->mTipHoverTime != DEFAULT_TOOLTIP_HOVERTIME; }
+
     bool    mVisible;
     bool    mActive;
     bool    mAwake;
     bool    mSetFirstResponder;
     bool    mCanSave;
-    bool    mIsContainer; ///< if true, then the GuiEditor can drag other controls into this one.
+    bool    mIsContainer; ///< True if the GuiEditor can drag other controls into this one.
+	bool    mRendersChildren; ///< True if the control renders children. If false, then the control cannot be a container. This is set by the class and cannot be changed by the user.
     bool    mUseInput; ///< True if input events like a click can be passed to this gui. False will pass events to the parent and this object and its children will not process input (touch and keyboard).
 
     S32     mLayer;
@@ -227,6 +234,10 @@ protected:
     ColorI              mFontColor;
     bool                mOverrideFontColor;
 
+	static bool writeFontSizeAdjustFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); return ctrl->mFontSizeAdjust != 1; }
+	static bool writeFontColorFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); return ctrl->mOverrideFontColor && ctrl->mFontColor != ColorI(0,0,0,255); }
+	static bool writeOverrideFontColorFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); return ctrl->mOverrideFontColor; }
+
     /// @}
 
     /// @name Console
@@ -361,6 +372,10 @@ public:
     /// @param   value   True if object should be visible
     virtual void setVisible(bool value);
     inline bool isVisible() { return mVisible; } ///< Returns true if the object is visible
+	static bool writeVisibleFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); return !ctrl->isVisible(); }
+	static bool writeUseInputFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); return !ctrl->mUseInput; }
+	static bool writeIsContainerFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); return ctrl->mRendersChildren && !ctrl->mIsContainer; }
+	static bool setIsContainerFn(void* obj, const char* data) { GuiControl* ctrl = static_cast<GuiControl*>(obj); ctrl->mIsContainer = ctrl->mRendersChildren ? dAtob(data) : false; return false; }
 
     /// Sets the status of this control as active and responding or inactive
     /// @param   value   True if this is active

+ 1 - 0
engine/source/gui/guiInputCtrl.cc

@@ -27,6 +27,7 @@ IMPLEMENT_CONOBJECT(GuiInputCtrl);
 
 GuiInputCtrl::GuiInputCtrl()
 {
+	mRendersChildren = false;
 	mIsContainer = false;
 }
 

+ 1 - 0
engine/source/gui/guiListBoxCtrl.cc

@@ -36,6 +36,7 @@ GuiListBoxCtrl::GuiListBoxCtrl()
    mFitParentWidth = true;
    mItemSize = Point2I(10,20);
    mLastClickItem = NULL;
+   mRendersChildren = false;
    mIsContainer = false;
    mActive = true;
    caller = this;

+ 1 - 0
engine/source/gui/guiMessageVectorCtrl.cc

@@ -92,6 +92,7 @@ GuiMessageVectorCtrl::GuiMessageVectorCtrl()
    mSpecialColor.set(0, 0, 255);
 
    mMaxColorIndex = 9;
+   mRendersChildren = false;
    mIsContainer = false;
 }
 

+ 1 - 0
engine/source/gui/guiProgressCtrl.cc

@@ -37,6 +37,7 @@ GuiProgressCtrl::GuiProgressCtrl()
    mCurrent = 0.0f;
    mStart = 0.0f;
    mEnd = 0.0f;
+   mRendersChildren = false;
    mIsContainer = false;
 
    setAnimationLength(250);

+ 1 - 0
engine/source/gui/guiSliderCtrl.cc

@@ -43,6 +43,7 @@ GuiSliderCtrl::GuiSliderCtrl(void)
     mDisplayValue = false;
     mMouseOver = false;
     mDepressed = false;
+	mRendersChildren = false;
 	mIsContainer = false;
 }
 

+ 54 - 14
engine/source/gui/guiTextEditCtrl.cc

@@ -422,9 +422,9 @@ void GuiTextEditCtrl::initPersistFields()
    addGroup("Text Edit");
    addField("returnCommand", TypeString, Offset(mReturnCommand, GuiTextEditCtrl));
    addField("escapeCommand", TypeString, Offset(mEscapeCommand, GuiTextEditCtrl));
-   addField("sinkAllKeyEvents",  TypeBool,      Offset(mSinkAllKeyEvents,  GuiTextEditCtrl));
-   addField("password", TypeBool, Offset(mPasswordText, GuiTextEditCtrl));
-   addField("returnCausesTab", TypeBool, Offset(mReturnCausesTab, GuiTextEditCtrl));
+   addField("sinkAllKeyEvents",  TypeBool,      Offset(mSinkAllKeyEvents,  GuiTextEditCtrl), &writeSinkAllKeyEventsFn);
+   addField("password", TypeBool, Offset(mPasswordText, GuiTextEditCtrl), &writePasswordFn);
+   addField("returnCausesTab", TypeBool, Offset(mReturnCausesTab, GuiTextEditCtrl), &writeReturnCausesTabFn);
    addProtectedField("maxLength", TypeS32,		Offset(mMaxStrLen,			GuiTextEditCtrl), &setMaxLengthProperty, &defaultProtectedGetFn, "The max number of characters that can be entered into the text edit box.");
    addProtectedField("inputMode", TypeEnum,		Offset(mInputMode,			GuiTextEditCtrl), &setInputMode, &getInputMode, &writeInputMode, 1, &gInputModeTable, "InputMode allows different characters to be entered.");
    addField("editCursor", TypeGuiCursor, Offset(mEditCursor, GuiTextEditCtrl));
@@ -940,8 +940,20 @@ bool GuiTextEditCtrl::tabPrev()
 	return false;
 }
 
+void GuiTextEditCtrl::onFocus(bool foundFirstResponder)
+{
+	Parent::onFocus(foundFirstResponder);
+
+	mTextOnFocus = mText;
+}
+
 void GuiTextEditCtrl::setFirstResponder()
 {
+	if(!isFirstResponder())
+	{
+		mTextOnFocus = mText;
+	}
+
 	selectAllText();
 	if(mTextBuffer.length() == 0)
 	{
@@ -1432,12 +1444,7 @@ bool GuiTextEditCtrl::handleKeyDownWithNoModifier(const GuiEvent& event)
         return tabNext();
 
     case KEY_ESCAPE:
-        if (mEscapeCommand && mEscapeCommand[0])
-        {
-            Con::evaluate(mEscapeCommand);
-            return true;
-        }
-        return false;
+        return handleEscapeKey();
 
     case KEY_RETURN:
     case KEY_NUMPADENTER:
@@ -1570,21 +1577,54 @@ bool GuiTextEditCtrl::handleDelete()
     return true;
 }
 
+bool GuiTextEditCtrl::handleEscapeKey()
+{
+	if(isMethod("onEscape"))
+		Con::executef(this, 1, "onEscape");
+
+	bool preventDefault = false;
+	if (mEscapeCommand && mEscapeCommand[0])
+	{
+		preventDefault = Con::evaluate(mEscapeCommand);
+	}
+	
+	if(!preventDefault)
+	{
+		setText(mTextOnFocus);
+		GuiControl* parent = getParent();
+		if (parent)
+		{
+			parent->onFocus(false);
+		}
+	}
+
+	return true;
+}
+
 bool GuiTextEditCtrl::handleEnterKey()
 {
     if (isMethod("onReturn"))
         Con::executef(this, 1, "onReturn");
 
-    if (mReturnCausesTab)
+    bool preventDefault = false;
+    if (mReturnCommand && mReturnCommand[0])
     {
-        tabNext();
+        preventDefault = Con::evaluate(mReturnCommand);
     }
 
-    
-    if (mReturnCommand && mReturnCommand[0])
+	if (mReturnCausesTab)
     {
-        Con::evaluate(mReturnCommand);
+        tabNext();
     }
+	else if (!preventDefault)
+	{
+		GuiControl* parent = getParent();
+		if (parent)
+		{
+			parent->onFocus(false);
+		}
+	}
+
     return true;
 }
 

+ 7 - 0
engine/source/gui/guiTextEditCtrl.h

@@ -164,6 +164,7 @@ protected:
    virtual bool handleKeyDownWithAlt(const GuiEvent& event);
    virtual bool handleKeyDownWithNoModifier(const GuiEvent& event);
    virtual bool handleCharacterInput(const GuiEvent& event);
+   virtual bool handleEscapeKey();
    virtual bool handleEnterKey();
    virtual bool handleArrowKey(GuiDirection direction);
    virtual bool handleShiftArrowKey(GuiDirection direction);
@@ -214,6 +215,8 @@ public:
    void onPaste();
    void onUndo();
 
+   StringTableEntry mTextOnFocus;
+   void onFocus(bool foundFirstResponder);
    virtual void setFirstResponder();
    virtual void onLoseFirstResponder();
 
@@ -277,6 +280,10 @@ public:
 
 	enum Constants { MAX_STRING_LENGTH = 1024 };
 
+	static bool writeSinkAllKeyEventsFn(void* obj, StringTableEntry pFieldName) { return static_cast<GuiTextEditCtrl*>(obj)->getSinkAllKeyEvents(); }
+	static bool writePasswordFn(void* obj, StringTableEntry pFieldName) { return static_cast<GuiTextEditCtrl*>(obj)->getIsPassword(); }
+	static bool writeReturnCausesTabFn(void* obj, StringTableEntry pFieldName) { return static_cast<GuiTextEditCtrl*>(obj)->getReturnCausesTab(); }
+
 private:
 	bool tabNext();
 	bool tabPrev();

+ 0 - 1
engine/source/gui/guiTextEditSliderCtrl.cc

@@ -37,7 +37,6 @@ GuiTextEditSliderCtrl::GuiTextEditSliderCtrl()
    mIncCounter = 0.0f;
    mFormat = StringTable->insert("%3.2f");
    mTextAreaHit = None;
-   mIsContainer = false;
 }
 
 GuiTextEditSliderCtrl::~GuiTextEditSliderCtrl()

+ 0 - 1
engine/source/gui/guiTreeViewCtrl.cc

@@ -33,7 +33,6 @@ IMPLEMENT_CONOBJECT(GuiTreeViewCtrl);
 GuiTreeViewCtrl::GuiTreeViewCtrl()
 {
 	mActive = true;
-	mIsContainer = false;
 	mIndentSize = 10;
 	mMultipleSelections = true;
 	mTouchPoint = Point2I::Zero;

+ 2 - 2
engine/source/sim/simObject.cc

@@ -1095,8 +1095,8 @@ void SimObject::initPersistFields()
 
    addGroup("Editing");
 
-   addProtectedField("hidden", TypeBool, NULL, &_setHidden, &_getHidden, &_writeHidden, "Whether the object is visible.");
-   addProtectedField("locked", TypeBool, NULL, &_setLocked, &_getLocked, &_writeLocked, "Whether the object can be edited.");
+   addProtectedField("hidden", TypeBool, NULL, &_setHidden, &_getHidden, &_writeHidden, "Temporarily hides the object in the editor.");
+   addProtectedField("locked", TypeBool, NULL, &_setLocked, &_getLocked, &_writeLocked, "Locks the object in the editor to prevent accidental changes.");
 
    endGroup("Editing");
 }