Browse Source

Fixed infinite loop when deleting multiple meshes

BearishSun 10 years ago
parent
commit
e55e173aed

+ 2 - 1
BansheeEditor/Include/BsBuiltinEditorResources.h

@@ -3,6 +3,7 @@
 #include "BsEditorPrerequisites.h"
 #include "BsEditorPrerequisites.h"
 #include "BsGUISkin.h"
 #include "BsGUISkin.h"
 #include "BsModule.h"
 #include "BsModule.h"
+#include "BsGUIContent.h"
 #include "BsApplication.h"
 #include "BsApplication.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
@@ -153,7 +154,7 @@ namespace BansheeEngine
 		/**
 		/**
 		 * @brief	Retrieves an icon that may be displayed on the scene window.
 		 * @brief	Retrieves an icon that may be displayed on the scene window.
 		 */
 		 */
-		HSpriteTexture getSceneWindowIcon(SceneWindowIcon icon) const;
+		GUIContentImages getSceneWindowIcon(SceneWindowIcon icon) const;
 
 
 		/**
 		/**
 		 * @brief	Retrieves an icon that may be displayed on the library window.
 		 * @brief	Retrieves an icon that may be displayed on the library window.

+ 45 - 12
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -2051,33 +2051,66 @@ namespace BansheeEngine
 		return HSpriteTexture();
 		return HSpriteTexture();
 	}
 	}
 
 
-	HSpriteTexture BuiltinEditorResources::getSceneWindowIcon(SceneWindowIcon icon) const
+	GUIContentImages BuiltinEditorResources::getSceneWindowIcon(SceneWindowIcon icon) const
 	{
 	{
+		HSpriteTexture off;
+		HSpriteTexture on;
+
 		switch (icon)
 		switch (icon)
 		{
 		{
 		case SceneWindowIcon::View:
 		case SceneWindowIcon::View:
-			return getGUIIcon(L"SceneViewIcon.png");
+			off = getGUIIcon(L"SceneViewIcon.png");
+			on = getGUIIcon(L"SceneViewIconOn.png");
+			break;
 		case SceneWindowIcon::Move:
 		case SceneWindowIcon::Move:
-			return getGUIIcon(L"SceneMoveIcon.png");
+			off = getGUIIcon(L"SceneMoveIcon.png");
+			on = getGUIIcon(L"SceneMoveIconOn.png");
+			break;
 		case SceneWindowIcon::Rotate:
 		case SceneWindowIcon::Rotate:
-			return getGUIIcon(L"SceneRotateIcon.png");
+			off = getGUIIcon(L"SceneRotateIcon.png");
+			on = getGUIIcon(L"SceneRotateIconOn.png");
+			break;
 		case SceneWindowIcon::Scale:
 		case SceneWindowIcon::Scale:
-			return getGUIIcon(L"SceneScaleIcon.png");
+			off = getGUIIcon(L"SceneScaleIcon.png");
+			on = getGUIIcon(L"SceneScaleIconOn.png");
+			break;
 		case SceneWindowIcon::Pivot:
 		case SceneWindowIcon::Pivot:
-			return getGUIIcon(L"ScenePivotIcon.png");
+			off = getGUIIcon(L"ScenePivotIcon.png");
+			on = getGUIIcon(L"ScenePivotIconOn.png");
+			break;
 		case SceneWindowIcon::Center:
 		case SceneWindowIcon::Center:
-			return getGUIIcon(L"SceneCenterIcon.png");
+			off = getGUIIcon(L"SceneCenterIcon.png");
+			on = getGUIIcon(L"SceneCenterIconOn.png");
+			break;
 		case SceneWindowIcon::Local:
 		case SceneWindowIcon::Local:
-			return getGUIIcon(L"SceneLocalIcon.png");
+			off = getGUIIcon(L"SceneLocalIcon.png");
+			on = getGUIIcon(L"SceneLocalIconOn.png");
+			break;
 		case SceneWindowIcon::World:
 		case SceneWindowIcon::World:
-			return getGUIIcon(L"SceneWorldIcon.png");
+			off = getGUIIcon(L"SceneWorldIcon.png");
+			on = getGUIIcon(L"SceneWorldIconOn.png");
+			break;
 		case SceneWindowIcon::MoveSnap:
 		case SceneWindowIcon::MoveSnap:
-			return getGUIIcon(L"SceneMoveSnapIcon.png");
+			off = getGUIIcon(L"SceneMoveSnapIcon.png");
+			on = getGUIIcon(L"SceneMoveSnapIconOn.png");
+			break;
 		case SceneWindowIcon::RotateSnap:
 		case SceneWindowIcon::RotateSnap:
-			return getGUIIcon(L"SceneRotateSnapIcon.png");
+			off = getGUIIcon(L"SceneRotateSnapIcon.png");
+			on = getGUIIcon(L"SceneRotateSnapIconOn.png");
+			break;
 		}
 		}
 
 
-		return HSpriteTexture();
+		GUIContentImages output;
+		output.normal = off;
+		output.hover = off;
+		output.active = on;
+		output.focused = off;
+		output.normalOn = on;
+		output.hoverOn = on;
+		output.activeOn = on;
+		output.focusedOn = on;
+
+		return output;
 	}
 	}
 
 
 	HSpriteTexture BuiltinEditorResources::getLibraryWindowIcon(LibraryWindowIcon icon) const
 	HSpriteTexture BuiltinEditorResources::getLibraryWindowIcon(LibraryWindowIcon icon) const

+ 1 - 1
BansheeEditor/Source/BsGUITreeView.cpp

@@ -610,7 +610,7 @@ namespace BansheeEngine
 				const TreeElement* elem = child;
 				const TreeElement* elem = child;
 
 
 				while (elem != nullptr && elem != parent)
 				while (elem != nullptr && elem != parent)
-					elem = child->mParent;
+					elem = elem->mParent;
 
 
 				return elem == parent;
 				return elem == parent;
 			};
 			};

+ 2 - 2
MBansheeEditor/EditorBuiltin.cs

@@ -114,7 +114,7 @@ namespace BansheeEditor
         /// </summary>
         /// </summary>
         /// <param name="icon">Type of icon to retrieve.</param>
         /// <param name="icon">Type of icon to retrieve.</param>
         /// <returns>Sprite texture of the icon.</returns>
         /// <returns>Sprite texture of the icon.</returns>
-        public static SpriteTexture GetSceneWindowIcon(SceneWindowIcon icon)
+        public static GUIContentImages GetSceneWindowIcon(SceneWindowIcon icon)
         {
         {
             return Internal_GetSceneWindowIcon(icon);
             return Internal_GetSceneWindowIcon(icon);
         }
         }
@@ -152,7 +152,7 @@ namespace BansheeEditor
         private static extern SpriteTexture Internal_GetInspectorWindowIcon(InspectorWindowIcon icon);
         private static extern SpriteTexture Internal_GetInspectorWindowIcon(InspectorWindowIcon icon);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern SpriteTexture Internal_GetSceneWindowIcon(SceneWindowIcon icon);
+        private static extern GUIContentImages Internal_GetSceneWindowIcon(SceneWindowIcon icon);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern SpriteTexture Internal_GetLogIcon(LogIcon icon, int size);
         private static extern SpriteTexture Internal_GetLogIcon(LogIcon icon, int size);

+ 3 - 3
SBansheeEditor/Source/BsScriptEditorBuiltin.cpp

@@ -4,7 +4,7 @@
 #include "BsMonoMethod.h"
 #include "BsMonoMethod.h"
 #include "BsMonoUtil.h"
 #include "BsMonoUtil.h"
 #include "BsScriptSpriteTexture.h"
 #include "BsScriptSpriteTexture.h"
-#include "BsScriptResourceManager.h"
+#include "BsScriptGUIContentImages.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -76,9 +76,9 @@ namespace BansheeEngine
 
 
 	MonoObject* ScriptEditorBuiltin::internal_GetSceneWindowIcon(SceneWindowIcon icon)
 	MonoObject* ScriptEditorBuiltin::internal_GetSceneWindowIcon(SceneWindowIcon icon)
 	{
 	{
-		HSpriteTexture tex = BuiltinEditorResources::instance().getSceneWindowIcon(icon);
+		GUIContentImages images = BuiltinEditorResources::instance().getSceneWindowIcon(icon);
 
 
-		return ScriptSpriteTexture::toManaged(tex);
+		return ScriptGUIContentImages::getManaged(images);
 	}
 	}
 
 
 	MonoObject* ScriptEditorBuiltin::internal_GetLogIcon(LogMessageIcon icon, int size)
 	MonoObject* ScriptEditorBuiltin::internal_GetLogIcon(LogMessageIcon icon, int size)