node.getChildren().forEach(child -> { final String material = processSpatialMaterial(child, replaceExisting); if (material != null) { node.getChildren().forEach(child -> { final String material = kidMaterials.get(child); if (!mostUsed.equals(material)) {
private static Spatial makeCopy(final Spatial source, final Spatial parent, final CopyLogic logic) { final AtomicBoolean recurse = new AtomicBoolean(); final Spatial result = logic.copy(source, recurse); if (recurse.get() && source instanceof Node && result instanceof Node && ((Node) source).getNumberOfChildren() > 0) { for (final Spatial child : ((Node) source).getChildren()) { final Spatial copy = makeCopy(child, result, logic); if (copy != null) { ((Node) result).attachChild(copy); } } } return result; }
@Override public Node makeInstanced() { // get copy of basic spatial info final Node node = (Node) super.makeInstanced(); // add copy of children for (final Spatial child : getChildren()) { final Spatial copy = child.makeInstanced(); node.attachChild(copy); } return node; }
private static Spatial makeCopy(final Spatial source, final Spatial parent, final CopyLogic logic) { final AtomicBoolean recurse = new AtomicBoolean(); final Spatial result = logic.copy(source, recurse); if (recurse.get() && source instanceof Node && result instanceof Node && ((Node) source).getNumberOfChildren() > 0) { for (final Spatial child : ((Node) source).getChildren()) { final Spatial copy = makeCopy(child, result, logic); if (copy != null) { ((Node) result).attachChild(copy); } } } return result; }
@Override public Node makeCopy(final boolean shareGeometricData) { // get copy of basic spatial info final Node node = (Node) super.makeCopy(shareGeometricData); // add copy of children for (final Spatial child : getChildren()) { final Spatial copy = child.makeCopy(shareGeometricData); node.attachChild(copy); } // return return node; }
@Override public Node makeInstanced() { // get copy of basic spatial info final Node node = (Node) super.makeInstanced(); // add copy of children for (final Spatial child : getChildren()) { final Spatial copy = child.makeInstanced(); node.attachChild(copy); } return node; }
@Override public Node makeCopy(final boolean shareGeometricData) { // get copy of basic spatial info final Node node = (Node) super.makeCopy(shareGeometricData); // add copy of children for (final Spatial child : getChildren()) { final Spatial copy = child.makeCopy(shareGeometricData); node.attachChild(copy); } // return return node; }
/** * creates a new collision tree for the provided spatial. If the spatial is a node, it recursively calls * generateCollisionTree for each child. If it is a Mesh, a call to generateCollisionTree is made for each mesh. If * this tree(s) is to be protected, i.e. not deleted by the CollisionTreeController, set protect to true. * * @param type * the type of collision tree to generate. * @param object * the Spatial to generate tree(s) for. * @param protect * true to keep these trees from being removed, false otherwise. */ public void generateCollisionTree(final CollisionTree.Type type, final Spatial object, final boolean protect) { if (object instanceof Mesh) { generateCollisionTree(type, (Mesh) object, protect); } if (object instanceof Node) { if (((Node) object).getNumberOfChildren() > 0) { for (final Spatial sp : ((Node) object).getChildren()) { generateCollisionTree(type, sp, protect); } } } }
/** * creates a new collision tree for the provided spatial. If the spatial is a node, it recursively calls * generateCollisionTree for each child. If it is a Mesh, a call to generateCollisionTree is made for each mesh. If * this tree(s) is to be protected, i.e. not deleted by the CollisionTreeController, set protect to true. * * @param type * the type of collision tree to generate. * @param object * the Spatial to generate tree(s) for. * @param protect * true to keep these trees from being removed, false otherwise. */ public void generateCollisionTree(final CollisionTree.Type type, final Spatial object, final boolean protect) { if (object instanceof Mesh) { generateCollisionTree(type, (Mesh) object, protect); } if (object instanceof Node) { if (((Node) object).getNumberOfChildren() > 0) { for (final Spatial sp : ((Node) object).getChildren()) { generateCollisionTree(type, sp, protect); } } } }
for (final Spatial spat : meshNode.getChildren()) { if (spat instanceof Mesh && ((Mesh) spat).getMeshData().getVertexCount() > 0) { final Mesh sourceMesh = (Mesh) spat;