Просмотр исходного кода

Fixed constant unnecessary GUI updates
Fixed C# inspectable objects getting created and immediately updated

Marko Pintera 11 лет назад
Родитель
Сommit
f6fc8e996f

+ 2 - 2
BansheeEditor/Source/BsMainEditorWindow.cpp

@@ -79,8 +79,8 @@ namespace BansheeEngine
 		AABox dbgBox(Vector3(-300, -200, 1000), Vector3(300, 300, 1500));
 		AABox dbgBox(Vector3(-300, -200, 1000), Vector3(300, 300, 1500));
 		//DrawHelper3D::instance().drawAABox(sceneCamera, dbgBox, Color::Green, 250.0f);
 		//DrawHelper3D::instance().drawAABox(sceneCamera, dbgBox, Color::Green, 250.0f);
 
 
-		mProfilerOverlay = mSceneObject->addComponent<ProfilerOverlay>(sceneCamera->getViewport());
-		mProfilerOverlay->show(ProfilerOverlayType::CPUSamples);
+		//mProfilerOverlay = mSceneObject->addComponent<ProfilerOverlay>(sceneCamera->getViewport());
+		//mProfilerOverlay->show(ProfilerOverlayType::CPUSamples);
 
 
 		TestSuitePtr testSuite = TestSuite::create<EditorTestSuite>();
 		TestSuitePtr testSuite = TestSuite::create<EditorTestSuite>();
 		testSuite->run(ExceptionTestOutput());
 		testSuite->run(ExceptionTestOutput());

+ 2 - 2
BansheeEngine/Include/BsGUIElementBase.h

@@ -167,14 +167,14 @@ namespace BansheeEngine
 		 *
 		 *
 		 * @note	Internal method.
 		 * @note	Internal method.
 		 */
 		 */
-		bool _isContentDirty() const;
+		virtual bool _isContentDirty() const;
 
 
 		/**
 		/**
 		 * @brief	Returns true if mesh has changed and fillBuffers needs to be called.
 		 * @brief	Returns true if mesh has changed and fillBuffers needs to be called.
 		 *
 		 *
 		 * @note	Internal method.
 		 * @note	Internal method.
 		 */
 		 */
-		bool _isMeshDirty() const; 
+		virtual bool _isMeshDirty() const; 
 
 
 		/**
 		/**
 		 * @brief	Returns true if element is disabled and won't be visible or interactable.
 		 * @brief	Returns true if element is disabled and won't be visible or interactable.

+ 20 - 0
BansheeEngine/Include/BsGUISpace.h

@@ -43,6 +43,16 @@ namespace BansheeEngine
 		 */
 		 */
 		virtual Vector2I _calculateOptimalLayoutSize() const { return _getOptimalSize(); }
 		virtual Vector2I _calculateOptimalLayoutSize() const { return _getOptimalSize(); }
 
 
+		/**
+		 * @copydoc	GUIElementBase::_isContentDirty
+		 */
+		virtual bool _isContentDirty() const { return false; }
+
+		/**
+		 * @copydoc	GUIElementBase::_isMeshDirty
+		 */
+		virtual bool _isMeshDirty() const { return false; }
+
 		/**
 		/**
 		 * @copydoc	GUIElementBase::_getPadding
 		 * @copydoc	GUIElementBase::_getPadding
 		 */
 		 */
@@ -90,6 +100,16 @@ namespace BansheeEngine
 		 */
 		 */
 		virtual Vector2I _calculateOptimalLayoutSize() const { return _getOptimalSize(); }
 		virtual Vector2I _calculateOptimalLayoutSize() const { return _getOptimalSize(); }
 
 
+		/**
+		 * @copydoc	GUIElementBase::_isContentDirty
+		 */
+		virtual bool _isContentDirty() const { return false; }
+
+		/**
+		 * @copydoc	GUIElementBase::_isMeshDirty
+		 */
+		virtual bool _isMeshDirty() const { return false; }
+
 		/**
 		/**
 		 * @copydoc	GUIElementBase::_getPadding
 		 * @copydoc	GUIElementBase::_getPadding
 		 */
 		 */

+ 4 - 4
BansheeEngine/Source/BsGUIElement.cpp

@@ -15,10 +15,7 @@ namespace BansheeEngine
 	}
 	}
 
 
 	GUIElement::~GUIElement()
 	GUIElement::~GUIElement()
