Bladeren bron

Tested remaining inspector fields
GameObject/Resource fields accept drag and drop, test for sub classes and not for exact types, and display the type they accept

Marko Pintera 11 jaren geleden
bovenliggende
commit
d1f33eb36a

+ 1 - 0
BansheeEditor/Include/BsGUIDropButton.h

@@ -27,6 +27,7 @@ namespace BansheeEngine
 		GUIDropButton(UINT32 dragType, const String& styleName, const GUILayoutOptions& layoutOptions);
 		GUIDropButton(UINT32 dragType, const String& styleName, const GUILayoutOptions& layoutOptions);
 
 
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
+		virtual bool _acceptDragAndDrop(const Vector2I position, UINT32 typeId) const;
 
 
 		UINT32 mDragType;
 		UINT32 mDragType;
 	};
 	};

+ 6 - 1
BansheeEditor/Source/BsGUIDropButton.cpp

@@ -19,7 +19,7 @@ namespace BansheeEngine
 	}
 	}
 
 
 	GUIDropButton::GUIDropButton(UINT32 dragType, const String& styleName, const GUILayoutOptions& layoutOptions)
 	GUIDropButton::GUIDropButton(UINT32 dragType, const String& styleName, const GUILayoutOptions& layoutOptions)
-		:GUIButtonBase(styleName, GUIContent(HString(L"None")), layoutOptions)
+		:GUIButtonBase(styleName, GUIContent(HString(L"None")), layoutOptions), mDragType(dragType)
 	{
 	{
 
 
 	}
 	}
@@ -80,4 +80,9 @@ namespace BansheeEngine
 
 
 		return processed;
 		return processed;
 	}
 	}
+
+	bool GUIDropButton::_acceptDragAndDrop(const Vector2I position, UINT32 typeId) const
+	{
+		return typeId == mDragType;
+	}
 }
 }

+ 8 - 1
BansheeEditor/Source/BsGUIFloatField.cpp

@@ -34,6 +34,7 @@ namespace BansheeEngine
 		mLayout->addElement(mInputBox);
 		mLayout->addElement(mInputBox);
 
 
 		setValue(0);
 		setValue(0);
+		mInputBox->setText(L"0");
 	}
 	}
 
 
 	GUIFloatField::~GUIFloatField()
 	GUIFloatField::~GUIFloatField()
@@ -124,7 +125,13 @@ namespace BansheeEngine
 	void GUIFloatField::setValue(float value)
 	void GUIFloatField::setValue(float value)
 	{
 	{
 		mValue = value;
 		mValue = value;
-		mInputBox->setText(toWString(value));
+
+		// Only update with new value if it actually changed, otherwise
+		// problems can occur when user types in "0." and the field
+		// updates back to "0" effectively making "." unusable
+		float curValue = parseFloat(mInputBox->getText());
+		if (mValue != curValue)
+			mInputBox->setText(toWString(value));
 	}
 	}
 
 
 	void GUIFloatField::updateClippedBounds()
 	void GUIFloatField::updateClippedBounds()

+ 4 - 6
Inspector.txt

@@ -1,23 +1,18 @@
 Update C# GUIElementStyle with sub styles
 Update C# GUIElementStyle with sub styles
 Update GUIFoldout with sub styles
 Update GUIFoldout with sub styles
 
 
-Test if drag and dropping scene objects works with object and resource fields. Especially custom resources and components.
-
 Transient meshes don't seem to be released properly in 100% of the cases
 Transient meshes don't seem to be released properly in 100% of the cases
+ - Might be related to creating/destroying GUI elements?
 
 
 Test custom resources:
 Test custom resources:
  - Can I load them? (Will likely need ProjectLIbrary::load)
  - Can I load them? (Will likely need ProjectLIbrary::load)
  - Can I reference them in Component and will the reference be held after after cloning?
  - Can I reference them in Component and will the reference be held after after cloning?
 
 
 ARRAY TODO:
 ARRAY TODO:
- - Ensure that case when array is null is handled properly. Will likely need a [Create] button. And a [Clear] button?
-   - Need the same for List and Object
  - Need a GUIFoldout that doesn't have BG and is just a single button.
  - Need a GUIFoldout that doesn't have BG and is just a single button.
  - Don't render inspector if array is multi-rank
  - Don't render inspector if array is multi-rank
 
 
 TODO:
 TODO:
