From d2f456cf5280f59425084532bd2397ec625f7577 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 24 Jun 2019 22:53:37 -0400
Subject: [PATCH] More tools.

---
 ObjEditor.java           |   44 ++++++-
 icons/eye.png            |    0 
 icons/particles.png      |    0 
 icons/particles0.png     |    0 
 icons/loop.png           |    0 
 icons/group.png          |    0 
 icons/switch.png         |    0 
 CameraPane.java          |    3 
 Globals.java             |    1 
 GroupEditor.java         |  268 ++++++++++++++++++++++++++++----------------
 cFileSystemPane.java     |    2 
 icons/composite.png      |    0 
 icons/loop0.png          |    0 
 icons/texture.png        |    0 
 icons/composite copy.png |    0 
 15 files changed, 214 insertions(+), 104 deletions(-)

diff --git a/CameraPane.java b/CameraPane.java
index 3697e29..6966eee 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -10481,6 +10481,7 @@
                     ANTIALIAS = 0;
                     //System.out.println("RESTART");
                     AAtimer.restart();
+                    Globals.TIMERRUNNING = true;
                 }
             }
         }
@@ -13840,6 +13841,7 @@
         else
         if (evt.getSource() == AAtimer)
         {
+                    Globals.TIMERRUNNING = false;
             if (mouseDown)
             {
             //new Exception().printStackTrace();
@@ -13914,6 +13916,7 @@
             return;
         
         AAtimer.restart(); // 
+        Globals.TIMERRUNNING = true;
 
 //        waslive = LIVE;
 //        LIVE = false;
diff --git a/Globals.java b/Globals.java
index 4eca159..c361638 100644
--- a/Globals.java
+++ b/Globals.java
@@ -13,6 +13,7 @@
         public static boolean SAVEONMAKE = false; // problems when auto-save (works with manual save)
         
         public static boolean MOUSEDRAGGED = false;
+        public static boolean TIMERRUNNING = false;
     
         // Hold on calculation when moving camera
         public static boolean FREEZEONMOVE = false; // true;
diff --git a/GroupEditor.java b/GroupEditor.java
index 9b1b9d3..d57f0f7 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -204,21 +204,21 @@
         //zBufferItem.addActionListener(this);
         //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
         //normalLensItem.addActionListener(this);
-        cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
-        revertCameraItem.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(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("Handles"));
         toggleHandleItem.addItemListener(this);
@@ -275,7 +275,7 @@
         {
 		oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
 		//cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
-		//cameraMenu.add(switchItem = new MenuItem("Reverse View"));
+		//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..."));
@@ -283,7 +283,7 @@
 		editLeafItem.addActionListener(this);
 		lookAtItem.addActionListener(this);
 		//lookFromItem.addActinoListener(this);
-		//switchItem.addActionListener(this);
+		//switchViewItem.addActionListener(this);
         }
         
 		oe.menuBar.add(menu = new Menu("Setting"));
@@ -328,14 +328,14 @@
         }
                 
 		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);
+//		compositeItem = menu.add(new MenuItem("Composite"));
+//		compositeItem.addActionListener(this);
                 
         if (Globals.ADVANCED)
         {
@@ -345,10 +345,10 @@
 		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"));
@@ -365,13 +365,11 @@
 		frameselectorItem.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"));
@@ -582,6 +580,10 @@
         oe.radioPanel.add(dummyButton);
         oe.buttonGroup.add(dummyButton);
          */
+                cGridBag copyOptionsPanel = new cGridBag();
+                                        
+                copyOptionsPanel.preferredHeight = 2;
+                
                 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
                 
 		//oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
@@ -596,39 +598,43 @@
                 fullButton.setToolTipText("Full-screen window");
 		fullButton.addActionListener(this);
                 
-		oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                restoreCameraButton.setToolTipText("Restore viewpoint");
+		restoreCameraButton.addActionListener(this);
+                
+		copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 undoButton.setToolTipText("Undo changes");
 		undoButton.addActionListener(this);
                 
-		oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 redoButton.setToolTipText("Redo changes");
 		redoButton.addActionListener(this);
                 
-		oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 saveButton.setToolTipText("Save changes");
 		saveButton.addActionListener(this);
                 
-                oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
+                copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
                 liveCB.setToolTipText("Enable animation");
                                 liveCB.addItemListener(this);
 
-		oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 oneStepButton.setToolTipText("Animate one step forward");
 		oneStepButton.addActionListener(this);
                 
-                oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
+                copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
                 fastCB.setToolTipText("Fast mode");
                                 fastCB.addItemListener(this);
                                 
-                oe.toolboxPanel.Return();
+                //oe.toolboxPanel.Return();
                 
-                oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
-                trackCB.setToolTipText("Enable tracking");
-                                trackCB.addItemListener(this);
-
-		oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 screenfitButton.setToolTipText("Screen fit");
 		screenfitButton.addActionListener(this);
+
+//                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);
@@ -640,10 +646,6 @@
                         snapobjectButton.setToolTipText("Snap Object");
                 }
 
