Ejemplo n.º 1
0
 public void addChild(CubeInfo info) {
   children.add(info);
   info.scale = new double[] {1D, 1D, 1D};
   info.mcScale = 0.0D;
   info.opacity = opacity;
   info.parentIdentifier = identifier;
   info.hidden = false;
 }
Ejemplo n.º 2
0
  @Override
  public void elementTriggered(Element element) {
    if (element.id == 0) {
      if (((GuiWorkspace) workspace).hasOpenProject()) {
        ((GuiWorkspace) workspace).getOpenProject().ghostModel = null;
        for (int i = 0; i < modelList.trees.size(); i++) {
          ElementListTree.Tree tree = modelList.trees.get(i);
          tree.selected = false;
        }
      }
    }
    if ((element.id == 1 || element.id == 3)) {
      for (int i = 0; i < modelList.trees.size(); i++) {
        ElementListTree.Tree tree = modelList.trees.get(i);
        if (tree.selected) {
          if (workspace.windowDragged == this) {
            workspace.windowDragged = null;
          }
          ProjectInfo project = ImportList.createProjectFromFile((File) tree.attachedObject);
          if (project == null) {
            workspace.addWindowOnTop(
                new WindowPopup(workspace, 0, 0, 180, 80, 180, 80, "window.open.failed")
                    .putInMiddleOfScreen());
          } else {
            project.repair();

            if (((GuiWorkspace) workspace).hasOpenProject()) {
              if (((GuiWorkspace) workspace).getOpenProject().ghostModel != null) {
                ((GuiWorkspace) workspace).getOpenProject().ghostModel.destroy();
              }
              ((GuiWorkspace) workspace).getOpenProject().ghostModel = project;
              for (Element e : elements) {
                if (e instanceof ElementToggle) {
                  if (!((ElementToggle) e).toggledState) {
                    project.bufferedTexture = null;
                  }
                } else if (e instanceof ElementNumberInput) {
                  ArrayList<CubeInfo> cubes = project.getAllCubes();
                  for (CubeInfo cube : cubes) {
                    cube.opacity =
                        Double.parseDouble(((ElementNumberInput) e).textFields.get(0).getText());
                  }
                }
              }
            }
          }
          break;
        }
      }

      workspace.removeWindow(this, true);
    }
  }