Commit c1f6af77 authored by Thilo Rörig's avatar Thilo Rörig

changed behaviour of import of obj-file containing a single geometry

parent 14f31aeb
......@@ -914,16 +914,29 @@ public class HalfedgeInterface extends ShrinkPanelPlugin implements
ReaderOBJ reader = new ReaderOBJ();
SceneGraphComponent c = reader.read(selectedFile);
// layers.remove(activeLayer);
for(SceneGraphComponent s : c.getChildComponents()) {
Geometry g = SceneGraphUtility.getFirstGeometry(s);
List<SceneGraphComponent> childComponents = c.getChildComponents();
if(childComponents.size() == 1) {
Geometry g = SceneGraphUtility.getFirstGeometry(c);
if (g == null)
continue;
return;
if (g instanceof IndexedFaceSet) {
HalfedgeLayer l = createLayer(s.getName());
HalfedgeLayer l = getActiveLayer();
IndexedFaceSet ifs = (IndexedFaceSet) g;
IndexedFaceSetUtility.calculateAndSetNormals(ifs);
l.set(ifs);
}
} else {
for(SceneGraphComponent s : childComponents) {
Geometry g = SceneGraphUtility.getFirstGeometry(s);
if (g == null)
continue;
if (g instanceof IndexedFaceSet) {
HalfedgeLayer l = createLayer(s.getName());
IndexedFaceSet ifs = (IndexedFaceSet) g;
IndexedFaceSetUtility.calculateAndSetNormals(ifs);
l.set(ifs);
}
}
}
activateLayer(layers.get(0));
} else if (selectedFile.getName().toLowerCase().endsWith(".heml")) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment