From 66aca73cce89e4b4d7521862760edf4b0888bc38 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sat, 17 Aug 2019 20:45:38 -0400
Subject: [PATCH] Tree icons, tabbed pane + credits.

---
 ObjEditor.java |  336 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 243 insertions(+), 93 deletions(-)

diff --git a/ObjEditor.java b/ObjEditor.java
index 16de211..8108843 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -83,7 +83,10 @@
     cButton GetButton(String name, boolean border)
     {
         ImageIcon icon = GetIcon(name);
-        return new cButton(icon, border);
+        if (icon != null || name.contains("/"))
+            return new cButton(icon, border);
+        else
+            return new cButton(name, border);
     }
 
     cLabel GetLabel(String name, boolean border)
@@ -106,7 +109,7 @@
 
     static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
     
-    ImageIcon GetIcon(String name)
+    static ImageIcon GetIcon(String name)
     {
         javax.swing.ImageIcon iconCache = icons.get(name);
         if (iconCache != null)
@@ -116,7 +119,7 @@
         
         try
         {
-            BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
+            BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
 
 //            if (image.getWidth() > 48 && image.getHeight() > 48)
 //            {
@@ -426,6 +429,9 @@
 
     static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
 
+    // This is to refresh the UI of the material panel.
+    boolean patchMaterial;
+    
     void SetupMenu()
     {
         frame.setMenuBar(menuBar = new MenuBar());
@@ -962,8 +968,13 @@
         object.versionlist = null;
         object.versiontable = null;
         
+        Object3D parent = object.parent;
+        object.parent = null;
+        
         //byte[] compress = Compress(copy);
         Object3D compress = (Object3D)Grafreed.clone(object);
+        
+        object.parent = parent;
         
         object.versionlist = versions;
         object.versiontable = versiontable; // if Grafreed.grafreed.universe
@@ -1307,7 +1318,7 @@
             
         //if (copy.pinned)
         {
-            pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
+            pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
             pinButton.setSelected(copy.pinned);
             cGridBag t = new cGridBag();
             t.preferredWidth = 2;
@@ -1621,6 +1632,45 @@
         //frontView.object = copy;
         //sideView.object = copy;
 
+        transformPanel = new cGridBag().setVertical(true);
+        
+        cGridBag resetTransformPanel = new cGridBag();
+        
+        resetTransformPanel.preferredHeight = 2;
+        
+        cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
+        resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
+        resetTransform.addMouseListener(new MouseAdapter()
+        {
+            public void mouseClicked(MouseEvent e)
+            {
+                ResetTransform();
+            }
+        });
+        resetTransformPanel.add(resetTransform);
+        
+        resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
+        resetTransform.setToolTipText("Reset Translation only");
+        resetTransform.addMouseListener(new MouseAdapter()
+        {
+            public void mouseClicked(MouseEvent e)
+            {
+                ResetTransform(1);
+            }
+        });
+        resetTransformPanel.add(resetTransform);
+        
+        resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
+        resetTransform.setToolTipText("Reset Rotation and Scale only");
+        resetTransform.addMouseListener(new MouseAdapter()
+        {
+            public void mouseClicked(MouseEvent e)
+            {
+                ResetTransform(2);
+            }
+        });
+        resetTransformPanel.add(resetTransform);
+        
         XYZPanel = new cGridBag().setVertical(true);
         //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
 
@@ -1630,6 +1680,9 @@
         XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
         //XYZPanel.setName("XYZ");
 
+        transformPanel.add(resetTransformPanel);
+        transformPanel.add(XYZPanel);
+        
         /*
         gridPanel = new JPanel(); //new BorderLayout());
         gridPanel.setLayout(new GridLayout(1, 2));
@@ -1637,12 +1690,12 @@
         gridPanel.add(cameraView);
         gridPanel.add(XYZPanel);
          */
-        gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
-        gridPanel.setContinuousLayout(true);
-        gridPanel.setOneTouchExpandable(true);
-        gridPanel.setDividerLocation(1.0);
-        gridPanel.setDividerSize(9);
-        gridPanel.setResizeWeight(0.85);
+//        gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
+//        gridPanel.setContinuousLayout(true);
+//        gridPanel.setOneTouchExpandable(true);
+//        gridPanel.setDividerLocation(1.0);
+//        gridPanel.setDividerSize(9);
+//        gridPanel.setResizeWeight(0.85);
 
 //                aConstraints.weighty = 0;
         //System.out.println("THIS = " + this);
@@ -1685,10 +1738,14 @@
         objectPanel.setIconAt(3, GetIcon("icons/write.png"));
         objectPanel.setToolTipTextAt(3, "Edit controls");
         
-        objectPanel.add(XYZPanel);
+        objectPanel.add(transformPanel);
         objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
-        objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
+        objectPanel.setToolTipTextAt(4, "TRS transform");
         
+        patchMaterial = true;
+        cameraView.patchMaterial = this;
+        objectPanel.setSelectedIndex(1);
+                
         /*
         aConstraints.gridx = 0;
         aConstraints.gridwidth = 1;
@@ -1708,7 +1765,7 @@
         scrollpane.addMouseWheelListener(this); // Default not fast enough
 
         /*JTabbedPane*/ scenePanel = new cGridBag();
-        scenePanel.preferredWidth = 5;
+        scenePanel.preferredWidth = 6;
         
         JTabbedPane tabbedPane = new JTabbedPane();
         tabbedPane.add(scrollpane);
@@ -1719,17 +1776,52 @@
         
         AddOptions(optionsPanel); //, aConstraints);
         
-        tabbedPane.add(optionsPanel);
-        
         tabbedPane.add(FSPane = new cFileSystemPane(this));
 
+        tabbedPane.add(optionsPanel);
+        
         scenePanel.add(tabbedPane);
 
-        //if (Globals.ADVANCED)
-//            tabbedPane.add(infoPanel);
-//        tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
-//        tabbedPane.setToolTipTextAt(3, "Information");
+        cGridBag creditsPanel = new cGridBag().setVertical(true);
+        creditsPanel.setName("Credits");
         
+        cLabel ogaLabel = new cLabel("   Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
+	creditsPanel.add(ogaLabel);
+        
+        cButton opengameartButton;
+	creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
+        opengameartButton.setToolTipText("https://opengameart.org");
+        
+        opengameartButton.addMouseListener(new MouseAdapter()
+        {
+            public void mouseClicked(MouseEvent e)
+            {
+                try
+                {
+                    Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
+                } catch (Exception e1)
+//                } catch (java.io.IOException | java.net.URISyntaxException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+        });
+        
+        for (int i=10; --i>=0;)
+        {
+            creditsPanel.add(new cGridBag());
+        }
+        
+        tabbedPane.add(creditsPanel);
+        tabbedPane.setToolTipTextAt(3, "Credits");
+        
+        if (Globals.ADVANCED)
+        {
+            tabbedPane.add(infoPanel);
+            tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
+            tabbedPane.setToolTipTextAt(4, "Information");
+        }
+
         /*
         cTree jTree = new cTree(null);
         ToolTipManager.sharedInstance().registerComponent(jTree);
@@ -1750,13 +1842,13 @@
         jtp.add(tree);
          */
 
-        bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
-        bigPanel.setContinuousLayout(true);
-        bigPanel.setOneTouchExpandable(true);
-        bigPanel.setDividerLocation(0.8);
-        bigPanel.setDividerSize(15);
-        bigPanel.setResizeWeight(0.15);
-        bigPanel.setName("Scene");
+//        bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
+//        bigPanel.setContinuousLayout(true);
+//        bigPanel.setOneTouchExpandable(true);
+//        bigPanel.setDividerLocation(0.8);
+//        bigPanel.setDividerSize(15);
+//        bigPanel.setResizeWeight(0.15);
+//        bigPanel.setName("Scene");
 
         //bigPanel.setLayout(new BorderLayout());
         //bigPanel.setSize(new Dimension(10,10));
@@ -1840,7 +1932,7 @@
         
                     cameraView.requestFocusInWindow();
                     
-        gridPanel.setDividerLocation(1.0);
+//        gridPanel.setDividerLocation(1.0);
         
         frame.validate();
 
@@ -1875,7 +1967,7 @@
     {
         cGridBag presetpanel = new cGridBag().setVertical(true);
         
-        cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
+        cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
         skin.setToolTipText("Skin");
         skin.addMouseListener(new MouseAdapter()
         {
@@ -1886,7 +1978,15 @@
                 
                 // Skin
                 colorField.setFloat(material.color);
-                saturationField.setFloat(material.modulation);
+                float saturation = material.modulation;
+                
+                if (!cameraView.Skinshader)
+                {
+                    saturation /= 1.5;
+                }
+                
+                saturationField.setFloat(saturation);
+                
                 subsurfaceField.setFloat(material.subsurface);
                 selfshadowField.setFloat(material.diffuseness);
                 diffusenessField.setFloat(material.factor);
@@ -1905,7 +2005,7 @@
         });
         presetpanel.add(skin);
         
-        cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
+        cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
         lambert.setToolTipText("Diffuse");
         lambert.addMouseListener(new MouseAdapter()
         {
@@ -1923,7 +2023,7 @@
         });
         presetpanel.add(lambert);
         
-        cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
+        cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
         diffuse2.setToolTipText("Diffuse2");
         diffuse2.addMouseListener(new MouseAdapter()
         {
@@ -1941,7 +2041,7 @@
         });
         presetpanel.add(diffuse2);
         
-        cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
+        cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
         diffusemoon.setToolTipText("Moon");
         diffusemoon.addMouseListener(new MouseAdapter()
         {
@@ -1959,7 +2059,7 @@
         });
         presetpanel.add(diffusemoon);
         
-        cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
+        cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
         diffusemoon2.setToolTipText("Moon2");
         diffusemoon2.addMouseListener(new MouseAdapter()
         {
@@ -1977,7 +2077,7 @@
         });
         presetpanel.add(diffusemoon2);
         
-        cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
+        cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
         diffusemoon3.setToolTipText("Moon3");
         diffusemoon3.addMouseListener(new MouseAdapter()
         {
@@ -1995,7 +2095,7 @@
         });
         presetpanel.add(diffusemoon3);
         
-        cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
+        cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
         diffusesheen.setToolTipText("Sheen");
         diffusesheen.addMouseListener(new MouseAdapter()
         {
@@ -2012,7 +2112,7 @@
         });
         presetpanel.add(diffusesheen);
         
-        cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
+        cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
         rough.setToolTipText("Rough metal");
         rough.addMouseListener(new MouseAdapter()
         {
@@ -2030,7 +2130,7 @@
         });
         presetpanel.add(rough);
         
-        cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
+        cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
         rough2.setToolTipText("Medium metal");
         rough2.addMouseListener(new MouseAdapter()
         {
@@ -2048,7 +2148,7 @@
         });
         presetpanel.add(rough2);
         
-        cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
+        cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
         shini0.setToolTipText("Shiny");
         shini0.addMouseListener(new MouseAdapter()
         {
@@ -2066,7 +2166,7 @@
         });
         presetpanel.add(shini0);
         
-        cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
+        cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
         shini1.setToolTipText("Shiny2");
         shini1.addMouseListener(new MouseAdapter()
         {
@@ -2084,7 +2184,7 @@
         });
         presetpanel.add(shini1);
         
-        cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
+        cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
         shini2.setToolTipText("Shiny3");
         shini2.addMouseListener(new MouseAdapter()
         {
@@ -2102,7 +2202,7 @@
         });
         presetpanel.add(shini2);
         
-        cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
+        cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
         aniso.setToolTipText("AnisoU");
         aniso.addMouseListener(new MouseAdapter()
         {
@@ -2120,7 +2220,7 @@
         });
         presetpanel.add(aniso);
         
-        cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
+        cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
         aniso2.setToolTipText("AnisoV");
         aniso2.addMouseListener(new MouseAdapter()
         {
@@ -2138,7 +2238,7 @@
         });
         presetpanel.add(aniso2);
         
-        cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
+        cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
         aniso3.setToolTipText("AnisoUV");
         aniso3.addMouseListener(new MouseAdapter()
         {
@@ -2156,7 +2256,7 @@
         });
         presetpanel.add(aniso3);
         
-        cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
+        cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
         velvet0.setToolTipText("Velvet");
         velvet0.addMouseListener(new MouseAdapter()
         {
@@ -2178,7 +2278,7 @@
         });
         presetpanel.add(velvet0);
         
-        cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
+        cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
         bump0.setToolTipText("Bump texture");
         bump0.addMouseListener(new MouseAdapter()
         {
@@ -2197,7 +2297,7 @@
         });
         presetpanel.add(bump0);
         
-        cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
+        cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
         borderShader.setToolTipText("Border fade");
         borderShader.addMouseListener(new MouseAdapter()
         {
@@ -2212,7 +2312,7 @@
         });
         presetpanel.add(borderShader);
         
-        cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
+        cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
         halo.setToolTipText("Halo");
         halo.addMouseListener(new MouseAdapter()
         {
@@ -2229,7 +2329,7 @@
         });
         presetpanel.add(halo);
         
-        cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
+        cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
         candle.setToolTipText("Candle");
         candle.addMouseListener(new MouseAdapter()
         {
@@ -2251,7 +2351,7 @@
         });
         presetpanel.add(candle);
         
-        cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
+        cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
         shadowShader.setToolTipText("Shadow");
         shadowShader.addMouseListener(new MouseAdapter()
         {
@@ -2286,19 +2386,19 @@
 
         cGridBag editBar = new cGridBag().setVertical(false);
             
-        editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
+        editBar.add(createMaterialButton = new cButton("Create", !Globals.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", !Globals.NIMBUSLAF)); // , aConstraints);
                 clearMaterialButton.setToolTipText("Clear material");
         
         if (Globals.ADVANCED)
         {
-                editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
+                editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
                 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
                 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
         }
@@ -4099,12 +4199,15 @@
 
     void New()
     {
-        while (copy.Size() > 1)
+        while (copy.Size() > 0)
         {
-            copy.remove(1);
+            copy.remove(0);
         }
         
+        copy.selection.clear();
+        
         ResetModel();
+        SetupViews();
         objEditor.refreshContents();
     }
     
@@ -4417,6 +4520,8 @@
         return count;
     }
     
+    public cGridBag versionSliderPane;
+    
     void SetVersionStates()
     {
         //if (true)
@@ -4424,21 +4529,36 @@
                     
         //cRadio tab = GetCurrentTab();
         
-        restoreButton.setEnabled(copy.versionindex != -1);
-        replaceButton.setEnabled(copy.versionindex != -1);
-        
-        previousVersionButton.setEnabled(copy.versionindex > 0);
-        nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
-        
-        deleteVersionButton.setEnabled(copy.versionindex != -1);
-                                        //copy.versionlist[copy.versionindex + 1] != null);
-        
-        muteSlider = true;
-        versionSlider.setMinimum(0);
-        versionSlider.setMaximum(VersionCount() - 1);
-        versionSlider.setInteger(copy.versionindex);
-        versionSlider.setEnabled(copy.versionindex != -1);
-        muteSlider = false;
+        if (copy.versionlist == null)
+        {
+            saveVersionButton.setEnabled(false);
+            restoreButton.setEnabled(false);
+            replaceButton.setEnabled(false);
+            previousVersionButton.setEnabled(false);
+            nextVersionButton.setEnabled(false);
+            deleteVersionButton.setEnabled(false);
+            versionSliderPane.setVisible(false);
+        }
+        else
+        {
+            restoreButton.setEnabled(copy.versionindex != -1);
+            replaceButton.setEnabled(copy.versionindex != -1);
+
+            previousVersionButton.setEnabled(copy.versionindex > 0);
+            nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
+
+            deleteVersionButton.setEnabled(copy.versionindex != -1);
+                                            //copy.versionlist[copy.versionindex + 1] != null);
+
+            muteSlider = true;
+            versionSlider.setMinimum(0);
+            versionSlider.setMaximum(VersionCount() - 1);
+            versionSlider.setInteger(copy.versionindex);
+            versionSlider.setEnabled(copy.versionindex != -1);
+            muteSlider = false;
+            
+            versionSliderPane.setVisible(true);
+        }
     }
     
     public boolean PreviousVersion()
@@ -4723,6 +4843,12 @@
 //            else
 //		applySelf(true);
 //	}
+    
+    boolean Equal(double a, double b)
+    {
+        return Math.abs(a - b) < 0.001;
+    }
+    
     void applySelf0(boolean name)
     {
         if (name)
@@ -4772,29 +4898,52 @@
                 {
                     cMaterial mat = copy.material;
                             
-                    colorField.SetToolTipValue((mat.color));
-                    saturationField.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 (!Equal(colorField.getFloat(), mat.color))
+                        colorField.SetToolTipValue((mat.color));
+                    if (!Equal(saturationField.getFloat(), mat.modulation))
+                        saturationField.SetToolTipValue((mat.modulation));
+                    if (!Equal(metalnessField.getFloat(), mat.metalness))
+                        metalnessField.SetToolTipValue((mat.metalness));
+                    if (!Equal(diffuseField.getFloat(), mat.diffuse))
+                        diffuseField.SetToolTipValue((mat.diffuse));
+                    if (!Equal(specularField.getFloat(), mat.specular))
+                        specularField.SetToolTipValue((mat.specular));
+                    if (!Equal(shininessField.getFloat(), mat.shininess))
+                        shininessField.SetToolTipValue((mat.shininess));
+                    if (!Equal(shiftField.getFloat(), mat.shift))
+                        shiftField.SetToolTipValue((mat.shift));
+                    if (!Equal(ambientField.getFloat(), mat.ambient))
+                        ambientField.SetToolTipValue((mat.ambient));
+                    if (!Equal(lightareaField.getFloat(), mat.lightarea))
+                        lightareaField.SetToolTipValue((mat.lightarea));
+                    if (!Equal(diffusenessField.getFloat(), mat.factor))
+                        diffusenessField.SetToolTipValue((mat.factor));
+                    if (!Equal(velvetField.getFloat(), mat.velvet))
+                        velvetField.SetToolTipValue((mat.velvet));
+                    if (!Equal(sheenField.getFloat(), mat.sheen))
+                        sheenField.SetToolTipValue((mat.sheen));
+                    if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
+                        subsurfaceField.SetToolTipValue((mat.subsurface));
+                    if (!Equal(backlitField.getFloat(), mat.bump))
+                        backlitField.SetToolTipValue((mat.bump));
+                    if (!Equal(anisoField.getFloat(), mat.aniso))
+                        anisoField.SetToolTipValue((mat.aniso));
+                    if (!Equal(anisoVField.getFloat(), mat.anisoV))
+                        anisoVField.SetToolTipValue((mat.anisoV));
+                    if (!Equal(cameraField.getFloat(), mat.cameralight))
+                        cameraField.SetToolTipValue((mat.cameralight));
+                    if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
+                        selfshadowField.SetToolTipValue((mat.diffuseness));
+                    if (!Equal(shadowField.getFloat(), mat.shadow))
+                        shadowField.SetToolTipValue((mat.shadow));
+                    if (!Equal(textureField.getFloat(), mat.texture))
+                        textureField.SetToolTipValue((mat.texture));
+                    if (!Equal(opacityField.getFloat(), mat.opacity))
+                        opacityField.SetToolTipValue((mat.opacity));
+                    if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
+                        fakedepthField.SetToolTipValue((mat.fakedepth));
+                    if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
+                        shadowbiasField.SetToolTipValue((mat.shadowbias));
                 }
                 
                 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
@@ -4829,7 +4978,7 @@
     
     public void stateChanged(ChangeEvent e)
     {
-        //    assert(false);
+        // assert(false);
         if (e.getSource() == versionSlider)
         {
             if (muteSlider)
@@ -5942,6 +6091,7 @@
     boolean materialFlushed;
     Object3D latestObject;
     
+    cGridBag transformPanel;
     cGridBag XYZPanel;
     
     JSplitPane gridPanel;

--
Gitblit v1.6.2