Procházet zdrojové kódy

_markContentsAsDirty -> _markLayoutAsDirty

Marko Pintera před 10 roky
rodič
revize
7daafa85e2

+ 2 - 2
BansheeEditor/Source/BsGUIColor.cpp

@@ -49,14 +49,14 @@ namespace BansheeEngine
 	{
 		mColor = color;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIColor::setTint(const Color& color)
 	{
 		mTint = color;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	UINT32 GUIColor::_getNumRenderElements() const

+ 2 - 2
BansheeEditor/Source/BsGUIComponentFoldout.cpp

@@ -57,7 +57,7 @@ namespace BansheeEngine
 			else
 				mToggle->toggleOff();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			if(!onStateChanged.empty())
 				onStateChanged(mIsExpanded);
@@ -78,7 +78,7 @@ namespace BansheeEngine
 	{
 		mIsExpanded = value;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 
 		onStateChanged(value);
 	}

+ 2 - 2
BansheeEditor/Source/BsGUIFoldout.cpp

@@ -59,7 +59,7 @@ namespace BansheeEngine
 			else
 				mToggle->toggleOff();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			if (!onStateChanged.empty())
 				onStateChanged(mIsExpanded);
@@ -81,7 +81,7 @@ namespace BansheeEngine
 	{
 		mIsExpanded = value;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 
 		onStateChanged(value);
 	}

+ 5 - 5
BansheeEditor/Source/BsGUIResourceTreeView.cpp

@@ -256,7 +256,7 @@ namespace BansheeEngine
 		assert(libEntry != nullptr);
 		updateFromProjectLibraryEntry(newElement, libEntry);
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIResourceTreeView::entryRemoved(const Path& path)
@@ -303,7 +303,7 @@ namespace BansheeEngine
 		mDragPosition = Vector2I(x, y);
 		mDragInProgress = true;
 		mDropTargetDragActive = true;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 
 		if(mBottomScrollBounds.contains(mDragPosition))
 		{
@@ -323,7 +323,7 @@ namespace BansheeEngine
 	{
 		mDragInProgress = false;
 		mDropTargetDragActive = false;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIResourceTreeView::dropTargetDragDropped(INT32 x, INT32 y)
@@ -357,7 +357,7 @@ namespace BansheeEngine
 
 		mDragInProgress = false;
 		mDropTargetDragActive = false;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	Path GUIResourceTreeView::findUniquePath(const Path& path)
@@ -436,7 +436,7 @@ namespace BansheeEngine
 	void GUIResourceTreeView::dragAndDropFinalize()
 	{
 		mDragInProgress = false;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 
 		DraggedResources* draggedResources = reinterpret_cast<DraggedResources*>(DragAndDropManager::instance().getDragData());
 		bs_delete(draggedResources);

+ 1 - 1
BansheeEditor/Source/BsGUISceneTreeView.cpp

@@ -317,7 +317,7 @@ namespace BansheeEngine
 	void GUISceneTreeView::dragAndDropFinalize()
 	{
 		mDragInProgress = false;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 
 		if (DragAndDropManager::instance().getDragTypeId() == (UINT32)DragAndDropType::SceneObject)
 		{

+ 3 - 3
BansheeEditor/Source/BsGUITabbedTitleBar.cpp

@@ -468,12 +468,12 @@ namespace BansheeEngine
 					}
 				}
 
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 			}
 			else
 			{
 				endDrag();
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 
 				if(!onTabDraggedOff.empty())
 					onTabDraggedOff(tabIdx);
@@ -488,7 +488,7 @@ namespace BansheeEngine
 		if(mActiveTabIdx != tabIdx)
 			tabToggled(tabIdx, true);
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	INT32 GUITabbedTitleBar::uniqueIdxToSeqIdx(UINT32 uniqueIdx) const

+ 7 - 7
BansheeEditor/Source/BsGUITreeView.cpp

@@ -280,7 +280,7 @@ namespace BansheeEngine
 					selectElement(treeElement);
 				}
 
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 
 				return true;
 			}
@@ -319,7 +319,7 @@ namespace BansheeEngine
 					mDragPosition = event.getPosition();
 					mDragInProgress = true;
 					mScrollState = ScrollState::None;
-					_markContentAsDirty();
+					_markLayoutAsDirty();
 				}
 			}
 		}
