From 29d5516687020263d3ae0454ce81879a3a450af0 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Thu, 01 Aug 2019 00:20:18 -0400 Subject: [PATCH] Min shader option. --- GroupEditor.java | 1923 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 1,505 insertions(+), 418 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index 9db1b62..f72277a 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -23,6 +23,302 @@ DragGestureListener, DragSourceListener, DropTargetListener, ItemListener // ListSelectionListener { + + public void AddSkyboxButton(String f, String s, cGridBag row) + { + cButton skyboxButton; + final String path = "cubemaps/" + f + "-skyboxes/" + s; + 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() + { + @Override + public void actionPerformed(ActionEvent e) + { + ChangeSkybox(path); + } + }); + } + + 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 name) + { + //cameraView.envyoff = false; + group.skyboxname = name; + group.skyboxext = "jpg"; + cameraView.repaint(); + } + //ObjEditor objEditor; public void closeUI2() { @@ -60,6 +356,12 @@ this.copy = this.group = group; //selectees = this.group.selectees; + if (copy.versions == null) + { + copy.versions = new byte[100][]; + copy.versionindex = -1; + } + if(ui) SetupUI(objEditor); } @@ -74,16 +376,28 @@ this.copy = this.group = copy; //selectees = this.group.selectees; - SetupMenu2(objEditor); + SetupMenu2(this); //objEditor); SetupUI2(objEditor); objEditor.SetupUI(true); SetupViews(objEditor); ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); + + if (copy.versions == null) + { + copy.versions = new byte[100][]; + copy.versionindex = -1; + + Save(true); + } } void CloneSelection(boolean supports) { + if (Globals.REPLACEONMAKE) + Save(); + boolean keep = Globals.REPLACEONMAKE; + Globals.REPLACEONMAKE = false; // Object3D keep = GrafreeD.clipboard; //Object3D obj; for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -94,18 +408,19 @@ makeSomething(clone, i==group.selection.size()-1); } + Globals.REPLACEONMAKE = keep; } void CloneClipboard(boolean supports) { - assert(GrafreeD.clipboard.parent == null); - Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent; - GrafreeD.clipboard.get(0).parent = null; // Avoid copy? - if (LA.isIdentity(GrafreeD.clipboard.toParent)) - makeSomething(CloneObject(GrafreeD.clipboard.get(0), false)); + assert(Grafreed.clipboard.parent == null); + Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent; + Grafreed.clipboard.get(0).parent = null; // Avoid copy? + if (LA.isIdentity(Grafreed.clipboard.toParent)) + makeSomething(CloneObject(Grafreed.clipboard.get(0), false)); else - makeSomething(CloneObject(GrafreeD.clipboard, false)); - GrafreeD.clipboard.get(0).parent = keepparent; + makeSomething(CloneObject(Grafreed.clipboard, false)); + Grafreed.clipboard.get(0).parent = keepparent; } static Object3D CloneObject(Object3D obj, boolean supports) @@ -119,7 +434,7 @@ // obj.support = null; if (!supports) obj.SaveSupports(); - Object3D clone = (Object3D)GrafreeD.clone(obj); + Object3D clone = (Object3D)Grafreed.clone(obj); obj.parent = parent; // obj.support = support; // clone.support = support; // aout 2013 @@ -148,30 +463,29 @@ //JTextField nameField; - void SetupMenu2(ObjEditor oe) + void SetupMenu2(GroupEditor oe) { - oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); - //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); - //cameraMenu.add(switchItem = 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); - //switchItem.addActionListener(this); + oe.jTree = new cTree(); + Menu menu; oe.menuBar.add(menu = new Menu("Edit")); //editItem = menu.add(new MenuItem("Edit")); //editItem.addActionListener(this); - duplicateItem = menu.add(new MenuItem("Duplicate")); + +// undoItem = menu.add(new MenuItem("Undo")); +// undoItem.addActionListener(this); +// redoItem = menu.add(new MenuItem("Redo")); +// redoItem.addActionListener(this); +// menu.add("-"); + duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); duplicateItem.addActionListener(this); - menu.add("-"); cloneItem = menu.add(new MenuItem("Clone")); cloneItem.addActionListener(this); + if (Globals.ADVANCED) + { cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); cloneSupportItem.addActionListener(this); + } menu.add("-"); cutItem = menu.add(new MenuItem("Cut")); cutItem.addActionListener(this); @@ -179,27 +493,123 @@ copyItem.addActionListener(this); pasteItem = menu.add(new MenuItem("Paste")); pasteItem.addActionListener(this); + + menu.add("-"); + pasteIntoItem = menu.add(new MenuItem("Paste into")); + pasteIntoItem.addActionListener(this); pasteLinkItem = menu.add(new MenuItem("Paste link")); pasteLinkItem.addActionListener(this); pasteCloneItem = menu.add(new MenuItem("Paste clone")); pasteCloneItem.addActionListener(this); // pasteExpandItem = menu.add(new MenuItem("Paste expand")); // pasteExpandItem.addActionListener(this); - clearItem = menu.add(new MenuItem("Clear")); - clearItem.addActionListener(this); + menu.add("-"); + deleteItem = menu.add(new MenuItem("Delete")); + deleteItem.addActionListener(this); + + if (Globals.ADVANCED) + { + // Deletes the cameras... clearAllItem = menu.add(new MenuItem("Clear All")); clearAllItem.addActionListener(this); + } + + menuBar.add(cameraMenu = new Menu("View")); + //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); + //zBufferItem.addActionListener(this); + //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); + //normalLensItem.addActionListener(this); + cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint")); + restoreCameraItem.addActionListener(this); + +// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); +// toggleFullScreenItem.addItemListener(this); +// toggleFullScreenItem.setState(CameraPane.FULLSCREEN); +// cameraMenu.add("-"); +// +// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); +// toggleTextureItem.addItemListener(this); +// toggleTextureItem.setState(CameraPane.textureon); +// +// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch")); +// toggleSwitchItem.addItemListener(this); +// toggleSwitchItem.setState(CameraPane.SWITCH); + + cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles")); + toggleHandleItem.addItemListener(this); + toggleHandleItem.setState(CameraPane.HANDLES); + + cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); + togglePaintItem.addItemListener(this); + togglePaintItem.setState(CameraPane.PAINTMODE); + + if (Globals.ADVANCED) + { + cameraMenu.add("-"); + cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); + toggleLiveItem.addItemListener(this); + toggleLiveItem.setState(Globals.isLIVE()); + cameraMenu.add(stepItem = new MenuItem("Step")); + stepItem.addActionListener(this); + // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); + // toggleDLItem.addItemListener(this); + // toggleDLItem.setState(false); + + cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); + toggleRenderItem.addItemListener(this); + toggleRenderItem.setState(!CameraPane.frozen); + + cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); + toggleDebugItem.addItemListener(this); + toggleDebugItem.setState(Globals.DEBUG); + + cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); + toggleFrustumItem.addItemListener(this); + toggleFrustumItem.setState(CameraPane.FRUSTUM); + + cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); + toggleFootContactItem.addItemListener(this); + toggleFootContactItem.setState(CameraPane.FOOTCONTACT); + + cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); + toggleTimelineItem.addItemListener(this); + } + +// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); +// toggleRootItem.addItemListener(this); +// toggleRootItem.setState(false); +// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); +// animationItem.addItemListener(this); +// animationItem.setState(CameraPane.ANIMATION); + cameraMenu.add("-"); + cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint")); + editCameraItem.addActionListener(this); + + if (Globals.ADVANCED) + { + 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); + } + oe.menuBar.add(menu = new Menu("Setting")); - resetMeshItem = menu.add(new MenuItem("Reset All")); - resetMeshItem.addActionListener(this); - stepAllItem = menu.add(new MenuItem("Step All")); - stepAllItem.addActionListener(this); + if (Globals.ADVANCED) + { revertMeshItem = menu.add(new MenuItem("Revert Meshes")); revertMeshItem.addActionListener(this); resetreferencesItem = menu.add(new MenuItem("Reset Mesh References")); resetreferencesItem.addActionListener(this); menu.add("-"); + } overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry")); overwriteGeoItem.addActionListener(this); overwriteMatItem = menu.add(new MenuItem("Overwrite Material")); @@ -211,79 +621,104 @@ overwriteUVItem = menu.add(new MenuItem("Overwrite UV")); overwriteUVItem.addActionListener(this); menu.add("-"); + if (Globals.ADVANCED) + { generateMeshItem = menu.add(new MenuItem("Generate Meshes")); generateMeshItem.addActionListener(this); poseMeshItem = menu.add(new MenuItem("Set Pose Meshes")); poseMeshItem.addActionListener(this); menu.add("-"); + } resetsupportItem = menu.add(new MenuItem("Reset support")); resetsupportItem.addActionListener(this); linkverticesItem = menu.add(new MenuItem("Link to Support")); linkverticesItem.addActionListener(this); relinkverticesItem = menu.add(new MenuItem("Re-link to Support")); relinkverticesItem.addActionListener(this); + + if (Globals.ADVANCED) + { setMasterItem = menu.add(new MenuItem("Set Master Mesh")); setMasterItem.addActionListener(this); + } oe.menuBar.add(menu = new Menu("Group")); - grabItem = menu.add(new MenuItem("Grab")); - grabItem.addActionListener(this); +// grabItem = menu.add(new MenuItem("Grab")); +// grabItem.addActionListener(this); backItem = menu.add(new MenuItem("Back")); backItem.addActionListener(this); frontItem = menu.add(new MenuItem("Front")); frontItem.addActionListener(this); - compositeItem = menu.add(new MenuItem("Composite")); - compositeItem.addActionListener(this); - hideItem = menu.add(new MenuItem("Hide")); +// compositeItem = menu.add(new MenuItem("Composite")); +// compositeItem.addActionListener(this); + + if (Globals.ADVANCED) + { + hideItem = menu.add(new MenuItem("Hidden Group")); hideItem.addActionListener(this); + } ungroupItem = menu.add(new MenuItem("Ungroup")); ungroupItem.addActionListener(this); - menu.add("-"); - randomItem = menu.add(new MenuItem("Switch node")); - randomItem.addActionListener(this); + +// menu.add("-"); +// +// switchItem = menu.add(new MenuItem("Switch node")); +// switchItem.addActionListener(this); + if (Globals.ADVANCED) + { switchGeoItem = menu.add(new MenuItem("Switch Geometry")); switchGeoItem.addActionListener(this); switchTransfoItem = menu.add(new MenuItem("Switch Transform")); switchTransfoItem.addActionListener(this); + morphItem = menu.add(new MenuItem("Morph Group")); + morphItem.addActionListener(this); + + menu.add("-"); physicsItem = menu.add(new MenuItem("Physics")); physicsItem.addActionListener(this); frameselectorItem = menu.add(new MenuItem("Frame Selector")); frameselectorItem.addActionListener(this); - morphItem = menu.add(new MenuItem("Morph")); - morphItem.addActionListener(this); scriptNodeItem = menu.add(new MenuItem("Script Node")); scriptNodeItem.addActionListener(this); - cameraItem = menu.add(new MenuItem("Camera")); - cameraItem.addActionListener(this); + } oe.menuBar.add(menu = new Menu("Object")); - textureItem = menu.add(new MenuItem("Texture")); - textureItem.addActionListener(this); +// textureItem = menu.add(new MenuItem("Texture")); +// textureItem.addActionListener(this); billboardItem = menu.add(new MenuItem("Billboard")); billboardItem.addActionListener(this); csgItem = menu.add(new MenuItem("CSG")); csgItem.addActionListener(this); - shadowXItem = menu.add(new MenuItem("Shadow X")); + shadowXItem = menu.add(new MenuItem("Shadow Red")); shadowXItem.addActionListener(this); - shadowYItem = menu.add(new MenuItem("Shadow Y")); + shadowYItem = menu.add(new MenuItem("Shadow Green")); shadowYItem.addActionListener(this); - shadowZItem = menu.add(new MenuItem("Shadow Z")); + shadowZItem = menu.add(new MenuItem("Shadow Blue")); shadowZItem.addActionListener(this); + attributeItem = menu.add(new MenuItem("Attribute")); + attributeItem.addActionListener(this); + + if (Globals.ADVANCED) + { + menu.add("-"); linkerItem = menu.add(new MenuItem("Linker")); linkerItem.addActionListener(this); templateItem = menu.add(new MenuItem("Template")); templateItem.addActionListener(this); - attributeItem = menu.add(new MenuItem("Attribute")); - attributeItem.addActionListener(this); pointflowItem = menu.add(new MenuItem("Point Flow")); pointflowItem.addActionListener(this); + } menu.add("-"); resetTransformItem = menu.add(new MenuItem("Reset Transform")); resetTransformItem.addActionListener(this); resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); resetCentroidItem.addActionListener(this); - transformgeometryItem = menu.add(new MenuItem("Transform Geometry")); - transformgeometryItem.addActionListener(this); + resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY")); + resetCentroidXZItem.addActionListener(this); + transformGeometryItem = menu.add(new MenuItem("Transform Geometry")); + transformGeometryItem.addActionListener(this); + transformChildrenItem = menu.add(new MenuItem("Transform Children")); + transformChildrenItem.addActionListener(this); oe.menuBar.add(menu = new Menu("Geometry")); genUVItem = menu.add(new MenuItem("Generate UV")); @@ -294,8 +729,11 @@ genNormalsCADItem.addActionListener(this); genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals")); genNormalsMESHItem.addActionListener(this); - genNormalsMINEItem = menu.add(new MenuItem("My Normals")); + if (Globals.ADVANCED) + { + genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals")); genNormalsMINEItem.addActionListener(this); + } stripifyItem = menu.add(new MenuItem("Stripify")); stripifyItem.addActionListener(this); unstripifyItem = menu.add(new MenuItem("Unstripify")); @@ -317,23 +755,34 @@ reduce34MeshItem.addActionListener(this); increaseMeshItem = menu.add(new MenuItem("Increase mesh")); increaseMeshItem.addActionListener(this); - smoothMeshItem = menu.add(new MenuItem("Smooth mesh")); - smoothMeshItem.addActionListener(this); clipMeshItem = menu.add(new MenuItem("Clip mesh")); clipMeshItem.addActionListener(this); + + if (Globals.ADVANCED) + { + smoothMeshItem = menu.add(new MenuItem("Smooth mesh")); + smoothMeshItem.addActionListener(this); + } oe.menuBar.add(menu = new Menu("Attributes")); clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); clearMaterialsItem.addActionListener(this); + resetAllItem = menu.add(new MenuItem("Reset All")); + resetAllItem.addActionListener(this); + stepAllItem = menu.add(new MenuItem("Step All")); + stepAllItem.addActionListener(this); menu.add("-"); liveleavesItem = menu.add(new MenuItem("Live Leaves")); liveleavesItem.addActionListener(this); unliveleavesItem = menu.add(new MenuItem("Unlive Leaves")); unliveleavesItem.addActionListener(this); + if (Globals.ADVANCED) + { supportleavesItem = menu.add(new MenuItem("Support Leaves")); supportleavesItem.addActionListener(this); unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves")); unsupportleavesItem.addActionListener(this); + } hideleavesItem = menu.add(new MenuItem("Hide Leaves")); hideleavesItem.addActionListener(this); showleavesItem = menu.add(new MenuItem("Show Leaves")); @@ -342,6 +791,14 @@ markleavesItem.addActionListener(this); unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves")); unmarkleavesItem.addActionListener(this); + rewindleavesItem = menu.add(new MenuItem("Rewind Leaves")); + rewindleavesItem.addActionListener(this); + unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves")); + unrewindleavesItem.addActionListener(this); + randomleavesItem = menu.add(new MenuItem("Random Leaves")); + randomleavesItem.addActionListener(this); + unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves")); + unrandomleavesItem.addActionListener(this); menu.add("-"); flipVItem = menu.add(new MenuItem("Flip V")); flipVItem.addActionListener(this); @@ -367,45 +824,56 @@ attachBumpItem.addActionListener(this); pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump")); pigmentBumpItem.addActionListener(this); + //embedTexturesItem detachPigmentItem = menu.add(new MenuItem("Detach Pigment")); detachPigmentItem.addActionListener(this); detachBumpItem = menu.add(new MenuItem("Detach Bump")); detachBumpItem.addActionListener(this); + embedTexturesItem = menu.add(new MenuItem("Embed Textures")); + embedTexturesItem.addActionListener(this); + deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures")); + deEmbedTexturesItem.addActionListener(this); menu.add("-"); sortbysizeItem = menu.add(new MenuItem("Sort by size")); sortbysizeItem.addActionListener(this); sortbynameItem = menu.add(new MenuItem("Sort by name")); sortbynameItem.addActionListener(this); menu.add("-"); + shareGeometriesItem = menu.add(new MenuItem("Share Geometries")); + shareGeometriesItem.addActionListener(this); + mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); + mergeGeometriesItem.addActionListener(this); + if (Globals.ADVANCED) + { + // Pretty much the same as duplicate and clone. extractGeometriesItem = menu.add(new MenuItem("Link Geometry")); extractGeometriesItem.addActionListener(this); cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry")); cloneGeometriesItem.addActionListener(this); - shareGeometriesItem = menu.add(new MenuItem("Share Geometry")); - shareGeometriesItem.addActionListener(this); - mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry")); - mergeGeometriesItem.addActionListener(this); + } oe.menuBar.add(menu = new Menu("Insert")); buildCreateMenu(menu); - - oe.menuBar.add(menu = new Menu("Include")); - importGFDItem = menu.add(new MenuItem("GrafreeD Object...")); - importGFDItem.addActionListener(this); - importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object...")); - importVRMLX3DItem.addActionListener(this); - importOBJItem = menu.add(new MenuItem("OBJ Object...")); - importOBJItem.addActionListener(this); - import3DSItem = menu.add(new MenuItem("3DS Object...")); - import3DSItem.addActionListener(this); - oe.menuBar.add(menu = new Menu("Tools")); buildToolsMenu(menu); } + void SetupUI2(ObjEditor oe) { + // June 2019 + if (oe == null) + { + //super.SetupUI2(this); + //return; + } + + if (copy != group) + { + //super.SetupUI2(this); + } + //new Exception().printStackTrace(); oe.radioPanel = new JPanel(new GridBagLayout()); @@ -434,93 +902,238 @@ oe.radioPanel.add(dummyButton); oe.buttonGroup.add(dummyButton); */ + cGridBag copyOptionsPanel = new cGridBag(); + + copyOptionsPanel.preferredHeight = 2; + //this.AddOptions(oe.toolbarPanel, oe.aConstraints); - oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints); - liveCB.setToolTipText("Enabled animation"); + //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + //minButton.setToolTipText("Minimize window"); + //minButton.addActionListener(this); + + 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(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); + screenfitButton.setToolTipText("Screen fit"); + screenfitButton.addActionListener(this); + + oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + 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(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + undoButton.setToolTipText("Previous version"); + undoButton.addActionListener(this); + undoButton.setEnabled(false); + + cGridBag updown = new cGridBag().setVertical(true); + updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + restoreButton.setToolTipText("Restore current"); + restoreButton.addActionListener(this); + restoreButton.setEnabled(false); + + updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + replaceButton.setToolTipText("Replace current"); + replaceButton.addActionListener(this); + 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); + + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); + liveCB.setToolTipText("Enable animation"); liveCB.addItemListener(this); - oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints); + 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); - oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints); - trackCB.setToolTipText("Enable tracking"); - trackCB.addItemListener(this); - - oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - screenfitButton.setToolTipText("Screen fit"); - screenfitButton.addActionListener(this); + //oe.toolboxPanel.Return(); + +// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); +// trackCB.setToolTipText("Enable tracking"); +// trackCB.addItemListener(this); // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints); // screenfitpointButton.addActionListener(this); if (Globals.ADVANCED) { - oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); snapobjectButton.addActionListener(this); snapobjectButton.setToolTipText("Snap Object"); + + oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + fourButton.addActionListener(this); + fourButton.setToolTipText("Show control panel only"); } - oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - flashSelectionButton.setToolTipText("Show selection"); - flashSelectionButton.addActionListener(this); + //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); - oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); - - oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - twoButton.setToolTipText("Show center view only"); + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + twoButton.setToolTipText("Show 3D view only"); twoButton.addActionListener(this); - oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - fourButton.addActionListener(this); - fourButton.setToolTipText("Show left panel only"); - oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - sixButton.setToolTipText("2-column layout left"); - sixButton.addActionListener(this); - oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - threeButton.setToolTipText("2-column layout right"); + 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(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - sevenButton.setToolTipText("3-column layout"); - sevenButton.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 = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - rootButton.setToolTipText("Edit selection in new tab"); + oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + rootButton.setToolTipText("Open selection in new tab"); rootButton.addActionListener(this); - oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); closeButton.setToolTipText("Close tab"); closeButton.addActionListener(this); //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); //clearButton.addActionListener(this); - - cGridBag commandsPanel = new cGridBag(); + + cGridBag row1 = new cGridBag(); - commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - editButton.setToolTipText("Edit selection"); + // INSERT + row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + gridButton.setToolTipText("Create grid"); + gridButton.addActionListener(this); + + row1.add(boxButton = GetButton("icons/box.png", !Grafreed.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); + superButton.setToolTipText("Create superellipsoid"); + superButton.addActionListener(this); + + if (Globals.ADVANCED) + { + oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + kleinButton.setToolTipText("Create Klein bottle"); + kleinButton.addActionListener(this); + } + + row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + particlesButton.setToolTipText("Create particle system"); + particlesButton.addActionListener(this); + + oe.toolboxPanel.add(row1); + + cGridBag row2 = new cGridBag(); + + row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + groupButton.setToolTipText("Create group"); + groupButton.addActionListener(this); + + row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + compositeButton.setToolTipText("Create composite"); + compositeButton.addActionListener(this); + + row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + switchButton.setToolTipText("Create item switcher"); + switchButton.addActionListener(this); + + row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + loopButton.setToolTipText("Create loop"); + loopButton.addActionListener(this); + + row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + textureButton.setToolTipText("Create texture"); + textureButton.addActionListener(this); + + row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + overlayButton.setToolTipText("Create overlay"); + overlayButton.addActionListener(this); + + row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + lightButton.setToolTipText("Create light"); + lightButton.addActionListener(this); + + oe.toolboxPanel.add(row2); + + // ENVYMAPS + cGridBag skyboxpane = new cGridBag(); + skyboxpane.preferredHeight = 100; + + oe.toolboxPanel.add(skyboxpane); + + JTabbedPane skyboxpanel = new JTabbedPane(); + skyboxpane.add(skyboxpanel); + + AddSkyboxTab0(skyboxpanel); + AddSkyboxTab1(skyboxpanel); + AddSkyboxTab2(skyboxpanel); + AddSkyboxTab3(skyboxpanel); + + // EDIT panel + editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + editButton.setToolTipText("Pin selection controls"); editButton.addActionListener(this); - commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); - uneditButton.setToolTipText("Unedit selection"); + editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + uneditButton.setToolTipText("Remove selection controls"); uneditButton.addActionListener(this); - commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); - allParamsButton.setToolTipText("Edit all params"); + editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); + allParamsButton.setToolTipText("Show all controle"); allParamsButton.addActionListener(this); - commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); + editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); clearPanelButton.setToolTipText("Clear edit panel"); clearPanelButton.addActionListener(this); - commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); + editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); unselectButton.setToolTipText("Unselect"); unselectButton.addActionListener(this); - commandsPanel.preferredHeight = 1; + editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + flashSelectionButton.setToolTipText("Highlight selection"); + flashSelectionButton.addActionListener(this); - oe.treePanel.add(commandsPanel); - oe.treePanel.Return(); + editCommandsPanel.preferredHeight = 1; + + SetPinStates(false); +// oe.treePanel.add(commandsPanel); +// oe.treePanel.Return(); // oe.aConstraints.gridx += 1; // oe.aConstraints.weighty = 0; @@ -537,32 +1150,20 @@ JScrollPane jSP; //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); - jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints); + jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints); ResetModel(); oe.treePanel.add(jSPPanel); oe.treePanel.Return(); - cGridBag copyOptionsPanel = new cGridBag(); - - copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints); - colorCB.setToolTipText("Copy color when dropped"); - colorCB.addItemListener(this); - - copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints); - materialCB.setToolTipText("Copy material when dropped"); - materialCB.addItemListener(this); - - copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints); - textureCB.setToolTipText("Copy texture when dropped"); - textureCB.addItemListener(this); - - copyOptionsPanel.preferredHeight = 1; oe.treePanel.add(copyOptionsPanel); oe.treePanel.Return(); + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); + versionSlider = (cNumberSlider)sliderPane.getComponent(1); + sliderPane.preferredHeight = 1; -// mainPanel.setDividerLocation(0.5); //1.0); -// mainPanel.setResizeWeight(0.5); +// mainPanel.setDividerLocation(0.1); //1.0); + mainPanel.setResizeWeight(0.4); //jList.addListSelectionListener(this); oe.jTree.addTreeSelectionListener(this); @@ -570,7 +1171,7 @@ //jTree.setEditable(true); oe.jTree.setDragEnabled(true); //jTree.setPreferredSize(new Dimension(10,10)); - jSP.setPreferredSize(new Dimension(100,200)); + //jSP.setPreferredSize(new Dimension(100,200)); oe.jTree.setCellRenderer(new cTreeModel.Renderer()); @@ -582,19 +1183,49 @@ dgr.addDragGestureListener(this); }catch(Exception e) {} */ - radio.layout = sevenButton; + radio.layout = sixButton; // sevenButton; oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); } void AddOptions(cGridBag panel) //, GridBagConstraints constraints) { - panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); - supportCB.setToolTipText("Enabled rigging"); - supportCB.addItemListener(this); + panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints); + colorCB.setToolTipText("Copy color when dropped"); + colorCB.addItemListener(this); + + panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints); + materialCB.setToolTipText("Copy material when dropped"); + materialCB.addItemListener(this); + + panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints); + textureCB.setToolTipText("Copy texture when dropped"); + textureCB.addItemListener(this); + + panel.Return(); + + panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints); + boxCB.setToolTipText("Display bounding boxes"); + boxCB.addItemListener(this); + + panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints); + zoomBoxCB.setToolTipText("Display only for wheel"); + zoomBoxCB.addItemListener(this); + + if (true) // Globals.ADVANCED) + { +// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); +// supportCB.setToolTipText("Enable rigging"); +// supportCB.addItemListener(this); + + panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints); + freezeCB.setToolTipText("Fast moving camera"); + freezeCB.addItemListener(this); // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); // localCB.addItemListener(this); + panel.Return(); + panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints); crowdCB.setToolTipText("Used for crowds"); crowdCB.addItemListener(this); @@ -603,22 +1234,19 @@ 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); - panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints); - boxCB.setToolTipText("Display bounding boxes"); - boxCB.addItemListener(this); - - panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints); - zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel"); - zoomBoxCB.addItemListener(this); - // constraints.gridy += 1; // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints); // speakerMocapCB.addItemListener(this); + panel.Return(); + if (false) { // handled in scripts @@ -633,40 +1261,85 @@ //constraints.gridy += 1; panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints); smoothfocusCB.addItemListener(this); + panel.Return(); } //constraints.gridx += 1; //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints); // debugCB.addItemListener(this); + panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints); + trackCB.setToolTipText("Enable tracking target"); + trackCB.addItemListener(this); + panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints); + oeilCB.setToolTipText("Move camera when tracking"); oeilCB.addItemListener(this); + panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints); + shadowCB.setToolTipText("When live compute shadows"); + shadowCB.addItemListener(this); + + panel.Return(); + panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints); + toggleTextureCB.setToolTipText("Load textures"); + toggleTextureCB.addItemListener(this); + + panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints); + toggleSwitchCB.setToolTipText("Choose a single item"); + toggleSwitchCB.addItemListener(this); + + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); + autokeepCB.setToolTipText("On structure change"); + autokeepCB.addItemListener(this); + + panel.Return(); + if (Globals.ADVANCED) + { panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints); lookAtCB.setToolTipText("Look-at target"); lookAtCB.addItemListener(this); + } + + } cGridBag fill = new cGridBag(); - fill.preferredHeight = 200; + cGridBag fill2 = new cGridBag(); + fill2.preferredHeight = 200; + cGridBag fill3 = new cGridBag(); + fill3.preferredHeight = 200; panel.add(fill); + panel.add(fill2); + panel.add(fill3); } void EditObject(Object3D obj) { cRadio radioButton = new cRadio(obj.name); + + // June 2019. Patch to avoid bug with transparency. + radioButton.hadMaterial = obj.material != null; + if (!radioButton.hadMaterial) + { + obj.material = new cMaterial(); + } + radioButton.SetObject(obj); - radioButton.layout = sevenButton; + radioButton.layout = sixButton; // sevenButton; radioButton.SetCamera(cameraView.renderCamera, false); radioButton.addActionListener(this); radioPanel.add(radioButton); buttonGroup.add(radioButton); radioButton.doClick(); } + void SetupViews(ObjEditor oe) { + theFrame = this; + oe.SetupViews(); System.out.println("SetupViews"); @@ -675,23 +1348,30 @@ /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this); } - JCheckBox liveCB; - JCheckBox supportCB; - JCheckBox localCB; - JCheckBox crowdCB; - JCheckBox smoothCB; - JCheckBox fastCB; - JCheckBox slowCB; - JCheckBox boxCB; - JCheckBox zoomBoxCB; - JCheckBox trackCB; - JCheckBox smoothfocusCB; + cToggleButton liveCB; + cCheckBox supportCB; + cCheckBox localCB; + cCheckBox crowdCB; + cCheckBox smoothCB; + cCheckBox minshaderCB; + + cToggleButton fastCB; + cCheckBox slowCB; + cCheckBox boxCB; + cCheckBox zoomBoxCB; + cCheckBox freezeCB; + //cToggleButton trackCB; + cCheckBox trackCB; + cCheckBox smoothfocusCB; // JCheckBox speakerMocapCB; - JCheckBox speakerCameraCB; - JCheckBox speakerFocusCB; - JCheckBox debugCB; - JCheckBox oeilCB; - JCheckBox lookAtCB; + cCheckBox speakerCameraCB; + cCheckBox speakerFocusCB; + cCheckBox debugCB; + + cCheckBox oeilCB; + cCheckBox shadowCB; + cCheckBox autokeepCB; + cCheckBox lookAtCB; // static int COLOR = 1; // static int MATERIAL = 2; @@ -699,9 +1379,9 @@ int dropAttributes = Object3D.COLOR | Object3D.MATERIAL; - JCheckBox colorCB; - JCheckBox materialCB; - JCheckBox textureCB; + cCheckBox colorCB; + cCheckBox materialCB; + cCheckBox textureCB; public void itemStateChanged(ItemEvent e) { @@ -729,6 +1409,7 @@ } else if(e.getSource() == liveCB) { cameraView.ToggleLive(); + refreshContents(false); } else if(e.getSource() == supportCB) { @@ -744,6 +1425,12 @@ { cameraView.ToggleInertia(); cameraView.repaint(); + } + else if(e.getSource() == minshaderCB) + { + Globals.MINSHADER ^= true; + cameraView.programInitialized = false; + cameraView.repaint(); } else if(e.getSource() == localCB) { @@ -793,6 +1480,18 @@ { cameraView.ToggleOeil(); } + else if(e.getSource() == shadowCB) + { + Globals.COMPUTESHADOWWHENLIVE ^= true; + } + else if(e.getSource() == freezeCB) + { + Globals.FREEZEONMOVE ^= true; + } + else if(e.getSource() == autokeepCB) + { + Globals.REPLACEONMAKE ^= true; + } else if(e.getSource() == lookAtCB) { cameraView.ToggleLookAt(); @@ -809,7 +1508,8 @@ /**/ //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this); - TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent()); + //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent()); + TreePath path = objEditor.jTree.getSelectionPath(); if ((path == null) || (path.getPathCount() <= 1)) { // We can't move the root node or an empty selection return; @@ -872,8 +1572,6 @@ } } - String string = (String) object; - System.out.println("Transfer = " + object + "; drop : " + target); // if( object instanceof java.io.File[]) // { @@ -881,7 +1579,11 @@ // objEditor.DropFile((java.io.File[]) object, true); // return; // } - if (string.charAt(0) == '/') + + String string = object.toString(); + + // File path for Mac and Windows + if (string.charAt(0) == '/' || string.charAt(1) == ':') { // file(s) String[] names = string.split("\n"); @@ -908,7 +1610,7 @@ flashIt = false; CameraPane pane = (CameraPane) target; - pane.clickStart(objEditor.location.x, objEditor.location.y, 0); + pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0); pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true); if (group.selection.size() == 1) @@ -924,23 +1626,33 @@ assert target == objEditor.jTree; TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y); + Object3D destinationLeaf; try { - Object3D dummy = (Composite) destinationPath.getLastPathComponent(); + destinationLeaf = (Composite) destinationPath.getLastPathComponent(); } catch (Exception e) { System.out.println("destinationPath : " + destinationPath); return; } - if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK) + for (int i=group.selection.size(); --i>=0;) { + Object3D child = (Object3D)group.selection.elementAt(i); + + // Cannot move into itself + if (child == destinationLeaf) + return; + } + +// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK) +// { loadClipboard(true); objEditor.jTree.setSelectionPath(destinationPath); - pasteInto(false); - } else { - loadClipboard(false); - objEditor.jTree.setSelectionPath(destinationPath); - pasteInto(false); // true); // ??? - } + pasteInto(false, false); +// } else { +// loadClipboard(false); +// objEditor.jTree.setSelectionPath(destinationPath); +// pasteInto(false, false); // true); // ??? +// } } public void dropActionChanged(DropTargetDragEvent dtde) // Called if the user has modified the current drop gesture @@ -1045,54 +1757,71 @@ { //heightFieldItem = menu.add(new MenuItem("Height Field")); //heightFieldItem.addActionListener(this); - gridItem = menu.add(new MenuItem("Grid")); - gridItem.addActionListener(this); - rectoidItem = menu.add(new MenuItem("Box")); - rectoidItem.addActionListener(this); - ellipsoidItem = menu.add(new MenuItem("Sphere")); - ellipsoidItem.addActionListener(this); - coneItem = menu.add(new MenuItem("Cone")); - coneItem.addActionListener(this); - torusItem = menu.add(new MenuItem("Torus")); - torusItem.addActionListener(this); - superItem = menu.add(new MenuItem("Superellipsoid")); - superItem.addActionListener(this); +// gridItem = menu.add(new MenuItem("Grid")); +// gridItem.addActionListener(this); +// rectoidItem = menu.add(new MenuItem("Box")); +// rectoidItem.addActionListener(this); +// ellipsoidItem = menu.add(new MenuItem("Sphere")); +// ellipsoidItem.addActionListener(this); +// coneItem = menu.add(new MenuItem("Cone")); +// coneItem.addActionListener(this); +// torusItem = menu.add(new MenuItem("Torus")); +// torusItem.addActionListener(this); +// superItem = menu.add(new MenuItem("Superellipsoid")); +// superItem.addActionListener(this); + + cameraItem = menu.add(new MenuItem("Camera")); + cameraItem.addActionListener(this); + + if (!Globals.ADVANCED) + { kleinItem = menu.add(new MenuItem("Klein Bottle")); kleinItem.addActionListener(this); - particleItem = menu.add(new MenuItem("Particle system")); - particleItem.addActionListener(this); + } + +// particleItem = menu.add(new MenuItem("Particle system")); +// particleItem.addActionListener(this); + if (Globals.ADVANCED) + { ragdollItem = menu.add(new MenuItem("Rag Walk")); ragdollItem.addActionListener(this); ragdoll2Item = menu.add(new MenuItem("Rag Fall")); ragdoll2Item.addActionListener(this); + } menu.add("-"); - meshItem = menu.add(new MenuItem("Mesh")); + meshItem = menu.add(new MenuItem("Dynamic Mesh")); meshItem.addActionListener(this); // meshGroupItem = menu.add(new MenuItem("Mesh Group")); // meshGroupItem.addActionListener(this); + if (Globals.ADVANCED) + { springItem = menu.add(new MenuItem("Spring")); springItem.addActionListener(this); flagItem = menu.add(new MenuItem("Flag")); flagItem.addActionListener(this); - bezierItem = menu.add(new MenuItem("Patch")); - bezierItem.addActionListener(this); - checkerItem = menu.add(new MenuItem("Checker")); - checkerItem.addActionListener(this); blobItem = menu.add(new MenuItem("Blob")); blobItem.addActionListener(this); latheItem = menu.add(new MenuItem("Lathe")); latheItem.addActionListener(this); - lightItem = menu.add(new MenuItem("Light")); - lightItem.addActionListener(this); + } + bezierItem = menu.add(new MenuItem("Bezier Patch")); + bezierItem.addActionListener(this); +// overlayItem = menu.add(new MenuItem("Overlay")); +// overlayItem.addActionListener(this); +// lightItem = menu.add(new MenuItem("Light")); +// lightItem.addActionListener(this); menu.add("-"); //superLoopItem = menu.add(new MenuItem("Super Loop")); //superLoopItem.addActionListener(this); - loopItem = menu.add(new MenuItem("Loop")); - loopItem.addActionListener(this); +// loopItem = menu.add(new MenuItem("Loop")); +// loopItem.addActionListener(this); doubleItem = menu.add(new MenuItem("Fork")); doubleItem.addActionListener(this); + if (Globals.ADVANCED) + { tripleItem = menu.add(new MenuItem("Trident")); tripleItem.addActionListener(this); + } } void buildToolsMenu(Menu menu) @@ -1101,29 +1830,34 @@ animationItem.addItemListener(this); animationItem.setState(Globals.ANIMATION); + menu.add(archiveItem = new MenuItem("Archive3D...")); + archiveItem.addActionListener(this); + menu.add("-"); parseverticesItem = menu.add(new MenuItem("Multiplicity")); parseverticesItem.addActionListener(this); textureFieldItem = menu.add(new MenuItem("Texture Field")); textureFieldItem.addActionListener(this); - alignItem = menu.add(new MenuItem("Align")); + alignItem = menu.add(new MenuItem("Align Objects")); alignItem.addActionListener(this); - mirrorItem = menu.add(new MenuItem("Mirror Poses")); - mirrorItem.addActionListener(this); reduceMorphItem = menu.add(new MenuItem("Reduce Morphs")); reduceMorphItem.addActionListener(this); reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); reduce34MorphItem.addActionListener(this); - - menu.add(computeAOItem = new MenuItem("Compute AO")); - computeAOItem.addActionListener(this); menu.add("-"); - menu.add(memoryItem = new MenuItem("Memory Usage")); memoryItem.addActionListener(this); + menu.add(computeAOItem = new MenuItem("Compute AO")); + computeAOItem.addActionListener(this); + + if (Globals.ADVANCED) + { + mirrorItem = menu.add(new MenuItem("Mirror Poses")); + mirrorItem.addActionListener(this); + menu.add("-"); menu.add(analyzeItem = new MenuItem("Analyze")); analyzeItem.addActionListener(this); - menu.add(dumpItem = new MenuItem("Dump")); + menu.add(dumpItem = new MenuItem("Print")); dumpItem.addActionListener(this); // menu.add(pathItem = new MenuItem("From-to path")); // pathItem.addActionListener(this); @@ -1141,6 +1875,7 @@ menu.add("-"); menu.add(editScriptItem = new MenuItem("Edit Script...")); editScriptItem.addActionListener(this); + } } void ScreenFit() @@ -1263,9 +1998,34 @@ shadow.material = new cMaterial(obj.material); shadow.material.diffuse = 0.0001f; shadow.material.specular = 0.0001f; + //shadow.projectedVertices[1].x = 300; makeSomething(shadow); } + + private void ClearUnpinned() + { + //for (Object3D obj : listUI) + for (int i=listUI.size(); --i>=0;) + { + Object3D obj = listUI.elementAt(i); + if (!obj.pinned) + { + obj.CloseUI(); + listUI.remove(i); + } + } + } + + private void EditElement(Object3D elem, boolean newWindow) + { + // if (!(elem instanceof Composite)) + // newWindow = false; + listUI.add(elem); + elem.openEditWindow(this, newWindow); //, false); + System.out.println("edit : " + elem); + elem.editWindow.refreshContents(true); // ? new + } /** * applyExample @@ -1469,9 +2229,9 @@ void Overwrite(int mask) { - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -1510,7 +2270,7 @@ { ScreenFit(); } else - if (source == switchItem) + if (source == switchViewItem) { cVector v1 = new cVector(); cVector v2 = new cVector(); @@ -1519,11 +2279,11 @@ objEditor.cameraView.renderCamera.setAim(v2, v1); objEditor.cameraView.repaint(); } else - if (source == rectoidItem) + if (source == rectoidItem || source == boxButton) { makeSomething(new Box()); } else - if (source == particleItem) + if (source == particleItem || source == particlesButton) { ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType); ParticleController particleController = new ParticleController(particleGeom); @@ -1602,27 +2362,27 @@ makeSomething(obj); } else - if (source == gridItem) + if (source == gridItem || source == gridButton) { makeSomething(new Grid()); } else - if (source == ellipsoidItem) + if (source == ellipsoidItem || source == sphereButton) { makeSomething(new Sphere()); } else - if (source == coneItem) + if (source == coneItem || source == coneButton) { makeSomething(new Cone()); } else - if (source == torusItem) + if (source == torusItem || source == torusButton) { makeSomething(new Torus()); } else - if (source == superItem) + if (source == superItem || source == superButton) { makeSomething(new Superellipsoid()); } else - if (source == kleinItem) + if (source == kleinItem || source == kleinButton) { makeSomething(new Klein()); } else @@ -1642,7 +2402,7 @@ { makeSomething(new BezierSurface()); } else - if (source == checkerItem) + if (source == overlayItem || source == overlayButton) { /* Object3D obj = new BezierSurface(5,8); @@ -1690,10 +2450,27 @@ s.setup(); makeSomething(s); } else - if (source == lightItem) + if (source == lightItem || source == lightButton) { makeSomething(new Light()); } else +// if (source == skybox1Button || +// source == skybox2Button || +// source == skybox3Button || +// source == skybox4Button || +// source == skybox5Button || +// source == skybox6Button || +// source == skybox7Button || +// source == skybox11Button || +// source == skybox12Button || +// source == skybox13Button || +// source == skybox14Button || +// source == skybox15Button || +// source == skybox16Button || +// source == skybox17Button) +// { +// ChangeSkybox(source); +// } else if (source == csgItem) { group(new CSG()); @@ -1740,30 +2517,30 @@ group(g); } else - if (source == loopItem) + if (source == loopItem || source == loopButton) { Composite csg = new GroupLeaf(); csg.count = 5; group(csg); - Composite child = new cGroup(); + Composite child = new cGroup("Branch"); csg.addChild(child); child.addChild(csg); } else if (source == doubleItem) { - Composite csg = new GroupLeaf(); + Composite csg = new GroupLeaf("Fork"); csg.count = 5; group(csg); - Composite child = new cGroup(); + Composite child = new cGroup("Branch A"); csg.addChild(child); child.addChild(csg); - child = new cGroup(); + child = new cGroup("Branch B"); csg.addChild(child); child.addChild(csg); } else if (source == tripleItem) { - Composite csg = new GroupLeaf(); + Composite csg = new GroupLeaf("Trident"); csg.count = 4; group(csg); Composite child = new cGroup(); @@ -1776,27 +2553,10 @@ csg.addChild(child); child.addChild(csg); } else - - if (source == importGFDItem) - { - ImportGFD(); - } else - if (source == importVRMLX3DItem) - { - ImportVRMLX3D(); - } else - if (source == import3DSItem) - { - objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); - } else - if (source == importOBJItem) - { - objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); - } else if (source == computeAOItem) { Globals.drawMode = CameraPane.OCCLUSION; - Globals.theRenderer.repaint(); + cameraView.repaint(); } else if (source == recompileItem) { @@ -1811,7 +2571,7 @@ if (source == invariantsItem) { System.out.println("Invariants:"); - GrafreeD.grafreeD.universe.invariants(); + Grafreed.grafreeD.universe.invariants(); } else if (source == memoryItem) { @@ -1830,19 +2590,61 @@ { DumpObject(); } else + if (source == minButton) + { + Minimize(); + } else + if (source == maxButton) + { + Maximize(); + } else + if (source == fullButton) + { + ToggleFullScreen(); + } else + if (source == undoButton) + { + // Go to previous version + //if (!Undo()) + //java.awt.Toolkit.getDefaultToolkit().beep(); + Undo(); + } else + if (source == restoreButton) + { + // Restore current version + Restore(); + } else + if (source == replaceButton) + { + // Overwrite current version + Replace(); + } else + if (source == redoButton) + { + // Go to next version + Redo(); + } else + if (source == saveButton) + { + // Save a new version + if (!Save(true)) + java.awt.Toolkit.getDefaultToolkit().beep(); + } else + if (source == oneStepButton) + { + Globals.ONESTEP = true; + cameraView.repaint(); + } else if (source == screenfitButton) { - //Reload(lastConverter, lastFilename, true); ScreenFit(); } else if (source == screenfitpointButton) { - //Reload(lastConverter, lastFilename, true); ScreenFitPoint(); } else if (source == snapobjectButton) { - //Reload(lastConverter, lastFilename, true); SnapObject(); } else // if (event.getSource() == recompileButton) @@ -1879,12 +2681,20 @@ { loadClipboard(true); } else + if (source == undoItem) + { + Undo(); + } else + if (source == redoItem) + { + Redo(); + } else if (source == duplicateItem) { - Object3D keep = GrafreeD.clipboard; + Object3D keep = Grafreed.clipboard; loadClipboard(false); paste(false); - GrafreeD.clipboard = keep; + Grafreed.clipboard = keep; } else if (source == cloneItem) { @@ -1902,13 +2712,17 @@ { paste(false); } else + if (source == pasteIntoItem) + { + pasteInto(true, false); + } else if (source == pasteLinkItem) { - pasteInto(false); + pasteInto(false, false); } else if (source == pasteCloneItem) { - pasteInto(true); + pasteInto(true, true); } else if (source == pasteExpandItem) { @@ -2100,9 +2914,9 @@ // group.selection.get(0).setMasterThis(content); // should be identity // refreshContents(); // } - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -2110,11 +2924,11 @@ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); for (int i=0; i<group.selection.size(); i++) { - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse all random nodes + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse all random nodes group.selection.get(i).linkVerticesThis(content); // group.selection.get(i).setMasterThis(content); // should be identity - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; } Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); refreshContents(); @@ -2124,20 +2938,20 @@ { for (int i=0; i<group.selection.size(); i++) { - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse all random nodes + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse all random nodes group.selection.get(i).linkVerticesThis(null); - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; } refreshContents(); } else if (source == relinkverticesItem) { - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse all random nodes + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse all random nodes group.selection.RelinkToSupport(); - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; refreshContents(); } else @@ -2152,9 +2966,9 @@ } else if (source == setMasterItem) { - if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) + if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -2167,9 +2981,9 @@ { if (group.selection.size() == 1) { - if (GrafreeD.clipboard.size() == 1) + if (Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -2186,7 +3000,7 @@ { RevertMeshes(); } else - if (source == resetMeshItem) + if (source == resetAllItem) { ResetAll(); } else @@ -2194,7 +3008,7 @@ { StepAll(); } else - if (source == clearItem) // || event.getSource() == clearButton) + if (source == deleteItem) // || event.getSource() == clearButton) { //int indices[] = jList.getSelectedIndices(); //for (int i = indices.length - 1; i >= 0; i--) @@ -2206,9 +3020,9 @@ { ClearSelection(true); } else - if (source == grabItem) + if (source == grabItem || source == groupButton) { - group(new cGroup(), true); + group(new cGroup(), false); // true); } else if (source == hideItem) { @@ -2226,11 +3040,11 @@ { makeSomething(new Camera()); } else - if (source == compositeItem) + if (source == compositeItem || source == compositeButton) { group(new Composite()); } else - if (source == randomItem) + if (source == switchItem || source == switchButton) { RandomNode random = new RandomNode(); group(random); @@ -2332,7 +3146,7 @@ { group(new cLinker()); } else - if (source == textureItem) + if (source == textureItem || source == textureButton) { group(new TextureNode()); } else @@ -2352,17 +3166,30 @@ { CastShadow(2); } else - if (source == ungroupItem) + if (source == ungroupItem || source == ungroupButton) { - //ungroup(); + boolean hasRoot = false; + for (int i=0; i<group.selection.size(); i++) { - Ungroup(group.selection.get(i)); + if (group.selection.get(i) == group) + { + hasRoot = true; + break; + } } - ClearSelection(false); - - refreshContents(); + if (!hasRoot) + { + for (int i=0; i<group.selection.size(); i++) + { + Ungroup(group.selection.get(i)); + } + + ClearSelection(false); + + refreshContents(); + } } else if (source == genUVItem) { @@ -2374,7 +3201,7 @@ } else if (source == genNormalsMESHItem) { - GenNormals(true); // TODO + GenNormalsMESH(); } else if (source == genNormalsORGANItem) { @@ -2439,6 +3266,22 @@ if (source == unmarkleavesItem) { MarkLeaves(false); + } else + if (source == rewindleavesItem) + { + RewindLeaves(true); + } else + if (source == unrewindleavesItem) + { + RewindLeaves(false); + } else + if (source == randomleavesItem) + { + RandomLeaves(true); + } else + if (source == unrandomleavesItem) + { + RandomLeaves(false); } else if (source == flipVItem) { @@ -2524,9 +3367,13 @@ { SmoothMesh(); } else - if (source == transformgeometryItem) + if (source == transformGeometryItem) { TransformGeometry(); + } else + if (source == transformChildrenItem) + { + TransformChildren(); } else if (source == resetTransformItem) { @@ -2534,7 +3381,11 @@ } else if (source == resetCentroidItem) { - ResetCentroid(); + ResetCentroid(true); + } else + if (source == resetCentroidXZItem) + { + ResetCentroid(false); } else if (source == resetParentItem) { @@ -2639,7 +3490,7 @@ for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); - obj.SetBumpTexture(null); + obj.ResetBumpTexture(); } refreshContents(); @@ -2655,6 +3506,31 @@ refreshContents(); } else + if (source == embedTexturesItem) + { + Object3D obj; + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + obj = (Object3D)e.nextElement(); + obj.EmbedTextures(true); + } + + refreshContents(); + } else + if (source == deEmbedTexturesItem) + { + Object3D obj; + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + obj = (Object3D)e.nextElement(); + obj.EmbedTextures(false); + } + + CameraPane.texturepigment.clear(); + CameraPane.texturebump.clear(); + + refreshContents(); + } else if (source == flashSelectionButton) { CameraPane.flash = true; @@ -2666,6 +3542,10 @@ if (source == twoButton) { radio.layout = twoButton; + + if (CameraPane.FULLSCREEN) + fullscreenLayout = radio.layout; + // bug //gridPanel.setDividerLocation(1.0); //bigPanel.setDividerLocation(0.0); @@ -2698,10 +3578,31 @@ bigThree.ClearUI(); bigThree.add(centralPanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); + +// refreshContents(true); +// +// try +// { +// java.awt.Robot bot = new java.awt.Robot(); +// int mask = InputEvent.BUTTON1_MASK; +// bot.mouseMove(100, 100); +// bot.mousePress(mask); +// bot.mouseRelease(mask); +// } +// catch (Exception e) +// { +// +// } + } else if (source == threeButton) { radio.layout = threeButton; + + if (CameraPane.FULLSCREEN) + fullscreenLayout = radio.layout; // bigThree.remove(scenePanel); // bigThree.remove(centralPanel); @@ -2731,13 +3632,18 @@ // centralPanel.setVisible(true); // XYZPanel.setVisible(true); bigThree.ClearUI(); + bigThree.add(scenePanel); bigThree.add(centralPanel); - bigThree.add(XYZPanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else if (source == fourButton) { radio.layout = fourButton; + + if (CameraPane.FULLSCREEN) + fullscreenLayout = radio.layout; // bigThree.remove(scenePanel); // bigThree.remove(centralPanel); @@ -2769,10 +3675,15 @@ bigThree.ClearUI(); bigThree.add(scenePanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else if (source == sixButton) { radio.layout = sixButton; + + if (CameraPane.FULLSCREEN) + fullscreenLayout = radio.layout; // bigThree.remove(scenePanel); // bigThree.remove(centralPanel); @@ -2802,13 +3713,18 @@ // centralPanel.setVisible(true); // XYZPanel.setVisible(false); bigThree.ClearUI(); - bigThree.add(scenePanel); bigThree.add(centralPanel); + bigThree.add(scenePanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else if (source == sevenButton) { radio.layout = sevenButton; + + if (CameraPane.FULLSCREEN) + fullscreenLayout = radio.layout; // bigThree.remove(scenePanel); // bigThree.remove(centralPanel); @@ -2842,6 +3758,8 @@ bigThree.add(centralPanel); bigThree.add(XYZPanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else if (source == rootButton) { @@ -2853,6 +3771,7 @@ EditObject(obj); } + cameraView.requestFocusInWindow(); refreshContents(true); } else if (source == closeButton) @@ -2862,22 +3781,37 @@ for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) { ab = (cRadio)e.nextElement(); - if(ab.getModel().isSelected() && ab.GetObject() != client) + if (ab.getModel().isSelected() && ab.GetObject() != client) { + // Patch to avoid bug with transparency. + if (!ab.hadMaterial) + { + ab.object.material = null; + } + buttonGroup.remove(ab); radioPanel.remove(ab); - ab.GetObject().editWindow = null; + //ab.GetObject().editWindow = null; + ab.GetObject().manipWindow = null; // ab.GetObject().objectUI = null; // ????????? ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick(); break; } } + + cameraView.requestFocusInWindow(); refreshContents(true); } else if (source == editItem || source == editButton) { + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + Object3D child = (Object3D)e.nextElement(); + child.pinned = true; + } + EditSelection(false); } else if (source == uneditButton) @@ -2887,10 +3821,11 @@ Object3D child = (Object3D)e.nextElement(); if(child.editWindow != null) objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); + child.pinned = false; child.CloseUI(); listUI.remove(child); - child.editWindow = null; // ??????????? + //child.editWindow = null; // ??????????? } objEditor.ctrlPanel.FlushUI(); //objEditor.jTree.clearSelection(); @@ -2903,6 +3838,7 @@ //copy.ClearUI(); for (Object3D obj : listUI) { + obj.pinned = false; obj.CloseUI(); } listUI.clear(); @@ -2912,7 +3848,7 @@ { assert(copy == group); - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); + //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); for (Object3D obj : listUI) { @@ -2961,6 +3897,9 @@ } copy = group; + + SetUndoStates(); + //Globals.theRenderer.object = group; if(!useclient) { @@ -2976,20 +3915,46 @@ frontView.object = group; sideView.object = group; } - group.editWindow = this; + +// fix "+" issue + //group.editWindow = this; + group.manipWindow = this; + /* currentLayout = radio.layout; if (currentLayout == null) currentLayout = sevenButton; */ radio.layout.doClick(); + + ClearUnpinned(); + //Grafreed.Assert(group != null); + //Grafreed.Assert(group.selection != null); + SetPinStates(group.selection == null || group.selection.size() > 0); + if (group.selection == null || group.selection.size() == 1) + EditSelection(false); keepparent = group.parent; // PARENT = NULL or not??? //group.parent = null; // ROOT //group.attributes = -1; ResetModel(); + + cameraView.requestFocusInWindow(); refreshContents(true); - } + } else if (event.getSource() == editCameraItem) + { + cameraView.ProtectCamera(); + cameraView.repaint(); + return; + } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton) + { + cameraView.RevertCamera(); + cameraView.repaint(); + return; + // } else if (event.getSource() == textureButton) + // { + // return; // true; + } else { //return super.action(event, arg); @@ -2998,7 +3963,6 @@ } boolean useclient = false; - cRadio radio; void ToggleRoot() { @@ -3050,6 +4014,28 @@ refreshContents(); } + void TransformChildren() + { + Object3D obj; + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + obj = (Object3D)e.nextElement(); + obj.KeepTextureMatrices(); + obj.TransformChildren(); + obj.RestoreTextureMatrices(); + +// if (obj.parent == null) +// { +// System.out.println("NULL PARENT!"); +// new Exception().printStackTrace(); +// } +// else +// TouchTransform(obj); +// //obj.parent.Touch(); + } + + refreshContents(); + } void ResetTransform() { @@ -3162,7 +4148,7 @@ refreshContents(); } - void ResetCentroid() + void ResetCentroid(boolean full) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -3177,12 +4163,16 @@ LA.matIdentity(Object3D.mat); obj.getBounds(minima, maxima, false); Object3D.mat[3][0] = -(minima.x + maxima.x)/2; - Object3D.mat[3][1] = -(minima.y + maxima.y)/2; + if (full) + Object3D.mat[3][1] = -(minima.y + maxima.y)/2; Object3D.mat[3][2] = -(minima.z + maxima.z)/2; obj.TransformMesh(Object3D.mat); + Object3D.mat[3][0] = (minima.x + maxima.x)/2; - Object3D.mat[3][1] = (minima.y + maxima.y)/2; + if (full) + Object3D.mat[3][1] = (minima.y + maxima.y)/2; Object3D.mat[3][2] = (minima.z + maxima.z)/2; + LA.matConcat(Object3D.mat, obj.toParent, obj.toParent); //Object3D.mat[3][0] = -Object3D.mat[3][0]; //Object3D.mat[3][1] = -Object3D.mat[3][1]; @@ -3211,7 +4201,8 @@ int size = obj.MemorySize(); - System.err.println((size/1024) + " KB is the size of " + obj); + //System.err.println((size/1024) + " KB is the size of " + obj); + System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)"); } } catch (Exception e) @@ -3248,9 +4239,9 @@ obj = (Object3D)e.nextElement(); System.out.println("Object is: " + obj); - GrafreeD.AnalyzeObject(obj); + Grafreed.AnalyzeObject(obj); System.out.println("Boundary rep: " + obj.bRep); - GrafreeD.AnalyzeObject(obj.bRep); + Grafreed.AnalyzeObject(obj.bRep); // System.err.println((size/1024) + " KB is the size of " + obj); } @@ -3292,6 +4283,13 @@ void GenNormals(boolean crease) { group.GenNormalsS(crease); + + refreshContents(); + } + + void GenNormalsMESH() + { + group.GenNormalsMeshS(); refreshContents(); } @@ -3464,8 +4462,8 @@ void ParseVertices() { - boolean epsequal = GrafreeD.epsequal; - GrafreeD.epsequal = true; + boolean epsequal = Grafreed.epsequal; + Grafreed.epsequal = true; for (int i=0; i<group.selection.size(); i++) { @@ -3490,7 +4488,7 @@ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); - g.add(GrafreeD.clipboard); + g.add(Grafreed.clipboard); buffer.add(g); } @@ -3505,7 +4503,7 @@ makeSomething(buffer, i==group.selection.size()-1); } - GrafreeD.epsequal = epsequal; + Grafreed.epsequal = epsequal; refreshContents(); } @@ -3523,7 +4521,16 @@ String pigment = Object3D.GetPigment(tex); //String bump = Object3D.GetBump(tex); - com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres); + com.sun.opengl.util.texture.TextureData texturedata = null; + + try + { + texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres); + } + catch (Exception e) + { + System.err.println("FAIL: " + node); + } double s = v.s; @@ -3611,11 +4618,11 @@ SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY); - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse all random nodes + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse all random nodes lowres.linkVerticesThis(null); lowres.linkVerticesThis(sn); - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; System.err.flush(); @@ -3655,7 +4662,7 @@ return; Object3D poses = group.selection.get(0); - Object3D ref = GrafreeD.clipboard.get(0); + Object3D ref = Grafreed.clipboard.get(0); Object3D newgroup = new Object3D("Po:" + poses.name); @@ -3849,9 +4856,9 @@ void ClipMesh() { - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -3860,7 +4867,7 @@ // { // group.selection.get(i).ClipMesh(GrafreeD.clipboard); // } - group.selection.ClipMesh(GrafreeD.clipboard); + group.selection.ClipMesh(Grafreed.clipboard); } // group.selection.ClipMesh(GrafreeD.clipboard); System.out.println("DONE."); @@ -3907,6 +4914,18 @@ void MarkLeaves(boolean hide) { group.selection.MarkLeaves(hide); + refreshContents(); + } + + void RewindLeaves(boolean hide) + { + group.selection.RewindLeaves(hide); + refreshContents(); + } + + void RandomLeaves(boolean hide) + { + group.selection.RandomLeaves(hide); refreshContents(); } @@ -3981,28 +5000,25 @@ // } // } - static boolean allparams = true; - - static Vector<Object3D> listUI = new Vector<Object3D>(); - void EditSelection(boolean newWindow) { + if (group.selection == null) + { + EditElement(group, newWindow); // ? new + return; + } + // aConstraints.gridy = 0; for (int i=0; i<group.selection.size(); i++) { //System.out.println("edit : " + objectPanel.indexOfTab("Material")); //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false); - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); + //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); Object3D elem = (Object3D)group.selection.elementAt(i); - if(elem != group) + if(elem != group || !newWindow) { - // if (!(elem instanceof Composite)) - // newWindow = false; - listUI.add(elem); - elem.openEditWindow(this, newWindow); //, false); - System.out.println("edit : " + elem); - elem.editWindow.refreshContents(true); // ? new + EditElement(elem, newWindow); // ? new } } } @@ -4077,7 +5093,8 @@ //new Exception().printStackTrace(); freezemodel = true; - + ClearUnpinned(); + /**/ //switch (event.id) { @@ -4085,7 +5102,6 @@ //case 702: // Event.LIST_DESELECT group.deselectAll(); TreePath tps[] = objEditor.jTree.getSelectionPaths(); - objEditor.ClearInfo(); // .GetMaterial()); if (tps != null) { for (int i=0; i < tps.length; i++) @@ -4094,10 +5110,8 @@ //if (child.parent != null) //child.parent.addSelectee(child); + objEditor.SetMaterial(child); group.addSelectee(child); - objEditor.SetMaterial(child); // .GetMaterial()); - objEditor.AddInfo(child, this, true); // .GetMaterial()); - System.err.println("info : " + child.GetPath()); } } // else @@ -4107,20 +5121,28 @@ // System.err.println("info : " + group.GetPath()); // } - objEditor.SetText(); // jan 2014 - - if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera)) + if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera)) CameraPane.flash = true; - if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera) + if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) // a camera { - CameraPane.camerachangeframe = 0; // don't refuse it - Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); + if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace + { + CameraPane.camerachangeframe = 0; // don't refuse it + Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); + } // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera; // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera; } + if (tps != null && tps.length == 1) + { + EditSelection(false); + } + + SetPinStates(tps != null && tps.length > 0); + refreshContents(); //return true; } @@ -4129,6 +5151,35 @@ freezemodel = false; } + + void SetPinStates(boolean enabled) + { + editButton.setEnabled(enabled); + uneditButton.setEnabled(enabled); + unselectButton.setEnabled(enabled); + flashSelectionButton.setEnabled(enabled); + } + + void refreshContents(boolean cp) + { + if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) + if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) + { + objEditor.ClearInfo(); // .GetMaterial()); + + for (int i=0; i < group.selection.Size(); i++) + { + Object3D child = (Object3D) group.selection.get(i); + + objEditor.AddInfo(child, this, true); + System.err.println("info : " + child.GetPath()); + } + + objEditor.SetText(); // jan 2014 + } + + super.refreshContents(cp); + } void linkSomething(Object3D thing) { @@ -4200,16 +5251,19 @@ { if (group.selection.isEmpty()) return; - GrafreeD.clipboardIsTempGroup = false; + + Grafreed.clipboardIsTempGroup = false; Composite tGroup = null; if (group.selection.size() > 0) // 1) { tGroup = new cGroup(); - GrafreeD.clipboardIsTempGroup = true; + Grafreed.clipboardIsTempGroup = true; } if (cut) { +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. +// Save(); //int indices[] = jList.getSelectedIndices(); //for (int i = indices.length - 1; i >= 0; i--) //jList.remove(indices[i]); @@ -4245,16 +5299,16 @@ //System.out.println("cut " + child); //System.out.println("parent = " + child.parent); // tmp.addChild(child); - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(tmp); else - GrafreeD.clipboard = tmp; + Grafreed.clipboard = tmp; } else - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(child); else - GrafreeD.clipboard = child; + Grafreed.clipboard = child; } //ResetModel(); @@ -4286,21 +5340,23 @@ //System.out.println("cut " + elem); //System.out.println("parent = " + elem.parent); // tmp.addChild(elem); - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(tmp); else - GrafreeD.clipboard = tmp; + Grafreed.clipboard = tmp; } else - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(child); else - GrafreeD.clipboard = child; + Grafreed.clipboard = child; } } - if (GrafreeD.clipboardIsTempGroup) - GrafreeD.clipboard = tGroup; + + if (Grafreed.clipboardIsTempGroup) + Grafreed.clipboard = tGroup; + if (cut) { ResetModel(); @@ -4310,11 +5366,15 @@ void paste(boolean expand) { + if (Globals.REPLACEONMAKE) + Save(); + boolean keep = Globals.REPLACEONMAKE; + Globals.REPLACEONMAKE = false; // if (GrafreeD.clipboard == null) // return; boolean first = true; - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) { Composite temp; @@ -4325,7 +5385,7 @@ temp = (Composite)Applet3D.clipboard.deepCopy(); */ Object3D elem; - for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) + for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) { Object3D child = (Object3D)e.nextElement(); @@ -4359,21 +5419,22 @@ //Object3D cb = Applet3D.clipboard; //temp.addChild(cb); //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0)); - assert(GrafreeD.clipboard.parent == null); - Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent; - GrafreeD.clipboard.get(0).parent = null; // Avoid copy? - if (LA.isIdentity(GrafreeD.clipboard.toParent)) - makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy()); + assert(Grafreed.clipboard.parent == null); + Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent; + Grafreed.clipboard.get(0).parent = null; // Avoid copy? + if (LA.isIdentity(Grafreed.clipboard.toParent)) + makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy()); else - makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy()); - GrafreeD.clipboard.get(0).parent = keepparent; + makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy()); + Grafreed.clipboard.get(0).parent = keepparent; } + Globals.REPLACEONMAKE = keep; ResetModel(); refreshContents(); } - void pasteInto(boolean copyit) + void pasteInto(boolean copyit, boolean clone) { // if (GrafreeD.clipboard == null) // return; @@ -4402,15 +5463,22 @@ if (copyit) { // paste(false); - CloneClipboard(false); // sept 2014 + if (clone) + { + CloneClipboard(false); // sept 2014 + } + else + { + paste(false); + } } else { boolean first = true; - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) { - Composite temp = (Composite)GrafreeD.clipboard; + Composite temp = (Composite)Grafreed.clipboard; Object3D copy; for (Enumeration e = temp.children.elements(); e.hasMoreElements();) { @@ -4420,7 +5488,7 @@ } } else { - linkSomething(GrafreeD.clipboard); //.get(0)); + linkSomething(Grafreed.clipboard); //.get(0)); } } } @@ -4497,6 +5565,10 @@ void group(Object3D csg, boolean grab) { + if (Globals.REPLACEONMAKE) + Save(); + boolean keep = Globals.REPLACEONMAKE; + Globals.REPLACEONMAKE = false; if (//false) // why?? !group.selection.isEmpty()) { @@ -4610,10 +5682,15 @@ //node.add(csg); //makeSomething(node); makeSomething(csg); + Globals.REPLACEONMAKE = keep; } void Ungroup(Object3D g) { + if (Globals.REPLACEONMAKE) + Save(); + boolean keep = Globals.REPLACEONMAKE; + Globals.REPLACEONMAKE = false; if (g instanceof HiddenObject) { HiddenObject h = (HiddenObject) g; @@ -4630,6 +5707,7 @@ objEditor.makeSomething(g.get(i), false); } } + Globals.REPLACEONMAKE = keep; } void ungroup() @@ -4825,21 +5903,6 @@ } */ - void ImportGFD() - { - FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); - browser.show(); - String filename = browser.getFile(); - if (filename != null && filename.length() > 0) - { - String fullname = browser.getDirectory() + filename; - - //Object3D readobj = - objEditor.ReadGFD(fullname, objEditor); - //makeSomething(readobj); - } - } - /* public void Callback(Object obj) { @@ -4863,26 +5926,9 @@ } */ - void ImportVRMLX3D() - { - if (GrafreeD.standAlone) - { - /**/ - FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); - browser.show(); - String filename = browser.getFile(); - if (filename != null && filename.length() > 0) - { - String fullname = browser.getDirectory() + filename; - LoadVRMLX3D(fullname); - } - /**/ - } - } - String GetFile(String dialogName) { - if (GrafreeD.standAlone) + if (Grafreed.standAlone) { FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD); browser.show(); @@ -4950,6 +5996,45 @@ cButton clearpanelButton; cButton unselectButton; + cButton restoreCameraButton; + + cButton saveButton; + cButton oneStepButton; + + cButton groupButton; + cButton ungroupButton; + cButton compositeButton; + cButton switchButton; + cButton loopButton; + cButton textureButton; + + cButton skybox1Button; + cButton skybox2Button; + cButton skybox3Button; + cButton skybox4Button; + cButton skybox5Button; + cButton skybox6Button; + cButton skybox7Button; + + cButton skybox11Button; + cButton skybox12Button; + cButton skybox13Button; + cButton skybox14Button; + cButton skybox15Button; + cButton skybox16Button; + cButton skybox17Button; + + cButton gridButton; + cButton boxButton; + cButton sphereButton; + cButton coneButton; + cButton torusButton; + cButton superButton; + cButton kleinButton; + cButton particlesButton; + cButton overlayButton; + cButton lightButton; + cButton screenfitButton; cButton screenfitpointButton; cButton snapobjectButton; @@ -4961,14 +6046,6 @@ cButton setsupportButton; - cButton twoButton; - cButton sixButton; - cButton threeButton; - cButton sevenButton; - cButton fourButton; // full panel - cButton oneButton; // full XYZ - //cButton currentLayout; - // //Composite Object3D // to do !! @@ -4978,9 +6055,11 @@ //JTree jTree; private MenuItem lookAtItem; private MenuItem lookFromItem; - private MenuItem switchItem; + private MenuItem switchViewItem; private MenuItem cutItem; - private MenuItem duplicateItem; + private MenuItem undoItem; + private MenuItem redoItem; + private JMenuItem duplicateItem; private MenuItem cloneItem; private MenuItem cloneSupportItem; private MenuItem overwriteGeoItem; @@ -4993,7 +6072,7 @@ private MenuItem linkverticesItem; private MenuItem relinkverticesItem; private MenuItem setMasterItem; - private MenuItem resetMeshItem; + private MenuItem resetAllItem; private MenuItem stepAllItem; private MenuItem revertMeshItem; private MenuItem poseMeshItem; @@ -5004,10 +6083,11 @@ private MenuItem mergeGeometriesItem; private MenuItem copyItem; private MenuItem pasteItem; + private MenuItem pasteIntoItem; private MenuItem pasteLinkItem; private MenuItem pasteCloneItem; private MenuItem pasteExpandItem; - private MenuItem clearItem; + private MenuItem deleteItem; private MenuItem clearAllItem; private MenuItem genUVItem; private MenuItem genNormalsMESHItem; @@ -5042,6 +6122,10 @@ private MenuItem showleavesItem; private MenuItem markleavesItem; private MenuItem unmarkleavesItem; + private MenuItem rewindleavesItem; + private MenuItem unrewindleavesItem; + private MenuItem randomleavesItem; + private MenuItem unrandomleavesItem; private MenuItem flipVItem; private MenuItem unflipVItem; @@ -5053,15 +6137,17 @@ private MenuItem panoTexturesItem; private MenuItem resetCentroidItem; - private MenuItem transformgeometryItem; + private MenuItem resetCentroidXZItem; private MenuItem resetTransformItem; + private MenuItem transformGeometryItem; + private MenuItem transformChildrenItem; private MenuItem hideItem; private MenuItem grabItem; private MenuItem backItem; private MenuItem frontItem; private MenuItem cameraItem; private MenuItem compositeItem; - private MenuItem randomItem; + private MenuItem switchItem; private MenuItem physicsItem; private MenuItem frameselectorItem; private MenuItem scriptNodeItem; @@ -5085,6 +6171,8 @@ private MenuItem attachBumpItem; private MenuItem detachBumpItem; private MenuItem pigmentBumpItem; + private MenuItem embedTexturesItem; + private MenuItem deEmbedTexturesItem; private MenuItem particleItem; private MenuItem ragdollItem; @@ -5101,7 +6189,7 @@ private MenuItem blobItem; private MenuItem latheItem; private MenuItem bezierItem; - private MenuItem checkerItem; + private MenuItem overlayItem; private MenuItem meshItem; // private MenuItem meshGroupItem; private MenuItem springItem; @@ -5123,11 +6211,6 @@ private MenuItem doubleItem; private MenuItem tripleItem; - private MenuItem importGFDItem; - private MenuItem importVRMLX3DItem; - private MenuItem import3DSItem; - private MenuItem importOBJItem; - private MenuItem computeAOItem; private MenuItem recompileItem; private MenuItem editScriptItem; @@ -5137,4 +6220,8 @@ private MenuItem analyzeItem; private MenuItem dumpItem; //boolean freezemodel = false; + + Menu cameraMenu; + MenuItem editCameraItem; + MenuItem restoreCameraItem; } -- Gitblit v1.6.2