2
0
Эх сурвалжийг харах

Added Vec3 and Vec2 fields

Marko Pintera 11 жил өмнө
parent
commit
2dbcc8d6ba

+ 4 - 0
BansheeEditor/BansheeEditor.vcxproj

@@ -278,6 +278,7 @@
     <ClInclude Include="Include\BsGUIFloatField.h" />
     <ClInclude Include="Include\BsGUIIntField.h" />
     <ClInclude Include="Include\BsGUITextField.h" />
+    <ClInclude Include="Include\BsGUIVector3Field.h" />
     <ClInclude Include="Include\BsGUIVector4Field.h" />
     <ClInclude Include="Include\BsProjectLibraryEntriesRTTI.h" />
     <ClInclude Include="Include\BsEditorPrerequisites.h" />
@@ -302,6 +303,7 @@
     <ClInclude Include="Include\BsProjectLibraryEntries.h" />
     <ClInclude Include="Include\BsResourceMeta.h" />
     <ClInclude Include="Include\BsResourceMetaRTTI.h" />
+    <ClInclude Include="Include\BsGUIVector2Field.h" />
     <ClInclude Include="Include\CmDebugCamera.h" />
     <ClInclude Include="Include\CmTestTextSprite.h" />
     <ClInclude Include="Include\DbgEditorWidget1.h" />
@@ -333,6 +335,8 @@
     <ClCompile Include="Source\BsGUITextField.cpp" />
     <ClCompile Include="Source\BsGUITreeView.cpp" />
     <ClCompile Include="Source\BsGUITreeViewEditBox.cpp" />
+    <ClCompile Include="Source\BsGUIVector2Field.cpp" />
+    <ClCompile Include="Source\BsGUIVector3Field.cpp" />
     <ClCompile Include="Source\BsGUIVector4Field.cpp" />
     <ClCompile Include="Source\BsGUIWindowFrame.cpp" />
     <ClCompile Include="Source\BsGUIWindowFrameWidget.cpp" />

+ 12 - 0
BansheeEditor/BansheeEditor.vcxproj.filters

@@ -165,6 +165,12 @@
     <ClInclude Include="Include\BsGUIVector4Field.h">
       <Filter>Header Files\Editor</Filter>
     </ClInclude>
+    <ClInclude Include="Include\BsGUIVector3Field.h">
+      <Filter>Header Files\Editor</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsGUIVector2Field.h">
+      <Filter>Header Files\Editor</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsEditorWidgetContainer.cpp">
@@ -281,5 +287,11 @@
     <ClCompile Include="Source\BsGUIVector4Field.cpp">
       <Filter>Source Files\Editor</Filter>
     </ClCompile>
+    <ClCompile Include="Source\BsGUIVector3Field.cpp">
+      <Filter>Source Files\Editor</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsGUIVector2Field.cpp">
+      <Filter>Source Files\Editor</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 60 - 0
BansheeEditor/Include/BsGUIVector2Field.h

