From e24558ddeacfc945b9e9ba0a32b552d04e2ed4dd Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 02 Jun 2019 20:11:20 -0400
Subject: [PATCH] Selectable mode + new mesh reduction.

---
 ObjEditor.java |   75 ++++++++++++++++++++++++++++---------
 1 files changed, 56 insertions(+), 19 deletions(-)

diff --git a/ObjEditor.java b/ObjEditor.java
index 2f289ea..75f346b 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -501,13 +501,13 @@
         //SendInfo("Name:", "bold");
         if (sel.GetTextures() != null || debug)
         {
-            si.SendInfo(sel.toString(), "bold");
+            si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
             //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
             if (sel.Size() > 0)
             {
                 si.SendInfo("#children = " + sel.Size(), "regular");
             }
-            si.SendInfo((debug ? "    Parent: " : "    ") + sel.parent, "regular");
+            si.SendInfo((debug ? "    Parent: " : "    ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
             if (debug)
             {
                 try
@@ -549,7 +549,7 @@
                 }
                 if (sel.support != null)
                 {
-                    si.SendInfo("    support: " + sel.support, "regular");
+                    si.SendInfo("    support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
                 }
                 if (sel.scriptnode != null)
                 {
@@ -752,7 +752,7 @@
     protected static ImageIcon createImageIcon(String path,
             String description)
     {
-        java.net.URL imgURL = GrafreeD.class.getResource(path);
+        java.net.URL imgURL = Grafreed.class.getResource(path);
         if (imgURL != null)
         {
             return new ImageIcon(imgURL, description);
@@ -784,6 +784,7 @@
 //    NumberSlider vDivsField;
 //    JCheckBox endcaps;
     JCheckBox liveCB;
+    JCheckBox selectCB;
     JCheckBox hideCB;
     JCheckBox link2masterCB;
     JCheckBox markCB;
@@ -986,9 +987,11 @@
             
         liveCB = AddCheckBox(setupPanel, "Live", copy.live);
                 liveCB.setToolTipText("Animate object");
+        selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
+                selectCB.setToolTipText("Make object selectable");
+//            Return();
         hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
                 hideCB.setToolTipText("Hide object");
-//            Return();
         markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
         markCB.setToolTipText("Set the animation target transform");
         
@@ -1028,7 +1031,7 @@
         oe.ctrlPanel.add(commandsPanel);
         oe.ctrlPanel.Return();
 
-    pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1);
+    pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
     normalpushField = (cNumberSlider)pushPanel.getComponent(1);
     //Return();
 
@@ -1476,19 +1479,19 @@
 
         cGridBag editBar = new cGridBag().setVertical(false);
             
-        editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints);
+        editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
                 createMaterialButton.setToolTipText("Create material");
 
         /*
         ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
          */
 
-        editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints);
+        editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
                 clearMaterialButton.setToolTipText("Clear material");
         
         if (Globals.ADVANCED)
         {
-                editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints);
+                editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
                 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
                 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
         }
@@ -1939,7 +1942,7 @@
 
         //? flashIt = false;
         CameraPane pane = (CameraPane) cameraView;
-        pane.clickStart(location.x, location.y, 0);
+        pane.clickStart(location.x, location.y, 0, 0);
         pane.clickEnd(location.x, location.y, 0, true);
 
         if (group.selection.size() == 1)
@@ -2396,11 +2399,11 @@
 
     void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
     {
-        if (GrafreeD.standAlone)
+        if (Grafreed.standAlone)
         {
             /**/
             FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
-            browser.show();
+            browser.setVisible(true);
             String filename = browser.getFile();
             if (filename != null && filename.length() > 0)
             {
@@ -3007,6 +3010,10 @@
         {
             copy.live ^= true;
             return;
+        } else if (event.getSource() == selectCB)
+        {
+            copy.dontselect ^= true;
+            return;
         } else if (event.getSource() == hideCB)
         {
             copy.hide ^= true;
@@ -3255,8 +3262,8 @@
 
                 Globals.ANIMATION ^= true;
 
-                GrafreeD.wav.cursor = 0;
-                GrafreeD.wav.loop = 0;
+                Grafreed.wav.cursor = 0;
+                Grafreed.wav.loop = 0;
             }
         } else
         {
@@ -3443,6 +3450,36 @@
             {
                 //System.out.println("Propagate = " + propagate);
                 copy.UpdateMaterial(anchor, current, propagate);
+                
+                if (copy.material != null)
+                {
+                    cMaterial mat = copy.material;
+                            
+                    colorField.SetToolTipValue((mat.color));
+                    modulationField.SetToolTipValue((mat.modulation));
+                    metalnessField.SetToolTipValue((mat.metalness));
+                    diffuseField.SetToolTipValue((mat.diffuse));
+                    specularField.SetToolTipValue((mat.specular));
+                    shininessField.SetToolTipValue((mat.shininess));
+                    shiftField.SetToolTipValue((mat.shift));
+                    ambientField.SetToolTipValue((mat.ambient));
+                    lightareaField.SetToolTipValue((mat.lightarea));
+                    diffusenessField.SetToolTipValue((mat.factor));
+                    velvetField.SetToolTipValue((mat.velvet));
+                    sheenField.SetToolTipValue((mat.sheen));
+                    subsurfaceField.SetToolTipValue((mat.subsurface));
+                    backlitField.SetToolTipValue((mat.bump));
+                    anisoField.SetToolTipValue((mat.aniso));
+                    anisoVField.SetToolTipValue((mat.anisoV));
+                    cameraField.SetToolTipValue((mat.cameralight));
+                    selfshadowField.SetToolTipValue((mat.diffuseness));
+                    shadowField.SetToolTipValue((mat.shadow));
+                    textureField.SetToolTipValue((mat.texture));
+                    opacityField.SetToolTipValue((mat.opacity));
+                    fakedepthField.SetToolTipValue((mat.fakedepth));
+                    shadowbiasField.SetToolTipValue((mat.shadowbias));
+                }
+                
                 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
                 {
                     copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
@@ -3558,7 +3595,7 @@
         }
         
         if (normalpushField != null)
-                copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
+                copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
     }
 
         void SnapObject()
@@ -4170,7 +4207,7 @@
 
     void load() // throws ClassNotFoundException
     {
-        if (GrafreeD.standAlone)
+        if (Grafreed.standAlone)
         {
             FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
             browser.show();
@@ -4275,7 +4312,7 @@
 
     void saveAs()
     {
-        if (GrafreeD.standAlone)
+        if (Grafreed.standAlone)
         {
             FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
             browser.setVisible(true);
@@ -4386,7 +4423,7 @@
             Object3D objectparent = obj.parent;
             obj.parent = null;
 
-            Object3D object = (Object3D) GrafreeD.clone(obj);
+            Object3D object = (Object3D) Grafreed.clone(obj);
 
             obj.parent = objectparent;
 
@@ -4420,7 +4457,7 @@
         buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
         cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
         copy.generatePOV(buffer);
-        if (GrafreeD.standAlone)
+        if (Grafreed.standAlone)
         {
             FileDialog browser = new FileDialog(frame, "Export POV", 1);
             browser.show();

--
Gitblit v1.6.2