Browse Source

Better way of calculating GUI clip rectangle

Marko Pintera 10 years ago
parent
commit
005da72c82

+ 0 - 6
BansheeEditor/Source/BsDockManager.cpp

@@ -111,10 +111,7 @@ namespace BansheeEngine
 				layoutData.area = mArea;
 				layoutData.area.y += sizeTop;
 				layoutData.area.height = SLIDER_SIZE;
-
 				layoutData.clipRect = clipRect;
-				layoutData.clipRect.x -= mArea.x;
-				layoutData.clipRect.y -= mArea.y;
 
 				mSlider->_setLayoutData(layoutData);
 				mSlider->_markContentAsDirty();
@@ -132,10 +129,7 @@ namespace BansheeEngine
 				layoutData.area = mArea;
 				layoutData.area.x += sizeLeft;
 				layoutData.area.width = SLIDER_SIZE;
-
 				layoutData.clipRect = clipRect;
-				layoutData.clipRect.x -= mArea.x;
-				layoutData.clipRect.y -= mArea.y;
 
 				mSlider->_setLayoutData(layoutData);
 				mSlider->_markContentAsDirty();

+ 1 - 4
BansheeEditor/Source/BsGUIColor.cpp

@@ -114,13 +114,10 @@ namespace BansheeEngine
 
 	void GUIColor::updateClippedBounds()
 	{
-		mClippedBounds = Rect2I(0, 0, mLayoutData.area.width, mLayoutData.area.height);
+		mClippedBounds = mLayoutData.area;
 
 		if (mLayoutData.clipRect.width > 0 && mLayoutData.clipRect.height > 0)
 			mClippedBounds.clip(mLayoutData.clipRect);
-
-		mClippedBounds.x += mLayoutData.area.x;
-		mClippedBounds.y += mLayoutData.area.y;
 	}
 
 	Vector2I GUIColor::_getOptimalSize() const

+ 0 - 3
BansheeEditor/Source/BsGUIComponentFoldout.cpp

@@ -95,9 +95,6 @@ namespace BansheeEngine
 			childData.area.y += yOffset;
 			childData.area.height = optimalSize.y;
 
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
-
 			mToggle->_setLayoutData(childData);
 
 			toggleOffset = optimalSize.x;

+ 2 - 9
BansheeEditor/Source/BsGUIFieldBase.cpp

@@ -25,15 +25,8 @@ namespace BansheeEngine
 
 	void GUIFieldBase::_updateLayoutInternal(const GUILayoutData& data)
 	{
-		GUILayoutData childData = data;
-		childData.clipRect.x -= data.area.x;
-		childData.clipRect.y -= data.area.y;
-
-		mLayout->_setLayoutData(childData);
-
-		childData.clipRect = data.clipRect;
-
-		mLayout->_updateLayoutInternal(childData);
+		mLayout->_setLayoutData(data);
+		mLayout->_updateLayoutInternal(data);
 	}
 
 	Vector2I GUIFieldBase::_getOptimalSize() const

+ 0 - 6
BansheeEditor/Source/BsGUIFoldout.cpp

@@ -99,9 +99,6 @@ namespace BansheeEngine
 			childData.area.width = optimalSize.x;
 			childData.area.height = optimalSize.y;
 
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
-
 			mToggle->_setLayoutData(childData);
 
 			toggleOffset = optimalSize.x;
@@ -117,9 +114,6 @@ namespace BansheeEngine
 			childData.area.width = optimalSize.x;
 			childData.area.height = optimalSize.y;
 
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
-
 			mLabel->_setLayoutData(childData);
 		}
 	}

+ 0 - 8
BansheeEditor/Source/BsGUITabbedTitleBar.cpp

@@ -250,8 +250,6 @@ namespace BansheeEngine
 			childData.area.y += 1;
 			childData.area.width -= 2;
 			childData.area.height = optimalSize.y;
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
 
 			mBackgroundImage->_setLayoutData(childData);
 		}
@@ -284,8 +282,6 @@ namespace BansheeEngine
 			childData.area.width = optimalSize.x;
 			childData.area.height = optimalSize.y;
 			childData.clipRect = tabClipRect;
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
 
 			btn->_setLayoutData(childData);
 
@@ -303,8 +299,6 @@ namespace BansheeEngine
 			childData.area.y = offset.y;
 			childData.area.width = minBtnOptimalSize.x;
 			childData.area.height = minBtnOptimalSize.y;
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
 
 			mMinBtn->_setLayoutData(childData);
 		}
