From 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Fri, 16 Aug 2019 13:25:19 -0400
Subject: [PATCH] Fix box and VR keys.

---
 GroupEditor.java |   64 +++++++++++++++++++------------
 1 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index b32dee9..cff60a6 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -570,9 +570,6 @@
 		//menu.add("-");
                 oe.jTree.popup.addSeparator();
                 
-		deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
-		deleteItem.addActionListener(this);
-                
         if (Globals.ADVANCED)
         {
                 // Deletes the cameras...
@@ -706,15 +703,17 @@
 		setMasterItem.addActionListener(this);
         }
                 
-		oe.menuBar.add(menu = new Menu("Group"));
-//		grabItem = menu.add(new MenuItem("Grab"));
-//		grabItem.addActionListener(this);
+		oe.menuBar.add(menu = new Menu("Order"));
+                
 		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);
+                
+		grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
+		grabItem.addActionListener(this);
                 
         if (Globals.ADVANCED)
         {
@@ -723,6 +722,11 @@
         }
 		ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
 		ungroupItem.addActionListener(this);
+                
+                oe.jTree.popup.addSeparator();
+                
+		deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
+		deleteItem.addActionListener(this);
                 
 //		menu.add("-");
 //                
@@ -928,7 +932,7 @@
 	
         JTabbedPane resourcecontainer;
         cGridBag currenttab;
-        boolean added; // patch for jar
+        //boolean added; // patch for jar
                 
         int tabcount = 0;
         int colcount = 0;
@@ -940,17 +944,19 @@
         
     public void ResourceCallBack(String[] path)
     {
-        for (int i = 0; i < path.length; i++)
-            System.out.print(path[i] + "/");
-        System.out.println();
+//        for (int i = 0; i < path.length; i++)
+//            System.out.print(path[i] + "/");
+//        System.out.println();
         
         if (//rowcount == 0 ||
-                path.length == 1)
+                path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
         {
             currenttab = new cGridBag();
-            added = false;
             String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
             currenttab.setName(tabname);
+            //added = false;
+            resourcecontainer.add(currenttab);
+            resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
             rowcount = 1;
             colcount = 0;
             texturecount = 0;
@@ -958,12 +964,11 @@
         
         if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
         {
-            if (!added)
+            //if (!added)
             {
-                added = true;
-                resourcecontainer.add(currenttab);
+                //added = true;
                 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
-                resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
+                currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
             }
             
             AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
@@ -1064,7 +1069,7 @@
                 collapseButton.setToolTipText("Collapse toolbar");
 		collapseButton.addActionListener(this);
                 
-		oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 maximize3DButton.setToolTipText("Maximize 3D view");
 		maximize3DButton.addActionListener(this);
                 
@@ -1186,6 +1191,10 @@
                 boxButton.setToolTipText("Create box");
                                 boxButton.addActionListener(this);
 
+                row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                superButton.setToolTipText("Create superellipsoid");
+                                superButton.addActionListener(this);
+
                 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 sphereButton.setToolTipText("Create sphere");
                                 sphereButton.addActionListener(this);
@@ -1197,10 +1206,6 @@
                 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)
                 {
@@ -1503,6 +1508,7 @@
                     
             oe.SetupViews();
             
+        if (Globals.DEBUG)
 		System.out.println("SetupViews");
             DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
                   oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
@@ -2164,7 +2170,11 @@
             shadow.material = new cMaterial(obj.material);
             shadow.material.diffuse = 0.0001f;
             shadow.material.specular = 0.0001f;
-            //shadow.projectedVertices[1].x = 300;
+            shadow.material.opacity = 0.75f;
+            
+            AllocProjectedVertices(shadow);
+        
+            shadow.projectedVertices[1].x = 300;
             
             makeSomething(shadow);
         }
@@ -4109,7 +4119,10 @@
             copy.versionlist = new Object3D[100];
             copy.versionindex = -1;
             
-            Save(true);
+            // Cannot work with loops
+            // To fix this issue, first mark all nodes above the root,
+            // and check if any of these nodes are reachable below the root.
+            //Save(true);
         }
         
                     SetVersionStates();
@@ -5354,7 +5367,8 @@
             if (group.selection != null)
             for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
             {
-                    if (!(e.nextElement() instanceof Composite))
+                    Object next = e.nextElement();
+                    if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
                     {
                         allComposites = false;
                         break;
@@ -6345,7 +6359,7 @@
 	private MenuItem transformGeometryItem;
 	private MenuItem transformChildrenItem;
 	private MenuItem hideItem;
-	private MenuItem grabItem;
+	private JMenuItem grabItem;
 	private MenuItem backItem;
 	private MenuItem frontItem;
 	private MenuItem cameraItem;

--
Gitblit v1.6.2