- - Add inspector support for lists and objects
- - Add all remaining field type Inspectable* classes
  - Ensure fields aren't updated from the app when in focus
  - Ensure fields aren't updated from the app when in focus
  - Entire foldout should be clickable, not just the toggle button
  - Entire foldout should be clickable, not just the toggle button
  - Extend text field so it can be multi-line
  - Extend text field so it can be multi-line
@@ -64,6 +59,9 @@ KEEP IN MIND:
 
 
 
 
 
 
+
+
+
 
 
 
 
 
 

+ 9 - 0
MBansheeEditor/Debug_Component1.cs

@@ -10,6 +10,15 @@ namespace BansheeEngine
     {
     {
         public int val3;
         public int val3;
         public int val4;
         public int val4;
+        public float fltVal;
+        public bool boolVal;
+        public string strVal;
+        public Color colVal;
+        public Vector2 vec2Val;
+        public Vector3 vec3Val;
+        public Vector4 vec4Val;
+        public Component cmp1;
+        public Texture2D tex1;
     }
     }
 
 
     public class Debug_Component1 : Component
     public class Debug_Component1 : Component

+ 1 - 1
MBansheeEngine/Color.cs

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-    [StructLayout(LayoutKind.Sequential)]
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
     public struct Color
     public struct Color
     {
     {
         public float r;
         public float r;

+ 1 - 1
MBansheeEngine/Math/Vector2.cs

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-    [StructLayout(LayoutKind.Sequential)]
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
     public struct Vector2
     public struct Vector2
     {
     {
         public float x;
         public float x;

+ 1 - 1
MBansheeEngine/Math/Vector3.cs

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-    [StructLayout(LayoutKind.Sequential)]
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
     public struct Vector3
     public struct Vector3
     {
     {
         public static readonly Vector3 zero = new Vector3(0.0f, 0.0f, 0.0f);
         public static readonly Vector3 zero = new Vector3(0.0f, 0.0f, 0.0f);

+ 1 - 1
MBansheeEngine/Math/Vector4.cs

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-    [StructLayout(LayoutKind.Sequential)]
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
     public struct Vector4
     public struct Vector4
     {
     {
         public static readonly Vector4 zero = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
         public static readonly Vector4 zero = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);

+ 13 - 11
SBansheeEditor/Include/BsGUIGameObjectField.h

@@ -12,35 +12,35 @@ namespace BansheeEngine
 	public:
 	public:
 		static const String& getGUITypeName();
 		static const String& getGUITypeName();
 
 
-		static GUIGameObjectField* create(const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions, 
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions, 
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const HString& labelText, const GUIOptions& layoutOptions,
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const HString& labelText, const GUIOptions& layoutOptions,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK);
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const GUIContent& labelContent, UINT32 labelWidth,
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const GUIContent& labelContent,
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const HString& labelText, UINT32 labelWidth,
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const HString& labelText,
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const HString& labelText,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIGameObjectField* create(const String& type, const String& style = StringUtil::BLANK);
+		static GUIGameObjectField* create(const String& typeNamespace, const String& type, const String& style = StringUtil::BLANK);
 
 
-		GUIGameObjectField(const PrivatelyConstruct& dummy, const String& type, const GUIContent& labelContent,
+		GUIGameObjectField(const PrivatelyConstruct& dummy, const String& typeNamespace, const String& type, const GUIContent& labelContent,
 			UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
 			UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
 
 
 		HGameObject getValue() const;
 		HGameObject getValue() const;
@@ -58,6 +58,7 @@ namespace BansheeEngine
 		void styleUpdated();
 		void styleUpdated();
 
 
 		void dataDropped(void* data);
 		void dataDropped(void* data);
+		void onClearButtonClicked();
 
 
 	private:
 	private:
 		static const UINT32 DEFAULT_LABEL_WIDTH;
 		static const UINT32 DEFAULT_LABEL_WIDTH;
@@ -67,6 +68,7 @@ namespace BansheeEngine
 		GUIDropButton* mDropButton;
 		GUIDropButton* mDropButton;
 		GUIButton* mClearButton;
 		GUIButton* mClearButton;
 		String mType;
 		String mType;
+		String mNamespace;
 
 
 		UINT64 mInstanceId;
 		UINT64 mInstanceId;
 	};
 	};

+ 13 - 11
SBansheeEditor/Include/BsGUIResourceField.h

@@ -12,35 +12,35 @@ namespace BansheeEngine
 	public:
 	public:
 		static const String& getGUITypeName();
 		static const String& getGUITypeName();
 
 
-		static GUIResourceField* create(const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const HString& labelText, const GUIOptions& layoutOptions,
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const HString& labelText, const GUIOptions& layoutOptions,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK);
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const GUIContent& labelContent, UINT32 labelWidth,
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const GUIContent& labelContent,
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const HString& labelText, UINT32 labelWidth,
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const HString& labelText,
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const HString& labelText,
 			const String& style = StringUtil::BLANK);
 			const String& style = StringUtil::BLANK);
 
 
-		static GUIResourceField* create(const String& type, const String& style = StringUtil::BLANK);
+		static GUIResourceField* create(const String& typeNamespace, const String& type, const String& style = StringUtil::BLANK);
 
 
-		GUIResourceField(const PrivatelyConstruct& dummy, const String& type, const GUIContent& labelContent,
+		GUIResourceField(const PrivatelyConstruct& dummy, const String& typeNamespace, const String& type, const GUIContent& labelContent,
 			UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
 			UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
 
 
 		HResource getValue() const;
 		HResource getValue() const;
@@ -61,6 +61,7 @@ namespace BansheeEngine
 		void styleUpdated();
 		void styleUpdated();
 
 
 		void dataDropped(void* data);
 		void dataDropped(void* data);
+		void onClearButtonClicked();
 
 
 	private:
 	private:
 		static const UINT32 DEFAULT_LABEL_WIDTH;
 		static const UINT32 DEFAULT_LABEL_WIDTH;
@@ -69,6 +70,7 @@ namespace BansheeEngine
 		GUILabel* mLabel;
 		GUILabel* mLabel;
 		GUIDropButton* mDropButton;
 		GUIDropButton* mDropButton;
 		GUIButton* mClearButton;
 		GUIButton* mClearButton;
+		String mNamespace;
 		String mType;
 		String mType;
 		String mUUID;
 		String mUUID;
 	};
 	};

+ 40 - 26
SBansheeEditor/Source/BsGUIGameObjectField.cpp

@@ -14,6 +14,7 @@
 #include "BsMonoClass.h"
 #include "BsMonoClass.h"
 #include "BsSceneObject.h"
 #include "BsSceneObject.h"
 #include "BsManagedComponent.h"
 #include "BsManagedComponent.h"
+#include "BsMonoManager.h"
 #include "BsEditorGUI.h"
 #include "BsEditorGUI.h"
 
 
 using namespace std::placeholders;
 using namespace std::placeholders;
@@ -22,9 +23,9 @@ namespace BansheeEngine
 {
 {
 	const UINT32 GUIGameObjectField::DEFAULT_LABEL_WIDTH = 100;
 	const UINT32 GUIGameObjectField::DEFAULT_LABEL_WIDTH = 100;
 
 
-	GUIGameObjectField::GUIGameObjectField(const PrivatelyConstruct& dummy, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
+	GUIGameObjectField::GUIGameObjectField(const PrivatelyConstruct& dummy, const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
 		const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
 		const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:GUIElementContainer(layoutOptions, style), mLabel(nullptr), mClearButton(nullptr), mDropButton(nullptr), mInstanceId(0), mType(type)
+		:GUIElementContainer(layoutOptions, style), mLabel(nullptr), mClearButton(nullptr), mDropButton(nullptr), mInstanceId(0), mType(type), mNamespace(typeNamespace)
 	{
 	{
 		mLayout = &addLayoutXInternal(this);
 		mLayout = &addLayoutXInternal(this);
 
 
@@ -36,6 +37,7 @@ namespace BansheeEngine
 
 
 		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(EditorGUI::ObjectFieldDropBtnStyleName));
 		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(EditorGUI::ObjectFieldDropBtnStyleName));
 		mClearButton = GUIButton::create(HString(L""), getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
 		mClearButton = GUIButton::create(HString(L""), getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
+		mClearButton->onClick.connect(std::bind(&GUIGameObjectField::onClearButtonClicked, this));
 
 
 		mLayout->addElement(mDropButton);
 		mLayout->addElement(mDropButton);
 		mLayout->addElement(mClearButton);
 		mLayout->addElement(mClearButton);
@@ -48,111 +50,111 @@ namespace BansheeEngine
 
 
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, labelContent, labelWidth, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, labelContent, labelWidth, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
 			GUILayoutOptions::create(layoutOptions), true);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
 			GUILayoutOptions::create(layoutOptions), true);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, GUIContent(labelText), labelWidth, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), labelWidth, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
 			GUILayoutOptions::create(layoutOptions), true);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const HString& labelText, const GUIOptions& layoutOptions,
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const HString& labelText, const GUIOptions& layoutOptions,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
 			GUILayoutOptions::create(layoutOptions), true);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const GUIOptions& layoutOptions, const String& style)
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const GUIOptions& layoutOptions, const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, GUIContent(), 0, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(), 0, *curStyle,
 			GUILayoutOptions::create(layoutOptions), false);
 			GUILayoutOptions::create(layoutOptions), false);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const GUIContent& labelContent, UINT32 labelWidth,
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, labelContent, labelWidth, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, labelContent, labelWidth, *curStyle,
 			GUILayoutOptions::create(), true);
 			GUILayoutOptions::create(), true);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const GUIContent& labelContent,
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const GUIContent& labelContent,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(), true);
 			GUILayoutOptions::create(), true);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const HString& labelText, UINT32 labelWidth,
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, GUIContent(labelText), labelWidth, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), labelWidth, *curStyle,
 			GUILayoutOptions::create(), true);
 			GUILayoutOptions::create(), true);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const HString& labelText,
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const HString& labelText,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(), true);
 			GUILayoutOptions::create(), true);
 	}
 	}
 
 
