From 21ac57b36a9e3b909853c7d64ac29b7ad72490a3 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 02 Sep 2019 16:52:19 -0400 Subject: [PATCH] Figure panel. --- GroupEditor.java | 310 ++++++++++++++++++++++++++++----------------------- 1 files changed, 168 insertions(+), 142 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index b37d3ac..ae9ebf2 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); @@ -366,16 +366,6 @@ } refreshContents(); - } - - public void Show3DView() - { - // bug - //gridPanel.setDividerLocation(1.0); - //bigPanel.setDividerLocation(0.0); - bigThree.ClearUI(); - bigThree.add(centralPanel); - bigThree.FlushUI(); } //ObjEditor objEditor; @@ -417,13 +407,13 @@ assert(false); - if (copy.versionlist == null) - { - copy.versionlist = new Object3D[100]; - copy.versionindex = -1; - - //Save(true); - } +// if (copy.versionlist == null) +// { +// copy.versionlist = new Object3D[100]; +// copy.versionindex = -1; +// +// //Save(true); +// } if(ui) SetupUI(objEditor); @@ -446,13 +436,13 @@ ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); - if (copy.versionlist == null) - { - copy.versionlist = 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) @@ -765,9 +755,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("-"); @@ -779,11 +769,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); @@ -835,6 +832,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")); @@ -857,9 +856,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); @@ -936,6 +935,8 @@ cGridBag currenttab; //boolean added; // patch for jar + int totalcount = 0; + int tabcount = 0; int colcount = 0; int rowcount = 0; @@ -964,7 +965,7 @@ 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) { @@ -973,7 +974,8 @@ 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); + totalcount++; if (++colcount >= columns) { @@ -999,6 +1001,8 @@ container.add(resourcecontainer); Grafreed.ParseResources("textures", this); + + // 935. System.out.println("Total = " + totalcount); } void SetupUI2(ObjEditor oe) @@ -1067,25 +1071,29 @@ // } // }); - oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - maximize3DButton.setToolTipText("Maximize 3D view"); - maximize3DButton.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", !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); } @@ -1094,51 +1102,47 @@ // sevenButton.addActionListener(this); // - oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.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); - versionManagerPanel.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); - versionManagerPanel.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); - versionManagerPanel.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); - 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); versionManagerPanel.add(updown); - versionManagerPanel.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); @@ -1161,11 +1165,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"); } @@ -1173,11 +1177,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); @@ -1186,38 +1190,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(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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); torusButton.setToolTipText("Create torus"); torusButton.addActionListener(this); - if (Globals.ADVANCED) + 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); @@ -1225,31 +1229,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); @@ -1259,7 +1263,10 @@ CreateTexturePanel(textures); - resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount())); + int tabCount = resourcecontainer.getTabCount(); + + if (tabCount > 0) + resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount)); oe.toolboxPanel.add(textures); @@ -1268,11 +1275,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); @@ -1280,7 +1287,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); @@ -1288,7 +1295,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); @@ -1483,7 +1490,7 @@ void EditObject(Object3D obj) { - assert(obj instanceof Composite); + //assert(obj instanceof Composite); // if (obj.versionlist == null) // { @@ -2119,24 +2126,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; } @@ -2705,11 +2712,11 @@ if (!group.selection.isEmpty()) { Composite csg = new GroupLeaf(); + group(csg); csg.count = 5; Composite child = new cGroup("Branch"); csg.addChild(child); child.addChild(csg); - group(csg); } } else if (source == doubleItem) @@ -2717,6 +2724,7 @@ if (!group.selection.isEmpty()) { Composite csg = new GroupLeaf("Fork"); + group(csg); csg.count = 5; Composite child = new cGroup("Branch A"); csg.addChild(child); @@ -2724,7 +2732,6 @@ child = new cGroup("Branch B"); csg.addChild(child); child.addChild(csg); - group(csg); } } else if (source == tripleItem) @@ -2790,7 +2797,7 @@ { Maximize(); } else - if (source == fullButton) + if (source == fullScreenButton) { ToggleFullScreen(); } else @@ -2799,13 +2806,13 @@ this.expandedLayout = radio.layout; CollapseToolbar(); } else - if (source == maximize3DButton) - { - this.expandedLayout = radio.layout; - radio.layout = twoButton; - Show3DView(); - CollapseToolbar(); - } else +// if (source == maximize3DButton) +// { +// this.expandedLayout = radio.layout; +// radio.layout = twoButton; +// CollapseToolbar(); +// Show3DView(); +// } else if (source == previousVersionButton) { // Go to previous version @@ -3458,6 +3465,10 @@ { ClearMaterials(); } else + if (source == clearVersionsItem) + { + ClearVersions(); + } else if (source == liveleavesItem) { LiveLeaves(true); @@ -3597,6 +3608,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) { @@ -3970,7 +3993,8 @@ if (source == closeButton) { //System.out.println("CLOSE: " + buttonGroup.getSelection()); - Replace(); + if (copy.versionlist != null) + Replace(); cRadio ab; for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) @@ -4070,7 +4094,8 @@ } else if(source instanceof cRadio) { - Replace(); + if (copy.versionlist != null) + Replace(); group.parent = keepparent; group.attributes = 0; @@ -4123,7 +4148,7 @@ */ radio.layout.doClick(); - assert(copy instanceof Composite); + //assert(copy instanceof Composite); if (copy.versionlist == null) { @@ -4134,12 +4159,15 @@ // and check if any of these nodes are reachable below the root. Grafreed.grafreed.universe.TagObjects(copy, true); - if (!copy.HasTags()) + if (copy instanceof Composite && !copy.HasTags()) { - copy.versionlist = new Object3D[100]; + if (copy.versionlist == null) + copy.versionlist = new Object3D[100]; - Save(true); + //Save(true); } + else + copy.versionindex = -2; Grafreed.grafreed.universe.TagObjects(copy, false); } @@ -4259,6 +4287,18 @@ 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); @@ -4274,38 +4314,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/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; - 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&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!"); @@ -4814,6 +4824,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); } @@ -5105,6 +5121,12 @@ refreshContents(); } + void ClearVersions() + { + group.selection.ClearVersions(); + refreshContents(); + } + void FlipV(boolean flip) { group.selection.FlipV(flip); @@ -5343,7 +5365,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()); @@ -5390,12 +5412,12 @@ } } - rootButton.setEnabled(allComposites); + rootButton.setEnabled(true); // allComposites); } void refreshContents(boolean cp) { - if (false) + if (Globals.SHOWINFO) //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) { @@ -6346,6 +6368,7 @@ private MenuItem clipMeshItem; private MenuItem smoothMeshItem; private MenuItem clearMaterialsItem; + private MenuItem clearVersionsItem; private MenuItem liveleavesItem; private MenuItem unliveleavesItem; @@ -6369,6 +6392,9 @@ private MenuItem maxTexturesItem; private MenuItem panoTexturesItem; + private MenuItem textureRatioRItem; + private MenuItem textureRatioGItem; + private MenuItem textureRatioBItem; private MenuItem resetCentroidItem; private MenuItem resetCentroidXZItem; private MenuItem resetTransformItem; -- Gitblit v1.6.2