Normand Briere
2019-08-18 66aca73cce89e4b4d7521862760edf4b0888bc38
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -13,6 +14,9 @@
1314 import javax.swing.plaf.metal.MetalLookAndFeel;
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
17
+
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
1620
1721 //import javax.media.opengl.GLCanvas;
1822
....@@ -30,6 +34,7 @@
3034 iSendInfo
3135 //KeyListener
3236 {
37
+ public cToggleButton pinButton;
3338 boolean timeline;
3439 boolean wasFullScreen;
3540
....@@ -37,6 +42,123 @@
3742 JFrame frame;
3843
3944 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 cGridBag GetSeparator()
76
+ {
77
+ cGridBag separator = new cGridBag();
78
+ separator.add(new JSeparator());
79
+ separator.preferredHeight = 5;
80
+ return separator;
81
+ }
82
+
83
+ cButton GetButton(String name, boolean border)
84
+ {
85
+ ImageIcon icon = GetIcon(name);
86
+ if (icon != null || name.contains("/"))
87
+ return new cButton(icon, border);
88
+ else
89
+ return new cButton(name, border);
90
+ }
91
+
92
+ cLabel GetLabel(String name, boolean border)
93
+ {
94
+ //ImageIcon icon = GetIcon(name);
95
+ return new cLabel(GetImage(name), border);
96
+ }
97
+
98
+ cToggleButton GetToggleButton(String name, boolean border)
99
+ {
100
+ ImageIcon icon = GetIcon(name);
101
+ return new cToggleButton(icon, border);
102
+ }
103
+
104
+ cCheckBox GetCheckBox(String name, boolean border)
105
+ {
106
+ ImageIcon icon = GetIcon(name);
107
+ return new cCheckBox(icon, border);
108
+ }
109
+
110
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
111
+
112
+ static ImageIcon GetIcon(String name)
113
+ {
114
+ javax.swing.ImageIcon iconCache = icons.get(name);
115
+ if (iconCache != null)
116
+ {
117
+ return iconCache;
118
+ }
119
+
120
+ try
121
+ {
122
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
123
+
124
+// if (image.getWidth() > 48 && image.getHeight() > 48)
125
+// {
126
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
127
+// Graphics2D g = resized.createGraphics();
128
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
129
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
130
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
131
+// g.dispose();
132
+//
133
+// image = resized;
134
+// }
135
+
136
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
137
+
138
+ icons.put(name, icon);
139
+
140
+ return icon;
141
+ }
142
+ catch (Exception e)
143
+ {
144
+ //icons.put(name, null);
145
+ return null;
146
+ }
147
+ }
148
+
149
+ BufferedImage GetImage(String name)
150
+ {
151
+ try
152
+ {
153
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
154
+
155
+ return image;
156
+ }
157
+ catch (Exception e)
158
+ {
159
+ return null;
160
+ }
161
+ }
40162
41163 // SCRIPT
42164
....@@ -147,7 +269,7 @@
147269
148270 objEditor.ctrlPanel.remove(namePanel);
149271
150
- if (!GroupEditor.allparams)
272
+ if (!allparams)
151273 return;
152274
153275 // objEditor.ctrlPanel.remove(liveCB);
....@@ -171,7 +293,7 @@
171293
172294 objEditor.ctrlPanel.remove(setupPanel);
173295 objEditor.ctrlPanel.remove(setupPanel2);
174
- objEditor.ctrlPanel.remove(commandsPanel);
296
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
175297 objEditor.ctrlPanel.remove(pushPanel);
176298 //objEditor.ctrlPanel.remove(fillPanel);
177299
....@@ -219,6 +341,14 @@
219341 client = inClient;
220342 copy = client;
221343
344
+// if (copy.versionlist == null)
345
+// {
346
+// copy.versionlist = new Object3D[100];
347
+// copy.versionindex = -1;
348
+//
349
+// callee.Save(true);
350
+// }
351
+
222352 // "this" is not called: SetupUI2(objEditor);
223353 }
224354
....@@ -232,6 +362,14 @@
232362 client = inClient;
233363 copy = client;
234364
365
+ if (copy.versionlist == null)
366
+ {
367
+ copy.versionlist = new Object3D[100];
368
+ copy.versionindex = -1;
369
+
370
+// Save(true);
371
+ }
372
+
235373 SetupUI2(callee.GetEditor());
236374 }
237375
....@@ -246,14 +384,15 @@
246384 //localCopy.parent = null;
247385
248386 frame = new JFrame();
249
- frame.setUndecorated(true);
387
+ frame.setUndecorated(false);
250388 objEditor = this;
251389 this.callee = callee;
252390
253391 //parent = p;
254392
255393 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
256
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
394
+ if (Globals.DEBUG)
395
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
257396 //gd.setFullScreenWindow(this);
258397 //setResizable(false);
259398 //if (!isDisplayable())
....@@ -264,6 +403,14 @@
264403 copy = localCopy;
265404 copy.editWindow = this;
266405
406
+// if (copy.versionlist == null)
407
+// {
408
+// copy.versionlist = new Object3D[100];
409
+// copy.versionindex = -1;
410
+//
411
+// Save(true);
412
+// }
413
+
267414 SetupMenu();
268415
269416 //SetupName(objEditor); // new
....@@ -277,12 +424,20 @@
277424 return frame.action(event, obj);
278425 }
279426
427
+ // Cannot work without static
428
+ static boolean allparams = true;
429
+
430
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
431
+
432
+ // This is to refresh the UI of the material panel.
433
+ boolean patchMaterial;
434
+
280435 void SetupMenu()
281436 {
282437 frame.setMenuBar(menuBar = new MenuBar());
283438 menuBar.add(fileMenu = new Menu("File"));
284439 fileMenu.add(newItem = new MenuItem("New"));
285
- fileMenu.add(loadItem = new MenuItem("Open..."));
440
+ fileMenu.add(openItem = new MenuItem("Open..."));
286441
287442 //oe.menuBar.add(menu = new Menu("Include"));
288443 Menu menu = new Menu("Import");
....@@ -314,7 +469,7 @@
314469 }
315470
316471 newItem.addActionListener(this);
317
- loadItem.addActionListener(this);
472
+ openItem.addActionListener(this);
318473 saveItem.addActionListener(this);
319474 saveAsItem.addActionListener(this);
320475 exportAsItem.addActionListener(this);
....@@ -323,28 +478,102 @@
323478 closeItem.addActionListener(this);
324479
325480 objectPanel = new JTabbedPane();
481
+
482
+ ChangeListener changeListener = new ChangeListener()
483
+ {
484
+ //String name;
485
+
486
+ public void stateChanged(ChangeEvent changeEvent)
487
+ {
488
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
489
+// {
490
+// if (latestObject != null)
491
+// {
492
+// refreshContents(true);
493
+// SetMaterial(latestObject);
494
+// }
495
+//
496
+// materialFlushed = true;
497
+// }
498
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
499
+// {
500
+// if (listUI.size() == 0)
501
+// EditSelection(false);
502
+// }
503
+
504
+// if (objectPanel.getSelectedIndex() == 4)
505
+// {
506
+// name = copy.skyboxname;
507
+//
508
+// if (name == null)
509
+// {
510
+// name = "";
511
+// }
512
+//
513
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
514
+// copy.skyboxext = "jpg";
515
+// }
516
+// else
517
+// {
518
+// if (name != null)
519
+// {
520
+// if (name.equals(""))
521
+// {
522
+// copy.skyboxname = null;
523
+// copy.skyboxext = null;
524
+// }
525
+// else
526
+// {
527
+// copy.skyboxname = name;
528
+// }
529
+// }
530
+// }
531
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
532
+
533
+// refreshContents(false); // To refresh Info tab
534
+ cameraView.repaint();
535
+ }
536
+ };
537
+ objectPanel.addChangeListener(changeListener);
538
+
326539 toolbarPanel = new JPanel();
327540 toolbarPanel.setName("Toolbar");
541
+
328542 treePanel = new cGridBag();
329543 treePanel.setName("Tree");
544
+
545
+ editPanel = new cGridBag().setVertical(true);
546
+ //editPanel.setName("Edit");
547
+
330548 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
331
- ctrlPanel.setName("Edit");
332
- materialPanel = new cGridBag().setVertical(true);
333
- materialPanel.setName("Material");
549
+
550
+ editCommandsPanel = new cGridBag();
551
+ editPanel.add(editCommandsPanel);
552
+ editPanel.add(ctrlPanel);
553
+
554
+ toolboxPanel = new cGridBag().setVertical(true);
555
+ //toolboxPanel.setName("Toolbox");
556
+
557
+ skyboxPanel = new cGridBag().setVertical(true);
558
+
559
+ materialPanel = new cGridBag().setVertical(false);
560
+ //materialPanel.setName("Material");
561
+
334562 /*JTextPane*/
335563 infoarea = createTextPane();
336564 doc = infoarea.getStyledDocument();
337565
338566 infoarea.setEditable(true);
339567 SetText();
568
+
340569 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
341570 // infoarea.setOpaque(false);
342571 // //infoarea.setForeground(textcolor);
343572 // TEXTAREA infoarea.setLineWrap(true);
344573 // TEXTAREA infoarea.setWrapStyleWord(true);
345574 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
346
- infoPanel.setPreferredSize(new Dimension(50, 200));
347
- infoPanel.setName("Info");
575
+ infoPanel.setPreferredSize(new Dimension(1, 1));
576
+ //infoPanel.setName("Info");
348577 //infoPanel.setLayout(new BorderLayout());
349578 //infoPanel.add(createTextPane());
350579
....@@ -355,7 +584,14 @@
355584 mainPanel.setDividerSize(9);
356585 mainPanel.setDividerLocation(0.5); //1.0);
357586 mainPanel.setResizeWeight(0.5);
358
-
587
+
588
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
589
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
590
+ divider.setDividerSize(15);
591
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
592
+
593
+ mainPanel.setUI(new BasicSplitPaneUI());
594
+
359595 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
360596 //mainPanel.setLayout(new GridBagLayout());
361597 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -586,8 +822,8 @@
586822 }
587823 }
588824
589
-static GraphicsDevice device = GraphicsEnvironment
590
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
825
+//static GraphicsDevice device = GraphicsEnvironment
826
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
591827
592828 Rectangle keeprect;
593829 cRadio radio;
....@@ -603,13 +839,25 @@
603839
604840 boolean maximized;
605841
842
+ cButton fullscreenLayout;
843
+ cButton expandedLayout;
844
+
606845 void Minimize()
607846 {
608847 frame.setState(Frame.ICONIFIED);
848
+ frame.validate();
609849 }
610850
851
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
852
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
853
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
611854 void Maximize()
612855 {
856
+ if (CameraPane.FULLSCREEN)
857
+ {
858
+ ToggleFullScreen();
859
+ }
860
+
613861 if (maximized)
614862 {
615863 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -617,20 +865,38 @@
617865 else
618866 {
619867 keeprect = frame.getBounds();
620
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
621
- Dimension rect2 = frame.getToolkit().getScreenSize();
622
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
868
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
869
+// Dimension rect2 = frame.getToolkit().getScreenSize();
870
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
623871 // frame.setState(Frame.MAXIMIZED_BOTH);
872
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
624873 }
625874
626875 maximized ^= true;
876
+
877
+ frame.validate();
627878 }
879
+
880
+ cButton minButton;
881
+ cButton maxButton;
882
+ cButton fullButton;
883
+ cButton collapseButton;
884
+ cButton maximize3DButton;
628885
629886 void ToggleFullScreen()
630887 {
631
- if (CameraPane.FULLSCREEN)
888
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
889
+
890
+ cameraView.ToggleFullScreen();
891
+
892
+ if (!CameraPane.FULLSCREEN)
632893 {
633894 device.setFullScreenWindow(null);
895
+ frame.dispose();
896
+ frame.setUndecorated(false);
897
+ frame.validate();
898
+ frame.setVisible(true);
899
+
634900 //frame.setVisible(false);
635901 // frame.removeNotify();
636902 // frame.setUndecorated(false);
....@@ -640,13 +906,13 @@
640906 // X frame.getContentPane().remove(/*"Center",*/bigThree);
641907 // X framePanel.add(bigThree);
642908 // X frame.getContentPane().add(/*"Center",*/framePanel);
643
- framePanel.setDividerLocation(1);
909
+// framePanel.setDividerLocation(46); // icons are 24x24
644910
645911 //frame.setVisible(true);
646
- radio.layout = keepButton;
912
+// radio.layout = keepButton;
647913 //theFrame = null;
648914 keepButton = null;
649
- radio.layout.doClick();
915
+// radio.layout.doClick();
650916
651917 } else
652918 {
....@@ -655,22 +921,70 @@
655921 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
656922 // frame.getToolkit().getScreenSize().height);
657923 //frame.setVisible(false);
924
+
925
+ frame.dispose();
926
+ frame.setUndecorated(true);
658927 device.setFullScreenWindow(frame);
928
+ frame.validate();
929
+ frame.setVisible(true);
659930 // frame.removeNotify();
660931 // frame.setUndecorated(true);
661932 // frame.addNotify();
662933 // X frame.getContentPane().remove(/*"Center",*/framePanel);
663934 // X framePanel.remove(bigThree);
664935 // X frame.getContentPane().add(/*"Center",*/bigThree);
665
- framePanel.setDividerLocation(0);
936
+// framePanel.setDividerLocation(0);
666937
667
- radio.layout = twoButton;
668
- radio.layout.doClick();
938
+// radio.layout = fullscreenLayout;
939
+// radio.layout.doClick();
669940 //frame.setVisible(true);
670941 }
671
-
672
- cameraView.ToggleFullScreen();
942
+ frame.validate();
943
+
944
+ cameraView.requestFocusInWindow();
673945 }
946
+
947
+ void CollapseToolbar()
948
+ {
949
+ framePanel.setDividerLocation(0);
950
+ //frame.validate();
951
+
952
+ cameraView.requestFocusInWindow();
953
+ }
954
+
955
+ private Object3D Duplicate(Object3D object)
956
+ {
957
+ boolean temp = CameraPane.SWITCH;
958
+ CameraPane.SWITCH = false;
959
+
960
+ if (Grafreed.grafreed.universe.versiontable == null)
961
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
962
+
963
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
964
+ // if (copy == client)
965
+
966
+ Object3D versions[] = object.versionlist;
967
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
968
+ object.versionlist = null;
969
+ object.versiontable = null;
970
+
971
+ Object3D parent = object.parent;
972
+ object.parent = null;
973
+
974
+ //byte[] compress = Compress(copy);
975
+ Object3D compress = (Object3D)Grafreed.clone(object);
976
+
977
+ object.parent = parent;
978
+
979
+ object.versionlist = versions;
980
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
981
+
982
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
983
+
984
+ CameraPane.SWITCH = temp;
985
+
986
+ return compress;
987
+ }
674988
675989 private JTextPane createTextPane()
676990 {
....@@ -793,6 +1107,7 @@
7931107 {
7941108 SetupMaterial(materialPanel);
7951109 }
1110
+
7961111 //SetupName();
7971112 //SetupViews();
7981113 }
....@@ -802,7 +1117,7 @@
8021117 // NumberSlider vDivsField;
8031118 // JCheckBox endcaps;
8041119 JCheckBox liveCB;
805
- JCheckBox selectCB;
1120
+ JCheckBox selectableCB;
8061121 JCheckBox hideCB;
8071122 JCheckBox link2masterCB;
8081123 JCheckBox markCB;
....@@ -810,7 +1125,12 @@
8101125 JCheckBox speedupCB;
8111126 JCheckBox rewindCB;
8121127 JCheckBox flipVCB;
1128
+
1129
+ cCheckBox toggleTextureCB;
1130
+ cCheckBox toggleSwitchCB;
1131
+
8131132 JComboBox texresMenu;
1133
+
8141134 JButton resetButton;
8151135 JButton stepButton;
8161136 JButton stepAllButton;
....@@ -819,10 +1139,13 @@
8191139 JButton fasterButton;
8201140 JButton remarkButton;
8211141
1142
+ cGridBag editPanel;
1143
+ cGridBag editCommandsPanel;
1144
+
8221145 cGridBag namePanel;
8231146 cGridBag setupPanel;
8241147 cGridBag setupPanel2;
825
- cGridBag commandsPanel;
1148
+ cGridBag objectCommandsPanel;
8261149 cGridBag pushPanel;
8271150 cGridBag fillPanel;
8281151
....@@ -993,39 +1316,55 @@
9931316
9941317 namePanel = new cGridBag();
9951318
1319
+ //if (copy.pinned)
1320
+ {
1321
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
1322
+ pinButton.setSelected(copy.pinned);
1323
+ cGridBag t = new cGridBag();
1324
+ t.preferredWidth = 2;
1325
+ t.add(pinButton);
1326
+ namePanel.add(t);
1327
+
1328
+ pinButton.addItemListener(this);
1329
+ }
1330
+
9961331 nameField = AddText(namePanel, copy.GetName());
997
- namePanel.add(nameField);
1332
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9981333 oe.ctrlPanel.add(namePanel);
9991334
10001335 oe.ctrlPanel.Return();
10011336
1002
- if (!GroupEditor.allparams)
1337
+ if (!allparams)
10031338 return;
10041339
10051340 setupPanel = new cGridBag().setVertical(false);
10061341
10071342 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
10081343 liveCB.setToolTipText("Animate object");
1009
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1010
- selectCB.setToolTipText("Make object selectable");
1344
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1345
+ markCB.setToolTipText("Set target transform");
1346
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1347
+ selectableCB.setToolTipText("Make object selectable");
10111348 // Return();
1349
+
10121350 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10131351 hideCB.setToolTipText("Hide object");
1014
- markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1015
- markCB.setToolTipText("Set the animation target transform");
1352
+
1353
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10161354
10171355 setupPanel2 = new cGridBag().setVertical(false);
10181356
10191357 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10201358 rewindCB.setToolTipText("Rewind animation");
10211359
1022
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1023
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1360
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1361
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10241362
1363
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1364
+ link2masterCB.setToolTipText("Attach to support");
1365
+
10251366 if (Globals.ADVANCED)
10261367 {
1027
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1028
- link2masterCB.setToolTipText("Attach to support");
10291368 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
10301369 speedupCB.setToolTipText("Option motion capture");
10311370 }
....@@ -1035,23 +1374,23 @@
10351374 oe.ctrlPanel.add(setupPanel2);
10361375 oe.ctrlPanel.Return();
10371376
1038
- commandsPanel = new cGridBag().setVertical(false);
1377
+ objectCommandsPanel = new cGridBag().setVertical(false);
10391378
1040
- resetButton = AddButton(commandsPanel, "Reset");
1379
+ resetButton = AddButton(objectCommandsPanel, "Reset");
10411380 resetButton.setToolTipText("Jump to frame zero");
1042
- stepButton = AddButton(commandsPanel, "Step");
1381
+ stepButton = AddButton(objectCommandsPanel, "Step");
10431382 stepButton.setToolTipText("Step one frame");
10441383 // resetAllButton = AddButton(oe, "Reset All");
10451384 // stepAllButton = AddButton(oe, "Step All");
10461385 // Return();
1047
- slowerButton = AddButton(commandsPanel, "Slow");
1386
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
10481387 slowerButton.setToolTipText("Decrease animation speed");
1049
- fasterButton = AddButton(commandsPanel, "Fast");
1388
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
10501389 fasterButton.setToolTipText("Increase animation speed");
1051
- remarkButton = AddButton(commandsPanel, "Remark");
1390
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
10521391 remarkButton.setToolTipText("Set the current transform as the target");
10531392
1054
- oe.ctrlPanel.add(commandsPanel);
1393
+ oe.ctrlPanel.add(objectCommandsPanel);
10551394 oe.ctrlPanel.Return();
10561395
10571396 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1211,6 +1550,7 @@
12111550
12121551 if (cam == null || !(copy.get(0) instanceof cGroup))
12131552 {
1553
+ if (Globals.DEBUG)
12141554 System.out.println("CREATE CAMERAS");
12151555 cams = new cTemplate();
12161556 cams.name = "Cameras";
....@@ -1292,6 +1632,45 @@
12921632 //frontView.object = copy;
12931633 //sideView.object = copy;
12941634
1635
+ transformPanel = new cGridBag().setVertical(true);
1636
+
1637
+ cGridBag resetTransformPanel = new cGridBag();
1638
+
1639
+ resetTransformPanel.preferredHeight = 2;
1640
+
1641
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1642
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
1643
+ resetTransform.addMouseListener(new MouseAdapter()
1644
+ {
1645
+ public void mouseClicked(MouseEvent e)
1646
+ {
1647
+ ResetTransform();
1648
+ }
1649
+ });
1650
+ resetTransformPanel.add(resetTransform);
1651
+
1652
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1653
+ resetTransform.setToolTipText("Reset Translation only");
1654
+ resetTransform.addMouseListener(new MouseAdapter()
1655
+ {
1656
+ public void mouseClicked(MouseEvent e)
1657
+ {
1658
+ ResetTransform(1);
1659
+ }
1660
+ });
1661
+ resetTransformPanel.add(resetTransform);
1662
+
1663
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1664
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
1665
+ resetTransform.addMouseListener(new MouseAdapter()
1666
+ {
1667
+ public void mouseClicked(MouseEvent e)
1668
+ {
1669
+ ResetTransform(2);
1670
+ }
1671
+ });
1672
+ resetTransformPanel.add(resetTransform);
1673
+
12951674 XYZPanel = new cGridBag().setVertical(true);
12961675 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12971676
....@@ -1299,7 +1678,11 @@
12991678 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
13001679 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
13011680 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1681
+ //XYZPanel.setName("XYZ");
13021682
1683
+ transformPanel.add(resetTransformPanel);
1684
+ transformPanel.add(XYZPanel);
1685
+
13031686 /*
13041687 gridPanel = new JPanel(); //new BorderLayout());
13051688 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1307,12 +1690,12 @@
13071690 gridPanel.add(cameraView);
13081691 gridPanel.add(XYZPanel);
13091692 */
1310
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1311
- gridPanel.setContinuousLayout(true);
1312
- gridPanel.setOneTouchExpandable(true);
1313
- gridPanel.setDividerLocation(1.0);
1314
- gridPanel.setDividerSize(9);
1315
- gridPanel.setResizeWeight(0.85);
1693
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1694
+// gridPanel.setContinuousLayout(true);
1695
+// gridPanel.setOneTouchExpandable(true);
1696
+// gridPanel.setDividerLocation(1.0);
1697
+// gridPanel.setDividerSize(9);
1698
+// gridPanel.setResizeWeight(0.85);
13161699
13171700 // aConstraints.weighty = 0;
13181701 //System.out.println("THIS = " + this);
....@@ -1335,14 +1718,34 @@
13351718
13361719 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
13371720 //tmp.setName("Edit");
1721
+ objectPanel.add(toolboxPanel);
1722
+ objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1723
+ objectPanel.setToolTipTextAt(0, "Objects & textures");
1724
+
13381725 objectPanel.add(materialPanel);
1726
+ objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1727
+ objectPanel.setToolTipTextAt(1, "Material");
1728
+
1729
+ objectPanel.add(skyboxPanel);
1730
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1731
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1732
+
13391733 // JPanel north = new JPanel(new BorderLayout());
13401734 // north.setName("Edit");
13411735 // north.add(ctrlPanel, BorderLayout.NORTH);
13421736 // objectPanel.add(north);
1343
- objectPanel.add(ctrlPanel);
1344
- objectPanel.add(infoPanel);
1345
-
1737
+ objectPanel.add(editPanel);
1738
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1739
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1740
+
1741
+ objectPanel.add(transformPanel);
1742
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1743
+ objectPanel.setToolTipTextAt(4, "TRS transform");
1744
+
1745
+ patchMaterial = true;
1746
+ cameraView.patchMaterial = this;
1747
+ objectPanel.setSelectedIndex(1);
1748
+
13461749 /*
13471750 aConstraints.gridx = 0;
13481751 aConstraints.gridwidth = 1;
....@@ -1350,7 +1753,7 @@
13501753 aConstraints.gridy += 1;
13511754 aConstraints.gridwidth = 1;
13521755 mainPanel.add(objectPanel, aConstraints);
1353
- */
1756
+ */
13541757
13551758 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
13561759 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1367,17 +1770,57 @@
13671770 JTabbedPane tabbedPane = new JTabbedPane();
13681771 tabbedPane.add(scrollpane);
13691772
1370
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1371
-
1372
- optionsPanel = new cGridBag().setVertical(true);
1773
+ optionsPanel = new cGridBag().setVertical(false);
13731774
13741775 optionsPanel.setName("Options");
13751776
13761777 AddOptions(optionsPanel); //, aConstraints);
13771778
1779
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1780
+
13781781 tabbedPane.add(optionsPanel);
13791782
13801783 scenePanel.add(tabbedPane);
1784
+
1785
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1786
+ creditsPanel.setName("Credits");
1787
+
1788
+ cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1789
+ creditsPanel.add(ogaLabel);
1790
+
1791
+ cButton opengameartButton;
1792
+ creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1793
+ opengameartButton.setToolTipText("https://opengameart.org");
1794
+
1795
+ opengameartButton.addMouseListener(new MouseAdapter()
1796
+ {
1797
+ public void mouseClicked(MouseEvent e)
1798
+ {
1799
+ try
1800
+ {
1801
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1802
+ } catch (Exception e1)
1803
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1804
+ {
1805
+ e1.printStackTrace();
1806
+ }
1807
+ }
1808
+ });
1809
+
1810
+ for (int i=10; --i>=0;)
1811
+ {
1812
+ creditsPanel.add(new cGridBag());
1813
+ }
1814
+
1815
+ tabbedPane.add(creditsPanel);
1816
+ tabbedPane.setToolTipTextAt(3, "Credits");
1817
+
1818
+ if (Globals.ADVANCED)
1819
+ {
1820
+ tabbedPane.add(infoPanel);
1821
+ tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1822
+ tabbedPane.setToolTipTextAt(4, "Information");
1823
+ }
13811824
13821825 /*
13831826 cTree jTree = new cTree(null);
....@@ -1399,13 +1842,13 @@
13991842 jtp.add(tree);
14001843 */
14011844
1402
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1403
- bigPanel.setContinuousLayout(true);
1404
- bigPanel.setOneTouchExpandable(true);
1405
- bigPanel.setDividerLocation(0.8);
1406
- bigPanel.setDividerSize(15);
1407
- bigPanel.setResizeWeight(0.15);
1408
- bigPanel.setName("Scene");
1845
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1846
+// bigPanel.setContinuousLayout(true);
1847
+// bigPanel.setOneTouchExpandable(true);
1848
+// bigPanel.setDividerLocation(0.8);
1849
+// bigPanel.setDividerSize(15);
1850
+// bigPanel.setResizeWeight(0.15);
1851
+// bigPanel.setName("Scene");
14091852
14101853 //bigPanel.setLayout(new BorderLayout());
14111854 //bigPanel.setSize(new Dimension(10,10));
....@@ -1440,7 +1883,7 @@
14401883 bigThree = new cGridBag();
14411884 bigThree.addComponent(scenePanel);
14421885 bigThree.addComponent(centralPanel);
1443
- bigThree.addComponent(XYZPanel);
1886
+ //bigThree.addComponent(XYZPanel);
14441887
14451888 // // SIDE EFFECT!!!
14461889 // aConstraints.gridx = 0;
....@@ -1449,16 +1892,33 @@
14491892 // aConstraints.gridheight = 1;
14501893
14511894 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1452
- framePanel.setContinuousLayout(true);
1453
- framePanel.setOneTouchExpandable(true);
1454
- framePanel.setDividerLocation(0.8);
1895
+
1896
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1897
+ new java.beans.PropertyChangeListener()
1898
+ {
1899
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1900
+ {
1901
+ if ((Integer)pce.getOldValue() == 1)
1902
+ {
1903
+ if (radio.layout != expandedLayout)
1904
+ {
1905
+ radio.layout = expandedLayout;
1906
+ radio.layout.doClick();
1907
+ }
1908
+ }
1909
+ }
1910
+ });
1911
+
1912
+ framePanel.setContinuousLayout(false);
1913
+ framePanel.setOneTouchExpandable(false);
1914
+ //.setDividerLocation(0.8);
14551915 //framePanel.setDividerSize(15);
14561916 //framePanel.setResizeWeight(0.15);
14571917 framePanel.setName("Frame");
14581918
14591919 frame.getContentPane().setLayout(new BorderLayout());
14601920 /**/
1461
- JTabbedPane worldPane = new JTabbedPane();
1921
+ //JTabbedPane worldPane = new JTabbedPane();
14621922 //worldPane.add(bigPanel);
14631923 //worldPane.add(worldPanel);
14641924 /**/
....@@ -1469,16 +1929,18 @@
14691929 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14701930
14711931 frame.setSize(1280, 860);
1472
- frame.setVisible(true);
1473
-
1932
+
14741933 cameraView.requestFocusInWindow();
14751934
1476
- gridPanel.setDividerLocation(1.0);
1935
+// gridPanel.setDividerLocation(1.0);
1936
+
1937
+ frame.validate();
1938
+
1939
+ frame.setVisible(true);
14771940
14781941 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
14791942 frame.addWindowListener(new WindowAdapter()
14801943 {
1481
-
14821944 public void windowClosing(WindowEvent e)
14831945 {
14841946 Close();
....@@ -1501,28 +1963,442 @@
15011963 ctrlPanel.removeAll();
15021964 }
15031965
1504
- void SetupMaterial(cGridBag panel)
1966
+ void SetupMaterial(cGridBag materialpanel)
15051967 {
1506
- /*
1968
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1969
+
1970
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
1971
+ skin.setToolTipText("Skin");
1972
+ skin.addMouseListener(new MouseAdapter()
1973
+ {
1974
+ public void mouseClicked(MouseEvent e)
1975
+ {
1976
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1977
+ cMaterial material = object.material;
1978
+
1979
+ // Skin
1980
+ colorField.setFloat(material.color);
1981
+ float saturation = material.modulation;
1982
+
1983
+ if (!cameraView.Skinshader)
1984
+ {
1985
+ saturation /= 1.5;
1986
+ }
1987
+
1988
+ saturationField.setFloat(saturation);
1989
+
1990
+ subsurfaceField.setFloat(material.subsurface);
1991
+ selfshadowField.setFloat(material.diffuseness);
1992
+ diffusenessField.setFloat(material.factor);
1993
+ shininessField.setFloat(material.shininess);
1994
+ shadowbiasField.setFloat(material.shadowbias);
1995
+ diffuseField.setFloat(material.diffuse);
1996
+ specularField.setFloat(material.specular);
1997
+
1998
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1999
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2000
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2001
+
2002
+ materialtouched = true;
2003
+ applySelf();
2004
+ }
2005
+ });
2006
+ presetpanel.add(skin);
2007
+
2008
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
2009
+ lambert.setToolTipText("Diffuse");
2010
+ lambert.addMouseListener(new MouseAdapter()
2011
+ {
2012
+ public void mouseClicked(MouseEvent e)
2013
+ {
2014
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
2015
+ cMaterial material = object.material;
2016
+
2017
+ diffusenessField.setFloat(material.factor);
2018
+ selfshadowField.setFloat(material.diffuseness);
2019
+
2020
+ materialtouched = true;
2021
+ applySelf();
2022
+ }
2023
+ });
2024
+ presetpanel.add(lambert);
2025
+
2026
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
2027
+ diffuse2.setToolTipText("Diffuse2");
2028
+ diffuse2.addMouseListener(new MouseAdapter()
2029
+ {
2030
+ public void mouseClicked(MouseEvent e)
2031
+ {
2032
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
2033
+ cMaterial material = object.material;
2034
+
2035
+ diffusenessField.setFloat(material.factor);
2036
+ selfshadowField.setFloat(material.diffuseness);
2037
+
2038
+ materialtouched = true;
2039
+ applySelf();
2040
+ }
2041
+ });
2042
+ presetpanel.add(diffuse2);
2043
+
2044
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
2045
+ diffusemoon.setToolTipText("Moon");
2046
+ diffusemoon.addMouseListener(new MouseAdapter()
2047
+ {
2048
+ public void mouseClicked(MouseEvent e)
2049
+ {
2050
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
2051
+ cMaterial material = object.material;
2052
+
2053
+ diffusenessField.setFloat(material.factor);
2054
+ selfshadowField.setFloat(material.diffuseness);
2055
+
2056
+ materialtouched = true;
2057
+ applySelf();
2058
+ }
2059
+ });
2060
+ presetpanel.add(diffusemoon);
2061
+
2062
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
2063
+ diffusemoon2.setToolTipText("Moon2");
2064
+ diffusemoon2.addMouseListener(new MouseAdapter()
2065
+ {
2066
+ public void mouseClicked(MouseEvent e)
2067
+ {
2068
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
2069
+ cMaterial material = object.material;
2070
+
2071
+ diffusenessField.setFloat(material.factor);
2072
+ selfshadowField.setFloat(material.diffuseness);
2073
+
2074
+ materialtouched = true;
2075
+ applySelf();
2076
+ }
2077
+ });
2078
+ presetpanel.add(diffusemoon2);
2079
+
2080
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
2081
+ diffusemoon3.setToolTipText("Moon3");
2082
+ diffusemoon3.addMouseListener(new MouseAdapter()
2083
+ {
2084
+ public void mouseClicked(MouseEvent e)
2085
+ {
2086
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
2087
+ cMaterial material = object.material;
2088
+
2089
+ diffusenessField.setFloat(material.factor);
2090
+ selfshadowField.setFloat(material.diffuseness);
2091
+
2092
+ materialtouched = true;
2093
+ applySelf();
2094
+ }
2095
+ });
2096
+ presetpanel.add(diffusemoon3);
2097
+
2098
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
2099
+ diffusesheen.setToolTipText("Sheen");
2100
+ diffusesheen.addMouseListener(new MouseAdapter()
2101
+ {
2102
+ public void mouseClicked(MouseEvent e)
2103
+ {
2104
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
2105
+ cMaterial material = object.material;
2106
+
2107
+ sheenField.setFloat(material.sheen);
2108
+
2109
+ materialtouched = true;
2110
+ applySelf();
2111
+ }
2112
+ });
2113
+ presetpanel.add(diffusesheen);
2114
+
2115
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
2116
+ rough.setToolTipText("Rough metal");
2117
+ rough.addMouseListener(new MouseAdapter()
2118
+ {
2119
+ public void mouseClicked(MouseEvent e)
2120
+ {
2121
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
2122
+ cMaterial material = object.material;
2123
+
2124
+ shininessField.setFloat(material.shininess);
2125
+ velvetField.setFloat(material.velvet);
2126
+
2127
+ materialtouched = true;
2128
+ applySelf();
2129
+ }
2130
+ });
2131
+ presetpanel.add(rough);
2132
+
2133
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
2134
+ rough2.setToolTipText("Medium metal");
2135
+ rough2.addMouseListener(new MouseAdapter()
2136
+ {
2137
+ public void mouseClicked(MouseEvent e)
2138
+ {
2139
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2140
+ cMaterial material = object.material;
2141
+
2142
+ shininessField.setFloat(material.shininess);
2143
+ lightareaField.setFloat(material.lightarea);
2144
+
2145
+ materialtouched = true;
2146
+ applySelf();
2147
+ }
2148
+ });
2149
+ presetpanel.add(rough2);
2150
+
2151
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
2152
+ shini0.setToolTipText("Shiny");
2153
+ shini0.addMouseListener(new MouseAdapter()
2154
+ {
2155
+ public void mouseClicked(MouseEvent e)
2156
+ {
2157
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2158
+ cMaterial material = object.material;
2159
+
2160
+ shininessField.setFloat(material.shininess);
2161
+ lightareaField.setFloat(material.lightarea);
2162
+
2163
+ materialtouched = true;
2164
+ applySelf();
2165
+ }
2166
+ });
2167
+ presetpanel.add(shini0);
2168
+
2169
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
2170
+ shini1.setToolTipText("Shiny2");
2171
+ shini1.addMouseListener(new MouseAdapter()
2172
+ {
2173
+ public void mouseClicked(MouseEvent e)
2174
+ {
2175
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2176
+ cMaterial material = object.material;
2177
+
2178
+ shininessField.setFloat(material.shininess);
2179
+ lightareaField.setFloat(material.lightarea);
2180
+
2181
+ materialtouched = true;
2182
+ applySelf();
2183
+ }
2184
+ });
2185
+ presetpanel.add(shini1);
2186
+
2187
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
2188
+ shini2.setToolTipText("Shiny3");
2189
+ shini2.addMouseListener(new MouseAdapter()
2190
+ {
2191
+ public void mouseClicked(MouseEvent e)
2192
+ {
2193
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2194
+ cMaterial material = object.material;
2195
+
2196
+ shininessField.setFloat(material.shininess);
2197
+ lightareaField.setFloat(material.lightarea);
2198
+
2199
+ materialtouched = true;
2200
+ applySelf();
2201
+ }
2202
+ });
2203
+ presetpanel.add(shini2);
2204
+
2205
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
2206
+ aniso.setToolTipText("AnisoU");
2207
+ aniso.addMouseListener(new MouseAdapter()
2208
+ {
2209
+ public void mouseClicked(MouseEvent e)
2210
+ {
2211
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2212
+ cMaterial material = object.material;
2213
+
2214
+ anisoField.setFloat(material.aniso);
2215
+ anisoVField.setFloat(material.anisoV);
2216
+
2217
+ materialtouched = true;
2218
+ applySelf();
2219
+ }
2220
+ });
2221
+ presetpanel.add(aniso);
2222
+
2223
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
2224
+ aniso2.setToolTipText("AnisoV");
2225
+ aniso2.addMouseListener(new MouseAdapter()
2226
+ {
2227
+ public void mouseClicked(MouseEvent e)
2228
+ {
2229
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2230
+ cMaterial material = object.material;
2231
+
2232
+ anisoField.setFloat(material.aniso);
2233
+ anisoVField.setFloat(material.anisoV);
2234
+
2235
+ materialtouched = true;
2236
+ applySelf();
2237
+ }
2238
+ });
2239
+ presetpanel.add(aniso2);
2240
+
2241
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
2242
+ aniso3.setToolTipText("AnisoUV");
2243
+ aniso3.addMouseListener(new MouseAdapter()
2244
+ {
2245
+ public void mouseClicked(MouseEvent e)
2246
+ {
2247
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2248
+ cMaterial material = object.material;
2249
+
2250
+ anisoField.setFloat(material.aniso);
2251
+ anisoVField.setFloat(material.anisoV);
2252
+
2253
+ materialtouched = true;
2254
+ applySelf();
2255
+ }
2256
+ });
2257
+ presetpanel.add(aniso3);
2258
+
2259
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
2260
+ velvet0.setToolTipText("Velvet");
2261
+ velvet0.addMouseListener(new MouseAdapter()
2262
+ {
2263
+ public void mouseClicked(MouseEvent e)
2264
+ {
2265
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2266
+ cMaterial material = object.material;
2267
+
2268
+ diffusenessField.setFloat(material.factor);
2269
+ selfshadowField.setFloat(material.diffuseness);
2270
+ sheenField.setFloat(material.sheen);
2271
+ shininessField.setFloat(material.shininess);
2272
+ velvetField.setFloat(material.velvet);
2273
+ shiftField.setFloat(material.shift);
2274
+
2275
+ materialtouched = true;
2276
+ applySelf();
2277
+ }
2278
+ });
2279
+ presetpanel.add(velvet0);
2280
+
2281
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
2282
+ bump0.setToolTipText("Bump texture");
2283
+ bump0.addMouseListener(new MouseAdapter()
2284
+ {
2285
+ public void mouseClicked(MouseEvent e)
2286
+ {
2287
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2288
+ cMaterial material = object.material;
2289
+
2290
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2291
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2292
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2293
+
2294
+ materialtouched = true;
2295
+ applySelf();
2296
+ }
2297
+ });
2298
+ presetpanel.add(bump0);
2299
+
2300
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
2301
+ borderShader.setToolTipText("Border fade");
2302
+ borderShader.addMouseListener(new MouseAdapter()
2303
+ {
2304
+ public void mouseClicked(MouseEvent e)
2305
+ {
2306
+ borderfadeField.setFloat(0.5);
2307
+ opacityField.setFloat(0.75);
2308
+
2309
+ materialtouched = true;
2310
+ applySelf();
2311
+ }
2312
+ });
2313
+ presetpanel.add(borderShader);
2314
+
2315
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
2316
+ halo.setToolTipText("Halo");
2317
+ halo.addMouseListener(new MouseAdapter()
2318
+ {
2319
+ public void mouseClicked(MouseEvent e)
2320
+ {
2321
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2322
+ cMaterial material = object.material;
2323
+
2324
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2325
+
2326
+ materialtouched = true;
2327
+ applySelf();
2328
+ }
2329
+ });
2330
+ presetpanel.add(halo);
2331
+
2332
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
2333
+ candle.setToolTipText("Candle");
2334
+ candle.addMouseListener(new MouseAdapter()
2335
+ {
2336
+ public void mouseClicked(MouseEvent e)
2337
+ {
2338
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2339
+ cMaterial material = object.material;
2340
+
2341
+ subsurfaceField.setFloat(material.subsurface);
2342
+ shadowbiasField.setFloat(material.shadowbias);
2343
+ ambientField.setFloat(material.ambient);
2344
+ specularField.setFloat(material.specular);
2345
+ lightareaField.setFloat(material.lightarea);
2346
+ shininessField.setFloat(material.shininess);
2347
+
2348
+ materialtouched = true;
2349
+ applySelf();
2350
+ }
2351
+ });
2352
+ presetpanel.add(candle);
2353
+
2354
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
2355
+ shadowShader.setToolTipText("Shadow");
2356
+ shadowShader.addMouseListener(new MouseAdapter()
2357
+ {
2358
+ public void mouseClicked(MouseEvent e)
2359
+ {
2360
+ diffuseField.setFloat(0.001);
2361
+ ambientField.setFloat(0.001);
2362
+ cameraField.setFloat(0.001);
2363
+ specularField.setFloat(0.001);
2364
+ fakedepthField.setFloat(0.001);
2365
+ opacityField.setFloat(0.6);
2366
+
2367
+ materialtouched = true;
2368
+ applySelf();
2369
+ }
2370
+ });
2371
+ presetpanel.add(shadowShader);
2372
+
2373
+ cGridBag panel = new cGridBag().setVertical(true);
2374
+
2375
+ presetpanel.preferredWidth = 1;
2376
+
2377
+ materialpanel.add(presetpanel);
2378
+ materialpanel.add(panel);
2379
+
2380
+ panel.preferredWidth = 8;
2381
+
2382
+ /*
15072383 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
15082384 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1509
- */
2385
+ */
15102386
15112387 cGridBag editBar = new cGridBag().setVertical(false);
15122388
1513
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2389
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
15142390 createMaterialButton.setToolTipText("Create material");
15152391
15162392 /*
15172393 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
15182394 */
15192395
1520
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2396
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
15212397 clearMaterialButton.setToolTipText("Clear material");
15222398
15232399 if (Globals.ADVANCED)
15242400 {
1525
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2401
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
15262402 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
15272403 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
15282404 }
....@@ -1540,45 +2416,61 @@
15402416 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15412417
15422418 cGridBag colorSection = new cGridBag().setVertical(true);
2419
+
2420
+ cGridBag huepanel = new cGridBag();
2421
+ cGridBag huelabel = new cGridBag();
2422
+ cLabel hue = GetLabel("icons/hue.png", false);
2423
+ hue.fit = true;
2424
+
2425
+ hue.addMouseListener(new MouseAdapter()
2426
+ {
2427
+ public void mousePressed(MouseEvent e)
2428
+ {
2429
+ int x = e.getX();
2430
+
2431
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2432
+ }
2433
+ });
2434
+
2435
+ huelabel.add(hue);
2436
+ huelabel.preferredWidth = 20;
2437
+ huepanel.add(new cGridBag()); // Label
2438
+ huepanel.add(huelabel); // Field/slider
2439
+
2440
+ huepanel.preferredHeight = 7;
2441
+
2442
+ colorSection.add(huepanel);
15432443
15442444 cGridBag color = new cGridBag();
1545
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1546
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2445
+
2446
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2447
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2448
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2449
+
15482450 //colorField.preferredWidth = 200;
15492451 colorSection.add(color);
15502452
15512453 cGridBag modulation = new cGridBag();
15522454 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
15532455 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1554
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2456
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
15552457 colorSection.add(modulation);
15562458
2459
+ cGridBag opacity = new cGridBag();
2460
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2461
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2462
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2463
+ colorSection.add(opacity);
2464
+
2465
+ colorSection.add(GetSeparator());
2466
+
15572467 cGridBag texture = new cGridBag();
15582468 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
15592469 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
15602470 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
15612471 colorSection.add(texture);
15622472
1563
- cGridBag anisoU = new cGridBag();
1564
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1565
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1567
- colorSection.add(anisoU);
1568
-
1569
- cGridBag anisoV = new cGridBag();
1570
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1571
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1573
- colorSection.add(anisoV);
1574
-
1575
- cGridBag shadowbias = new cGridBag();
1576
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1577
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1579
- colorSection.add(shadowbias);
1580
-
1581
- panel.add(new JSeparator());
2473
+ panel.add(GetSeparator());
15822474
15832475 panel.add(colorSection);
15842476
....@@ -1628,7 +2520,13 @@
16282520 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16292521 diffuseSection.add(fakedepth);
16302522
1631
- panel.add(new JSeparator());
2523
+ cGridBag shadowbias = new cGridBag();
2524
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2525
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2526
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2527
+ diffuseSection.add(shadowbias);
2528
+
2529
+ panel.add(GetSeparator());
16322530
16332531 panel.add(diffuseSection);
16342532
....@@ -1678,42 +2576,48 @@
16782576 // aConstraints.gridy += 1;
16792577 // aConstraints.gridwidth = 1;
16802578
2579
+ cGridBag anisoU = new cGridBag();
2580
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2581
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2582
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2583
+ specularSection.add(anisoU);
16812584
1682
- panel.add(new JSeparator());
2585
+ cGridBag anisoV = new cGridBag();
2586
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2587
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2588
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2589
+ specularSection.add(anisoV);
2590
+
2591
+
2592
+ panel.add(GetSeparator());
16832593
16842594 panel.add(specularSection);
16852595
16862596 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16872597
1688
- cGridBag globalSection = new cGridBag().setVertical(true);
2598
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16892599
16902600 cGridBag camera = new cGridBag();
16912601 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16922602 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16932603 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1694
- globalSection.add(camera);
2604
+ colorSection.add(camera);
16952605
16962606 cGridBag ambient = new cGridBag();
16972607 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16982608 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16992609 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1700
- globalSection.add(ambient);
2610
+ colorSection.add(ambient);
17012611
17022612 cGridBag backlit = new cGridBag();
17032613 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17042614 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17052615 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
- globalSection.add(backlit);
2616
+ colorSection.add(backlit);
17072617
1708
- cGridBag opacity = new cGridBag();
1709
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1710
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1711
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1712
- globalSection.add(opacity);
1713
-
1714
- panel.add(new JSeparator());
2618
+ //panel.add(new JSeparator());
17152619
1716
- panel.add(globalSection);
2620
+ //panel.add(globalSection);
17172621
17182622 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17192623
....@@ -1755,7 +2659,7 @@
17552659 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
17562660 textureSection.add(opacityPower);
17572661
1758
- panel.add(new JSeparator());
2662
+ panel.add(GetSeparator());
17592663
17602664 panel.add(textureSection);
17612665
....@@ -1820,8 +2724,9 @@
18202724 // 3D models
18212725 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18222726 {
1823
- lastConverter = new com.jmex.model.converters.MaxToJme();
1824
- LoadFile(filename, lastConverter);
2727
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2728
+ //LoadFile(filename, lastConverter);
2729
+ LoadObjFile(filename); // New 3ds loader
18252730 continue;
18262731 }
18272732 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2547,6 +3452,7 @@
25473452 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25483453 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25493454 }
3455
+
25503456 //cJME.count++;
25513457 //cJME.count %= 12;
25523458 if (gc)
....@@ -2730,6 +3636,7 @@
27303636 }
27313637 }
27323638 }
3639
+
27333640 cFileSystemPane FSPane;
27343641
27353642 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2739,7 +3646,7 @@
27393646
27403647 freezematerial = true;
27413648 colorField.setFloat(mat.color);
2742
- modulationField.setFloat(mat.modulation);
3649
+ saturationField.setFloat(mat.modulation);
27433650 metalnessField.setFloat(mat.metalness);
27443651 diffuseField.setFloat(mat.diffuse);
27453652 specularField.setFloat(mat.specular);
....@@ -2783,11 +3690,14 @@
27833690 }
27843691 }
27853692 }
3693
+
27863694 freezematerial = false;
27873695 }
27883696
27893697 void SetMaterial(Object3D object)
27903698 {
3699
+ latestObject = object;
3700
+
27913701 cMaterial mat = object.material;
27923702
27933703 if (mat == null)
....@@ -2798,32 +3708,8 @@
27983708
27993709 if (multiplyToggle != null)
28003710 multiplyToggle.setSelected(mat.multiply);
2801
-
2802
- assert (object.projectedVertices != null);
2803
-
2804
- if (object.projectedVertices.length <= 2)
2805
- {
2806
- // Side effect...
2807
- Object3D.cVector2[] keep = object.projectedVertices;
2808
- object.projectedVertices = new Object3D.cVector2[3];
2809
- for (int i = 0; i < 3; i++)
2810
- {
2811
- if (i < keep.length)
2812
- {
2813
- object.projectedVertices[i] = keep[i];
2814
- } else
2815
- {
2816
- object.projectedVertices[i] = new Object3D.cVector2();
2817
- }
2818
- /*
2819
- if(keep.length == 0)
2820
- object.projectedVertices[0] = new Object3D.cVector2();
2821
- else
2822
- object.projectedVertices[0] = keep[0];
2823
- object.projectedVertices[1] = new Object3D.cVector2();
2824
- */
2825
- }
2826
- }
3711
+
3712
+ AllocProjectedVertices(object);
28273713
28283714 SetMaterial(mat, object.projectedVertices);
28293715 }
....@@ -2899,12 +3785,17 @@
28993785 // }
29003786
29013787 /**/
2902
- if (deselect)
3788
+ if (deselect || child == null)
29033789 {
29043790 //group.deselectAll();
29053791 //freeze = true;
29063792 GetTree().clearSelection();
29073793 //freeze = false;
3794
+
3795
+ if (child == null)
3796
+ {
3797
+ return;
3798
+ }
29083799 }
29093800
29103801 //group.addSelectee(child);
....@@ -2938,6 +3829,17 @@
29383829 public void itemStateChanged(ItemEvent event)
29393830 {
29403831 // System.out.println("Propagate = " + propagate);
3832
+ if (event.getSource() == pinButton)
3833
+ {
3834
+ copy.pinned ^= true;
3835
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3836
+ {
3837
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3838
+ copy.CloseUI();
3839
+ //copy.editWindow.refreshContents();
3840
+ }
3841
+ }
3842
+ else
29413843 if (event.getSource() == propagateToggle)
29423844 {
29433845 propagate ^= true;
....@@ -2973,7 +3875,7 @@
29733875 cameraView.ToggleDL();
29743876 cameraView.repaint();
29753877 return;
2976
- } else if (event.getSource() == toggleTextureItem)
3878
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29773879 {
29783880 cameraView.ToggleTexture();
29793881 // june 2013 copy.HardTouch();
....@@ -3012,7 +3914,7 @@
30123914 frame.validate();
30133915
30143916 return;
3015
- } else if (event.getSource() == toggleSwitchItem)
3917
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30163918 {
30173919 cameraView.ToggleSwitch();
30183920 cameraView.repaint();
....@@ -3042,8 +3944,9 @@
30423944 } else if (event.getSource() == liveCB)
30433945 {
30443946 copy.live ^= true;
3947
+ objEditor.refreshContents(true); // To show item colors
30453948 return;
3046
- } else if (event.getSource() == selectCB)
3949
+ } else if (event.getSource() == selectableCB)
30473950 {
30483951 copy.dontselect ^= true;
30493952 return;
....@@ -3051,7 +3954,7 @@
30513954 {
30523955 copy.hide ^= true;
30533956 copy.Touch(); // display list issue
3054
- objEditor.refreshContents();
3957
+ objEditor.refreshContents(true); // To show item colors
30553958 return;
30563959 } else if (event.getSource() == link2masterCB)
30573960 {
....@@ -3116,7 +4019,7 @@
31164019 //System.out.println("ObjEditor " + event);
31174020 applySelf0(true);
31184021 //parent.applySelf();
3119
- objEditor.refreshContents();
4022
+ // conflicts with requestFocus objEditor.refreshContents();
31204023 } else if (source == resetButton)
31214024 {
31224025 CameraPane.fullreset = true;
....@@ -3228,9 +4131,9 @@
32284131 {
32294132 Close();
32304133 //return true;
3231
- } else if (source == loadItem)
4134
+ } else if (source == openItem)
32324135 {
3233
- load();
4136
+ Open();
32344137 //return true;
32354138 } else if (source == newItem)
32364139 {
....@@ -3255,6 +4158,10 @@
32554158 {
32564159 generatePOV();
32574160 //return true;
4161
+ } else if (event.getSource() == archiveItem)
4162
+ {
4163
+ cTools.Archive(frame);
4164
+ return;
32584165 } else if (source == zBufferItem)
32594166 {
32604167 try
....@@ -3292,22 +4199,26 @@
32924199
32934200 void New()
32944201 {
3295
- while (copy.Size() > 1)
4202
+ while (copy.Size() > 0)
32964203 {
3297
- copy.remove(1);
4204
+ copy.remove(0);
32984205 }
32994206
4207
+ copy.selection.clear();
4208
+
33004209 ResetModel();
4210
+ SetupViews();
33014211 objEditor.refreshContents();
33024212 }
33034213
33044214 static public byte[] Compress(Object3D o)
33054215 {
4216
+ // Slower to actually compress.
33064217 try
33074218 {
33084219 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3309
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3310
- ObjectOutputStream out = new ObjectOutputStream(zstream);
4220
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4221
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
33114222
33124223 Object3D parent = o.parent;
33134224 o.parent = null;
....@@ -3318,10 +4229,14 @@
33184229
33194230 out.flush();
33204231
3321
- zstream.close();
4232
+ baos //zstream
4233
+ .close();
33224234 out.close();
33234235
3324
- return baos.toByteArray();
4236
+ byte[] bytes = baos.toByteArray();
4237
+
4238
+ System.out.println("save #bytes = " + bytes.length);
4239
+ return bytes;
33254240 } catch (Exception e)
33264241 {
33274242 System.err.println(e);
....@@ -3331,13 +4246,16 @@
33314246
33324247 static public Object Uncompress(byte[] bytes)
33334248 {
3334
- System.out.println("#bytes = " + bytes.length);
4249
+ System.out.println("restore #bytes = " + bytes.length);
33354250 try
33364251 {
33374252 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3338
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3339
- ObjectInputStream in = new ObjectInputStream(istream);
4253
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4254
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
33404255 Object obj = in.readObject();
4256
+
4257
+ bais //istream
4258
+ .close();
33414259 in.close();
33424260
33434261 return obj;
....@@ -3392,37 +4310,97 @@
33924310 return null;
33934311 }
33944312
3395
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
33964313
33974314 public void Save()
33984315 {
3399
- cRadio tab = GetCurrentTab();
4316
+ //Save(true);
4317
+ Replace();
4318
+ SetVersionStates();
4319
+ }
4320
+
4321
+ private boolean Equal(byte[] compress, byte[] name)
4322
+ {
4323
+ if (compress.length != name.length)
4324
+ {
4325
+ return false;
4326
+ }
34004327
3401
- boolean temp = CameraPane.SWITCH;
3402
- CameraPane.SWITCH = false;
4328
+ for (int i=compress.length; --i>=0;)
4329
+ {
4330
+ if (compress[i] != name[i])
4331
+ return false;
4332
+ }
34034333
3404
- copy.ExtractBigData(hashtable);
4334
+ return true;
4335
+ }
4336
+
4337
+ void DeleteVersion()
4338
+ {
4339
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4340
+ {
4341
+ copy.versionlist[i] = copy.versionlist[i+1];
4342
+ }
4343
+
4344
+ if (copy.versionlist[copy.versionindex] == null)
4345
+ copy.versionindex -= 1;
4346
+
4347
+ if (copy.versionindex != -1)
4348
+ CopyChanged();
4349
+
4350
+ SetVersionStates();
4351
+ }
4352
+
4353
+ public boolean Save(boolean user)
4354
+ {
4355
+ System.err.println("Save");
4356
+ Replace();
4357
+
4358
+ //cRadio tab = GetCurrentTab();
4359
+
4360
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
4361
+
4362
+ boolean thesame = false;
4363
+
4364
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4365
+// {
4366
+// thesame = true;
4367
+// }
34054368
34064369 //EditorFrame.m_MainFrame.requestFocusInWindow();
3407
- tab.graphs[tab.undoindex++] = Compress(copy);
3408
-
3409
- copy.RestoreBigData(hashtable);
3410
-
3411
- CameraPane.SWITCH = temp;
3412
-
3413
- //assert(hashtable.isEmpty());
3414
-
3415
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
4370
+ if (!thesame)
34164371 {
3417
- tab.graphs[i] = null;
4372
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4373
+ {
4374
+ copy.versionlist[i] = copy.versionlist[i-1];
4375
+ }
4376
+
4377
+ //tab.user[tab.versionindex] = user;
4378
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4379
+
4380
+ copy.versionlist[++copy.versionindex] = compress;
4381
+
4382
+ // if (increment)
4383
+ // tab.versionindex++;
34184384 }
34194385
4386
+ //copy.RestoreBigData(versiontable);
4387
+
4388
+ //assert(hashtable.isEmpty());
4389
+
4390
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4391
+// {
4392
+// //tab.user[i] = false;
4393
+// copy.versionlist[i] = null;
4394
+// }
4395
+
4396
+ SetVersionStates();
4397
+
34204398 // test save
34214399 if (false)
34224400 {
34234401 try
34244402 {
3425
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
4403
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
34264404 ObjectOutputStream p = new ObjectOutputStream(ostream);
34274405
34284406 p.writeObject(copy);
....@@ -3435,26 +4413,68 @@
34354413 e.printStackTrace();
34364414 }
34374415 }
4416
+
4417
+ return !thesame;
4418
+ }
4419
+
4420
+ boolean flashIt = true;
4421
+
4422
+ void RefreshSelection()
4423
+ {
4424
+ Object3D selection = new Object3D();
4425
+
4426
+ for (int i = 0; i < copy.selection.size(); i++)
4427
+ {
4428
+ Object3D elem = copy.selection.elementAt(i);
4429
+
4430
+ Object3D obj = copy.GetObject(elem.GetUUID());
4431
+
4432
+ if (obj == null)
4433
+ {
4434
+ copy.selection.remove(i--);
4435
+ }
4436
+ else
4437
+ {
4438
+ selection.add(obj);
4439
+ copy.selection.setElementAt(obj, i);
4440
+ }
4441
+ }
4442
+
4443
+ flashIt = false;
4444
+ GetTree().clearSelection();
4445
+ for (int i = 0; i < selection.size(); i++)
4446
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4447
+ flashIt = true;
4448
+
4449
+ //refreshContents(false);
34384450 }
34394451
3440
- void CopyChanged(Object3D obj)
4452
+ void CopyChanged()
34414453 {
4454
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4455
+
4456
+ SetVersionStates();
4457
+
34424458 boolean temp = CameraPane.SWITCH;
34434459 CameraPane.SWITCH = false;
34444460
3445
- copy.ExtractBigData(hashtable);
4461
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
34464462
34474463 copy.clear();
34484464
4465
+ copy.skyboxname = obj.skyboxname;
4466
+ copy.skyboxext = obj.skyboxext;
4467
+
34494468 for (int i=0; i<obj.Size(); i++)
34504469 {
34514470 copy.add(obj.get(i));
34524471 }
34534472
3454
- copy.RestoreBigData(hashtable);
4473
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
34554474
34564475 CameraPane.SWITCH = temp;
34574476
4477
+ RefreshSelection();
34584478 //assert(hashtable.isEmpty());
34594479
34604480 copy.Touch();
....@@ -3475,43 +4495,161 @@
34754495 }
34764496 }
34774497
3478
- refreshContents();
4498
+ refreshContents(true);
34794499 }
34804500
3481
- public void Undo()
3482
- {
3483
- cRadio tab = GetCurrentTab();
4501
+ cButton previousVersionButton;
4502
+ cButton restoreButton;
4503
+ cButton replaceButton;
4504
+ cButton nextVersionButton;
4505
+ cButton saveVersionButton;
4506
+ cButton deleteVersionButton;
34844507
3485
- if (tab.undoindex == 0)
4508
+ boolean muteSlider;
4509
+
4510
+ int VersionCount()
4511
+ {
4512
+ int count = 0;
4513
+
4514
+ for (int i = copy.versionlist.length; --i >= 0;)
4515
+ {
4516
+ if (copy.versionlist[i] != null)
4517
+ count++;
4518
+ }
4519
+
4520
+ return count;
4521
+ }
4522
+
4523
+ public cGridBag versionSliderPane;
4524
+
4525
+ void SetVersionStates()
4526
+ {
4527
+ //if (true)
4528
+ // return;
4529
+
4530
+ //cRadio tab = GetCurrentTab();
4531
+
4532
+ if (copy.versionlist == null)
4533
+ {
4534
+ saveVersionButton.setEnabled(false);
4535
+ restoreButton.setEnabled(false);
4536
+ replaceButton.setEnabled(false);
4537
+ previousVersionButton.setEnabled(false);
4538
+ nextVersionButton.setEnabled(false);
4539
+ deleteVersionButton.setEnabled(false);
4540
+ versionSliderPane.setVisible(false);
4541
+ }
4542
+ else
4543
+ {
4544
+ restoreButton.setEnabled(copy.versionindex != -1);
4545
+ replaceButton.setEnabled(copy.versionindex != -1);
4546
+
4547
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4548
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4549
+
4550
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4551
+ //copy.versionlist[copy.versionindex + 1] != null);
4552
+
4553
+ muteSlider = true;
4554
+ versionSlider.setMinimum(0);
4555
+ versionSlider.setMaximum(VersionCount() - 1);
4556
+ versionSlider.setInteger(copy.versionindex);
4557
+ versionSlider.setEnabled(copy.versionindex != -1);
4558
+ muteSlider = false;
4559
+
4560
+ versionSliderPane.setVisible(true);
4561
+ }
4562
+ }
4563
+
4564
+ public boolean PreviousVersion()
4565
+ {
4566
+ // Option?
4567
+ Replace();
4568
+
4569
+ System.err.println("Undo");
4570
+
4571
+ //cRadio tab = GetCurrentTab();
4572
+
4573
+ if (copy.versionindex == 0)
34864574 {
34874575 java.awt.Toolkit.getDefaultToolkit().beep();
3488
- return;
4576
+ return false;
34894577 }
34904578
3491
- if (tab.graphs[tab.undoindex] == null)
3492
- {
3493
- Save();
3494
- tab.undoindex -= 1;
3495
- }
4579
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4580
+// {
4581
+// if (Save(false))
4582
+// tab.versionindex -= 1;
4583
+// else
4584
+// {
4585
+// if (tab.versionindex <= 0)
4586
+// return false;
4587
+// else
4588
+// tab.versionindex -= 1;
4589
+// }
4590
+// }
34964591
3497
- tab.undoindex -= 1;
4592
+ copy.versionindex -= 1;
34984593
3499
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4594
+ CopyChanged();
4595
+
4596
+ return true;
35004597 }
35014598
3502
- public void Redo()
4599
+ public boolean Restore()
35034600 {
3504
- cRadio tab = GetCurrentTab();
4601
+ System.err.println("Restore");
35054602
3506
- if (tab.graphs[tab.undoindex + 1] == null)
4603
+ //cRadio tab = GetCurrentTab();
4604
+
4605
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4606
+ {
4607
+ java.awt.Toolkit.getDefaultToolkit().beep();
4608
+ return false;
4609
+ }
4610
+
4611
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4612
+ CopyChanged();
4613
+
4614
+ return true;
4615
+ }
4616
+
4617
+ public boolean Replace()
4618
+ {
4619
+ //System.err.println("Replace");
4620
+
4621
+ //cRadio tab = GetCurrentTab();
4622
+
4623
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4624
+ {
4625
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4626
+ return false;
4627
+ }
4628
+
4629
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4630
+
4631
+ return true;
4632
+ }
4633
+
4634
+ public void NextVersion()
4635
+ {
4636
+ // Option?
4637
+ Replace();
4638
+
4639
+ //cRadio tab = GetCurrentTab();
4640
+
4641
+ if (copy.versionlist[copy.versionindex + 1] == null)
35074642 {
35084643 java.awt.Toolkit.getDefaultToolkit().beep();
35094644 return;
35104645 }
35114646
3512
- tab.undoindex += 1;
4647
+ copy.versionindex += 1;
35134648
3514
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4649
+ CopyChanged();
4650
+
4651
+ //if (!tab.user[tab.versionindex])
4652
+ // tab.graphs[tab.versionindex] = null;
35154653 }
35164654
35174655 void ImportGFD()
....@@ -3663,7 +4801,7 @@
36634801 assert false;
36644802 }
36654803
3666
- void EditSelection()
4804
+ void EditSelection(boolean newWindow)
36674805 {
36684806 }
36694807
....@@ -3705,6 +4843,12 @@
37054843 // else
37064844 // applySelf(true);
37074845 // }
4846
+
4847
+ boolean Equal(double a, double b)
4848
+ {
4849
+ return Math.abs(a - b) < 0.001;
4850
+ }
4851
+
37084852 void applySelf0(boolean name)
37094853 {
37104854 if (name)
....@@ -3722,7 +4866,7 @@
37224866 //copy.material = new cMaterial(copy.GetMaterial());
37234867
37244868 current.color = (float) colorField.getFloat();
3725
- current.modulation = (float) modulationField.getFloat();
4869
+ current.modulation = (float) saturationField.getFloat();
37264870 current.metalness = (float) metalnessField.getFloat();
37274871 current.diffuse = (float) diffuseField.getFloat();
37284872 current.specular = (float) specularField.getFloat();
....@@ -3754,29 +4898,52 @@
37544898 {
37554899 cMaterial mat = copy.material;
37564900
3757
- colorField.SetToolTipValue((mat.color));
3758
- modulationField.SetToolTipValue((mat.modulation));
3759
- metalnessField.SetToolTipValue((mat.metalness));
3760
- diffuseField.SetToolTipValue((mat.diffuse));
3761
- specularField.SetToolTipValue((mat.specular));
3762
- shininessField.SetToolTipValue((mat.shininess));
3763
- shiftField.SetToolTipValue((mat.shift));
3764
- ambientField.SetToolTipValue((mat.ambient));
3765
- lightareaField.SetToolTipValue((mat.lightarea));
3766
- diffusenessField.SetToolTipValue((mat.factor));
3767
- velvetField.SetToolTipValue((mat.velvet));
3768
- sheenField.SetToolTipValue((mat.sheen));
3769
- subsurfaceField.SetToolTipValue((mat.subsurface));
3770
- backlitField.SetToolTipValue((mat.bump));
3771
- anisoField.SetToolTipValue((mat.aniso));
3772
- anisoVField.SetToolTipValue((mat.anisoV));
3773
- cameraField.SetToolTipValue((mat.cameralight));
3774
- selfshadowField.SetToolTipValue((mat.diffuseness));
3775
- shadowField.SetToolTipValue((mat.shadow));
3776
- textureField.SetToolTipValue((mat.texture));
3777
- opacityField.SetToolTipValue((mat.opacity));
3778
- fakedepthField.SetToolTipValue((mat.fakedepth));
3779
- shadowbiasField.SetToolTipValue((mat.shadowbias));
4901
+ if (!Equal(colorField.getFloat(), mat.color))
4902
+ colorField.SetToolTipValue((mat.color));
4903
+ if (!Equal(saturationField.getFloat(), mat.modulation))
4904
+ saturationField.SetToolTipValue((mat.modulation));
4905
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
4906
+ metalnessField.SetToolTipValue((mat.metalness));
4907
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
4908
+ diffuseField.SetToolTipValue((mat.diffuse));
4909
+ if (!Equal(specularField.getFloat(), mat.specular))
4910
+ specularField.SetToolTipValue((mat.specular));
4911
+ if (!Equal(shininessField.getFloat(), mat.shininess))
4912
+ shininessField.SetToolTipValue((mat.shininess));
4913
+ if (!Equal(shiftField.getFloat(), mat.shift))
4914
+ shiftField.SetToolTipValue((mat.shift));
4915
+ if (!Equal(ambientField.getFloat(), mat.ambient))
4916
+ ambientField.SetToolTipValue((mat.ambient));
4917
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
4918
+ lightareaField.SetToolTipValue((mat.lightarea));
4919
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
4920
+ diffusenessField.SetToolTipValue((mat.factor));
4921
+ if (!Equal(velvetField.getFloat(), mat.velvet))
4922
+ velvetField.SetToolTipValue((mat.velvet));
4923
+ if (!Equal(sheenField.getFloat(), mat.sheen))
4924
+ sheenField.SetToolTipValue((mat.sheen));
4925
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
4926
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4927
+ if (!Equal(backlitField.getFloat(), mat.bump))
4928
+ backlitField.SetToolTipValue((mat.bump));
4929
+ if (!Equal(anisoField.getFloat(), mat.aniso))
4930
+ anisoField.SetToolTipValue((mat.aniso));
4931
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
4932
+ anisoVField.SetToolTipValue((mat.anisoV));
4933
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
4934
+ cameraField.SetToolTipValue((mat.cameralight));
4935
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
4936
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4937
+ if (!Equal(shadowField.getFloat(), mat.shadow))
4938
+ shadowField.SetToolTipValue((mat.shadow));
4939
+ if (!Equal(textureField.getFloat(), mat.texture))
4940
+ textureField.SetToolTipValue((mat.texture));
4941
+ if (!Equal(opacityField.getFloat(), mat.opacity))
4942
+ opacityField.SetToolTipValue((mat.opacity));
4943
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
4944
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4945
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
4946
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
37804947 }
37814948
37824949 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -3807,9 +4974,28 @@
38074974 //copy.Touch();
38084975 }
38094976
4977
+ cNumberSlider versionSlider;
4978
+
38104979 public void stateChanged(ChangeEvent e)
38114980 {
3812
- // assert(false);
4981
+ // assert(false);
4982
+ if (e.getSource() == versionSlider)
4983
+ {
4984
+ if (muteSlider)
4985
+ return;
4986
+
4987
+ Replace();
4988
+
4989
+ int version = versionSlider.getInteger();
4990
+
4991
+ if (version != -1 && copy.versionlist[version] != null)
4992
+ {
4993
+ copy.versionindex = version;
4994
+ CopyChanged();
4995
+ }
4996
+
4997
+ return;
4998
+ }
38134999
38145000 if (freezematerial)
38155001 {
....@@ -3845,6 +5031,12 @@
38455031 {
38465032 //System.out.println("stateChanged = " + this);
38475033 materialtouched = true;
5034
+
5035
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
5036
+ {
5037
+ saturationField.setFloat(1);
5038
+ }
5039
+
38485040 applySelf();
38495041 //System.out.println("this = " + this);
38505042 //System.out.println("PARENT = " + parent);
....@@ -4144,6 +5336,7 @@
41445336 {
41455337 if (GetTree() != null)
41465338 {
5339
+ GetTree().revalidate();
41475340 GetTree().repaint();
41485341 }
41495342
....@@ -4152,13 +5345,19 @@
41525345 ctrlPanel.validate(); // ? new
41535346 ctrlPanel.repaint();
41545347 }
5348
+
5349
+ if (previousVersionButton != null && copy.versionlist != null)
5350
+ SetVersionStates();
5351
+
5352
+ cameraView.requestFocusInWindow();
41555353 }
41565354
41575355 static TweenManager tweenManager = new TweenManager();
41585356
41595357 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
41605358 {
4161
- Save();
5359
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5360
+ Save();
41625361 //Tween.set(thing, 0).target(1).start(tweenManager);
41635362 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
41645363 // if (thing instanceof GenericJointDemo)
....@@ -4182,7 +5381,7 @@
41825381 // group = (Composite) group.get(0);
41835382 // }
41845383
4185
- System.out.println("makeSomething of " + thing);
5384
+ //System.out.println("makeSomething of " + thing);
41865385
41875386 /*
41885387 if (deselect && jList != null)
....@@ -4245,6 +5444,12 @@
42455444 {
42465445 ResetModel();
42475446 Select(thing.GetTreePath(), true, false); // unselect... false);
5447
+
5448
+ if (thing.Size() == 0)
5449
+ {
5450
+ //EditSelection(false);
5451
+ }
5452
+
42485453 refreshContents();
42495454 }
42505455
....@@ -4393,7 +5598,9 @@
43935598 readobj.ResetDisplayList();
43945599 } catch (Exception e)
43955600 {
4396
- //e.printStackTrace();
5601
+ if (!e.toString().contains("GZIP"))
5602
+ e.printStackTrace();
5603
+
43975604 try
43985605 {
43995606 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4467,11 +5674,14 @@
44675674
44685675 if (readobj != null)
44695676 {
4470
- Save();
5677
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5678
+ // Save();
44715679 try
44725680 {
44735681 //readobj.deepCopySelf(copy);
44745682 copy.clear(); // june 2014
5683
+ copy.skyboxname = readobj.skyboxname;
5684
+ copy.skyboxext = readobj.skyboxext;
44755685 for (int i = 0; i < readobj.size(); i++)
44765686 {
44775687 Object3D child = readobj.get(i); // reserve(i);
....@@ -4512,6 +5722,7 @@
45125722 }
45135723 } catch (ClassCastException e)
45145724 {
5725
+ e.printStackTrace();
45155726 assert (false);
45165727 Composite c = (Composite) copy;
45175728 c.children.clear();
....@@ -4522,17 +5733,32 @@
45225733 c.addChild(csg);
45235734 }
45245735
5736
+ copy.versionlist = readobj.versionlist;
5737
+ copy.versionindex = readobj.versionindex;
5738
+ copy.versiontable = readobj.versiontable;
5739
+
5740
+ if (copy.versionlist == null)
5741
+ {
5742
+ // Backward compatibility
5743
+ copy.versionlist = new Object3D[100];
5744
+ copy.versionindex = -1;
5745
+
5746
+ //Save(true);
5747
+ }
5748
+
5749
+ //? SetUndoStates();
5750
+
45255751 ResetModel();
45265752 copy.HardTouch(); // recompile?
45275753 refreshContents();
45285754 }
45295755 }
45305756
4531
- void load() // throws ClassNotFoundException
5757
+ void Open() // throws ClassNotFoundException
45325758 {
45335759 if (Grafreed.standAlone)
45345760 {
4535
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5761
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
45365762 browser.show();
45375763 String filename = browser.getFile();
45385764 if (filename != null && filename.length() > 0)
....@@ -4609,6 +5835,8 @@
46095835
46105836 void save()
46115837 {
5838
+ Replace();
5839
+
46125840 if (lastname == null)
46135841 {
46145842 return;
....@@ -4631,6 +5859,7 @@
46315859 //ps.print(buffer.toString());
46325860 } catch (IOException e)
46335861 {
5862
+ e.printStackTrace();
46345863 }
46355864 }
46365865
....@@ -4645,6 +5874,8 @@
46455874 String filename = browser.getFile();
46465875 if (filename != null && filename.length() > 0)
46475876 {
5877
+ if (!filename.endsWith(".gfd"))
5878
+ filename += ".gfd";
46485879 lastname = browser.getDirectory() + filename;
46495880 save();
46505881 }
....@@ -4811,7 +6042,7 @@
48116042 MenuBar menuBar;
48126043 Menu fileMenu;
48136044 MenuItem newItem;
4814
- MenuItem loadItem;
6045
+ MenuItem openItem;
48156046 MenuItem saveItem;
48166047 MenuItem saveAsItem;
48176048 MenuItem exportAsItem;
....@@ -4834,22 +6065,38 @@
48346065 CheckboxMenuItem toggleSwitchItem;
48356066 CheckboxMenuItem toggleRootItem;
48366067 CheckboxMenuItem animationItem;
6068
+ MenuItem archiveItem;
48376069 CheckboxMenuItem toggleHandleItem;
48386070 CheckboxMenuItem togglePaintItem;
48396071 JSplitPane mainPanel;
48406072 JScrollPane scrollpane;
6073
+
48416074 JPanel toolbarPanel;
6075
+
48426076 cGridBag treePanel;
6077
+
48436078 JPanel radioPanel;
48446079 ButtonGroup buttonGroup;
4845
- cGridBag ctrlPanel;
6080
+
6081
+ cGridBag toolboxPanel;
6082
+ cGridBag skyboxPanel;
48466083 cGridBag materialPanel;
6084
+ cGridBag ctrlPanel;
6085
+
48476086 JScrollPane infoPanel;
6087
+
48486088 cGridBag optionsPanel;
6089
+
48496090 JTabbedPane objectPanel;
6091
+ boolean materialFlushed;
6092
+ Object3D latestObject;
6093
+
6094
+ cGridBag transformPanel;
48506095 cGridBag XYZPanel;
6096
+
48516097 JSplitPane gridPanel;
48526098 JSplitPane bigPanel;
6099
+
48536100 cGridBag bigThree;
48546101 cGridBag scenePanel;
48556102 cGridBag centralPanel;
....@@ -4907,7 +6154,7 @@
49076154 JLabel colorLabel;
49086155 cNumberSlider colorField;
49096156 JLabel modulationLabel;
4910
- cNumberSlider modulationField;
6157
+ cNumberSlider saturationField;
49116158 JLabel metalnessLabel;
49126159 cNumberSlider metalnessField;
49136160 JLabel diffuseLabel;
....@@ -4938,6 +6185,7 @@
49386185 cNumberSlider anisoField;
49396186 JLabel anisoVLabel;
49406187 cNumberSlider anisoVField;
6188
+
49416189 JLabel cameraLabel;
49426190 cNumberSlider cameraField;
49436191 JLabel selfshadowLabel;
....@@ -4952,6 +6200,7 @@
49526200 cNumberSlider fakedepthField;
49536201 JLabel shadowbiasLabel;
49546202 cNumberSlider shadowbiasField;
6203
+
49556204 JLabel bumpLabel;
49566205 cNumberSlider bumpField;
49576206 JLabel noiseLabel;
....@@ -4964,7 +6213,7 @@
49646213 cNumberSlider fogField;
49656214 JLabel opacityPowerLabel;
49666215 cNumberSlider opacityPowerField;
4967
- JTree jTree;
6216
+ cTree jTree;
49686217 //ObjectUI parent;
49696218
49706219 cNumberSlider normalpushField;