]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ShapeNode.java
Set copyright texts for java files in the latest development branches.
[simantics/3d.git] / org.simantics.proconf.g3d / src / org / simantics / proconf / g3d / scenegraph / ShapeNode.java
index 3369b5ead95e7afacde03555ca0ac9b7e646e181..52afcbc7459cce33554ab471dfbf4d66aac860e2 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
  * which accompanies this distribution, and is available at\r
@@ -29,6 +29,8 @@ import org.simantics.proconf.g3d.animation.ConstantInterpolator;
 import org.simantics.proconf.g3d.animation.ScalarInterpolator;\r
 import org.simantics.proconf.g3d.animation.SlerpInterpolator;\r
 import org.simantics.proconf.g3d.animation.TCBInterpolator;\r
+import org.simantics.proconf.g3d.base.AppearanceProvider;\r
+import org.simantics.proconf.g3d.base.AppearanceProviderRegistry;\r
 import org.simantics.proconf.g3d.base.AppearanceTools;\r
 import org.simantics.proconf.g3d.base.G3DTools;\r
 import org.simantics.proconf.g3d.base.GeometryProvider;\r
@@ -226,7 +228,7 @@ public class ShapeNode extends AbstractGraphicsNode implements Animatable, IGeom
 \r
             \r
             G3DNode shape = getG3DNode(graph);\r
-            if (renderStates == null)\r
+            //if (renderStates == null)\r
                updateAppearance(shape);\r
 \r
             if (isVisible()) {\r
@@ -258,9 +260,9 @@ public class ShapeNode extends AbstractGraphicsNode implements Animatable, IGeom
     }\r
     \r
     protected void updateAppearance(IEntity shape) {\r
-       Collection<IEntity> appearanceResource;\r
-        if ((appearanceResource = shape.getRelatedObjects(Resources.g3dResource.HasAppearance)) != null && appearanceResource.size() > 0) {\r
-            renderStates = AppearanceTools.getAppearance(new Appearance(shape.getGraph(),appearanceResource.iterator().next().getResource()), editor.getRenderingComponent().getDisplaySystem().getRenderer());\r
+       AppearanceProvider provider = AppearanceProviderRegistry.getAppearanceProvider(shape);\r
+        if (provider != null) {\r
+            renderStates = provider.getAppearanceFromResource(shape, editor.getRenderingComponent().getDisplaySystem().getRenderer());\r
         } else {\r
                renderStates = getMaterial();\r
         }\r