@@ -320,8 +314,6 @@ namespace BansheeEngine
 			childData.area.y = offset.y;
 			childData.area.width = closeBtnOptimalSize.x;
 			childData.area.height = closeBtnOptimalSize.y;
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
 
 			mCloseBtn->_setLayoutData(childData);
 		}

+ 2 - 9
BansheeEditor/Source/BsGUITextField.cpp

@@ -165,15 +165,8 @@ namespace BansheeEngine
 
 	void GUITextField::_updateLayoutInternal(const GUILayoutData& data)
 	{
-		GUILayoutData childData = data;
-		childData.clipRect.x -= data.area.x;
-		childData.clipRect.y -= data.area.y;
-
-		mLayout->_setLayoutData(childData);
-
-		childData.clipRect = data.clipRect;
-
-		mLayout->_updateLayoutInternal(childData);
+		mLayout->_setLayoutData(data);
+		mLayout->_updateLayoutInternal(data);
 	}
 
 	Vector2I GUITextField::_getOptimalSize() const

+ 1 - 18
BansheeEditor/Source/BsGUITreeView.cpp

@@ -821,12 +821,7 @@ namespace BansheeEngine
 	void GUITreeView::updateClippedBounds()
 	{
 		mClippedBounds = mLayoutData.area;
-
-		Rect2I localClipRect = mLayoutData.clipRect;
-		localClipRect.x += mLayoutData.area.x;
-		localClipRect.y += mLayoutData.area.y;
-
-		mClippedBounds.clip(localClipRect);
+		mClippedBounds.clip(mLayoutData.clipRect);
 	}
 
 	void GUITreeView::_updateLayoutInternal(const GUILayoutData& data)
@@ -878,8 +873,6 @@ namespace BansheeEngine
 				childData.area.y = offset.y;
 				childData.area.width = elementSize.x;
 				childData.area.height = elementSize.y;
-				childData.clipRect.x -= offset.x;
-				childData.clipRect.y -= offset.y;
 
 				current->mElement->_setLayoutData(childData);
 
@@ -907,8 +900,6 @@ namespace BansheeEngine
 				childData.area.y = myOffset.y;
 				childData.area.width = elementSize.x;
 				childData.area.height = elementSize.y;
-				childData.clipRect.x -= myOffset.x;
-				childData.clipRect.y -= myOffset.y;
 
 				current->mFoldoutBtn->_setLayoutData(childData);
 			}
@@ -944,8 +935,6 @@ namespace BansheeEngine
 			GUILayoutData childData = data;
 			childData.area.y = targetElement->_getLayoutData().area.y;
 			childData.area.height = targetElement->_getLayoutData().area.height;
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
 
 			selectedElem.background->_setLayoutData(childData);
 		}
@@ -959,8 +948,6 @@ namespace BansheeEngine
 			GUILayoutData childData = data;
 			childData.area = targetElement->_getLayoutData().area;
 			childData.area.width = remainingWidth;
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
 
 			mNameEditBox->_setLayoutData(childData);
 		}
@@ -989,8 +976,6 @@ namespace BansheeEngine
 
 					GUILayoutData childData = data;
 					childData.area = interactableElement->bounds;
-					childData.clipRect.x -= childData.area.x;
-					childData.clipRect.y -= childData.area.y;
 
 					mDragHighlight->_setLayoutData(childData);
 				}
@@ -1004,8 +989,6 @@ namespace BansheeEngine
 
 					GUILayoutData childData = data;
 					childData.area = interactableElement->bounds;
-					childData.clipRect.x -= childData.area.x;
-					childData.clipRect.y -= childData.area.y;
 
 					mDragSepHighlight->_setLayoutData(childData);
 				}

+ 27 - 0
BansheeEngine/Include/BsGUILayoutData.h

@@ -18,6 +18,9 @@ namespace BansheeEngine
 			setPanelDepth(0);
 		}
 
+		/**
+		 * @brief	Set widget part of element depth. (Most significant part)
+		 */
 		void setWidgetDepth(UINT8 depth)
 		{
 			UINT32 shiftedDepth = depth << 24;
@@ -25,6 +28,10 @@ namespace BansheeEngine
 			depth = shiftedDepth | (depth & 0x00FFFFFF);
 		}
 
