From d5d6485126da83b06645e90e3e4ce66659a56009 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sat, 17 Aug 2019 13:56:24 -0400 Subject: [PATCH] Reset transform, fix loop versioning. --- GroupEditor.java | 53 +++++++++++++++++++++++++++++++++-------------------- 1 files changed, 33 insertions(+), 20 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index b81fe93..b37d3ac 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -1038,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); @@ -1071,7 +1071,7 @@ collapseButton.setToolTipText("Collapse toolbar"); collapseButton.addActionListener(this); - oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); maximize3DButton.setToolTipText("Maximize 3D view"); maximize3DButton.addActionListener(this); @@ -1106,16 +1106,16 @@ 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", !Grafreed.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", !Grafreed.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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); previousVersionButton.setToolTipText("Previous version"); previousVersionButton.addActionListener(this); previousVersionButton.setEnabled(false); @@ -1131,9 +1131,9 @@ replaceButton.addActionListener(this); 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", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); nextVersionButton.setToolTipText("Next version"); nextVersionButton.addActionListener(this); nextVersionButton.setEnabled(false); @@ -1259,6 +1259,8 @@ CreateTexturePanel(textures); + resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount())); + oe.toolboxPanel.add(textures); textures.preferredHeight = 100; @@ -1309,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); @@ -1317,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); @@ -3966,6 +3970,8 @@ if (source == closeButton) { //System.out.println("CLOSE: " + buttonGroup.getSelection()); + Replace(); + cRadio ab; for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) { @@ -4064,6 +4070,8 @@ } else if(source instanceof cRadio) { + Replace(); + group.parent = keepparent; group.attributes = 0; //group.editWindow = null; @@ -4119,13 +4127,21 @@ if (copy.versionlist == null) { - copy.versionlist = new Object3D[100]; copy.versionindex = -1; // Cannot work with loops - // To fix this issue, first mark all nodes above the root, + // To fix this issue, we first mark all nodes above the root, // and check if any of these nodes are reachable below the root. - //Save(true); + Grafreed.grafreed.universe.TagObjects(copy, true); + + if (!copy.HasTags()) + { + copy.versionlist = new Object3D[100]; + + Save(true); + } + + Grafreed.grafreed.universe.TagObjects(copy, false); } SetVersionStates(); @@ -4273,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; @@ -4281,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 { @@ -5383,6 +5395,7 @@ void refreshContents(boolean cp) { + if (false) //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) { -- Gitblit v1.6.2