X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.proconf.g3d%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Fscenegraph%2FShapeNode.java;h=52afcbc7459cce33554ab471dfbf4d66aac860e2;hb=9ad91ae4a059a4c7b219d2560c5b8b8ed1c5f184;hp=3369b5ead95e7afacde03555ca0ac9b7e646e181;hpb=54be6a9a0f71bc6c6b4c2584327264fb6053ade9;p=simantics%2F3d.git diff --git a/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ShapeNode.java b/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ShapeNode.java index 3369b5ea..52afcbc7 100644 --- a/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ShapeNode.java +++ b/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/scenegraph/ShapeNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. + * Copyright (c) 2007- VTT Technical Research Centre of Finland. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,6 +29,8 @@ import org.simantics.proconf.g3d.animation.ConstantInterpolator; import org.simantics.proconf.g3d.animation.ScalarInterpolator; import org.simantics.proconf.g3d.animation.SlerpInterpolator; import org.simantics.proconf.g3d.animation.TCBInterpolator; +import org.simantics.proconf.g3d.base.AppearanceProvider; +import org.simantics.proconf.g3d.base.AppearanceProviderRegistry; import org.simantics.proconf.g3d.base.AppearanceTools; import org.simantics.proconf.g3d.base.G3DTools; import org.simantics.proconf.g3d.base.GeometryProvider; @@ -226,7 +228,7 @@ public class ShapeNode extends AbstractGraphicsNode implements Animatable, IGeom G3DNode shape = getG3DNode(graph); - if (renderStates == null) + //if (renderStates == null) updateAppearance(shape); if (isVisible()) { @@ -258,9 +260,9 @@ public class ShapeNode extends AbstractGraphicsNode implements Animatable, IGeom } protected void updateAppearance(IEntity shape) { - Collection appearanceResource; - if ((appearanceResource = shape.getRelatedObjects(Resources.g3dResource.HasAppearance)) != null && appearanceResource.size() > 0) { - renderStates = AppearanceTools.getAppearance(new Appearance(shape.getGraph(),appearanceResource.iterator().next().getResource()), editor.getRenderingComponent().getDisplaySystem().getRenderer()); + AppearanceProvider provider = AppearanceProviderRegistry.getAppearanceProvider(shape); + if (provider != null) { + renderStates = provider.getAppearanceFromResource(shape, editor.getRenderingComponent().getDisplaySystem().getRenderer()); } else { renderStates = getMaterial(); }