+		/**
+		 * @brief	Set panel part of element depth. Less significant than widget
+		 *			depth but more than custom element depth.
+		 */
 		void setPanelDepth(INT16 depth)
 		{
 			UINT32 signedDepth = ((INT32)depth + 32768) << 8;
@@ -32,16 +39,36 @@ namespace BansheeEngine
 			depth = signedDepth | (depth & 0xFF0000FF);;
 		}
 
+
+		/**
+		 * @brief	Retrieve widget part of element depth. (Most significant part)
+		 */
 		UINT8 getWidgetDepth() const
 		{
 			return (depth >> 24) & 0xFF;
 		}
 
+		/**
+		 * @brief	Retrieve panel part of element depth. Less significant than widget
+		 *			depth but more than custom element depth.
+		 */
 		INT16 getPanelDepth() const
 		{
 			return (((INT32)depth >> 8) & 0xFFFF) - 32768;
 		}
 
+		/**
+		 * @brief	Returns a clip rectangle that is relative to the current bounds.
+		 */
+		Rect2I getLocalClipRect() const
+		{
+			Rect2I localClipRect = clipRect;
+			localClipRect.x -= area.x;
+			localClipRect.y -= area.y;
+
+			return localClipRect;
+		}
+
 		Rect2I area;
 		Rect2I clipRect;
 		UINT32 depth;

+ 2 - 6
BansheeEngine/Source/BsGUIButtonBase.cpp

@@ -143,11 +143,7 @@ namespace BansheeEngine
 	void GUIButtonBase::updateClippedBounds()
 	{
 		mClippedBounds = mLayoutData.area;
-
-		Rect2I localClipRect = mLayoutData.clipRect;
-		localClipRect.x += mLayoutData.area.x;
-		localClipRect.y += mLayoutData.area.y;
-		mClippedBounds.clip(localClipRect);
+		mClippedBounds.clip(mLayoutData.clipRect);
 	}
 
 	Vector2I GUIButtonBase::_getOptimalSize() const
@@ -198,7 +194,7 @@ namespace BansheeEngine
 			Vector2I offset(mLayoutData.area.x, mLayoutData.area.y);
 
 			mImageSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, 
-				vertexStride, indexStride, renderElementIdx, offset, mLayoutData.clipRect);
+				vertexStride, indexStride, renderElementIdx, offset, mLayoutData.getLocalClipRect());
 
 			return;
 		}

+ 1 - 9
BansheeEngine/Source/BsGUIDropDownContent.cpp

@@ -327,12 +327,7 @@ namespace BansheeEngine
 	void GUIDropDownContent::updateClippedBounds()
 	{
 		mClippedBounds = mLayoutData.area;
-
-		Rect2I localClipRect = mLayoutData.clipRect;
-		localClipRect.x += mLayoutData.area.x;
-		localClipRect.y += mLayoutData.area.y;
-
-		mClippedBounds.clip(localClipRect);
+		mClippedBounds.clip(mLayoutData.clipRect);
 	}
 
 	void GUIDropDownContent::_updateLayoutInternal(const GUILayoutData& data)
@@ -355,9 +350,6 @@ namespace BansheeEngine
 
 			yOffset += childData.area.height;
 
-			childData.clipRect.x = data.clipRect.x - childData.area.x;
-			childData.clipRect.y = data.clipRect.y - childData.area.y;
-
 			guiMainElement->_setLayoutData(childData);
 
 			// Shortcut label

+ 1 - 1
BansheeEngine/Source/BsGUIElement.cpp

@@ -137,7 +137,7 @@ namespace BansheeEngine
 		// Transform into element space so we can clip it using the element clip rectangle
 		Vector2I offsetDiff = Vector2I(contentBounds.x - mLayoutData.area.x, contentBounds.y - mLayoutData.area.y);
 		Rect2I contentClipRect(offsetDiff.x, offsetDiff.y, contentBounds.width, contentBounds.height);
-		contentClipRect.clip(mLayoutData.clipRect);
+		contentClipRect.clip(mLayoutData.getLocalClipRect());
 
 		// Transform into content sprite space
 		contentClipRect.x -= offsetDiff.x;

+ 2 - 2
BansheeEngine/Source/BsGUIInputBox.cpp

@@ -179,7 +179,7 @@ namespace BansheeEngine
 	void GUIInputBox::updateClippedBounds()
 	{
 		Vector2I offset(mLayoutData.area.x, mLayoutData.area.y);
-		mClippedBounds = mImageSprite->getBounds(offset, mLayoutData.clipRect);
+		mClippedBounds = mImageSprite->getBounds(offset, mLayoutData.getLocalClipRect());
 	}
 
 	Sprite* GUIInputBox::renderElemToSprite(UINT32 renderElemIdx, UINT32& localRenderElemIdx) const
