From 8f1afe25ea8fc8801aab66331c32a50859a758c2 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 12 Aug 2019 18:20:19 -0400 Subject: [PATCH] Fix version manager. --- GroupEditor.java | 783 ++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 567 insertions(+), 216 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index 696071e..e09d28f 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, @@ -24,11 +25,12 @@ ItemListener // ListSelectionListener { - public void AddSkyboxButton(String f, String s, cGridBag row3) + public void AddSkyboxButton(String f, String s, cGridBag row) { cButton skyboxButton; final String path = "cubemaps/" + f + "-skyboxes/" + s; - row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF)); + row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); + //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); skyboxButton.setToolTipText(s); skyboxButton.addActionListener(new ActionListener() { @@ -40,14 +42,333 @@ }); } - public void ChangeSkybox(String name) + public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) { - cameraView.envyoff = false; - cameraView.skyboxname = name; - cameraView.skyboxext = "jpg"; - cameraView.repaint(); + cButton textureButton; + final String path = "textures/" + f + "/" + c + "/"; // + t; + row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.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); + + tab0.setName("Urban"); + skyboxpanel.add(tab0); + + cGridBag row0 = new cGridBag(); + cGridBag row1 = new cGridBag(); + cGridBag row2 = new cGridBag(); + cGridBag row3 = new cGridBag(); + cGridBag row4 = new cGridBag(); + cGridBag row5 = new cGridBag(); + cGridBag row6 = new cGridBag(); + + AddSkyboxButton("default", "rgb", row0); + //AddSkyboxButton("default", "cornell", row0); + AddSkyboxButton("penguins", "dust", row0); + AddSkyboxButton("penguins", "tropic", row0); + AddSkyboxButton("penguins", "yonder", row0); + + AddSkyboxButton("default", "uffizi", row1); + AddSkyboxButton("bridge", "Bridge", row1); + AddSkyboxButton("bridge", "Bridge2", row1); + AddSkyboxButton("urban", "GamlaStan2", row1); + + AddSkyboxButton("urban", "Parliament", row2); + AddSkyboxButton("urban", "Roundabout", row2); + AddSkyboxButton("urban", "SaintLazarusChurch", row2); + AddSkyboxButton("urban", "SaintLazarusChurch2", row2); + + AddSkyboxButton("urban", "SaintLazarusChurch3", row3); + AddSkyboxButton("urban", "UnionSquare", row3); + AddSkyboxButton("urban", "Medborgarplatsen", row3); + AddSkyboxButton("park", "BerzeliiPark", row3); + + AddSkyboxButton("park", "Buddha", row4); + AddSkyboxButton("park", "CNTower2", row4); + AddSkyboxButton("park", "NiagaraFalls1", row4); + AddSkyboxButton("park", "NiagaraFalls3", row4); + + AddSkyboxButton("park", "Park", row5); + AddSkyboxButton("park", "Pond", row5); + AddSkyboxButton("park", "Skansen", row5); + AddSkyboxButton("park", "Skansen2", row5); + + AddSkyboxButton("park", "Skansen3", row6); + AddSkyboxButton("park", "Skansen4", row6); + AddSkyboxButton("park", "Skansen5", row6); + AddSkyboxButton("persson", "VancouverConventionCentre", row6); + + tab0.add(row0); + tab0.add(row1); + tab0.add(row2); + tab0.add(row3); + tab0.add(row4); + tab0.add(row5); + tab0.add(row6); + + for (int i=5; --i>=0;) + { + //oe.toolboxPanel.Return(); + //tab0.add(new cGridBag()); + } + } + + public void AddSkyboxTab1(JTabbedPane skyboxpanel) + { + cGridBag tab0 = new cGridBag().setVertical(true); + + tab0.setName("Nature"); + skyboxpanel.add(tab0); + + cGridBag row0 = new cGridBag(); + cGridBag row1 = new cGridBag(); + cGridBag row2 = new cGridBag(); + cGridBag row3 = new cGridBag(); + cGridBag row4 = new cGridBag(); + cGridBag row5 = new cGridBag(); + cGridBag row6 = new cGridBag(); + + AddSkyboxButton("beach", "HeartInTheSand", row0); + AddSkyboxButton("beach", "LarnacaBeach", row0); + AddSkyboxButton("beach", "PalmTrees", row0); + AddSkyboxButton("beach", "Tenerife", row0); + + AddSkyboxButton("beach", "Tenerife2", row1); + AddSkyboxButton("beach", "Tenerife3", row1); + AddSkyboxButton("field", "FishPond", row1); + AddSkyboxButton("field", "Footballfield", row1); + + AddSkyboxButton("field", "Meadow", row2); + AddSkyboxButton("field", "Sorsele", row2); + AddSkyboxButton("field", "Sorsele2", row2); + AddSkyboxButton("field", "Sorsele3", row2); + + AddSkyboxButton("forest", "Brudslojan", row3); + AddSkyboxButton("forest", "Langholmen2", row3); + AddSkyboxButton("forest", "Plants", row3); + AddSkyboxButton("mountain", "Maskonaive", row3); + + AddSkyboxButton("mountain", "Maskonaive2", row4); + AddSkyboxButton("mountain", "Maskonaive3", row4); + AddSkyboxButton("mountain", "Teide", row4); + AddSkyboxButton("park", "Tantolunden4", row4); + + AddSkyboxButton("park", "Stairs", row5); + AddSkyboxButton("default", "skycube", row6); + AddSkyboxButton("rocky", "Langholmen", row5); + AddSkyboxButton("rocky", "Skinnarviksberget", row5); + + AddSkyboxButton("rocky", "Tantolunden6", row5); + AddSkyboxButton("default", "CloudyHills", row6); + AddSkyboxButton("daz", "Autumn", row6); + AddSkyboxButton("daz", "MountainTrail", row6); + /* +Autumn +Greenlands +MountainTrail +Oasis +TheRock +TopOfTheWorld +Winter + */ + + tab0.add(row0); + tab0.add(row1); + tab0.add(row2); + tab0.add(row3); + tab0.add(row4); + tab0.add(row5); + tab0.add(row6); + + for (int i=5; --i>=0;) + { + //oe.toolboxPanel.Return(); + //tab0.add(new cGridBag()); + } + } + + public void AddSkyboxTab2(JTabbedPane skyboxpanel) + { + cGridBag tab0 = new cGridBag().setVertical(true); + + tab0.setName("Night"); + skyboxpanel.add(tab0); + + cGridBag row0 = new cGridBag(); + cGridBag row1 = new cGridBag(); + cGridBag row2 = new cGridBag(); + cGridBag row3 = new cGridBag(); + cGridBag row4 = new cGridBag(); + cGridBag row5 = new cGridBag(); + cGridBag row6 = new cGridBag(); + + AddSkyboxButton("night", "NightPath", row0); + AddSkyboxButton("night", "PondNight", row0); + AddSkyboxButton("night", "Powerlines", row0); + AddSkyboxButton("night", "SwedishRoyalCastle", row0); + + AddSkyboxButton("urban", "CNTower", row1); + AddSkyboxButton("bridge", "ArstaBridge", row1); + AddSkyboxButton("rocky", "Riddarfjarden", row1); + AddSkyboxButton("penguins", "sleepyhollow", row1); + + AddSkyboxButton("penguins", "kenon_star", row2); + AddSkyboxButton("persson", "corona", row2); + AddSkyboxButton("persson", "spaceskybox", row2); + AddSkyboxButton("indoors", "Vasa", row2); + + AddSkyboxButton("winter", "Backyard", row3); + AddSkyboxButton("winter", "Creek", row3); + AddSkyboxButton("winter", "FootballField3", row3); + AddSkyboxButton("winter", "Forest", row3); + + AddSkyboxButton("winter", "HornstullsStrand2", row4); + AddSkyboxButton("winter", "House", row4); + AddSkyboxButton("winter", "IceLake", row4); + AddSkyboxButton("winter", "IceRiver", row4); + + AddSkyboxButton("winter", "Park3", row5); + AddSkyboxButton("winter", "PondWinter", row5); + AddSkyboxButton("winter", "Tantolunden5", row5); + AddSkyboxButton("winter", "Vindelalven", row5); + + AddSkyboxButton("daz", "TheRock", row6); + AddSkyboxButton("daz", "TopOfTheWorld", row6); + AddSkyboxButton("daz", "Winter", row6); + AddSkyboxButton("mountain", "Ryfjallet", row6); + + tab0.add(row0); + tab0.add(row1); + tab0.add(row2); + tab0.add(row3); + tab0.add(row4); + tab0.add(row5); + tab0.add(row6); + + for (int i=5; --i>=0;) + { + //oe.toolboxPanel.Return(); + //tab0.add(new cGridBag()); + } + } + + public void AddSkyboxTab3(JTabbedPane skyboxpanel) + { + cGridBag tab0 = new cGridBag().setVertical(true); + + tab0.setName("Others"); + skyboxpanel.add(tab0); + + cGridBag row0 = new cGridBag(); + cGridBag row1 = new cGridBag(); + cGridBag row2 = new cGridBag(); + cGridBag row3 = new cGridBag(); + cGridBag row4 = new cGridBag(); + cGridBag row5 = new cGridBag(); + cGridBag row6 = new cGridBag(); + + AddSkyboxButton("mayhem", "afterrain", row0); + AddSkyboxButton("mayhem", "aqua4", row0); + AddSkyboxButton("mayhem", "aqua9", row0); + AddSkyboxButton("mayhem", "flame", row0); + + AddSkyboxButton("mayhem", "h2s", row1); + AddSkyboxButton("mayhem", "prehistoric", row1); + AddSkyboxButton("mayhem", "scorched", row1); + AddSkyboxButton("penguins", "desertdawn", row1); + + AddSkyboxButton("persson", "Citadella", row2); + AddSkyboxButton("persson", "Citadella2", row2); + AddSkyboxButton("persson", "clouds1", row2); + AddSkyboxButton("penguins", "wrath", row2); + + AddSkyboxButton("persson", "FishermansBastion", row3); + AddSkyboxButton("persson", "HeroesSquare", row3); + AddSkyboxButton("indoors", "DallasW", row3); + AddSkyboxButton("indoors", "MarriottMadisonWest", row3); + + AddSkyboxButton("persson", "LancellottiChapel", row4); + AddSkyboxButton("persson", "PereaBeach1", row4); + AddSkyboxButton("persson", "PereaBeach2", row4); + AddSkyboxButton("persson", "redeclipse", row4); + + AddSkyboxButton("daz", "Greenlands", row5); + AddSkyboxButton("daz", "Oasis", row5); + AddSkyboxButton("elyvisions", "arch3", row5); + AddSkyboxButton("elyvisions", "calm_sea", row5); + + AddSkyboxButton("elyvisions", "rainbow", row6); + AddSkyboxButton("elyvisions", "distant_sunset", row6); + AddSkyboxButton("elyvisions", "heaven", row6); + AddSkyboxButton("elyvisions", "hot", row6); + + tab0.add(row0); + tab0.add(row1); + tab0.add(row2); + tab0.add(row3); + tab0.add(row4); + tab0.add(row5); + tab0.add(row6); + + for (int i=5; --i>=0;) + { + //oe.toolboxPanel.Return(); + //tab0.add(new cGridBag()); + } + } + + public void ChangeSkybox(String skybox) + { + //cameraView.envyoff = false; + group.skyboxname = skybox; + group.skyboxext = "jpg"; + cameraView.repaint(); + } + + public void CreateSkyboxPanel(cGridBag skyboxPanel) + { + JTabbedPane skyboxpane = new JTabbedPane(); + + 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(); + } + + public void Show3DView() + { + // bug + //gridPanel.setDividerLocation(1.0); + //bigPanel.setDividerLocation(0.0); + bigThree.ClearUI(); + bigThree.add(centralPanel); + bigThree.FlushUI(); + } + //ObjEditor objEditor; public void closeUI2() { @@ -85,10 +406,12 @@ this.copy = this.group = group; //selectees = this.group.selectees; - if (copy.versions == null) + if (copy.versionlist == null) { - copy.versions = new byte[100][]; + copy.versionlist = new Object3D[100]; copy.versionindex = -1; + + Save(true); } if(ui) @@ -112,9 +435,9 @@ ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); - if (copy.versions == null) + if (copy.versionlist == null) { - copy.versions = new byte[100][]; + copy.versionlist = new Object3D[100]; copy.versionindex = -1; Save(true); @@ -320,11 +643,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); @@ -572,6 +893,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. @@ -588,6 +912,73 @@ buildToolsMenu(menu); } + JTabbedPane resourcecontainer; + cGridBag currenttab; + boolean added; // patch for jar + + 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) + { + currenttab = new cGridBag(); + added = false; + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); + currenttab.setName(tabname); + rowcount = 1; + colcount = 0; + texturecount = 0; + } + + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) + { + if (!added) + { + added = true; + resourcecontainer.add(currenttab); + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); + } + + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); + + 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); + } void SetupUI2(ObjEditor oe) { @@ -606,11 +997,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(); @@ -643,10 +1029,49 @@ 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); } + +// cButton gcButton; +// +// 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(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + collapseButton.setToolTipText("Collapse toolbar"); + collapseButton.addActionListener(this); + + oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + maximize3DButton.setToolTipText("Maximize 3D view"); + maximize3DButton.addActionListener(this); + + 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); + if (Globals.ADVANCED) + { + 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(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); fullButton.setToolTipText("Full-screen window"); @@ -660,41 +1085,45 @@ restoreCameraButton.setToolTipText("Restore viewpoint"); restoreCameraButton.addActionListener(this); - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - saveButton.setToolTipText("New version"); - saveButton.addActionListener(this); + copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.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); + copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + deleteVersionButton.setToolTipText("Delete current version"); + deleteVersionButton.addActionListener(this); + + copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.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"); + 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); - replaceButton.setToolTipText("Replace current"); + replaceButton.setToolTipText("Save (replace current version)"); replaceButton.addActionListener(this); - replaceButton.setEnabled(false); + //replaceButton.setEnabled(false); copyOptionsPanel.add(updown); - copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - redoButton.setToolTipText("Next version"); - redoButton.addActionListener(this); - redoButton.setEnabled(false); + copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.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); + 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); @@ -721,21 +1150,6 @@ //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); rootButton.setToolTipText("Open selection in new tab"); @@ -751,7 +1165,7 @@ // INSERT row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - gridButton.setToolTipText("Create grid"); + gridButton.setToolTipText("Create ground"); gridButton.addActionListener(this); row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); @@ -819,107 +1233,15 @@ oe.toolboxPanel.add(row2); - // ENVYMAPS - cGridBag row3 = new cGridBag(); - row3.preferredHeight = 20; + cGridBag textures = new cGridBag(); - AddSkyboxButton("default", "rgb", row3); - AddSkyboxButton("default", "cornell", row3); - AddSkyboxButton("default", "uffizi", row3); - AddSkyboxButton("default", "CloudyHills", row3); - AddSkyboxButton("default", "skycube", row3); - - oe.toolboxPanel.add(row3); - - cGridBag row4 = new cGridBag(); - row4.preferredHeight = 20; + CreateTexturePanel(textures); - AddSkyboxButton("bridge", "Bridge2", row4); - AddSkyboxButton("urban", "GamlaStan2", row4); - AddSkyboxButton("urban", "Parliament", row4); - AddSkyboxButton("urban", "Roundabout", row4); + oe.toolboxPanel.add(textures); - oe.toolboxPanel.add(row4); - - cGridBag row5 = new cGridBag(); - row5.preferredHeight = 20; + textures.preferredHeight = 100; - AddSkyboxButton("urban", "SaintLazarusChurch", row5); - AddSkyboxButton("urban", "SaintLazarusChurch2", row5); - AddSkyboxButton("urban", "SaintLazarusChurch3", row5); - AddSkyboxButton("urban", "UnionSquare", row5); - - oe.toolboxPanel.add(row5); - - cGridBag row6 = new cGridBag(); - row6.preferredHeight = 20; - - AddSkyboxButton("park", "BerzeliiPark", row6); - AddSkyboxButton("park", "Buddha", row6); - AddSkyboxButton("park", "CNTower2", row6); - //AddSkyboxButton("park", "Fatbursparken", row6); - AddSkyboxButton("park", "NiagaraFalls1", row6); - - oe.toolboxPanel.add(row6); - - cGridBag row7 = new cGridBag(); - row7.preferredHeight = 20; - - AddSkyboxButton("park", "NiagaraFalls3", row7); - AddSkyboxButton("park", "Park", row7); - //AddSkyboxButton("park", "Park2", row6); - //AddSkyboxButton("park", "Path", row6); - AddSkyboxButton("park", "Pond", row7); - AddSkyboxButton("park", "Skansen", row7); - - oe.toolboxPanel.add(row7); - - cGridBag row8 = new cGridBag(); - row8.preferredHeight = 20; - - AddSkyboxButton("park", "Skansen2", row8); - AddSkyboxButton("park", "Skansen3", row8); - AddSkyboxButton("park", "Skansen4", row8); - AddSkyboxButton("park", "Skansen5", row8); - - oe.toolboxPanel.add(row8); - - cGridBag row9 = new cGridBag(); - row9.preferredHeight = 20; - - AddSkyboxButton("park", "Stairs", row9); - //AddSkyboxButton("park", "Tantolunden", row6); - //AddSkyboxButton("park", "Tantolunden3", row6); - AddSkyboxButton("park", "Tantolunden4", row9); - - oe.toolboxPanel.add(row9); -/* -BerzeliiPark -Buddha -CNTower2 -Fatbursparken -NiagaraFalls1 -NiagaraFalls3 -Park -Park2 -Path -Pond -Skansen -Skansen2 -Skansen3 -Skansen4 -Skansen5 -Stairs -Tantolunden -Tantolunden3 -Tantolunden4 - */ - - for (int i=1; --i>=0;) - { - //oe.toolboxPanel.Return(); - oe.toolboxPanel.add(new cGridBag()); - } + CreateSkyboxPanel(oe.skyboxPanel); // EDIT panel editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); @@ -927,20 +1249,20 @@ editButton.addActionListener(this); editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - uneditButton.setToolTipText("Remove selection controls"); + 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", !Grafreed.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); flashSelectionButton.setToolTipText("Highlight selection"); @@ -1000,7 +1322,7 @@ dgr.addDragGestureListener(this); }catch(Exception e) {} */ - radio.layout = sixButton; // sevenButton; + radio.layout = threeButton; // sixButton; oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); } @@ -1051,9 +1373,12 @@ smoothCB.setToolTipText("Snapping delay"); smoothCB.addItemListener(this); - panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints); - slowCB.setToolTipText("Smooth interpolation"); - slowCB.addItemListener(this); +// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints); +// slowCB.setToolTipText("Smooth interpolation"); +// slowCB.addItemListener(this); + panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints); + minshaderCB.setToolTipText("Minimal fast shader"); + minshaderCB.addItemListener(this); // constraints.gridy += 1; // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints); @@ -1132,6 +1457,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. @@ -1142,7 +1475,7 @@ } radioButton.SetObject(obj); - radioButton.layout = sixButton; // sevenButton; + radioButton.layout = threeButton; // sixButton; radioButton.SetCamera(cameraView.renderCamera, false); radioButton.addActionListener(this); radioPanel.add(radioButton); @@ -1167,6 +1500,8 @@ cCheckBox localCB; cCheckBox crowdCB; cCheckBox smoothCB; + cCheckBox minshaderCB; + cToggleButton fastCB; cCheckBox slowCB; cCheckBox boxCB; @@ -1237,6 +1572,12 @@ { cameraView.ToggleInertia(); cameraView.repaint(); + } + else if(e.getSource() == minshaderCB) + { + Globals.MINSHADER ^= true; + cameraView.programInitialized = false; + cameraView.repaint(); } else if(e.getSource() == localCB) { @@ -1514,7 +1855,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() { @@ -2377,7 +2723,7 @@ if (source == invariantsItem) { System.out.println("Invariants:"); - Grafreed.grafreeD.universe.invariants(); + Grafreed.grafreed.universe.invariants(); } else if (source == memoryItem) { @@ -2408,33 +2754,52 @@ { ToggleFullScreen(); } else - if (source == undoButton) + if (source == collapseButton) + { + this.expandedLayout = radio.layout; + CollapseToolbar(); + } else + if (source == maximize3DButton) + { + this.expandedLayout = radio.layout; + radio.layout = twoButton; + Show3DView(); + CollapseToolbar(); + } 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) { @@ -2489,11 +2854,11 @@ } else if (source == undoItem) { - Undo(); + PreviousVersion(); } else if (source == redoItem) { - Redo(); + NextVersion(); } else if (source == duplicateItem) { @@ -3352,38 +3717,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(); @@ -3569,6 +3903,7 @@ } else if (source == rootButton) { + Replace(); Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { @@ -3626,10 +3961,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; // ??????????? } @@ -3648,6 +3983,7 @@ obj.CloseUI(); } listUI.clear(); + SetPinStates(group.selection.size() > 0); refreshContents(true); } else if (source == allParamsButton) @@ -3704,8 +4040,6 @@ copy = group; - SetUndoStates(); - //Globals.theRenderer.object = group; if(!useclient) { @@ -3733,7 +4067,10 @@ */ radio.layout.doClick(); + SetUndoStates(); + ClearUnpinned(); + //Grafreed.Assert(group != null); //Grafreed.Assert(group.selection != null); SetPinStates(group.selection == null || group.selection.size() > 0); @@ -3750,11 +4087,13 @@ } else if (event.getSource() == editCameraItem) { cameraView.ProtectCamera(); + cameraView.requestFocusInWindow(); cameraView.repaint(); return; } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton) { cameraView.RevertCamera(); + cameraView.requestFocusInWindow(); cameraView.repaint(); return; // } else if (event.getSource() == textureButton) @@ -4887,9 +5226,7 @@ freezemodel = false; } - - boolean flashIt = true; - + public void valueChanged(TreeSelectionEvent e) //public boolean handleEvent(Event event) { @@ -4962,13 +5299,28 @@ { editButton.setEnabled(enabled); uneditButton.setEnabled(enabled); - unselectButton.setEnabled(enabled); + //unselectButton.setEnabled(enabled); flashSelectionButton.setEnabled(enabled); + + clearPanelButton.setEnabled(!listUI.isEmpty()); + + boolean allComposites = true; + + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + if (!(e.nextElement() instanceof Composite)) + { + allComposites = false; + break; + } + } + + rootButton.setEnabled(allComposites); } void refreshContents(boolean cp) { - if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) + //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) { objEditor.ClearInfo(); // .GetMaterial()); @@ -4978,7 +5330,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 @@ -5804,7 +6156,6 @@ cButton restoreCameraButton; - cButton saveButton; cButton oneStepButton; cButton groupButton; -- Gitblit v1.6.2