From 7dc9a8879ed29a7693d617afcb48014504ddc4a9 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Tue, 20 Aug 2019 01:19:51 -0400 Subject: [PATCH] Textures from opengameart. --- GroupEditor.java | 284 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 170 insertions(+), 114 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index 9f3c422..8342091 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -29,7 +29,7 @@ { 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.equals("") ? "No background" : s); skyboxButton.addActionListener(new ActionListener() @@ -46,7 +46,7 @@ { cButton textureButton; final String path = "textures/" + f + "/" + c + "/"; // + t; - row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF)); + row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF)); textureButton.setToolTipText(c + count); textureButton.addActionListener(new ActionListener() { @@ -347,7 +347,7 @@ public void CreateSkyboxPanel(cGridBag skyboxPanel) { - JTabbedPane skyboxpane = new JTabbedPane(); + JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT); AddSkyboxTab0(skyboxpane); AddSkyboxTab1(skyboxpane); @@ -415,12 +415,14 @@ this.copy = this.group = group; //selectees = this.group.selectees; + assert(false); + if (copy.versionlist == null) { copy.versionlist = new Object3D[100]; copy.versionindex = -1; - Save(true); + //Save(true); } if(ui) @@ -449,7 +451,7 @@ copy.versionlist = new Object3D[100]; copy.versionindex = -1; - Save(true); + //Save(true); } } @@ -540,33 +542,35 @@ // 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")); +// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); // pasteExpandItem.addActionListener(this); - menu.add("-"); - deleteItem = menu.add(new MenuItem("Delete")); - deleteItem.addActionListener(this); + //menu.add("-"); + oe.jTree.popup.addSeparator(); if (Globals.ADVANCED) { @@ -701,9 +705,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")); @@ -711,13 +714,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("-"); // @@ -846,9 +857,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); @@ -923,7 +934,7 @@ JTabbedPane resourcecontainer; cGridBag currenttab; - boolean added; // patch for jar + //boolean added; // patch for jar int tabcount = 0; int colcount = 0; @@ -940,28 +951,29 @@ // System.out.println(); if (//rowcount == 0 || - path.length == 1) + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) { currenttab = new cGridBag(); - added = false; 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")) + if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png"))) { - if (!added) + //if (!added) { - added = true; - resourcecontainer.add(currenttab); + //added = true; String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); - resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); } - AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); + AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab); if (++colcount >= columns) { @@ -1026,9 +1038,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); @@ -1055,25 +1067,25 @@ // } // }); - oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); collapseButton.setToolTipText("Collapse toolbar"); collapseButton.addActionListener(this); - oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); sixButton.setToolTipText("Show 3D view and controls"); sixButton.addActionListener(this); } @@ -1082,50 +1094,51 @@ // sevenButton.addActionListener(this); // - oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); fullButton.setToolTipText("Full-screen window"); fullButton.addActionListener(this); - oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); saveVersionButton.setToolTipText("Duplicate current version"); saveVersionButton.addActionListener(this); - copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); deleteVersionButton.setToolTipText("Delete current version"); deleteVersionButton.addActionListener(this); + deleteVersionButton.setEnabled(false); - copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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); + updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); restoreButton.setToolTipText("Undo (restore current version)"); restoreButton.addActionListener(this); - //restoreButton.setEnabled(false); + restoreButton.setEnabled(false); - updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); replaceButton.setToolTipText("Save (replace current version)"); replaceButton.addActionListener(this); - //replaceButton.setEnabled(false); + replaceButton.setEnabled(false); - copyOptionsPanel.add(updown); + versionManagerPanel.add(updown); - copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); oneStepButton.setToolTipText("Animate one step forward"); oneStepButton.addActionListener(this); @@ -1148,11 +1161,11 @@ 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"); } @@ -1160,11 +1173,11 @@ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); - 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); @@ -1173,38 +1186,38 @@ cGridBag row1 = new cGridBag(); // INSERT - row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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); + 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 (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); @@ -1212,31 +1225,31 @@ 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); @@ -1246,6 +1259,8 @@ CreateTexturePanel(textures); + resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount())); + oe.toolboxPanel.add(textures); textures.preferredHeight = 100; @@ -1253,11 +1268,11 @@ 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); + editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); uneditButton.setToolTipText("Unpin and remove selection controls"); uneditButton.addActionListener(this); @@ -1265,7 +1280,7 @@ allParamsButton.setToolTipText("Show all controls"); allParamsButton.addActionListener(this); - editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); clearPanelButton.setToolTipText("Clear all controls"); clearPanelButton.addActionListener(this); @@ -1273,7 +1288,7 @@ //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); @@ -1296,6 +1311,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); @@ -1304,11 +1321,11 @@ 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); @@ -1498,6 +1515,7 @@ oe.SetupViews(); + if (Globals.DEBUG) System.out.println("SetupViews"); DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? @@ -2159,7 +2177,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); } @@ -2680,27 +2702,35 @@ } else if (source == loopItem || source == loopButton) { + if (!group.selection.isEmpty()) + { Composite csg = new GroupLeaf(); csg.count = 5; - group(csg); Composite child = new cGroup("Branch"); csg.addChild(child); child.addChild(csg); + group(csg); + } } else if (source == doubleItem) { + if (!group.selection.isEmpty()) + { Composite csg = new GroupLeaf("Fork"); csg.count = 5; - group(csg); Composite child = new cGroup("Branch A"); csg.addChild(child); child.addChild(csg); child = new cGroup("Branch B"); csg.addChild(child); child.addChild(csg); + group(csg); + } } else if (source == tripleItem) { + if (!group.selection.isEmpty()) + { Composite csg = new GroupLeaf("Trident"); csg.count = 4; group(csg); @@ -2713,6 +2743,7 @@ child = new cGroup(); csg.addChild(child); child.addChild(csg); + } } else if (source == computeAOItem) { @@ -3348,22 +3379,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); @@ -3927,6 +3970,8 @@ if (source == closeButton) { //System.out.println("CLOSE: " + buttonGroup.getSelection()); + Replace(); + cRadio ab; for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) { @@ -4025,6 +4070,8 @@ } else if(source instanceof cRadio) { + Replace(); + group.parent = keepparent; group.attributes = 0; //group.editWindow = null; @@ -4080,10 +4127,21 @@ if (copy.versionlist == null) { - copy.versionlist = new Object3D[100]; copy.versionindex = -1; - Save(true); + // 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.HasTags()) + { + copy.versionlist = new Object3D[100]; + + Save(true); + } + + Grafreed.grafreed.universe.TagObjects(copy, false); } SetVersionStates(); @@ -4231,7 +4289,7 @@ TouchTransform(obj); continue; } - if ((mask&2) != 0) // Scale + if ((mask&2) != 0) // Scale/rotation { 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; @@ -4239,10 +4297,6 @@ 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 { @@ -5328,7 +5382,8 @@ if (group.selection != null) for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { - if (!(e.nextElement() instanceof Composite)) + Object next = e.nextElement(); + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) { allComposites = false; break; @@ -5340,6 +5395,7 @@ void refreshContents(boolean cp) { + if (Globals.ADVANCED) //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) { @@ -6233,11 +6289,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; @@ -6258,13 +6314,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; @@ -6319,7 +6375,7 @@ private MenuItem transformGeometryItem; private MenuItem transformChildrenItem; private MenuItem hideItem; - private MenuItem grabItem; + private JMenuItem grabItem; private MenuItem backItem; private MenuItem frontItem; private MenuItem cameraItem; @@ -6332,7 +6388,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