-		oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                flashSelectionButton.setToolTipText("Highlight selection");
-		flashSelectionButton.addActionListener(this);
-                
 		//oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
                 
 		oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
@@ -688,8 +690,6 @@
                 sphereButton.setToolTipText("Create sphere");
                                 sphereButton.addActionListener(this);
 
-                oe.toolboxPanel.Return();
-                
                 oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 coneButton.setToolTipText("Create cone");
                                 coneButton.addActionListener(this);
@@ -712,6 +712,28 @@
                 oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 particlesButton.setToolTipText("Create particle system");
                                particlesButton.addActionListener(this);
+
+                oe.toolboxPanel.Return();
+                
+                oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                groupButton.setToolTipText("Create group");
+                               groupButton.addActionListener(this);
+
+                oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                compositeButton.setToolTipText("Create composite");
+                               compositeButton.addActionListener(this);
+
+                oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                switchButton.setToolTipText("Create switch");
+                               switchButton.addActionListener(this);
+
+                oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                loopButton.setToolTipText("Create loop");
+                               loopButton.addActionListener(this);
+
+                oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                textureButton.setToolTipText("Create texture");
+                               textureButton.addActionListener(this);
 
                 oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 overlayButton.setToolTipText("Create overlay");
@@ -742,6 +764,10 @@
                 unselectButton.setToolTipText("Unselect");
 		unselectButton.addActionListener(this);
 
+		editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                flashSelectionButton.setToolTipText("Highlight selection");
+		flashSelectionButton.addActionListener(this);
+                
                 editCommandsPanel.preferredHeight = 1;
                 
 //                oe.treePanel.add(commandsPanel);
@@ -768,21 +794,6 @@
                 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();
                 
@@ -813,6 +824,20 @@
         
         void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
         {
+                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);
@@ -830,6 +855,8 @@
         //        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);
@@ -846,6 +873,8 @@
 //                panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
 //                                speakerMocapCB.addItemListener(this);
 
+                panel.Return();
+                
             if (false)
             {
                 // handled in scripts
@@ -860,24 +889,39 @@
         	//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 target");
+                oeilCB.setToolTipText("Move camera when tracking");
                                 oeilCB.addItemListener(this);
 
                 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
                 shadowCB.setToolTipText("Compute shadows when live");
                                 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("Use switch");
+                                toggleSwitchCB.addItemListener(this);
+                                
                 panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
                 autosaveCB.setToolTipText("Auto-save on structure change");
                                 autosaveCB.addItemListener(this);
 
+                panel.Return();
             if (Globals.ADVANCED)
             {
                 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
@@ -888,10 +932,15 @@
         }
                                 
                 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);
 
         }
 	
@@ -936,7 +985,8 @@
         cCheckBox slowCB;
         cCheckBox boxCB;
         cCheckBox zoomBoxCB;
-        cToggleButton trackCB;
+        //cToggleButton trackCB;
+        cCheckBox trackCB;
         cCheckBox smoothfocusCB;
 //        JCheckBox speakerMocapCB;
         cCheckBox speakerCameraCB;
@@ -1191,13 +1241,23 @@
                 
                 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;
             }
 
+            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);
@@ -1312,22 +1372,30 @@
 	{
 		//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"));
@@ -1353,15 +1421,15 @@
         }
 		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);
