Normand Briere
2019-08-23 60cec91731a350fe67e9b5ffe7a00d70e9026314
ObjEditor.java
....@@ -34,6 +34,7 @@
3434 iSendInfo
3535 //KeyListener
3636 {
37
+ public cToggleButton pinButton;
3738 boolean timeline;
3839 boolean wasFullScreen;
3940
....@@ -41,6 +42,50 @@
4142 JFrame frame;
4243
4344 static ObjEditor theFrame;
45
+
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
+ }
4489
4590 public cGridBag GetSeparator()
4691 {
....@@ -53,7 +98,10 @@
5398 cButton GetButton(String name, boolean border)
5499 {
55100 ImageIcon icon = GetIcon(name);
56
- 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);
57105 }
58106
59107 cLabel GetLabel(String name, boolean border)
....@@ -74,12 +122,26 @@
74122 return new cCheckBox(icon, border);
75123 }
76124
77
- 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)
78128 {
129
+ javax.swing.ImageIcon iconCache = icons.get(name);
130
+ if (iconCache != null)
131
+ {
132
+ return iconCache;
133
+ }
134
+
79135 try
80136 {
81
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
82
-
137
+ BufferedImage image;
138
+
139
+ if (name.endsWith("jpg"))
140
+ // Much faster!
141
+ image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage();
142
+ else
143
+ image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
144
+
83145 // if (image.getWidth() > 48 && image.getHeight() > 48)
84146 // {
85147 // BufferedImage resized = new BufferedImage(48, 48, image.getType());
....@@ -93,10 +155,14 @@
93155 // }
94156
95157 javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
158
+
159
+ icons.put(name, icon);
160
+
96161 return icon;
97162 }
98163 catch (Exception e)
99164 {
165
+ //icons.put(name, null);
100166 return null;
101167 }
102168 }
....@@ -296,11 +362,13 @@
296362 client = inClient;
297363 copy = client;
298364
299
- if (copy.versions == null)
300
- {
301
- copy.versions = new Object3D[100];
302
- copy.versionindex = -1;
303
- }
365
+// if (copy.versionlist == null)
366
+// {
367
+// copy.versionlist = new Object3D[100];
368
+// copy.versionindex = -1;
369
+//
370
+// callee.Save(true);
371
+// }
304372
305373 // "this" is not called: SetupUI2(objEditor);
306374 }
....@@ -315,12 +383,6 @@
315383 client = inClient;
316384 copy = client;
317385
318
- if (copy.versions == null)
319
- {
320
- copy.versions = new Object3D[100];
321
- copy.versionindex = -1;
322
- }
323
-
324386 SetupUI2(callee.GetEditor());
325387 }
326388
....@@ -342,7 +404,8 @@
342404 //parent = p;
343405
344406 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
345
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
407
+ if (Globals.DEBUG)
408
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
346409 //gd.setFullScreenWindow(this);
347410 //setResizable(false);
348411 //if (!isDisplayable())
....@@ -353,11 +416,13 @@
353416 copy = localCopy;
354417 copy.editWindow = this;
355418
356
- if (copy.versions == null)
357
- {
358
-// copy.versions = new byte[100][];
419
+// if (copy.versionlist == null)
420
+// {
421
+// copy.versionlist = new Object3D[100];
359422 // copy.versionindex = -1;
360
- }
423
+//
424
+// Save(true);
425
+// }
361426
362427 SetupMenu();
363428
....@@ -377,6 +442,9 @@
377442
378443 static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
379444
445
+ // This is to refresh the UI of the material panel.
446
+ boolean patchMaterial;
447
+
380448 void SetupMenu()
381449 {
382450 frame.setMenuBar(menuBar = new MenuBar());
....@@ -390,8 +458,11 @@
390458 importOBJItem.addActionListener(this);
391459 import3DSItem = menu.add(new MenuItem("3DS file..."));
392460 import3DSItem.addActionListener(this);
461
+ if (Globals.ADVANCED)
462
+ {
393463 importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
394464 importVRMLX3DItem.addActionListener(this);
465
+ }
395466 menu.add("-");
396467 importGFDItem = menu.add(new MenuItem("Grafreed file..."));
397468 importGFDItem.addActionListener(this);
....@@ -426,6 +497,8 @@
426497
427498 ChangeListener changeListener = new ChangeListener()
428499 {
500
+ //String name;
501
+
429502 public void stateChanged(ChangeEvent changeEvent)
430503 {
431504 // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
....@@ -444,7 +517,37 @@
444517 // EditSelection(false);
445518 // }
446519
447
- refreshContents(false); // To refresh Info tab
520
+// if (objectPanel.getSelectedIndex() == 4)
521
+// {
522
+// name = copy.skyboxname;
523
+//
524
+// if (name == null)
525
+// {
526
+// name = "";
527
+// }
528
+//
529
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
530
+// copy.skyboxext = "jpg";
531
+// }
532
+// else
533
+// {
534
+// if (name != null)
535
+// {
536
+// if (name.equals(""))
537
+// {
538
+// copy.skyboxname = null;
539
+// copy.skyboxext = null;
540
+// }
541
+// else
542
+// {
543
+// copy.skyboxname = name;
544
+// }
545
+// }
546
+// }
547
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
548
+
549
+// refreshContents(false); // To refresh Info tab
550
+ cameraView.repaint();
448551 }
449552 };
450553 objectPanel.addChangeListener(changeListener);
....@@ -467,7 +570,9 @@
467570 toolboxPanel = new cGridBag().setVertical(true);
468571 //toolboxPanel.setName("Toolbox");
469572
470
- materialPanel = new cGridBag().setVertical(true);
573
+ skyboxPanel = new cGridBag().setVertical(true);
574
+
575
+ materialPanel = new cGridBag().setVertical(false);
471576 //materialPanel.setName("Material");
472577
473578 /*JTextPane*/
....@@ -751,6 +856,7 @@
751856 boolean maximized;
752857
753858 cButton fullscreenLayout;
859
+ cButton expandedLayout;
754860
755861 void Minimize()
756862 {
....@@ -790,10 +896,12 @@
790896 cButton minButton;
791897 cButton maxButton;
792898 cButton fullButton;
899
+ cButton collapseButton;
900
+ cButton maximize3DButton;
793901
794902 void ToggleFullScreen()
795903 {
796
-GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
904
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
797905
798906 cameraView.ToggleFullScreen();
799907
....@@ -814,13 +922,13 @@
814922 // X frame.getContentPane().remove(/*"Center",*/bigThree);
815923 // X framePanel.add(bigThree);
816924 // X frame.getContentPane().add(/*"Center",*/framePanel);
817
- framePanel.setDividerLocation(46);
925
+// framePanel.setDividerLocation(46); // icons are 24x24
818926
819927 //frame.setVisible(true);
820
- radio.layout = keepButton;
928
+// radio.layout = keepButton;
821929 //theFrame = null;
822930 keepButton = null;
823
- radio.layout.doClick();
931
+// radio.layout.doClick();
824932
825933 } else
826934 {
....@@ -841,32 +949,53 @@
841949 // X frame.getContentPane().remove(/*"Center",*/framePanel);
842950 // X framePanel.remove(bigThree);
843951 // X frame.getContentPane().add(/*"Center",*/bigThree);
844
- framePanel.setDividerLocation(0);
952
+// framePanel.setDividerLocation(0);
845953
846
- radio.layout = fullscreenLayout;
847
- radio.layout.doClick();
954
+// radio.layout = fullscreenLayout;
955
+// radio.layout.doClick();
848956 //frame.setVisible(true);
849957 }
850958 frame.validate();
959
+
960
+ cameraView.requestFocusInWindow();
851961 }
852962
853
- private Object3D CompressCopy()
963
+ void CollapseToolbar()
964
+ {
965
+ framePanel.setDividerLocation(0);
966
+ //frame.validate();
967
+
968
+ cameraView.requestFocusInWindow();
969
+ }
970
+
971
+ private Object3D Duplicate(Object3D object)
854972 {
855973 boolean temp = CameraPane.SWITCH;
856974 CameraPane.SWITCH = false;
857975
858
- copy.ExtractBigData(versiontable);
976
+ if (Grafreed.grafreed.universe.versiontable == null)
977
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
978
+
979
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
859980 // if (copy == client)
860981
861
- Object3D versions[] = copy.versions;
862
- copy.versions = null;
982
+ Object3D versions[] = object.versionlist;
983
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
984
+ object.versionlist = null;
985
+ object.versiontable = null;
986
+
987
+ Object3D parent = object.parent;
988
+ object.parent = null;
863989
864990 //byte[] compress = Compress(copy);
865
- Object3D compress = (Object3D)Grafreed.clone(copy);
991
+ Object3D compress = (Object3D)Grafreed.clone(object);
866992
867
- copy.versions = versions;
993
+ object.parent = parent;
868994
869
- copy.RestoreBigData(versiontable);
995
+ object.versionlist = versions;
996
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
997
+
998
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
870999
8711000 CameraPane.SWITCH = temp;
8721001
....@@ -994,6 +1123,7 @@
9941123 {
9951124 SetupMaterial(materialPanel);
9961125 }
1126
+
9971127 //SetupName();
9981128 //SetupViews();
9991129 }
....@@ -1202,6 +1332,18 @@
12021332
12031333 namePanel = new cGridBag();
12041334
1335
+ //if (copy.pinned)
1336
+ {
1337
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
1338
+ pinButton.setSelected(copy.pinned);
1339
+ cGridBag t = new cGridBag();
1340
+ t.preferredWidth = 2;
1341
+ t.add(pinButton);
1342
+ namePanel.add(t);
1343
+
1344
+ pinButton.addItemListener(this);
1345
+ }
1346
+
12051347 nameField = AddText(namePanel, copy.GetName());
12061348 namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
12071349 oe.ctrlPanel.add(namePanel);
....@@ -1215,14 +1357,14 @@
12151357
12161358 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
12171359 liveCB.setToolTipText("Animate object");
1360
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1361
+ markCB.setToolTipText("Set target transform");
12181362 selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
12191363 selectableCB.setToolTipText("Make object selectable");
12201364 // Return();
12211365
12221366 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
12231367 hideCB.setToolTipText("Hide object");
1224
- markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1225
- markCB.setToolTipText("As animation target transform");
12261368
12271369 ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
12281370
....@@ -1424,22 +1566,9 @@
14241566
14251567 if (cam == null || !(copy.get(0) instanceof cGroup))
14261568 {
1427
- System.out.println("CREATE CAMERAS");
1428
- cams = new cTemplate();
1429
- cams.name = "Cameras";
1430
- copy.insertElementAt(cams, 0);
1431
- //cams.parent = copy;
1432
-
1433
- cam = new Camera(); // LA.newVector(3, 2, 1));
1434
- cams.addChild(cam);
1435
- cam = new Camera(1);
1436
- cams.addChild(cam);
1437
- cam = new Camera(2);
1438
- cams.addChild(cam);
1439
- cam = new Camera(3);
1440
- cams.addChild(cam);
1441
- cam = new Camera(4); // Light
1442
- cams.addChild(cam);
1569
+ if (Globals.DEBUG)
1570
+ System.out.println("CREATE CAMERAS");
1571
+ cams = CreateCameras();
14431572 } else
14441573 {
14451574 cams = (cGroup) copy.get(0);
....@@ -1505,6 +1634,45 @@
15051634 //frontView.object = copy;
15061635 //sideView.object = copy;
15071636
1637
+ transformPanel = new cGridBag().setVertical(true);
1638
+
1639
+ cGridBag resetTransformPanel = new cGridBag();
1640
+
1641
+ resetTransformPanel.preferredHeight = 2;
1642
+
1643
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1644
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
1645
+ resetTransform.addMouseListener(new MouseAdapter()
1646
+ {
1647
+ public void mouseClicked(MouseEvent e)
1648
+ {
1649
+ ResetTransform();
1650
+ }
1651
+ });
1652
+ resetTransformPanel.add(resetTransform);
1653
+
1654
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1655
+ resetTransform.setToolTipText("Reset Translation only");
1656
+ resetTransform.addMouseListener(new MouseAdapter()
1657
+ {
1658
+ public void mouseClicked(MouseEvent e)
1659
+ {
1660
+ ResetTransform(1);
1661
+ }
1662
+ });
1663
+ resetTransformPanel.add(resetTransform);
1664
+
1665
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1666
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
1667
+ resetTransform.addMouseListener(new MouseAdapter()
1668
+ {
1669
+ public void mouseClicked(MouseEvent e)
1670
+ {
1671
+ ResetTransform(2);
1672
+ }
1673
+ });
1674
+ resetTransformPanel.add(resetTransform);
1675
+
15081676 XYZPanel = new cGridBag().setVertical(true);
15091677 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
15101678
....@@ -1514,6 +1682,9 @@
15141682 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
15151683 //XYZPanel.setName("XYZ");
15161684
1685
+ transformPanel.add(resetTransformPanel);
1686
+ transformPanel.add(XYZPanel);
1687
+
15171688 /*
15181689 gridPanel = new JPanel(); //new BorderLayout());
15191690 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1521,12 +1692,12 @@
15211692 gridPanel.add(cameraView);
15221693 gridPanel.add(XYZPanel);
15231694 */
1524
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1525
- gridPanel.setContinuousLayout(true);
1526
- gridPanel.setOneTouchExpandable(true);
1527
- gridPanel.setDividerLocation(1.0);
1528
- gridPanel.setDividerSize(9);
1529
- gridPanel.setResizeWeight(0.85);
1695
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1696
+// gridPanel.setContinuousLayout(true);
1697
+// gridPanel.setOneTouchExpandable(true);
1698
+// gridPanel.setDividerLocation(1.0);
1699
+// gridPanel.setDividerSize(9);
1700
+// gridPanel.setResizeWeight(0.85);
15301701
15311702 // aConstraints.weighty = 0;
15321703 //System.out.println("THIS = " + this);
....@@ -1549,31 +1720,34 @@
15491720
15501721 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
15511722 //tmp.setName("Edit");
1723
+ objectPanel.add(skyboxPanel);
1724
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1725
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1726
+
1727
+ objectPanel.add(toolboxPanel);
1728
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1729
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1730
+
15521731 objectPanel.add(materialPanel);
1553
- objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1554
- objectPanel.setToolTipTextAt(0, "Material panel");
1732
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1733
+ objectPanel.setToolTipTextAt(2, "Material");
15551734
15561735 // JPanel north = new JPanel(new BorderLayout());
15571736 // north.setName("Edit");
15581737 // north.add(ctrlPanel, BorderLayout.NORTH);
15591738 // objectPanel.add(north);
15601739 objectPanel.add(editPanel);
1561
- objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1562
- objectPanel.setToolTipTextAt(1, "Edit panel");
1740
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
1741
+ objectPanel.setToolTipTextAt(3, "Edit controls");
15631742
1564
- //if (Globals.ADVANCED)
1565
- objectPanel.add(infoPanel);
1566
- objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1567
- objectPanel.setToolTipTextAt(2, "Info panel");
1743
+ objectPanel.add(transformPanel);
1744
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1745
+ objectPanel.setToolTipTextAt(4, "TRS transform");
15681746
1569
- objectPanel.add(XYZPanel);
1570
- objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1571
- objectPanel.setToolTipTextAt(3, "XYZ/RGB panel");
1572
-
1573
- objectPanel.add(toolboxPanel);
1574
- objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1575
- objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel");
1576
-
1747
+ patchMaterial = true;
1748
+ cameraView.patchMaterial = this;
1749
+ objectPanel.setSelectedIndex(2);
1750
+
15771751 /*
15781752 aConstraints.gridx = 0;
15791753 aConstraints.gridwidth = 1;
....@@ -1604,11 +1778,108 @@
16041778
16051779 AddOptions(optionsPanel); //, aConstraints);
16061780
1607
- tabbedPane.add(optionsPanel);
1608
-
16091781 tabbedPane.add(FSPane = new cFileSystemPane(this));
16101782
1783
+ tabbedPane.add(optionsPanel);
1784
+
16111785 scenePanel.add(tabbedPane);
1786
+
1787
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1788
+ creditsPanel.setName("Credits");
1789
+
1790
+ cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1791
+ creditsPanel.add(ogaLabel);
1792
+
1793
+ cButton creditButton;
1794
+ creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1795
+ creditButton.setToolTipText("https://opengameart.org");
1796
+
1797
+ creditButton.addMouseListener(new MouseAdapter()
1798
+ {
1799
+ public void mouseClicked(MouseEvent e)
1800
+ {
1801
+ try
1802
+ {
1803
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1804
+ } catch (Exception e1)
1805
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1806
+ {
1807
+ e1.printStackTrace();
1808
+ }
1809
+ }
1810
+ });
1811
+
1812
+ ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
1813
+ creditsPanel.add(ogaLabel);
1814
+
1815
+ creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF));
1816
+ creditButton.setToolTipText("https://3delicious.net");
1817
+
1818
+ creditButton.addMouseListener(new MouseAdapter()
1819
+ {
1820
+ public void mouseClicked(MouseEvent e)
1821
+ {
1822
+ try
1823
+ {
1824
+ Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net"));
1825
+ } catch (Exception e1)
1826
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1827
+ {
1828
+ e1.printStackTrace();
1829
+ }
1830
+ }
1831
+ });
1832
+
1833
+ creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF));
1834
+ creditButton.setToolTipText("https://archive3d.net");
1835
+
1836
+ creditButton.addMouseListener(new MouseAdapter()
1837
+ {
1838
+ public void mouseClicked(MouseEvent e)
1839
+ {
1840
+ try
1841
+ {
1842
+ Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net"));
1843
+ } catch (Exception e1)
1844
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1845
+ {
1846
+ e1.printStackTrace();
1847
+ }
1848
+ }
1849
+ });
1850
+
1851
+ creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF));
1852
+ creditButton.setToolTipText("https://turbosquid.com");
1853
+
1854
+ creditButton.addMouseListener(new MouseAdapter()
1855
+ {
1856
+ public void mouseClicked(MouseEvent e)
1857
+ {
1858
+ try
1859
+ {
1860
+ Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free"));
1861
+ } catch (Exception e1)
1862
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1863
+ {
1864
+ e1.printStackTrace();
1865
+ }
1866
+ }
1867
+ });
1868
+
1869
+ for (int i=6; --i>=0;)
1870
+ {
1871
+ creditsPanel.add(new cGridBag());
1872
+ }
1873
+
1874
+ tabbedPane.add(creditsPanel);
1875
+ tabbedPane.setToolTipTextAt(3, "Credits");
1876
+
1877
+ if (Globals.ADVANCED)
1878
+ {
1879
+ objectPanel.add(infoPanel);
1880
+ objectPanel.setIconAt(5, GetIcon("icons/info.png"));
1881
+ objectPanel.setToolTipTextAt(4, "Information");
1882
+ }
16121883
16131884 /*
16141885 cTree jTree = new cTree(null);
....@@ -1630,13 +1901,13 @@
16301901 jtp.add(tree);
16311902 */
16321903
1633
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1634
- bigPanel.setContinuousLayout(true);
1635
- bigPanel.setOneTouchExpandable(true);
1636
- bigPanel.setDividerLocation(0.8);
1637
- bigPanel.setDividerSize(15);
1638
- bigPanel.setResizeWeight(0.15);
1639
- bigPanel.setName("Scene");
1904
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1905
+// bigPanel.setContinuousLayout(true);
1906
+// bigPanel.setOneTouchExpandable(true);
1907
+// bigPanel.setDividerLocation(0.8);
1908
+// bigPanel.setDividerSize(15);
1909
+// bigPanel.setResizeWeight(0.15);
1910
+// bigPanel.setName("Scene");
16401911
16411912 //bigPanel.setLayout(new BorderLayout());
16421913 //bigPanel.setSize(new Dimension(10,10));
....@@ -1680,6 +1951,23 @@
16801951 // aConstraints.gridheight = 1;
16811952
16821953 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1954
+
1955
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1956
+ new java.beans.PropertyChangeListener()
1957
+ {
1958
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1959
+ {
1960
+ if ((Integer)pce.getOldValue() == 1)
1961
+ {
1962
+ if (radio.layout != expandedLayout)
1963
+ {
1964
+ radio.layout = expandedLayout;
1965
+ radio.layout.doClick();
1966
+ }
1967
+ }
1968
+ }
1969
+ });
1970
+
16831971 framePanel.setContinuousLayout(false);
16841972 framePanel.setOneTouchExpandable(false);
16851973 //.setDividerLocation(0.8);
....@@ -1689,7 +1977,7 @@
16891977
16901978 frame.getContentPane().setLayout(new BorderLayout());
16911979 /**/
1692
- JTabbedPane worldPane = new JTabbedPane();
1980
+ //JTabbedPane worldPane = new JTabbedPane();
16931981 //worldPane.add(bigPanel);
16941982 //worldPane.add(worldPanel);
16951983 /**/
....@@ -1703,7 +1991,7 @@
17031991
17041992 cameraView.requestFocusInWindow();
17051993
1706
- gridPanel.setDividerLocation(1.0);
1994
+// gridPanel.setDividerLocation(1.0);
17071995
17081996 frame.validate();
17091997
....@@ -1734,28 +2022,484 @@
17342022 ctrlPanel.removeAll();
17352023 }
17362024
1737
- void SetupMaterial(cGridBag panel)
2025
+ void SetupMaterial(cGridBag materialpanel)
17382026 {
1739
- /*
2027
+ cGridBag presetpanel = new cGridBag().setVertical(true);
2028
+
2029
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
2030
+ skin.setToolTipText("Skin");
2031
+ skin.addMouseListener(new MouseAdapter()
2032
+ {
2033
+ public void mouseClicked(MouseEvent e)
2034
+ {
2035
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
2036
+ cMaterial material = object.material;
2037
+
2038
+ // Skin
2039
+ colorField.setFloat(material.color);
2040
+ float saturation = material.modulation;
2041
+
2042
+ if (!cameraView.Skinshader)
2043
+ {
2044
+ saturation /= 1.5;
2045
+ }
2046
+
2047
+ saturationField.setFloat(saturation);
2048
+
2049
+ subsurfaceField.setFloat(material.subsurface);
2050
+ selfshadowField.setFloat(material.diffuseness);
2051
+ diffusenessField.setFloat(material.factor);
2052
+ shininessField.setFloat(material.shininess);
2053
+ shadowbiasField.setFloat(material.shadowbias);
2054
+ diffuseField.setFloat(material.diffuse);
2055
+ specularField.setFloat(material.specular);
2056
+
2057
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2058
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2059
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2060
+
2061
+ materialtouched = true;
2062
+ applySelf();
2063
+ }
2064
+ });
2065
+ presetpanel.add(skin);
2066
+
2067
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
2068
+ lambert.setToolTipText("Diffuse");
2069
+ lambert.addMouseListener(new MouseAdapter()
2070
+ {
2071
+ public void mouseClicked(MouseEvent e)
2072
+ {
2073
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
2074
+ cMaterial material = object.material;
2075
+
2076
+ diffusenessField.setFloat(material.factor);
2077
+ selfshadowField.setFloat(material.diffuseness);
2078
+
2079
+ materialtouched = true;
2080
+ applySelf();
2081
+ }
2082
+ });
2083
+ presetpanel.add(lambert);
2084
+
2085
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
2086
+ diffuse2.setToolTipText("Diffuse2");
2087
+ diffuse2.addMouseListener(new MouseAdapter()
2088
+ {
2089
+ public void mouseClicked(MouseEvent e)
2090
+ {
2091
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
2092
+ cMaterial material = object.material;
2093
+
2094
+ diffusenessField.setFloat(material.factor);
2095
+ selfshadowField.setFloat(material.diffuseness);
2096
+
2097
+ materialtouched = true;
2098
+ applySelf();
2099
+ }
2100
+ });
2101
+ presetpanel.add(diffuse2);
2102
+
2103
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
2104
+ diffusemoon.setToolTipText("Moon");
2105
+ diffusemoon.addMouseListener(new MouseAdapter()
2106
+ {
2107
+ public void mouseClicked(MouseEvent e)
2108
+ {
2109
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
2110
+ cMaterial material = object.material;
2111
+
2112
+ diffusenessField.setFloat(material.factor);
2113
+ selfshadowField.setFloat(material.diffuseness);
2114
+
2115
+ materialtouched = true;
2116
+ applySelf();
2117
+ }
2118
+ });
2119
+ presetpanel.add(diffusemoon);
2120
+
2121
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
2122
+ diffusemoon2.setToolTipText("Moon2");
2123
+ diffusemoon2.addMouseListener(new MouseAdapter()
2124
+ {
2125
+ public void mouseClicked(MouseEvent e)
2126
+ {
2127
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
2128
+ cMaterial material = object.material;
2129
+
2130
+ diffusenessField.setFloat(material.factor);
2131
+ selfshadowField.setFloat(material.diffuseness);
2132
+
2133
+ materialtouched = true;
2134
+ applySelf();
2135
+ }
2136
+ });
2137
+ presetpanel.add(diffusemoon2);
2138
+
2139
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
2140
+ diffusemoon3.setToolTipText("Moon3");
2141
+ diffusemoon3.addMouseListener(new MouseAdapter()
2142
+ {
2143
+ public void mouseClicked(MouseEvent e)
2144
+ {
2145
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
2146
+ cMaterial material = object.material;
2147
+
2148
+ diffusenessField.setFloat(material.factor);
2149
+ selfshadowField.setFloat(material.diffuseness);
2150
+
2151
+ materialtouched = true;
2152
+ applySelf();
2153
+ }
2154
+ });
2155
+ presetpanel.add(diffusemoon3);
2156
+
2157
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
2158
+ diffusesheen.setToolTipText("Sheen");
2159
+ diffusesheen.addMouseListener(new MouseAdapter()
2160
+ {
2161
+ public void mouseClicked(MouseEvent e)
2162
+ {
2163
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
2164
+ cMaterial material = object.material;
2165
+
2166
+ sheenField.setFloat(material.sheen);
2167
+
2168
+ materialtouched = true;
2169
+ applySelf();
2170
+ }
2171
+ });
2172
+ presetpanel.add(diffusesheen);
2173
+
2174
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
2175
+ rough.setToolTipText("Rough metal");
2176
+ rough.addMouseListener(new MouseAdapter()
2177
+ {
2178
+ public void mouseClicked(MouseEvent e)
2179
+ {
2180
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
2181
+ cMaterial material = object.material;
2182
+
2183
+ shininessField.setFloat(material.shininess);
2184
+ velvetField.setFloat(material.velvet);
2185
+
2186
+ materialtouched = true;
2187
+ applySelf();
2188
+ }
2189
+ });
2190
+ presetpanel.add(rough);
2191
+
2192
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
2193
+ rough2.setToolTipText("Medium metal");
2194
+ rough2.addMouseListener(new MouseAdapter()
2195
+ {
2196
+ public void mouseClicked(MouseEvent e)
2197
+ {
2198
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2199
+ cMaterial material = object.material;
2200
+
2201
+ shininessField.setFloat(material.shininess);
2202
+ lightareaField.setFloat(material.lightarea);
2203
+
2204
+ materialtouched = true;
2205
+ applySelf();
2206
+ }
2207
+ });
2208
+ presetpanel.add(rough2);
2209
+
2210
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
2211
+ shini0.setToolTipText("Shiny");
2212
+ shini0.addMouseListener(new MouseAdapter()
2213
+ {
2214
+ public void mouseClicked(MouseEvent e)
2215
+ {
2216
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2217
+ cMaterial material = object.material;
2218
+
2219
+ shininessField.setFloat(material.shininess);
2220
+ lightareaField.setFloat(material.lightarea);
2221
+
2222
+ materialtouched = true;
2223
+ applySelf();
2224
+ }
2225
+ });
2226
+ presetpanel.add(shini0);
2227
+
2228
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
2229
+ shini1.setToolTipText("Shiny2");
2230
+ shini1.addMouseListener(new MouseAdapter()
2231
+ {
2232
+ public void mouseClicked(MouseEvent e)
2233
+ {
2234
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2235
+ cMaterial material = object.material;
2236
+
2237
+ shininessField.setFloat(material.shininess);
2238
+ lightareaField.setFloat(material.lightarea);
2239
+
2240
+ materialtouched = true;
2241
+ applySelf();
2242
+ }
2243
+ });
2244
+ presetpanel.add(shini1);
2245
+
2246
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
2247
+ shini2.setToolTipText("Shiny3");
2248
+ shini2.addMouseListener(new MouseAdapter()
2249
+ {
2250
+ public void mouseClicked(MouseEvent e)
2251
+ {
2252
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2253
+ cMaterial material = object.material;
2254
+
2255
+ shininessField.setFloat(material.shininess);
2256
+ lightareaField.setFloat(material.lightarea);
2257
+
2258
+ materialtouched = true;
2259
+ applySelf();
2260
+ }
2261
+ });
2262
+ presetpanel.add(shini2);
2263
+
2264
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
2265
+ aniso.setToolTipText("AnisoU");
2266
+ aniso.addMouseListener(new MouseAdapter()
2267
+ {
2268
+ public void mouseClicked(MouseEvent e)
2269
+ {
2270
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2271
+ cMaterial material = object.material;
2272
+
2273
+ anisoField.setFloat(material.aniso);
2274
+ anisoVField.setFloat(material.anisoV);
2275
+
2276
+ materialtouched = true;
2277
+ applySelf();
2278
+ }
2279
+ });
2280
+ presetpanel.add(aniso);
2281
+
2282
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
2283
+ aniso2.setToolTipText("AnisoV");
2284
+ aniso2.addMouseListener(new MouseAdapter()
2285
+ {
2286
+ public void mouseClicked(MouseEvent e)
2287
+ {
2288
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2289
+ cMaterial material = object.material;
2290
+
2291
+ anisoField.setFloat(material.aniso);
2292
+ anisoVField.setFloat(material.anisoV);
2293
+
2294
+ materialtouched = true;
2295
+ applySelf();
2296
+ }
2297
+ });
2298
+ presetpanel.add(aniso2);
2299
+
2300
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
2301
+ aniso3.setToolTipText("AnisoUV");
2302
+ aniso3.addMouseListener(new MouseAdapter()
2303
+ {
2304
+ public void mouseClicked(MouseEvent e)
2305
+ {
2306
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2307
+ cMaterial material = object.material;
2308
+
2309
+ anisoField.setFloat(material.aniso);
2310
+ anisoVField.setFloat(material.anisoV);
2311
+
2312
+ materialtouched = true;
2313
+ applySelf();
2314
+ }
2315
+ });
2316
+ presetpanel.add(aniso3);
2317
+
2318
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
2319
+ velvet0.setToolTipText("Velvet");
2320
+ velvet0.addMouseListener(new MouseAdapter()
2321
+ {
2322
+ public void mouseClicked(MouseEvent e)
2323
+ {
2324
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2325
+ cMaterial material = object.material;
2326
+
2327
+ diffusenessField.setFloat(material.factor);
2328
+ selfshadowField.setFloat(material.diffuseness);
2329
+ sheenField.setFloat(material.sheen);
2330
+ shininessField.setFloat(material.shininess);
2331
+ velvetField.setFloat(material.velvet);
2332
+ shiftField.setFloat(material.shift);
2333
+
2334
+ materialtouched = true;
2335
+ applySelf();
2336
+ }
2337
+ });
2338
+ presetpanel.add(velvet0);
2339
+
2340
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
2341
+ bump0.setToolTipText("Bump texture");
2342
+ bump0.addMouseListener(new MouseAdapter()
2343
+ {
2344
+ public void mouseClicked(MouseEvent e)
2345
+ {
2346
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2347
+ cMaterial material = object.material;
2348
+
2349
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2350
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2351
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2352
+
2353
+ materialtouched = true;
2354
+ applySelf();
2355
+ }
2356
+ });
2357
+ presetpanel.add(bump0);
2358
+
2359
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
2360
+ borderShader.setToolTipText("Border fade");
2361
+ borderShader.addMouseListener(new MouseAdapter()
2362
+ {
2363
+ public void mouseClicked(MouseEvent e)
2364
+ {
2365
+ borderfadeField.setFloat(0.4);
2366
+ opacityField.setFloat(0.75);
2367
+
2368
+ materialtouched = true;
2369
+ applySelf();
2370
+ }
2371
+ });
2372
+ presetpanel.add(borderShader);
2373
+
2374
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
2375
+ halo.setToolTipText("Halo");
2376
+ halo.addMouseListener(new MouseAdapter()
2377
+ {
2378
+ public void mouseClicked(MouseEvent e)
2379
+ {
2380
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2381
+ cMaterial material = object.material;
2382
+
2383
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2384
+
2385
+ materialtouched = true;
2386
+ applySelf();
2387
+ }
2388
+ });
2389
+ presetpanel.add(halo);
2390
+
2391
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
2392
+ candle.setToolTipText("Candle");
2393
+ candle.addMouseListener(new MouseAdapter()
2394
+ {
2395
+ public void mouseClicked(MouseEvent e)
2396
+ {
2397
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2398
+ cMaterial material = object.material;
2399
+
2400
+ subsurfaceField.setFloat(material.subsurface);
2401
+ shadowbiasField.setFloat(material.shadowbias);
2402
+ ambientField.setFloat(material.ambient);
2403
+ specularField.setFloat(material.specular);
2404
+ lightareaField.setFloat(material.lightarea);
2405
+ shininessField.setFloat(material.shininess);
2406
+
2407
+ materialtouched = true;
2408
+ applySelf();
2409
+ }
2410
+ });
2411
+ presetpanel.add(candle);
2412
+
2413
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
2414
+ shadowShader.setToolTipText("Shadow");
2415
+ shadowShader.addMouseListener(new MouseAdapter()
2416
+ {
2417
+ public void mouseClicked(MouseEvent e)
2418
+ {
2419
+ diffuseField.setFloat(0.001);
2420
+ ambientField.setFloat(0.001);
2421
+ cameraField.setFloat(0.001);
2422
+ specularField.setFloat(0.001);
2423
+ fakedepthField.setFloat(0.001);
2424
+ opacityField.setFloat(0.6);
2425
+
2426
+ materialtouched = true;
2427
+ applySelf();
2428
+ }
2429
+ });
2430
+ presetpanel.add(shadowShader);
2431
+
2432
+ cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF);
2433
+ para0.setToolTipText("No parallax");
2434
+ para0.addMouseListener(new MouseAdapter()
2435
+ {
2436
+ public void mouseClicked(MouseEvent e)
2437
+ {
2438
+ parallaxField.setFloat(0.125);
2439
+
2440
+ materialtouched = true;
2441
+ applySelf();
2442
+ }
2443
+ });
2444
+ presetpanel.add(para0);
2445
+
2446
+ cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF);
2447
+ para1.setToolTipText("With parallax");
2448
+ para1.addMouseListener(new MouseAdapter()
2449
+ {
2450
+ public void mouseClicked(MouseEvent e)
2451
+ {
2452
+ parallaxField.setFloat(0.13);
2453
+
2454
+ materialtouched = true;
2455
+ applySelf();
2456
+ }
2457
+ });
2458
+ presetpanel.add(para1);
2459
+
2460
+ cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF);
2461
+ para2.setToolTipText("Reset parallax");
2462
+ para2.addMouseListener(new MouseAdapter()
2463
+ {
2464
+ public void mouseClicked(MouseEvent e)
2465
+ {
2466
+ parallaxField.setFloat(0.14);
2467
+
2468
+ materialtouched = true;
2469
+ applySelf();
2470
+ }
2471
+ });
2472
+ presetpanel.add(para2);
2473
+
2474
+ cGridBag panel = new cGridBag().setVertical(true);
2475
+
2476
+ presetpanel.preferredWidth = 1;
2477
+
2478
+ materialpanel.add(presetpanel);
2479
+ materialpanel.add(panel);
2480
+
2481
+ panel.preferredWidth = 8;
2482
+
2483
+ /*
17402484 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
17412485 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1742
- */
2486
+ */
17432487
17442488 cGridBag editBar = new cGridBag().setVertical(false);
17452489
1746
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2490
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
17472491 createMaterialButton.setToolTipText("Create material");
17482492
17492493 /*
17502494 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
17512495 */
17522496
1753
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2497
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
17542498 clearMaterialButton.setToolTipText("Clear material");
17552499
17562500 if (Globals.ADVANCED)
17572501 {
1758
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2502
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
17592503 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
17602504 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
17612505 }
....@@ -1776,7 +2520,20 @@
17762520
17772521 cGridBag huepanel = new cGridBag();
17782522 cGridBag huelabel = new cGridBag();
1779
- huelabel.add(GetLabel("icons/hue.png", false));
2523
+ cLabel hue = GetLabel("icons/hue.png", false);
2524
+ hue.fit = true;
2525
+
2526
+ hue.addMouseListener(new MouseAdapter()
2527
+ {
2528
+ public void mousePressed(MouseEvent e)
2529
+ {
2530
+ int x = e.getX();
2531
+
2532
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2533
+ }
2534
+ });
2535
+
2536
+ huelabel.add(hue);
17802537 huelabel.preferredWidth = 20;
17812538 huepanel.add(new cGridBag()); // Label
17822539 huepanel.add(huelabel); // Field/slider
....@@ -1797,7 +2554,7 @@
17972554 cGridBag modulation = new cGridBag();
17982555 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
17992556 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1800
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2557
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
18012558 colorSection.add(modulation);
18022559
18032560 cGridBag opacity = new cGridBag();
....@@ -1959,6 +2716,12 @@
19592716 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
19602717 colorSection.add(backlit);
19612718
2719
+ cGridBag parallax = new cGridBag();
2720
+ parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints);
2721
+ parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2722
+ parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints);
2723
+ colorSection.add(parallax);
2724
+
19622725 //panel.add(new JSeparator());
19632726
19642727 //panel.add(globalSection);
....@@ -2990,7 +3753,7 @@
29903753
29913754 freezematerial = true;
29923755 colorField.setFloat(mat.color);
2993
- modulationField.setFloat(mat.modulation);
3756
+ saturationField.setFloat(mat.modulation);
29943757 metalnessField.setFloat(mat.metalness);
29953758 diffuseField.setFloat(mat.diffuse);
29963759 specularField.setFloat(mat.specular);
....@@ -3010,6 +3773,7 @@
30103773 shadowField.setFloat(mat.shadow);
30113774 textureField.setFloat(mat.texture);
30123775 opacityField.setFloat(mat.opacity);
3776
+ parallaxField.setFloat(mat.parallax + 0.125f);
30133777 fakedepthField.setFloat(mat.fakedepth);
30143778 shadowbiasField.setFloat(mat.shadowbias);
30153779 bumpField.setInteger(1); // dec 2013
....@@ -3052,32 +3816,8 @@
30523816
30533817 if (multiplyToggle != null)
30543818 multiplyToggle.setSelected(mat.multiply);
3055
-
3056
- assert (object.projectedVertices != null);
3057
-
3058
- if (object.projectedVertices.length <= 2)
3059
- {
3060
- // Side effect...
3061
- Object3D.cVector2[] keep = object.projectedVertices;
3062
- object.projectedVertices = new Object3D.cVector2[3];
3063
- for (int i = 0; i < 3; i++)
3064
- {
3065
- if (i < keep.length)
3066
- {
3067
- object.projectedVertices[i] = keep[i];
3068
- } else
3069
- {
3070
- object.projectedVertices[i] = new Object3D.cVector2();
3071
- }
3072
- /*
3073
- if(keep.length == 0)
3074
- object.projectedVertices[0] = new Object3D.cVector2();
3075
- else
3076
- object.projectedVertices[0] = keep[0];
3077
- object.projectedVertices[1] = new Object3D.cVector2();
3078
- */
3079
- }
3080
- }
3819
+
3820
+ AllocProjectedVertices(object);
30813821
30823822 SetMaterial(mat, object.projectedVertices);
30833823 }
....@@ -3197,6 +3937,17 @@
31973937 public void itemStateChanged(ItemEvent event)
31983938 {
31993939 // System.out.println("Propagate = " + propagate);
3940
+ if (event.getSource() == pinButton)
3941
+ {
3942
+ copy.pinned ^= true;
3943
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3944
+ {
3945
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3946
+ copy.CloseUI();
3947
+ //copy.editWindow.refreshContents();
3948
+ }
3949
+ }
3950
+ else
32003951 if (event.getSource() == propagateToggle)
32013952 {
32023953 propagate ^= true;
....@@ -3301,6 +4052,7 @@
33014052 } else if (event.getSource() == liveCB)
33024053 {
33034054 copy.live ^= true;
4055
+ objEditor.refreshContents(true); // To show item colors
33044056 return;
33054057 } else if (event.getSource() == selectableCB)
33064058 {
....@@ -3310,7 +4062,7 @@
33104062 {
33114063 copy.hide ^= true;
33124064 copy.Touch(); // display list issue
3313
- objEditor.refreshContents();
4065
+ objEditor.refreshContents(true); // To show item colors
33144066 return;
33154067 } else if (event.getSource() == link2masterCB)
33164068 {
....@@ -3375,7 +4127,7 @@
33754127 //System.out.println("ObjEditor " + event);
33764128 applySelf0(true);
33774129 //parent.applySelf();
3378
- objEditor.refreshContents();
4130
+ // conflicts with requestFocus objEditor.refreshContents();
33794131 } else if (source == resetButton)
33804132 {
33814133 CameraPane.fullreset = true;
....@@ -3555,11 +4307,18 @@
35554307
35564308 void New()
35574309 {
3558
- while (copy.Size() > 1)
4310
+ while (copy.Size() > 0)
35594311 {
3560
- copy.remove(1);
4312
+ copy.remove(0);
35614313 }
35624314
4315
+ copy.selection.clear();
4316
+
4317
+ if (copy == Grafreed.grafreed.universe)
4318
+ {
4319
+ CreateCameras();
4320
+ cameraView.SetCamera(GetCamera(copy, 0));
4321
+ }
35634322 ResetModel();
35644323 objEditor.refreshContents();
35654324 }
....@@ -3668,6 +4427,7 @@
36684427 {
36694428 //Save(true);
36704429 Replace();
4430
+ SetVersionStates();
36714431 }
36724432
36734433 private boolean Equal(byte[] compress, byte[] name)
....@@ -3686,15 +4446,34 @@
36864446 return true;
36874447 }
36884448
3689
- java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4449
+ void DeleteVersion()
4450
+ {
4451
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4452
+ {
4453
+ copy.versionlist[i] = copy.versionlist[i+1];
4454
+ }
4455
+
4456
+ if (copy.versionlist[copy.versionindex] == null)
4457
+ copy.versionindex -= 1;
4458
+
4459
+ if (copy.versionindex != -1)
4460
+ CopyChanged();
4461
+
4462
+ SetVersionStates();
4463
+ }
36904464
36914465 public boolean Save(boolean user)
36924466 {
36934467 System.err.println("Save");
4468
+ Replace();
36944469
3695
- cRadio tab = GetCurrentTab();
4470
+ if (copy.versionlist == null)
4471
+ {
4472
+ copy.versionlist = new Object3D[100];
4473
+ copy.versionindex = -1;
4474
+ }
36964475
3697
- Object3D compress = CompressCopy(); // Saved version. No need for "Replace".
4476
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
36984477
36994478 boolean thesame = false;
37004479
....@@ -3706,10 +4485,15 @@
37064485 //EditorFrame.m_MainFrame.requestFocusInWindow();
37074486 if (!thesame)
37084487 {
4488
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4489
+ {
4490
+ copy.versionlist[i] = copy.versionlist[i-1];
4491
+ }
4492
+
37094493 //tab.user[tab.versionindex] = user;
37104494 //boolean increment = true; // tab.graphs[tab.versionindex] == null;
37114495
3712
- copy.versions[++copy.versionindex] = compress;
4496
+ copy.versionlist[++copy.versionindex] = compress;
37134497
37144498 // if (increment)
37154499 // tab.versionindex++;
....@@ -3719,13 +4503,13 @@
37194503
37204504 //assert(hashtable.isEmpty());
37214505
3722
- for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3723
- {
3724
- //tab.user[i] = false;
3725
- copy.versions[i] = null;
3726
- }
4506
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4507
+// {
4508
+// //tab.user[i] = false;
4509
+// copy.versionlist[i] = null;
4510
+// }
37274511
3728
- SetUndoStates();
4512
+ SetVersionStates();
37294513
37304514 // test save
37314515 if (false)
....@@ -3748,15 +4532,49 @@
37484532
37494533 return !thesame;
37504534 }
3751
-
3752
- void CopyChanged(Object3D obj)
4535
+
4536
+ boolean flashIt = true;
4537
+
4538
+ void RefreshSelection()
37534539 {
3754
- SetUndoStates();
4540
+ Object3D selection = new Object3D();
4541
+
4542
+ for (int i = 0; i < copy.selection.size(); i++)
4543
+ {
4544
+ Object3D elem = copy.selection.elementAt(i);
4545
+
4546
+ Object3D obj = copy.GetObject(elem.GetUUID());
4547
+
4548
+ if (obj == null)
4549
+ {
4550
+ copy.selection.remove(i--);
4551
+ }
4552
+ else
4553
+ {
4554
+ selection.add(obj);
4555
+ copy.selection.setElementAt(obj, i);
4556
+ }
4557
+ }
4558
+
4559
+ flashIt = false;
4560
+ GetTree().clearSelection();
4561
+ for (int i = 0; i < selection.size(); i++)
4562
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4563
+ flashIt = true;
4564
+
4565
+ //refreshContents(false);
4566
+ }
4567
+
4568
+ void CopyChanged()
4569
+ {
4570
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4571
+
4572
+ SetVersionStates();
37554573
37564574 boolean temp = CameraPane.SWITCH;
37574575 CameraPane.SWITCH = false;
37584576
3759
- copy.ExtractBigData(versiontable);
4577
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
37604578
37614579 copy.clear();
37624580
....@@ -3768,10 +4586,11 @@
37684586 copy.add(obj.get(i));
37694587 }
37704588
3771
- copy.RestoreBigData(versiontable);
4589
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
37724590
37734591 CameraPane.SWITCH = temp;
37744592
4593
+ RefreshSelection();
37754594 //assert(hashtable.isEmpty());
37764595
37774596 copy.Touch();
....@@ -3792,13 +4611,15 @@
37924611 }
37934612 }
37944613
3795
- refreshContents();
4614
+ refreshContents(true);
37964615 }
37974616
3798
- cButton undoButton;
4617
+ cButton previousVersionButton;
37994618 cButton restoreButton;
38004619 cButton replaceButton;
3801
- cButton redoButton;
4620
+ cButton nextVersionButton;
4621
+ cButton saveVersionButton;
4622
+ cButton deleteVersionButton;
38024623
38034624 boolean muteSlider;
38044625
....@@ -3806,39 +4627,64 @@
38064627 {
38074628 int count = 0;
38084629
3809
- for (int i = copy.versions.length; --i >= 0;)
4630
+ for (int i = copy.versionlist.length; --i >= 0;)
38104631 {
3811
- if (copy.versions[i] != null)
4632
+ if (copy.versionlist[i] != null)
38124633 count++;
38134634 }
38144635
38154636 return count;
38164637 }
38174638
3818
- void SetUndoStates()
4639
+ public cGridBag versionSliderPane;
4640
+
4641
+ void SetVersionStates()
38194642 {
3820
- cRadio tab = GetCurrentTab();
4643
+ //if (true)
4644
+ // return;
4645
+
4646
+ //cRadio tab = GetCurrentTab();
38214647
3822
- restoreButton.setEnabled(copy.versionindex != -1);
3823
- replaceButton.setEnabled(copy.versionindex != -1);
3824
-
3825
- undoButton.setEnabled(copy.versionindex > 0);
3826
- redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3827
-
3828
- muteSlider = true;
3829
- versionSlider.setMaximum(VersionCount() - 1);
3830
- versionSlider.setInteger(copy.versionindex);
3831
- muteSlider = false;
4648
+ if (copy.versionindex == -2)
4649
+ {
4650
+ saveVersionButton.setEnabled(false);
4651
+ restoreButton.setEnabled(false);
4652
+ replaceButton.setEnabled(false);
4653
+ previousVersionButton.setEnabled(false);
4654
+ nextVersionButton.setEnabled(false);
4655
+ deleteVersionButton.setEnabled(false);
4656
+ versionSliderPane.setVisible(false);
4657
+ }
4658
+ else
4659
+ {
4660
+ restoreButton.setEnabled(copy.versionindex != -1);
4661
+ replaceButton.setEnabled(copy.versionindex != -1);
4662
+
4663
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4664
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4665
+
4666
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4667
+ //copy.versionlist[copy.versionindex + 1] != null);
4668
+
4669
+ muteSlider = true;
4670
+ versionSlider.setMinimum(0);
4671
+ versionSlider.setMaximum(VersionCount() - 1);
4672
+ versionSlider.setInteger(copy.versionindex);
4673
+ versionSlider.setEnabled(copy.versionindex != -1);
4674
+ muteSlider = false;
4675
+
4676
+ versionSliderPane.setVisible(true);
4677
+ }
38324678 }
38334679
3834
- public boolean Undo()
4680
+ public boolean PreviousVersion()
38354681 {
38364682 // Option?
38374683 Replace();
38384684
38394685 System.err.println("Undo");
38404686
3841
- cRadio tab = GetCurrentTab();
4687
+ //cRadio tab = GetCurrentTab();
38424688
38434689 if (copy.versionindex == 0)
38444690 {
....@@ -3861,7 +4707,7 @@
38614707
38624708 copy.versionindex -= 1;
38634709
3864
- CopyChanged((Object3D)copy.versions[copy.versionindex]);
4710
+ CopyChanged();
38654711
38664712 return true;
38674713 }
....@@ -3870,45 +4716,45 @@
38704716 {
38714717 System.err.println("Restore");
38724718
3873
- cRadio tab = GetCurrentTab();
4719
+ //cRadio tab = GetCurrentTab();
38744720
3875
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
4721
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38764722 {
38774723 java.awt.Toolkit.getDefaultToolkit().beep();
38784724 return false;
38794725 }
38804726
38814727 //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3882
- CopyChanged(copy.versions[copy.versionindex]);
4728
+ CopyChanged();
38834729
38844730 return true;
38854731 }
38864732
38874733 public boolean Replace()
38884734 {
3889
- System.err.println("Replace");
4735
+ //System.err.println("Replace");
38904736
3891
- cRadio tab = GetCurrentTab();
4737
+ //cRadio tab = GetCurrentTab();
38924738
3893
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
4739
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38944740 {
38954741 // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
38964742 return false;
38974743 }
38984744
3899
- copy.versions[copy.versionindex] = CompressCopy();
4745
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
39004746
39014747 return true;
39024748 }
39034749
3904
- public void Redo()
4750
+ public void NextVersion()
39054751 {
39064752 // Option?
39074753 Replace();
39084754
3909
- cRadio tab = GetCurrentTab();
4755
+ //cRadio tab = GetCurrentTab();
39104756
3911
- if (copy.versions[copy.versionindex + 1] == null)
4757
+ if (copy.versionlist[copy.versionindex + 1] == null)
39124758 {
39134759 java.awt.Toolkit.getDefaultToolkit().beep();
39144760 return;
....@@ -3916,7 +4762,7 @@
39164762
39174763 copy.versionindex += 1;
39184764
3919
- CopyChanged(copy.versions[copy.versionindex]);
4765
+ CopyChanged();
39204766
39214767 //if (!tab.user[tab.versionindex])
39224768 // tab.graphs[tab.versionindex] = null;
....@@ -4113,6 +4959,12 @@
41134959 // else
41144960 // applySelf(true);
41154961 // }
4962
+
4963
+ boolean Equal(double a, double b)
4964
+ {
4965
+ return Math.abs(a - b) < 0.001;
4966
+ }
4967
+
41164968 void applySelf0(boolean name)
41174969 {
41184970 if (name)
....@@ -4130,7 +4982,7 @@
41304982 //copy.material = new cMaterial(copy.GetMaterial());
41314983
41324984 current.color = (float) colorField.getFloat();
4133
- current.modulation = (float) modulationField.getFloat();
4985
+ current.modulation = (float) saturationField.getFloat();
41344986 current.metalness = (float) metalnessField.getFloat();
41354987 current.diffuse = (float) diffuseField.getFloat();
41364988 current.specular = (float) specularField.getFloat();
....@@ -4150,6 +5002,7 @@
41505002 current.shadow = (float) shadowField.getFloat();
41515003 current.texture = (float) textureField.getFloat();
41525004 current.opacity = (float) opacityField.getFloat();
5005
+ current.parallax = (float) parallaxField.getFloat() - 0.125f;
41535006 current.fakedepth = (float) fakedepthField.getFloat();
41545007 current.shadowbias = (float) shadowbiasField.getFloat();
41555008
....@@ -4162,29 +5015,54 @@
41625015 {
41635016 cMaterial mat = copy.material;
41645017
4165
- colorField.SetToolTipValue((mat.color));
4166
- modulationField.SetToolTipValue((mat.modulation));
4167
- metalnessField.SetToolTipValue((mat.metalness));
4168
- diffuseField.SetToolTipValue((mat.diffuse));
4169
- specularField.SetToolTipValue((mat.specular));
4170
- shininessField.SetToolTipValue((mat.shininess));
4171
- shiftField.SetToolTipValue((mat.shift));
4172
- ambientField.SetToolTipValue((mat.ambient));
4173
- lightareaField.SetToolTipValue((mat.lightarea));
4174
- diffusenessField.SetToolTipValue((mat.factor));
4175
- velvetField.SetToolTipValue((mat.velvet));
4176
- sheenField.SetToolTipValue((mat.sheen));
4177
- subsurfaceField.SetToolTipValue((mat.subsurface));
4178
- backlitField.SetToolTipValue((mat.bump));
4179
- anisoField.SetToolTipValue((mat.aniso));
4180
- anisoVField.SetToolTipValue((mat.anisoV));
4181
- cameraField.SetToolTipValue((mat.cameralight));
4182
- selfshadowField.SetToolTipValue((mat.diffuseness));
4183
- shadowField.SetToolTipValue((mat.shadow));
4184
- textureField.SetToolTipValue((mat.texture));
4185
- opacityField.SetToolTipValue((mat.opacity));
4186
- fakedepthField.SetToolTipValue((mat.fakedepth));
4187
- shadowbiasField.SetToolTipValue((mat.shadowbias));
5018
+ if (!Equal(colorField.getFloat(), mat.color))
5019
+ colorField.SetToolTipValue((mat.color));
5020
+ if (!Equal(saturationField.getFloat(), mat.modulation))
5021
+ saturationField.SetToolTipValue((mat.modulation));
5022
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
5023
+ metalnessField.SetToolTipValue((mat.metalness));
5024
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
5025
+ diffuseField.SetToolTipValue((mat.diffuse));
5026
+ if (!Equal(specularField.getFloat(), mat.specular))
5027
+ specularField.SetToolTipValue((mat.specular));
5028
+ if (!Equal(shininessField.getFloat(), mat.shininess))
5029
+ shininessField.SetToolTipValue((mat.shininess));
5030
+ if (!Equal(shiftField.getFloat(), mat.shift))
5031
+ shiftField.SetToolTipValue((mat.shift));
5032
+ if (!Equal(ambientField.getFloat(), mat.ambient))
5033
+ ambientField.SetToolTipValue((mat.ambient));
5034
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
5035
+ lightareaField.SetToolTipValue((mat.lightarea));
5036
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
5037
+ diffusenessField.SetToolTipValue((mat.factor));
5038
+ if (!Equal(velvetField.getFloat(), mat.velvet))
5039
+ velvetField.SetToolTipValue((mat.velvet));
5040
+ if (!Equal(sheenField.getFloat(), mat.sheen))
5041
+ sheenField.SetToolTipValue((mat.sheen));
5042
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
5043
+ subsurfaceField.SetToolTipValue((mat.subsurface));
5044
+ if (!Equal(backlitField.getFloat(), mat.bump))
5045
+ backlitField.SetToolTipValue((mat.bump));
5046
+ if (!Equal(anisoField.getFloat(), mat.aniso))
5047
+ anisoField.SetToolTipValue((mat.aniso));
5048
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
5049
+ anisoVField.SetToolTipValue((mat.anisoV));
5050
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
5051
+ cameraField.SetToolTipValue((mat.cameralight));
5052
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
5053
+ selfshadowField.SetToolTipValue((mat.diffuseness));
5054
+ if (!Equal(shadowField.getFloat(), mat.shadow))
5055
+ shadowField.SetToolTipValue((mat.shadow));
5056
+ if (!Equal(textureField.getFloat(), mat.texture))
5057
+ textureField.SetToolTipValue((mat.texture));
5058
+ if (!Equal(opacityField.getFloat(), mat.opacity))
5059
+ opacityField.SetToolTipValue((mat.opacity));
5060
+ //if (!Equal(parallaxField.getFloat(), mat.parallax))
5061
+ parallaxField.SetToolTipValue((mat.parallax));
5062
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
5063
+ fakedepthField.SetToolTipValue((mat.fakedepth));
5064
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
5065
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
41885066 }
41895067
41905068 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -4219,17 +5097,20 @@
42195097
42205098 public void stateChanged(ChangeEvent e)
42215099 {
4222
- // assert(false);
5100
+ // assert(false);
42235101 if (e.getSource() == versionSlider)
42245102 {
42255103 if (muteSlider)
42265104 return;
42275105
5106
+ Replace();
5107
+
42285108 int version = versionSlider.getInteger();
42295109
4230
- if (copy.versions[version] != null)
5110
+ if (version != -1 && copy.versionlist[version] != null)
42315111 {
4232
- CopyChanged(copy.versions[copy.versionindex = version]);
5112
+ copy.versionindex = version;
5113
+ CopyChanged();
42335114 }
42345115
42355116 return;
....@@ -4269,6 +5150,12 @@
42695150 {
42705151 //System.out.println("stateChanged = " + this);
42715152 materialtouched = true;
5153
+
5154
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
5155
+ {
5156
+ saturationField.setFloat(1);
5157
+ }
5158
+
42725159 applySelf();
42735160 //System.out.println("this = " + this);
42745161 //System.out.println("PARENT = " + parent);
....@@ -4568,6 +5455,7 @@
45685455 {
45695456 if (GetTree() != null)
45705457 {
5458
+ GetTree().revalidate();
45715459 GetTree().repaint();
45725460 }
45735461
....@@ -4576,6 +5464,11 @@
45765464 ctrlPanel.validate(); // ? new
45775465 ctrlPanel.repaint();
45785466 }
5467
+
5468
+ if (previousVersionButton != null && copy.versionlist != null)
5469
+ SetVersionStates();
5470
+
5471
+ cameraView.requestFocusInWindow();
45795472 }
45805473
45815474 static TweenManager tweenManager = new TweenManager();
....@@ -4607,7 +5500,7 @@
46075500 // group = (Composite) group.get(0);
46085501 // }
46095502
4610
- System.out.println("makeSomething of " + thing);
5503
+ //System.out.println("makeSomething of " + thing);
46115504
46125505 /*
46135506 if (deselect && jList != null)
....@@ -4959,13 +5852,17 @@
49595852 c.addChild(csg);
49605853 }
49615854
4962
- copy.versions = readobj.versions;
5855
+ copy.versionlist = readobj.versionlist;
49635856 copy.versionindex = readobj.versionindex;
5857
+ copy.versiontable = readobj.versiontable;
49645858
4965
- if (copy.versions == null)
5859
+ if (copy.versionlist == null)
49665860 {
4967
- copy.versions = new Object3D[100];
5861
+ // Backward compatibility
5862
+ copy.versionlist = new Object3D[100];
49685863 copy.versionindex = -1;
5864
+
5865
+ //Save(true);
49695866 }
49705867
49715868 //? SetUndoStates();
....@@ -4980,7 +5877,7 @@
49805877 {
49815878 if (Grafreed.standAlone)
49825879 {
4983
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5880
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
49845881 browser.show();
49855882 String filename = browser.getFile();
49865883 if (filename != null && filename.length() > 0)
....@@ -5057,6 +5954,8 @@
50575954
50585955 void save()
50595956 {
5957
+ Replace();
5958
+
50605959 if (lastname == null)
50615960 {
50625961 return;
....@@ -5299,6 +6198,7 @@
52996198 ButtonGroup buttonGroup;
53006199
53016200 cGridBag toolboxPanel;
6201
+ cGridBag skyboxPanel;
53026202 cGridBag materialPanel;
53036203 cGridBag ctrlPanel;
53046204
....@@ -5310,6 +6210,7 @@
53106210 boolean materialFlushed;
53116211 Object3D latestObject;
53126212
6213
+ cGridBag transformPanel;
53136214 cGridBag XYZPanel;
53146215
53156216 JSplitPane gridPanel;
....@@ -5372,7 +6273,7 @@
53726273 JLabel colorLabel;
53736274 cNumberSlider colorField;
53746275 JLabel modulationLabel;
5375
- cNumberSlider modulationField;
6276
+ cNumberSlider saturationField;
53766277 JLabel metalnessLabel;
53776278 cNumberSlider metalnessField;
53786279 JLabel diffuseLabel;
....@@ -5403,6 +6304,7 @@
54036304 cNumberSlider anisoField;
54046305 JLabel anisoVLabel;
54056306 cNumberSlider anisoVField;
6307
+
54066308 JLabel cameraLabel;
54076309 cNumberSlider cameraField;
54086310 JLabel selfshadowLabel;
....@@ -5413,10 +6315,13 @@
54136315 cNumberSlider textureField;
54146316 JLabel opacityLabel;
54156317 cNumberSlider opacityField;
6318
+ JLabel parallaxLabel;
6319
+ cNumberSlider parallaxField;
54166320 JLabel fakedepthLabel;
54176321 cNumberSlider fakedepthField;
54186322 JLabel shadowbiasLabel;
54196323 cNumberSlider shadowbiasField;
6324
+
54206325 JLabel bumpLabel;
54216326 cNumberSlider bumpField;
54226327 JLabel noiseLabel;