From 4cbc9cc2b4438dd9bb20095d2305be9150cc0071 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 06 Oct 2019 10:25:43 -0400
Subject: [PATCH] Count slider

---
 ObjEditor.java |  131 +++++++++++++++++++++++++------------------
 1 files changed, 76 insertions(+), 55 deletions(-)

diff --git a/ObjEditor.java b/ObjEditor.java
index af5b921..2afeb9e 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -330,6 +330,8 @@
         objEditor.ctrlPanel.remove(pushPanel);
         if (versionPanel != null)
             objEditor.ctrlPanel.remove(versionPanel);
+        if (countPanel != null)
+            objEditor.ctrlPanel.remove(countPanel);
         //objEditor.ctrlPanel.remove(fillPanel);
         
         //Remove(normalpushField);
@@ -727,53 +729,10 @@
                 si.SendInfo("#children = " + sel.Size(), "regular");
             }
             si.SendInfo((debug ? "    Parent: " : "    ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
-            if (debug)
-            {
-                try
-                {
-                    sel.getBounds(minima, maxima, true);
-                } catch (Exception e)
-                {
-                    e.printStackTrace();
-                }
-
-        if (full)
-        {
-            si.SendInfo("    BBox min: " + minima, "regular");
-            si.SendInfo("    BBox max: " + maxima, "regular");
-        }
-        
-                if (sel.bRep != null)
-                {
-                    si.SendInfo("    BRep: " + sel.bRep.hashCode(), "regular");
-                    si.SendInfo("    Geo: " + sel.bRep.FaceCount() + " triangles, " + sel.bRep.VertexCount()
-                            + " vertices; ", "regular");
-                    si.SendInfo("    Storage: " + sel.bRep, "regular");
-                    si.SendInfo("    Display list: " + sel.bRep.displaylist, "regular");
-                    if (sel.bRep.vertextable != null)
-                    {
-                        si.SendInfo(" ... has vertextable. ", "regular");
-                    }
-                    if (sel.bRep.support != null)
-                    {
-                        si.SendInfo("    bRep support: " + sel.bRep.support, "regular");
-                    }
-                }
-                if (sel.transientrep != null)
-                {
-                    si.SendInfo("    transientrep: " + sel.transientrep.hashCode(), "regular");
-                    si.SendInfo("    Geo: " + sel.transientrep.FaceCount() + " triangles;" + sel.transientrep.VertexCount()
-                            + " vertices; ", "regular");
-                    si.SendInfo("    Storage: " + sel.transientrep, "regular");
-                }
-                if (sel.support != null)
-                {
-                    si.SendInfo("    support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
-                }
-                if (sel.scriptnode != null)
-                {
-                    si.SendInfo("    script: " + sel.scriptnode.scripttext, "regular");
-                }
+            si.SendInfo((debug ? "    Complete path: " : "    ") + sel.GetPath(), "regular");
+            si.SendInfo((debug ? "    Texture: " : "    ") + sel.GetTextures(), "bold");
+            if (sel.GetTextures().pigmentdata != null)
+                si.SendInfo(" EMBEDDED ", "regular");
                 if (sel.toParent != null)
                 {
                     sel.GlobalTransformInv();
@@ -802,11 +761,58 @@
             si.SendInfo("    Max count: " + sel.maxcount, "regular");
 //            SendInfo("    countdown: " + sel.countdown + newline, "regular");
 //            SendInfo("    delay: " + sel.delay + newline, "regular");
+            if (debug)
+            {
+                try
+                {
+                    sel.getBounds(minima, maxima, true);
+                } catch (Exception e)
+                {
+                    e.printStackTrace();
+                }
+
+        if (full)
+        {
+            si.SendInfo("    BBox min: " + minima, "regular");
+            si.SendInfo("    BBox max: " + maxima, "regular");
+        }
+        
+                if (sel.bRep != null)
+                {
+                    si.SendInfo("    Mesh: " + sel.bRep.hashCode(), "regular");
+                    si.SendInfo("    Size: " + sel.bRep.FaceCount() + " triangles, " + sel.bRep.VertexCount()
+                            + " vertices; ", "regular");
+                    si.SendInfo("    Storage: " + sel.bRep, "regular");
+                    if (Globals.ADVANCED)
+                    {
+                        si.SendInfo("    Display list: " + sel.bRep.displaylist, "regular");
+                        if (sel.bRep.vertextable != null)
+                        {
+                            si.SendInfo(" ... has vertextable. ", "regular");
+                        }
+                    }
+                    if (sel.bRep.support != null)
+                    {
+                        si.SendInfo("    Mesh support: " + sel.bRep.hashCode() + " " + sel.bRep.support, "regular");
+                    }
+                }
+                if (sel.transientrep != null)
+                {
+                    si.SendInfo("    transient mesh: " + sel.transientrep.hashCode(), "regular");
+                    si.SendInfo("    Size: " + sel.transientrep.FaceCount() + " triangles;" + sel.transientrep.VertexCount()
+                            + " vertices; ", "regular");
+                    si.SendInfo("    Storage: " + sel.transientrep, "regular");
+                }
+                if (sel.support != null)
+                {
+                    si.SendInfo("    support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
+                }
+                if (sel.scriptnode != null)
+                {
+                    si.SendInfo("    script: " + sel.scriptnode.scripttext, "regular");
+                }
             // live, hide, ...
             //??       SendInfo("    Orig: " + maxima + newline, "regular");
-            if (sel.GetTextures().pigmentdata != null)
-                si.SendInfo(" EMBEDDED ", "regular");
-            si.SendInfo((debug ? "    Texture: " : "    ") + sel.GetTextures(), "bold");
     //        SendInfo((debug ? "    Material: " : "    ") + sel.material + newline, "regular");
             if (sel instanceof cMesh)
             {
@@ -838,8 +844,6 @@
                 SwitchNode sn = (SwitchNode) sel;
                 si.SendInfo("    Switch Object: " + sn.switchobject, "regular");
             }
-
-            si.SendInfo((debug ? "    Path: " : "    ") + sel.GetPath(), "regular");
 
 //            System.err.println("info : " + sel.GetPath());
             if (sel instanceof PointFlow)
@@ -1210,8 +1214,11 @@
     cGridBag objectCommandsPanel;
     cGridBag pushPanel;
     cGridBag versionPanel;
+    cGridBag countPanel;
     cGridBag fillPanel;
 
+    cNumberSlider countField;
+    
     JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
     {
         JCheckBox cb;
@@ -1466,6 +1473,12 @@
 
     pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH * 100, 1.1); // To have the buttons
     normalpushField = (cNumberSlider)pushPanel.getComponent(1);
+    if (copy instanceof Composite && !(copy instanceof cGroup))
+    {
+        oe.ctrlPanel.Return();
+        countPanel = AddSlider(oe.ctrlPanel, "Count", 0, 50, copy.count);
+        countField = (cNumberSlider)countPanel.getComponent(1);
+    }
     if (false && copy.versionlist != null && copy.versionindex != -1)
     {
         oe.ctrlPanel.Return();
@@ -2244,7 +2257,7 @@
         {
             objectTabbedPane.add(infoPanel);
             objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/info.png"));
-            objectTabbedPane.setToolTipTextAt(objectTabCount++, "Information");
+            objectTabbedPane.setToolTipTextAt(objectTabCount++, "Information (advanced)");
         }
 
         /*
@@ -5526,8 +5539,8 @@
         //copy.Touch();
     }
 
-    cNumberSlider versionSlider;
-    cNumberSlider versionField;
+    cNumberSlider versionSlider; // Main
+    cNumberSlider versionField; // selection (off)
     
     cNumberSlider scaleSlider;
     
@@ -5573,6 +5586,14 @@
             return;
         }
         
+        if (e.getSource() == countField)
+        {
+            copy.count = countField.getInteger();
+            Globals.lighttouched = true;
+            objEditor.refreshContents();
+            return;
+        }
+        
         if (e.getSource() == scaleSlider)
         {
             int scale = scaleSlider.getInteger();

--
Gitblit v1.6.2