-	GUIGameObjectField* GUIGameObjectField::create(const String& type, const String& style)
+	GUIGameObjectField* GUIGameObjectField::create(const String& typeNamespace, const String& type, const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), type, GUIContent(), 0, *curStyle,
+		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(), 0, *curStyle,
 			GUILayoutOptions::create(), false);
 			GUILayoutOptions::create(), false);
 	}
 	}
 
 
@@ -171,12 +173,12 @@ namespace BansheeEngine
 		if(value)
 		if(value)
 		{
 		{
 			mInstanceId = value->getInstanceId();
 			mInstanceId = value->getInstanceId();
-			mDropButton->setContent(GUIContent(HString(toWString(value->getName()))));
+			mDropButton->setContent(GUIContent(HString(toWString(value->getName()) + L" (" + toWString(mType) + L")")));
 		}
 		}
 		else
 		else
 		{
 		{
 			mInstanceId = 0;
 			mInstanceId = 0;
-			mDropButton->setContent(GUIContent(HString(L"None")));
+			mDropButton->setContent(GUIContent(HString(L"None (" + toWString(mType) + L")")));
 		}
 		}
 
 
 		onValueChanged(value);
 		onValueChanged(value);
@@ -218,9 +220,16 @@ namespace BansheeEngine
 					if (component->getTypeId() == TID_ManagedComponent) // We only care about managed components
 					if (component->getTypeId() == TID_ManagedComponent) // We only care about managed components
 					{
 					{
 						HManagedComponent managedComponent = static_object_cast<ManagedComponent>(component);
 						HManagedComponent managedComponent = static_object_cast<ManagedComponent>(component);
-						if (managedComponent->getManagedFullTypeName() == mType)
+
+						MonoClass* acceptedClass = MonoManager::instance().findClass(mNamespace, mType);
+						MonoClass* providedClass = MonoManager::instance().findClass(managedComponent->getManagedNamespace(), managedComponent->getManagedTypeName());
+
+						if (acceptedClass != nullptr && providedClass != nullptr)
 						{
 						{
-							setValue(managedComponent);
+							if (providedClass->isSubClassOf(acceptedClass))
+							{
+								setValue(managedComponent);
+							}
 						}
 						}
 					}
 					}
 				}
 				}
