Normand Briere
2019-08-18 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c
ObjEditor.java
....@@ -43,6 +43,50 @@
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
+
75
+ public Composite CreateCameras()
76
+ {
77
+ Composite cams = new cTemplate();
78
+ cams.name = "Cameras";
79
+ copy.insertElementAt(cams, 0);
80
+
81
+ cams.addChild(new Camera());
82
+ cams.addChild(new Camera(1));
83
+ cams.addChild(new Camera(2));
84
+ cams.addChild(new Camera(3));
85
+ cams.addChild(new Camera(4));
86
+
87
+ return cams;
88
+ }
89
+
4690 public cGridBag GetSeparator()
4791 {
4892 cGridBag separator = new cGridBag();
....@@ -54,7 +98,10 @@
5498 cButton GetButton(String name, boolean border)
5599 {
56100 ImageIcon icon = GetIcon(name);
57
- return new cButton(icon, border);
101
+ if (icon != null || name.contains("/"))
102
+ return new cButton(icon, border);
103
+ else
104
+ return new cButton(name, border);
58105 }
59106
60107 cLabel GetLabel(String name, boolean border)
....@@ -75,11 +122,19 @@
75122 return new cCheckBox(icon, border);
76123 }
77124
78
- ImageIcon GetIcon(String name)
125
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
126
+
127
+ static ImageIcon GetIcon(String name)
79128 {
129
+ javax.swing.ImageIcon iconCache = icons.get(name);
130
+ if (iconCache != null)
131
+ {
132
+ return iconCache;
133
+ }
134
+
80135 try
81136 {
82
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
137
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
83138
84139 // if (image.getWidth() > 48 && image.getHeight() > 48)
85140 // {
....@@ -94,10 +149,14 @@
94149 // }
95150
96151 javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
152
+
153
+ icons.put(name, icon);
154
+
97155 return icon;
98156 }
99157 catch (Exception e)
100158 {
159
+ //icons.put(name, null);
101160 return null;
102161 }
103162 }
....@@ -297,11 +356,13 @@
297356 client = inClient;
298357 copy = client;
299358
300
- if (copy.versionlist == null)
301
- {
302
- copy.versionlist = new Object3D[100];
303
- copy.versionindex = -1;
304
- }
359
+// if (copy.versionlist == null)
360
+// {
361
+// copy.versionlist = new Object3D[100];
362
+// copy.versionindex = -1;
363
+//
364
+// callee.Save(true);
365
+// }
305366
306367 // "this" is not called: SetupUI2(objEditor);
307368 }
....@@ -320,6 +381,8 @@
320381 {
321382 copy.versionlist = new Object3D[100];
322383 copy.versionindex = -1;
384
+
385
+// Save(true);
323386 }
324387
325388 SetupUI2(callee.GetEditor());
....@@ -343,7 +406,8 @@
343406 //parent = p;
344407
345408 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
346
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
409
+ if (Globals.DEBUG)
410
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
347411 //gd.setFullScreenWindow(this);
348412 //setResizable(false);
349413 //if (!isDisplayable())
....@@ -354,11 +418,13 @@
354418 copy = localCopy;
355419 copy.editWindow = this;
356420
357
- if (copy.versionlist == null)
358
- {
359
-// copy.versions = new byte[100][];
421
+// if (copy.versionlist == null)
422
+// {
423
+// copy.versionlist = new Object3D[100];
360424 // copy.versionindex = -1;
361
- }
425
+//
426
+// Save(true);
427
+// }
362428
363429 SetupMenu();
364430
....@@ -378,6 +444,9 @@
378444
379445 static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
380446
447
+ // This is to refresh the UI of the material panel.
448
+ boolean patchMaterial;
449
+
381450 void SetupMenu()
382451 {
383452 frame.setMenuBar(menuBar = new MenuBar());
....@@ -427,6 +496,8 @@
427496
428497 ChangeListener changeListener = new ChangeListener()
429498 {
499
+ //String name;
500
+
430501 public void stateChanged(ChangeEvent changeEvent)
431502 {
432503 // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
....@@ -445,7 +516,37 @@
445516 // EditSelection(false);
446517 // }
447518
448
- refreshContents(false); // To refresh Info tab
519
+// if (objectPanel.getSelectedIndex() == 4)
520
+// {
521
+// name = copy.skyboxname;
522
+//
523
+// if (name == null)
524
+// {
525
+// name = "";
526
+// }
527
+//
528
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
529
+// copy.skyboxext = "jpg";
530
+// }
531
+// else
532
+// {
533
+// if (name != null)
534
+// {
535
+// if (name.equals(""))
536
+// {
537
+// copy.skyboxname = null;
538
+// copy.skyboxext = null;
539
+// }
540
+// else
541
+// {
542
+// copy.skyboxname = name;
543
+// }
544
+// }
545
+// }
546
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
547
+
548
+// refreshContents(false); // To refresh Info tab
549
+ cameraView.repaint();
449550 }
450551 };
451552 objectPanel.addChangeListener(changeListener);
....@@ -754,6 +855,7 @@
754855 boolean maximized;
755856
756857 cButton fullscreenLayout;
858
+ cButton expandedLayout;
757859
758860 void Minimize()
759861 {
....@@ -793,10 +895,12 @@
793895 cButton minButton;
794896 cButton maxButton;
795897 cButton fullButton;
898
+ cButton collapseButton;
899
+ cButton maximize3DButton;
796900
797901 void ToggleFullScreen()
798902 {
799
-GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
903
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
800904
801905 cameraView.ToggleFullScreen();
802906
....@@ -817,13 +921,13 @@
817921 // X frame.getContentPane().remove(/*"Center",*/bigThree);
818922 // X framePanel.add(bigThree);
819923 // X frame.getContentPane().add(/*"Center",*/framePanel);
820
- framePanel.setDividerLocation(46);
924
+// framePanel.setDividerLocation(46); // icons are 24x24
821925
822926 //frame.setVisible(true);
823
- radio.layout = keepButton;
927
+// radio.layout = keepButton;
824928 //theFrame = null;
825929 keepButton = null;
826
- radio.layout.doClick();
930
+// radio.layout.doClick();
827931
828932 } else
829933 {
....@@ -844,10 +948,10 @@
844948 // X frame.getContentPane().remove(/*"Center",*/framePanel);
845949 // X framePanel.remove(bigThree);
846950 // X frame.getContentPane().add(/*"Center",*/bigThree);
847
- framePanel.setDividerLocation(0);
951
+// framePanel.setDividerLocation(0);
848952
849
- radio.layout = fullscreenLayout;
850
- radio.layout.doClick();
953
+// radio.layout = fullscreenLayout;
954
+// radio.layout.doClick();
851955 //frame.setVisible(true);
852956 }
853957 frame.validate();
....@@ -855,23 +959,42 @@
855959 cameraView.requestFocusInWindow();
856960 }
857961
858
- private Object3D CompressCopy()
962
+ void CollapseToolbar()
963
+ {
964
+ framePanel.setDividerLocation(0);
965
+ //frame.validate();
966
+
967
+ cameraView.requestFocusInWindow();
968
+ }
969
+
970
+ private Object3D Duplicate(Object3D object)
859971 {
860972 boolean temp = CameraPane.SWITCH;
861973 CameraPane.SWITCH = false;
862974
863
- copy.ExtractBigData(versiontable);
975
+ if (Grafreed.grafreed.universe.versiontable == null)
976
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
977
+
978
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
864979 // if (copy == client)
865980
866
- Object3D versions[] = copy.versionlist;
867
- copy.versionlist = null;
981
+ Object3D versions[] = object.versionlist;
982
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
983
+ object.versionlist = null;
984
+ object.versiontable = null;
985
+
986
+ Object3D parent = object.parent;
987
+ object.parent = null;
868988
869989 //byte[] compress = Compress(copy);
870
- Object3D compress = (Object3D)Grafreed.clone(copy);
990
+ Object3D compress = (Object3D)Grafreed.clone(object);
871991
872
- copy.versionlist = versions;
992
+ object.parent = parent;
873993
874
- copy.RestoreBigData(versiontable);
994
+ object.versionlist = versions;
995
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
996
+
997
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
875998
876999 CameraPane.SWITCH = temp;
8771000
....@@ -1210,7 +1333,7 @@
12101333
12111334 //if (copy.pinned)
12121335 {
1213
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1336
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
12141337 pinButton.setSelected(copy.pinned);
12151338 cGridBag t = new cGridBag();
12161339 t.preferredWidth = 2;
....@@ -1233,14 +1356,14 @@
12331356
12341357 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
12351358 liveCB.setToolTipText("Animate object");
1359
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1360
+ markCB.setToolTipText("Set target transform");
12361361 selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
12371362 selectableCB.setToolTipText("Make object selectable");
12381363 // Return();
12391364
12401365 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
12411366 hideCB.setToolTipText("Hide object");
1242
- markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1243
- markCB.setToolTipText("As animation target transform");
12441367
12451368 ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
12461369
....@@ -1442,22 +1565,9 @@
14421565
14431566 if (cam == null || !(copy.get(0) instanceof cGroup))
14441567 {
1445
- System.out.println("CREATE CAMERAS");
1446
- cams = new cTemplate();
1447
- cams.name = "Cameras";
1448
- copy.insertElementAt(cams, 0);
1449
- //cams.parent = copy;
1450
-
1451
- cam = new Camera(); // LA.newVector(3, 2, 1));
1452
- cams.addChild(cam);
1453
- cam = new Camera(1);
1454
- cams.addChild(cam);
1455
- cam = new Camera(2);
1456
- cams.addChild(cam);
1457
- cam = new Camera(3);
1458
- cams.addChild(cam);
1459
- cam = new Camera(4); // Light
1460
- cams.addChild(cam);
1568
+ if (Globals.DEBUG)
1569
+ System.out.println("CREATE CAMERAS");
1570
+ cams = CreateCameras();
14611571 } else
14621572 {
14631573 cams = (cGroup) copy.get(0);
....@@ -1523,6 +1633,45 @@
15231633 //frontView.object = copy;
15241634 //sideView.object = copy;
15251635
1636
+ transformPanel = new cGridBag().setVertical(true);
1637
+
1638
+ cGridBag resetTransformPanel = new cGridBag();
1639
+
1640
+ resetTransformPanel.preferredHeight = 2;
1641
+
1642
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1643
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
1644
+ resetTransform.addMouseListener(new MouseAdapter()
1645
+ {
1646
+ public void mouseClicked(MouseEvent e)
1647
+ {
1648
+ ResetTransform();
1649
+ }
1650
+ });
1651
+ resetTransformPanel.add(resetTransform);
1652
+
1653
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1654
+ resetTransform.setToolTipText("Reset Translation only");
1655
+ resetTransform.addMouseListener(new MouseAdapter()
1656
+ {
1657
+ public void mouseClicked(MouseEvent e)
1658
+ {
1659
+ ResetTransform(1);
1660
+ }
1661
+ });
1662
+ resetTransformPanel.add(resetTransform);
1663
+
1664
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1665
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
1666
+ resetTransform.addMouseListener(new MouseAdapter()
1667
+ {
1668
+ public void mouseClicked(MouseEvent e)
1669
+ {
1670
+ ResetTransform(2);
1671
+ }
1672
+ });
1673
+ resetTransformPanel.add(resetTransform);
1674
+
15261675 XYZPanel = new cGridBag().setVertical(true);
15271676 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
15281677
....@@ -1532,6 +1681,9 @@
15321681 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
15331682 //XYZPanel.setName("XYZ");
15341683
1684
+ transformPanel.add(resetTransformPanel);
1685
+ transformPanel.add(XYZPanel);
1686
+
15351687 /*
15361688 gridPanel = new JPanel(); //new BorderLayout());
15371689 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1539,12 +1691,12 @@
15391691 gridPanel.add(cameraView);
15401692 gridPanel.add(XYZPanel);
15411693 */
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);
1694
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1695
+// gridPanel.setContinuousLayout(true);
1696
+// gridPanel.setOneTouchExpandable(true);
1697
+// gridPanel.setDividerLocation(1.0);
1698
+// gridPanel.setDividerSize(9);
1699
+// gridPanel.setResizeWeight(0.85);
15481700
15491701 // aConstraints.weighty = 0;
15501702 //System.out.println("THIS = " + this);
....@@ -1567,30 +1719,34 @@
15671719
15681720 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
15691721 //tmp.setName("Edit");
1570
- objectPanel.add(materialPanel);
1571
- objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1572
- objectPanel.setToolTipTextAt(0, "Material");
1573
-
1722
+ objectPanel.add(skyboxPanel);
1723
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1724
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1725
+
15741726 objectPanel.add(toolboxPanel);
15751727 objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
15761728 objectPanel.setToolTipTextAt(1, "Objects & textures");
15771729
1578
- objectPanel.add(skyboxPanel);
1579
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1580
- objectPanel.setToolTipTextAt(2, "Backgrounds");
1581
-
1730
+ objectPanel.add(materialPanel);
1731
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1732
+ objectPanel.setToolTipTextAt(2, "Material");
1733
+
15821734 // JPanel north = new JPanel(new BorderLayout());
15831735 // north.setName("Edit");
15841736 // north.add(ctrlPanel, BorderLayout.NORTH);
15851737 // objectPanel.add(north);
15861738 objectPanel.add(editPanel);
1587
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1739
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
15881740 objectPanel.setToolTipTextAt(3, "Edit controls");
15891741
1590
- objectPanel.add(XYZPanel);
1742
+ objectPanel.add(transformPanel);
15911743 objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1592
- objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1744
+ objectPanel.setToolTipTextAt(4, "TRS transform");
15931745
1746
+ patchMaterial = true;
1747
+ cameraView.patchMaterial = this;
1748
+ objectPanel.setSelectedIndex(2);
1749
+
15941750 /*
15951751 aConstraints.gridx = 0;
15961752 aConstraints.gridwidth = 1;
....@@ -1610,7 +1766,7 @@
16101766 scrollpane.addMouseWheelListener(this); // Default not fast enough
16111767
16121768 /*JTabbedPane*/ scenePanel = new cGridBag();
1613
- scenePanel.preferredWidth = 5;
1769
+ scenePanel.preferredWidth = 6;
16141770
16151771 JTabbedPane tabbedPane = new JTabbedPane();
16161772 tabbedPane.add(scrollpane);
....@@ -1621,17 +1777,52 @@
16211777
16221778 AddOptions(optionsPanel); //, aConstraints);
16231779
1624
- tabbedPane.add(optionsPanel);
1625
-
16261780 tabbedPane.add(FSPane = new cFileSystemPane(this));
16271781
1782
+ tabbedPane.add(optionsPanel);
1783
+
16281784 scenePanel.add(tabbedPane);
16291785
1630
- //if (Globals.ADVANCED)
1631
- tabbedPane.add(infoPanel);
1632
- tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1633
- tabbedPane.setToolTipTextAt(3, "Information");
1786
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1787
+ creditsPanel.setName("Credits");
16341788
1789
+ cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1790
+ creditsPanel.add(ogaLabel);
1791
+
1792
+ cButton opengameartButton;
1793
+ creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1794
+ opengameartButton.setToolTipText("https://opengameart.org");
1795
+
1796
+ opengameartButton.addMouseListener(new MouseAdapter()
1797
+ {
1798
+ public void mouseClicked(MouseEvent e)
1799
+ {
1800
+ try
1801
+ {
1802
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1803
+ } catch (Exception e1)
1804
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1805
+ {
1806
+ e1.printStackTrace();
1807
+ }
1808
+ }
1809
+ });
1810
+
1811
+ for (int i=10; --i>=0;)
1812
+ {
1813
+ creditsPanel.add(new cGridBag());
1814
+ }
1815
+
1816
+ tabbedPane.add(creditsPanel);
1817
+ tabbedPane.setToolTipTextAt(3, "Credits");
1818
+
1819
+ if (Globals.ADVANCED)
1820
+ {
1821
+ tabbedPane.add(infoPanel);
1822
+ tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1823
+ tabbedPane.setToolTipTextAt(4, "Information");
1824
+ }
1825
+
16351826 /*
16361827 cTree jTree = new cTree(null);
16371828 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1652,13 +1843,13 @@
16521843 jtp.add(tree);
16531844 */
16541845
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");
1846
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1847
+// bigPanel.setContinuousLayout(true);
1848
+// bigPanel.setOneTouchExpandable(true);
1849
+// bigPanel.setDividerLocation(0.8);
1850
+// bigPanel.setDividerSize(15);
1851
+// bigPanel.setResizeWeight(0.15);
1852
+// bigPanel.setName("Scene");
16621853
16631854 //bigPanel.setLayout(new BorderLayout());
16641855 //bigPanel.setSize(new Dimension(10,10));
....@@ -1702,6 +1893,23 @@
17021893 // aConstraints.gridheight = 1;
17031894
17041895 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1896
+
1897
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1898
+ new java.beans.PropertyChangeListener()
1899
+ {
1900
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1901
+ {
1902
+ if ((Integer)pce.getOldValue() == 1)
1903
+ {
1904
+ if (radio.layout != expandedLayout)
1905
+ {
1906
+ radio.layout = expandedLayout;
1907
+ radio.layout.doClick();
1908
+ }
1909
+ }
1910
+ }
1911
+ });
1912
+
17051913 framePanel.setContinuousLayout(false);
17061914 framePanel.setOneTouchExpandable(false);
17071915 //.setDividerLocation(0.8);
....@@ -1711,7 +1919,7 @@
17111919
17121920 frame.getContentPane().setLayout(new BorderLayout());
17131921 /**/
1714
- JTabbedPane worldPane = new JTabbedPane();
1922
+ //JTabbedPane worldPane = new JTabbedPane();
17151923 //worldPane.add(bigPanel);
17161924 //worldPane.add(worldPanel);
17171925 /**/
....@@ -1725,7 +1933,7 @@
17251933
17261934 cameraView.requestFocusInWindow();
17271935
1728
- gridPanel.setDividerLocation(1.0);
1936
+// gridPanel.setDividerLocation(1.0);
17291937
17301938 frame.validate();
17311939
....@@ -1760,7 +1968,7 @@
17601968 {
17611969 cGridBag presetpanel = new cGridBag().setVertical(true);
17621970
1763
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1971
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
17641972 skin.setToolTipText("Skin");
17651973 skin.addMouseListener(new MouseAdapter()
17661974 {
....@@ -1771,7 +1979,15 @@
17711979
17721980 // Skin
17731981 colorField.setFloat(material.color);
1774
- saturationField.setFloat(material.modulation);
1982
+ float saturation = material.modulation;
1983
+
1984
+ if (!cameraView.Skinshader)
1985
+ {
1986
+ saturation /= 1.5;
1987
+ }
1988
+
1989
+ saturationField.setFloat(saturation);
1990
+
17751991 subsurfaceField.setFloat(material.subsurface);
17761992 selfshadowField.setFloat(material.diffuseness);
17771993 diffusenessField.setFloat(material.factor);
....@@ -1790,7 +2006,7 @@
17902006 });
17912007 presetpanel.add(skin);
17922008
1793
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2009
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
17942010 lambert.setToolTipText("Diffuse");
17952011 lambert.addMouseListener(new MouseAdapter()
17962012 {
....@@ -1808,7 +2024,7 @@
18082024 });
18092025 presetpanel.add(lambert);
18102026
1811
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2027
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
18122028 diffuse2.setToolTipText("Diffuse2");
18132029 diffuse2.addMouseListener(new MouseAdapter()
18142030 {
....@@ -1826,7 +2042,7 @@
18262042 });
18272043 presetpanel.add(diffuse2);
18282044
1829
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2045
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
18302046 diffusemoon.setToolTipText("Moon");
18312047 diffusemoon.addMouseListener(new MouseAdapter()
18322048 {
....@@ -1844,7 +2060,7 @@
18442060 });
18452061 presetpanel.add(diffusemoon);
18462062
1847
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2063
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
18482064 diffusemoon2.setToolTipText("Moon2");
18492065 diffusemoon2.addMouseListener(new MouseAdapter()
18502066 {
....@@ -1862,7 +2078,7 @@
18622078 });
18632079 presetpanel.add(diffusemoon2);
18642080
1865
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2081
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
18662082 diffusemoon3.setToolTipText("Moon3");
18672083 diffusemoon3.addMouseListener(new MouseAdapter()
18682084 {
....@@ -1880,7 +2096,7 @@
18802096 });
18812097 presetpanel.add(diffusemoon3);
18822098
1883
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2099
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
18842100 diffusesheen.setToolTipText("Sheen");
18852101 diffusesheen.addMouseListener(new MouseAdapter()
18862102 {
....@@ -1897,7 +2113,7 @@
18972113 });
18982114 presetpanel.add(diffusesheen);
18992115
1900
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2116
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
19012117 rough.setToolTipText("Rough metal");
19022118 rough.addMouseListener(new MouseAdapter()
19032119 {
....@@ -1915,7 +2131,7 @@
19152131 });
19162132 presetpanel.add(rough);
19172133
1918
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2134
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
19192135 rough2.setToolTipText("Medium metal");
19202136 rough2.addMouseListener(new MouseAdapter()
19212137 {
....@@ -1933,7 +2149,7 @@
19332149 });
19342150 presetpanel.add(rough2);
19352151
1936
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2152
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
19372153 shini0.setToolTipText("Shiny");
19382154 shini0.addMouseListener(new MouseAdapter()
19392155 {
....@@ -1951,7 +2167,7 @@
19512167 });
19522168 presetpanel.add(shini0);
19532169
1954
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2170
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
19552171 shini1.setToolTipText("Shiny2");
19562172 shini1.addMouseListener(new MouseAdapter()
19572173 {
....@@ -1969,7 +2185,7 @@
19692185 });
19702186 presetpanel.add(shini1);
19712187
1972
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2188
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
19732189 shini2.setToolTipText("Shiny3");
19742190 shini2.addMouseListener(new MouseAdapter()
19752191 {
....@@ -1987,7 +2203,7 @@
19872203 });
19882204 presetpanel.add(shini2);
19892205
1990
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2206
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
19912207 aniso.setToolTipText("AnisoU");
19922208 aniso.addMouseListener(new MouseAdapter()
19932209 {
....@@ -2005,7 +2221,7 @@
20052221 });
20062222 presetpanel.add(aniso);
20072223
2008
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2224
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
20092225 aniso2.setToolTipText("AnisoV");
20102226 aniso2.addMouseListener(new MouseAdapter()
20112227 {
....@@ -2023,7 +2239,7 @@
20232239 });
20242240 presetpanel.add(aniso2);
20252241
2026
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2242
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
20272243 aniso3.setToolTipText("AnisoUV");
20282244 aniso3.addMouseListener(new MouseAdapter()
20292245 {
....@@ -2041,7 +2257,7 @@
20412257 });
20422258 presetpanel.add(aniso3);
20432259
2044
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2260
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
20452261 velvet0.setToolTipText("Velvet");
20462262 velvet0.addMouseListener(new MouseAdapter()
20472263 {
....@@ -2063,7 +2279,7 @@
20632279 });
20642280 presetpanel.add(velvet0);
20652281
2066
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2282
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
20672283 bump0.setToolTipText("Bump texture");
20682284 bump0.addMouseListener(new MouseAdapter()
20692285 {
....@@ -2082,7 +2298,22 @@
20822298 });
20832299 presetpanel.add(bump0);
20842300
2085
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2301
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
2302
+ borderShader.setToolTipText("Border fade");
2303
+ borderShader.addMouseListener(new MouseAdapter()
2304
+ {
2305
+ public void mouseClicked(MouseEvent e)
2306
+ {
2307
+ borderfadeField.setFloat(0.5);
2308
+ opacityField.setFloat(0.75);
2309
+
2310
+ materialtouched = true;
2311
+ applySelf();
2312
+ }
2313
+ });
2314
+ presetpanel.add(borderShader);
2315
+
2316
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
20862317 halo.setToolTipText("Halo");
20872318 halo.addMouseListener(new MouseAdapter()
20882319 {
....@@ -2099,7 +2330,7 @@
20992330 });
21002331 presetpanel.add(halo);
21012332
2102
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2333
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
21032334 candle.setToolTipText("Candle");
21042335 candle.addMouseListener(new MouseAdapter()
21052336 {
....@@ -2121,6 +2352,25 @@
21212352 });
21222353 presetpanel.add(candle);
21232354
2355
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
2356
+ shadowShader.setToolTipText("Shadow");
2357
+ shadowShader.addMouseListener(new MouseAdapter()
2358
+ {
2359
+ public void mouseClicked(MouseEvent e)
2360
+ {
2361
+ diffuseField.setFloat(0.001);
2362
+ ambientField.setFloat(0.001);
2363
+ cameraField.setFloat(0.001);
2364
+ specularField.setFloat(0.001);
2365
+ fakedepthField.setFloat(0.001);
2366
+ opacityField.setFloat(0.6);
2367
+
2368
+ materialtouched = true;
2369
+ applySelf();
2370
+ }
2371
+ });
2372
+ presetpanel.add(shadowShader);
2373
+
21242374 cGridBag panel = new cGridBag().setVertical(true);
21252375
21262376 presetpanel.preferredWidth = 1;
....@@ -2137,19 +2387,19 @@
21372387
21382388 cGridBag editBar = new cGridBag().setVertical(false);
21392389
2140
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2390
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
21412391 createMaterialButton.setToolTipText("Create material");
21422392
21432393 /*
21442394 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
21452395 */
21462396
2147
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2397
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
21482398 clearMaterialButton.setToolTipText("Clear material");
21492399
21502400 if (Globals.ADVANCED)
21512401 {
2152
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2402
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
21532403 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
21542404 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
21552405 }
....@@ -2170,9 +2420,20 @@
21702420
21712421 cGridBag huepanel = new cGridBag();
21722422 cGridBag huelabel = new cGridBag();
2173
- skin = GetLabel("icons/hue.png", false);
2174
- skin.fit = true;
2175
- huelabel.add(skin);
2423
+ cLabel hue = GetLabel("icons/hue.png", false);
2424
+ hue.fit = true;
2425
+
2426
+ hue.addMouseListener(new MouseAdapter()
2427
+ {
2428
+ public void mousePressed(MouseEvent e)
2429
+ {
2430
+ int x = e.getX();
2431
+
2432
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2433
+ }
2434
+ });
2435
+
2436
+ huelabel.add(hue);
21762437 huelabel.preferredWidth = 20;
21772438 huepanel.add(new cGridBag()); // Label
21782439 huepanel.add(huelabel); // Field/slider
....@@ -3448,32 +3709,8 @@
34483709
34493710 if (multiplyToggle != null)
34503711 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
- }
3712
+
3713
+ AllocProjectedVertices(object);
34773714
34783715 SetMaterial(mat, object.projectedVertices);
34793716 }
....@@ -3783,7 +4020,7 @@
37834020 //System.out.println("ObjEditor " + event);
37844021 applySelf0(true);
37854022 //parent.applySelf();
3786
- objEditor.refreshContents();
4023
+ // conflicts with requestFocus objEditor.refreshContents();
37874024 } else if (source == resetButton)
37884025 {
37894026 CameraPane.fullreset = true;
....@@ -3963,11 +4200,18 @@
39634200
39644201 void New()
39654202 {
3966
- while (copy.Size() > 1)
4203
+ while (copy.Size() > 0)
39674204 {
3968
- copy.remove(1);
4205
+ copy.remove(0);
39694206 }
39704207
4208
+ copy.selection.clear();
4209
+
4210
+ if (copy == Grafreed.grafreed.universe)
4211
+ {
4212
+ CreateCameras();
4213
+ cameraView.SetCamera(GetCamera(copy, 0));
4214
+ }
39714215 ResetModel();
39724216 objEditor.refreshContents();
39734217 }
....@@ -4076,7 +4320,7 @@
40764320 {
40774321 //Save(true);
40784322 Replace();
4079
- SetUndoStates();
4323
+ SetVersionStates();
40804324 }
40814325
40824326 private boolean Equal(byte[] compress, byte[] name)
....@@ -4095,8 +4339,6 @@
40954339 return true;
40964340 }
40974341
4098
- java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4099
-
41004342 void DeleteVersion()
41014343 {
41024344 for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
....@@ -4104,19 +4346,23 @@
41044346 copy.versionlist[i] = copy.versionlist[i+1];
41054347 }
41064348
4107
- CopyChanged();
4349
+ if (copy.versionlist[copy.versionindex] == null)
4350
+ copy.versionindex -= 1;
41084351
4109
- SetUndoStates();
4352
+ if (copy.versionindex != -1)
4353
+ CopyChanged();
4354
+
4355
+ SetVersionStates();
41104356 }
41114357
41124358 public boolean Save(boolean user)
41134359 {
41144360 System.err.println("Save");
4115
- //Replace();
4361
+ Replace();
41164362
4117
- cRadio tab = GetCurrentTab();
4363
+ //cRadio tab = GetCurrentTab();
41184364
4119
- Object3D compress = CompressCopy(); // Saved version. No need for "Replace"?
4365
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
41204366
41214367 boolean thesame = false;
41224368
....@@ -4152,7 +4398,7 @@
41524398 // copy.versionlist[i] = null;
41534399 // }
41544400
4155
- SetUndoStates();
4401
+ SetVersionStates();
41564402
41574403 // test save
41584404 if (false)
....@@ -4210,14 +4456,14 @@
42104456
42114457 void CopyChanged()
42124458 {
4213
- Object3D obj = copy.versionlist[copy.versionindex];
4459
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
42144460
4215
- SetUndoStates();
4461
+ SetVersionStates();
42164462
42174463 boolean temp = CameraPane.SWITCH;
42184464 CameraPane.SWITCH = false;
42194465
4220
- copy.ExtractBigData(versiontable);
4466
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
42214467
42224468 copy.clear();
42234469
....@@ -4229,7 +4475,7 @@
42294475 copy.add(obj.get(i));
42304476 }
42314477
4232
- copy.RestoreBigData(versiontable);
4478
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
42334479
42344480 CameraPane.SWITCH = temp;
42354481
....@@ -4279,23 +4525,45 @@
42794525 return count;
42804526 }
42814527
4282
- void SetUndoStates()
4528
+ public cGridBag versionSliderPane;
4529
+
4530
+ void SetVersionStates()
42834531 {
4284
- cRadio tab = GetCurrentTab();
4532
+ //if (true)
4533
+ // return;
4534
+
4535
+ //cRadio tab = GetCurrentTab();
42854536
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;
4537
+ if (copy.versionlist == null)
4538
+ {
4539
+ saveVersionButton.setEnabled(false);
4540
+ restoreButton.setEnabled(false);
4541
+ replaceButton.setEnabled(false);
4542
+ previousVersionButton.setEnabled(false);
4543
+ nextVersionButton.setEnabled(false);
4544
+ deleteVersionButton.setEnabled(false);
4545
+ versionSliderPane.setVisible(false);
4546
+ }
4547
+ else
4548
+ {
4549
+ restoreButton.setEnabled(copy.versionindex != -1);
4550
+ replaceButton.setEnabled(copy.versionindex != -1);
4551
+
4552
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4553
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4554
+
4555
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4556
+ //copy.versionlist[copy.versionindex + 1] != null);
4557
+
4558
+ muteSlider = true;
4559
+ versionSlider.setMinimum(0);
4560
+ versionSlider.setMaximum(VersionCount() - 1);
4561
+ versionSlider.setInteger(copy.versionindex);
4562
+ versionSlider.setEnabled(copy.versionindex != -1);
4563
+ muteSlider = false;
4564
+
4565
+ versionSliderPane.setVisible(true);
4566
+ }
42994567 }
43004568
43014569 public boolean PreviousVersion()
....@@ -4305,7 +4573,7 @@
43054573
43064574 System.err.println("Undo");
43074575
4308
- cRadio tab = GetCurrentTab();
4576
+ //cRadio tab = GetCurrentTab();
43094577
43104578 if (copy.versionindex == 0)
43114579 {
....@@ -4337,7 +4605,7 @@
43374605 {
43384606 System.err.println("Restore");
43394607
4340
- cRadio tab = GetCurrentTab();
4608
+ //cRadio tab = GetCurrentTab();
43414609
43424610 if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
43434611 {
....@@ -4353,9 +4621,9 @@
43534621
43544622 public boolean Replace()
43554623 {
4356
- System.err.println("Replace");
4624
+ //System.err.println("Replace");
43574625
4358
- cRadio tab = GetCurrentTab();
4626
+ //cRadio tab = GetCurrentTab();
43594627
43604628 if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
43614629 {
....@@ -4363,7 +4631,7 @@
43634631 return false;
43644632 }
43654633
4366
- copy.versionlist[copy.versionindex] = CompressCopy();
4634
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
43674635
43684636 return true;
43694637 }
....@@ -4373,7 +4641,7 @@
43734641 // Option?
43744642 Replace();
43754643
4376
- cRadio tab = GetCurrentTab();
4644
+ //cRadio tab = GetCurrentTab();
43774645
43784646 if (copy.versionlist[copy.versionindex + 1] == null)
43794647 {
....@@ -4580,6 +4848,12 @@
45804848 // else
45814849 // applySelf(true);
45824850 // }
4851
+
4852
+ boolean Equal(double a, double b)
4853
+ {
4854
+ return Math.abs(a - b) < 0.001;
4855
+ }
4856
+
45834857 void applySelf0(boolean name)
45844858 {
45854859 if (name)
....@@ -4629,29 +4903,52 @@
46294903 {
46304904 cMaterial mat = copy.material;
46314905
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));
4906
+ if (!Equal(colorField.getFloat(), mat.color))
4907
+ colorField.SetToolTipValue((mat.color));
4908
+ if (!Equal(saturationField.getFloat(), mat.modulation))
4909
+ saturationField.SetToolTipValue((mat.modulation));
4910
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
4911
+ metalnessField.SetToolTipValue((mat.metalness));
4912
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
4913
+ diffuseField.SetToolTipValue((mat.diffuse));
4914
+ if (!Equal(specularField.getFloat(), mat.specular))
4915
+ specularField.SetToolTipValue((mat.specular));
4916
+ if (!Equal(shininessField.getFloat(), mat.shininess))
4917
+ shininessField.SetToolTipValue((mat.shininess));
4918
+ if (!Equal(shiftField.getFloat(), mat.shift))
4919
+ shiftField.SetToolTipValue((mat.shift));
4920
+ if (!Equal(ambientField.getFloat(), mat.ambient))
4921
+ ambientField.SetToolTipValue((mat.ambient));
4922
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
4923
+ lightareaField.SetToolTipValue((mat.lightarea));
4924
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
4925
+ diffusenessField.SetToolTipValue((mat.factor));
4926
+ if (!Equal(velvetField.getFloat(), mat.velvet))
4927
+ velvetField.SetToolTipValue((mat.velvet));
4928
+ if (!Equal(sheenField.getFloat(), mat.sheen))
4929
+ sheenField.SetToolTipValue((mat.sheen));
4930
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
4931
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4932
+ if (!Equal(backlitField.getFloat(), mat.bump))
4933
+ backlitField.SetToolTipValue((mat.bump));
4934
+ if (!Equal(anisoField.getFloat(), mat.aniso))
4935
+ anisoField.SetToolTipValue((mat.aniso));
4936
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
4937
+ anisoVField.SetToolTipValue((mat.anisoV));
4938
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
4939
+ cameraField.SetToolTipValue((mat.cameralight));
4940
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
4941
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4942
+ if (!Equal(shadowField.getFloat(), mat.shadow))
4943
+ shadowField.SetToolTipValue((mat.shadow));
4944
+ if (!Equal(textureField.getFloat(), mat.texture))
4945
+ textureField.SetToolTipValue((mat.texture));
4946
+ if (!Equal(opacityField.getFloat(), mat.opacity))
4947
+ opacityField.SetToolTipValue((mat.opacity));
4948
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
4949
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4950
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
4951
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
46554952 }
46564953
46574954 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -4686,15 +4983,17 @@
46864983
46874984 public void stateChanged(ChangeEvent e)
46884985 {
4689
- // assert(false);
4986
+ // assert(false);
46904987 if (e.getSource() == versionSlider)
46914988 {
46924989 if (muteSlider)
46934990 return;
46944991
4992
+ Replace();
4993
+
46954994 int version = versionSlider.getInteger();
46964995
4697
- if (copy.versionlist[version] != null)
4996
+ if (version != -1 && copy.versionlist[version] != null)
46984997 {
46994998 copy.versionindex = version;
47004999 CopyChanged();
....@@ -4738,7 +5037,7 @@
47385037 //System.out.println("stateChanged = " + this);
47395038 materialtouched = true;
47405039
4741
- if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
5040
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
47425041 {
47435042 saturationField.setFloat(1);
47445043 }
....@@ -5053,7 +5352,9 @@
50535352 }
50545353
50555354 if (previousVersionButton != null && copy.versionlist != null)
5056
- SetUndoStates();
5355
+ SetVersionStates();
5356
+
5357
+ cameraView.requestFocusInWindow();
50575358 }
50585359
50595360 static TweenManager tweenManager = new TweenManager();
....@@ -5085,7 +5386,7 @@
50855386 // group = (Composite) group.get(0);
50865387 // }
50875388
5088
- System.out.println("makeSomething of " + thing);
5389
+ //System.out.println("makeSomething of " + thing);
50895390
50905391 /*
50915392 if (deselect && jList != null)
....@@ -5439,11 +5740,15 @@
54395740
54405741 copy.versionlist = readobj.versionlist;
54415742 copy.versionindex = readobj.versionindex;
5743
+ copy.versiontable = readobj.versiontable;
54425744
54435745 if (copy.versionlist == null)
54445746 {
5747
+ // Backward compatibility
54455748 copy.versionlist = new Object3D[100];
54465749 copy.versionindex = -1;
5750
+
5751
+ //Save(true);
54475752 }
54485753
54495754 //? SetUndoStates();
....@@ -5535,6 +5840,8 @@
55355840
55365841 void save()
55375842 {
5843
+ Replace();
5844
+
55385845 if (lastname == null)
55395846 {
55405847 return;
....@@ -5789,6 +6096,7 @@
57896096 boolean materialFlushed;
57906097 Object3D latestObject;
57916098
6099
+ cGridBag transformPanel;
57926100 cGridBag XYZPanel;
57936101
57946102 JSplitPane gridPanel;
....@@ -5882,6 +6190,7 @@
58826190 cNumberSlider anisoField;
58836191 JLabel anisoVLabel;
58846192 cNumberSlider anisoVField;
6193
+
58856194 JLabel cameraLabel;
58866195 cNumberSlider cameraField;
58876196 JLabel selfshadowLabel;
....@@ -5896,6 +6205,7 @@
58966205 cNumberSlider fakedepthField;
58976206 JLabel shadowbiasLabel;
58986207 cNumberSlider shadowbiasField;
6208
+
58996209 JLabel bumpLabel;
59006210 cNumberSlider bumpField;
59016211 JLabel noiseLabel;