Hi,
I got definitly a situation where I need to get one shape by name.
Ta-Re and I used to modify the code from FaceList and OBJGroup to solve our problem.
It is not a good solution, so maybe someone will find a better way.
@Override
public Group build(VertexList verts, TexList texs, NormalList normals, LoadedGraph<? super GroupNode> graph, int flags)
{
Group group = new Group();
Group superGroup = super.build(verts, texs, normals, graph, flags, shapeName);
for (int i = 0; i < groups.size(); i++) {
Group childGroup = groups.get(i).build(verts, texs, normals, graph, flags);
shapeName = groups.get(i).name;
if (childGroup != null) {
group.addChild(childGroup);
childGroup.setName(name);
}
}
if (superGroup != null) {
group.addChild(superGroup);
superGroup.setName(name);
}
if(name != null && !name.equals("top")) {
graph.getNamedObjects().put(name, group);
}
return group;
}
That's the modifikation in OBJGroup, therefore a static String shapeName is needed.
If super is called it will deliver the shapeName variable.
In Facelist we overload the method and added a shape.setName(name) after the shapeconstruction.
As long as the obj-files wont change that much, it will work.