Normand Briere
2019-08-18 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c
ObjEditor.java
....@@ -34,6 +34,7 @@
3434 iSendInfo
3535 //KeyListener
3636 {
37
+ public cToggleButton pinButton;
3738 boolean timeline;
3839 boolean wasFullScreen;
3940
....@@ -41,64 +42,137 @@
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
+ }
89
+
90
+ public cGridBag GetSeparator()
91
+ {
92
+ cGridBag separator = new cGridBag();
93
+ separator.add(new JSeparator());
94
+ separator.preferredHeight = 5;
95
+ return separator;
96
+ }
4497
4598 cButton GetButton(String name, boolean border)
4699 {
47
- try
48
- {
49
- ImageIcon icon = GetIcon(name);
100
+ ImageIcon icon = GetIcon(name);
101
+ if (icon != null || name.contains("/"))
50102 return new cButton(icon, border);
51
- }
52
- catch (Exception e)
53
- {
103
+ else
54104 return new cButton(name, border);
55
- }
105
+ }
106
+
107
+ cLabel GetLabel(String name, boolean border)
108
+ {
109
+ //ImageIcon icon = GetIcon(name);
110
+ return new cLabel(GetImage(name), border);
56111 }
57112
58113 cToggleButton GetToggleButton(String name, boolean border)
59114 {
60
- try
61
- {
62
- ImageIcon icon = GetIcon(name);
63
- return new cToggleButton(icon, border);
64
- }
65
- catch (Exception e)
66
- {
67
- return new cToggleButton(name, border);
68
- }
115
+ ImageIcon icon = GetIcon(name);
116
+ return new cToggleButton(icon, border);
69117 }
70118
71119 cCheckBox GetCheckBox(String name, boolean border)
72120 {
121
+ ImageIcon icon = GetIcon(name);
122
+ return new cCheckBox(icon, border);
123
+ }
124
+
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)
128
+ {
129
+ javax.swing.ImageIcon iconCache = icons.get(name);
130
+ if (iconCache != null)
131
+ {
132
+ return iconCache;
133
+ }
134
+
73135 try
74136 {
75
- ImageIcon icon = GetIcon(name);
76
- return new cCheckBox(icon, border);
137
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
138
+
139
+// if (image.getWidth() > 48 && image.getHeight() > 48)
140
+// {
141
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
142
+// Graphics2D g = resized.createGraphics();
143
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
144
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
145
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
146
+// g.dispose();
147
+//
148
+// image = resized;
149
+// }
150
+
151
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
152
+
153
+ icons.put(name, icon);
154
+
155
+ return icon;
77156 }
78157 catch (Exception e)
79158 {
80
- return new cCheckBox(name, border);
159
+ //icons.put(name, null);
160
+ return null;
81161 }
82162 }
83
-
84
- private ImageIcon GetIcon(String name) throws IOException
163
+
164
+ BufferedImage GetImage(String name)
85165 {
86
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
-
88
- if (image.getWidth() != 24 && image.getHeight() != 24)
166
+ try
89167 {
90
- BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
- Graphics2D g = resized.createGraphics();
92
- g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
- //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
- g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
- g.dispose();
96
-
97
- image = resized;
168
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
169
+
170
+ return image;
98171 }
99
-
100
- javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
- return icon;
172
+ catch (Exception e)
173
+ {
174
+ return null;
175
+ }
102176 }
103177
104178 // SCRIPT
....@@ -282,6 +356,14 @@
282356 client = inClient;
283357 copy = client;
284358
359
+// if (copy.versionlist == null)
360
+// {
361
+// copy.versionlist = new Object3D[100];
362
+// copy.versionindex = -1;
363
+//
364
+// callee.Save(true);
365
+// }
366
+
285367 // "this" is not called: SetupUI2(objEditor);
286368 }
287369
....@@ -295,6 +377,14 @@
295377 client = inClient;
296378 copy = client;
297379
380
+ if (copy.versionlist == null)
381
+ {
382
+ copy.versionlist = new Object3D[100];
383
+ copy.versionindex = -1;
384
+
385
+// Save(true);
386
+ }
387
+
298388 SetupUI2(callee.GetEditor());
299389 }
300390
....@@ -316,7 +406,8 @@
316406 //parent = p;
317407
318408 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
319
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
409
+ if (Globals.DEBUG)
410
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
320411 //gd.setFullScreenWindow(this);
321412 //setResizable(false);
322413 //if (!isDisplayable())
....@@ -327,6 +418,14 @@
327418 copy = localCopy;
328419 copy.editWindow = this;
329420
421
+// if (copy.versionlist == null)
422
+// {
423
+// copy.versionlist = new Object3D[100];
424
+// copy.versionindex = -1;
425
+//
426
+// Save(true);
427
+// }
428
+
330429 SetupMenu();
331430
332431 //SetupName(objEditor); // new
....@@ -345,6 +444,9 @@
345444
346445 static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
347446
447
+ // This is to refresh the UI of the material panel.
448
+ boolean patchMaterial;
449
+
348450 void SetupMenu()
349451 {
350452 frame.setMenuBar(menuBar = new MenuBar());
....@@ -394,6 +496,8 @@
394496
395497 ChangeListener changeListener = new ChangeListener()
396498 {
499
+ //String name;
500
+
397501 public void stateChanged(ChangeEvent changeEvent)
398502 {
399503 // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
....@@ -412,18 +516,49 @@
412516 // EditSelection(false);
413517 // }
414518
415
- 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();
416550 }
417551 };
418552 objectPanel.addChangeListener(changeListener);
419553
420554 toolbarPanel = new JPanel();
421555 toolbarPanel.setName("Toolbar");
556
+
422557 treePanel = new cGridBag();
423558 treePanel.setName("Tree");
424559
425560 editPanel = new cGridBag().setVertical(true);
426
- editPanel.setName("Edit");
561
+ //editPanel.setName("Edit");
427562
428563 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
429564
....@@ -431,11 +566,13 @@
431566 editPanel.add(editCommandsPanel);
432567 editPanel.add(ctrlPanel);
433568
434
- toolboxPanel = new cGridBag().setVertical(false);
435
- toolboxPanel.setName("Toolbox");
569
+ toolboxPanel = new cGridBag().setVertical(true);
570
+ //toolboxPanel.setName("Toolbox");
436571
437
- materialPanel = new cGridBag().setVertical(true);
438
- materialPanel.setName("Material");
572
+ skyboxPanel = new cGridBag().setVertical(true);
573
+
574
+ materialPanel = new cGridBag().setVertical(false);
575
+ //materialPanel.setName("Material");
439576
440577 /*JTextPane*/
441578 infoarea = createTextPane();
....@@ -443,6 +580,7 @@
443580
444581 infoarea.setEditable(true);
445582 SetText();
583
+
446584 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
447585 // infoarea.setOpaque(false);
448586 // //infoarea.setForeground(textcolor);
....@@ -450,7 +588,7 @@
450588 // TEXTAREA infoarea.setWrapStyleWord(true);
451589 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
452590 infoPanel.setPreferredSize(new Dimension(1, 1));
453
- infoPanel.setName("Info");
591
+ //infoPanel.setName("Info");
454592 //infoPanel.setLayout(new BorderLayout());
455593 //infoPanel.add(createTextPane());
456594
....@@ -717,6 +855,7 @@
717855 boolean maximized;
718856
719857 cButton fullscreenLayout;
858
+ cButton expandedLayout;
720859
721860 void Minimize()
722861 {
....@@ -756,10 +895,12 @@
756895 cButton minButton;
757896 cButton maxButton;
758897 cButton fullButton;
898
+ cButton collapseButton;
899
+ cButton maximize3DButton;
759900
760901 void ToggleFullScreen()
761902 {
762
-GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
903
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
763904
764905 cameraView.ToggleFullScreen();
765906
....@@ -780,13 +921,13 @@
780921 // X frame.getContentPane().remove(/*"Center",*/bigThree);
781922 // X framePanel.add(bigThree);
782923 // X frame.getContentPane().add(/*"Center",*/framePanel);
783
- framePanel.setDividerLocation(46);
924
+// framePanel.setDividerLocation(46); // icons are 24x24
784925
785926 //frame.setVisible(true);
786
- radio.layout = keepButton;
927
+// radio.layout = keepButton;
787928 //theFrame = null;
788929 keepButton = null;
789
- radio.layout.doClick();
930
+// radio.layout.doClick();
790931
791932 } else
792933 {
....@@ -807,14 +948,58 @@
807948 // X frame.getContentPane().remove(/*"Center",*/framePanel);
808949 // X framePanel.remove(bigThree);
809950 // X frame.getContentPane().add(/*"Center",*/bigThree);
810
- framePanel.setDividerLocation(0);
951
+// framePanel.setDividerLocation(0);
811952
812
- radio.layout = fullscreenLayout;
813
- radio.layout.doClick();
953
+// radio.layout = fullscreenLayout;
954
+// radio.layout.doClick();
814955 //frame.setVisible(true);
815956 }
816957 frame.validate();
958
+
959
+ cameraView.requestFocusInWindow();
817960 }
961
+
962
+ void CollapseToolbar()
963
+ {
964
+ framePanel.setDividerLocation(0);
965
+ //frame.validate();
966
+
967
+ cameraView.requestFocusInWindow();
968
+ }
969
+
970
+ private Object3D Duplicate(Object3D object)
971
+ {
972
+ boolean temp = CameraPane.SWITCH;
973
+ CameraPane.SWITCH = false;
974
+
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);
979
+ // if (copy == client)
980
+
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;
988
+
989
+ //byte[] compress = Compress(copy);
990
+ Object3D compress = (Object3D)Grafreed.clone(object);
991
+
992
+ object.parent = parent;
993
+
994
+ object.versionlist = versions;
995
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
996
+
997
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
998
+
999
+ CameraPane.SWITCH = temp;
1000
+
1001
+ return compress;
1002
+ }
8181003
8191004 private JTextPane createTextPane()
8201005 {
....@@ -937,6 +1122,7 @@
9371122 {
9381123 SetupMaterial(materialPanel);
9391124 }
1125
+
9401126 //SetupName();
9411127 //SetupViews();
9421128 }
....@@ -946,7 +1132,7 @@
9461132 // NumberSlider vDivsField;
9471133 // JCheckBox endcaps;
9481134 JCheckBox liveCB;
949
- JCheckBox selectCB;
1135
+ JCheckBox selectableCB;
9501136 JCheckBox hideCB;
9511137 JCheckBox link2masterCB;
9521138 JCheckBox markCB;
....@@ -1145,6 +1331,18 @@
11451331
11461332 namePanel = new cGridBag();
11471333
1334
+ //if (copy.pinned)
1335
+ {
1336
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
1337
+ pinButton.setSelected(copy.pinned);
1338
+ cGridBag t = new cGridBag();
1339
+ t.preferredWidth = 2;
1340
+ t.add(pinButton);
1341
+ namePanel.add(t);
1342
+
1343
+ pinButton.addItemListener(this);
1344
+ }
1345
+
11481346 nameField = AddText(namePanel, copy.GetName());
11491347 namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11501348 oe.ctrlPanel.add(namePanel);
....@@ -1158,13 +1356,16 @@
11581356
11591357 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
11601358 liveCB.setToolTipText("Animate object");
1161
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1162
- selectCB.setToolTipText("Make object selectable");
1359
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1360
+ markCB.setToolTipText("Set target transform");
1361
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1362
+ selectableCB.setToolTipText("Make object selectable");
11631363 // Return();
1364
+
11641365 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11651366 hideCB.setToolTipText("Hide object");
1166
- markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1167
- markCB.setToolTipText("As animation target transform");
1367
+
1368
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
11681369
11691370 setupPanel2 = new cGridBag().setVertical(false);
11701371
....@@ -1364,22 +1565,9 @@
13641565
13651566 if (cam == null || !(copy.get(0) instanceof cGroup))
13661567 {
1367
- System.out.println("CREATE CAMERAS");
1368
- cams = new cTemplate();
1369
- cams.name = "Cameras";
1370
- copy.insertElementAt(cams, 0);
1371
- //cams.parent = copy;
1372
-
1373
- cam = new Camera(); // LA.newVector(3, 2, 1));
1374
- cams.addChild(cam);
1375
- cam = new Camera(1);
1376
- cams.addChild(cam);
1377
- cam = new Camera(2);
1378
- cams.addChild(cam);
1379
- cam = new Camera(3);
1380
- cams.addChild(cam);
1381
- cam = new Camera(4); // Light
1382
- cams.addChild(cam);
1568
+ if (Globals.DEBUG)
1569
+ System.out.println("CREATE CAMERAS");
1570
+ cams = CreateCameras();
13831571 } else
13841572 {
13851573 cams = (cGroup) copy.get(0);
....@@ -1445,6 +1633,45 @@
14451633 //frontView.object = copy;
14461634 //sideView.object = copy;
14471635
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
+
14481675 XYZPanel = new cGridBag().setVertical(true);
14491676 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
14501677
....@@ -1452,7 +1679,11 @@
14521679 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
14531680 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
14541681 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1682
+ //XYZPanel.setName("XYZ");
14551683
1684
+ transformPanel.add(resetTransformPanel);
1685
+ transformPanel.add(XYZPanel);
1686
+
14561687 /*
14571688 gridPanel = new JPanel(); //new BorderLayout());
14581689 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1460,12 +1691,12 @@
14601691 gridPanel.add(cameraView);
14611692 gridPanel.add(XYZPanel);
14621693 */
1463
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1464
- gridPanel.setContinuousLayout(true);
1465
- gridPanel.setOneTouchExpandable(true);
1466
- gridPanel.setDividerLocation(1.0);
1467
- gridPanel.setDividerSize(9);
1468
- 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);
14691700
14701701 // aConstraints.weighty = 0;
14711702 //System.out.println("THIS = " + this);
....@@ -1488,18 +1719,34 @@
14881719
14891720 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14901721 //tmp.setName("Edit");
1722
+ objectPanel.add(skyboxPanel);
1723
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1724
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1725
+
1726
+ objectPanel.add(toolboxPanel);
1727
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1728
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1729
+
14911730 objectPanel.add(materialPanel);
1731
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1732
+ objectPanel.setToolTipTextAt(2, "Material");
1733
+
14921734 // JPanel north = new JPanel(new BorderLayout());
14931735 // north.setName("Edit");
14941736 // north.add(ctrlPanel, BorderLayout.NORTH);
14951737 // objectPanel.add(north);
14961738 objectPanel.add(editPanel);
1739
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
1740
+ objectPanel.setToolTipTextAt(3, "Edit controls");
14971741
1498
- //if (Globals.ADVANCED)
1499
- objectPanel.add(infoPanel);
1742
+ objectPanel.add(transformPanel);
1743
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1744
+ objectPanel.setToolTipTextAt(4, "TRS transform");
15001745
1501
- objectPanel.add(toolboxPanel);
1502
-
1746
+ patchMaterial = true;
1747
+ cameraView.patchMaterial = this;
1748
+ objectPanel.setSelectedIndex(2);
1749
+
15031750 /*
15041751 aConstraints.gridx = 0;
15051752 aConstraints.gridwidth = 1;
....@@ -1530,11 +1777,51 @@
15301777
15311778 AddOptions(optionsPanel); //, aConstraints);
15321779
1533
- tabbedPane.add(optionsPanel);
1534
-
15351780 tabbedPane.add(FSPane = new cFileSystemPane(this));
15361781
1782
+ tabbedPane.add(optionsPanel);
1783
+
15371784 scenePanel.add(tabbedPane);
1785
+
1786
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1787
+ creditsPanel.setName("Credits");
1788
+
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
+ }
15381825
15391826 /*
15401827 cTree jTree = new cTree(null);
....@@ -1556,13 +1843,13 @@
15561843 jtp.add(tree);
15571844 */
15581845
1559
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1560
- bigPanel.setContinuousLayout(true);
1561
- bigPanel.setOneTouchExpandable(true);
1562
- bigPanel.setDividerLocation(0.8);
1563
- bigPanel.setDividerSize(15);
1564
- bigPanel.setResizeWeight(0.15);
1565
- 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");
15661853
15671854 //bigPanel.setLayout(new BorderLayout());
15681855 //bigPanel.setSize(new Dimension(10,10));
....@@ -1597,7 +1884,7 @@
15971884 bigThree = new cGridBag();
15981885 bigThree.addComponent(scenePanel);
15991886 bigThree.addComponent(centralPanel);
1600
- bigThree.addComponent(XYZPanel);
1887
+ //bigThree.addComponent(XYZPanel);
16011888
16021889 // // SIDE EFFECT!!!
16031890 // aConstraints.gridx = 0;
....@@ -1606,6 +1893,23 @@
16061893 // aConstraints.gridheight = 1;
16071894
16081895 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
+
16091913 framePanel.setContinuousLayout(false);
16101914 framePanel.setOneTouchExpandable(false);
16111915 //.setDividerLocation(0.8);
....@@ -1615,7 +1919,7 @@
16151919
16161920 frame.getContentPane().setLayout(new BorderLayout());
16171921 /**/
1618
- JTabbedPane worldPane = new JTabbedPane();
1922
+ //JTabbedPane worldPane = new JTabbedPane();
16191923 //worldPane.add(bigPanel);
16201924 //worldPane.add(worldPanel);
16211925 /**/
....@@ -1629,7 +1933,7 @@
16291933
16301934 cameraView.requestFocusInWindow();
16311935
1632
- gridPanel.setDividerLocation(1.0);
1936
+// gridPanel.setDividerLocation(1.0);
16331937
16341938 frame.validate();
16351939
....@@ -1638,7 +1942,6 @@
16381942 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16391943 frame.addWindowListener(new WindowAdapter()
16401944 {
1641
-
16421945 public void windowClosing(WindowEvent e)
16431946 {
16441947 Close();
....@@ -1661,28 +1964,442 @@
16611964 ctrlPanel.removeAll();
16621965 }
16631966
1664
- void SetupMaterial(cGridBag panel)
1967
+ void SetupMaterial(cGridBag materialpanel)
16651968 {
1666
- /*
1969
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1970
+
1971
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
1972
+ skin.setToolTipText("Skin");
1973
+ skin.addMouseListener(new MouseAdapter()
1974
+ {
1975
+ public void mouseClicked(MouseEvent e)
1976
+ {
1977
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1978
+ cMaterial material = object.material;
1979
+
1980
+ // Skin
1981
+ colorField.setFloat(material.color);
1982
+ float saturation = material.modulation;
1983
+
1984
+ if (!cameraView.Skinshader)
1985
+ {
1986
+ saturation /= 1.5;
1987
+ }
1988
+
1989
+ saturationField.setFloat(saturation);
1990
+
1991
+ subsurfaceField.setFloat(material.subsurface);
1992
+ selfshadowField.setFloat(material.diffuseness);
1993
+ diffusenessField.setFloat(material.factor);
1994
+ shininessField.setFloat(material.shininess);
1995
+ shadowbiasField.setFloat(material.shadowbias);
1996
+ diffuseField.setFloat(material.diffuse);
1997
+ specularField.setFloat(material.specular);
1998
+
1999
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2000
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2001
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2002
+
2003
+ materialtouched = true;
2004
+ applySelf();
2005
+ }
2006
+ });
2007
+ presetpanel.add(skin);
2008
+
2009
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
2010
+ lambert.setToolTipText("Diffuse");
2011
+ lambert.addMouseListener(new MouseAdapter()
2012
+ {
2013
+ public void mouseClicked(MouseEvent e)
2014
+ {
2015
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
2016
+ cMaterial material = object.material;
2017
+
2018
+ diffusenessField.setFloat(material.factor);
2019
+ selfshadowField.setFloat(material.diffuseness);
2020
+
2021
+ materialtouched = true;
2022
+ applySelf();
2023
+ }
2024
+ });
2025
+ presetpanel.add(lambert);
2026
+
2027
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
2028
+ diffuse2.setToolTipText("Diffuse2");
2029
+ diffuse2.addMouseListener(new MouseAdapter()
2030
+ {
2031
+ public void mouseClicked(MouseEvent e)
2032
+ {
2033
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
2034
+ cMaterial material = object.material;
2035
+
2036
+ diffusenessField.setFloat(material.factor);
2037
+ selfshadowField.setFloat(material.diffuseness);
2038
+
2039
+ materialtouched = true;
2040
+ applySelf();
2041
+ }
2042
+ });
2043
+ presetpanel.add(diffuse2);
2044
+
2045
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
2046
+ diffusemoon.setToolTipText("Moon");
2047
+ diffusemoon.addMouseListener(new MouseAdapter()
2048
+ {
2049
+ public void mouseClicked(MouseEvent e)
2050
+ {
2051
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
2052
+ cMaterial material = object.material;
2053
+
2054
+ diffusenessField.setFloat(material.factor);
2055
+ selfshadowField.setFloat(material.diffuseness);
2056
+
2057
+ materialtouched = true;
2058
+ applySelf();
2059
+ }
2060
+ });
2061
+ presetpanel.add(diffusemoon);
2062
+
2063
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
2064
+ diffusemoon2.setToolTipText("Moon2");
2065
+ diffusemoon2.addMouseListener(new MouseAdapter()
2066
+ {
2067
+ public void mouseClicked(MouseEvent e)
2068
+ {
2069
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
2070
+ cMaterial material = object.material;
2071
+
2072
+ diffusenessField.setFloat(material.factor);
2073
+ selfshadowField.setFloat(material.diffuseness);
2074
+
2075
+ materialtouched = true;
2076
+ applySelf();
2077
+ }
2078
+ });
2079
+ presetpanel.add(diffusemoon2);
2080
+
2081
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
2082
+ diffusemoon3.setToolTipText("Moon3");
2083
+ diffusemoon3.addMouseListener(new MouseAdapter()
2084
+ {
2085
+ public void mouseClicked(MouseEvent e)
2086
+ {
2087
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
2088
+ cMaterial material = object.material;
2089
+
2090
+ diffusenessField.setFloat(material.factor);
2091
+ selfshadowField.setFloat(material.diffuseness);
2092
+
2093
+ materialtouched = true;
2094
+ applySelf();
2095
+ }
2096
+ });
2097
+ presetpanel.add(diffusemoon3);
2098
+
2099
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
2100
+ diffusesheen.setToolTipText("Sheen");
2101
+ diffusesheen.addMouseListener(new MouseAdapter()
2102
+ {
2103
+ public void mouseClicked(MouseEvent e)
2104
+ {
2105
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
2106
+ cMaterial material = object.material;
2107
+
2108
+ sheenField.setFloat(material.sheen);
2109
+
2110
+ materialtouched = true;
2111
+ applySelf();
2112
+ }
2113
+ });
2114
+ presetpanel.add(diffusesheen);
2115
+
2116
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
2117
+ rough.setToolTipText("Rough metal");
2118
+ rough.addMouseListener(new MouseAdapter()
2119
+ {
2120
+ public void mouseClicked(MouseEvent e)
2121
+ {
2122
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
2123
+ cMaterial material = object.material;
2124
+
2125
+ shininessField.setFloat(material.shininess);
2126
+ velvetField.setFloat(material.velvet);
2127
+
2128
+ materialtouched = true;
2129
+ applySelf();
2130
+ }
2131
+ });
2132
+ presetpanel.add(rough);
2133
+
2134
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
2135
+ rough2.setToolTipText("Medium metal");
2136
+ rough2.addMouseListener(new MouseAdapter()
2137
+ {
2138
+ public void mouseClicked(MouseEvent e)
2139
+ {
2140
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2141
+ cMaterial material = object.material;
2142
+
2143
+ shininessField.setFloat(material.shininess);
2144
+ lightareaField.setFloat(material.lightarea);
2145
+
2146
+ materialtouched = true;
2147
+ applySelf();
2148
+ }
2149
+ });
2150
+ presetpanel.add(rough2);
2151
+
2152
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
2153
+ shini0.setToolTipText("Shiny");
2154
+ shini0.addMouseListener(new MouseAdapter()
2155
+ {
2156
+ public void mouseClicked(MouseEvent e)
2157
+ {
2158
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2159
+ cMaterial material = object.material;
2160
+
2161
+ shininessField.setFloat(material.shininess);
2162
+ lightareaField.setFloat(material.lightarea);
2163
+
2164
+ materialtouched = true;
2165
+ applySelf();
2166
+ }
2167
+ });
2168
+ presetpanel.add(shini0);
2169
+
2170
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
2171
+ shini1.setToolTipText("Shiny2");
2172
+ shini1.addMouseListener(new MouseAdapter()
2173
+ {
2174
+ public void mouseClicked(MouseEvent e)
2175
+ {
2176
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2177
+ cMaterial material = object.material;
2178
+
2179
+ shininessField.setFloat(material.shininess);
2180
+ lightareaField.setFloat(material.lightarea);
2181
+
2182
+ materialtouched = true;
2183
+ applySelf();
2184
+ }
2185
+ });
2186
+ presetpanel.add(shini1);
2187
+
2188
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
2189
+ shini2.setToolTipText("Shiny3");
2190
+ shini2.addMouseListener(new MouseAdapter()
2191
+ {
2192
+ public void mouseClicked(MouseEvent e)
2193
+ {
2194
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2195
+ cMaterial material = object.material;
2196
+
2197
+ shininessField.setFloat(material.shininess);
2198
+ lightareaField.setFloat(material.lightarea);
2199
+
2200
+ materialtouched = true;
2201
+ applySelf();
2202
+ }
2203
+ });
2204
+ presetpanel.add(shini2);
2205
+
2206
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
2207
+ aniso.setToolTipText("AnisoU");
2208
+ aniso.addMouseListener(new MouseAdapter()
2209
+ {
2210
+ public void mouseClicked(MouseEvent e)
2211
+ {
2212
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2213
+ cMaterial material = object.material;
2214
+
2215
+ anisoField.setFloat(material.aniso);
2216
+ anisoVField.setFloat(material.anisoV);
2217
+
2218
+ materialtouched = true;
2219
+ applySelf();
2220
+ }
2221
+ });
2222
+ presetpanel.add(aniso);
2223
+
2224
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
2225
+ aniso2.setToolTipText("AnisoV");
2226
+ aniso2.addMouseListener(new MouseAdapter()
2227
+ {
2228
+ public void mouseClicked(MouseEvent e)
2229
+ {
2230
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2231
+ cMaterial material = object.material;
2232
+
2233
+ anisoField.setFloat(material.aniso);
2234
+ anisoVField.setFloat(material.anisoV);
2235
+
2236
+ materialtouched = true;
2237
+ applySelf();
2238
+ }
2239
+ });
2240
+ presetpanel.add(aniso2);
2241
+
2242
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
2243
+ aniso3.setToolTipText("AnisoUV");
2244
+ aniso3.addMouseListener(new MouseAdapter()
2245
+ {
2246
+ public void mouseClicked(MouseEvent e)
2247
+ {
2248
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2249
+ cMaterial material = object.material;
2250
+
2251
+ anisoField.setFloat(material.aniso);
2252
+ anisoVField.setFloat(material.anisoV);
2253
+
2254
+ materialtouched = true;
2255
+ applySelf();
2256
+ }
2257
+ });
2258
+ presetpanel.add(aniso3);
2259
+
2260
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
2261
+ velvet0.setToolTipText("Velvet");
2262
+ velvet0.addMouseListener(new MouseAdapter()
2263
+ {
2264
+ public void mouseClicked(MouseEvent e)
2265
+ {
2266
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2267
+ cMaterial material = object.material;
2268
+
2269
+ diffusenessField.setFloat(material.factor);
2270
+ selfshadowField.setFloat(material.diffuseness);
2271
+ sheenField.setFloat(material.sheen);
2272
+ shininessField.setFloat(material.shininess);
2273
+ velvetField.setFloat(material.velvet);
2274
+ shiftField.setFloat(material.shift);
2275
+
2276
+ materialtouched = true;
2277
+ applySelf();
2278
+ }
2279
+ });
2280
+ presetpanel.add(velvet0);
2281
+
2282
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
2283
+ bump0.setToolTipText("Bump texture");
2284
+ bump0.addMouseListener(new MouseAdapter()
2285
+ {
2286
+ public void mouseClicked(MouseEvent e)
2287
+ {
2288
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2289
+ cMaterial material = object.material;
2290
+
2291
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2292
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2293
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2294
+
2295
+ materialtouched = true;
2296
+ applySelf();
2297
+ }
2298
+ });
2299
+ presetpanel.add(bump0);
2300
+
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);
2317
+ halo.setToolTipText("Halo");
2318
+ halo.addMouseListener(new MouseAdapter()
2319
+ {
2320
+ public void mouseClicked(MouseEvent e)
2321
+ {
2322
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2323
+ cMaterial material = object.material;
2324
+
2325
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2326
+
2327
+ materialtouched = true;
2328
+ applySelf();
2329
+ }
2330
+ });
2331
+ presetpanel.add(halo);
2332
+
2333
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
2334
+ candle.setToolTipText("Candle");
2335
+ candle.addMouseListener(new MouseAdapter()
2336
+ {
2337
+ public void mouseClicked(MouseEvent e)
2338
+ {
2339
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2340
+ cMaterial material = object.material;
2341
+
2342
+ subsurfaceField.setFloat(material.subsurface);
2343
+ shadowbiasField.setFloat(material.shadowbias);
2344
+ ambientField.setFloat(material.ambient);
2345
+ specularField.setFloat(material.specular);
2346
+ lightareaField.setFloat(material.lightarea);
2347
+ shininessField.setFloat(material.shininess);
2348
+
2349
+ materialtouched = true;
2350
+ applySelf();
2351
+ }
2352
+ });
2353
+ presetpanel.add(candle);
2354
+
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
+
2374
+ cGridBag panel = new cGridBag().setVertical(true);
2375
+
2376
+ presetpanel.preferredWidth = 1;
2377
+
2378
+ materialpanel.add(presetpanel);
2379
+ materialpanel.add(panel);
2380
+
2381
+ panel.preferredWidth = 8;
2382
+
2383
+ /*
16672384 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
16682385 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1669
- */
2386
+ */
16702387
16712388 cGridBag editBar = new cGridBag().setVertical(false);
16722389
1673
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2390
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
16742391 createMaterialButton.setToolTipText("Create material");
16752392
16762393 /*
16772394 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
16782395 */
16792396
1680
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2397
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
16812398 clearMaterialButton.setToolTipText("Clear material");
16822399
16832400 if (Globals.ADVANCED)
16842401 {
1685
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2402
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
16862403 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
16872404 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
16882405 }
....@@ -1700,27 +2417,61 @@
17002417 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17012418
17022419 cGridBag colorSection = new cGridBag().setVertical(true);
2420
+
2421
+ cGridBag huepanel = new cGridBag();
2422
+ cGridBag huelabel = new cGridBag();
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);
2437
+ huelabel.preferredWidth = 20;
2438
+ huepanel.add(new cGridBag()); // Label
2439
+ huepanel.add(huelabel); // Field/slider
2440
+
2441
+ huepanel.preferredHeight = 7;
2442
+
2443
+ colorSection.add(huepanel);
17032444
17042445 cGridBag color = new cGridBag();
1705
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1706
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1707
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2446
+
2447
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2448
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2449
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2450
+
17082451 //colorField.preferredWidth = 200;
17092452 colorSection.add(color);
17102453
17112454 cGridBag modulation = new cGridBag();
17122455 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
17132456 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1714
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2457
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
17152458 colorSection.add(modulation);
17162459
2460
+ cGridBag opacity = new cGridBag();
2461
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2462
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2463
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2464
+ colorSection.add(opacity);
2465
+
2466
+ colorSection.add(GetSeparator());
2467
+
17172468 cGridBag texture = new cGridBag();
17182469 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
17192470 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17202471 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
17212472 colorSection.add(texture);
17222473
1723
- panel.add(new JSeparator());
2474
+ panel.add(GetSeparator());
17242475
17252476 panel.add(colorSection);
17262477
....@@ -1776,7 +2527,7 @@
17762527 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
17772528 diffuseSection.add(shadowbias);
17782529
1779
- panel.add(new JSeparator());
2530
+ panel.add(GetSeparator());
17802531
17812532 panel.add(diffuseSection);
17822533
....@@ -1839,7 +2590,7 @@
18392590 specularSection.add(anisoV);
18402591
18412592
1842
- panel.add(new JSeparator());
2593
+ panel.add(GetSeparator());
18432594
18442595 panel.add(specularSection);
18452596
....@@ -1864,12 +2615,6 @@
18642615 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18652616 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
18662617 colorSection.add(backlit);
1867
-
1868
- cGridBag opacity = new cGridBag();
1869
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1870
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1871
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1872
- colorSection.add(opacity);
18732618
18742619 //panel.add(new JSeparator());
18752620
....@@ -1915,7 +2660,7 @@
19152660 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
19162661 textureSection.add(opacityPower);
19172662
1918
- panel.add(new JSeparator());
2663
+ panel.add(GetSeparator());
19192664
19202665 panel.add(textureSection);
19212666
....@@ -2902,7 +3647,7 @@
29023647
29033648 freezematerial = true;
29043649 colorField.setFloat(mat.color);
2905
- modulationField.setFloat(mat.modulation);
3650
+ saturationField.setFloat(mat.modulation);
29063651 metalnessField.setFloat(mat.metalness);
29073652 diffuseField.setFloat(mat.diffuse);
29083653 specularField.setFloat(mat.specular);
....@@ -2964,32 +3709,8 @@
29643709
29653710 if (multiplyToggle != null)
29663711 multiplyToggle.setSelected(mat.multiply);
2967
-
2968
- assert (object.projectedVertices != null);
2969
-
2970
- if (object.projectedVertices.length <= 2)
2971
- {
2972
- // Side effect...
2973
- Object3D.cVector2[] keep = object.projectedVertices;
2974
- object.projectedVertices = new Object3D.cVector2[3];
2975
- for (int i = 0; i < 3; i++)
2976
- {
2977
- if (i < keep.length)
2978
- {
2979
- object.projectedVertices[i] = keep[i];
2980
- } else
2981
- {
2982
- object.projectedVertices[i] = new Object3D.cVector2();
2983
- }
2984
- /*
2985
- if(keep.length == 0)
2986
- object.projectedVertices[0] = new Object3D.cVector2();
2987
- else
2988
- object.projectedVertices[0] = keep[0];
2989
- object.projectedVertices[1] = new Object3D.cVector2();
2990
- */
2991
- }
2992
- }
3712
+
3713
+ AllocProjectedVertices(object);
29933714
29943715 SetMaterial(mat, object.projectedVertices);
29953716 }
....@@ -3109,6 +3830,17 @@
31093830 public void itemStateChanged(ItemEvent event)
31103831 {
31113832 // System.out.println("Propagate = " + propagate);
3833
+ if (event.getSource() == pinButton)
3834
+ {
3835
+ copy.pinned ^= true;
3836
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3837
+ {
3838
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3839
+ copy.CloseUI();
3840
+ //copy.editWindow.refreshContents();
3841
+ }
3842
+ }
3843
+ else
31123844 if (event.getSource() == propagateToggle)
31133845 {
31143846 propagate ^= true;
....@@ -3213,8 +3945,9 @@
32133945 } else if (event.getSource() == liveCB)
32143946 {
32153947 copy.live ^= true;
3948
+ objEditor.refreshContents(true); // To show item colors
32163949 return;
3217
- } else if (event.getSource() == selectCB)
3950
+ } else if (event.getSource() == selectableCB)
32183951 {
32193952 copy.dontselect ^= true;
32203953 return;
....@@ -3222,7 +3955,7 @@
32223955 {
32233956 copy.hide ^= true;
32243957 copy.Touch(); // display list issue
3225
- objEditor.refreshContents();
3958
+ objEditor.refreshContents(true); // To show item colors
32263959 return;
32273960 } else if (event.getSource() == link2masterCB)
32283961 {
....@@ -3287,7 +4020,7 @@
32874020 //System.out.println("ObjEditor " + event);
32884021 applySelf0(true);
32894022 //parent.applySelf();
3290
- objEditor.refreshContents();
4023
+ // conflicts with requestFocus objEditor.refreshContents();
32914024 } else if (source == resetButton)
32924025 {
32934026 CameraPane.fullreset = true;
....@@ -3467,17 +4200,25 @@
34674200
34684201 void New()
34694202 {
3470
- while (copy.Size() > 1)
4203
+ while (copy.Size() > 0)
34714204 {
3472
- copy.remove(1);
4205
+ copy.remove(0);
34734206 }
34744207
4208
+ copy.selection.clear();
4209
+
4210
+ if (copy == Grafreed.grafreed.universe)
4211
+ {
4212
+ CreateCameras();
4213
+ cameraView.SetCamera(GetCamera(copy, 0));
4214
+ }
34754215 ResetModel();
34764216 objEditor.refreshContents();
34774217 }
34784218
34794219 static public byte[] Compress(Object3D o)
34804220 {
4221
+ // Slower to actually compress.
34814222 try
34824223 {
34834224 ByteArrayOutputStream baos = new ByteArrayOutputStream();
....@@ -3574,11 +4315,12 @@
35744315 return null;
35754316 }
35764317
3577
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
35784318
35794319 public void Save()
35804320 {
3581
- Save(true);
4321
+ //Save(true);
4322
+ Replace();
4323
+ SetVersionStates();
35824324 }
35834325
35844326 private boolean Equal(byte[] compress, byte[] name)
....@@ -3597,59 +4339,73 @@
35974339 return true;
35984340 }
35994341
4342
+ void DeleteVersion()
4343
+ {
4344
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4345
+ {
4346
+ copy.versionlist[i] = copy.versionlist[i+1];
4347
+ }
4348
+
4349
+ if (copy.versionlist[copy.versionindex] == null)
4350
+ copy.versionindex -= 1;
4351
+
4352
+ if (copy.versionindex != -1)
4353
+ CopyChanged();
4354
+
4355
+ SetVersionStates();
4356
+ }
4357
+
36004358 public boolean Save(boolean user)
36014359 {
36024360 System.err.println("Save");
4361
+ Replace();
36034362
3604
- cRadio tab = GetCurrentTab();
4363
+ //cRadio tab = GetCurrentTab();
36054364
3606
- boolean temp = CameraPane.SWITCH;
3607
- CameraPane.SWITCH = false;
3608
-
3609
- copy.ExtractBigData(hashtable);
3610
-
3611
- byte[] compress = Compress(copy);
3612
-
3613
- CameraPane.SWITCH = temp;
4365
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
36144366
36154367 boolean thesame = false;
36164368
3617
- // Quick heuristic using length. Works only when stream is compressed.
3618
- if (tab.undoindex > 0 && tab.graphs[tab.undoindex-1] != null && Equal(compress, tab.graphs[tab.undoindex-1]))
3619
- {
3620
- thesame = true;
3621
- }
4369
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4370
+// {
4371
+// thesame = true;
4372
+// }
36224373
36234374 //EditorFrame.m_MainFrame.requestFocusInWindow();
36244375 if (!thesame)
36254376 {
3626
- //tab.user[tab.undoindex] = user;
3627
- boolean increment = tab.graphs[tab.undoindex] == null;
4377
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4378
+ {
4379
+ copy.versionlist[i] = copy.versionlist[i-1];
4380
+ }
36284381
3629
- tab.graphs[tab.undoindex] = compress;
4382
+ //tab.user[tab.versionindex] = user;
4383
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
36304384
3631
- if (increment)
3632
- tab.undoindex++;
4385
+ copy.versionlist[++copy.versionindex] = compress;
4386
+
4387
+ // if (increment)
4388
+ // tab.versionindex++;
36334389 }
36344390
3635
- copy.RestoreBigData(hashtable);
4391
+ //copy.RestoreBigData(versiontable);
36364392
36374393 //assert(hashtable.isEmpty());
36384394
3639
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3640
- {
3641
- //tab.user[i] = false;
3642
- // tab.graphs[i] = null;
3643
- }
4395
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4396
+// {
4397
+// //tab.user[i] = false;
4398
+// copy.versionlist[i] = null;
4399
+// }
36444400
3645
- SetUndoStates();
4401
+ SetVersionStates();
36464402
36474403 // test save
36484404 if (false)
36494405 {
36504406 try
36514407 {
3652
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
4408
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
36534409 ObjectOutputStream p = new ObjectOutputStream(ostream);
36544410
36554411 p.writeObject(copy);
....@@ -3665,27 +4421,65 @@
36654421
36664422 return !thesame;
36674423 }
3668
-
3669
- void CopyChanged(Object3D obj)
4424
+
4425
+ boolean flashIt = true;
4426
+
4427
+ void RefreshSelection()
36704428 {
3671
- SetUndoStates();
4429
+ Object3D selection = new Object3D();
4430
+
4431
+ for (int i = 0; i < copy.selection.size(); i++)
4432
+ {
4433
+ Object3D elem = copy.selection.elementAt(i);
4434
+
4435
+ Object3D obj = copy.GetObject(elem.GetUUID());
4436
+
4437
+ if (obj == null)
4438
+ {
4439
+ copy.selection.remove(i--);
4440
+ }
4441
+ else
4442
+ {
4443
+ selection.add(obj);
4444
+ copy.selection.setElementAt(obj, i);
4445
+ }
4446
+ }
4447
+
4448
+ flashIt = false;
4449
+ GetTree().clearSelection();
4450
+ for (int i = 0; i < selection.size(); i++)
4451
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4452
+ flashIt = true;
4453
+
4454
+ //refreshContents(false);
4455
+ }
4456
+
4457
+ void CopyChanged()
4458
+ {
4459
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4460
+
4461
+ SetVersionStates();
36724462
36734463 boolean temp = CameraPane.SWITCH;
36744464 CameraPane.SWITCH = false;
36754465
3676
- copy.ExtractBigData(hashtable);
4466
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
36774467
36784468 copy.clear();
36794469
4470
+ copy.skyboxname = obj.skyboxname;
4471
+ copy.skyboxext = obj.skyboxext;
4472
+
36804473 for (int i=0; i<obj.Size(); i++)
36814474 {
36824475 copy.add(obj.get(i));
36834476 }
36844477
3685
- copy.RestoreBigData(hashtable);
4478
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
36864479
36874480 CameraPane.SWITCH = temp;
36884481
4482
+ RefreshSelection();
36894483 //assert(hashtable.isEmpty());
36904484
36914485 copy.Touch();
....@@ -3706,68 +4500,161 @@
37064500 }
37074501 }
37084502
3709
- refreshContents();
4503
+ refreshContents(true);
37104504 }
37114505
3712
- cButton undoButton;
3713
- cButton redoButton;
4506
+ cButton previousVersionButton;
4507
+ cButton restoreButton;
4508
+ cButton replaceButton;
4509
+ cButton nextVersionButton;
4510
+ cButton saveVersionButton;
4511
+ cButton deleteVersionButton;
37144512
3715
- void SetUndoStates()
4513
+ boolean muteSlider;
4514
+
4515
+ int VersionCount()
37164516 {
3717
- cRadio tab = GetCurrentTab();
4517
+ int count = 0;
37184518
3719
- undoButton.setEnabled(tab.undoindex > 0);
3720
- redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
4519
+ for (int i = copy.versionlist.length; --i >= 0;)
4520
+ {
4521
+ if (copy.versionlist[i] != null)
4522
+ count++;
4523
+ }
4524
+
4525
+ return count;
37214526 }
37224527
3723
- public boolean Undo()
4528
+ public cGridBag versionSliderPane;
4529
+
4530
+ void SetVersionStates()
37244531 {
4532
+ //if (true)
4533
+ // return;
4534
+
4535
+ //cRadio tab = GetCurrentTab();
4536
+
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
+ }
4567
+ }
4568
+
4569
+ public boolean PreviousVersion()
4570
+ {
4571
+ // Option?
4572
+ Replace();
4573
+
37254574 System.err.println("Undo");
37264575
3727
- cRadio tab = GetCurrentTab();
4576
+ //cRadio tab = GetCurrentTab();
37284577
3729
- if (tab.undoindex == 0)
4578
+ if (copy.versionindex == 0)
37304579 {
37314580 java.awt.Toolkit.getDefaultToolkit().beep();
37324581 return false;
37334582 }
37344583
3735
- if (tab.graphs[tab.undoindex] == null) // || !tab.user[tab.undoindex])
3736
- {
3737
- if (Save(false))
3738
- tab.undoindex -= 1;
3739
- else
3740
- {
3741
- if (tab.undoindex <= 0)
3742
- return false;
3743
- else
3744
- tab.undoindex -= 1;
3745
- }
3746
- }
4584
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4585
+// {
4586
+// if (Save(false))
4587
+// tab.versionindex -= 1;
4588
+// else
4589
+// {
4590
+// if (tab.versionindex <= 0)
4591
+// return false;
4592
+// else
4593
+// tab.versionindex -= 1;
4594
+// }
4595
+// }
37474596
3748
- tab.undoindex -= 1;
4597
+ copy.versionindex -= 1;
37494598
3750
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4599
+ CopyChanged();
37514600
37524601 return true;
37534602 }
37544603
3755
- public void Redo()
4604
+ public boolean Restore()
37564605 {
3757
- cRadio tab = GetCurrentTab();
4606
+ System.err.println("Restore");
37584607
3759
- if (tab.graphs[tab.undoindex + 1] == null)
4608
+ //cRadio tab = GetCurrentTab();
4609
+
4610
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4611
+ {
4612
+ java.awt.Toolkit.getDefaultToolkit().beep();
4613
+ return false;
4614
+ }
4615
+
4616
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4617
+ CopyChanged();
4618
+
4619
+ return true;
4620
+ }
4621
+
4622
+ public boolean Replace()
4623
+ {
4624
+ //System.err.println("Replace");
4625
+
4626
+ //cRadio tab = GetCurrentTab();
4627
+
4628
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4629
+ {
4630
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4631
+ return false;
4632
+ }
4633
+
4634
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4635
+
4636
+ return true;
4637
+ }
4638
+
4639
+ public void NextVersion()
4640
+ {
4641
+ // Option?
4642
+ Replace();
4643
+
4644
+ //cRadio tab = GetCurrentTab();
4645
+
4646
+ if (copy.versionlist[copy.versionindex + 1] == null)
37604647 {
37614648 java.awt.Toolkit.getDefaultToolkit().beep();
37624649 return;
37634650 }
37644651
3765
- tab.undoindex += 1;
4652
+ copy.versionindex += 1;
37664653
3767
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4654
+ CopyChanged();
37684655
3769
- //if (!tab.user[tab.undoindex])
3770
- // tab.graphs[tab.undoindex] = null;
4656
+ //if (!tab.user[tab.versionindex])
4657
+ // tab.graphs[tab.versionindex] = null;
37714658 }
37724659
37734660 void ImportGFD()
....@@ -3961,6 +4848,12 @@
39614848 // else
39624849 // applySelf(true);
39634850 // }
4851
+
4852
+ boolean Equal(double a, double b)
4853
+ {
4854
+ return Math.abs(a - b) < 0.001;
4855
+ }
4856
+
39644857 void applySelf0(boolean name)
39654858 {
39664859 if (name)
....@@ -3978,7 +4871,7 @@
39784871 //copy.material = new cMaterial(copy.GetMaterial());
39794872
39804873 current.color = (float) colorField.getFloat();
3981
- current.modulation = (float) modulationField.getFloat();
4874
+ current.modulation = (float) saturationField.getFloat();
39824875 current.metalness = (float) metalnessField.getFloat();
39834876 current.diffuse = (float) diffuseField.getFloat();
39844877 current.specular = (float) specularField.getFloat();
....@@ -4010,29 +4903,52 @@
40104903 {
40114904 cMaterial mat = copy.material;
40124905
4013
- colorField.SetToolTipValue((mat.color));
4014
- modulationField.SetToolTipValue((mat.modulation));
4015
- metalnessField.SetToolTipValue((mat.metalness));
4016
- diffuseField.SetToolTipValue((mat.diffuse));
4017
- specularField.SetToolTipValue((mat.specular));
4018
- shininessField.SetToolTipValue((mat.shininess));
4019
- shiftField.SetToolTipValue((mat.shift));
4020
- ambientField.SetToolTipValue((mat.ambient));
4021
- lightareaField.SetToolTipValue((mat.lightarea));
4022
- diffusenessField.SetToolTipValue((mat.factor));
4023
- velvetField.SetToolTipValue((mat.velvet));
4024
- sheenField.SetToolTipValue((mat.sheen));
4025
- subsurfaceField.SetToolTipValue((mat.subsurface));
4026
- backlitField.SetToolTipValue((mat.bump));
4027
- anisoField.SetToolTipValue((mat.aniso));
4028
- anisoVField.SetToolTipValue((mat.anisoV));
4029
- cameraField.SetToolTipValue((mat.cameralight));
4030
- selfshadowField.SetToolTipValue((mat.diffuseness));
4031
- shadowField.SetToolTipValue((mat.shadow));
4032
- textureField.SetToolTipValue((mat.texture));
4033
- opacityField.SetToolTipValue((mat.opacity));
4034
- fakedepthField.SetToolTipValue((mat.fakedepth));
4035
- 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));
40364952 }
40374953
40384954 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -4063,9 +4979,28 @@
40634979 //copy.Touch();
40644980 }
40654981
4982
+ cNumberSlider versionSlider;
4983
+
40664984 public void stateChanged(ChangeEvent e)
40674985 {
4068
- // assert(false);
4986
+ // assert(false);
4987
+ if (e.getSource() == versionSlider)
4988
+ {
4989
+ if (muteSlider)
4990
+ return;
4991
+
4992
+ Replace();
4993
+
4994
+ int version = versionSlider.getInteger();
4995
+
4996
+ if (version != -1 && copy.versionlist[version] != null)
4997
+ {
4998
+ copy.versionindex = version;
4999
+ CopyChanged();
5000
+ }
5001
+
5002
+ return;
5003
+ }
40695004
40705005 if (freezematerial)
40715006 {
....@@ -4101,6 +5036,12 @@
41015036 {
41025037 //System.out.println("stateChanged = " + this);
41035038 materialtouched = true;
5039
+
5040
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
5041
+ {
5042
+ saturationField.setFloat(1);
5043
+ }
5044
+
41045045 applySelf();
41055046 //System.out.println("this = " + this);
41065047 //System.out.println("PARENT = " + parent);
....@@ -4400,6 +5341,7 @@
44005341 {
44015342 if (GetTree() != null)
44025343 {
5344
+ GetTree().revalidate();
44035345 GetTree().repaint();
44045346 }
44055347
....@@ -4408,13 +5350,18 @@
44085350 ctrlPanel.validate(); // ? new
44095351 ctrlPanel.repaint();
44105352 }
5353
+
5354
+ if (previousVersionButton != null && copy.versionlist != null)
5355
+ SetVersionStates();
5356
+
5357
+ cameraView.requestFocusInWindow();
44115358 }
44125359
44135360 static TweenManager tweenManager = new TweenManager();
44145361
44155362 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
44165363 {
4417
- if (Globals.SAVEONMAKE) // && resetmodel)
5364
+ if (Globals.REPLACEONMAKE) // && resetmodel)
44185365 Save();
44195366 //Tween.set(thing, 0).target(1).start(tweenManager);
44205367 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4439,7 +5386,7 @@
44395386 // group = (Composite) group.get(0);
44405387 // }
44415388
4442
- System.out.println("makeSomething of " + thing);
5389
+ //System.out.println("makeSomething of " + thing);
44435390
44445391 /*
44455392 if (deselect && jList != null)
....@@ -4656,7 +5603,9 @@
46565603 readobj.ResetDisplayList();
46575604 } catch (Exception e)
46585605 {
4659
- //e.printStackTrace();
5606
+ if (!e.toString().contains("GZIP"))
5607
+ e.printStackTrace();
5608
+
46605609 try
46615610 {
46625611 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4736,6 +5685,8 @@
47365685 {
47375686 //readobj.deepCopySelf(copy);
47385687 copy.clear(); // june 2014
5688
+ copy.skyboxname = readobj.skyboxname;
5689
+ copy.skyboxext = readobj.skyboxext;
47395690 for (int i = 0; i < readobj.size(); i++)
47405691 {
47415692 Object3D child = readobj.get(i); // reserve(i);
....@@ -4776,6 +5727,7 @@
47765727 }
47775728 } catch (ClassCastException e)
47785729 {
5730
+ e.printStackTrace();
47795731 assert (false);
47805732 Composite c = (Composite) copy;
47815733 c.children.clear();
....@@ -4786,6 +5738,21 @@
47865738 c.addChild(csg);
47875739 }
47885740
5741
+ copy.versionlist = readobj.versionlist;
5742
+ copy.versionindex = readobj.versionindex;
5743
+ copy.versiontable = readobj.versiontable;
5744
+
5745
+ if (copy.versionlist == null)
5746
+ {
5747
+ // Backward compatibility
5748
+ copy.versionlist = new Object3D[100];
5749
+ copy.versionindex = -1;
5750
+
5751
+ //Save(true);
5752
+ }
5753
+
5754
+ //? SetUndoStates();
5755
+
47895756 ResetModel();
47905757 copy.HardTouch(); // recompile?
47915758 refreshContents();
....@@ -4796,7 +5763,7 @@
47965763 {
47975764 if (Grafreed.standAlone)
47985765 {
4799
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5766
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
48005767 browser.show();
48015768 String filename = browser.getFile();
48025769 if (filename != null && filename.length() > 0)
....@@ -4873,6 +5840,8 @@
48735840
48745841 void save()
48755842 {
5843
+ Replace();
5844
+
48765845 if (lastname == null)
48775846 {
48785847 return;
....@@ -4895,6 +5864,7 @@
48955864 //ps.print(buffer.toString());
48965865 } catch (IOException e)
48975866 {
5867
+ e.printStackTrace();
48985868 }
48995869 }
49005870
....@@ -5114,6 +6084,7 @@
51146084 ButtonGroup buttonGroup;
51156085
51166086 cGridBag toolboxPanel;
6087
+ cGridBag skyboxPanel;
51176088 cGridBag materialPanel;
51186089 cGridBag ctrlPanel;
51196090
....@@ -5125,6 +6096,7 @@
51256096 boolean materialFlushed;
51266097 Object3D latestObject;
51276098
6099
+ cGridBag transformPanel;
51286100 cGridBag XYZPanel;
51296101
51306102 JSplitPane gridPanel;
....@@ -5187,7 +6159,7 @@
51876159 JLabel colorLabel;
51886160 cNumberSlider colorField;
51896161 JLabel modulationLabel;
5190
- cNumberSlider modulationField;
6162
+ cNumberSlider saturationField;
51916163 JLabel metalnessLabel;
51926164 cNumberSlider metalnessField;
51936165 JLabel diffuseLabel;
....@@ -5218,6 +6190,7 @@
52186190 cNumberSlider anisoField;
52196191 JLabel anisoVLabel;
52206192 cNumberSlider anisoVField;
6193
+
52216194 JLabel cameraLabel;
52226195 cNumberSlider cameraField;
52236196 JLabel selfshadowLabel;
....@@ -5232,6 +6205,7 @@
52326205 cNumberSlider fakedepthField;
52336206 JLabel shadowbiasLabel;
52346207 cNumberSlider shadowbiasField;
6208
+
52356209 JLabel bumpLabel;
52366210 cNumberSlider bumpField;
52376211 JLabel noiseLabel;