|
|
@ -206,43 +206,18 @@ public class SkeletonControl extends AbstractControl implements Cloneable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void findTargets(Node node) { |
|
|
|
private void findTargets(Node node) { |
|
|
|
Mesh sharedMesh = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Spatial child : node.getChildren()) { |
|
|
|
for (Spatial child : node.getChildren()) { |
|
|
|
if (child instanceof Geometry) { |
|
|
|
if (child instanceof Geometry) { |
|
|
|
Geometry geom = (Geometry) child; |
|
|
|
Geometry geom = (Geometry) child; |
|
|
|
|
|
|
|
|
|
|
|
// is this geometry using a shared mesh?
|
|
|
|
|
|
|
|
Mesh childSharedMesh = geom.getUserData(UserData.JME_SHAREDMESH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (childSharedMesh != null) { |
|
|
|
|
|
|
|
// Don’t bother with non-animated shared meshes
|
|
|
|
|
|
|
|
if (childSharedMesh.isAnimated()) { |
|
|
|
|
|
|
|
// child is using shared mesh,
|
|
|
|
|
|
|
|
// so animate the shared mesh but ignore child
|
|
|
|
|
|
|
|
if (sharedMesh == null) { |
|
|
|
|
|
|
|
sharedMesh = childSharedMesh; |
|
|
|
|
|
|
|
} else if (sharedMesh != childSharedMesh) { |
|
|
|
|
|
|
|
throw new IllegalStateException("Two conflicting shared meshes for " + node); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
materials.add(geom.getMaterial()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Mesh mesh = geom.getMesh(); |
|
|
|
Mesh mesh = geom.getMesh(); |
|
|
|
if (mesh.isAnimated()) { |
|
|
|
if (mesh.isAnimated()) { |
|
|
|
targets.add(mesh); |
|
|
|
targets.add(mesh); |
|
|
|
materials.add(geom.getMaterial()); |
|
|
|
materials.add(geom.getMaterial()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (child instanceof Node) { |
|
|
|
} else if (child instanceof Node) { |
|
|
|
findTargets((Node) child); |
|
|
|
findTargets((Node) child); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (sharedMesh != null) { |
|
|
|
|
|
|
|
targets.add(sharedMesh); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|