@@ -237,6 +246,11 @@ namespace BansheeEngine
 		mClearButton->setStyle(getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
 		mClearButton->setStyle(getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
 	}
 	}
 
 
+	void GUIGameObjectField::onClearButtonClicked()
+	{
+		setValue(HGameObject());
+	}
+
 	const String& GUIGameObjectField::getGUITypeName()
 	const String& GUIGameObjectField::getGUITypeName()
 	{
 	{
 		static String typeName = "GUIGameObjectField";
 		static String typeName = "GUIGameObjectField";

+ 39 - 31
SBansheeEditor/Source/BsGUIResourceField.cpp

@@ -12,6 +12,7 @@
 #include "BsGameObjectManager.h"
 #include "BsGameObjectManager.h"
 #include "BsRuntimeScriptObjects.h"
 #include "BsRuntimeScriptObjects.h"
 #include "BsMonoClass.h"
 #include "BsMonoClass.h"
+#include "BsMonoManager.h"
 #include "BsResources.h"
 #include "BsResources.h"
 #include "BsProjectLibrary.h"
 #include "BsProjectLibrary.h"
 #include "BsProjectResourceMeta.h"
 #include "BsProjectResourceMeta.h"
@@ -24,9 +25,9 @@ namespace BansheeEngine
 {
 {
 	const UINT32 GUIResourceField::DEFAULT_LABEL_WIDTH = 100;
 	const UINT32 GUIResourceField::DEFAULT_LABEL_WIDTH = 100;
 
 
-	GUIResourceField::GUIResourceField(const PrivatelyConstruct& dummy, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
+	GUIResourceField::GUIResourceField(const PrivatelyConstruct& dummy, const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
 		const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
 		const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:GUIElementContainer(layoutOptions, style), mLabel(nullptr), mClearButton(nullptr), mDropButton(nullptr), mType(type)
+		:GUIElementContainer(layoutOptions, style), mLabel(nullptr), mClearButton(nullptr), mDropButton(nullptr), mType(type), mNamespace(typeNamespace)
 	{
 	{
 		mLayout = &addLayoutXInternal(this);
 		mLayout = &addLayoutXInternal(this);
 
 
@@ -36,8 +37,9 @@ namespace BansheeEngine
 			mLayout->addElement(mLabel);
 			mLayout->addElement(mLabel);
 		}
 		}
 
 
-		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(EditorGUI::ObjectFieldDropBtnStyleName));
+		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::Resources, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(EditorGUI::ObjectFieldDropBtnStyleName));
 		mClearButton = GUIButton::create(HString(L""), getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
 		mClearButton = GUIButton::create(HString(L""), getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
+		mClearButton->onClick.connect(std::bind(&GUIResourceField::onClearButtonClicked, this));
 
 
 		mLayout->addElement(mDropButton);
 		mLayout->addElement(mDropButton);
 		mLayout->addElement(mClearButton);
 		mLayout->addElement(mClearButton);
@@ -50,111 +52,111 @@ namespace BansheeEngine
 
 
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, labelContent, labelWidth, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, labelContent, labelWidth, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
 			GUILayoutOptions::create(layoutOptions), true);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
 			GUILayoutOptions::create(layoutOptions), true);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, GUIContent(labelText), labelWidth, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), labelWidth, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
 			GUILayoutOptions::create(layoutOptions), true);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const HString& labelText, const GUIOptions& layoutOptions,
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const HString& labelText, const GUIOptions& layoutOptions,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
 			GUILayoutOptions::create(layoutOptions), true);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const GUIOptions& layoutOptions, const String& style)
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const GUIOptions& layoutOptions, const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, GUIContent(), 0, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(), 0, *curStyle,
 			GUILayoutOptions::create(layoutOptions), false);
 			GUILayoutOptions::create(layoutOptions), false);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const GUIContent& labelContent, UINT32 labelWidth,
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, labelContent, labelWidth, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, labelContent, labelWidth, *curStyle,
 			GUILayoutOptions::create(), true);
 			GUILayoutOptions::create(), true);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const GUIContent& labelContent,
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const GUIContent& labelContent,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(), true);
 			GUILayoutOptions::create(), true);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const HString& labelText, UINT32 labelWidth,
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, GUIContent(labelText), labelWidth, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), labelWidth, *curStyle,
 			GUILayoutOptions::create(), true);
 			GUILayoutOptions::create(), true);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const HString& labelText,
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const HString& labelText,
 		const String& style)
 		const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(), true);
 			GUILayoutOptions::create(), true);
 	}
 	}
 
 
