From d32f24f147068e6cbecb31c7f98047f68bc8b58a Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 21 Jul 2019 19:03:28 -0400
Subject: [PATCH] Embed texture.

---
 Object3D.java |   76 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/Object3D.java b/Object3D.java
index b3a45b6..2ccc4c6 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,27 @@
         }
     }
     
+    void EmbedTextures()
+    {
+        if (blockloop)
+            return;
+        
+        CameraPane.EmbedTextures(texture);
+        
+        int nb = Size();
+        for (int i = 0; i < nb; i++)
+        {
+            Object3D child = (Object3D) get(i);
+
+            if (child == null)
+                continue;
+
+            blockloop = true;
+            child.EmbedTextures();
+            blockloop = false;
+        }
+    }
+    
     void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
     {
         Draw(display, root, selected, blocked);

--
Gitblit v1.6.2