]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d/src/org/simantics/g3d/scenegraph/G3DNode.java
Remove listener calls when property values not updated.
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / g3d / scenegraph / G3DNode.java
index c955dc6a3d21642bc23b4ff5b3f4420f177b74bd..7b890b39b8ae16cdd85ad19f331fffb846b6c46e 100644 (file)
@@ -11,6 +11,8 @@
  *******************************************************************************/\r
 package org.simantics.g3d.scenegraph;\r
 \r
+import java.util.Objects;\r
+\r
 import javax.vecmath.Quat4d;\r
 import javax.vecmath.Vector3d;\r
 \r
@@ -61,8 +63,11 @@ public class G3DNode extends Node implements IG3DNode {
        @SetPropertyValue(G3D.URIs.hasOrientation)\r
        public void setOrientation(Quat4d orientation) {\r
                assert(orientation != null);\r
+               if (Objects.equals(this.orientation, orientation))\r
+                       return;\r
+\r
                this.orientation = orientation;\r
-               \r
+                       \r
                firePropertyChanged(G3D.URIs.hasOrientation);\r
        }\r
        \r
@@ -77,6 +82,9 @@ public class G3DNode extends Node implements IG3DNode {
        @SetPropertyValue(G3D.URIs.hasPosition)\r
        public void setPosition(Vector3d position) {\r
                assert(position != null);\r
+               if (Objects.equals(this.position, position))\r
+                       return;\r
+               \r
                this.position = position;\r
                \r
                firePropertyChanged(G3D.URIs.hasPosition);\r
@@ -89,6 +97,11 @@ public class G3DNode extends Node implements IG3DNode {
                setPosition(new Vector3d(arr));\r
        }\r
        \r
+       public void _setPosition(Vector3d position) {\r
+               assert(position != null);\r
+               this.position = position;\r
+       }\r
+       \r
        @Override\r
        @GetPropertyValue(value = G3D.URIs.hasWorldPosition, tabId = "Transform", name = "World Position")\r
        public Vector3d getWorldPosition() {\r