-	GUIResourceField* GUIResourceField::create(const String& type, const String& style)
+	GUIResourceField* GUIResourceField::create(const String& typeNamespace, const String& type, const String& style)
 	{
 	{
 		const String* curStyle = &style;
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 			curStyle = &EditorGUI::ObjectFieldStyleName;
 
 
-		return bs_new<GUIResourceField>(PrivatelyConstruct(), type, GUIContent(), 0, *curStyle,
+		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(), 0, *curStyle,
 			GUILayoutOptions::create(), false);
 			GUILayoutOptions::create(), false);
 	}
 	}
 
 
@@ -178,10 +180,11 @@ namespace BansheeEngine
 		Path filePath;
 		Path filePath;
 		if (Resources::instance().getFilePathFromUUID(mUUID, filePath))
 		if (Resources::instance().getFilePathFromUUID(mUUID, filePath))
 		{
 		{
-			mDropButton->setContent(GUIContent(filePath.getFilename(false)));
+			WString title = filePath.getWFilename(false) + L" (" + toWString(mType) + L")";
+			mDropButton->setContent(GUIContent(HString(title)));
 		}
 		}
 		else
 		else
-			mDropButton->setContent(GUIContent(HString(L"None")));
+			mDropButton->setContent(GUIContent(HString(L"None (" + toWString(mType) + L")")));
 
 
 		onValueChanged(mUUID);
 		onValueChanged(mUUID);
 	}
 	}