+//		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)
@@ -1790,7 +1858,7 @@
 		{
                     ScreenFit();
                 } else
-		if (source == switchItem)
+		if (source == switchViewItem)
 		{
 			cVector v1 = new cVector();
 			cVector v2 = new cVector();
@@ -2020,7 +2088,7 @@
                             
 			group(g);
 		} else
-		if (source == loopItem)
+		if (source == loopItem || source == loopButton)
 		{
                         Composite csg = new GroupLeaf();
                         csg.count = 5;
@@ -2510,9 +2578,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)
 		{
@@ -2530,11 +2598,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);
@@ -2636,7 +2704,7 @@
 		{
 			group(new cLinker());
 		} else
-		if (source == textureItem)
+		if (source == textureItem || source == textureButton)
 		{
 			group(new TextureNode());
 		} else
@@ -3380,7 +3448,7 @@
                     cameraView.ProtectCamera();
                     cameraView.repaint();
                     return;
-                } else if (event.getSource() == revertCameraItem)
+                } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
                 {
                     cameraView.RevertCamera();
                     cameraView.repaint();
@@ -4583,7 +4651,8 @@
         
         void refreshContents(boolean cp)
         {
-            if (!Globals.MOUSEDRAGGED)
+            if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
+            if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
             {
                 objEditor.ClearInfo(); // .GetMaterial());
 
@@ -5401,6 +5470,8 @@
 	cButton clearpanelButton;
 	cButton unselectButton;
 	
+	cButton restoreCameraButton;
+        
 	cButton minButton;
 	cButton maxButton;
 	cButton fullButton;
@@ -5412,6 +5483,9 @@
         cButton groupButton;
         cButton ungroupButton;
         cButton compositeButton;
+        cButton switchButton;
+        cButton loopButton;
+        cButton textureButton;
         
         cButton gridButton;
         cButton boxButton;
@@ -5444,7 +5518,7 @@
 	//JTree jTree;
 	private MenuItem lookAtItem;
 	private MenuItem lookFromItem;
-	private MenuItem switchItem;
+	private MenuItem switchViewItem;
 	private MenuItem cutItem;
 	private MenuItem undoItem;
 	private MenuItem redoItem;
@@ -5536,7 +5610,7 @@
 	private MenuItem frontItem;
 	private MenuItem cameraItem;
 	private MenuItem compositeItem;
-	private MenuItem randomItem;
+	private MenuItem switchItem;
 	private MenuItem physicsItem;
 	private MenuItem frameselectorItem;
 	private MenuItem scriptNodeItem;
@@ -5610,5 +5684,5 @@
         
     Menu cameraMenu;
     MenuItem editCameraItem;
-    MenuItem revertCameraItem;
+    MenuItem restoreCameraItem;
 }
diff --git a/ObjEditor.java b/ObjEditor.java
index fdd2815..7128e8d 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -383,6 +383,27 @@
         closeItem.addActionListener(this);
 
         objectPanel = new JTabbedPane();
+        
+        ChangeListener changeListener = new ChangeListener()
+        {
+            public void stateChanged(ChangeEvent changeEvent)
+            {
+//                if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
+//                {
+//                    if (latestObject != null)
+//                    {
+//                        refreshContents(true);
+//                        SetMaterial(latestObject);
+//                    }
+//                    
+//                    materialFlushed = true;
+//                }
+
+                refreshContents(false); // To refresh Info tab
+            }
+        };
+        objectPanel.addChangeListener(changeListener);
+    
         toolbarPanel = new JPanel();
         toolbarPanel.setName("Toolbar");
         treePanel = new cGridBag();
@@ -884,7 +905,12 @@
     JCheckBox speedupCB;
     JCheckBox rewindCB;
     JCheckBox flipVCB;
+    
+    cCheckBox toggleTextureCB;
+    cCheckBox toggleSwitchCB;
+        
     JComboBox texresMenu;
+    
     JButton resetButton;
     JButton stepButton;
     JButton stepAllButton;
@@ -1412,8 +1438,8 @@
 
         //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
         //tmp.setName("Edit");
-        objectPanel.add(toolboxPanel);
         objectPanel.add(materialPanel);
+        objectPanel.add(toolboxPanel);
 //        JPanel north = new JPanel(new BorderLayout());
 //        north.setName("Edit");
 //        north.add(ctrlPanel, BorderLayout.NORTH);
@@ -1445,9 +1471,7 @@
         JTabbedPane tabbedPane = new JTabbedPane();
         tabbedPane.add(scrollpane);
 
-        tabbedPane.add(FSPane = new cFileSystemPane(this));
-
-        optionsPanel = new cGridBag().setVertical(true);
+        optionsPanel = new cGridBag().setVertical(false);
 
         optionsPanel.setName("Options");
         
@@ -1455,6 +1479,8 @@
         
         tabbedPane.add(optionsPanel);
         
+        tabbedPane.add(FSPane = new cFileSystemPane(this));
+
         scenePanel.add(tabbedPane);
 
         /*
@@ -1547,6 +1573,8 @@
 //            aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
 
         frame.setSize(1280, 860);
+        
+        frame.validate();
         frame.setVisible(true);
 
                     cameraView.requestFocusInWindow();
@@ -2866,6 +2894,8 @@
 
     void SetMaterial(Object3D object)
     {
+        latestObject = object;
+        
         cMaterial mat = object.material;
 
         if (mat == null)
@@ -3051,7 +3081,7 @@
             cameraView.ToggleDL();
             cameraView.repaint();
             return;
-        } else if (event.getSource() == toggleTextureItem)
+        } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
         {
             cameraView.ToggleTexture();
             // june 2013           copy.HardTouch();
@@ -3090,7 +3120,7 @@
             frame.validate();
 
             return;
-        } else if (event.getSource() == toggleSwitchItem)
+        } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
         {
             cameraView.ToggleSwitch();
             cameraView.repaint();
@@ -4945,6 +4975,8 @@
     cGridBag optionsPanel;
     
     JTabbedPane objectPanel;
+    boolean materialFlushed;
+    Object3D latestObject;
     
     cGridBag XYZPanel;
     
diff --git a/cFileSystemPane.java b/cFileSystemPane.java
index cbc4ddf..98b5413 100644
--- a/cFileSystemPane.java
+++ b/cFileSystemPane.java
@@ -32,7 +32,7 @@
     {
         owner = o;
         
-        setName("File system");
+        setName("Files");
         //System.out.println("layout : " + getLayout());
         //setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
         //setLayout(new GridBagLayout());
diff --git a/icons/composite copy.png b/icons/composite copy.png
new file mode 100644
index 0000000..4a44b63
--- /dev/null
+++ b/icons/composite copy.png
Binary files differ
diff --git a/icons/composite.png b/icons/composite.png
new file mode 100644
index 0000000..1578f83
--- /dev/null
+++ b/icons/composite.png
Binary files differ
diff --git a/icons/eye.png b/icons/eye.png
new file mode 100644
index 0000000..c3e43cc
--- /dev/null
+++ b/icons/eye.png
Binary files differ
diff --git a/icons/group.png b/icons/group.png
new file mode 100644
index 0000000..c27e092
--- /dev/null
+++ b/icons/group.png
Binary files differ
diff --git a/icons/loop.png b/icons/loop.png
new file mode 100644
index 0000000..1bd548e
--- /dev/null
+++ b/icons/loop.png
Binary files differ
diff --git a/icons/loop0.png b/icons/loop0.png
new file mode 100644
index 0000000..1bd548e
--- /dev/null
+++ b/icons/loop0.png
Binary files differ
diff --git a/icons/particles.png b/icons/particles.png
index 2fee0fd..62fcd6c 100644
--- a/icons/particles.png
+++ b/icons/particles.png
Binary files differ
diff --git a/icons/particles0.png b/icons/particles0.png
new file mode 100644
index 0000000..62fcd6c
--- /dev/null
+++ b/icons/particles0.png
Binary files differ
diff --git a/icons/switch.png b/icons/switch.png
new file mode 100644
index 0000000..310da04
--- /dev/null
+++ b/icons/switch.png
Binary files differ
diff --git a/icons/texture.png b/icons/texture.png
new file mode 100644
index 0000000..4fcd9b5
--- /dev/null
+++ b/icons/texture.png
Binary files differ

--
Gitblit v1.6.2