From 60cec91731a350fe67e9b5ffe7a00d70e9026314 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Thu, 22 Aug 2019 22:45:00 -0400
Subject: [PATCH] Min shader.

---
 GroupEditor.java |   87 +++++++++++++++++++++++++++----------------
 1 files changed, 55 insertions(+), 32 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 615e02f..83301a6 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -347,7 +347,7 @@
 
     public void CreateSkyboxPanel(cGridBag skyboxPanel)
     {
-        JTabbedPane skyboxpane = new JTabbedPane();
+        JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
         
         AddSkyboxTab0(skyboxpane);
         AddSkyboxTab1(skyboxpane);
@@ -417,13 +417,13 @@
 		
                 assert(false);
                 
-        if (copy.versionlist == null)
-        {
-            copy.versionlist = new Object3D[100];
-            copy.versionindex = -1;
-            
-            //Save(true);
-        }
+//        if (copy.versionlist == null)
+//        {
+//            copy.versionlist = new Object3D[100];
+//            copy.versionindex = -1;
+//            
+//            //Save(true);
+//        }
         
 		if(ui)
                     SetupUI(objEditor);
@@ -446,13 +446,13 @@
                 
                 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
                 
-        if (copy.versionlist == null)
-        {
-            copy.versionlist = new Object3D[100];
-            copy.versionindex = -1;
-            
-            //Save(true);
-        }
+//        if (copy.versionlist == null)
+//        {
+//            copy.versionlist = new Object3D[100];
+//            copy.versionindex = -1;
+//            
+//            //Save(true);
+//        }
 	}
 
     void CloneSelection(boolean supports)
@@ -835,6 +835,8 @@
         }
 
                 oe.menuBar.add(menu = new Menu("Attributes"));
+		clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
+		clearVersionsItem.addActionListener(this);
 		clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
 		clearMaterialsItem.addActionListener(this);
                 resetAllItem = menu.add(new MenuItem("Reset All"));
@@ -936,6 +938,8 @@
         cGridBag currenttab;
         //boolean added; // patch for jar
                 
+        int totalcount = 0;
+        
         int tabcount = 0;
         int colcount = 0;
         int rowcount = 0;
@@ -964,7 +968,7 @@
             texturecount = 0;
         }
         
-        if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
+        if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
         {
             //if (!added)
             {
@@ -973,7 +977,8 @@
                 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
             }
             
-            AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
+            AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
+            totalcount++;
             
             if (++colcount >= columns)
             {
@@ -999,6 +1004,8 @@
             container.add(resourcecontainer);
             
             Grafreed.ParseResources("textures", this);
+            
+            // 935. System.out.println("Total = " + totalcount);
         }
         
 	void SetupUI2(ObjEditor oe)
@@ -1259,7 +1266,10 @@
                 
                 CreateTexturePanel(textures);
                 
-                resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
+                int tabCount = resourcecontainer.getTabCount();
+                
+                if (tabCount > 0)
+                    resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
                 
                 oe.toolboxPanel.add(textures);
                 
@@ -2119,24 +2129,24 @@
             switch(axis)
             {
                 case 0 :
-                    vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
-                    vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
-                    vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
-                    vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
+                    vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
+                    vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
+                    vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
+                    vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
                     norm = cVector.X;
                     break;
                 case 1 :
-                    vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
-                    vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
-                    vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
-                    vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
+                    vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
+                    vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
+                    vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
+                    vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
                     norm = cVector.Y;
                     break;
                 case 2 :
-                    vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
-                    vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
-                    vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
-                    vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
+                    vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
+                    vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
+                    vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
+                    vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
                     norm = cVector.Z;
                     break;
             }
@@ -3458,6 +3468,10 @@
                 {
 			ClearMaterials();
 		} else
+		if (source == clearVersionsItem)
+                {
+			ClearVersions();
+		} else
 		if (source == liveleavesItem)
                 {
 			LiveLeaves(true);
@@ -4134,12 +4148,14 @@
             // and check if any of these nodes are reachable below the root.
             Grafreed.grafreed.universe.TagObjects(copy, true);
             
-            if (!copy.HasTags())
+            if (copy.versionlist == null && !copy.HasTags())
             {
                 copy.versionlist = new Object3D[100];
                 
-                Save(true);
+                //Save(true);
             }
+            else
+                copy.versionindex = -2;
             
             Grafreed.grafreed.universe.TagObjects(copy, false);
         }
@@ -5102,6 +5118,12 @@
 	void ClearMaterials()
 	{
 		group.selection.ClearMaterials();
+		refreshContents();
+	}
+	
+	void ClearVersions()
+	{
+		group.selection.ClearVersions();
 		refreshContents();
 	}
 	
@@ -6346,6 +6368,7 @@
 	private MenuItem clipMeshItem;
 	private MenuItem smoothMeshItem;
 	private MenuItem clearMaterialsItem;
+	private MenuItem clearVersionsItem;
         
 	private MenuItem liveleavesItem;
 	private MenuItem unliveleavesItem;

--
Gitblit v1.6.2