@@ -329,7 +329,7 @@ namespace BansheeEngine
 			{
 				mDragPosition = event.getPosition();
 				mDragInProgress = true;
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 
 				if(mBottomScrollBounds.contains(mDragPosition))
 				{
@@ -371,7 +371,7 @@ namespace BansheeEngine
 		else if(event.getType() == GUIMouseEventType::MouseOut)
 		{
 			mDragInProgress = false;
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 		}
 
 		return false;
@@ -522,7 +522,7 @@ namespace BansheeEngine
 			GUIElement::destroy(iterFind->background);
 
 			mSelectedElements.erase(iterFind);
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			selectionChanged();
 		}
@@ -541,7 +541,7 @@ namespace BansheeEngine
 		mSelectedElements.clear();
 		mIsElementSelected = false;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 
 		selectionChanged();
 	}
@@ -691,7 +691,7 @@ namespace BansheeEngine
 				unselectElement(element);
 		}
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUITreeView::elementToggled(TreeElement* element, bool toggled)

+ 1 - 1
BansheeEditor/Source/BsGUIWindowFrame.cpp

@@ -44,6 +44,6 @@ namespace BansheeEngine
 		else
 			mActiveTexture = _getStyle()->normal.texture;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 }

+ 1 - 1
BansheeEngine/Include/BsGUIElementBase.h

@@ -298,7 +298,7 @@ namespace BansheeEngine
 		 *
 		 * @note	Internal method.
 		 */
-		void _markContentAsDirty();
+		void _markLayoutAsDirty();
 
 		/**
 		 * @brief	Mark only the elements that operate directly on the sprite mesh without requiring the mesh

+ 1 - 1
BansheeEngine/Include/BsGUISpace.h

@@ -26,7 +26,7 @@ namespace BansheeEngine
 		/**
 		 * @brief	Changes the size of the space to the specified value, in pixels.
 		 */
-		void setSize(UINT32 size) { mSize = size; _markContentAsDirty(); }
+		void setSize(UINT32 size) { mSize = size; _markLayoutAsDirty(); }
 
 		/**
 		 * @copydoc	GUIElementBase::_getType

+ 6 - 0
BansheeEngine/Include/BsGUIWidget.h

@@ -105,6 +105,12 @@ namespace BansheeEngine
 		 */
 		void _markMeshDirty(GUIElementBase* elem);
 
+		/**
+		 * @brief	Marks the elements content as dirty, meaning its internal mesh will need to be
+		 *			rebuilt (this implies the entire widget mesh will be rebuilt as well).
+		 */
+		void _markContentDirty(GUIElementBase* elem);
+
 		/**
 		 * @brief	Updates the layout of all child elements, repositioning and resizing them as needed.
 		 */

+ 5 - 5
BansheeEngine/Source/BsGUIButtonBase.cpp

@@ -21,7 +21,7 @@ namespace BansheeEngine
 		if(SpriteTexture::checkIsLoaded(contentTex))
 			mContentImageSprite = bs_new<ImageSprite>();
 
-		mLocStringUpdatedConn = mContent.getText().addOnStringModifiedCallback(std::bind(&GUIButtonBase::_markContentAsDirty, this));
+		mLocStringUpdatedConn = mContent.getText().addOnStringModifiedCallback(std::bind(&GUIButtonBase::_markLayoutAsDirty, this));
 	}
 
 	GUIButtonBase::~GUIButtonBase()
