From c8bb659043bfa0ccf9436d7cbbc49255b4c82402 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Tue, 03 Sep 2019 22:31:10 -0400 Subject: [PATCH] Paste expand. --- GroupEditor.java | 817 +++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 551 insertions(+), 266 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index e5c5470..5f68a81 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -16,6 +16,7 @@ //import buoy.widget.BFileChooser; class GroupEditor extends ObjEditor implements //iParse, //iCallBack, + Grafreed.iResourceCallBack, ObjectUI, Runnable, ActionListener, @@ -28,9 +29,9 @@ { cButton skyboxButton; final String path = "cubemaps/" + f + "-skyboxes/" + s; - row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); + row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF)); //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); - skyboxButton.setToolTipText(s); + skyboxButton.setToolTipText(s.equals("") ? "No background" : s); skyboxButton.addActionListener(new ActionListener() { @Override @@ -41,6 +42,22 @@ }); } + public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) + { + cButton textureButton; + final String path = "textures/" + f + "/" + c + "/"; // + t; + row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF)); + textureButton.setToolTipText(c + count); + textureButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ChangeTexture(path + t); + } + }); + } + public void AddSkyboxTab0(JTabbedPane skyboxpanel) { cGridBag tab0 = new cGridBag().setVertical(true); @@ -56,7 +73,7 @@ cGridBag row5 = new cGridBag(); cGridBag row6 = new cGridBag(); - AddSkyboxButton("default", "rgb", row0); + AddSkyboxButton("default", "", row0); //AddSkyboxButton("default", "cornell", row0); AddSkyboxButton("penguins", "dust", row0); AddSkyboxButton("penguins", "tropic", row0); @@ -311,14 +328,46 @@ } } - public void ChangeSkybox(String name) + public void ChangeSkybox(String skybox) { - //cameraView.envyoff = false; - group.skyboxname = name; - group.skyboxext = "jpg"; - cameraView.repaint(); + if (skybox.endsWith("/")) + { + group.skyboxname = null; + group.skyboxext = null; + cameraView.repaint(); + } + else + { + //cameraView.envyoff = false; + group.skyboxname = skybox; + group.skyboxext = "jpg"; + cameraView.repaint(); + } + } + + public void CreateSkyboxPanel(cGridBag skyboxPanel) + { + JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT); + + AddSkyboxTab0(skyboxpane); + AddSkyboxTab1(skyboxpane); + AddSkyboxTab2(skyboxpane); + AddSkyboxTab3(skyboxpane); + + skyboxPanel.add(skyboxpane); } + public void ChangeTexture(String texture) + { + for (int i=0; i<group.selection.size(); i++) + { + Object3D obj = group.selection.get(i); + obj.SetPigmentTexture("@" + texture); + } + + refreshContents(); + } + //ObjEditor objEditor; public void closeUI2() { @@ -356,11 +405,15 @@ this.copy = this.group = group; //selectees = this.group.selectees; - if (copy.versions == null) - { - copy.versions = new Object3D[100]; - copy.versionindex = -1; - } + assert(false); + +// if (copy.versionlist == null) +// { +// copy.versionlist = new Object3D[100]; +// copy.versionindex = -1; +// +// //Save(true); +// } if(ui) SetupUI(objEditor); @@ -383,13 +436,13 @@ ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); - if (copy.versions == null) - { - copy.versions = new Object3D[100]; - copy.versionindex = -1; - - Save(true); - } +// if (copy.versionlist == null) +// { +// copy.versionlist = new Object3D[100]; +// copy.versionindex = -1; +// +// //Save(true); +// } } void CloneSelection(boolean supports) @@ -479,33 +532,37 @@ // menu.add("-"); duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); duplicateItem.addActionListener(this); - cloneItem = menu.add(new MenuItem("Clone")); + + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); cloneItem.addActionListener(this); - if (Globals.ADVANCED) + //if (Globals.ADVANCED) { cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); cloneSupportItem.addActionListener(this); } + oe.jTree.popup.addSeparator(); menu.add("-"); - cutItem = menu.add(new MenuItem("Cut")); + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); cutItem.addActionListener(this); - copyItem = menu.add(new MenuItem("Copy")); + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); copyItem.addActionListener(this); pasteItem = menu.add(new MenuItem("Paste")); pasteItem.addActionListener(this); - menu.add("-"); - pasteIntoItem = menu.add(new MenuItem("Paste into")); + oe.jTree.popup.addSeparator(); + //menu.add("-"); + pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into")); pasteIntoItem.addActionListener(this); - pasteLinkItem = menu.add(new MenuItem("Paste link")); + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); pasteLinkItem.addActionListener(this); - pasteCloneItem = menu.add(new MenuItem("Paste clone")); + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); pasteCloneItem.addActionListener(this); -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); -// pasteExpandItem.addActionListener(this); - menu.add("-"); - deleteItem = menu.add(new MenuItem("Delete")); - deleteItem.addActionListener(this); +// CRASH + pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); +// + pasteExpandItem.addActionListener(this); + //menu.add("-"); + oe.jTree.popup.addSeparator(); if (Globals.ADVANCED) { @@ -591,11 +648,9 @@ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); oe.cameraMenu.add("-"); openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); openWindowItem.addActionListener(this); - editLeafItem.addActionListener(this); lookAtItem.addActionListener(this); //lookFromItem.addActinoListener(this); //switchViewItem.addActionListener(this); @@ -642,9 +697,8 @@ setMasterItem.addActionListener(this); } - oe.menuBar.add(menu = new Menu("Group")); -// grabItem = menu.add(new MenuItem("Grab")); -// grabItem.addActionListener(this); + oe.menuBar.add(menu = new Menu("Order")); + backItem = menu.add(new MenuItem("Back")); backItem.addActionListener(this); frontItem = menu.add(new MenuItem("Front")); @@ -652,13 +706,21 @@ // compositeItem = menu.add(new MenuItem("Composite")); // compositeItem.addActionListener(this); + grabItem = oe.jTree.popup.add(new JMenuItem("Group")); + grabItem.addActionListener(this); + if (Globals.ADVANCED) { hideItem = menu.add(new MenuItem("Hidden Group")); hideItem.addActionListener(this); } - ungroupItem = menu.add(new MenuItem("Ungroup")); + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); ungroupItem.addActionListener(this); + + oe.jTree.popup.addSeparator(); + + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); + deleteItem.addActionListener(this); // menu.add("-"); // @@ -695,9 +757,9 @@ shadowYItem.addActionListener(this); shadowZItem = menu.add(new MenuItem("Shadow Blue")); shadowZItem.addActionListener(this); + attributeItem = menu.add(new MenuItem("Attribute")); attributeItem.addActionListener(this); - if (Globals.ADVANCED) { menu.add("-"); @@ -709,11 +771,18 @@ pointflowItem.addActionListener(this); } menu.add("-"); + textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red")); + textureRatioRItem.addActionListener(this); + textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green")); + textureRatioGItem.addActionListener(this); + textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue")); + textureRatioBItem.addActionListener(this); + menu.add("-"); resetTransformItem = menu.add(new MenuItem("Reset Transform")); resetTransformItem.addActionListener(this); resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); resetCentroidItem.addActionListener(this); - resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY")); + resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ")); resetCentroidXZItem.addActionListener(this); transformGeometryItem = menu.add(new MenuItem("Transform Geometry")); transformGeometryItem.addActionListener(this); @@ -765,6 +834,8 @@ } oe.menuBar.add(menu = new Menu("Attributes")); + clearVersionsItem = menu.add(new MenuItem("Clear Versions")); + clearVersionsItem.addActionListener(this); clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); clearMaterialsItem.addActionListener(this); resetAllItem = menu.add(new MenuItem("Reset All")); @@ -787,9 +858,9 @@ hideleavesItem.addActionListener(this); showleavesItem = menu.add(new MenuItem("Show Leaves")); showleavesItem.addActionListener(this); - markleavesItem = menu.add(new MenuItem("Mark Leaves")); + markleavesItem = menu.add(new MenuItem("Anim Leaves")); markleavesItem.addActionListener(this); - unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves")); + unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves")); unmarkleavesItem.addActionListener(this); rewindleavesItem = menu.add(new MenuItem("Rewind Leaves")); rewindleavesItem.addActionListener(this); @@ -843,6 +914,9 @@ shareGeometriesItem.addActionListener(this); mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); mergeGeometriesItem.addActionListener(this); + menu.add("-"); + editLeafItem = menu.add(new MenuItem("Edit leaf...")); + editLeafItem.addActionListener(this); if (Globals.ADVANCED) { // Pretty much the same as duplicate and clone. @@ -859,6 +933,79 @@ buildToolsMenu(menu); } + JTabbedPane resourcecontainer; + cGridBag currenttab; + //boolean added; // patch for jar + + int totalcount = 0; + + int tabcount = 0; + int colcount = 0; + int rowcount = 0; + int texturecount = 0; + + int columns = 5; + int rows = 7; + + public void ResourceCallBack(String[] path) + { +// for (int i = 0; i < path.length; i++) +// System.out.print(path[i] + "/"); +// System.out.println(); + + if (//rowcount == 0 || + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) + { + currenttab = new cGridBag(); + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); + currenttab.setName(tabname); + //added = false; + resourcecontainer.add(currenttab); + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); + rowcount = 1; + colcount = 0; + texturecount = 0; + } + + if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png"))) + { + //if (!added) + { + //added = true; + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); + } + + AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab); + totalcount++; + + if (++colcount >= columns) + { + colcount = 0; + currenttab.Return(); + + if (rowcount++ >= rows) + { + rowcount = 0; + } + } + } + else + { +// if (!path[path.length-1].equals("icons")) +// resourcecontainer.Return(); + } + } + + void CreateTexturePanel(cGridBag container) + { + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); + container.add(resourcecontainer); + + Grafreed.ParseResources("textures", this); + + // 935. System.out.println("Total = " + totalcount); + } void SetupUI2(ObjEditor oe) { @@ -877,11 +1024,6 @@ //new Exception().printStackTrace(); oe.radioPanel = new JPanel(new GridBagLayout()); - oe.aConstraints.weightx = 1; - oe.aConstraints.weighty = 0; - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; - oe.aConstraints.gridwidth = 100; - oe.aConstraints.gridheight = 1; // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); oe.buttonGroup = new ButtonGroup(); @@ -902,9 +1044,9 @@ oe.radioPanel.add(dummyButton); oe.buttonGroup.add(dummyButton); */ - cGridBag copyOptionsPanel = new cGridBag(); + cGridBag versionManagerPanel = new cGridBag(); - copyOptionsPanel.preferredHeight = 2; + versionManagerPanel.preferredHeight = 4; //this.AddOptions(oe.toolbarPanel, oe.aConstraints); @@ -914,58 +1056,102 @@ if (Globals.ADVANCED) { - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - maxButton.setToolTipText("Maximize window"); - maxButton.addActionListener(this); +// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); +// maxButton.setToolTipText("Maximize window"); +// maxButton.addActionListener(this); } - oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - fullButton.setToolTipText("Full-screen window"); - fullButton.addActionListener(this); + cButton gcButton; - oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); +// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); +// gcButton.setToolTipText("Garbage collect"); +// gcButton.addActionListener(new ActionListener() +// { +// public void actionPerformed(ActionEvent e) +// { +// System.gc(); +// } +// }); + + oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + fullScreenButton.setToolTipText("Full-screen window"); + fullScreenButton.addActionListener(this); + + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + collapseButton.setToolTipText("Collapse toolbar"); + collapseButton.addActionListener(this); + +// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); +// maximize3DButton.setToolTipText("Maximize 3D view"); +// maximize3DButton.addActionListener(this); + + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + twoButton.setToolTipText("Show 3D view only"); + twoButton.addActionListener(this); + this.fullscreenLayout = twoButton; + + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + threeButton.setToolTipText("Show controls and 3D view"); + threeButton.addActionListener(this); + if (Globals.ADVANCED) + { + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + sixButton.setToolTipText("Show 3D view and controls"); + sixButton.addActionListener(this); + } +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); +// sevenButton.setToolTipText("3-column layout"); +// sevenButton.addActionListener(this); + // + + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); screenfitButton.setToolTipText("Screen fit"); screenfitButton.addActionListener(this); - oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); restoreCameraButton.setToolTipText("Restore viewpoint"); restoreCameraButton.addActionListener(this); - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - saveButton.setToolTipText("Duplicate current version"); - saveButton.addActionListener(this); + versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + saveVersionButton.setToolTipText("Duplicate current version"); + saveVersionButton.addActionListener(this); - copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - undoButton.setToolTipText("Previous version"); - undoButton.addActionListener(this); - undoButton.setEnabled(false); + versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + deleteVersionButton.setToolTipText("Delete current version"); + deleteVersionButton.addActionListener(this); + deleteVersionButton.setEnabled(false); + + versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + previousVersionButton.setToolTipText("Previous version"); + previousVersionButton.addActionListener(this); + previousVersionButton.setEnabled(false); cGridBag updown = new cGridBag().setVertical(true); - updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - restoreButton.setToolTipText("Restore current version (undo latest change)"); + updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + restoreButton.setToolTipText("Undo (restore current version)"); restoreButton.addActionListener(this); restoreButton.setEnabled(false); - updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - replaceButton.setToolTipText("Replace current version (save latest change)"); + updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + replaceButton.setToolTipText("Save (replace current version)"); replaceButton.addActionListener(this); replaceButton.setEnabled(false); - copyOptionsPanel.add(updown); + versionManagerPanel.add(updown); - copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - redoButton.setToolTipText("Next version"); - redoButton.addActionListener(this); - redoButton.setEnabled(false); + versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + nextVersionButton.setToolTipText("Next version"); + nextVersionButton.addActionListener(this); + nextVersionButton.setEnabled(false); + + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + oneStepButton.setToolTipText("Animate one step forward"); + oneStepButton.addActionListener(this); oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); liveCB.setToolTipText("Enable animation"); liveCB.addItemListener(this); - oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - oneStepButton.setToolTipText("Animate one step forward"); - oneStepButton.addActionListener(this); - oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); fastCB.setToolTipText("Fast mode"); fastCB.addItemListener(this); @@ -981,38 +1167,23 @@ if (Globals.ADVANCED) { - oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints); snapobjectButton.addActionListener(this); snapobjectButton.setToolTipText("Snap Object"); - oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); fourButton.addActionListener(this); fourButton.setToolTipText("Show control panel only"); } //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); - oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - twoButton.setToolTipText("Show 3D view only"); - twoButton.addActionListener(this); - this.fullscreenLayout = twoButton; - - oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - threeButton.setToolTipText("Show controls and 3D view"); - threeButton.addActionListener(this); - oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - sixButton.setToolTipText("Show 3D view and controls"); - sixButton.addActionListener(this); -// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); -// sevenButton.setToolTipText("3-column layout"); -// sevenButton.addActionListener(this); - // - oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); rootButton.setToolTipText("Open selection in new tab"); rootButton.addActionListener(this); - oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); closeButton.setToolTipText("Close tab"); closeButton.addActionListener(this); //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); @@ -1021,38 +1192,38 @@ cGridBag row1 = new cGridBag(); // INSERT - row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - gridButton.setToolTipText("Create grid"); + row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + gridButton.setToolTipText("Create ground"); gridButton.addActionListener(this); - row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); boxButton.setToolTipText("Create box"); boxButton.addActionListener(this); - row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - sphereButton.setToolTipText("Create sphere"); - sphereButton.addActionListener(this); - - row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - coneButton.setToolTipText("Create cone"); - coneButton.addActionListener(this); - - row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - torusButton.setToolTipText("Create torus"); - torusButton.addActionListener(this); - - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); superButton.setToolTipText("Create superellipsoid"); superButton.addActionListener(this); - if (Globals.ADVANCED) + row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + sphereButton.setToolTipText("Create sphere"); + sphereButton.addActionListener(this); + + row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + coneButton.setToolTipText("Create cone"); + coneButton.addActionListener(this); + + row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + torusButton.setToolTipText("Create torus"); + torusButton.addActionListener(this); + + if (false) //Globals.ADVANCED) { - oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); kleinButton.setToolTipText("Create Klein bottle"); kleinButton.addActionListener(this); } - row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); particlesButton.setToolTipText("Create particle system"); particlesButton.addActionListener(this); @@ -1060,72 +1231,73 @@ cGridBag row2 = new cGridBag(); - row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); groupButton.setToolTipText("Create group"); groupButton.addActionListener(this); - row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); compositeButton.setToolTipText("Create composite"); compositeButton.addActionListener(this); - row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); switchButton.setToolTipText("Create item switcher"); switchButton.addActionListener(this); - row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); loopButton.setToolTipText("Create loop"); loopButton.addActionListener(this); - row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); textureButton.setToolTipText("Create texture"); textureButton.addActionListener(this); - row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); overlayButton.setToolTipText("Create overlay"); overlayButton.addActionListener(this); - row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); lightButton.setToolTipText("Create light"); lightButton.addActionListener(this); oe.toolboxPanel.add(row2); - // ENVYMAPS - cGridBag skyboxpane = new cGridBag(); - skyboxpane.preferredHeight = 100; + cGridBag textures = new cGridBag(); - oe.toolboxPanel.add(skyboxpane); + CreateTexturePanel(textures); - JTabbedPane skyboxpanel = new JTabbedPane(); - skyboxpane.add(skyboxpanel); + int tabCount = resourcecontainer.getTabCount(); - AddSkyboxTab0(skyboxpanel); - AddSkyboxTab1(skyboxpanel); - AddSkyboxTab2(skyboxpanel); - AddSkyboxTab3(skyboxpanel); + if (tabCount > 0) + resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount)); + + oe.toolboxPanel.add(textures); + + textures.preferredHeight = 100; + + CreateSkyboxPanel(oe.skyboxPanel); // EDIT panel - editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); editButton.setToolTipText("Pin selection controls"); editButton.addActionListener(this); - editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - uneditButton.setToolTipText("Remove selection controls"); + editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + uneditButton.setToolTipText("Unpin and remove selection controls"); uneditButton.addActionListener(this); editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); - allParamsButton.setToolTipText("Show all controle"); + allParamsButton.setToolTipText("Show all controls"); allParamsButton.addActionListener(this); - editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - clearPanelButton.setToolTipText("Clear edit panel"); + editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + clearPanelButton.setToolTipText("Clear all controls"); clearPanelButton.addActionListener(this); - editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - unselectButton.setToolTipText("Unselect"); - unselectButton.addActionListener(this); + //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + //unselectButton.setToolTipText("Unselect"); + //unselectButton.addActionListener(this); - editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); flashSelectionButton.setToolTipText("Highlight selection"); flashSelectionButton.addActionListener(this); @@ -1148,6 +1320,8 @@ cGridBag jSPPanel = new cGridBag(); + jSPPanel.preferredHeight = 20; + JScrollPane jSP; //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints); @@ -1156,11 +1330,12 @@ oe.treePanel.add(jSPPanel); oe.treePanel.Return(); - oe.treePanel.add(copyOptionsPanel); + oe.treePanel.add(versionManagerPanel); oe.treePanel.Return(); - cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); - versionSlider = (cNumberSlider)sliderPane.getComponent(1); - sliderPane.preferredHeight = 1; + + versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); + versionSlider = (cNumberSlider)versionSliderPane.getComponent(1); + versionSliderPane.preferredHeight = 3; // mainPanel.setDividerLocation(0.1); //1.0); mainPanel.setResizeWeight(0.4); @@ -1318,6 +1493,14 @@ void EditObject(Object3D obj) { + //assert(obj instanceof Composite); + +// if (obj.versionlist == null) +// { +// obj.versionlist = new Object3D[100]; +// obj.versionindex = -1; +// } + cRadio radioButton = new cRadio(obj.name); // June 2019. Patch to avoid bug with transparency. @@ -1342,6 +1525,7 @@ oe.SetupViews(); + if (Globals.DEBUG) System.out.println("SetupViews"); DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? @@ -1708,7 +1892,12 @@ TreePath path; public TransferableTreePath(TreePath tp) { - path = tp; + Object[] objs = new Object[tp.getPathCount()]; + for (int i=0; i<objs.length; i++) + { + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); + } + path = new TreePath(objs); } public synchronized DataFlavor[] getTransferDataFlavors() { @@ -1940,24 +2129,24 @@ switch(axis) { case 0 : - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; - vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z; - vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z; - vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z; + vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z; + vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z; + vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z; + vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z; norm = cVector.X; break; case 1 : - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; - vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z; - vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z; - vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z; + vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z; + vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z; + vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z; + vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z; norm = cVector.Y; break; case 2 : - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; - vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z; - vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z; - vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z; + vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f; + vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f; + vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f; + vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f; norm = cVector.Z; break; } @@ -1998,7 +2187,11 @@ shadow.material = new cMaterial(obj.material); shadow.material.diffuse = 0.0001f; shadow.material.specular = 0.0001f; - //shadow.projectedVertices[1].x = 300; + shadow.material.opacity = 0.75f; + + AllocProjectedVertices(shadow); + + shadow.projectedVertices[1].x = 300; makeSomething(shadow); } @@ -2519,27 +2712,35 @@ } else if (source == loopItem || source == loopButton) { + if (!group.selection.isEmpty()) + { Composite csg = new GroupLeaf(); - csg.count = 5; group(csg); + csg.count = 5; Composite child = new cGroup("Branch"); csg.addChild(child); child.addChild(csg); + } } else if (source == doubleItem) { + if (!group.selection.isEmpty()) + { Composite csg = new GroupLeaf("Fork"); - csg.count = 5; group(csg); + csg.count = 5; Composite child = new cGroup("Branch A"); csg.addChild(child); child.addChild(csg); child = new cGroup("Branch B"); csg.addChild(child); child.addChild(csg); + } } else if (source == tripleItem) { + if (!group.selection.isEmpty()) + { Composite csg = new GroupLeaf("Trident"); csg.count = 4; group(csg); @@ -2552,6 +2753,7 @@ child = new cGroup(); csg.addChild(child); child.addChild(csg); + } } else if (source == computeAOItem) { @@ -2571,7 +2773,7 @@ if (source == invariantsItem) { System.out.println("Invariants:"); - Grafreed.grafreeD.universe.invariants(); + Grafreed.grafreed.universe.invariants(); } else if (source == memoryItem) { @@ -2598,37 +2800,56 @@ { Maximize(); } else - if (source == fullButton) + if (source == fullScreenButton) { ToggleFullScreen(); } else - if (source == undoButton) + if (source == collapseButton) + { + this.expandedLayout = radio.layout; + CollapseToolbar(); + } else +// if (source == maximize3DButton) +// { +// this.expandedLayout = radio.layout; +// radio.layout = twoButton; +// CollapseToolbar(); +// Show3DView(); +// } else + if (source == previousVersionButton) { // Go to previous version //if (!Undo()) //java.awt.Toolkit.getDefaultToolkit().beep(); - Undo(); + PreviousVersion(); } else if (source == restoreButton) { // Restore current version Restore(); + //restoreButton.setEnabled(false); } else if (source == replaceButton) { // Overwrite current version Replace(); + //replaceButton.setEnabled(false); } else - if (source == redoButton) + if (source == nextVersionButton) { // Go to next version - Redo(); + NextVersion(); } else - if (source == saveButton) + if (source == saveVersionButton) { // Save a new version if (!Save(true)) java.awt.Toolkit.getDefaultToolkit().beep(); + } else + if (source == deleteVersionButton) + { + // Delete a new version + DeleteVersion(); } else if (source == oneStepButton) { @@ -2683,11 +2904,11 @@ } else if (source == undoItem) { - Undo(); + PreviousVersion(); } else if (source == redoItem) { - Redo(); + NextVersion(); } else if (source == duplicateItem) { @@ -3168,22 +3389,34 @@ } else if (source == ungroupItem || source == ungroupButton) { - boolean hasRoot = false; + boolean canUngroup = true; for (int i=0; i<group.selection.size(); i++) { - if (group.selection.get(i) == group) + Object3D selectedItem = group.selection.get(i); + + if (selectedItem.Size() == 0) { - hasRoot = true; + // Cannot ungroup leaves + canUngroup = false; + break; + } + + if (selectedItem == group) + { + // Cannot ungroup root + canUngroup = false; break; } } - if (!hasRoot) + if (canUngroup) { for (int i=0; i<group.selection.size(); i++) { - Ungroup(group.selection.get(i)); + Object3D selectedItem = group.selection.get(i); + + Ungroup(selectedItem); } ClearSelection(false); @@ -3234,6 +3467,10 @@ if (source == clearMaterialsItem) { ClearMaterials(); + } else + if (source == clearVersionsItem) + { + ClearVersions(); } else if (source == liveleavesItem) { @@ -3374,6 +3611,18 @@ if (source == transformChildrenItem) { TransformChildren(); + } else + if (source == textureRatioRItem) + { + TextureRatio(0); + } else + if (source == textureRatioGItem) + { + TextureRatio(1); + } else + if (source == textureRatioBItem) + { + TextureRatio(2); } else if (source == resetTransformItem) { @@ -3546,38 +3795,7 @@ if (CameraPane.FULLSCREEN) fullscreenLayout = radio.layout; - // bug - //gridPanel.setDividerLocation(1.0); - //bigPanel.setDividerLocation(0.0); -// bigThree.remove(scenePanel); -// bigThree.remove(centralPanel); -// bigThree.remove(XYZPanel); -// aWindowConstraints.gridx = 0; -// aWindowConstraints.gridy = 0; -// aWindowConstraints.gridwidth = 1; -// // aConstraints.gridheight = 3; -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; -// aWindowConstraints.weightx = 0; -// aWindowConstraints.weighty = 1; -// //bigThree.add(jtp, aWindowConstraints); -// aWindowConstraints.weightx = 1; -// aWindowConstraints.gridwidth = 3; -// // aConstraints.gridheight = 3; -// aWindowConstraints.gridx = 1; -// aWindowConstraints.fill = GridBagConstraints.BOTH; -// bigThree.add(centralPanel, aWindowConstraints); -// aWindowConstraints.weightx = 0; -// aWindowConstraints.gridx = 4; -// aWindowConstraints.gridwidth = 1; -// // aConstraints.gridheight = 3; -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; -// //bigThree.add(XYZPanel, aWindowConstraints); -// scenePanel.setVisible(false); -// centralPanel.setVisible(true); -// XYZPanel.setVisible(false); - bigThree.ClearUI(); - bigThree.add(centralPanel); - bigThree.FlushUI(); + Show3DView(); cameraView.requestFocusInWindow(); @@ -3763,6 +3981,7 @@ } else if (source == rootButton) { + Replace(); Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { @@ -3777,6 +3996,9 @@ if (source == closeButton) { //System.out.println("CLOSE: " + buttonGroup.getSelection()); + if (copy.versionlist != null) + Replace(); + cRadio ab; for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) { @@ -3820,10 +4042,10 @@ { Object3D child = (Object3D)e.nextElement(); if(child.editWindow != null) - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); child.pinned = false; child.CloseUI(); listUI.remove(child); +// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); //child.editWindow = null; // ??????????? } @@ -3842,6 +4064,7 @@ obj.CloseUI(); } listUI.clear(); + SetPinStates(group.selection.size() > 0); refreshContents(true); } else if (source == allParamsButton) @@ -3874,6 +4097,9 @@ } else if(source instanceof cRadio) { + if (copy.versionlist != null) + Replace(); + group.parent = keepparent; group.attributes = 0; //group.editWindow = null; @@ -3898,8 +4124,6 @@ copy = group; - SetUndoStates(); - //Globals.theRenderer.object = group; if(!useclient) { @@ -3927,7 +4151,34 @@ */ radio.layout.doClick(); + //assert(copy instanceof Composite); + + if (copy.versionlist == null) + { + copy.versionindex = -1; + + // Cannot work with loops + // To fix this issue, we first mark all nodes above the root, + // and check if any of these nodes are reachable below the root. + Grafreed.grafreed.universe.TagObjects(copy, true); + + if (copy instanceof Composite && !copy.HasTags()) + { + if (copy.versionlist == null) + copy.versionlist = new Object3D[100]; + + //Save(true); + } + else + copy.versionindex = -2; + + Grafreed.grafreed.universe.TagObjects(copy, false); + } + + SetVersionStates(); + ClearUnpinned(); + //Grafreed.Assert(group != null); //Grafreed.Assert(group.selection != null); SetPinStates(group.selection == null || group.selection.size() > 0); @@ -4039,9 +4290,46 @@ refreshContents(); } + void TextureRatio(int axis) + { + Object3D obj; + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + obj = (Object3D)e.nextElement(); + obj.TextureRatio(axis); + } + + refreshContents(); + } + void ResetTransform() { ResetTransform(-1); + } + + void ScaleSelection(int scale) + { + Object3D obj; + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + obj = (Object3D)e.nextElement(); + + if (obj.toParent == null) + continue; + + obj.Scale(scale); + + if (obj.parent == null) + { + System.out.println("NULL PARENT!"); + // new Exception().printStackTrace(); + } + else + TouchTransform(obj); + //obj.parent.Touch(); + } + + refreshContents(); } void ResetTransform(int mask) @@ -4054,42 +4342,8 @@ if (obj.toParent == null) continue; - if (mask == -1) - { - if (obj instanceof Camera) // jan 2014 - { - LA.matIdentity(obj.toParent); - LA.matIdentity(obj.fromParent); - } - else - { - obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); - obj.fromParent = null; // LA.matIdentity(obj.fromParent); - } - TouchTransform(obj); - continue; - } - if ((mask&2) != 0) // Scale - { - obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; - obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; - obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; - obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; - obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; - obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; - } - if ((mask&4) != 0) // Rotation - { - // ? - } - if ((mask&1) != 0) // Translation - { - if (obj.toParent != null) - { - obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; - obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; - } - } + obj.ResetTransform(mask); + if (obj.parent == null) { System.out.println("NULL PARENT!"); @@ -4598,6 +4852,12 @@ { Object3D obj = group.selection.get(i); + if (obj.toParent == null) + { + obj.toParent = LA.newMatrix(); + obj.fromParent = LA.newMatrix(); + } + LA.matTranslate(obj.toParent, i * scale, 0, 0); LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0); } @@ -4889,6 +5149,12 @@ refreshContents(); } + void ClearVersions() + { + group.selection.ClearVersions(); + refreshContents(); + } + void FlipV(boolean flip) { group.selection.FlipV(flip); @@ -5083,9 +5349,7 @@ freezemodel = false; } - - boolean flashIt = true; - + public void valueChanged(TreeSelectionEvent e) //public boolean handleEvent(Event event) { @@ -5129,7 +5393,7 @@ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) // a camera { - if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace + if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace { CameraPane.camerachangeframe = 0; // don't refuse it Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); @@ -5158,13 +5422,31 @@ { editButton.setEnabled(enabled); uneditButton.setEnabled(enabled); - unselectButton.setEnabled(enabled); + //unselectButton.setEnabled(enabled); flashSelectionButton.setEnabled(enabled); + + clearPanelButton.setEnabled(!listUI.isEmpty()); + + boolean allComposites = true; + + if (group.selection != null) + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + Object next = e.nextElement(); + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) + { + allComposites = false; + break; + } + } + + rootButton.setEnabled(true); // allComposites); } void refreshContents(boolean cp) { - if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) + if (Globals.SHOWINFO) + //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) { objEditor.ClearInfo(); // .GetMaterial()); @@ -5174,7 +5456,7 @@ Object3D child = (Object3D) group.selection.get(i); objEditor.AddInfo(child, this, true); - System.err.println("info : " + child.GetPath()); +// System.err.println("info : " + child.GetPath()); } objEditor.SetText(); // jan 2014 @@ -6000,7 +6282,6 @@ cButton restoreCameraButton; - cButton saveButton; cButton oneStepButton; cButton groupButton; @@ -6058,11 +6339,11 @@ private MenuItem lookAtItem; private MenuItem lookFromItem; private MenuItem switchViewItem; - private MenuItem cutItem; + private JMenuItem cutItem; private MenuItem undoItem; private MenuItem redoItem; private JMenuItem duplicateItem; - private MenuItem cloneItem; + private JMenuItem cloneItem; private MenuItem cloneSupportItem; private MenuItem overwriteGeoItem; private MenuItem overwriteMatItem; @@ -6083,13 +6364,13 @@ private MenuItem cloneGeometriesItem; private MenuItem shareGeometriesItem; private MenuItem mergeGeometriesItem; - private MenuItem copyItem; + private JMenuItem copyItem; private MenuItem pasteItem; - private MenuItem pasteIntoItem; - private MenuItem pasteLinkItem; - private MenuItem pasteCloneItem; - private MenuItem pasteExpandItem; - private MenuItem deleteItem; + private JMenuItem pasteIntoItem; + private JMenuItem pasteLinkItem; + private JMenuItem pasteCloneItem; + private JMenuItem pasteExpandItem; + private JMenuItem deleteItem; private MenuItem clearAllItem; private MenuItem genUVItem; private MenuItem genNormalsMESHItem; @@ -6115,6 +6396,7 @@ private MenuItem clipMeshItem; private MenuItem smoothMeshItem; private MenuItem clearMaterialsItem; + private MenuItem clearVersionsItem; private MenuItem liveleavesItem; private MenuItem unliveleavesItem; @@ -6138,13 +6420,16 @@ private MenuItem maxTexturesItem; private MenuItem panoTexturesItem; + private MenuItem textureRatioRItem; + private MenuItem textureRatioGItem; + private MenuItem textureRatioBItem; private MenuItem resetCentroidItem; private MenuItem resetCentroidXZItem; private MenuItem resetTransformItem; private MenuItem transformGeometryItem; private MenuItem transformChildrenItem; private MenuItem hideItem; - private MenuItem grabItem; + private JMenuItem grabItem; private MenuItem backItem; private MenuItem frontItem; private MenuItem cameraItem; @@ -6157,7 +6442,7 @@ private MenuItem switchTransfoItem; private MenuItem morphItem; private MenuItem linkerItem; - private MenuItem ungroupItem; + private JMenuItem ungroupItem; private MenuItem editItem; private MenuItem openWindowItem; private MenuItem editLeafItem; -- Gitblit v1.6.2