changeset 4023:d3b9acbe766c

3DViewer MayaImporter: Not loading empty meshes again.
author Alexander Kouznetsov
date Thu, 20 Jun 2013 17:04:20 -0700
parents 7f7c5a705ee7
children b792789577f4
files apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/maya/Loader.java apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/maya/MayaImporter.java
diffstat 2 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/maya/Loader.java	Thu Jun 20 11:50:27 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/maya/Loader.java	Thu Jun 20 17:04:20 2013 -0700
@@ -466,21 +466,21 @@
                 ((Group) node).getChildren().add(mv);
             }
         } else {
-//            if (((TriangleMesh)mesh).getPoints().size() > 0) {
-                MeshView mv = new MeshView();
-                mv.setId(n.getName());
-                mv.setMaterial(material);
+            MeshView mv = new MeshView();
+            mv.setId(n.getName());
+            mv.setMaterial(material);
 
-    //            // TODO HACK for [JIRA] (RT-30449) FX 8 3D: Need to handle mirror transformation (flip culling);
-    //            mv.setCullFace(CullFace.FRONT);
+//            // TODO HACK for [JIRA] (RT-30449) FX 8 3D: Need to handle mirror transformation (flip culling);
+//            mv.setCullFace(CullFace.FRONT);
 
-                mv.setMesh((TriangleMesh) mesh);
+            mv.setMesh((TriangleMesh) mesh);
 
-                loaded.put(n, mv);
+            loaded.put(n, mv);
+            if (((TriangleMesh)mesh).getPoints().size() > 0) {
                 if (node != null) {
                     ((Group) node).getChildren().add(mv);
                 }
-//            }
+            }
         }
     }
             
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/maya/MayaImporter.java	Thu Jun 20 11:50:27 2013 -0700
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/maya/MayaImporter.java	Thu Jun 20 17:04:20 2013 -0700
@@ -38,10 +38,10 @@
 import javafx.animation.KeyFrame;
 import javafx.animation.KeyValue;
 import javafx.animation.Timeline;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
 import javafx.scene.DepthTest;
 import javafx.scene.Node;
+import javafx.scene.shape.MeshView;
+import javafx.scene.shape.TriangleMesh;
 
 /**
  * MayaImporter
@@ -108,7 +108,9 @@
                             System.out.println("Adding top level node " + n.getId() + " to root!");
                         }
                         n.setDepthTest(DepthTest.ENABLE);
-                        root.getChildren().add(n);
+                        if (!(n instanceof MeshView) || ((TriangleMesh)((MeshView)n).getMesh()).getPoints().size() > 0) {
+                            root.getChildren().add(n);
+                        }
                     }
                     nodeCount++;
                 }