@@ -38,7 +38,7 @@ namespace BansheeEngine
 	void GUIButtonBase::setContent(const GUIContent& content)
 	{
 		mLocStringUpdatedConn.disconnect();
-		mLocStringUpdatedConn = content.getText().addOnStringModifiedCallback(std::bind(&GUIButtonBase::_markContentAsDirty, this));
+		mLocStringUpdatedConn = content.getText().addOnStringModifiedCallback(std::bind(&GUIButtonBase::_markLayoutAsDirty, this));
 
 		mContent = content;
 
@@ -57,14 +57,14 @@ namespace BansheeEngine
 			}
 		}
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIButtonBase::setTint(const Color& color)
 	{
 		mColor = color;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIButtonBase::_setOn(bool on) 
@@ -370,7 +370,7 @@ namespace BansheeEngine
 	{
 		mActiveState = state;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	const HSpriteTexture& GUIButtonBase::getActiveTexture() const

+ 1 - 1
BansheeEngine/Source/BsGUIDropDownContent.cpp

@@ -133,7 +133,7 @@ namespace BansheeEngine
 			curVisIdx++;
 		}
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	UINT32 GUIDropDownContent::getElementHeight(UINT32 idx) const

+ 3 - 3
BansheeEngine/Source/BsGUIDropDownMenu.cpp

@@ -88,7 +88,7 @@ namespace BansheeEngine
 		hitboxLayoutData.setPanelDepth(std::numeric_limits<INT16>::min());
 		mFrontHitBox->_setLayoutData(hitboxLayoutData);
 		mFrontHitBox->_changeParentWidget(this);
-		mFrontHitBox->_markContentAsDirty();
+		mFrontHitBox->_markLayoutAsDirty();
 
 		mBackHitBox = GUIDropDownHitBox::create(false, true);
 		GUILayoutData backHitboxLayoutData = mBackHitBox->_getLayoutData();
@@ -96,7 +96,7 @@ namespace BansheeEngine
 		backHitboxLayoutData.setPanelDepth(std::numeric_limits<INT16>::max());
 		mBackHitBox->_setLayoutData(backHitboxLayoutData);
 		mBackHitBox->_changeParentWidget(this);
-		mBackHitBox->_markContentAsDirty();
+		mBackHitBox->_markLayoutAsDirty();
 
 		Rect2I targetBounds(0, 0, desc.target->getWidth(), desc.target->getHeight());
 		Vector<Rect2I> captureBounds;
@@ -109,7 +109,7 @@ namespace BansheeEngine
 		captureHitboxLayoutData.setPanelDepth(std::numeric_limits<INT16>::max());
 		mCaptureHitBox->_setLayoutData(captureHitboxLayoutData);
 		mCaptureHitBox->_changeParentWidget(this);
-		mCaptureHitBox->_markContentAsDirty();
+		mCaptureHitBox->_markLayoutAsDirty();
 
 		mAdditionalCaptureBounds = desc.additionalBounds;
 

+ 2 - 2
BansheeEngine/Source/BsGUIElement.cpp

@@ -122,7 +122,7 @@ namespace BansheeEngine
 		mDimensions = GUIDimensions::create();
 		mDimensions.updateWithStyle(mStyle);
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	Rect2I GUIElement::getCachedVisibleBounds() const
@@ -188,7 +188,7 @@ namespace BansheeEngine
 			mDimensions.updateWithStyle(mStyle);
 			styleUpdated();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 		}
 	}
 

+ 10 - 10
BansheeEngine/Source/BsGUIElementBase.cpp

@@ -75,7 +75,7 @@ namespace BansheeEngine
 		if (isFixedBefore != isFixedAfter)
 			refreshChildUpdateParents();
 			
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIElementBase::setFlexibleWidth(UINT32 minWidth, UINT32 maxWidth)
@@ -95,7 +95,7 @@ namespace BansheeEngine
 		if (isFixedBefore != isFixedAfter)
 			refreshChildUpdateParents();
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIElementBase::setHeight(UINT32 height)
@@ -110,7 +110,7 @@ namespace BansheeEngine
 		if (isFixedBefore != isFixedAfter)
 			refreshChildUpdateParents();
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIElementBase::setFlexibleHeight(UINT32 minHeight, UINT32 maxHeight)
@@ -130,7 +130,7 @@ namespace BansheeEngine
 		if (isFixedBefore != isFixedAfter)
 			refreshChildUpdateParents();
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIElementBase::resetDimensions()
@@ -144,7 +144,7 @@ namespace BansheeEngine
 		if (isFixedBefore != isFixedAfter)
 			refreshChildUpdateParents();
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	Rect2I GUIElementBase::getBounds(GUIPanel* relativeTo)
@@ -184,7 +184,7 @@ namespace BansheeEngine
 		mIsDirty = false;
 	}
 
-	void GUIElementBase::_markContentAsDirty() 
+	void GUIElementBase::_markLayoutAsDirty() 
 	{ 
 		if(_isDisabled())
 			return;
@@ -211,7 +211,7 @@ namespace BansheeEngine
 
 		// Make sure to mark everything as dirty, as we didn't track any dirty flags while the element was disabled
 		mIsDisabled = false;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 
 		for(auto& elem : mChildren)
 		{
@@ -305,7 +305,7 @@ namespace BansheeEngine
 		if (mIsDisabled)
 			element->disableRecursively();
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIElementBase::_unregisterChildElement(GUIElementBase* element)
@@ -321,7 +321,7 @@ namespace BansheeEngine
 				element->_setParent(nullptr);
 				foundElem = true;
 
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 				break;
 			}
 		}
@@ -350,7 +350,7 @@ namespace BansheeEngine
 			child->_changeParentWidget(widget);
 		}
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIElementBase::_updateAUParents()

+ 32 - 32
BansheeEngine/Source/BsGUIInputBox.cpp

@@ -91,7 +91,7 @@ namespace BansheeEngine
 
 			scrollTextToCaret();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 		}
 	}
 
@@ -99,7 +99,7 @@ namespace BansheeEngine
 	{
 		mColor = color;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	UINT32 GUIInputBox::_getNumRenderElements() const
@@ -402,7 +402,7 @@ namespace BansheeEngine
 			if(!mHasFocus)
 			{
 				mState = State::Hover;
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 			}
 
 			mIsMouseOver = true;
@@ -414,7 +414,7 @@ namespace BansheeEngine
 			if(!mHasFocus)
 			{
 				mState = State::Normal;
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 			}
 
 			mIsMouseOver = false;
@@ -426,7 +426,7 @@ namespace BansheeEngine
 			showSelection(0);
 			gGUIManager().getInputSelectionTool()->selectAll();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 		else if(ev.getType() == GUIMouseEventType::MouseDown && ev.getButton() == GUIMouseButton::Left)
@@ -455,7 +455,7 @@ namespace BansheeEngine
 				scrollTextToCaret();
 			}
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			return true;
 		}
@@ -496,7 +496,7 @@ namespace BansheeEngine
 
 				scrollTextToCaret();
 
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 				return true;
 			}
 		}
@@ -527,7 +527,7 @@ namespace BansheeEngine
 			gGUIManager().getInputCaretTool()->moveCaretToChar(charIdx, CARET_AFTER);
 			scrollTextToCaret();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			if(!onValueChanged.empty())
 				onValueChanged(mText);
@@ -542,7 +542,7 @@ namespace BansheeEngine
 
 		if(ev.getType() == GUICommandEventType::Redraw)
 		{
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -552,7 +552,7 @@ namespace BansheeEngine
 
 			showSelection(0);
 			gGUIManager().getInputSelectionTool()->selectAll();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			mHasFocus = true;
 
@@ -568,7 +568,7 @@ namespace BansheeEngine
 
 			hideCaret();
 			clearSelection();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			mHasFocus = false;
 
@@ -618,7 +618,7 @@ namespace BansheeEngine
 					}
 				}
 
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 			}
 
 			return true;
@@ -663,7 +663,7 @@ namespace BansheeEngine
 					}
 				}
 
-				_markContentAsDirty();
+				_markLayoutAsDirty();
 			}
 
 			return true;
@@ -688,7 +688,7 @@ namespace BansheeEngine
 				gGUIManager().getInputCaretTool()->moveCaretLeft();
 
 			scrollTextToCaret();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -701,7 +701,7 @@ namespace BansheeEngine
 			gGUIManager().getInputSelectionTool()->moveSelectionToCaret(gGUIManager().getInputCaretTool()->getCaretPos());
 
 			scrollTextToCaret();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -724,7 +724,7 @@ namespace BansheeEngine
 				gGUIManager().getInputCaretTool()->moveCaretRight();
 
 			scrollTextToCaret();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -737,7 +737,7 @@ namespace BansheeEngine
 			gGUIManager().getInputSelectionTool()->moveSelectionToCaret(gGUIManager().getInputCaretTool()->getCaretPos());
 
 			scrollTextToCaret();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -752,7 +752,7 @@ namespace BansheeEngine
 			gGUIManager().getInputCaretTool()->moveCaretUp();
 
 			scrollTextToCaret();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -765,7 +765,7 @@ namespace BansheeEngine
 			gGUIManager().getInputSelectionTool()->moveSelectionToCaret(gGUIManager().getInputCaretTool()->getCaretPos());
 
 			scrollTextToCaret();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -780,7 +780,7 @@ namespace BansheeEngine
 			gGUIManager().getInputCaretTool()->moveCaretDown();
 
 			scrollTextToCaret();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -793,7 +793,7 @@ namespace BansheeEngine
 			gGUIManager().getInputSelectionTool()->moveSelectionToCaret(gGUIManager().getInputCaretTool()->getCaretPos());
 
 			scrollTextToCaret();
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -822,7 +822,7 @@ namespace BansheeEngine
 					gGUIManager().getInputCaretTool()->moveCaretRight();
 					scrollTextToCaret();
 