@@ -0,0 +1,60 @@
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsGUIElementContainer.h"
+#include "CmVector2.h"
+
+namespace BansheeEditor
+{
+	class BS_ED_EXPORT GUIVector2Field : public BS::GUIElementContainer
+	{
+		struct PrivatelyConstruct {};
+
+	public:
+		static const CM::String& getGUITypeName();
+
+		static GUIVector2Field* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector2Field* create(BS::GUIWidget& parent, const CM::HString& labelText, 
+			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector2Field* create(BS::GUIWidget& parent, 
+			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector2Field* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector2Field* create(BS::GUIWidget& parent, const CM::HString& labelText, 
+			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector2Field* create(BS::GUIWidget& parent, 
+			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		GUIVector2Field(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
+
+		GUIVector2Field(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, 
+			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
+
+		CM::Vector2 getValue() const;
+		void setValue(const CM::Vector2& value);
+
+		CM::Vector2I _getOptimalSize() const;
+	protected:
+		virtual ~GUIVector2Field();
+
+		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
+			CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
+
+	protected:
+		static const CM::UINT32 ELEMENT_LABEL_WIDTH;
+
+		BS::GUILabel* mLabel;
+		GUIFloatField* mFieldX;
+		GUIFloatField* mFieldY;
+
+		void construct(BS::GUIWidget& parent, const BS::GUIContent& labelContent, BS::GUIElementStyle* labelStyle, 
+			BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
+	};
+}

+ 61 - 0
BansheeEditor/Include/BsGUIVector3Field.h

@@ -0,0 +1,61 @@
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsGUIElementContainer.h"
+#include "CmVector3.h"
+
+namespace BansheeEditor
+{
+	class BS_ED_EXPORT GUIVector3Field : public BS::GUIElementContainer
+	{
+		struct PrivatelyConstruct {};
+
+	public:
+		static const CM::String& getGUITypeName();
+
+		static GUIVector3Field* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector3Field* create(BS::GUIWidget& parent, const CM::HString& labelText, 
+			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector3Field* create(BS::GUIWidget& parent, 
+			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector3Field* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector3Field* create(BS::GUIWidget& parent, const CM::HString& labelText, 
+			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		static GUIVector3Field* create(BS::GUIWidget& parent, 
+			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
+
+		GUIVector3Field(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
+
+		GUIVector3Field(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, 
+			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
+
+		CM::Vector3 getValue() const;
+		void setValue(const CM::Vector3& value);
+
+		CM::Vector2I _getOptimalSize() const;
+	protected:
+		virtual ~GUIVector3Field();
+
+		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
+			CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
+
+	protected:
+		static const CM::UINT32 ELEMENT_LABEL_WIDTH;
+
+		BS::GUILabel* mLabel;
+		GUIFloatField* mFieldX;
+		GUIFloatField* mFieldY;
+		GUIFloatField* mFieldZ;
+
+		void construct(BS::GUIWidget& parent, const BS::GUIContent& labelContent, BS::GUIElementStyle* labelStyle, 
+			BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
+	};
+}

+ 193 - 0
BansheeEditor/Source/BsGUIVector2Field.cpp

@@ -0,0 +1,193 @@
+#include "BsGUIVector2Field.h"
+#include "BsGUIArea.h"
+#include "BsGUILayout.h"
+#include "BsGUILabel.h"
+#include "BsGUIFloatField.h"
+#include "BsBuiltinResources.h"
+#include "BsGUIWidget.h"
+#include "BsGUIMouseEvent.h"
+#include "BsGUIWidget.h"
+
+using namespace CamelotFramework;
+using namespace BansheeEngine;
+
+namespace BansheeEditor
+{
+	const UINT32 GUIVector2Field::ELEMENT_LABEL_WIDTH = 10;
+
+	GUIVector2Field::GUIVector2Field(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
+		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mFieldX(nullptr), mFieldY(nullptr)
+	{
+		construct(parent, labelContent, labelStyle, inputBoxStyle, layoutOptions, true);
+	}
+
+	GUIVector2Field::GUIVector2Field(const PrivatelyConstruct& dummy, GUIWidget& parent, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
+		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mFieldX(nullptr), mFieldY(nullptr)
+	{
+		construct(parent, GUIContent(HString()), labelStyle, inputBoxStyle, layoutOptions, false);
+	}
+
+	GUIVector2Field::~GUIVector2Field()
+	{
+
+	}
+
+	GUIVector2Field* GUIVector2Field::create(GUIWidget& parent, const GUIContent& labelContent, const GUIOptions& layoutOptions, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector2Field>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
+			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
+	}
+
+	GUIVector2Field* GUIVector2Field::create(GUIWidget& parent, const GUIContent& labelContent, GUIElementStyle* labelStyle, 
+		GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector2Field>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
+			GUILayoutOptions::create(&GUISkin::DefaultStyle));
+	}
+
+	GUIVector2Field* GUIVector2Field::create(GUIWidget& parent, const HString& labelContent, const GUIOptions& layoutOptions, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector2Field>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, 
+			inputBoxStyle, GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
+	}
+
+	GUIVector2Field* GUIVector2Field::create(GUIWidget& parent, const HString& labelContent, GUIElementStyle* labelStyle, 
+		GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector2Field>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, inputBoxStyle, 
+			GUILayoutOptions::create(&GUISkin::DefaultStyle));
+	}
+
+	GUIVector2Field* GUIVector2Field::create(GUIWidget& parent, const GUIOptions& layoutOptions, GUIElementStyle* labelStyle, 
+		GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector2Field>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, 
+			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
+	}
+
+	GUIVector2Field* GUIVector2Field::create(GUIWidget& parent, GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector2Field>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
+	}
+
+	void GUIVector2Field::construct(GUIWidget& parent, const GUIContent& labelContent, GUIElementStyle* labelStyle, 
+		GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
+	{
+		if(withLabel)
+		{
+			const GUIElementStyle* curLabelStyle = labelStyle;
+
+			if(curLabelStyle == nullptr)
+				curLabelStyle = parent.getSkin().getStyle("Label");
+
+			mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
+		}
+
+		mFieldX = GUIFloatField::create(parent, HString(L"X"), labelStyle, inputBoxStyle);
+		mFieldY = GUIFloatField::create(parent, HString(L"Y"), labelStyle, inputBoxStyle);
+
+		mFieldX->setLabelWidth(ELEMENT_LABEL_WIDTH);
+		mFieldY->setLabelWidth(ELEMENT_LABEL_WIDTH);
+
+		_registerChildElement(mLabel);
+		_registerChildElement(mFieldX);
+		_registerChildElement(mFieldY);
+	}
+
+	Vector2 GUIVector2Field::getValue() const
+	{
+		Vector2 value;
+		value.x = mFieldX->getValue();
+		value.y = mFieldY->getValue();
+
+		return value;
+	}
+
+	void GUIVector2Field::setValue(const Vector2& value)
+	{
+		mFieldX->setValue(value.x);
+		mFieldY->setValue(value.y);
+	}
+
+	void GUIVector2Field::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
+		RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
+	{
+		UINT32 inputBoxYOffset = 0;
+
+		if(mLabel != nullptr)
+		{
+			Vector2I optimalSize = mLabel->_getOptimalSize();
+			Vector2I offset(x, y);
+			mLabel->_setOffset(offset);
+			mLabel->_setWidth(width);
+			mLabel->_setHeight(optimalSize.y);
+			mLabel->_setAreaDepth(areaDepth);
+			mLabel->_setWidgetDepth(widgetDepth);
+
+			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
+			mLabel->_setClipRect(elemClipRect);
+
+			inputBoxYOffset = optimalSize.y;
+		}
+
+		GUIFloatField* fields[] = { mFieldX, mFieldY };
+		UINT32 numFields = sizeof(fields) / sizeof(fields[0]);
+
+		UINT32 sizePerField = width / numFields;
+		UINT32 inputBoxXOffset = 0;
+
+		for(UINT32 i = 0; i < numFields; i++)
+		{
+			Vector2I optimalSize = fields[i]->_getOptimalSize();
+			INT32 yOffset = Math::roundToInt((height - optimalSize.y) * 0.5f);
+
+			Vector2I offset(x + inputBoxXOffset, y + inputBoxYOffset);
+			fields[i]->_setOffset(offset);
+			fields[i]->_setWidth(sizePerField);
+			fields[i]->_setHeight(optimalSize.y);
+			fields[i]->_setAreaDepth(areaDepth);
+			fields[i]->_setWidgetDepth(widgetDepth);
+
+			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
+			fields[i]->_setClipRect(elemClipRect);
+
+			RectI newClipRect(offset.x, offset.y, sizePerField, optimalSize.y);
+			newClipRect.clip(clipRect);
+			fields[i]->_updateLayoutInternal(offset.x, offset.y, sizePerField, optimalSize.y, newClipRect, widgetDepth, areaDepth);
+
+			inputBoxXOffset += sizePerField;
+		}
+	}
+
+	Vector2I GUIVector2Field::_getOptimalSize() const
+	{
+		GUIFloatField* fields[] = { mFieldX, mFieldY };
+		UINT32 numFields = sizeof(fields) / sizeof(fields[0]);
+
+		Vector2I optimalSize;
+
+		for(UINT32 i = 0; i < numFields; i++)
+		{
+			optimalSize.x += fields[i]->_getOptimalSize().x;
+			optimalSize.y = std::max(optimalSize.y, fields[i]->_getOptimalSize().y);
+		}
+
+		if(mLabel != nullptr)
+		{
+			optimalSize.x = std::max(optimalSize.x, mLabel->_getOptimalSize().x);
+			optimalSize.y += mLabel->_getOptimalSize().y;
+		}
+
+		return optimalSize;
+	}
+
+	const String& GUIVector2Field::getGUITypeName()
+	{
+		static String typeName = "GUIVector2Field";
+		return typeName;
+	}
+}

+ 200 - 0
BansheeEditor/Source/BsGUIVector3Field.cpp

@@ -0,0 +1,200 @@
+#include "BsGUIVector3Field.h"
+#include "BsGUIArea.h"
+#include "BsGUILayout.h"
+#include "BsGUILabel.h"
+#include "BsGUIFloatField.h"
+#include "BsBuiltinResources.h"
+#include "BsGUIWidget.h"
+#include "BsGUIMouseEvent.h"
+#include "BsGUIWidget.h"
+
+using namespace CamelotFramework;
+using namespace BansheeEngine;
+
+namespace BansheeEditor
+{
+	const UINT32 GUIVector3Field::ELEMENT_LABEL_WIDTH = 10;
+
+	GUIVector3Field::GUIVector3Field(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
+		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mFieldX(nullptr), mFieldY(nullptr),
+		mFieldZ(nullptr)
+	{
+		construct(parent, labelContent, labelStyle, inputBoxStyle, layoutOptions, true);
+	}
+
+	GUIVector3Field::GUIVector3Field(const PrivatelyConstruct& dummy, GUIWidget& parent, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
+		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mFieldX(nullptr), mFieldY(nullptr),
+		mFieldZ(nullptr)
+	{
+		construct(parent, GUIContent(HString()), labelStyle, inputBoxStyle, layoutOptions, false);
+	}
+
+	GUIVector3Field::~GUIVector3Field()
+	{
+
+	}
+
+	GUIVector3Field* GUIVector3Field::create(GUIWidget& parent, const GUIContent& labelContent, const GUIOptions& layoutOptions, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector3Field>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
+			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
+	}
+
+	GUIVector3Field* GUIVector3Field::create(GUIWidget& parent, const GUIContent& labelContent, GUIElementStyle* labelStyle, 
+		GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector3Field>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
+			GUILayoutOptions::create(&GUISkin::DefaultStyle));
+	}
+
+	GUIVector3Field* GUIVector3Field::create(GUIWidget& parent, const HString& labelContent, const GUIOptions& layoutOptions, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector3Field>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, 
+			inputBoxStyle, GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
+	}
+
+	GUIVector3Field* GUIVector3Field::create(GUIWidget& parent, const HString& labelContent, GUIElementStyle* labelStyle, 
+		GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector3Field>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, inputBoxStyle, 
+			GUILayoutOptions::create(&GUISkin::DefaultStyle));
+	}
+
+	GUIVector3Field* GUIVector3Field::create(GUIWidget& parent, const GUIOptions& layoutOptions, GUIElementStyle* labelStyle, 
+		GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector3Field>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, 
+			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
+	}
+
+	GUIVector3Field* GUIVector3Field::create(GUIWidget& parent, GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
+	{
+		return cm_new<GUIVector3Field>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
+	}
+
+	void GUIVector3Field::construct(GUIWidget& parent, const GUIContent& labelContent, GUIElementStyle* labelStyle, 
+		GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
+	{
+		if(withLabel)
+		{
+			const GUIElementStyle* curLabelStyle = labelStyle;
+
+			if(curLabelStyle == nullptr)
+				curLabelStyle = parent.getSkin().getStyle("Label");
+
+			mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
+		}
+
+		mFieldX = GUIFloatField::create(parent, HString(L"X"), labelStyle, inputBoxStyle);
+		mFieldY = GUIFloatField::create(parent, HString(L"Y"), labelStyle, inputBoxStyle);
+		mFieldZ = GUIFloatField::create(parent, HString(L"Z"), labelStyle, inputBoxStyle);
+
+		mFieldX->setLabelWidth(ELEMENT_LABEL_WIDTH);
+		mFieldY->setLabelWidth(ELEMENT_LABEL_WIDTH);
+		mFieldZ->setLabelWidth(ELEMENT_LABEL_WIDTH);
+
+		_registerChildElement(mLabel);
+		_registerChildElement(mFieldX);
+		_registerChildElement(mFieldY);
+		_registerChildElement(mFieldZ);
+	}
+
+	Vector3 GUIVector3Field::getValue() const
+	{
+		Vector3 value;
+		value.x = mFieldX->getValue();
+		value.y = mFieldY->getValue();
+		value.z = mFieldZ->getValue();
+
+		return value;
+	}
+
+	void GUIVector3Field::setValue(const Vector3& value)
+	{
+		mFieldX->setValue(value.x);
+		mFieldY->setValue(value.y);
+		mFieldZ->setValue(value.z);
+	}
+
+	void GUIVector3Field::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
+		RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
+	{
+		UINT32 inputBoxYOffset = 0;
+
+		if(mLabel != nullptr)
+		{
+			Vector2I optimalSize = mLabel->_getOptimalSize();
+			Vector2I offset(x, y);
+			mLabel->_setOffset(offset);
+			mLabel->_setWidth(width);
+			mLabel->_setHeight(optimalSize.y);
+			mLabel->_setAreaDepth(areaDepth);
+			mLabel->_setWidgetDepth(widgetDepth);
+
+			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
+			mLabel->_setClipRect(elemClipRect);
+
+			inputBoxYOffset = optimalSize.y;
+		}
+
+		GUIFloatField* fields[] = { mFieldX, mFieldY, mFieldZ };
+		UINT32 numFields = sizeof(fields) / sizeof(fields[0]);
+
+		UINT32 sizePerField = width / numFields;
+		UINT32 inputBoxXOffset = 0;
+
+		for(UINT32 i = 0; i < numFields; i++)
+		{
+			Vector2I optimalSize = fields[i]->_getOptimalSize();
+			INT32 yOffset = Math::roundToInt((height - optimalSize.y) * 0.5f);
+
+			Vector2I offset(x + inputBoxXOffset, y + inputBoxYOffset);
+			fields[i]->_setOffset(offset);
+			fields[i]->_setWidth(sizePerField);
+			fields[i]->_setHeight(optimalSize.y);
+			fields[i]->_setAreaDepth(areaDepth);
+			fields[i]->_setWidgetDepth(widgetDepth);
+
+			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
+			fields[i]->_setClipRect(elemClipRect);
+
+			RectI newClipRect(offset.x, offset.y, sizePerField, optimalSize.y);
+			newClipRect.clip(clipRect);
+			fields[i]->_updateLayoutInternal(offset.x, offset.y, sizePerField, optimalSize.y, newClipRect, widgetDepth, areaDepth);
+
+			inputBoxXOffset += sizePerField;
+		}
+	}
+
+	Vector2I GUIVector3Field::_getOptimalSize() const
+	{
+		GUIFloatField* fields[] = { mFieldX, mFieldY, mFieldZ };
+		UINT32 numFields = sizeof(fields) / sizeof(fields[0]);
+
+		Vector2I optimalSize;
+
+		for(UINT32 i = 0; i < numFields; i++)
+		{
+			optimalSize.x += fields[i]->_getOptimalSize().x;
+			optimalSize.y = std::max(optimalSize.y, fields[i]->_getOptimalSize().y);
+		}
+
+		if(mLabel != nullptr)
+		{
+			optimalSize.x = std::max(optimalSize.x, mLabel->_getOptimalSize().x);
+			optimalSize.y += mLabel->_getOptimalSize().y;
+		}
+
+		return optimalSize;
+	}
+
+	const String& GUIVector3Field::getGUITypeName()
+	{
+		static String typeName = "GUIVector3Field";
+		return typeName;
+	}
+}

+ 2 - 2
BansheeEditor/Source/BsGUIVector4Field.cpp

@@ -146,7 +146,7 @@ namespace BansheeEditor
 			inputBoxYOffset = optimalSize.y;
 		}
 
-		GUIFloatField* fields[4] = { mFieldX, mFieldY, mFieldZ, mFieldW };
+		GUIFloatField* fields[] = { mFieldX, mFieldY, mFieldZ, mFieldW };
 		UINT32 numFields = sizeof(fields) / sizeof(fields[0]);
 
 		UINT32 sizePerField = width / numFields;
@@ -177,7 +177,7 @@ namespace BansheeEditor
 
 	Vector2I GUIVector4Field::_getOptimalSize() const
 	{
-		GUIFloatField* fields[4] = { mFieldX, mFieldY, mFieldZ, mFieldW };
+		GUIFloatField* fields[] = { mFieldX, mFieldY, mFieldZ, mFieldW };
 		UINT32 numFields = sizeof(fields) / sizeof(fields[0]);
 
 		Vector2I optimalSize;

+ 6 - 0
BansheeEditor/Source/DbgEditorWidget2.cpp

@@ -9,6 +9,8 @@
 #include "BsGUIIntField.h"
 #include "BsGUIFloatField.h"
 #include "BsGUITextField.h"
+#include "BsGUIVector2Field.h"
+#include "BsGUIVector3Field.h"
 #include "BsGUIVector4Field.h"
 #include "BsGUISpace.h"
 #include "CmHString.h"
@@ -29,11 +31,15 @@ namespace BansheeEditor
 		GUIFloatField* floatField = GUIFloatField::create(getParentWidget(), HString(L"Float Field"), GUIOptions(GUIOption::fixedWidth(200)));
 		GUITextField* textField = GUITextField::create(getParentWidget(), HString(L"Text Field"), GUIOptions(GUIOption::fixedWidth(200)));
 		GUIVector4Field* vec4Field = GUIVector4Field::create(getParentWidget(), HString(L"Vec4 Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIVector3Field* vec3Field = GUIVector3Field::create(getParentWidget(), HString(L"Vec3 Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIVector2Field* vec2Field = GUIVector2Field::create(getParentWidget(), HString(L"Vec2 Field"), GUIOptions(GUIOption::fixedWidth(200)));
 
 		layout.addElement(intField);
 		layout.addElement(floatField);
 		layout.addElement(textField);
 		layout.addElement(vec4Field);
+		layout.addElement(vec3Field);
+		layout.addElement(vec2Field);
 
 		layout.addFlexibleSpace();
 	}