Normand Briere
2019-08-18 66aca73cce89e4b4d7521862760edf4b0888bc38
ObjEditor.java
....@@ -43,6 +43,35 @@
4343
4444 static ObjEditor theFrame;
4545
46
+ public void AllocProjectedVertices(Object3D object)
47
+ {
48
+ assert (object.projectedVertices != null);
49
+
50
+ if (object.projectedVertices.length <= 2)
51
+ {
52
+ // Side effect...
53
+ Object3D.cVector2[] keep = object.projectedVertices;
54
+ object.projectedVertices = new Object3D.cVector2[3];
55
+ for (int i = 0; i < 3; i++)
56
+ {
57
+ if (i < keep.length)
58
+ {
59
+ object.projectedVertices[i] = keep[i];
60
+ } else
61
+ {
62
+ object.projectedVertices[i] = new Object3D.cVector2();
63
+ }
64
+ /*
65
+ if(keep.length == 0)
66
+ object.projectedVertices[0] = new Object3D.cVector2();
67
+ else
68
+ object.projectedVertices[0] = keep[0];
69
+ object.projectedVertices[1] = new Object3D.cVector2();
70
+ */
71
+ }
72
+ }
73
+ }
74
+
4675 public cGridBag GetSeparator()
4776 {
4877 cGridBag separator = new cGridBag();
....@@ -54,7 +83,10 @@
5483 cButton GetButton(String name, boolean border)
5584 {
5685 ImageIcon icon = GetIcon(name);
57
- return new cButton(icon, border);
86
+ if (icon != null || name.contains("/"))
87
+ return new cButton(icon, border);
88
+ else
89
+ return new cButton(name, border);
5890 }
5991
6092 cLabel GetLabel(String name, boolean border)
....@@ -75,11 +107,19 @@
75107 return new cCheckBox(icon, border);
76108 }
77109
78
- ImageIcon GetIcon(String name)
110
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
111
+
112
+ static ImageIcon GetIcon(String name)
79113 {
114
+ javax.swing.ImageIcon iconCache = icons.get(name);
115
+ if (iconCache != null)
116
+ {
117
+ return iconCache;
118
+ }
119
+
80120 try
81121 {
82
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
122
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
83123
84124 // if (image.getWidth() > 48 && image.getHeight() > 48)
85125 // {
....@@ -94,10 +134,14 @@
94134 // }
95135
96136 javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
137
+
138
+ icons.put(name, icon);
139
+
97140 return icon;
98141 }
99142 catch (Exception e)
100143 {
144
+ //icons.put(name, null);
101145 return null;
102146 }
103147 }
....@@ -297,11 +341,13 @@
297341 client = inClient;
298342 copy = client;
299343
300
- if (copy.versionlist == null)
301
- {
302
- copy.versionlist = new Object3D[100];
303
- copy.versionindex = -1;
304
- }
344
+// if (copy.versionlist == null)
345
+// {
346
+// copy.versionlist = new Object3D[100];
347
+// copy.versionindex = -1;
348
+//
349
+// callee.Save(true);
350
+// }
305351
306352 // "this" is not called: SetupUI2(objEditor);
307353 }
....@@ -320,6 +366,8 @@
320366 {
321367 copy.versionlist = new Object3D[100];
322368 copy.versionindex = -1;
369
+
370
+// Save(true);
323371 }
324372
325373 SetupUI2(callee.GetEditor());
....@@ -343,7 +391,8 @@
343391 //parent = p;
344392
345393 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
346
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
394
+ if (Globals.DEBUG)
395
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
347396 //gd.setFullScreenWindow(this);
348397 //setResizable(false);
349398 //if (!isDisplayable())
....@@ -354,11 +403,13 @@
354403 copy = localCopy;
355404 copy.editWindow = this;
356405
357
- if (copy.versionlist == null)
358
- {
359
-// copy.versions = new byte[100][];
406
+// if (copy.versionlist == null)
407
+// {
408
+// copy.versionlist = new Object3D[100];
360409 // copy.versionindex = -1;
361
- }
410
+//
411
+// Save(true);
412
+// }
362413
363414 SetupMenu();
364415
....@@ -378,6 +429,9 @@
378429
379430 static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
380431
432
+ // This is to refresh the UI of the material panel.
433
+ boolean patchMaterial;
434
+
381435 void SetupMenu()
382436 {
383437 frame.setMenuBar(menuBar = new MenuBar());
....@@ -427,6 +481,8 @@
427481
428482 ChangeListener changeListener = new ChangeListener()
429483 {
484
+ //String name;
485
+
430486 public void stateChanged(ChangeEvent changeEvent)
431487 {
432488 // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
....@@ -445,7 +501,37 @@
445501 // EditSelection(false);
446502 // }
447503
448
- refreshContents(false); // To refresh Info tab
504
+// if (objectPanel.getSelectedIndex() == 4)
505
+// {
506
+// name = copy.skyboxname;
507
+//
508
+// if (name == null)
509
+// {
510
+// name = "";
511
+// }
512
+//
513
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
514
+// copy.skyboxext = "jpg";
515
+// }
516
+// else
517
+// {
518
+// if (name != null)
519
+// {
520
+// if (name.equals(""))
521
+// {
522
+// copy.skyboxname = null;
523
+// copy.skyboxext = null;
524
+// }
525
+// else
526
+// {
527
+// copy.skyboxname = name;
528
+// }
529
+// }
530
+// }
531
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
532
+
533
+// refreshContents(false); // To refresh Info tab
534
+ cameraView.repaint();
449535 }
450536 };
451537 objectPanel.addChangeListener(changeListener);
....@@ -754,6 +840,7 @@
754840 boolean maximized;
755841
756842 cButton fullscreenLayout;
843
+ cButton expandedLayout;
757844
758845 void Minimize()
759846 {
....@@ -793,10 +880,12 @@
793880 cButton minButton;
794881 cButton maxButton;
795882 cButton fullButton;
883
+ cButton collapseButton;
884
+ cButton maximize3DButton;
796885
797886 void ToggleFullScreen()
798887 {
799
-GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
888
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
800889
801890 cameraView.ToggleFullScreen();
802891
....@@ -817,13 +906,13 @@
817906 // X frame.getContentPane().remove(/*"Center",*/bigThree);
818907 // X framePanel.add(bigThree);
819908 // X frame.getContentPane().add(/*"Center",*/framePanel);
820
- framePanel.setDividerLocation(46);
909
+// framePanel.setDividerLocation(46); // icons are 24x24
821910
822911 //frame.setVisible(true);
823
- radio.layout = keepButton;
912
+// radio.layout = keepButton;
824913 //theFrame = null;
825914 keepButton = null;
826
- radio.layout.doClick();
915
+// radio.layout.doClick();
827916
828917 } else
829918 {
....@@ -844,10 +933,10 @@
844933 // X frame.getContentPane().remove(/*"Center",*/framePanel);
845934 // X framePanel.remove(bigThree);
846935 // X frame.getContentPane().add(/*"Center",*/bigThree);
847
- framePanel.setDividerLocation(0);
936
+// framePanel.setDividerLocation(0);
848937
849
- radio.layout = fullscreenLayout;
850
- radio.layout.doClick();
938
+// radio.layout = fullscreenLayout;
939
+// radio.layout.doClick();
851940 //frame.setVisible(true);
852941 }
853942 frame.validate();
....@@ -855,23 +944,42 @@
855944 cameraView.requestFocusInWindow();
856945 }
857946
858
- private Object3D CompressCopy()
947
+ void CollapseToolbar()
948
+ {
949
+ framePanel.setDividerLocation(0);
950
+ //frame.validate();
951
+
952
+ cameraView.requestFocusInWindow();
953
+ }
954
+
955
+ private Object3D Duplicate(Object3D object)
859956 {
860957 boolean temp = CameraPane.SWITCH;
861958 CameraPane.SWITCH = false;
862959
863
- copy.ExtractBigData(versiontable);
960
+ if (Grafreed.grafreed.universe.versiontable == null)
961
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
962
+
963
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
864964 // if (copy == client)
865965
866
- Object3D versions[] = copy.versionlist;
867
- copy.versionlist = null;
966
+ Object3D versions[] = object.versionlist;
967
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
968
+ object.versionlist = null;
969
+ object.versiontable = null;
970
+
971
+ Object3D parent = object.parent;
972
+ object.parent = null;
868973
869974 //byte[] compress = Compress(copy);
870
- Object3D compress = (Object3D)Grafreed.clone(copy);
975
+ Object3D compress = (Object3D)Grafreed.clone(object);
871976
872
- copy.versionlist = versions;
977
+ object.parent = parent;
873978
874
- copy.RestoreBigData(versiontable);
979
+ object.versionlist = versions;
980
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
981
+
982
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
875983
876984 CameraPane.SWITCH = temp;
877985
....@@ -1210,7 +1318,7 @@
12101318
12111319 //if (copy.pinned)
12121320 {
1213
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1321
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
12141322 pinButton.setSelected(copy.pinned);
12151323 cGridBag t = new cGridBag();
12161324 t.preferredWidth = 2;
....@@ -1233,14 +1341,14 @@
12331341
12341342 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
12351343 liveCB.setToolTipText("Animate object");
1344
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1345
+ markCB.setToolTipText("Set target transform");
12361346 selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
12371347 selectableCB.setToolTipText("Make object selectable");
12381348 // Return();
12391349
12401350 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
12411351 hideCB.setToolTipText("Hide object");
1242
- markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1243
- markCB.setToolTipText("As animation target transform");
12441352
12451353 ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
12461354
....@@ -1442,6 +1550,7 @@
14421550
14431551 if (cam == null || !(copy.get(0) instanceof cGroup))
14441552 {
1553
+ if (Globals.DEBUG)
14451554 System.out.println("CREATE CAMERAS");
14461555 cams = new cTemplate();
14471556 cams.name = "Cameras";
....@@ -1523,6 +1632,45 @@
15231632 //frontView.object = copy;
15241633 //sideView.object = copy;
15251634
1635
+ transformPanel = new cGridBag().setVertical(true);
1636
+
1637
+ cGridBag resetTransformPanel = new cGridBag();
1638
+
1639
+ resetTransformPanel.preferredHeight = 2;
1640
+
1641
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1642
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
1643
+ resetTransform.addMouseListener(new MouseAdapter()
1644
+ {
1645
+ public void mouseClicked(MouseEvent e)
1646
+ {
1647
+ ResetTransform();
1648
+ }
1649
+ });
1650
+ resetTransformPanel.add(resetTransform);
1651
+
1652
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1653
+ resetTransform.setToolTipText("Reset Translation only");
1654
+ resetTransform.addMouseListener(new MouseAdapter()
1655
+ {
1656
+ public void mouseClicked(MouseEvent e)
1657
+ {
1658
+ ResetTransform(1);
1659
+ }
1660
+ });
1661
+ resetTransformPanel.add(resetTransform);
1662
+
1663
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1664
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
1665
+ resetTransform.addMouseListener(new MouseAdapter()
1666
+ {
1667
+ public void mouseClicked(MouseEvent e)
1668
+ {
1669
+ ResetTransform(2);
1670
+ }
1671
+ });
1672
+ resetTransformPanel.add(resetTransform);
1673
+
15261674 XYZPanel = new cGridBag().setVertical(true);
15271675 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
15281676
....@@ -1532,6 +1680,9 @@
15321680 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
15331681 //XYZPanel.setName("XYZ");
15341682
1683
+ transformPanel.add(resetTransformPanel);
1684
+ transformPanel.add(XYZPanel);
1685
+
15351686 /*
15361687 gridPanel = new JPanel(); //new BorderLayout());
15371688 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1539,12 +1690,12 @@
15391690 gridPanel.add(cameraView);
15401691 gridPanel.add(XYZPanel);
15411692 */
1542
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1543
- gridPanel.setContinuousLayout(true);
1544
- gridPanel.setOneTouchExpandable(true);
1545
- gridPanel.setDividerLocation(1.0);
1546
- gridPanel.setDividerSize(9);
1547
- gridPanel.setResizeWeight(0.85);
1693
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1694
+// gridPanel.setContinuousLayout(true);
1695
+// gridPanel.setOneTouchExpandable(true);
1696
+// gridPanel.setDividerLocation(1.0);
1697
+// gridPanel.setDividerSize(9);
1698
+// gridPanel.setResizeWeight(0.85);
15481699
15491700 // aConstraints.weighty = 0;
15501701 //System.out.println("THIS = " + this);
....@@ -1567,14 +1718,14 @@
15671718
15681719 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
15691720 //tmp.setName("Edit");
1570
- objectPanel.add(materialPanel);
1571
- objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1572
- objectPanel.setToolTipTextAt(0, "Material");
1573
-
15741721 objectPanel.add(toolboxPanel);
1575
- objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1576
- objectPanel.setToolTipTextAt(1, "Objects & textures");
1722
+ objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1723
+ objectPanel.setToolTipTextAt(0, "Objects & textures");
15771724
1725
+ objectPanel.add(materialPanel);
1726
+ objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1727
+ objectPanel.setToolTipTextAt(1, "Material");
1728
+
15781729 objectPanel.add(skyboxPanel);
15791730 objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
15801731 objectPanel.setToolTipTextAt(2, "Backgrounds");
....@@ -1587,10 +1738,14 @@
15871738 objectPanel.setIconAt(3, GetIcon("icons/write.png"));
15881739 objectPanel.setToolTipTextAt(3, "Edit controls");
15891740
1590
- objectPanel.add(XYZPanel);
1741
+ objectPanel.add(transformPanel);
15911742 objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1592
- objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1743
+ objectPanel.setToolTipTextAt(4, "TRS transform");
15931744
1745
+ patchMaterial = true;
1746
+ cameraView.patchMaterial = this;
1747
+ objectPanel.setSelectedIndex(1);
1748
+
15941749 /*
15951750 aConstraints.gridx = 0;
15961751 aConstraints.gridwidth = 1;
....@@ -1610,7 +1765,7 @@
16101765 scrollpane.addMouseWheelListener(this); // Default not fast enough
16111766
16121767 /*JTabbedPane*/ scenePanel = new cGridBag();
1613
- scenePanel.preferredWidth = 5;
1768
+ scenePanel.preferredWidth = 6;
16141769
16151770 JTabbedPane tabbedPane = new JTabbedPane();
16161771 tabbedPane.add(scrollpane);
....@@ -1621,17 +1776,52 @@
16211776
16221777 AddOptions(optionsPanel); //, aConstraints);
16231778
1624
- tabbedPane.add(optionsPanel);
1625
-
16261779 tabbedPane.add(FSPane = new cFileSystemPane(this));
16271780
1781
+ tabbedPane.add(optionsPanel);
1782
+
16281783 scenePanel.add(tabbedPane);
16291784
1630
- //if (Globals.ADVANCED)
1631
- tabbedPane.add(infoPanel);
1632
- tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1633
- tabbedPane.setToolTipTextAt(3, "Information");
1785
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1786
+ creditsPanel.setName("Credits");
16341787
1788
+ cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1789
+ creditsPanel.add(ogaLabel);
1790
+
1791
+ cButton opengameartButton;
1792
+ creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1793
+ opengameartButton.setToolTipText("https://opengameart.org");
1794
+
1795
+ opengameartButton.addMouseListener(new MouseAdapter()
1796
+ {
1797
+ public void mouseClicked(MouseEvent e)
1798
+ {
1799
+ try
1800
+ {
1801
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1802
+ } catch (Exception e1)
1803
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1804
+ {
1805
+ e1.printStackTrace();
1806
+ }
1807
+ }
1808
+ });
1809
+
1810
+ for (int i=10; --i>=0;)
1811
+ {
1812
+ creditsPanel.add(new cGridBag());
1813
+ }
1814
+
1815
+ tabbedPane.add(creditsPanel);
1816
+ tabbedPane.setToolTipTextAt(3, "Credits");
1817
+
1818
+ if (Globals.ADVANCED)
1819
+ {
1820
+ tabbedPane.add(infoPanel);
1821
+ tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1822
+ tabbedPane.setToolTipTextAt(4, "Information");
1823
+ }
1824
+
16351825 /*
16361826 cTree jTree = new cTree(null);
16371827 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1652,13 +1842,13 @@
16521842 jtp.add(tree);
16531843 */
16541844
1655
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1656
- bigPanel.setContinuousLayout(true);
1657
- bigPanel.setOneTouchExpandable(true);
1658
- bigPanel.setDividerLocation(0.8);
1659
- bigPanel.setDividerSize(15);
1660
- bigPanel.setResizeWeight(0.15);
1661
- bigPanel.setName("Scene");
1845
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1846
+// bigPanel.setContinuousLayout(true);
1847
+// bigPanel.setOneTouchExpandable(true);
1848
+// bigPanel.setDividerLocation(0.8);
1849
+// bigPanel.setDividerSize(15);
1850
+// bigPanel.setResizeWeight(0.15);
1851
+// bigPanel.setName("Scene");
16621852
16631853 //bigPanel.setLayout(new BorderLayout());
16641854 //bigPanel.setSize(new Dimension(10,10));
....@@ -1702,6 +1892,23 @@
17021892 // aConstraints.gridheight = 1;
17031893
17041894 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1895
+
1896
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1897
+ new java.beans.PropertyChangeListener()
1898
+ {
1899
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1900
+ {
1901
+ if ((Integer)pce.getOldValue() == 1)
1902
+ {
1903
+ if (radio.layout != expandedLayout)
1904
+ {
1905
+ radio.layout = expandedLayout;
1906
+ radio.layout.doClick();
1907
+ }
1908
+ }
1909
+ }
1910
+ });
1911
+
17051912 framePanel.setContinuousLayout(false);
17061913 framePanel.setOneTouchExpandable(false);
17071914 //.setDividerLocation(0.8);
....@@ -1711,7 +1918,7 @@
17111918
17121919 frame.getContentPane().setLayout(new BorderLayout());
17131920 /**/
1714
- JTabbedPane worldPane = new JTabbedPane();
1921
+ //JTabbedPane worldPane = new JTabbedPane();
17151922 //worldPane.add(bigPanel);
17161923 //worldPane.add(worldPanel);
17171924 /**/
....@@ -1725,7 +1932,7 @@
17251932
17261933 cameraView.requestFocusInWindow();
17271934
1728
- gridPanel.setDividerLocation(1.0);
1935
+// gridPanel.setDividerLocation(1.0);
17291936
17301937 frame.validate();
17311938
....@@ -1760,7 +1967,7 @@
17601967 {
17611968 cGridBag presetpanel = new cGridBag().setVertical(true);
17621969
1763
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1970
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
17641971 skin.setToolTipText("Skin");
17651972 skin.addMouseListener(new MouseAdapter()
17661973 {
....@@ -1771,7 +1978,15 @@
17711978
17721979 // Skin
17731980 colorField.setFloat(material.color);
1774
- saturationField.setFloat(material.modulation);
1981
+ float saturation = material.modulation;
1982
+
1983
+ if (!cameraView.Skinshader)
1984
+ {
1985
+ saturation /= 1.5;
1986
+ }
1987
+
1988
+ saturationField.setFloat(saturation);
1989
+
17751990 subsurfaceField.setFloat(material.subsurface);
17761991 selfshadowField.setFloat(material.diffuseness);
17771992 diffusenessField.setFloat(material.factor);
....@@ -1790,7 +2005,7 @@
17902005 });
17912006 presetpanel.add(skin);
17922007
1793
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2008
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
17942009 lambert.setToolTipText("Diffuse");
17952010 lambert.addMouseListener(new MouseAdapter()
17962011 {
....@@ -1808,7 +2023,7 @@
18082023 });
18092024 presetpanel.add(lambert);
18102025
1811
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2026
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
18122027 diffuse2.setToolTipText("Diffuse2");
18132028 diffuse2.addMouseListener(new MouseAdapter()
18142029 {
....@@ -1826,7 +2041,7 @@
18262041 });
18272042 presetpanel.add(diffuse2);
18282043
1829
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2044
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
18302045 diffusemoon.setToolTipText("Moon");
18312046 diffusemoon.addMouseListener(new MouseAdapter()
18322047 {
....@@ -1844,7 +2059,7 @@
18442059 });
18452060 presetpanel.add(diffusemoon);
18462061
1847
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2062
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
18482063 diffusemoon2.setToolTipText("Moon2");
18492064 diffusemoon2.addMouseListener(new MouseAdapter()
18502065 {
....@@ -1862,7 +2077,7 @@
18622077 });
18632078 presetpanel.add(diffusemoon2);
18642079
1865
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2080
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
18662081 diffusemoon3.setToolTipText("Moon3");
18672082 diffusemoon3.addMouseListener(new MouseAdapter()
18682083 {
....@@ -1880,7 +2095,7 @@
18802095 });
18812096 presetpanel.add(diffusemoon3);
18822097
1883
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2098
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
18842099 diffusesheen.setToolTipText("Sheen");
18852100 diffusesheen.addMouseListener(new MouseAdapter()
18862101 {
....@@ -1897,7 +2112,7 @@
18972112 });
18982113 presetpanel.add(diffusesheen);
18992114
1900
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2115
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
19012116 rough.setToolTipText("Rough metal");
19022117 rough.addMouseListener(new MouseAdapter()
19032118 {
....@@ -1915,7 +2130,7 @@
19152130 });
19162131 presetpanel.add(rough);
19172132
1918
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2133
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
19192134 rough2.setToolTipText("Medium metal");
19202135 rough2.addMouseListener(new MouseAdapter()
19212136 {
....@@ -1933,7 +2148,7 @@
19332148 });
19342149 presetpanel.add(rough2);
19352150
1936
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2151
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
19372152 shini0.setToolTipText("Shiny");
19382153 shini0.addMouseListener(new MouseAdapter()
19392154 {
....@@ -1951,7 +2166,7 @@
19512166 });
19522167 presetpanel.add(shini0);
19532168
1954
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2169
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
19552170 shini1.setToolTipText("Shiny2");
19562171 shini1.addMouseListener(new MouseAdapter()
19572172 {
....@@ -1969,7 +2184,7 @@
19692184 });
19702185 presetpanel.add(shini1);
19712186
1972
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2187
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
19732188 shini2.setToolTipText("Shiny3");
19742189 shini2.addMouseListener(new MouseAdapter()
19752190 {
....@@ -1987,7 +2202,7 @@
19872202 });
19882203 presetpanel.add(shini2);
19892204
1990
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2205
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
19912206 aniso.setToolTipText("AnisoU");
19922207 aniso.addMouseListener(new MouseAdapter()
19932208 {
....@@ -2005,7 +2220,7 @@
20052220 });
20062221 presetpanel.add(aniso);
20072222
2008
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2223
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
20092224 aniso2.setToolTipText("AnisoV");
20102225 aniso2.addMouseListener(new MouseAdapter()
20112226 {
....@@ -2023,7 +2238,7 @@
20232238 });
20242239 presetpanel.add(aniso2);
20252240
2026
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2241
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
20272242 aniso3.setToolTipText("AnisoUV");
20282243 aniso3.addMouseListener(new MouseAdapter()
20292244 {
....@@ -2041,7 +2256,7 @@
20412256 });
20422257 presetpanel.add(aniso3);
20432258
2044
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2259
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
20452260 velvet0.setToolTipText("Velvet");
20462261 velvet0.addMouseListener(new MouseAdapter()
20472262 {
....@@ -2063,7 +2278,7 @@
20632278 });
20642279 presetpanel.add(velvet0);
20652280
2066
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2281
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
20672282 bump0.setToolTipText("Bump texture");
20682283 bump0.addMouseListener(new MouseAdapter()
20692284 {
....@@ -2082,7 +2297,22 @@
20822297 });
20832298 presetpanel.add(bump0);
20842299
2085
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2300
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
2301
+ borderShader.setToolTipText("Border fade");
2302
+ borderShader.addMouseListener(new MouseAdapter()
2303
+ {
2304
+ public void mouseClicked(MouseEvent e)
2305
+ {
2306
+ borderfadeField.setFloat(0.5);
2307
+ opacityField.setFloat(0.75);
2308
+
2309
+ materialtouched = true;
2310
+ applySelf();
2311
+ }
2312
+ });
2313
+ presetpanel.add(borderShader);
2314
+
2315
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
20862316 halo.setToolTipText("Halo");
20872317 halo.addMouseListener(new MouseAdapter()
20882318 {
....@@ -2099,7 +2329,7 @@
20992329 });
21002330 presetpanel.add(halo);
21012331
2102
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2332
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
21032333 candle.setToolTipText("Candle");
21042334 candle.addMouseListener(new MouseAdapter()
21052335 {
....@@ -2121,6 +2351,25 @@
21212351 });
21222352 presetpanel.add(candle);
21232353
2354
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
2355
+ shadowShader.setToolTipText("Shadow");
2356
+ shadowShader.addMouseListener(new MouseAdapter()
2357
+ {
2358
+ public void mouseClicked(MouseEvent e)
2359
+ {
2360
+ diffuseField.setFloat(0.001);
2361
+ ambientField.setFloat(0.001);
2362
+ cameraField.setFloat(0.001);
2363
+ specularField.setFloat(0.001);
2364
+ fakedepthField.setFloat(0.001);
2365
+ opacityField.setFloat(0.6);
2366
+
2367
+ materialtouched = true;
2368
+ applySelf();
2369
+ }
2370
+ });
2371
+ presetpanel.add(shadowShader);
2372
+
21242373 cGridBag panel = new cGridBag().setVertical(true);
21252374
21262375 presetpanel.preferredWidth = 1;
....@@ -2137,19 +2386,19 @@
21372386
21382387 cGridBag editBar = new cGridBag().setVertical(false);
21392388
2140
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2389
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
21412390 createMaterialButton.setToolTipText("Create material");
21422391
21432392 /*
21442393 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
21452394 */
21462395
2147
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2396
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
21482397 clearMaterialButton.setToolTipText("Clear material");
21492398
21502399 if (Globals.ADVANCED)
21512400 {
2152
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2401
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
21532402 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
21542403 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
21552404 }
....@@ -2170,9 +2419,20 @@
21702419
21712420 cGridBag huepanel = new cGridBag();
21722421 cGridBag huelabel = new cGridBag();
2173
- skin = GetLabel("icons/hue.png", false);
2174
- skin.fit = true;
2175
- huelabel.add(skin);
2422
+ cLabel hue = GetLabel("icons/hue.png", false);
2423
+ hue.fit = true;
2424
+
2425
+ hue.addMouseListener(new MouseAdapter()
2426
+ {
2427
+ public void mousePressed(MouseEvent e)
2428
+ {
2429
+ int x = e.getX();
2430
+
2431
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2432
+ }
2433
+ });
2434
+
2435
+ huelabel.add(hue);
21762436 huelabel.preferredWidth = 20;
21772437 huepanel.add(new cGridBag()); // Label
21782438 huepanel.add(huelabel); // Field/slider
....@@ -3448,32 +3708,8 @@
34483708
34493709 if (multiplyToggle != null)
34503710 multiplyToggle.setSelected(mat.multiply);
3451
-
3452
- assert (object.projectedVertices != null);
3453
-
3454
- if (object.projectedVertices.length <= 2)
3455
- {
3456
- // Side effect...
3457
- Object3D.cVector2[] keep = object.projectedVertices;
3458
- object.projectedVertices = new Object3D.cVector2[3];
3459
- for (int i = 0; i < 3; i++)
3460
- {
3461
- if (i < keep.length)
3462
- {
3463
- object.projectedVertices[i] = keep[i];
3464
- } else
3465
- {
3466
- object.projectedVertices[i] = new Object3D.cVector2();
3467
- }
3468
- /*
3469
- if(keep.length == 0)
3470
- object.projectedVertices[0] = new Object3D.cVector2();
3471
- else
3472
- object.projectedVertices[0] = keep[0];
3473
- object.projectedVertices[1] = new Object3D.cVector2();
3474
- */
3475
- }
3476
- }
3711
+
3712
+ AllocProjectedVertices(object);
34773713
34783714 SetMaterial(mat, object.projectedVertices);
34793715 }
....@@ -3783,7 +4019,7 @@
37834019 //System.out.println("ObjEditor " + event);
37844020 applySelf0(true);
37854021 //parent.applySelf();
3786
- objEditor.refreshContents();
4022
+ // conflicts with requestFocus objEditor.refreshContents();
37874023 } else if (source == resetButton)
37884024 {
37894025 CameraPane.fullreset = true;
....@@ -3963,12 +4199,15 @@
39634199
39644200 void New()
39654201 {
3966
- while (copy.Size() > 1)
4202
+ while (copy.Size() > 0)
39674203 {
3968
- copy.remove(1);
4204
+ copy.remove(0);
39694205 }
39704206
4207
+ copy.selection.clear();
4208
+
39714209 ResetModel();
4210
+ SetupViews();
39724211 objEditor.refreshContents();
39734212 }
39744213
....@@ -4076,7 +4315,7 @@
40764315 {
40774316 //Save(true);
40784317 Replace();
4079
- SetUndoStates();
4318
+ SetVersionStates();
40804319 }
40814320
40824321 private boolean Equal(byte[] compress, byte[] name)
....@@ -4095,8 +4334,6 @@
40954334 return true;
40964335 }
40974336
4098
- java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4099
-
41004337 void DeleteVersion()
41014338 {
41024339 for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
....@@ -4104,19 +4341,23 @@
41044341 copy.versionlist[i] = copy.versionlist[i+1];
41054342 }
41064343
4107
- CopyChanged();
4344
+ if (copy.versionlist[copy.versionindex] == null)
4345
+ copy.versionindex -= 1;
41084346
4109
- SetUndoStates();
4347
+ if (copy.versionindex != -1)
4348
+ CopyChanged();
4349
+
4350
+ SetVersionStates();
41104351 }
41114352
41124353 public boolean Save(boolean user)
41134354 {
41144355 System.err.println("Save");
4115
- //Replace();
4356
+ Replace();
41164357
4117
- cRadio tab = GetCurrentTab();
4358
+ //cRadio tab = GetCurrentTab();
41184359
4119
- Object3D compress = CompressCopy(); // Saved version. No need for "Replace"?
4360
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
41204361
41214362 boolean thesame = false;
41224363
....@@ -4152,7 +4393,7 @@
41524393 // copy.versionlist[i] = null;
41534394 // }
41544395
4155
- SetUndoStates();
4396
+ SetVersionStates();
41564397
41574398 // test save
41584399 if (false)
....@@ -4210,14 +4451,14 @@
42104451
42114452 void CopyChanged()
42124453 {
4213
- Object3D obj = copy.versionlist[copy.versionindex];
4454
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
42144455
4215
- SetUndoStates();
4456
+ SetVersionStates();
42164457
42174458 boolean temp = CameraPane.SWITCH;
42184459 CameraPane.SWITCH = false;
42194460
4220
- copy.ExtractBigData(versiontable);
4461
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
42214462
42224463 copy.clear();
42234464
....@@ -4229,7 +4470,7 @@
42294470 copy.add(obj.get(i));
42304471 }
42314472
4232
- copy.RestoreBigData(versiontable);
4473
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
42334474
42344475 CameraPane.SWITCH = temp;
42354476
....@@ -4279,23 +4520,45 @@
42794520 return count;
42804521 }
42814522
4282
- void SetUndoStates()
4523
+ public cGridBag versionSliderPane;
4524
+
4525
+ void SetVersionStates()
42834526 {
4284
- cRadio tab = GetCurrentTab();
4527
+ //if (true)
4528
+ // return;
4529
+
4530
+ //cRadio tab = GetCurrentTab();
42854531
4286
- restoreButton.setEnabled(true); // copy.versionindex != -1);
4287
- replaceButton.setEnabled(true); // copy.versionindex != -1);
4288
-
4289
- previousVersionButton.setEnabled(copy.versionindex > 0);
4290
- nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4291
-
4292
- deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4293
- copy.versionlist[copy.versionindex + 1] != null);
4294
-
4295
- muteSlider = true;
4296
- versionSlider.setMaximum(VersionCount() - 1);
4297
- versionSlider.setInteger(copy.versionindex);
4298
- muteSlider = false;
4532
+ if (copy.versionlist == null)
4533
+ {
4534
+ saveVersionButton.setEnabled(false);
4535
+ restoreButton.setEnabled(false);
4536
+ replaceButton.setEnabled(false);
4537
+ previousVersionButton.setEnabled(false);
4538
+ nextVersionButton.setEnabled(false);
4539
+ deleteVersionButton.setEnabled(false);
4540
+ versionSliderPane.setVisible(false);
4541
+ }
4542
+ else
4543
+ {
4544
+ restoreButton.setEnabled(copy.versionindex != -1);
4545
+ replaceButton.setEnabled(copy.versionindex != -1);
4546
+
4547
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4548
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4549
+
4550
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4551
+ //copy.versionlist[copy.versionindex + 1] != null);
4552
+
4553
+ muteSlider = true;
4554
+ versionSlider.setMinimum(0);
4555
+ versionSlider.setMaximum(VersionCount() - 1);
4556
+ versionSlider.setInteger(copy.versionindex);
4557
+ versionSlider.setEnabled(copy.versionindex != -1);
4558
+ muteSlider = false;
4559
+
4560
+ versionSliderPane.setVisible(true);
4561
+ }
42994562 }
43004563
43014564 public boolean PreviousVersion()
....@@ -4305,7 +4568,7 @@
43054568
43064569 System.err.println("Undo");
43074570
4308
- cRadio tab = GetCurrentTab();
4571
+ //cRadio tab = GetCurrentTab();
43094572
43104573 if (copy.versionindex == 0)
43114574 {
....@@ -4337,7 +4600,7 @@
43374600 {
43384601 System.err.println("Restore");
43394602
4340
- cRadio tab = GetCurrentTab();
4603
+ //cRadio tab = GetCurrentTab();
43414604
43424605 if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
43434606 {
....@@ -4353,9 +4616,9 @@
43534616
43544617 public boolean Replace()
43554618 {
4356
- System.err.println("Replace");
4619
+ //System.err.println("Replace");
43574620
4358
- cRadio tab = GetCurrentTab();
4621
+ //cRadio tab = GetCurrentTab();
43594622
43604623 if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
43614624 {
....@@ -4363,7 +4626,7 @@
43634626 return false;
43644627 }
43654628
4366
- copy.versionlist[copy.versionindex] = CompressCopy();
4629
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
43674630
43684631 return true;
43694632 }
....@@ -4373,7 +4636,7 @@
43734636 // Option?
43744637 Replace();
43754638
4376
- cRadio tab = GetCurrentTab();
4639
+ //cRadio tab = GetCurrentTab();
43774640
43784641 if (copy.versionlist[copy.versionindex + 1] == null)
43794642 {
....@@ -4580,6 +4843,12 @@
45804843 // else
45814844 // applySelf(true);
45824845 // }
4846
+
4847
+ boolean Equal(double a, double b)
4848
+ {
4849
+ return Math.abs(a - b) < 0.001;
4850
+ }
4851
+
45834852 void applySelf0(boolean name)
45844853 {
45854854 if (name)
....@@ -4629,29 +4898,52 @@
46294898 {
46304899 cMaterial mat = copy.material;
46314900
4632
- colorField.SetToolTipValue((mat.color));
4633
- saturationField.SetToolTipValue((mat.modulation));
4634
- metalnessField.SetToolTipValue((mat.metalness));
4635
- diffuseField.SetToolTipValue((mat.diffuse));
4636
- specularField.SetToolTipValue((mat.specular));
4637
- shininessField.SetToolTipValue((mat.shininess));
4638
- shiftField.SetToolTipValue((mat.shift));
4639
- ambientField.SetToolTipValue((mat.ambient));
4640
- lightareaField.SetToolTipValue((mat.lightarea));
4641
- diffusenessField.SetToolTipValue((mat.factor));
4642
- velvetField.SetToolTipValue((mat.velvet));
4643
- sheenField.SetToolTipValue((mat.sheen));
4644
- subsurfaceField.SetToolTipValue((mat.subsurface));
4645
- backlitField.SetToolTipValue((mat.bump));
4646
- anisoField.SetToolTipValue((mat.aniso));
4647
- anisoVField.SetToolTipValue((mat.anisoV));
4648
- cameraField.SetToolTipValue((mat.cameralight));
4649
- selfshadowField.SetToolTipValue((mat.diffuseness));
4650
- shadowField.SetToolTipValue((mat.shadow));
4651
- textureField.SetToolTipValue((mat.texture));
4652
- opacityField.SetToolTipValue((mat.opacity));
4653
- fakedepthField.SetToolTipValue((mat.fakedepth));
4654
- shadowbiasField.SetToolTipValue((mat.shadowbias));
4901
+ if (!Equal(colorField.getFloat(), mat.color))
4902
+ colorField.SetToolTipValue((mat.color));
4903
+ if (!Equal(saturationField.getFloat(), mat.modulation))
4904
+ saturationField.SetToolTipValue((mat.modulation));
4905
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
4906
+ metalnessField.SetToolTipValue((mat.metalness));
4907
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
4908
+ diffuseField.SetToolTipValue((mat.diffuse));
4909
+ if (!Equal(specularField.getFloat(), mat.specular))
4910
+ specularField.SetToolTipValue((mat.specular));
4911
+ if (!Equal(shininessField.getFloat(), mat.shininess))
4912
+ shininessField.SetToolTipValue((mat.shininess));
4913
+ if (!Equal(shiftField.getFloat(), mat.shift))
4914
+ shiftField.SetToolTipValue((mat.shift));
4915
+ if (!Equal(ambientField.getFloat(), mat.ambient))
4916
+ ambientField.SetToolTipValue((mat.ambient));
4917
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
4918
+ lightareaField.SetToolTipValue((mat.lightarea));
4919
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
4920
+ diffusenessField.SetToolTipValue((mat.factor));
4921
+ if (!Equal(velvetField.getFloat(), mat.velvet))
4922
+ velvetField.SetToolTipValue((mat.velvet));
4923
+ if (!Equal(sheenField.getFloat(), mat.sheen))
4924
+ sheenField.SetToolTipValue((mat.sheen));
4925
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
4926
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4927
+ if (!Equal(backlitField.getFloat(), mat.bump))
4928
+ backlitField.SetToolTipValue((mat.bump));
4929
+ if (!Equal(anisoField.getFloat(), mat.aniso))
4930
+ anisoField.SetToolTipValue((mat.aniso));
4931
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
4932
+ anisoVField.SetToolTipValue((mat.anisoV));
4933
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
4934
+ cameraField.SetToolTipValue((mat.cameralight));
4935
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
4936
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4937
+ if (!Equal(shadowField.getFloat(), mat.shadow))
4938
+ shadowField.SetToolTipValue((mat.shadow));
4939
+ if (!Equal(textureField.getFloat(), mat.texture))
4940
+ textureField.SetToolTipValue((mat.texture));
4941
+ if (!Equal(opacityField.getFloat(), mat.opacity))
4942
+ opacityField.SetToolTipValue((mat.opacity));
4943
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
4944
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4945
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
4946
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
46554947 }
46564948
46574949 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -4686,15 +4978,17 @@
46864978
46874979 public void stateChanged(ChangeEvent e)
46884980 {
4689
- // assert(false);
4981
+ // assert(false);
46904982 if (e.getSource() == versionSlider)
46914983 {
46924984 if (muteSlider)
46934985 return;
46944986
4987
+ Replace();
4988
+
46954989 int version = versionSlider.getInteger();
46964990
4697
- if (copy.versionlist[version] != null)
4991
+ if (version != -1 && copy.versionlist[version] != null)
46984992 {
46994993 copy.versionindex = version;
47004994 CopyChanged();
....@@ -4738,7 +5032,7 @@
47385032 //System.out.println("stateChanged = " + this);
47395033 materialtouched = true;
47405034
4741
- if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
5035
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
47425036 {
47435037 saturationField.setFloat(1);
47445038 }
....@@ -5053,7 +5347,9 @@
50535347 }
50545348
50555349 if (previousVersionButton != null && copy.versionlist != null)
5056
- SetUndoStates();
5350
+ SetVersionStates();
5351
+
5352
+ cameraView.requestFocusInWindow();
50575353 }
50585354
50595355 static TweenManager tweenManager = new TweenManager();
....@@ -5085,7 +5381,7 @@
50855381 // group = (Composite) group.get(0);
50865382 // }
50875383
5088
- System.out.println("makeSomething of " + thing);
5384
+ //System.out.println("makeSomething of " + thing);
50895385
50905386 /*
50915387 if (deselect && jList != null)
....@@ -5439,11 +5735,15 @@
54395735
54405736 copy.versionlist = readobj.versionlist;
54415737 copy.versionindex = readobj.versionindex;
5738
+ copy.versiontable = readobj.versiontable;
54425739
54435740 if (copy.versionlist == null)
54445741 {
5742
+ // Backward compatibility
54455743 copy.versionlist = new Object3D[100];
54465744 copy.versionindex = -1;
5745
+
5746
+ //Save(true);
54475747 }
54485748
54495749 //? SetUndoStates();
....@@ -5535,6 +5835,8 @@
55355835
55365836 void save()
55375837 {
5838
+ Replace();
5839
+
55385840 if (lastname == null)
55395841 {
55405842 return;
....@@ -5789,6 +6091,7 @@
57896091 boolean materialFlushed;
57906092 Object3D latestObject;
57916093
6094
+ cGridBag transformPanel;
57926095 cGridBag XYZPanel;
57936096
57946097 JSplitPane gridPanel;
....@@ -5882,6 +6185,7 @@
58826185 cNumberSlider anisoField;
58836186 JLabel anisoVLabel;
58846187 cNumberSlider anisoVField;
6188
+
58856189 JLabel cameraLabel;
58866190 cNumberSlider cameraField;
58876191 JLabel selfshadowLabel;
....@@ -5896,6 +6200,7 @@
58966200 cNumberSlider fakedepthField;
58976201 JLabel shadowbiasLabel;
58986202 cNumberSlider shadowbiasField;
6203
+
58996204 JLabel bumpLabel;
59006205 cNumberSlider bumpField;
59016206 JLabel noiseLabel;