@@ -285,7 +285,7 @@ namespace BansheeEngine
 		newNumElements += mImageSprite->getNumRenderElements();
 
 		if(renderElemIdx < newNumElements)
-			return mLayoutData.clipRect;
+			return mLayoutData.getLocalClipRect();
 
 		if(mCaretShown && gGUIManager().getCaretBlinkState())
 		{

+ 1 - 5
BansheeEngine/Source/BsGUILabel.cpp

@@ -58,11 +58,7 @@ namespace BansheeEngine
 	void GUILabel::updateClippedBounds()
 	{
 		mClippedBounds = mLayoutData.area;
-
-		Rect2I localClipRect = mLayoutData.clipRect;
-		localClipRect.x += mLayoutData.area.x;
-		localClipRect.y += mLayoutData.area.y;
-		mClippedBounds.clip(localClipRect);
+		mClippedBounds.clip(mLayoutData.clipRect);
 	}
 
 	Vector2I GUILabel::_getOptimalSize() const

+ 0 - 3
BansheeEngine/Source/BsGUILayoutX.cpp

@@ -383,9 +383,6 @@ namespace BansheeEngine
 		for(auto& child : mChildren)
 		{
 			childData.area = elementAreas[childIdx];
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
-
 			child->_setLayoutData(childData);
 
 			childData.clipRect = childData.area;

+ 0 - 3
BansheeEngine/Source/BsGUILayoutY.cpp

@@ -381,9 +381,6 @@ namespace BansheeEngine
 		for(auto& child : mChildren)
 		{
 			childData.area = elementAreas[childIdx];
-			childData.clipRect.x -= childData.area.x;
-			childData.clipRect.y -= childData.area.y;
-
 			child->_setLayoutData(childData);
 
 			childData.clipRect = childData.area;

+ 0 - 5
BansheeEngine/Source/BsGUIPanel.cpp

@@ -223,11 +223,6 @@ namespace BansheeEngine
 	void GUIPanel::_updateChildLayout(GUIElementBase* element, const GUILayoutData& data)
 	{
 		GUILayoutData childData = data;
-
-		childData.clipRect = data.clipRect;
-		childData.clipRect.x -= data.area.x;
-		childData.clipRect.y -= data.area.y;
-
 		element->_setLayoutData(childData);
 
 		childData.clipRect = data.area;

+ 1 - 7
BansheeEngine/Source/BsGUIProgressBar.cpp

@@ -46,11 +46,7 @@ namespace BansheeEngine
 
 	void GUIProgressBar::_updateLayoutInternal(const GUILayoutData& data)
 	{
-		GUILayoutData bgLayoutData = data;
-		bgLayoutData.clipRect.x -= data.area.x;
-		bgLayoutData.clipRect.y -= data.area.y;
-
-		mBackground->_setLayoutData(bgLayoutData);
+		mBackground->_setLayoutData(data);
 
 		const GUIElementStyle* style = _getStyle();
 		
@@ -58,8 +54,6 @@ namespace BansheeEngine
 
 		barLayoutData.area.x += style->margins.left;
 		barLayoutData.area.y += style->margins.top;
-		barLayoutData.clipRect.x -= barLayoutData.area.x;
-		barLayoutData.clipRect.y -= barLayoutData.area.y;
 
 		UINT32 maxProgressBarWidth = std::max((UINT32)0, (UINT32)(data.area.width - style->margins.left - style->margins.right));
 		UINT32 progressBarHeight = std::max((UINT32)0, (UINT32)(data.area.height - style->margins.top - style->margins.bottom));

+ 4 - 17
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -44,12 +44,8 @@ namespace BansheeEngine
 
 	void GUIScrollArea::updateClippedBounds()
 	{
-		Rect2I bounds(0, 0, mLayoutData.area.width, mLayoutData.area.height);
-		bounds.clip(mLayoutData.clipRect);
-		bounds.x += mLayoutData.area.x;
-		bounds.y += mLayoutData.area.y;
-
-		mClippedBounds = bounds;
+		mClippedBounds = mLayoutData.area;
+		mClippedBounds.clip(mLayoutData.clipRect);
 	}
 
 	void GUIScrollArea::_getElementAreas(const Rect2I& layoutArea, Rect2I* elementAreas, UINT32 numElements,
@@ -229,13 +225,8 @@ namespace BansheeEngine
 		GUILayoutData layoutData = data;
 		layoutData.area = layoutBounds;
 		layoutData.clipRect = layoutClipRect;
-		layoutData.clipRect.x -= layoutBounds.x;
-		layoutData.clipRect.y -= layoutBounds.y;
 
 		mContentLayout->_setLayoutData(layoutData);
-
-		layoutData.clipRect = layoutClipRect;
-
 		mContentLayout->_updateLayoutInternal(layoutData);
 
 		// Vertical scrollbar
@@ -244,14 +235,11 @@ namespace BansheeEngine
 			vertScrollData.area = vertScrollBounds;
 
 			UINT32 clippedScrollbarWidth = std::min((UINT32)data.area.width, ScrollBarWidth);
-			vertScrollData.clipRect = Rect2I(0, 0, clippedScrollbarWidth, data.clipRect.height);
-
-			mVertScroll->_setLayoutData(layoutData);
-
 			vertScrollData.clipRect = Rect2I(data.clipRect.x + (vertScrollBounds.x - data.area.x), 
 				data.clipRect.y + (vertScrollBounds.y - data.area.y), clippedScrollbarWidth, data.clipRect.height);
 
 			// This element is not a child of any layout so we treat it as a root element
+			mVertScroll->_setLayoutData(vertScrollData);
 			mVertScroll->_updateLayout(vertScrollData);
 
 			// Set new handle size and update position to match the new size
@@ -274,12 +262,11 @@ namespace BansheeEngine
 			horzScrollData.area = horzScrollBounds;
 
 			UINT32 clippedScrollbarHeight = std::min((UINT32)data.area.height, ScrollBarWidth);
-			horzScrollData.clipRect = Rect2I(0, 0, data.clipRect.width, clippedScrollbarHeight);
-			mHorzScroll->_setLayoutData(horzScrollData);
 
 			// This element is not a child of any layout so we treat it as a root element
 			horzScrollData.clipRect = Rect2I(data.clipRect.x + (horzScrollBounds.x - data.area.x), 
 				data.clipRect.y + (horzScrollBounds.y - data.area.y), data.clipRect.width, clippedScrollbarHeight);
+			mHorzScroll->_setLayoutData(horzScrollData);
 			mHorzScroll->_updateLayout(horzScrollData);
 
 			// Set new handle size and update position to match the new size

+ 1 - 1
BansheeEngine/Source/BsGUIScrollBar.cpp

@@ -125,7 +125,7 @@ namespace BansheeEngine
 	{
 		Vector2I offset(mLayoutData.area.x, mLayoutData.area.y);
 		mImageSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, 
-			vertexStride, indexStride, renderElementIdx, offset, mLayoutData.clipRect);
+			vertexStride, indexStride, renderElementIdx, offset, mLayoutData.getLocalClipRect());
 	}
 
 	void GUIScrollBar::handleMoved(float handlePct)

+ 2 - 7
BansheeEngine/Source/BsGUISlider.cpp

@@ -54,13 +54,8 @@ namespace BansheeEngine
 
 	void GUISlider::_updateLayoutInternal(const GUILayoutData& data)
 	{
-		GUILayoutData childData = data;
-
-		childData.clipRect = Rect2I(data.clipRect.x - data.area.x, data.clipRect.y - data.area.y, 
-			data.clipRect.width, data.clipRect.height);
-
-		mBackground->_setLayoutData(childData);
-		mSliderHandle->_setLayoutData(childData);
+		mBackground->_setLayoutData(data);
+		mSliderHandle->_setLayoutData(data);
 	}
 
 	void GUISlider::styleUpdated()

+ 1 - 5
BansheeEngine/Source/BsGUISliderHandle.cpp

@@ -117,11 +117,7 @@ namespace BansheeEngine
 	void GUISliderHandle::updateClippedBounds()
 	{
 		mClippedBounds = mLayoutData.area;
-
-		Rect2I localClipRect = mLayoutData.clipRect;
-		localClipRect.x += mLayoutData.area.x;
-		localClipRect.y += mLayoutData.area.y;
-		mClippedBounds.clip(localClipRect);
+		mClippedBounds.clip(mLayoutData.clipRect);
 	}
 
 	Vector2I GUISliderHandle::_getOptimalSize() const

+ 2 - 2
BansheeEngine/Source/BsGUITexture.cpp

@@ -207,7 +207,7 @@ namespace BansheeEngine
 	void GUITexture::updateClippedBounds()
 	{
 		Vector2I offset(mLayoutData.area.x, mLayoutData.area.y);
-		mClippedBounds = mImageSprite->getBounds(offset, mLayoutData.clipRect);
+		mClippedBounds = mImageSprite->getBounds(offset, mLayoutData.getLocalClipRect());
 	}
 
 	void GUITexture::styleUpdated()
@@ -248,6 +248,6 @@ namespace BansheeEngine
 	{
 		Vector2I offset(mLayoutData.area.x, mLayoutData.area.y);
 		mImageSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, 
-			vertexStride, indexStride, renderElementIdx, offset, mLayoutData.clipRect);
+			vertexStride, indexStride, renderElementIdx, offset, mLayoutData.getLocalClipRect());
 	}
 }

+ 2 - 4
BansheeEngine/Source/BsGUIViewport.cpp

@@ -57,10 +57,8 @@ namespace BansheeEngine
 
 	void GUIViewport::updateClippedBounds()
 	{
-		Rect2I mBounds = Rect2I(0, 0, mLayoutData.area.width, mLayoutData.area.height);
-		mBounds.clip(mLayoutData.clipRect);
-		mBounds.x += mLayoutData.area.x;
-		mBounds.y += mLayoutData.area.y;
+		mClippedBounds = mLayoutData.area;
+		mClippedBounds.clip(mLayoutData.clipRect);
 	}
 
 	Vector2I GUIViewport::_getOptimalSize() const

+ 0 - 7
BansheeEngine/Source/BsGUIWidget.cpp

@@ -199,10 +199,6 @@ namespace BansheeEngine
 			Rect2I elementArea = panel->_getElementArea(panel->_getLayoutData().area, dirtyElement, elementSizeRange);
 
 			GUILayoutData childLayoutData = panel->_getLayoutData();
-
-			childLayoutData.clipRect.x += childLayoutData.area.x;
-			childLayoutData.clipRect.y += childLayoutData.area.y;
-
 			childLayoutData.area = elementArea;
 
 			panel->_updateChildLayout(dirtyElement, childLayoutData);
@@ -211,9 +207,6 @@ namespace BansheeEngine
 		{
 			GUILayoutData childLayoutData = updateParent->_getLayoutData();
 
-			childLayoutData.clipRect.x += childLayoutData.area.x;
-			childLayoutData.clipRect.y += childLayoutData.area.y;
-
 			updateParent->_updateLayout(childLayoutData);
 		}
 

+ 2 - 9
SBansheeEditor/Source/BsGUIGameObjectField.cpp

@@ -195,15 +195,8 @@ namespace BansheeEngine
 
 	void GUIGameObjectField::_updateLayoutInternal(const GUILayoutData& data)
 	{
-		GUILayoutData childData = data;
-		childData.clipRect.x -= data.area.x;
-		childData.clipRect.y -= data.area.y;
-
-		mLayout->_setLayoutData(childData);
-
-		childData.clipRect = data.clipRect;
-
-		mLayout->_updateLayoutInternal(childData);
+		mLayout->_setLayoutData(data);
+		mLayout->_updateLayoutInternal(data);
 	}
 
 	Vector2I GUIGameObjectField::_getOptimalSize() const

+ 2 - 9
SBansheeEditor/Source/BsGUIResourceField.cpp

@@ -200,15 +200,8 @@ namespace BansheeEngine
 
 	void GUIResourceField::_updateLayoutInternal(const GUILayoutData& data)
 	{
-		GUILayoutData childData = data;
-		childData.clipRect.x -= data.area.x;
-		childData.clipRect.y -= data.area.y;
-
-		mLayout->_setLayoutData(childData);
-
-		childData.clipRect = data.clipRect;
-
-		mLayout->_updateLayoutInternal(childData);
+		mLayout->_setLayoutData(data);
+		mLayout->_updateLayoutInternal(data);
 	}
 
 	Vector2I GUIResourceField::_getOptimalSize() const

+ 0 - 4
TODO.txt

@@ -40,10 +40,6 @@ Positions in color picker are screwed up
 Depth in COlorPicker is fucked up
 Test dock manager and sliders (right now it doesn't seem to work at all)
 
-Later:
- - Unify position, width, height, depth, depthMin, depthMax, layoutClipRect, elementClipRect into a single structure
-   - So I don't need to call 6 different _set methods in _updateLayoutInternal, and so that _updateLayoutInternal doesn't have as many parameters
-
 Simple tasks:
  - Add C# Renderable interface
  - Add C# context menu support for GUI elements