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 +++++++++++++++++++-------------
 BoundaryRep.java |    7 +
 CameraPane.java  |   40 ++++++---
 GroupLeaf.java   |    4 
 Object3D.java    |    2 
 5 files changed, 111 insertions(+), 73 deletions(-)

diff --git a/BoundaryRep.java b/BoundaryRep.java
index 09c35f0..7a7b36c 100644
--- a/BoundaryRep.java
+++ b/BoundaryRep.java
@@ -8752,7 +8752,12 @@
     public String toString()
     {
         //return "trim = " + trimmed + "; stripped = " + stripified + "; AOdone = " + AOdone + "; colors = " + colors;
-        return "trim = " + trimmed + "; stripped = " + stripified + "; colors = " + colors + "; faces = " + (faces!=null?faces.size():null) + "; triangles = " + (triangles!=null?triangles.length:null) + "; indices = " + indices;
+        return "trim = " + trimmed +
+                "; stripped = " + stripified +
+                "; colors = " + colors +
+                "; faces = " + (faces!=null?faces.size():null) +
+                "; triangles = " + (triangles!=null?triangles.length:null) +
+                ((indices==null)?"":"; indices = " + indices.length);
     }
     
     boolean trimmed = false;
diff --git a/CameraPane.java b/CameraPane.java
index 3f97ee4..c7a4b69 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -15002,6 +15002,9 @@
     
     void GoDown(int mod)
     {
+        LA.vecSub(manipCamera.location, manipCamera.lookAt, manipCamera.direction);
+        float scale = (float)manipCamera.direction.length() / 10;
+        
         MODIFIERS |= COMMAND;
         boolean isVR = (mouseMode&VR)!=0;
         /**/
@@ -15011,16 +15014,16 @@
 //                manipCamera.RotateInterest(0, speed);
 //            else
             if (isVR)
-                ViewAngle(-speed*delta);
+                ViewAngle(-speed*delta*scale);
             else
-                manipCamera.Translate(0, -speed*delta, getWidth());
+                manipCamera.Translate(0, -speed*delta*scale, getWidth());
         }
         else
         {
             if (isVR)
-                manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth());
+                manipCamera.BackForth(0, -speed*delta*scale, isVR?1000:0); // getWidth());
             else
-                manipCamera.RotatePosition(0, -speed);
+                manipCamera.RotatePosition(0, -speed*scale);
         }
         
         /**/
@@ -15040,6 +15043,9 @@
 
     void GoUp(int mod)
     {
+        LA.vecSub(manipCamera.location, manipCamera.lookAt, manipCamera.direction);
+        float scale = (float)manipCamera.direction.length() / 10;
+        
                 RigidBody.justclicked = true;
         
         MODIFIERS |= COMMAND;
@@ -15052,14 +15058,14 @@
 //                manipCamera.RotateInterest(0, -speed);
 //            else
             if (isVR)
-                ViewAngle(speed*delta);
+                ViewAngle(speed*delta*scale);
             else
-                manipCamera.Translate(0, speed*delta, getWidth());
+                manipCamera.Translate(0, speed*delta*scale, getWidth());
         }
         else
         {
             if (isVR)
-                manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth());
+                manipCamera.BackForth(0, speed*delta*scale, isVR?1000:0); // getWidth());
             else
                 manipCamera.RotatePosition(0, speed);
         }
@@ -15081,16 +15087,19 @@
 
     void GoLeft(int mod)
     {
+        LA.vecSub(manipCamera.location, manipCamera.lookAt, manipCamera.direction);
+        float scale = (float)manipCamera.direction.length() / 10;
+        
         MODIFIERS |= COMMAND;
         /**/
         if((mod&SHIFT) == SHIFT)
-            manipCamera.Translate(speed, 0, getWidth());
+            manipCamera.Translate(speed*scale, 0, getWidth());
         else
         {
             if ((mouseMode&VR)!=0)
-                manipCamera.RotateInterest(-speed*manipCamera.shaper_fovy/90, 0);
+                manipCamera.RotateInterest(-speed*scale*manipCamera.shaper_fovy/90, 0);
             else
-                manipCamera.RotatePosition(speed*manipCamera.shaper_fovy/90, 0);
+                manipCamera.RotatePosition(speed*scale*manipCamera.shaper_fovy/90, 0);
         }
         
         /**/
@@ -15113,16 +15122,19 @@
 
     void GoRight(int mod)
     {
+        LA.vecSub(manipCamera.location, manipCamera.lookAt, manipCamera.direction);
+        float scale = (float)manipCamera.direction.length() / 10;
+        
         MODIFIERS |= COMMAND;
         /**/
         if((mod&SHIFT) == SHIFT)
-            manipCamera.Translate(-speed, 0, getWidth());
+            manipCamera.Translate(-speed*scale, 0, getWidth());
         else
         {
             if ((mouseMode&VR)!=0)
-                manipCamera.RotateInterest(speed*manipCamera.shaper_fovy/90, 0);
+                manipCamera.RotateInterest(speed*scale*manipCamera.shaper_fovy/90, 0);
             else
-                manipCamera.RotatePosition(-speed*manipCamera.shaper_fovy/90, 0);
+                manipCamera.RotatePosition(-speed*scale*manipCamera.shaper_fovy/90, 0);
         }
         
         /**/
@@ -18275,7 +18287,7 @@
     
     private boolean keepshadow;
     
-    static public boolean capsLocked = false; // VR
+    static public boolean capsLocked = true; // false; // VR
     
     static public int indexcount = 0;
     /*static*/ cColor vertexOcclusion = new cColor();
diff --git a/GroupLeaf.java b/GroupLeaf.java
index 9c7e5f5..ad10985 100644
--- a/GroupLeaf.java
+++ b/GroupLeaf.java
@@ -40,8 +40,8 @@
     {
         ////GraphreeD.trace("SIZE " + count + this + " = ", super.size() - 1);
         
-        if (count == 2)
-            return 2;
+        if (count == 1) // 2)
+            return 1; // 2;
         
         if (true)
             return super.size() - 1; // ???
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();
diff --git a/Object3D.java b/Object3D.java
index 4c48f08..56c17c2 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -3421,7 +3421,7 @@
         }
     }
     
-    public void Scale(int scale)
+    public void Scale(float scale)
     {
         Object3D obj = this;
         

--
Gitblit v1.6.2