From b1d79b74514041a059b454a9f6fc3970773c0cb8 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 12 Aug 2019 18:19:30 -0400
Subject: [PATCH] Compact toolbar.

---
 Object3D.java |   63 ++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/Object3D.java b/Object3D.java
index 1e36e28..cc8b73b 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -22,6 +22,7 @@
     //static final long serialVersionUID = -607422624994562685L;
     static final long serialVersionUID = 5022536242724664900L;
     
+    // Use GetUUID for backward compatibility with null.
     private UUID uuid = UUID.randomUUID();
     
     // TEMPORARY for mocap undo. No need to be transient.
@@ -32,7 +33,7 @@
     String skyboxname;
     String skyboxext;
     
-    byte[] versions[];
+    Object3D versionlist[];
     int versionindex = -1;    
         
     ScriptNode scriptnode;
@@ -222,7 +223,7 @@
 //            o.bRep.support = null;
 //        }
         o.selection = this.selection;
-        o.versions = this.versions;
+        o.versionlist = this.versionlist;
         o.versionindex = this.versionindex;
         
         if (this.support != null)
@@ -245,6 +246,29 @@
     //    this.support = null;
     //    this.fileparent = null;
     }
+
+//    Object3D GetObject(java.util.UUID uuid)
+//    {
+//        if (this.uuid.equals(uuid))
+//            return this;
+//            
+//        if (blockloop)
+//            return null;
+//
+//        blockloop = true;
+//
+//        for (int i=0; i<Size(); i++)
+//        {
+//            Object3D o = get(i).GetObject(uuid);
+//            
+//            if (o != null)
+//                return o;
+//        }
+//        
+//        blockloop = false;
+//        
+//        return null;
+//    }
 
     void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
     {
@@ -280,7 +304,7 @@
         
         this.selection = o.selection;
         
-        this.versions = o.versions;
+        this.versionlist = o.versionlist;
         this.versionindex = o.versionindex;
 // July 2019        if (this.bRep != null)
 //            this.bRep.support = o.transientrep;
@@ -1014,6 +1038,9 @@
         
         if (material == null || material.multiply)
             return true;
+        
+        if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
+            return false;
         
         // Transparent objects are dynamic because we have to sort the triangles.
         return material.opacity > 0.99;
@@ -2441,6 +2468,11 @@
         else
         {
             //((ObjEditor)editWindow).SetupUI2(null);
+            if (objectUI != null)
+                ((ObjEditor)objectUI).pinButton.setSelected(pinned);
+            else
+                //new Exception().printStackTrace();
+                System.err.println("objectUI is null");
         }
     }
 
@@ -5909,8 +5941,10 @@
         if (support != null)
             support = support;
         
-        //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
-        boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
+        boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
+        //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
+        
+        //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
         
         if (!usecalllists && bRep != null && bRep.displaylist > 0)
         {
@@ -5920,8 +5954,9 @@
    //     usecalllists &= !(parent instanceof RandomNode);
    //     usecalllists = false;
 
-        if (GetBRep() != null)
-            usecalllists = usecalllists;
+        if (display.DrawMode() == display.SHADOW)
+            //GetBRep() != null)
+            usecalllists = !!usecalllists;
         //System.out.println("draw " + this);
         //new Exception().printStackTrace();
 
@@ -5943,7 +5978,7 @@
             if (!(this instanceof Composite))
                 touched = false;
             //if (displaylist == -1 && usecalllists)
-            if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
+            if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
             {
                 bRep.displaylist = display.GenList();
                 assert(bRep.displaylist != 0);
@@ -5954,7 +5989,7 @@
 
             //System.out.println("\tnew list " + list);
             //gl.glDrawBuffer(gl.GL_NONE);
-            if (usecalllists)
+            if (usecalllists && bRep.displaylist > 0)
             {
 //            System.err.println("new list " + bRep.displaylist + " for " + this);
                 display.NewList(bRep.displaylist);
@@ -5963,7 +5998,7 @@
             CallList(display, root, selected, blocked);
             
           //  compiled = true;
-            if (usecalllists)
+            if (usecalllists && bRep.displaylist > 0)
             {
 //            System.err.println("end list " + bRep.displaylist + " for " + this);
                 display.EndList();
@@ -7493,7 +7528,7 @@
             hitSomething = hitScale;
             
         double scale = 0.005f * clickInfo.camera.Distance();
-                double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
+                double hScale = (double) (clickInfo.x - centerPt.x) / 32;
                 double sign = 1;
                 if (hScale < 0)
                 {
@@ -7505,7 +7540,7 @@
                     //hScale = 0.01;
                 }
                 
-                double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
+                double vScale = (double) (clickInfo.y - centerPt.y) / 32;
                 sign = 1;
                 if (vScale < 0)
                 {
@@ -7720,7 +7755,7 @@
                 break;
 
             case hitScale: // scale
-                double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
+                double hScale = (double) (clickInfo.x - centerPt.x) / 32;
                 double sign = 1;
                 if (hScale < 0)
                 {
@@ -7732,7 +7767,7 @@
                     //hScale = 0.01;
                 }
                 
-                double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
+                double vScale = (double) (clickInfo.y - centerPt.y) / 32;
                 sign = 1;
                 if (vScale < 0)
                 {

--
Gitblit v1.6.2