Преглед на файлове

Fix for GUI element enable/disable functionality not properly updating layout after changes
Various fixes for release mode compilation

BearishSun преди 10 години
родител
ревизия
ffc68fb6e0

+ 2 - 2
BansheeCore/Include/BsCommandQueue.h

@@ -236,6 +236,7 @@ namespace BansheeEngine
 		BansheeEngine::Queue<QueuedCommand>* mCommands;
 		BansheeEngine::Queue<QueuedCommand>* mCommands;
 		Stack<BansheeEngine::Queue<QueuedCommand>*> mEmptyCommandQueues; // List of empty queues for reuse
 		Stack<BansheeEngine::Queue<QueuedCommand>*> mEmptyCommandQueues; // List of empty queues for reuse
 
 
+		AsyncOpSyncDataPtr mAsyncOpSyncData;
 		BS_THREAD_ID_TYPE mMyThreadId;
 		BS_THREAD_ID_TYPE mMyThreadId;
 
 
 		// Various variables that allow for easier debugging by allowing us to trigger breakpoints
 		// Various variables that allow for easier debugging by allowing us to trigger breakpoints
@@ -267,8 +268,7 @@ namespace BansheeEngine
 
 
 		UINT32 mMaxDebugIdx;
 		UINT32 mMaxDebugIdx;
 		UINT32 mCommandQueueIdx;
 		UINT32 mCommandQueueIdx;
-		AsyncOpSyncDataPtr mAsyncOpSyncData;
-
+		
 		static UINT32 MaxCommandQueueIdx;
 		static UINT32 MaxCommandQueueIdx;
 		static UnorderedSet<QueueBreakpoint, QueueBreakpoint::HashFunction, QueueBreakpoint::EqualFunction> SetBreakpoints;
 		static UnorderedSet<QueueBreakpoint, QueueBreakpoint::HashFunction, QueueBreakpoint::EqualFunction> SetBreakpoints;
 		BS_STATIC_MUTEX(CommandQueueBreakpointMutex);
 		BS_STATIC_MUTEX(CommandQueueBreakpointMutex);

+ 2 - 1
BansheeCore/Source/BsCommandQueue.cpp

@@ -22,7 +22,8 @@ namespace BansheeEngine
 	CommandQueueBase::CommandQueueBase(BS_THREAD_ID_TYPE threadId)
 	CommandQueueBase::CommandQueueBase(BS_THREAD_ID_TYPE threadId)
 		:mMyThreadId(threadId)
 		:mMyThreadId(threadId)
 	{
 	{
-		mCommands = bs_new<BansheeEngine::Queue<QueuedCommand>, PoolAlloc>();
+		mAsyncOpSyncData = bs_shared_ptr_new<AsyncOpSyncData>();
+		mCommands = bs_new<BansheeEngine::Queue<QueuedCommand>>();
 	}
 	}
 #endif
 #endif
 
 

+ 1 - 0
BansheeCore/Source/BsIconUtility.cpp

@@ -1,6 +1,7 @@
 #include "BsIconUtility.h"
 #include "BsIconUtility.h"
 #include "BsPixelData.h"
 #include "BsPixelData.h"
 #include "BsColor.h"
 #include "BsColor.h"
+#include "BsException.h"
 
 
 #define MSDOS_SIGNATURE 0x5A4D
 #define MSDOS_SIGNATURE 0x5A4D
 #define PE_SIGNATURE 0x00004550
 #define PE_SIGNATURE 0x00004550

+ 6 - 2
BansheeD3D9RenderAPI/Source/BsD3D9Texture.cpp

