Пример #1
0
 private void removeEmptyGroups() {
   for (Parent p : emptyParents) {
     Parent parent = p.getParent();
     Group g = (Group) parent;
     g.getChildren().addAll(p.getChildrenUnmodifiable());
     g.getChildren().remove(p);
   }
 }
Пример #2
0
 private void optimize(Node node) {
   ObservableList<Transform> transforms = node.getTransforms();
   Iterator<Transform> iterator = transforms.iterator();
   boolean prevIsStatic = false;
   while (iterator.hasNext()) {
     Transform transform = iterator.next();
     trTotal++;
     if (transform.isIdentity()) {
       if (timeline == null || !bound.contains(transform)) {
         iterator.remove();
         trRemoved++;
       }
     } else {
       if (timeline == null || !bound.contains(transform)) {
         if (prevIsStatic) {
           trCandidate++;
         }
         prevIsStatic = true;
       } else {
         prevIsStatic = false;
       }
     }
   }
   if (node instanceof Parent) {
     groupsTotal++;
     Parent p = (Parent) node;
     for (Node n : p.getChildrenUnmodifiable()) {
       optimize(n);
     }
     if (transforms.isEmpty()) {
       Parent parent = p.getParent();
       if (parent instanceof Group) {
         trEmpty++;
         //                    System.out.println("Empty group = " + node.getId());
         emptyParents.add(p);
       } else {
         //                    System.err.println("parent is not group = " + parent);
       }
     }
   }
   if (node instanceof MeshView) {
     meshViews.add((MeshView) node);
   }
 }