From de4f66e0239a736bce24e09c9a0b49b5bb92d84b Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Tue, 23 Jul 2019 02:41:35 -0400
Subject: [PATCH] Min shader.

---
 Object3D.java |   87 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 85 insertions(+), 2 deletions(-)

diff --git a/Object3D.java b/Object3D.java
index b3a45b6..1b9b4c0 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -29,7 +29,7 @@
     Object3D saveskeleton;
     //
     
-    byte[] versions[] = new byte[100][];
+    byte[] versions[];
     int versionindex = -1;    
         
     ScriptNode scriptnode;
@@ -219,6 +219,8 @@
 //            o.bRep.support = null;
 //        }
         o.selection = this.selection;
+        o.versions = this.versions;
+        o.versionindex = this.versionindex;
         
         if (this.support != null)
         {
@@ -274,6 +276,9 @@
         }
         
         this.selection = o.selection;
+        
+        this.versions = o.versions;
+        this.versionindex = o.versionindex;
 // July 2019        if (this.bRep != null)
 //            this.bRep.support = o.transientrep;
     //    this.support = o.support;
@@ -421,6 +426,7 @@
         }
         
     boolean live = false;
+    transient boolean keepdontselect;
     boolean dontselect = false;
     boolean hide = false;
     boolean link2master = false; // performs reset support/master at each frame
@@ -3112,7 +3118,7 @@
     {
         if (bRep != null)
         {
-            bRep.GenerateNormalsMINE();
+            bRep.MergeNormals(); //.GenerateNormalsMINE();
             Touch();
         }
     }
@@ -5415,6 +5421,51 @@
         blockloop = false;
     }
 
+    void ResetSelectable()
+    {
+        if (blockloop)
+            return;
+        
+        blockloop = true;
+
+        keepdontselect = dontselect;
+        dontselect = true;
+        
+        Object3D child;
+        int nb = Size();
+        for (int i = 0; i < nb; i++)
+        {
+            child = (Object3D) get(i);
+            if (child == null)
+                continue;
+            child.ResetSelectable();
+        }
+        
+        blockloop = false;
+    }
+
+    void RestoreSelectable()
+    {
+        if (blockloop)
+            return;
+        
+        blockloop = true;
+
+        dontselect = keepdontselect;
+        
+        Object3D child;
+        int nb = Size();
+        for (int i = 0; i < nb; i++)
+        {
+            child = (Object3D) get(i);
+            if (child == null)
+                continue;
+            child.RestoreSelectable();
+        }
+        
+        blockloop = false;
+    }
+
     boolean IsSelected()
     {
         if (parent == null)
@@ -5724,6 +5775,38 @@
         }
     }
     
+    void EmbedTextures(boolean embed)
+    {
+        if (blockloop)
+            return;
+        
+        //if (GetTextures() != null)
+        if (embed)
+            CameraPane.EmbedTextures(GetTextures());
+        else
+        {
+            GetTextures().pigmentdata = null;
+            GetTextures().bumpdata = null;
+            GetTextures().pw = 0;
+            GetTextures().ph = 0;
+            GetTextures().bw = 0;
+            GetTextures().bh = 0;
+        }
+        
+        int nb = Size();
+        for (int i = 0; i < nb; i++)
+        {
+            Object3D child = (Object3D) get(i);
+
+            if (child == null)
+                continue;
+
+            blockloop = true;
+            child.EmbedTextures(embed);
+            blockloop = false;
+        }
+    }
+    
     void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
     {
         Draw(display, root, selected, blocked);

--
Gitblit v1.6.2