-	{
-		if(mParentElement != nullptr)
-			mParentElement->_unregisterChildElement(this);
-	}
+	{ }
 
 
 	void GUIElement::updateRenderElements()
 	void GUIElement::updateRenderElements()
 	{
 	{
@@ -301,6 +298,9 @@ namespace BansheeEngine
 		if(element->mParentWidget != nullptr)
 		if(element->mParentWidget != nullptr)
 			element->mParentWidget->unregisterElement(element);
 			element->mParentWidget->unregisterElement(element);
 
 
+		if (element->mParentElement != nullptr)
+			element->mParentElement->_unregisterChildElement(element);
+
 		element->mIsDestroyed = true;
 		element->mIsDestroyed = true;
 
 
 		GUIManager::instance().queueForDestroy(element);
 		GUIManager::instance().queueForDestroy(element);

+ 2 - 2
BansheeEngine/Source/BsGUIElementBase.cpp

@@ -15,12 +15,12 @@ namespace BansheeEngine
 
 
 	GUIElementBase::~GUIElementBase()
 	GUIElementBase::~GUIElementBase()
 	{
 	{
-		for (auto& child : mChildren)
+		Vector<GUIElementBase*> childCopy = mChildren;
+		for (auto& child : childCopy)
 		{
 		{
 			if (child->_getType() == GUIElementBase::Type::Element)
 			if (child->_getType() == GUIElementBase::Type::Element)
 			{
 			{
 				GUIElement* element = static_cast<GUIElement*>(child);
 				GUIElement* element = static_cast<GUIElement*>(child);
-				element->_setParent(nullptr);
 				GUIElement::destroy(element);
 				GUIElement::destroy(element);
 			}
 			}
 			else
 			else

+ 4 - 7
MBansheeEditor/Inspector/InspectableArray.cs

@@ -51,7 +51,7 @@ namespace BansheeEditor
 
 
         private const int IndentAmount = 15;
         private const int IndentAmount = 15;
 
 
-        private object oldPropertyValue; // TODO - This will unnecessarily hold references to the object
+        private object propertyValue; // TODO - This will unnecessarily hold references to the object
         private int numArrayElements;
         private int numArrayElements;
 
 
         private List<EntryRow> rows = new List<EntryRow>();
         private List<EntryRow> rows = new List<EntryRow>();
@@ -71,12 +71,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             object newPropertyValue = property.GetValue<object>();
             object newPropertyValue = property.GetValue<object>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             if (newPropertyValue != null)
             if (newPropertyValue != null)
             {
             {
@@ -103,7 +99,8 @@ namespace BansheeEditor
 
 
             layout.DestroyElements();
             layout.DestroyElements();
 
 
-            if (property.GetValue<object>() == null)
+            propertyValue = property.GetValue<object>();
+            if (propertyValue == null)
             {
             {
                 GUILayoutX guiChildLayout = layout.AddLayoutX(layoutIndex);
                 GUILayoutX guiChildLayout = layout.AddLayoutX(layoutIndex);
 
 

+ 4 - 7
MBansheeEditor/Inspector/InspectableBool.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableBool : InspectableObjectBase
     public class InspectableBool : InspectableObjectBase
     {
     {
-        private bool oldPropertyValue;
+        private bool propertyValue;
         private GUIToggleField guiField;
         private GUIToggleField guiField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             bool newPropertyValue = property.GetValue<bool>();
             bool newPropertyValue = property.GetValue<bool>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -55,8 +51,9 @@ namespace BansheeEditor
             if (!isInitialized)
             if (!isInitialized)
                 Initialize(layoutIndex);
                 Initialize(layoutIndex);
 
 
+            propertyValue = property.GetValue<bool>();
             if (guiField != null)
             if (guiField != null)
-                guiField.Value = property.GetValue<bool>();
+                guiField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(bool newValue)
         private void OnFieldValueChanged(bool newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableColor.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableColor : InspectableObjectBase
     public class InspectableColor : InspectableObjectBase
     {
     {
-        private Color oldPropertyValue;
+        private Color propertyValue;
         private GUIColorField guiField;
         private GUIColorField guiField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             Color newPropertyValue = property.GetValue<Color>();
             Color newPropertyValue = property.GetValue<Color>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -57,8 +53,9 @@ namespace BansheeEditor
 
 
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
 
 
+            propertyValue = property.GetValue<Color>();
             if (guiField != null)
             if (guiField != null)
-                guiField.Value = property.GetValue<Color>();
+                guiField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(Color newValue)
         private void OnFieldValueChanged(Color newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableFloat.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableFloat : InspectableObjectBase
     public class InspectableFloat : InspectableObjectBase
     {
     {
-        private float oldPropertyValue;
+        private float propertyValue;
         private GUIFloatField guiFloatField;
         private GUIFloatField guiFloatField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             float newPropertyValue = property.GetValue<float>();
             float newPropertyValue = property.GetValue<float>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -57,8 +53,9 @@ namespace BansheeEditor
 
 
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
 
 
+            propertyValue = property.GetValue<float>();
             if (guiFloatField != null)
             if (guiFloatField != null)
-                guiFloatField.Value = property.GetValue<float>();
+                guiFloatField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(float newValue)
         private void OnFieldValueChanged(float newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableGameObjectRef.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableGameObjectRef : InspectableObjectBase
     public class InspectableGameObjectRef : InspectableObjectBase
     {
     {
-        private GameObject oldPropertyValue;
+        private GameObject propertyValue;
         private GUIGameObjectField guiField;
         private GUIGameObjectField guiField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             GameObject newPropertyValue = property.GetValue<GameObject>();
             GameObject newPropertyValue = property.GetValue<GameObject>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -55,8 +51,9 @@ namespace BansheeEditor
             if (!isInitialized)
             if (!isInitialized)
                 Initialize(layoutIndex);
                 Initialize(layoutIndex);
 
 
+            propertyValue = property.GetValue<GameObject>();
             if (guiField != null)
             if (guiField != null)
-                guiField.Value = property.GetValue<GameObject>();
+                guiField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(GameObject newValue)
         private void OnFieldValueChanged(GameObject newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableInt.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableInt : InspectableObjectBase
     public class InspectableInt : InspectableObjectBase
     {
     {
-        private int oldPropertyValue;
+        private int propertyValue;
         private GUIIntField guiIntField;
         private GUIIntField guiIntField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             int newPropertyValue = property.GetValue<int>();
             int newPropertyValue = property.GetValue<int>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -57,8 +53,9 @@ namespace BansheeEditor
 
 
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
 
 
+            propertyValue = property.GetValue<int>();
             if(guiIntField != null)
             if(guiIntField != null)
-                guiIntField.Value = property.GetValue<int>();
+                guiIntField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(int newValue)
         private void OnFieldValueChanged(int newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableList.cs

@@ -51,7 +51,7 @@ namespace BansheeEditor
 
 
         private const int IndentAmount = 15;
         private const int IndentAmount = 15;
 
 
-        private object oldPropertyValue; // TODO - This will unnecessarily hold references to the object
+        private object propertyValue; // TODO - This will unnecessarily hold references to the object
         private int numArrayElements;
         private int numArrayElements;
 
 
         private GUIIntField guiSizeField;
         private GUIIntField guiSizeField;
@@ -71,12 +71,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             object newPropertyValue = property.GetValue<object>();
             object newPropertyValue = property.GetValue<object>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             if (newPropertyValue != null)
             if (newPropertyValue != null)
             {
             {
@@ -102,7 +98,8 @@ namespace BansheeEditor
 
 
             rows.Clear();
             rows.Clear();
 
 
-            if (property.GetValue<object>() == null)
+            propertyValue = property.GetValue<object>();
+            if (propertyValue == null)
             {
             {
                 GUILayoutX guiChildLayout = layout.AddLayoutX(layoutIndex);
                 GUILayoutX guiChildLayout = layout.AddLayoutX(layoutIndex);
 
 

+ 4 - 7
MBansheeEditor/Inspector/InspectableObject.cs

@@ -11,7 +11,7 @@ namespace BansheeEditor
     {
     {
         private const int IndentAmount = 15;
         private const int IndentAmount = 15;
 
 
-        private object oldPropertyValue;
+        private object propertyValue;
         private bool isInitialized;
         private bool isInitialized;
 
 
         public InspectableObject(string title, InspectableFieldLayout layout, SerializableProperty property)
         public InspectableObject(string title, InspectableFieldLayout layout, SerializableProperty property)
@@ -26,12 +26,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             object newPropertyValue = property.GetValue<object>();
             object newPropertyValue = property.GetValue<object>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -46,7 +42,8 @@ namespace BansheeEditor
 
 
             layout.DestroyElements();
             layout.DestroyElements();
 
 
-            if (property.GetValue<object>() == null)
+            propertyValue = property.GetValue<object>();
+            if (propertyValue == null)
             {
             {
                 GUILayoutX guiChildLayout = layout.AddLayoutX(index);
                 GUILayoutX guiChildLayout = layout.AddLayoutX(index);
 
 

+ 4 - 7
MBansheeEditor/Inspector/InspectableResourceRef.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableResourceRef : InspectableObjectBase
     public class InspectableResourceRef : InspectableObjectBase
     {
     {
-        private Resource oldPropertyValue;
+        private Resource propertyValue;
         private GUIResourceField guiField;
         private GUIResourceField guiField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             Resource newPropertyValue = property.GetValue<Resource>();
             Resource newPropertyValue = property.GetValue<Resource>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -55,8 +51,9 @@ namespace BansheeEditor
             if (!isInitialized)
             if (!isInitialized)
                 Initialize(layoutIndex);
                 Initialize(layoutIndex);
 
 
+            propertyValue = property.GetValue<Resource>();
             if (guiField != null)
             if (guiField != null)
-                guiField.Value = property.GetValue<Resource>();
+                guiField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(Resource newValue)
         private void OnFieldValueChanged(Resource newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableString.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableString : InspectableObjectBase
     public class InspectableString : InspectableObjectBase
     {
     {
-        private string oldPropertyValue;
+        private string propertyValue;
         private GUITextField guiField;
         private GUITextField guiField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             string newPropertyValue = property.GetValue<string>();
             string newPropertyValue = property.GetValue<string>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -57,8 +53,9 @@ namespace BansheeEditor
 
 
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
 
 
+            propertyValue = property.GetValue<string>();
             if (guiField != null)
             if (guiField != null)
-                guiField.Value = property.GetValue<string>();
+                guiField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(string newValue)
         private void OnFieldValueChanged(string newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableVector2.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableVector2 : InspectableObjectBase
     public class InspectableVector2 : InspectableObjectBase
     {
     {
-        private Vector2 oldPropertyValue;
+        private Vector2 propertyValue;
         private GUIVector2Field guiField;
         private GUIVector2Field guiField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             Vector2 newPropertyValue = property.GetValue<Vector2>();
             Vector2 newPropertyValue = property.GetValue<Vector2>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -57,8 +53,9 @@ namespace BansheeEditor
 
 
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
 
 
+            propertyValue = property.GetValue<Vector2>();
             if (guiField != null)
             if (guiField != null)
-                guiField.Value = property.GetValue<Vector2>();
+                guiField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(Vector2 newValue)
         private void OnFieldValueChanged(Vector2 newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableVector3.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableVector3 : InspectableObjectBase
     public class InspectableVector3 : InspectableObjectBase
     {
     {
-        private Vector3 oldPropertyValue;
+        private Vector3 propertyValue;
         private GUIVector3Field guiField;
         private GUIVector3Field guiField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             Vector3 newPropertyValue = property.GetValue<Vector3>();
             Vector3 newPropertyValue = property.GetValue<Vector3>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -57,8 +53,9 @@ namespace BansheeEditor
 
 
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
 
 
+            propertyValue = property.GetValue<Vector3>();
             if (guiField != null)
             if (guiField != null)
-                guiField.Value = property.GetValue<Vector3>();
+                guiField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(Vector3 newValue)
         private void OnFieldValueChanged(Vector3 newValue)

+ 4 - 7
MBansheeEditor/Inspector/InspectableVector4.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
 {
 {
     public class InspectableVector4 : InspectableObjectBase
     public class InspectableVector4 : InspectableObjectBase
     {
     {
-        private Vector4 oldPropertyValue;
+        private Vector4 propertyValue;
         private GUIVector4Field guiField;
         private GUIVector4Field guiField;
         private bool isInitialized;
         private bool isInitialized;
 
 
@@ -38,12 +38,8 @@ namespace BansheeEditor
                 return true;
                 return true;
 
 
             Vector4 newPropertyValue = property.GetValue<Vector4>();
             Vector4 newPropertyValue = property.GetValue<Vector4>();
-            if (oldPropertyValue != newPropertyValue)
-            {
-                oldPropertyValue = newPropertyValue;
-
+            if (propertyValue != newPropertyValue)
                 return true;
                 return true;
-            }
 
 
             return base.IsModified();
             return base.IsModified();
         }
         }
@@ -57,8 +53,9 @@ namespace BansheeEditor
 
 
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
             // TODO - Skip update if it currently has input focus so user can modify the value in peace
 
 
+            propertyValue = property.GetValue<Vector4>();
             if (guiField != null)
             if (guiField != null)
-                guiField.Value = property.GetValue<Vector4>();
+                guiField.Value = propertyValue;
         }
         }
 
 
         private void OnFieldValueChanged(Vector4 newValue)
         private void OnFieldValueChanged(Vector4 newValue)