@@ -253,10 +253,14 @@ namespace BansheeEngine
 
 
 			if (sourceSurface != nullptr && destSurface != nullptr)
 			if (sourceSurface != nullptr && destSurface != nullptr)
 			{
 			{
-				if (sourceSurface->Pool != D3DPOOL_DEFAULT)
+				D3DSURFACE_DESC desc;
+
+				sourceSurface->GetDesc(&desc);
+				if (desc.Pool != D3DPOOL_DEFAULT)
 					BS_EXCEPT(InvalidStateException, "Source surface must be in the default pool.");
 					BS_EXCEPT(InvalidStateException, "Source surface must be in the default pool.");
 
 
-				if (destSurface->Pool != D3DPOOL_DEFAULT)
+				destSurface->GetDesc(&desc);
+				if (desc.Pool != D3DPOOL_DEFAULT)
 					BS_EXCEPT(InvalidStateException, "Destination surface must be in the default pool.");
 					BS_EXCEPT(InvalidStateException, "Destination surface must be in the default pool.");
 
 
 				if (FAILED(hr = resPair.first->StretchRect(sourceSurface, NULL, destSurface, NULL, D3DTEXF_NONE)))
 				if (FAILED(hr = resPair.first->StretchRect(sourceSurface, NULL, destSurface, NULL, D3DTEXF_NONE)))

+ 13 - 3
BansheeEditorExec/BsEditorExec.cpp

@@ -6,6 +6,9 @@
 
 
 #include "BsEditorApplication.h"
 #include "BsEditorApplication.h"
 
 
+// DEBUG ONLY
+#include "BsDebug.h"
+
 using namespace BansheeEngine;
 using namespace BansheeEngine;
 
 
 #if BS_DEBUG_MODE
 #if BS_DEBUG_MODE
@@ -65,9 +68,16 @@ int CALLBACK WinMain(
 	InitializeDebugConsole();
 	InitializeDebugConsole();
 #endif
 #endif
 
 
-	EditorApplication::startUp(RenderAPIPlugin::DX11);
-	EditorApplication::instance().runMainLoop();
-	EditorApplication::shutDown();
+	try
+	{
+		EditorApplication::startUp(RenderAPIPlugin::DX11);
+		EditorApplication::instance().runMainLoop();
+		EditorApplication::shutDown();
+	}
+	catch(Exception& e)
+	{
+		LOGERR(e.getFullDescription());
+	}
 
 
 #if BS_DEBUG_MODE
 #if BS_DEBUG_MODE
 	ShutdownDebugConsole();
 	ShutdownDebugConsole();

+ 8 - 3
BansheeEngine/Source/BsGUIElementBase.cpp

@@ -235,8 +235,8 @@ namespace BansheeEngine
 			}
 			}
 			else
 			else
 			{
 			{
-				_markLayoutAsDirty();
 				mFlags &= ~GUIElem_Hidden;
 				mFlags &= ~GUIElem_Hidden;
+				_markLayoutAsDirty();
 			}
 			}
 		}
 		}
 
 
@@ -251,19 +251,24 @@ namespace BansheeEngine
 
 
 		if (_isEnabled() != enabled)
 		if (_isEnabled() != enabled)
 		{
 		{
-			_markLayoutAsDirty();
-
 			// If parent is not visible, just enable the element but don't make it visible
 			// If parent is not visible, just enable the element but don't make it visible
 			if (enabled && mParentElement != nullptr && !mParentElement->_isVisible())
 			if (enabled && mParentElement != nullptr && !mParentElement->_isVisible())
 			{
 			{
 				mFlags &= ~GUIElem_Disabled;
 				mFlags &= ~GUIElem_Disabled;
+				_markLayoutAsDirty();
 			}
 			}
 			else
 			else
 			{
 			{
 				if (!enabled)
 				if (!enabled)
+				{
+					_markLayoutAsDirty();
 					mFlags |= GUIElem_Disabled | GUIElem_Hidden;
 					mFlags |= GUIElem_Disabled | GUIElem_Hidden;
+				}
 				else
 				else
+				{
 					mFlags &= ~(GUIElem_Disabled | GUIElem_Hidden);
 					mFlags &= ~(GUIElem_Disabled | GUIElem_Hidden);
+					_markLayoutAsDirty();
+				}
 			}
 			}
 		}
 		}
 
 

+ 2 - 0
BansheeUtility/BansheeUtility.vcxproj

@@ -216,6 +216,8 @@
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
       <DebugInformationFormat>None</DebugInformationFormat>
       <InlineFunctionExpansion>Default</InlineFunctionExpansion>
       <InlineFunctionExpansion>Default</InlineFunctionExpansion>
+      <MinimalRebuild>
+      </MinimalRebuild>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <GenerateDebugInformation>false</GenerateDebugInformation>

+ 17 - 5
BansheeUtility/Include/BsAny.h

@@ -1,7 +1,7 @@
 #pragma once
 #pragma once
 
 
 #include "BsPrerequisitesUtil.h"
 #include "BsPrerequisitesUtil.h"
-#include "BsException.h"
+#include "BsDebug.h"
 #include <algorithm>
 #include <algorithm>
 #include <typeinfo>
 #include <typeinfo>
 
 
@@ -154,7 +154,10 @@ namespace BansheeEngine
 		ValueType* result = any_cast<ValueType>(const_cast<Any*>(&operand));
 		ValueType* result = any_cast<ValueType>(const_cast<Any*>(&operand));
 
 
 		if (result == nullptr)
 		if (result == nullptr)
-			BS_EXCEPT(InvalidStateException, "Failed to cast between Any types.");
+		{
+			String msg = String("Failed to cast between Any types: ") + String(operand.type().name()) + " != " + String(typeid(ValueType).name());
+			LOGERR(msg);
+		}
 
 
 		return *result;
 		return *result;
 	}
 	}
