From 6a823ffbfcda4c843f46e02e83c869d5bc323e25 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 21 Aug 2019 20:15:53 -0400
Subject: [PATCH] Parallax presets

---
 GroupEditor.java |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 8342091..0ac356b 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -936,6 +936,8 @@
         cGridBag currenttab;
         //boolean added; // patch for jar
                 
+        int totalcount = 0;
+        
         int tabcount = 0;
         int colcount = 0;
         int rowcount = 0;
@@ -974,6 +976,7 @@
             }
             
             AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
+            totalcount++;
             
             if (++colcount >= columns)
             {
@@ -999,6 +1002,8 @@
             container.add(resourcecontainer);
             
             Grafreed.ParseResources("textures", this);
+            
+            // 935. System.out.println("Total = " + totalcount);
         }
         
 	void SetupUI2(ObjEditor oe)
@@ -1259,7 +1264,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);
                 

--
Gitblit v1.6.2