예제 #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;
 }
예제 #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);
    }
  }
예제 #3
0
  public void createChildren(ModelBase base) {
    for (CubeInfo child : getChildren()) {
      child.modelCube = new ModelRenderer(base, child.txOffset[0], child.txOffset[1]);
      child.modelCube.mirror = child.txMirror;
      child.modelCube.addBox(
          (float) child.offset[0],
          (float) child.offset[1],
          (float) child.offset[2],
          child.dimensions[0],
          child.dimensions[1],
          child.dimensions[2]);
      child.modelCube.setRotationPoint(
          (float) child.position[0], (float) child.position[1], (float) child.position[2]);
      child.modelCube.rotateAngleX = (float) Math.toRadians(child.rotation[0]);
      child.modelCube.rotateAngleY = (float) Math.toRadians(child.rotation[1]);
      child.modelCube.rotateAngleZ = (float) Math.toRadians(child.rotation[2]);

      this.modelCube.addChild(child.modelCube);

      child.createChildren(base);
    }
  }
예제 #4
0
 public void removeChild(CubeInfo info) {
   children.remove(info);
   if (info.parentIdentifier != null && info.parentIdentifier.equals(identifier)) {
     info.parentIdentifier = null;
   }
 }