@@ -205,6 +208,8 @@ namespace BansheeEngine
 		if (numResources <= 0)
 		if (numResources <= 0)
 			return;
 			return;
 
 
+		MonoClass* acceptedClass = MonoManager::instance().findClass(mNamespace, mType);
+
 		for (UINT32 i = 0; i < numResources; i++)
 		for (UINT32 i = 0; i < numResources; i++)
 		{
 		{
 			String uuid = draggedResources->resourceUUIDs[i];
 			String uuid = draggedResources->resourceUUIDs[i];
@@ -219,8 +224,7 @@ namespace BansheeEngine
 			{
 			{
 			case TID_Texture:
 			case TID_Texture:
 			{
 			{
-				const String& texTypeName = RuntimeScriptObjects::instance().getTextureClass()->getFullName();
-				if (texTypeName == mType)
+				if (RuntimeScriptObjects::instance().getTextureClass()->isSubClassOf(acceptedClass))
 				{
 				{
 					setUUID(uuid);
 					setUUID(uuid);
 					found = true;
 					found = true;
@@ -229,8 +233,7 @@ namespace BansheeEngine
 				break;
 				break;
 			case TID_SpriteTexture:
 			case TID_SpriteTexture:
 			{
 			{
-				const String& spriteTexTypeName = RuntimeScriptObjects::instance().getSpriteTextureClass()->getFullName();
-				if (spriteTexTypeName == mType)
+				if (RuntimeScriptObjects::instance().getSpriteTextureClass()->isSubClassOf(acceptedClass))
 				{
 				{
 					setUUID(uuid);
 					setUUID(uuid);
 					found = true;
 					found = true;
@@ -240,9 +243,9 @@ namespace BansheeEngine
 			case TID_ManagedResource:
 			case TID_ManagedResource:
 			{
 			{
 				ManagedResourceMetaDataPtr managedResMetaData = std::static_pointer_cast<ManagedResourceMetaData>(meta->getResourceMetaData());
 				ManagedResourceMetaDataPtr managedResMetaData = std::static_pointer_cast<ManagedResourceMetaData>(meta->getResourceMetaData());
-				String fullTypeName = managedResMetaData->typeNamespace + "." + managedResMetaData->typeName;
+				MonoClass* providedClass = MonoManager::instance().findClass(managedResMetaData->typeNamespace, managedResMetaData->typeName);
 
 
-				if (fullTypeName == mType)
+				if (providedClass->isSubClassOf(acceptedClass))
 				{
 				{
 					setUUID(uuid);
 					setUUID(uuid);
 					found = true;
 					found = true;
@@ -267,6 +270,11 @@ namespace BansheeEngine
 		mClearButton->setStyle(getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
 		mClearButton->setStyle(getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
 	}
 	}
 
 
+	void GUIResourceField::onClearButtonClicked()
+	{
+		setValue(HResource());
+	}
+
 	const String& GUIResourceField::getGUITypeName()
 	const String& GUIResourceField::getGUITypeName()
 	{
 	{
 		static String typeName = "GUIResourceField";
 		static String typeName = "GUIResourceField";

+ 2 - 4
SBansheeEditor/Source/BsScriptGUIGameObjectField.cpp

@@ -56,17 +56,15 @@ namespace BansheeEngine
 		String typeNamespace = mono_class_get_namespace(monoClass);
 		String typeNamespace = mono_class_get_namespace(monoClass);
 		String typeName = mono_class_get_name(monoClass);
 		String typeName = mono_class_get_name(monoClass);
 
 
-		String fullTypeName = typeNamespace + "::" + typeName;
-
 		GUIGameObjectField* guiGameObjectField = nullptr;
 		GUIGameObjectField* guiGameObjectField = nullptr;
 		if (withTitle)
 		if (withTitle)
 		{
 		{
 			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
 			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiGameObjectField = GUIGameObjectField::create(fullTypeName, nativeContent, titleWidth, options, styleName);
+			guiGameObjectField = GUIGameObjectField::create(typeNamespace, typeName, nativeContent, titleWidth, options, styleName);
 		}
 		}
 		else
 		else
 		{
 		{
-			guiGameObjectField = GUIGameObjectField::create(fullTypeName, options, styleName);
+			guiGameObjectField = GUIGameObjectField::create(typeNamespace, typeName, options, styleName);
 		}
 		}
 
 
 		guiGameObjectField->onValueChanged.connect(std::bind(&ScriptGUIGameObjectField::onChanged, instance, _1));
 		guiGameObjectField->onValueChanged.connect(std::bind(&ScriptGUIGameObjectField::onChanged, instance, _1));

+ 2 - 4
SBansheeEditor/Source/BsScriptGUIResourceField.cpp

@@ -56,17 +56,15 @@ namespace BansheeEngine
 		String typeNamespace = mono_class_get_namespace(monoClass);
 		String typeNamespace = mono_class_get_namespace(monoClass);
 		String typeName = mono_class_get_name(monoClass);
 		String typeName = mono_class_get_name(monoClass);
 
 
-		String fullTypeName = typeNamespace + "::" + typeName;
-
 		GUIResourceField* guiResourceField = nullptr;
 		GUIResourceField* guiResourceField = nullptr;
 		if (withTitle)
 		if (withTitle)
 		{
 		{
 			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
 			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiResourceField = GUIResourceField::create(fullTypeName, nativeContent, titleWidth, options, styleName);
+			guiResourceField = GUIResourceField::create(typeNamespace, typeName, nativeContent, titleWidth, options, styleName);
 		}
 		}
 		else
 		else
 		{
 		{
-			guiResourceField = GUIResourceField::create(fullTypeName, options, styleName);
+			guiResourceField = GUIResourceField::create(typeNamespace, typeName, options, styleName);
 		}
 		}
 
 
 		guiResourceField->onValueChanged.connect(std::bind(&ScriptGUIResourceField::onChanged, instance, _1));
 		guiResourceField->onValueChanged.connect(std::bind(&ScriptGUIResourceField::onChanged, instance, _1));

+ 3 - 0
SBansheeEngine/Include/BsManagedComponent.h

@@ -11,6 +11,9 @@ namespace BansheeEngine
 	public:
 	public:
 		MonoObject* getManagedInstance() const { return mManagedInstance; }
 		MonoObject* getManagedInstance() const { return mManagedInstance; }
 		MonoReflectionType* getRuntimeType() const { return mRuntimeType; }
 		MonoReflectionType* getRuntimeType() const { return mRuntimeType; }
+
+		const String& getManagedNamespace() const { return mNamespace; }
+		const String& getManagedTypeName() const { return mTypeName; }
 		const String& getManagedFullTypeName() const { return mFullTypeName; }
 		const String& getManagedFullTypeName() const { return mFullTypeName; }
 
 
 	private:
 	private:

+ 2 - 0
SBansheeEngine/Source/BsManagedComponent.cpp

@@ -22,6 +22,8 @@ namespace BansheeEngine
 			return;
 			return;
 		}
 		}
 
 
+		setName(mTypeName);
+
 		construct(managedClass->createInstance(), runtimeType);
 		construct(managedClass->createInstance(), runtimeType);
 	}
 	}