@@ -170,7 +173,10 @@ namespace BansheeEngine
 		ValueType* result = any_cast<ValueType>(&operand);
 		ValueType* result = any_cast<ValueType>(&operand);
 
 
 		if (result == nullptr)
 		if (result == nullptr)
-			BS_EXCEPT(InvalidStateException, "Failed to cast between Any types.");
+		{
+			String msg = String("Failed to cast between Any types: ") + String(operand.type().name()) + " != " + String(typeid(ValueType).name());
+			LOGERR(msg);
+		}
 
 
 		return *result;
 		return *result;
 	}
 	}
@@ -186,7 +192,10 @@ namespace BansheeEngine
 		ValueType* result = any_cast<ValueType>(const_cast<Any*>(&operand));
 		ValueType* result = any_cast<ValueType>(const_cast<Any*>(&operand));
 
 
 		if (result == nullptr)
 		if (result == nullptr)
-			BS_EXCEPT(InvalidStateException, "Failed to cast between Any types.");
+		{
+			String msg = String("Failed to cast between Any types: ") + String(operand.type().name()) + " != " + String(typeid(ValueType).name());
+			LOGERR(msg);
+		}
 
 
 		return *result;
 		return *result;
 	}
 	}
@@ -202,7 +211,10 @@ namespace BansheeEngine
 		ValueType* result = any_cast<ValueType>(&operand);
 		ValueType* result = any_cast<ValueType>(&operand);
 
 
 		if (result == nullptr)
 		if (result == nullptr)
-			BS_EXCEPT(InvalidStateException, "Failed to cast between Any types.");
+		{
+			String msg = String("Failed to cast between Any types: ") + String(operand.type().name()) + " != " + String(typeid(ValueType).name());
+			LOGERR(msg);
+		}
 
 
 		return *result;
 		return *result;
 	}
 	}

+ 11 - 0
BansheeUtility/Source/BsFrameAlloc.cpp

@@ -23,12 +23,21 @@ namespace BansheeEngine
 		mFreePtr = 0;
 		mFreePtr = 0;
 	}
 	}
 
 
+#if BS_DEBUG_MODE
 	FrameAlloc::FrameAlloc(UINT32 blockSize)
 	FrameAlloc::FrameAlloc(UINT32 blockSize)
 		:mTotalAllocBytes(0), mFreeBlock(nullptr), mBlockSize(blockSize),
 		:mTotalAllocBytes(0), mFreeBlock(nullptr), mBlockSize(blockSize),
 		mOwnerThread(BS_THREAD_CURRENT_ID), mLastFrame(nullptr), mNextBlockIdx(0)
 		mOwnerThread(BS_THREAD_CURRENT_ID), mLastFrame(nullptr), mNextBlockIdx(0)
 	{
 	{
 		allocBlock(mBlockSize);
 		allocBlock(mBlockSize);
 	}
 	}
+#else
+	FrameAlloc::FrameAlloc(UINT32 blockSize)
+		:mTotalAllocBytes(0), mFreeBlock(nullptr), mBlockSize(blockSize),
+		mLastFrame(nullptr), mNextBlockIdx(0)
+	{
+		allocBlock(mBlockSize);
+	}
+#endif
 
 
 	FrameAlloc::~FrameAlloc()
 	FrameAlloc::~FrameAlloc()
 	{
 	{
@@ -83,7 +92,9 @@ namespace BansheeEngine
 
 
 	void FrameAlloc::clear()
 	void FrameAlloc::clear()
 	{
 	{
+#if BS_DEBUG_MODE
 		assert(mOwnerThread == BS_THREAD_CURRENT_ID && "Frame allocator called from invalid thread.");
 		assert(mOwnerThread == BS_THREAD_CURRENT_ID && "Frame allocator called from invalid thread.");
+#endif
 
 
 		if(mLastFrame != nullptr)
 		if(mLastFrame != nullptr)
 		{
 		{

+ 2 - 1
TODO.txt

@@ -53,8 +53,9 @@ Code quality improvements:
 Polish
 Polish
 
 
 Ribek use:
 Ribek use:
+ - Default material has no shader. What shader to assign to default materials?
+ - When I'm directly editing a resource like material, I need to save it after editing is done. Use the "dirty" system for that?
  - Hook up color picker to guicolor field
  - Hook up color picker to guicolor field
- - When hiding a component in inspector, it doesn't immediately reposition the components below it
  - Resource inspectors for: Shader, GUISkin, StringTable
  - Resource inspectors for: Shader, GUISkin, StringTable
  - Test release mode
  - Test release mode