Răsfoiți Sursa

Fixed important issue with GUIManager element grouping
Fixed GUIElement clipping, where elements would not get clipped if they clip rect was itself clipped to 0 width or height

Marko Pintera 12 ani în urmă
părinte
comite
41ca843e12

+ 1 - 1
BansheeEngine/Include/BsSprite.h

@@ -90,7 +90,7 @@ namespace BansheeEngine
 		 * @param	renderElementIdx	Zero-based index of the render element.
 		 */
 		CM::UINT32 fillBuffer(CM::UINT8* vertices, CM::UINT8* uv, CM::UINT32* indices, CM::UINT32 startingQuad, CM::UINT32 maxNumQuads, 
-			CM::UINT32 vertexStride, CM::UINT32 indexStride, CM::UINT32 renderElementIdx, const CM::Vector2I& offset, const CM::RectI& clipRect) const;
+			CM::UINT32 vertexStride, CM::UINT32 indexStride, CM::UINT32 renderElementIdx, const CM::Vector2I& offset, const CM::RectI& clipRect, bool clip = true) const;
 
 		static void clipToRect(CM::UINT8* vertices, CM::UINT8* uv, CM::UINT32 numQuads, CM::UINT32 vertStride, const CM::RectI& clipRect);
 		static CM::Vector2I getAnchorOffset(SpriteAnchor anchor, CM::UINT32 width, CM::UINT32 height);

+ 1 - 1
BansheeEngine/Source/BsGUIDropDownBox.cpp

@@ -75,7 +75,7 @@ namespace BansheeEngine
 
 	GUIDropDownBox::GUIDropDownBox(const HSceneObject& parent, CM::Viewport* target, const GUIDropDownAreaPlacement& placement,
 		const GUIDropDownData& dropDownData, const GUISkin& skin, GUIDropDownType type)
-		:GUIWidget(parent, target), mScrollUpStyle(nullptr),
+		:GUIWidget(parent, target), mScrollUpStyle(nullptr), mRootMenu(nullptr),
 		mScrollDownStyle(nullptr), mEntryBtnStyle(nullptr), mEntryExpBtnStyle(nullptr), 
 		mSeparatorStyle(nullptr), mBackgroundStyle(nullptr), mHitBox(nullptr)
 	{

+ 9 - 3
BansheeEngine/Source/BsGUIManager.cpp

@@ -437,14 +437,20 @@ namespace BansheeEngine
 						UINT32 startDepth = elemDepth;
 						UINT32 endDepth = group.depth;
 
+						RectI potentialGroupBounds = group.bounds;
+						potentialGroupBounds.encapsulate(tfrmedBounds);
+
 						bool foundOverlap = false;
 						for(auto& material : materialGroups)
 						{
-							for(auto& group : material.second)
+							for(auto& matGroup : material.second)
 							{
-								if(group.depth > startDepth && group.depth < endDepth)
+								if(&matGroup == &group)
+									continue;
+
+								if(matGroup.depth > startDepth && matGroup.depth < endDepth)
 								{
-									if(group.bounds.overlaps(tfrmedBounds))
+									if(matGroup.bounds.overlaps(potentialGroupBounds))
 									{
 										foundOverlap = true;
 										break;

+ 2 - 2
BansheeEngine/Source/BsSprite.cpp

@@ -45,7 +45,7 @@ namespace BansheeEngine
 	}
 
 	UINT32 Sprite::fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, 
-		UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx, const Vector2I& offset, const RectI& clipRect) const
+		UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx, const Vector2I& offset, const RectI& clipRect, bool clip) const
 	{
 		auto renderElem = mCachedRenderElements.at(renderElementIdx);
 
@@ -66,7 +66,7 @@ namespace BansheeEngine
 
 		// TODO - I'm sure this can be done in a more cache friendly way. Profile it later.
 		Vector2 vecOffset((float)offset.x, (float)offset.y);
-		if(clipRect.width > 0 && clipRect.height > 0)
+		if(clip)
 		{
 			for(UINT32 i = 0; i < renderElem.numQuads; i++)
 			{

+ 4 - 3
TreeView.txt

@@ -14,9 +14,10 @@ TODO:
  - Auto scroll
     - Sliding over top or bottom of the tree view while dragging an element will search GUIElement parents to find a ScrollArea. If it finds one it will attempt to scroll up or down.
 
-Fix GUIDropDownHitBox 
- - Ensure it is focused when initially created
- - Test it works properly
+MenuBar problems:
+ - Mousing over a sub-menu hides the parent sub-menu
+ - Clicking the top menu item closes and immediately opens the menu again (it should only close it)
+   - Something similar probably also happens with ListBox
 
  Other:
  - When dragging in tree view automatically expand mouse over elements