-					_markContentAsDirty();
+					_markLayoutAsDirty();
 
 					if(!onValueChanged.empty())
 						onValueChanged(mText);
@@ -842,7 +842,7 @@ namespace BansheeEngine
 		{
 			cutText();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 		else if(ev.getButton() == mCopyVB)
@@ -855,7 +855,7 @@ namespace BansheeEngine
 		{
 			pasteText();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 		else if(ev.getButton() == mSelectAllVB)
@@ -863,7 +863,7 @@ namespace BansheeEngine
 			showSelection(0);
 			gGUIManager().getInputSelectionTool()->selectAll();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -877,14 +877,14 @@ namespace BansheeEngine
 		TEXT_SPRITE_DESC textDesc = getTextDesc();
 		Vector2I offset = getTextOffset();
 		gGUIManager().getInputCaretTool()->updateText(this, textDesc);
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 
 	void GUIInputBox::hideCaret()
 	{
 		mCaretShown = false;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIInputBox::showSelection(UINT32 anchorCaretPos)
@@ -895,14 +895,14 @@ namespace BansheeEngine
 
 		gGUIManager().getInputSelectionTool()->showSelection(anchorCaretPos);
 		mSelectionShown = true;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIInputBox::clearSelection()
 	{
 		gGUIManager().getInputSelectionTool()->clearSelection();
 		mSelectionShown = false;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIInputBox::scrollTextToCaret()
@@ -947,7 +947,7 @@ namespace BansheeEngine
 		gGUIManager().getInputCaretTool()->updateText(this, textDesc);
 		gGUIManager().getInputSelectionTool()->updateText(this, textDesc);
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIInputBox::clampScrollToBounds(Rect2I unclippedTextBounds)
@@ -967,7 +967,7 @@ namespace BansheeEngine
 			gGUIManager().getInputCaretTool()->updateText(this, textDesc);
 			gGUIManager().getInputSelectionTool()->updateText(this, textDesc);
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 		}
 	}
 
@@ -1174,7 +1174,7 @@ namespace BansheeEngine
 
 			scrollTextToCaret();
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			if(!onValueChanged.empty())
 				onValueChanged(mText);

+ 4 - 4
BansheeEngine/Source/BsGUILabel.cpp

@@ -14,7 +14,7 @@ namespace BansheeEngine
 	{
 		mTextSprite = bs_new<TextSprite, PoolAlloc>();
 
-		mLocStringUpdatedConn = mContent.getText().addOnStringModifiedCallback(std::bind(&GUILabel::_markContentAsDirty, this));
+		mLocStringUpdatedConn = mContent.getText().addOnStringModifiedCallback(std::bind(&GUILabel::_markLayoutAsDirty, this));
 	}
 
 	GUILabel::~GUILabel()
@@ -78,18 +78,18 @@ namespace BansheeEngine
 	void GUILabel::setContent(const GUIContent& content)
 	{
 		mLocStringUpdatedConn.disconnect();
-		mLocStringUpdatedConn = content.getText().addOnStringModifiedCallback(std::bind(&GUILabel::_markContentAsDirty, this));
+		mLocStringUpdatedConn = content.getText().addOnStringModifiedCallback(std::bind(&GUILabel::_markLayoutAsDirty, this));
 
 		mContent = content;
 		
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUILabel::setTint(const Color& color)
 	{
 		mColor = color;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	GUILabel* GUILabel::create(const HString& text, const String& styleName)

+ 2 - 2
BansheeEngine/Source/BsGUILayout.cpp

@@ -51,7 +51,7 @@ namespace BansheeEngine
 		if (mIsDisabled)
 			element->disableRecursively();
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUILayout::removeElementAt(UINT32 idx)
@@ -64,7 +64,7 @@ namespace BansheeEngine
 
 		child->_setParent(nullptr);
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	const RectOffset& GUILayout::_getPadding() const

+ 1 - 1
BansheeEngine/Source/BsGUIPanel.cpp

@@ -17,7 +17,7 @@ namespace BansheeEngine
 		mDepthRangeMin = depthRangeMin;
 		mDepthRangeMax = depthRangeMax;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	LayoutSizeRange GUIPanel::_calculateLayoutSizeRange() const

+ 1 - 1
BansheeEngine/Source/BsGUIProgressBar.cpp

@@ -73,7 +73,7 @@ namespace BansheeEngine
 	void GUIProgressBar::setPercent(float pct)
 	{
 		mPercent = pct;
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIProgressBar::setTint(const Color& color)

+ 1 - 1
BansheeEngine/Source/BsGUIRenderTexture.cpp

@@ -59,7 +59,7 @@ namespace BansheeEngine
 			setTexture(SpriteTexture::create(HTexture()));
 		}
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIRenderTexture::updateRenderElementsInternal()

+ 2 - 2
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -350,7 +350,7 @@ namespace BansheeEngine
 		UINT32 scrollableHeight = (UINT32)std::max(0, INT32(mContentSize.y) - INT32(mVisibleSize.y));
 		mVertOffset = scrollableHeight * Math::clamp01(pct);
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUIScrollArea::scrollToHorizontal(float pct)
@@ -358,7 +358,7 @@ namespace BansheeEngine
 		UINT32 scrollableWidth = (UINT32)std::max(0, INT32(mContentSize.x) - INT32(mVisibleSize.x));
 		mHorzOffset = scrollableWidth * Math::clamp01(pct);
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	float GUIScrollArea::getVerticalScroll() const

+ 2 - 2
BansheeEngine/Source/BsGUIScrollBar.cpp

@@ -161,7 +161,7 @@ namespace BansheeEngine
 		float newHandlePos = Math::clamp01(mHandleBtn->getHandlePos() - amount);
 
 		mHandleBtn->_setHandlePos(newHandlePos);
-		mHandleBtn->_markContentAsDirty();
+		mHandleBtn->_markLayoutAsDirty();
 
 		if(!onScrollPositionChanged.empty())
 			onScrollPositionChanged(newHandlePos);
@@ -196,6 +196,6 @@ namespace BansheeEngine
 	{
 		mColor = color;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 }

+ 1 - 1
BansheeEngine/Source/BsGUISlider.cpp

@@ -67,7 +67,7 @@ namespace BansheeEngine
 	void GUISlider::setPercent(float pct)
 	{
 		mSliderHandle->_setHandlePos(pct);
-		mSliderHandle->_markContentAsDirty();
+		mSliderHandle->_markLayoutAsDirty();
 	}
 
 	float GUISlider::getPercent() const

+ 8 - 8
BansheeEngine/Source/BsGUISliderHandle.cpp

@@ -65,7 +65,7 @@ namespace BansheeEngine
 	{
 		mColor = color;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	UINT32 GUISliderHandle::_getNumRenderElements() const
@@ -160,7 +160,7 @@ namespace BansheeEngine
 					mMouseOverHandle = false;
 
 					mState = State::Normal;
-					_markContentAsDirty();
+					_markLayoutAsDirty();
 
 					return true;
 				}
@@ -172,7 +172,7 @@ namespace BansheeEngine
 					mMouseOverHandle = true;
 
 					mState = State::Hover;
-					_markContentAsDirty();
+					_markLayoutAsDirty();
 
 					return true;
 				}
@@ -182,7 +182,7 @@ namespace BansheeEngine
 		if(ev.getType() == GUIMouseEventType::MouseDown && (mMouseOverHandle || mJumpOnClick))
 		{
 			mState = State::Active;
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			if (mJumpOnClick)
 			{
@@ -229,7 +229,7 @@ namespace BansheeEngine
 
 			onHandleMoved(mPctHandlePos);
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -237,7 +237,7 @@ namespace BansheeEngine
 		{
 			mState = State::Normal;
 			mMouseOverHandle = false;
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 
 			return true;
 		}
@@ -283,7 +283,7 @@ namespace BansheeEngine
 
 			onHandleMoved(mPctHandlePos);
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 
@@ -296,7 +296,7 @@ namespace BansheeEngine
 			else
 				mState = State::Normal;
 
-			_markContentAsDirty();
+			_markLayoutAsDirty();
 			return true;
 		}
 		

+ 2 - 2
BansheeEngine/Source/BsGUITexture.cpp

@@ -107,7 +107,7 @@ namespace BansheeEngine
 	{
 		mColor = color;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	void GUITexture::setTexture(const HSpriteTexture& texture)
@@ -115,7 +115,7 @@ namespace BansheeEngine
 		mActiveTexture = texture;
 		mUsingStyleTexture = false;
 
-		_markContentAsDirty();
+		_markLayoutAsDirty();
 	}
 
 	UINT32 GUITexture::_getNumRenderElements() const

+ 7 - 1
BansheeEngine/Source/BsGUIWidget.cpp

@@ -256,6 +256,12 @@ namespace BansheeEngine
 		mWidgetIsDirty = true;
 	}
 
+	void GUIWidget::_markContentDirty(GUIElementBase* elem)
+	{
+		if (elem->_getType() == GUIElementBase::Type::Element)
+			mDirtyContents.insert(static_cast<GUIElement*>(elem));
+	}
+
 	void GUIWidget::setSkin(const HGUISkin& skin)
 	{
 		mSkin = skin;
@@ -338,7 +344,7 @@ namespace BansheeEngine
 		mPanel->setHeight(height);
 
 		mPanel->_setLayoutData(layoutData);
-		mPanel->_markContentAsDirty();
+		mPanel->_markLayoutAsDirty();
 	}
 
 	void GUIWidget::ownerWindowFocusChanged()

+ 10 - 34
TODO.txt

@@ -59,40 +59,6 @@ Polish stage 1
 
 UpdateMeshes is taking a long time to rebuild, try to optimize it
 
-Moving the mouse over inspector seems to queue a rebuild for the entire GUIWidget (meaning the whole main window)
- - It seems the parent GUIPanel is marked as dirty
- - Ensure that dirty changes don't propagate outside of EditorWidget
- - Modify GUIElementBase::findUpdateParent
-	GUIElementBase* GUIElementBase::findUpdateParent()
-	{
-		GUIElementBase* currentElement = mParentElement;
-		while (currentElement != nullptr)
-		{
-			const GUIDimensions& parentDimensions = currentElement->_getDimensions();
-			bool boundsDependOnChildren = !parentDimensions.fixedHeight() || !parentDimensions.fixedWidth();
-
-			if (!boundsDependOnChildren)
-			{
-				// If parent is a panel then we can do an optimization and only update
-				// one child instead of all of them, so change parent to that child.
-				if (currentElement->_getType() == GUIElementBase::Type::Panel)
-				{
-					GUIElementBase* optimizedUpdateParent = this;
-					while (optimizedUpdateParent->_getParent() != currentElement)
-						optimizedUpdateParent = optimizedUpdateParent->_getParent();
-
-					currentElement = optimizedUpdateParent;
-				}
-
-				return currentElement;
-			}
-
-			currentElement = currentElement->mParentElement;
-		}
-
-		return nullptr;
-	}
-
 Avoid fully recalculating layout for common operations like changing button states/toggles, and modifying input boxes.
  - Layout should be fully recalculated only if:
    - optimal size changes
@@ -102,8 +68,18 @@ Avoid fully recalculating layout for common operations like changing button stat
    - disabled state changes
    - when initially created
  - I should probably just handle this on a case by case basis (e.g. if changing the active button texture is the same size as previous one don't call contentDirty)
+  - when button state changes, when input box contents change (by user or code), when text field data changes
  - ADDITIONALLY consider marking the mesh not dirty after layout update if size didn't change
 
+GUILabel
+ - don't mark as dirty when contents change unless it affects optimal size
+GUIInputBox
+ - don't mark as dirty when state changes unless it affects optimal size
+ - don't mark as dirty when contents change unless it affects optimal size
+GUIButtonBase (toggle + normal button)
+ - don't mark as dirty when state changes unless it affects optimal size
+ - don't mark as dirty when contents change unless it affects optimal size
+
 Get rid of all the profiling calls
 
 Test inspector selection, selecting a resource and adding/removing component updates