ソースを参照

Changing scene object selection no longer triggers the selection change event twice

BearishSun 10 年 前
コミット
94bd57914c

+ 3 - 1
BansheeEditor/Include/BsGUITreeView.h

@@ -253,8 +253,10 @@ namespace BansheeEngine
 
 		/**
 		 * @brief	Unselects all selected TreeElement%s.
+		 *
+		 * @param	sendEvent	Determines should the external world be notified of this change.
 		 */
-		void unselectAll();
+		void unselectAll(bool sendEvent = true);
 
 		/**
 		 * @brief	Starts rename operation on the currently selected element.

+ 1 - 1
BansheeEditor/Source/BsGUISceneTreeView.cpp

@@ -383,7 +383,7 @@ namespace BansheeEngine
 
 	void GUISceneTreeView::setSelection(const Vector<HSceneObject>& objects)
 	{
-		unselectAll();
+		unselectAll(false);
 
 		// Note: I could queue the selection update until after the next frame in order to avoid the hierarchy update here
 		// for better performance.

+ 3 - 2
BansheeEditor/Source/BsGUITreeView.cpp

@@ -572,7 +572,7 @@ namespace BansheeEngine
 		mIsElementSelected = mSelectedElements.size() > 0;
 	}
 
-	void GUITreeView::unselectAll()
+	void GUITreeView::unselectAll(bool sendEvent)
 	{
 		clearPing();
 
@@ -587,7 +587,8 @@ namespace BansheeEngine
 
 		_markLayoutAsDirty();
 
-		selectionChanged();
+		if (sendEvent)
+			selectionChanged();
 	}
 
 	void GUITreeView::renameSelected()