Normand Briere
2019-08-08 8294241adc5fe698b70e13ebd6780af46ab83f7e
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,11 +34,87 @@
3034 iSendInfo
3135 //KeyListener
3236 {
37
+ public cToggleButton pinButton;
3338 boolean timeline;
3439 boolean wasFullScreen;
3540
3641 GroupEditor callee;
3742 JFrame frame;
43
+
44
+ static ObjEditor theFrame;
45
+
46
+ public cGridBag GetSeparator()
47
+ {
48
+ cGridBag separator = new cGridBag();
49
+ separator.add(new JSeparator());
50
+ separator.preferredHeight = 5;
51
+ return separator;
52
+ }
53
+
54
+ cButton GetButton(String name, boolean border)
55
+ {
56
+ ImageIcon icon = GetIcon(name);
57
+ return new cButton(icon, border);
58
+ }
59
+
60
+ cLabel GetLabel(String name, boolean border)
61
+ {
62
+ //ImageIcon icon = GetIcon(name);
63
+ return new cLabel(GetImage(name), border);
64
+ }
65
+
66
+ cToggleButton GetToggleButton(String name, boolean border)
67
+ {
68
+ ImageIcon icon = GetIcon(name);
69
+ return new cToggleButton(icon, border);
70
+ }
71
+
72
+ cCheckBox GetCheckBox(String name, boolean border)
73
+ {
74
+ ImageIcon icon = GetIcon(name);
75
+ return new cCheckBox(icon, border);
76
+ }
77
+
78
+ ImageIcon GetIcon(String name)
79
+ {
80
+ try
81
+ {
82
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
83
+
84
+// if (image.getWidth() > 48 && image.getHeight() > 48)
85
+// {
86
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
87
+// Graphics2D g = resized.createGraphics();
88
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
89
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
90
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
91
+// g.dispose();
92
+//
93
+// image = resized;
94
+// }
95
+
96
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
97
+ return icon;
98
+ }
99
+ catch (Exception e)
100
+ {
101
+ return null;
102
+ }
103
+ }
104
+
105
+ BufferedImage GetImage(String name)
106
+ {
107
+ try
108
+ {
109
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
110
+
111
+ return image;
112
+ }
113
+ catch (Exception e)
114
+ {
115
+ return null;
116
+ }
117
+ }
38118
39119 // SCRIPT
40120
....@@ -145,7 +225,7 @@
145225
146226 objEditor.ctrlPanel.remove(namePanel);
147227
148
- if (!GroupEditor.allparams)
228
+ if (!allparams)
149229 return;
150230
151231 // objEditor.ctrlPanel.remove(liveCB);
....@@ -169,7 +249,7 @@
169249
170250 objEditor.ctrlPanel.remove(setupPanel);
171251 objEditor.ctrlPanel.remove(setupPanel2);
172
- objEditor.ctrlPanel.remove(commandsPanel);
252
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
173253 objEditor.ctrlPanel.remove(pushPanel);
174254 //objEditor.ctrlPanel.remove(fillPanel);
175255
....@@ -217,6 +297,12 @@
217297 client = inClient;
218298 copy = client;
219299
300
+ if (copy.versionlist == null)
301
+ {
302
+ copy.versionlist = new Object3D[100];
303
+ copy.versionindex = -1;
304
+ }
305
+
220306 // "this" is not called: SetupUI2(objEditor);
221307 }
222308
....@@ -230,6 +316,12 @@
230316 client = inClient;
231317 copy = client;
232318
319
+ if (copy.versionlist == null)
320
+ {
321
+ copy.versionlist = new Object3D[100];
322
+ copy.versionindex = -1;
323
+ }
324
+
233325 SetupUI2(callee.GetEditor());
234326 }
235327
....@@ -244,6 +336,7 @@
244336 //localCopy.parent = null;
245337
246338 frame = new JFrame();
339
+ frame.setUndecorated(false);
247340 objEditor = this;
248341 this.callee = callee;
249342
....@@ -261,6 +354,12 @@
261354 copy = localCopy;
262355 copy.editWindow = this;
263356
357
+ if (copy.versionlist == null)
358
+ {
359
+// copy.versions = new byte[100][];
360
+// copy.versionindex = -1;
361
+ }
362
+
264363 SetupMenu();
265364
266365 //SetupName(objEditor); // new
....@@ -274,12 +373,17 @@
274373 return frame.action(event, obj);
275374 }
276375
376
+ // Cannot work without static
377
+ static boolean allparams = true;
378
+
379
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
380
+
277381 void SetupMenu()
278382 {
279383 frame.setMenuBar(menuBar = new MenuBar());
280384 menuBar.add(fileMenu = new Menu("File"));
281385 fileMenu.add(newItem = new MenuItem("New"));
282
- fileMenu.add(loadItem = new MenuItem("Open..."));
386
+ fileMenu.add(openItem = new MenuItem("Open..."));
283387
284388 //oe.menuBar.add(menu = new Menu("Include"));
285389 Menu menu = new Menu("Import");
....@@ -311,7 +415,7 @@
311415 }
312416
313417 newItem.addActionListener(this);
314
- loadItem.addActionListener(this);
418
+ openItem.addActionListener(this);
315419 saveItem.addActionListener(this);
316420 saveAsItem.addActionListener(this);
317421 exportAsItem.addActionListener(this);
....@@ -320,28 +424,70 @@
320424 closeItem.addActionListener(this);
321425
322426 objectPanel = new JTabbedPane();
427
+
428
+ ChangeListener changeListener = new ChangeListener()
429
+ {
430
+ public void stateChanged(ChangeEvent changeEvent)
431
+ {
432
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
433
+// {
434
+// if (latestObject != null)
435
+// {
436
+// refreshContents(true);
437
+// SetMaterial(latestObject);
438
+// }
439
+//
440
+// materialFlushed = true;
441
+// }
442
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
443
+// {
444
+// if (listUI.size() == 0)
445
+// EditSelection(false);
446
+// }
447
+
448
+ refreshContents(false); // To refresh Info tab
449
+ }
450
+ };
451
+ objectPanel.addChangeListener(changeListener);
452
+
323453 toolbarPanel = new JPanel();
324454 toolbarPanel.setName("Toolbar");
455
+
325456 treePanel = new cGridBag();
326457 treePanel.setName("Tree");
458
+
459
+ editPanel = new cGridBag().setVertical(true);
460
+ //editPanel.setName("Edit");
461
+
327462 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
328
- ctrlPanel.setName("Edit");
329
- materialPanel = new cGridBag().setVertical(true);
330
- materialPanel.setName("Material");
463
+
464
+ editCommandsPanel = new cGridBag();
465
+ editPanel.add(editCommandsPanel);
466
+ editPanel.add(ctrlPanel);
467
+
468
+ toolboxPanel = new cGridBag().setVertical(true);
469
+ //toolboxPanel.setName("Toolbox");
470
+
471
+ skyboxPanel = new cGridBag().setVertical(true);
472
+
473
+ materialPanel = new cGridBag().setVertical(false);
474
+ //materialPanel.setName("Material");
475
+
331476 /*JTextPane*/
332477 infoarea = createTextPane();
333478 doc = infoarea.getStyledDocument();
334479
335480 infoarea.setEditable(true);
336481 SetText();
482
+
337483 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
338484 // infoarea.setOpaque(false);
339485 // //infoarea.setForeground(textcolor);
340486 // TEXTAREA infoarea.setLineWrap(true);
341487 // TEXTAREA infoarea.setWrapStyleWord(true);
342488 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
343
- infoPanel.setPreferredSize(new Dimension(50, 200));
344
- infoPanel.setName("Info");
489
+ infoPanel.setPreferredSize(new Dimension(1, 1));
490
+ //infoPanel.setName("Info");
345491 //infoPanel.setLayout(new BorderLayout());
346492 //infoPanel.add(createTextPane());
347493
....@@ -352,7 +498,14 @@
352498 mainPanel.setDividerSize(9);
353499 mainPanel.setDividerLocation(0.5); //1.0);
354500 mainPanel.setResizeWeight(0.5);
355
-
501
+
502
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
503
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
504
+ divider.setDividerSize(15);
505
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
506
+
507
+ mainPanel.setUI(new BasicSplitPaneUI());
508
+
356509 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
357510 //mainPanel.setLayout(new GridBagLayout());
358511 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -583,21 +736,147 @@
583736 }
584737 }
585738
739
+//static GraphicsDevice device = GraphicsEnvironment
740
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
741
+
742
+ Rectangle keeprect;
743
+ cRadio radio;
744
+
745
+cButton keepButton;
746
+ cButton twoButton; // Full 3D
747
+ cButton sixButton;
748
+ cButton threeButton;
749
+ cButton sevenButton;
750
+ cButton fourButton; // full panel
751
+ cButton oneButton; // full XYZ
752
+ //cButton currentLayout;
753
+
754
+ boolean maximized;
755
+
756
+ cButton fullscreenLayout;
757
+
758
+ void Minimize()
759
+ {
760
+ frame.setState(Frame.ICONIFIED);
761
+ frame.validate();
762
+ }
763
+
764
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
765
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
766
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
767
+ void Maximize()
768
+ {
769
+ if (CameraPane.FULLSCREEN)
770
+ {
771
+ ToggleFullScreen();
772
+ }
773
+
774
+ if (maximized)
775
+ {
776
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
777
+ }
778
+ else
779
+ {
780
+ keeprect = frame.getBounds();
781
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
782
+// Dimension rect2 = frame.getToolkit().getScreenSize();
783
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
784
+// frame.setState(Frame.MAXIMIZED_BOTH);
785
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
786
+ }
787
+
788
+ maximized ^= true;
789
+
790
+ frame.validate();
791
+ }
792
+
793
+ cButton minButton;
794
+ cButton maxButton;
795
+ cButton fullButton;
796
+
586797 void ToggleFullScreen()
587798 {
588
- if (CameraPane.FULLSCREEN)
799
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
800
+
801
+ cameraView.ToggleFullScreen();
802
+
803
+ if (!CameraPane.FULLSCREEN)
589804 {
590
- frame.getContentPane().remove(/*"Center",*/bigThree);
591
- framePanel.add(bigThree);
592
- frame.getContentPane().add(/*"Center",*/framePanel);
805
+ device.setFullScreenWindow(null);
806
+ frame.dispose();
807
+ frame.setUndecorated(false);
808
+ frame.validate();
809
+ frame.setVisible(true);
810
+
811
+ //frame.setVisible(false);
812
+// frame.removeNotify();
813
+// frame.setUndecorated(false);
814
+// frame.addNotify();
815
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
816
+
817
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
818
+// X framePanel.add(bigThree);
819
+// X frame.getContentPane().add(/*"Center",*/framePanel);
820
+ framePanel.setDividerLocation(46);
821
+
822
+ //frame.setVisible(true);
823
+ radio.layout = keepButton;
824
+ //theFrame = null;
825
+ keepButton = null;
826
+ radio.layout.doClick();
827
+
593828 } else
594829 {
595
- frame.getContentPane().remove(/*"Center",*/framePanel);
596
- framePanel.remove(bigThree);
597
- frame.getContentPane().add(/*"Center",*/bigThree);
830
+ keepButton = radio.layout;
831
+ //keeprect = frame.getBounds();
832
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
833
+// frame.getToolkit().getScreenSize().height);
834
+ //frame.setVisible(false);
835
+
836
+ frame.dispose();
837
+ frame.setUndecorated(true);
838
+ device.setFullScreenWindow(frame);
839
+ frame.validate();
840
+ frame.setVisible(true);
841
+// frame.removeNotify();
842
+// frame.setUndecorated(true);
843
+// frame.addNotify();
844
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
845
+// X framePanel.remove(bigThree);
846
+// X frame.getContentPane().add(/*"Center",*/bigThree);
847
+ framePanel.setDividerLocation(0);
848
+
849
+ radio.layout = fullscreenLayout;
850
+ radio.layout.doClick();
851
+ //frame.setVisible(true);
598852 }
599
- cameraView.ToggleFullScreen();
853
+ frame.validate();
854
+
855
+ cameraView.requestFocusInWindow();
600856 }
857
+
858
+ private Object3D CompressCopy()
859
+ {
860
+ boolean temp = CameraPane.SWITCH;
861
+ CameraPane.SWITCH = false;
862
+
863
+ copy.ExtractBigData(versiontable);
864
+ // if (copy == client)
865
+
866
+ Object3D versions[] = copy.versionlist;
867
+ copy.versionlist = null;
868
+
869
+ //byte[] compress = Compress(copy);
870
+ Object3D compress = (Object3D)Grafreed.clone(copy);
871
+
872
+ copy.versionlist = versions;
873
+
874
+ copy.RestoreBigData(versiontable);
875
+
876
+ CameraPane.SWITCH = temp;
877
+
878
+ return compress;
879
+ }
601880
602881 private JTextPane createTextPane()
603882 {
....@@ -720,6 +999,7 @@
720999 {
7211000 SetupMaterial(materialPanel);
7221001 }
1002
+
7231003 //SetupName();
7241004 //SetupViews();
7251005 }
....@@ -729,7 +1009,7 @@
7291009 // NumberSlider vDivsField;
7301010 // JCheckBox endcaps;
7311011 JCheckBox liveCB;
732
- JCheckBox selectCB;
1012
+ JCheckBox selectableCB;
7331013 JCheckBox hideCB;
7341014 JCheckBox link2masterCB;
7351015 JCheckBox markCB;
....@@ -737,7 +1017,12 @@
7371017 JCheckBox speedupCB;
7381018 JCheckBox rewindCB;
7391019 JCheckBox flipVCB;
1020
+
1021
+ cCheckBox toggleTextureCB;
1022
+ cCheckBox toggleSwitchCB;
1023
+
7401024 JComboBox texresMenu;
1025
+
7411026 JButton resetButton;
7421027 JButton stepButton;
7431028 JButton stepAllButton;
....@@ -746,10 +1031,13 @@
7461031 JButton fasterButton;
7471032 JButton remarkButton;
7481033
1034
+ cGridBag editPanel;
1035
+ cGridBag editCommandsPanel;
1036
+
7491037 cGridBag namePanel;
7501038 cGridBag setupPanel;
7511039 cGridBag setupPanel2;
752
- cGridBag commandsPanel;
1040
+ cGridBag objectCommandsPanel;
7531041 cGridBag pushPanel;
7541042 cGridBag fillPanel;
7551043
....@@ -920,39 +1208,55 @@
9201208
9211209 namePanel = new cGridBag();
9221210
1211
+ //if (copy.pinned)
1212
+ {
1213
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1214
+ pinButton.setSelected(copy.pinned);
1215
+ cGridBag t = new cGridBag();
1216
+ t.preferredWidth = 2;
1217
+ t.add(pinButton);
1218
+ namePanel.add(t);
1219
+
1220
+ pinButton.addItemListener(this);
1221
+ }
1222
+
9231223 nameField = AddText(namePanel, copy.GetName());
924
- namePanel.add(nameField);
1224
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9251225 oe.ctrlPanel.add(namePanel);
9261226
9271227 oe.ctrlPanel.Return();
9281228
929
- if (!GroupEditor.allparams)
1229
+ if (!allparams)
9301230 return;
9311231
9321232 setupPanel = new cGridBag().setVertical(false);
9331233
9341234 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
9351235 liveCB.setToolTipText("Animate object");
936
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
937
- selectCB.setToolTipText("Make object selectable");
1236
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1237
+ selectableCB.setToolTipText("Make object selectable");
9381238 // Return();
1239
+
9391240 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
9401241 hideCB.setToolTipText("Hide object");
9411242 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
942
- markCB.setToolTipText("Set the animation target transform");
1243
+ markCB.setToolTipText("As animation target transform");
1244
+
1245
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
9431246
9441247 setupPanel2 = new cGridBag().setVertical(false);
9451248
9461249 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
9471250 rewindCB.setToolTipText("Rewind animation");
9481251
949
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
950
- randomCB.setToolTipText("Rewind or Go back and forth randomly");
1252
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1253
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
9511254
1255
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1256
+ link2masterCB.setToolTipText("Attach to support");
1257
+
9521258 if (Globals.ADVANCED)
9531259 {
954
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
955
- link2masterCB.setToolTipText("Attach to support");
9561260 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
9571261 speedupCB.setToolTipText("Option motion capture");
9581262 }
....@@ -962,23 +1266,23 @@
9621266 oe.ctrlPanel.add(setupPanel2);
9631267 oe.ctrlPanel.Return();
9641268
965
- commandsPanel = new cGridBag().setVertical(false);
1269
+ objectCommandsPanel = new cGridBag().setVertical(false);
9661270
967
- resetButton = AddButton(commandsPanel, "Reset");
1271
+ resetButton = AddButton(objectCommandsPanel, "Reset");
9681272 resetButton.setToolTipText("Jump to frame zero");
969
- stepButton = AddButton(commandsPanel, "Step");
1273
+ stepButton = AddButton(objectCommandsPanel, "Step");
9701274 stepButton.setToolTipText("Step one frame");
9711275 // resetAllButton = AddButton(oe, "Reset All");
9721276 // stepAllButton = AddButton(oe, "Step All");
9731277 // Return();
974
- slowerButton = AddButton(commandsPanel, "Slow");
1278
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
9751279 slowerButton.setToolTipText("Decrease animation speed");
976
- fasterButton = AddButton(commandsPanel, "Fast");
1280
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
9771281 fasterButton.setToolTipText("Increase animation speed");
978
- remarkButton = AddButton(commandsPanel, "Remark");
1282
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
9791283 remarkButton.setToolTipText("Set the current transform as the target");
9801284
981
- oe.ctrlPanel.add(commandsPanel);
1285
+ oe.ctrlPanel.add(objectCommandsPanel);
9821286 oe.ctrlPanel.Return();
9831287
9841288 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1184,8 +1488,11 @@
11841488 //worldPanel.setName("World");
11851489 centralPanel = new cGridBag();
11861490 centralPanel.preferredWidth = 20;
1187
- timelinePanel = new JPanel(new BorderLayout());
1188
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1491
+
1492
+ if (Globals.ADVANCED)
1493
+ {
1494
+ timelinePanel = new JPanel(new BorderLayout());
1495
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11891496
11901497 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11911498 cameraPanel.setContinuousLayout(true);
....@@ -1194,7 +1501,10 @@
11941501 // cameraPanel.setDividerSize(9);
11951502 cameraPanel.setResizeWeight(1.0);
11961503
1504
+ }
1505
+
11971506 centralPanel.add(cameraView);
1507
+ centralPanel.setFocusable(true);
11981508 //frame.setJMenuBar(timelineMenubar);
11991509 //centralPanel.add(timelinePanel);
12001510
....@@ -1220,6 +1530,7 @@
12201530 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12211531 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12221532 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1533
+ //XYZPanel.setName("XYZ");
12231534
12241535 /*
12251536 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1257,13 +1568,29 @@
12571568 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12581569 //tmp.setName("Edit");
12591570 objectPanel.add(materialPanel);
1571
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1572
+ objectPanel.setToolTipTextAt(0, "Material");
1573
+
1574
+ objectPanel.add(toolboxPanel);
1575
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1576
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1577
+
1578
+ objectPanel.add(skyboxPanel);
1579
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1580
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1581
+
12601582 // JPanel north = new JPanel(new BorderLayout());
12611583 // north.setName("Edit");
12621584 // north.add(ctrlPanel, BorderLayout.NORTH);
12631585 // objectPanel.add(north);
1264
- objectPanel.add(ctrlPanel);
1265
- objectPanel.add(infoPanel);
1266
-
1586
+ objectPanel.add(editPanel);
1587
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1588
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1589
+
1590
+ objectPanel.add(XYZPanel);
1591
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1592
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1593
+
12671594 /*
12681595 aConstraints.gridx = 0;
12691596 aConstraints.gridwidth = 1;
....@@ -1271,7 +1598,7 @@
12711598 aConstraints.gridy += 1;
12721599 aConstraints.gridwidth = 1;
12731600 mainPanel.add(objectPanel, aConstraints);
1274
- */
1601
+ */
12751602
12761603 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12771604 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1283,14 +1610,12 @@
12831610 scrollpane.addMouseWheelListener(this); // Default not fast enough
12841611
12851612 /*JTabbedPane*/ scenePanel = new cGridBag();
1286
- scenePanel.preferredWidth = 6;
1613
+ scenePanel.preferredWidth = 5;
12871614
12881615 JTabbedPane tabbedPane = new JTabbedPane();
12891616 tabbedPane.add(scrollpane);
12901617
1291
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1292
-
1293
- optionsPanel = new cGridBag().setVertical(true);
1618
+ optionsPanel = new cGridBag().setVertical(false);
12941619
12951620 optionsPanel.setName("Options");
12961621
....@@ -1298,8 +1623,15 @@
12981623
12991624 tabbedPane.add(optionsPanel);
13001625
1626
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1627
+
13011628 scenePanel.add(tabbedPane);
13021629
1630
+ //if (Globals.ADVANCED)
1631
+ tabbedPane.add(infoPanel);
1632
+ tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1633
+ tabbedPane.setToolTipTextAt(3, "Information");
1634
+
13031635 /*
13041636 cTree jTree = new cTree(null);
13051637 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1361,7 +1693,7 @@
13611693 bigThree = new cGridBag();
13621694 bigThree.addComponent(scenePanel);
13631695 bigThree.addComponent(centralPanel);
1364
- bigThree.addComponent(XYZPanel);
1696
+ //bigThree.addComponent(XYZPanel);
13651697
13661698 // // SIDE EFFECT!!!
13671699 // aConstraints.gridx = 0;
....@@ -1370,9 +1702,9 @@
13701702 // aConstraints.gridheight = 1;
13711703
13721704 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1373
- framePanel.setContinuousLayout(true);
1374
- framePanel.setOneTouchExpandable(true);
1375
- framePanel.setDividerLocation(0.8);
1705
+ framePanel.setContinuousLayout(false);
1706
+ framePanel.setOneTouchExpandable(false);
1707
+ //.setDividerLocation(0.8);
13761708 //framePanel.setDividerSize(15);
13771709 //framePanel.setResizeWeight(0.15);
13781710 framePanel.setName("Frame");
....@@ -1390,14 +1722,18 @@
13901722 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911723
13921724 frame.setSize(1280, 860);
1393
- frame.setVisible(true);
1394
-
1725
+
1726
+ cameraView.requestFocusInWindow();
1727
+
13951728 gridPanel.setDividerLocation(1.0);
1729
+
1730
+ frame.validate();
1731
+
1732
+ frame.setVisible(true);
13961733
13971734 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13981735 frame.addWindowListener(new WindowAdapter()
13991736 {
1400
-
14011737 public void windowClosing(WindowEvent e)
14021738 {
14031739 Close();
....@@ -1420,12 +1756,384 @@
14201756 ctrlPanel.removeAll();
14211757 }
14221758
1423
- void SetupMaterial(cGridBag panel)
1759
+ void SetupMaterial(cGridBag materialpanel)
14241760 {
1425
- /*
1761
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1762
+
1763
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1764
+ skin.setToolTipText("Skin");
1765
+ skin.addMouseListener(new MouseAdapter()
1766
+ {
1767
+ public void mouseClicked(MouseEvent e)
1768
+ {
1769
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1770
+ cMaterial material = object.material;
1771
+
1772
+ // Skin
1773
+ colorField.setFloat(material.color);
1774
+ saturationField.setFloat(material.modulation);
1775
+ subsurfaceField.setFloat(material.subsurface);
1776
+ selfshadowField.setFloat(material.diffuseness);
1777
+ diffusenessField.setFloat(material.factor);
1778
+ shininessField.setFloat(material.shininess);
1779
+ shadowbiasField.setFloat(material.shadowbias);
1780
+ diffuseField.setFloat(material.diffuse);
1781
+ specularField.setFloat(material.specular);
1782
+
1783
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1784
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1785
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1786
+
1787
+ materialtouched = true;
1788
+ applySelf();
1789
+ }
1790
+ });
1791
+ presetpanel.add(skin);
1792
+
1793
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1794
+ lambert.setToolTipText("Diffuse");
1795
+ lambert.addMouseListener(new MouseAdapter()
1796
+ {
1797
+ public void mouseClicked(MouseEvent e)
1798
+ {
1799
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1800
+ cMaterial material = object.material;
1801
+
1802
+ diffusenessField.setFloat(material.factor);
1803
+ selfshadowField.setFloat(material.diffuseness);
1804
+
1805
+ materialtouched = true;
1806
+ applySelf();
1807
+ }
1808
+ });
1809
+ presetpanel.add(lambert);
1810
+
1811
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1812
+ diffuse2.setToolTipText("Diffuse2");
1813
+ diffuse2.addMouseListener(new MouseAdapter()
1814
+ {
1815
+ public void mouseClicked(MouseEvent e)
1816
+ {
1817
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1818
+ cMaterial material = object.material;
1819
+
1820
+ diffusenessField.setFloat(material.factor);
1821
+ selfshadowField.setFloat(material.diffuseness);
1822
+
1823
+ materialtouched = true;
1824
+ applySelf();
1825
+ }
1826
+ });
1827
+ presetpanel.add(diffuse2);
1828
+
1829
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1830
+ diffusemoon.setToolTipText("Moon");
1831
+ diffusemoon.addMouseListener(new MouseAdapter()
1832
+ {
1833
+ public void mouseClicked(MouseEvent e)
1834
+ {
1835
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1836
+ cMaterial material = object.material;
1837
+
1838
+ diffusenessField.setFloat(material.factor);
1839
+ selfshadowField.setFloat(material.diffuseness);
1840
+
1841
+ materialtouched = true;
1842
+ applySelf();
1843
+ }
1844
+ });
1845
+ presetpanel.add(diffusemoon);
1846
+
1847
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1848
+ diffusemoon2.setToolTipText("Moon2");
1849
+ diffusemoon2.addMouseListener(new MouseAdapter()
1850
+ {
1851
+ public void mouseClicked(MouseEvent e)
1852
+ {
1853
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1854
+ cMaterial material = object.material;
1855
+
1856
+ diffusenessField.setFloat(material.factor);
1857
+ selfshadowField.setFloat(material.diffuseness);
1858
+
1859
+ materialtouched = true;
1860
+ applySelf();
1861
+ }
1862
+ });
1863
+ presetpanel.add(diffusemoon2);
1864
+
1865
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1866
+ diffusemoon3.setToolTipText("Moon3");
1867
+ diffusemoon3.addMouseListener(new MouseAdapter()
1868
+ {
1869
+ public void mouseClicked(MouseEvent e)
1870
+ {
1871
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1872
+ cMaterial material = object.material;
1873
+
1874
+ diffusenessField.setFloat(material.factor);
1875
+ selfshadowField.setFloat(material.diffuseness);
1876
+
1877
+ materialtouched = true;
1878
+ applySelf();
1879
+ }
1880
+ });
1881
+ presetpanel.add(diffusemoon3);
1882
+
1883
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1884
+ diffusesheen.setToolTipText("Sheen");
1885
+ diffusesheen.addMouseListener(new MouseAdapter()
1886
+ {
1887
+ public void mouseClicked(MouseEvent e)
1888
+ {
1889
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1890
+ cMaterial material = object.material;
1891
+
1892
+ sheenField.setFloat(material.sheen);
1893
+
1894
+ materialtouched = true;
1895
+ applySelf();
1896
+ }
1897
+ });
1898
+ presetpanel.add(diffusesheen);
1899
+
1900
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1901
+ rough.setToolTipText("Rough metal");
1902
+ rough.addMouseListener(new MouseAdapter()
1903
+ {
1904
+ public void mouseClicked(MouseEvent e)
1905
+ {
1906
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1907
+ cMaterial material = object.material;
1908
+
1909
+ shininessField.setFloat(material.shininess);
1910
+ velvetField.setFloat(material.velvet);
1911
+
1912
+ materialtouched = true;
1913
+ applySelf();
1914
+ }
1915
+ });
1916
+ presetpanel.add(rough);
1917
+
1918
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
1919
+ rough2.setToolTipText("Medium metal");
1920
+ rough2.addMouseListener(new MouseAdapter()
1921
+ {
1922
+ public void mouseClicked(MouseEvent e)
1923
+ {
1924
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
1925
+ cMaterial material = object.material;
1926
+
1927
+ shininessField.setFloat(material.shininess);
1928
+ lightareaField.setFloat(material.lightarea);
1929
+
1930
+ materialtouched = true;
1931
+ applySelf();
1932
+ }
1933
+ });
1934
+ presetpanel.add(rough2);
1935
+
1936
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
1937
+ shini0.setToolTipText("Shiny");
1938
+ shini0.addMouseListener(new MouseAdapter()
1939
+ {
1940
+ public void mouseClicked(MouseEvent e)
1941
+ {
1942
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
1943
+ cMaterial material = object.material;
1944
+
1945
+ shininessField.setFloat(material.shininess);
1946
+ lightareaField.setFloat(material.lightarea);
1947
+
1948
+ materialtouched = true;
1949
+ applySelf();
1950
+ }
1951
+ });
1952
+ presetpanel.add(shini0);
1953
+
1954
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
1955
+ shini1.setToolTipText("Shiny2");
1956
+ shini1.addMouseListener(new MouseAdapter()
1957
+ {
1958
+ public void mouseClicked(MouseEvent e)
1959
+ {
1960
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
1961
+ cMaterial material = object.material;
1962
+
1963
+ shininessField.setFloat(material.shininess);
1964
+ lightareaField.setFloat(material.lightarea);
1965
+
1966
+ materialtouched = true;
1967
+ applySelf();
1968
+ }
1969
+ });
1970
+ presetpanel.add(shini1);
1971
+
1972
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
1973
+ shini2.setToolTipText("Shiny3");
1974
+ shini2.addMouseListener(new MouseAdapter()
1975
+ {
1976
+ public void mouseClicked(MouseEvent e)
1977
+ {
1978
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
1979
+ cMaterial material = object.material;
1980
+
1981
+ shininessField.setFloat(material.shininess);
1982
+ lightareaField.setFloat(material.lightarea);
1983
+
1984
+ materialtouched = true;
1985
+ applySelf();
1986
+ }
1987
+ });
1988
+ presetpanel.add(shini2);
1989
+
1990
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
1991
+ aniso.setToolTipText("AnisoU");
1992
+ aniso.addMouseListener(new MouseAdapter()
1993
+ {
1994
+ public void mouseClicked(MouseEvent e)
1995
+ {
1996
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
1997
+ cMaterial material = object.material;
1998
+
1999
+ anisoField.setFloat(material.aniso);
2000
+ anisoVField.setFloat(material.anisoV);
2001
+
2002
+ materialtouched = true;
2003
+ applySelf();
2004
+ }
2005
+ });
2006
+ presetpanel.add(aniso);
2007
+
2008
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2009
+ aniso2.setToolTipText("AnisoV");
2010
+ aniso2.addMouseListener(new MouseAdapter()
2011
+ {
2012
+ public void mouseClicked(MouseEvent e)
2013
+ {
2014
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2015
+ cMaterial material = object.material;
2016
+
2017
+ anisoField.setFloat(material.aniso);
2018
+ anisoVField.setFloat(material.anisoV);
2019
+
2020
+ materialtouched = true;
2021
+ applySelf();
2022
+ }
2023
+ });
2024
+ presetpanel.add(aniso2);
2025
+
2026
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2027
+ aniso3.setToolTipText("AnisoUV");
2028
+ aniso3.addMouseListener(new MouseAdapter()
2029
+ {
2030
+ public void mouseClicked(MouseEvent e)
2031
+ {
2032
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2033
+ cMaterial material = object.material;
2034
+
2035
+ anisoField.setFloat(material.aniso);
2036
+ anisoVField.setFloat(material.anisoV);
2037
+
2038
+ materialtouched = true;
2039
+ applySelf();
2040
+ }
2041
+ });
2042
+ presetpanel.add(aniso3);
2043
+
2044
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2045
+ velvet0.setToolTipText("Velvet");
2046
+ velvet0.addMouseListener(new MouseAdapter()
2047
+ {
2048
+ public void mouseClicked(MouseEvent e)
2049
+ {
2050
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2051
+ cMaterial material = object.material;
2052
+
2053
+ diffusenessField.setFloat(material.factor);
2054
+ selfshadowField.setFloat(material.diffuseness);
2055
+ sheenField.setFloat(material.sheen);
2056
+ shininessField.setFloat(material.shininess);
2057
+ velvetField.setFloat(material.velvet);
2058
+ shiftField.setFloat(material.shift);
2059
+
2060
+ materialtouched = true;
2061
+ applySelf();
2062
+ }
2063
+ });
2064
+ presetpanel.add(velvet0);
2065
+
2066
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2067
+ bump0.setToolTipText("Bump texture");
2068
+ bump0.addMouseListener(new MouseAdapter()
2069
+ {
2070
+ public void mouseClicked(MouseEvent e)
2071
+ {
2072
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2073
+ cMaterial material = object.material;
2074
+
2075
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2076
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2077
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2078
+
2079
+ materialtouched = true;
2080
+ applySelf();
2081
+ }
2082
+ });
2083
+ presetpanel.add(bump0);
2084
+
2085
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2086
+ halo.setToolTipText("Halo");
2087
+ halo.addMouseListener(new MouseAdapter()
2088
+ {
2089
+ public void mouseClicked(MouseEvent e)
2090
+ {
2091
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2092
+ cMaterial material = object.material;
2093
+
2094
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2095
+
2096
+ materialtouched = true;
2097
+ applySelf();
2098
+ }
2099
+ });
2100
+ presetpanel.add(halo);
2101
+
2102
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2103
+ candle.setToolTipText("Candle");
2104
+ candle.addMouseListener(new MouseAdapter()
2105
+ {
2106
+ public void mouseClicked(MouseEvent e)
2107
+ {
2108
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2109
+ cMaterial material = object.material;
2110
+
2111
+ subsurfaceField.setFloat(material.subsurface);
2112
+ shadowbiasField.setFloat(material.shadowbias);
2113
+ ambientField.setFloat(material.ambient);
2114
+ specularField.setFloat(material.specular);
2115
+ lightareaField.setFloat(material.lightarea);
2116
+ shininessField.setFloat(material.shininess);
2117
+
2118
+ materialtouched = true;
2119
+ applySelf();
2120
+ }
2121
+ });
2122
+ presetpanel.add(candle);
2123
+
2124
+ cGridBag panel = new cGridBag().setVertical(true);
2125
+
2126
+ presetpanel.preferredWidth = 1;
2127
+
2128
+ materialpanel.add(presetpanel);
2129
+ materialpanel.add(panel);
2130
+
2131
+ panel.preferredWidth = 8;
2132
+
2133
+ /*
14262134 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14272135 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1428
- */
2136
+ */
14292137
14302138 cGridBag editBar = new cGridBag().setVertical(false);
14312139
....@@ -1459,45 +2167,50 @@
14592167 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14602168
14612169 cGridBag colorSection = new cGridBag().setVertical(true);
2170
+
2171
+ cGridBag huepanel = new cGridBag();
2172
+ cGridBag huelabel = new cGridBag();
2173
+ skin = GetLabel("icons/hue.png", false);
2174
+ skin.fit = true;
2175
+ huelabel.add(skin);
2176
+ huelabel.preferredWidth = 20;
2177
+ huepanel.add(new cGridBag()); // Label
2178
+ huepanel.add(huelabel); // Field/slider
2179
+
2180
+ huepanel.preferredHeight = 7;
2181
+
2182
+ colorSection.add(huepanel);
14622183
14632184 cGridBag color = new cGridBag();
1464
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1465
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1466
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2185
+
2186
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2187
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2188
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2189
+
14672190 //colorField.preferredWidth = 200;
14682191 colorSection.add(color);
14692192
14702193 cGridBag modulation = new cGridBag();
14712194 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
14722195 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2196
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
14742197 colorSection.add(modulation);
14752198
2199
+ cGridBag opacity = new cGridBag();
2200
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2201
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2202
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2203
+ colorSection.add(opacity);
2204
+
2205
+ colorSection.add(GetSeparator());
2206
+
14762207 cGridBag texture = new cGridBag();
14772208 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
14782209 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
14792210 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
14802211 colorSection.add(texture);
14812212
1482
- cGridBag anisoU = new cGridBag();
1483
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1484
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
- colorSection.add(anisoU);
1487
-
1488
- cGridBag anisoV = new cGridBag();
1489
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1490
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1492
- colorSection.add(anisoV);
1493
-
1494
- cGridBag shadowbias = new cGridBag();
1495
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1496
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1498
- colorSection.add(shadowbias);
1499
-
1500
- panel.add(new JSeparator());
2213
+ panel.add(GetSeparator());
15012214
15022215 panel.add(colorSection);
15032216
....@@ -1547,7 +2260,13 @@
15472260 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15482261 diffuseSection.add(fakedepth);
15492262
1550
- panel.add(new JSeparator());
2263
+ cGridBag shadowbias = new cGridBag();
2264
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2265
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2266
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2267
+ diffuseSection.add(shadowbias);
2268
+
2269
+ panel.add(GetSeparator());
15512270
15522271 panel.add(diffuseSection);
15532272
....@@ -1597,42 +2316,48 @@
15972316 // aConstraints.gridy += 1;
15982317 // aConstraints.gridwidth = 1;
15992318
2319
+ cGridBag anisoU = new cGridBag();
2320
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2321
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2322
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2323
+ specularSection.add(anisoU);
16002324
1601
- panel.add(new JSeparator());
2325
+ cGridBag anisoV = new cGridBag();
2326
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2327
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2328
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2329
+ specularSection.add(anisoV);
2330
+
2331
+
2332
+ panel.add(GetSeparator());
16022333
16032334 panel.add(specularSection);
16042335
16052336 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16062337
1607
- cGridBag globalSection = new cGridBag().setVertical(true);
2338
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16082339
16092340 cGridBag camera = new cGridBag();
16102341 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16112342 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16122343 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
- globalSection.add(camera);
2344
+ colorSection.add(camera);
16142345
16152346 cGridBag ambient = new cGridBag();
16162347 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16172348 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16182349 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
- globalSection.add(ambient);
2350
+ colorSection.add(ambient);
16202351
16212352 cGridBag backlit = new cGridBag();
16222353 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
16232354 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16242355 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1625
- globalSection.add(backlit);
2356
+ colorSection.add(backlit);
16262357
1627
- cGridBag opacity = new cGridBag();
1628
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1629
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1630
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1631
- globalSection.add(opacity);
1632
-
1633
- panel.add(new JSeparator());
2358
+ //panel.add(new JSeparator());
16342359
1635
- panel.add(globalSection);
2360
+ //panel.add(globalSection);
16362361
16372362 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16382363
....@@ -1674,7 +2399,7 @@
16742399 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16752400 textureSection.add(opacityPower);
16762401
1677
- panel.add(new JSeparator());
2402
+ panel.add(GetSeparator());
16782403
16792404 panel.add(textureSection);
16802405
....@@ -1739,8 +2464,9 @@
17392464 // 3D models
17402465 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
17412466 {
1742
- lastConverter = new com.jmex.model.converters.MaxToJme();
1743
- LoadFile(filename, lastConverter);
2467
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2468
+ //LoadFile(filename, lastConverter);
2469
+ LoadObjFile(filename); // New 3ds loader
17442470 continue;
17452471 }
17462472 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2466,6 +3192,7 @@
24663192 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
24673193 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
24683194 }
3195
+
24693196 //cJME.count++;
24703197 //cJME.count %= 12;
24713198 if (gc)
....@@ -2649,6 +3376,7 @@
26493376 }
26503377 }
26513378 }
3379
+
26523380 cFileSystemPane FSPane;
26533381
26543382 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2658,7 +3386,7 @@
26583386
26593387 freezematerial = true;
26603388 colorField.setFloat(mat.color);
2661
- modulationField.setFloat(mat.modulation);
3389
+ saturationField.setFloat(mat.modulation);
26623390 metalnessField.setFloat(mat.metalness);
26633391 diffuseField.setFloat(mat.diffuse);
26643392 specularField.setFloat(mat.specular);
....@@ -2702,11 +3430,14 @@
27023430 }
27033431 }
27043432 }
3433
+
27053434 freezematerial = false;
27063435 }
27073436
27083437 void SetMaterial(Object3D object)
27093438 {
3439
+ latestObject = object;
3440
+
27103441 cMaterial mat = object.material;
27113442
27123443 if (mat == null)
....@@ -2818,12 +3549,17 @@
28183549 // }
28193550
28203551 /**/
2821
- if (deselect)
3552
+ if (deselect || child == null)
28223553 {
28233554 //group.deselectAll();
28243555 //freeze = true;
28253556 GetTree().clearSelection();
28263557 //freeze = false;
3558
+
3559
+ if (child == null)
3560
+ {
3561
+ return;
3562
+ }
28273563 }
28283564
28293565 //group.addSelectee(child);
....@@ -2857,6 +3593,17 @@
28573593 public void itemStateChanged(ItemEvent event)
28583594 {
28593595 // System.out.println("Propagate = " + propagate);
3596
+ if (event.getSource() == pinButton)
3597
+ {
3598
+ copy.pinned ^= true;
3599
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3600
+ {
3601
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3602
+ copy.CloseUI();
3603
+ //copy.editWindow.refreshContents();
3604
+ }
3605
+ }
3606
+ else
28603607 if (event.getSource() == propagateToggle)
28613608 {
28623609 propagate ^= true;
....@@ -2892,7 +3639,7 @@
28923639 cameraView.ToggleDL();
28933640 cameraView.repaint();
28943641 return;
2895
- } else if (event.getSource() == toggleTextureItem)
3642
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
28963643 {
28973644 cameraView.ToggleTexture();
28983645 // june 2013 copy.HardTouch();
....@@ -2931,7 +3678,7 @@
29313678 frame.validate();
29323679
29333680 return;
2934
- } else if (event.getSource() == toggleSwitchItem)
3681
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29353682 {
29363683 cameraView.ToggleSwitch();
29373684 cameraView.repaint();
....@@ -2961,8 +3708,9 @@
29613708 } else if (event.getSource() == liveCB)
29623709 {
29633710 copy.live ^= true;
3711
+ objEditor.refreshContents(true); // To show item colors
29643712 return;
2965
- } else if (event.getSource() == selectCB)
3713
+ } else if (event.getSource() == selectableCB)
29663714 {
29673715 copy.dontselect ^= true;
29683716 return;
....@@ -2970,7 +3718,7 @@
29703718 {
29713719 copy.hide ^= true;
29723720 copy.Touch(); // display list issue
2973
- objEditor.refreshContents();
3721
+ objEditor.refreshContents(true); // To show item colors
29743722 return;
29753723 } else if (event.getSource() == link2masterCB)
29763724 {
....@@ -3147,9 +3895,9 @@
31473895 {
31483896 Close();
31493897 //return true;
3150
- } else if (source == loadItem)
3898
+ } else if (source == openItem)
31513899 {
3152
- load();
3900
+ Open();
31533901 //return true;
31543902 } else if (source == newItem)
31553903 {
....@@ -3174,6 +3922,10 @@
31743922 {
31753923 generatePOV();
31763924 //return true;
3925
+ } else if (event.getSource() == archiveItem)
3926
+ {
3927
+ cTools.Archive(frame);
3928
+ return;
31773929 } else if (source == zBufferItem)
31783930 {
31793931 try
....@@ -3222,11 +3974,12 @@
32223974
32233975 static public byte[] Compress(Object3D o)
32243976 {
3977
+ // Slower to actually compress.
32253978 try
32263979 {
32273980 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3228
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3229
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3981
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3982
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
32303983
32313984 Object3D parent = o.parent;
32323985 o.parent = null;
....@@ -3237,10 +3990,14 @@
32373990
32383991 out.flush();
32393992
3240
- zstream.close();
3993
+ baos //zstream
3994
+ .close();
32413995 out.close();
32423996
3243
- return baos.toByteArray();
3997
+ byte[] bytes = baos.toByteArray();
3998
+
3999
+ System.out.println("save #bytes = " + bytes.length);
4000
+ return bytes;
32444001 } catch (Exception e)
32454002 {
32464003 System.err.println(e);
....@@ -3250,13 +4007,16 @@
32504007
32514008 static public Object Uncompress(byte[] bytes)
32524009 {
3253
- System.out.println("#bytes = " + bytes.length);
4010
+ System.out.println("restore #bytes = " + bytes.length);
32544011 try
32554012 {
32564013 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3257
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3258
- ObjectInputStream in = new ObjectInputStream(istream);
4014
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4015
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
32594016 Object obj = in.readObject();
4017
+
4018
+ bais //istream
4019
+ .close();
32604020 in.close();
32614021
32624022 return obj;
....@@ -3311,37 +4071,95 @@
33114071 return null;
33124072 }
33134073
3314
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
33154074
33164075 public void Save()
33174076 {
4077
+ //Save(true);
4078
+ Replace();
4079
+ SetUndoStates();
4080
+ }
4081
+
4082
+ private boolean Equal(byte[] compress, byte[] name)
4083
+ {
4084
+ if (compress.length != name.length)
4085
+ {
4086
+ return false;
4087
+ }
4088
+
4089
+ for (int i=compress.length; --i>=0;)
4090
+ {
4091
+ if (compress[i] != name[i])
4092
+ return false;
4093
+ }
4094
+
4095
+ return true;
4096
+ }
4097
+
4098
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4099
+
4100
+ void DeleteVersion()
4101
+ {
4102
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4103
+ {
4104
+ copy.versionlist[i] = copy.versionlist[i+1];
4105
+ }
4106
+
4107
+ CopyChanged();
4108
+
4109
+ SetUndoStates();
4110
+ }
4111
+
4112
+ public boolean Save(boolean user)
4113
+ {
4114
+ System.err.println("Save");
4115
+ //Replace();
4116
+
33184117 cRadio tab = GetCurrentTab();
33194118
3320
- boolean temp = CameraPane.SWITCH;
3321
- CameraPane.SWITCH = false;
4119
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace"?
33224120
3323
- copy.ExtractBigData(hashtable);
4121
+ boolean thesame = false;
4122
+
4123
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4124
+// {
4125
+// thesame = true;
4126
+// }
33244127
33254128 //EditorFrame.m_MainFrame.requestFocusInWindow();
3326
- tab.graphs[tab.undoindex++] = Compress(copy);
3327
-
3328
- copy.RestoreBigData(hashtable);
3329
-
3330
- CameraPane.SWITCH = temp;
3331
-
3332
- //assert(hashtable.isEmpty());
3333
-
3334
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
4129
+ if (!thesame)
33354130 {
3336
- tab.graphs[i] = null;
4131
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4132
+ {
4133
+ copy.versionlist[i] = copy.versionlist[i-1];
4134
+ }
4135
+
4136
+ //tab.user[tab.versionindex] = user;
4137
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4138
+
4139
+ copy.versionlist[++copy.versionindex] = compress;
4140
+
4141
+ // if (increment)
4142
+ // tab.versionindex++;
33374143 }
33384144
4145
+ //copy.RestoreBigData(versiontable);
4146
+
4147
+ //assert(hashtable.isEmpty());
4148
+
4149
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4150
+// {
4151
+// //tab.user[i] = false;
4152
+// copy.versionlist[i] = null;
4153
+// }
4154
+
4155
+ SetUndoStates();
4156
+
33394157 // test save
33404158 if (false)
33414159 {
33424160 try
33434161 {
3344
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
4162
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
33454163 ObjectOutputStream p = new ObjectOutputStream(ostream);
33464164
33474165 p.writeObject(copy);
....@@ -3354,26 +4172,68 @@
33544172 e.printStackTrace();
33554173 }
33564174 }
4175
+
4176
+ return !thesame;
4177
+ }
4178
+
4179
+ boolean flashIt = true;
4180
+
4181
+ void RefreshSelection()
4182
+ {
4183
+ Object3D selection = new Object3D();
4184
+
4185
+ for (int i = 0; i < copy.selection.size(); i++)
4186
+ {
4187
+ Object3D elem = copy.selection.elementAt(i);
4188
+
4189
+ Object3D obj = copy.GetObject(elem.GetUUID());
4190
+
4191
+ if (obj == null)
4192
+ {
4193
+ copy.selection.remove(i--);
4194
+ }
4195
+ else
4196
+ {
4197
+ selection.add(obj);
4198
+ copy.selection.setElementAt(obj, i);
4199
+ }
4200
+ }
4201
+
4202
+ flashIt = false;
4203
+ GetTree().clearSelection();
4204
+ for (int i = 0; i < selection.size(); i++)
4205
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4206
+ flashIt = true;
4207
+
4208
+ //refreshContents(false);
33574209 }
33584210
3359
- void CopyChanged(Object3D obj)
4211
+ void CopyChanged()
33604212 {
4213
+ Object3D obj = copy.versionlist[copy.versionindex];
4214
+
4215
+ SetUndoStates();
4216
+
33614217 boolean temp = CameraPane.SWITCH;
33624218 CameraPane.SWITCH = false;
33634219
3364
- copy.ExtractBigData(hashtable);
4220
+ copy.ExtractBigData(versiontable);
33654221
33664222 copy.clear();
33674223
4224
+ copy.skyboxname = obj.skyboxname;
4225
+ copy.skyboxext = obj.skyboxext;
4226
+
33684227 for (int i=0; i<obj.Size(); i++)
33694228 {
33704229 copy.add(obj.get(i));
33714230 }
33724231
3373
- copy.RestoreBigData(hashtable);
4232
+ copy.RestoreBigData(versiontable);
33744233
33754234 CameraPane.SWITCH = temp;
33764235
4236
+ RefreshSelection();
33774237 //assert(hashtable.isEmpty());
33784238
33794239 copy.Touch();
....@@ -3394,43 +4254,139 @@
33944254 }
33954255 }
33964256
3397
- refreshContents();
4257
+ refreshContents(true);
33984258 }
33994259
3400
- public void Undo()
4260
+ cButton previousVersionButton;
4261
+ cButton restoreButton;
4262
+ cButton replaceButton;
4263
+ cButton nextVersionButton;
4264
+ cButton saveVersionButton;
4265
+ cButton deleteVersionButton;
4266
+
4267
+ boolean muteSlider;
4268
+
4269
+ int VersionCount()
4270
+ {
4271
+ int count = 0;
4272
+
4273
+ for (int i = copy.versionlist.length; --i >= 0;)
4274
+ {
4275
+ if (copy.versionlist[i] != null)
4276
+ count++;
4277
+ }
4278
+
4279
+ return count;
4280
+ }
4281
+
4282
+ void SetUndoStates()
34014283 {
34024284 cRadio tab = GetCurrentTab();
34034285
3404
- if (tab.undoindex == 0)
4286
+ restoreButton.setEnabled(true); // copy.versionindex != -1);
4287
+ replaceButton.setEnabled(true); // copy.versionindex != -1);
4288
+
4289
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4290
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4291
+
4292
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4293
+ copy.versionlist[copy.versionindex + 1] != null);
4294
+
4295
+ muteSlider = true;
4296
+ versionSlider.setMaximum(VersionCount() - 1);
4297
+ versionSlider.setInteger(copy.versionindex);
4298
+ muteSlider = false;
4299
+ }
4300
+
4301
+ public boolean PreviousVersion()
4302
+ {
4303
+ // Option?
4304
+ Replace();
4305
+
4306
+ System.err.println("Undo");
4307
+
4308
+ cRadio tab = GetCurrentTab();
4309
+
4310
+ if (copy.versionindex == 0)
34054311 {
34064312 java.awt.Toolkit.getDefaultToolkit().beep();
3407
- return;
4313
+ return false;
34084314 }
34094315
3410
- if (tab.graphs[tab.undoindex] == null)
3411
- {
3412
- Save();
3413
- tab.undoindex -= 1;
3414
- }
4316
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4317
+// {
4318
+// if (Save(false))
4319
+// tab.versionindex -= 1;
4320
+// else
4321
+// {
4322
+// if (tab.versionindex <= 0)
4323
+// return false;
4324
+// else
4325
+// tab.versionindex -= 1;
4326
+// }
4327
+// }
34154328
3416
- tab.undoindex -= 1;
4329
+ copy.versionindex -= 1;
34174330
3418
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4331
+ CopyChanged();
4332
+
4333
+ return true;
34194334 }
34204335
3421
- public void Redo()
4336
+ public boolean Restore()
34224337 {
4338
+ System.err.println("Restore");
4339
+
34234340 cRadio tab = GetCurrentTab();
34244341
3425
- if (tab.graphs[tab.undoindex + 1] == null)
4342
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4343
+ {
4344
+ java.awt.Toolkit.getDefaultToolkit().beep();
4345
+ return false;
4346
+ }
4347
+
4348
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4349
+ CopyChanged();
4350
+
4351
+ return true;
4352
+ }
4353
+
4354
+ public boolean Replace()
4355
+ {
4356
+ System.err.println("Replace");
4357
+
4358
+ cRadio tab = GetCurrentTab();
4359
+
4360
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4361
+ {
4362
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4363
+ return false;
4364
+ }
4365
+
4366
+ copy.versionlist[copy.versionindex] = CompressCopy();
4367
+
4368
+ return true;
4369
+ }
4370
+
4371
+ public void NextVersion()
4372
+ {
4373
+ // Option?
4374
+ Replace();
4375
+
4376
+ cRadio tab = GetCurrentTab();
4377
+
4378
+ if (copy.versionlist[copy.versionindex + 1] == null)
34264379 {
34274380 java.awt.Toolkit.getDefaultToolkit().beep();
34284381 return;
34294382 }
34304383
3431
- tab.undoindex += 1;
4384
+ copy.versionindex += 1;
34324385
3433
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4386
+ CopyChanged();
4387
+
4388
+ //if (!tab.user[tab.versionindex])
4389
+ // tab.graphs[tab.versionindex] = null;
34344390 }
34354391
34364392 void ImportGFD()
....@@ -3582,7 +4538,7 @@
35824538 assert false;
35834539 }
35844540
3585
- void EditSelection()
4541
+ void EditSelection(boolean newWindow)
35864542 {
35874543 }
35884544
....@@ -3641,7 +4597,7 @@
36414597 //copy.material = new cMaterial(copy.GetMaterial());
36424598
36434599 current.color = (float) colorField.getFloat();
3644
- current.modulation = (float) modulationField.getFloat();
4600
+ current.modulation = (float) saturationField.getFloat();
36454601 current.metalness = (float) metalnessField.getFloat();
36464602 current.diffuse = (float) diffuseField.getFloat();
36474603 current.specular = (float) specularField.getFloat();
....@@ -3674,7 +4630,7 @@
36744630 cMaterial mat = copy.material;
36754631
36764632 colorField.SetToolTipValue((mat.color));
3677
- modulationField.SetToolTipValue((mat.modulation));
4633
+ saturationField.SetToolTipValue((mat.modulation));
36784634 metalnessField.SetToolTipValue((mat.metalness));
36794635 diffuseField.SetToolTipValue((mat.diffuse));
36804636 specularField.SetToolTipValue((mat.specular));
....@@ -3726,9 +4682,26 @@
37264682 //copy.Touch();
37274683 }
37284684
4685
+ cNumberSlider versionSlider;
4686
+
37294687 public void stateChanged(ChangeEvent e)
37304688 {
37314689 // assert(false);
4690
+ if (e.getSource() == versionSlider)
4691
+ {
4692
+ if (muteSlider)
4693
+ return;
4694
+
4695
+ int version = versionSlider.getInteger();
4696
+
4697
+ if (copy.versionlist[version] != null)
4698
+ {
4699
+ copy.versionindex = version;
4700
+ CopyChanged();
4701
+ }
4702
+
4703
+ return;
4704
+ }
37324705
37334706 if (freezematerial)
37344707 {
....@@ -3764,6 +4737,12 @@
37644737 {
37654738 //System.out.println("stateChanged = " + this);
37664739 materialtouched = true;
4740
+
4741
+ if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
4742
+ {
4743
+ saturationField.setFloat(1);
4744
+ }
4745
+
37674746 applySelf();
37684747 //System.out.println("this = " + this);
37694748 //System.out.println("PARENT = " + parent);
....@@ -4063,6 +5042,7 @@
40635042 {
40645043 if (GetTree() != null)
40655044 {
5045
+ GetTree().revalidate();
40665046 GetTree().repaint();
40675047 }
40685048
....@@ -4071,13 +5051,17 @@
40715051 ctrlPanel.validate(); // ? new
40725052 ctrlPanel.repaint();
40735053 }
5054
+
5055
+ if (previousVersionButton != null && copy.versionlist != null)
5056
+ SetUndoStates();
40745057 }
40755058
40765059 static TweenManager tweenManager = new TweenManager();
40775060
40785061 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
40795062 {
4080
- Save();
5063
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5064
+ Save();
40815065 //Tween.set(thing, 0).target(1).start(tweenManager);
40825066 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
40835067 // if (thing instanceof GenericJointDemo)
....@@ -4164,6 +5148,12 @@
41645148 {
41655149 ResetModel();
41665150 Select(thing.GetTreePath(), true, false); // unselect... false);
5151
+
5152
+ if (thing.Size() == 0)
5153
+ {
5154
+ //EditSelection(false);
5155
+ }
5156
+
41675157 refreshContents();
41685158 }
41695159
....@@ -4312,7 +5302,9 @@
43125302 readobj.ResetDisplayList();
43135303 } catch (Exception e)
43145304 {
4315
- //e.printStackTrace();
5305
+ if (!e.toString().contains("GZIP"))
5306
+ e.printStackTrace();
5307
+
43165308 try
43175309 {
43185310 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4386,11 +5378,14 @@
43865378
43875379 if (readobj != null)
43885380 {
4389
- Save();
5381
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5382
+ // Save();
43905383 try
43915384 {
43925385 //readobj.deepCopySelf(copy);
43935386 copy.clear(); // june 2014
5387
+ copy.skyboxname = readobj.skyboxname;
5388
+ copy.skyboxext = readobj.skyboxext;
43945389 for (int i = 0; i < readobj.size(); i++)
43955390 {
43965391 Object3D child = readobj.get(i); // reserve(i);
....@@ -4431,6 +5426,7 @@
44315426 }
44325427 } catch (ClassCastException e)
44335428 {
5429
+ e.printStackTrace();
44345430 assert (false);
44355431 Composite c = (Composite) copy;
44365432 c.children.clear();
....@@ -4441,17 +5437,28 @@
44415437 c.addChild(csg);
44425438 }
44435439
5440
+ copy.versionlist = readobj.versionlist;
5441
+ copy.versionindex = readobj.versionindex;
5442
+
5443
+ if (copy.versionlist == null)
5444
+ {
5445
+ copy.versionlist = new Object3D[100];
5446
+ copy.versionindex = -1;
5447
+ }
5448
+
5449
+ //? SetUndoStates();
5450
+
44445451 ResetModel();
44455452 copy.HardTouch(); // recompile?
44465453 refreshContents();
44475454 }
44485455 }
44495456
4450
- void load() // throws ClassNotFoundException
5457
+ void Open() // throws ClassNotFoundException
44515458 {
44525459 if (Grafreed.standAlone)
44535460 {
4454
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5461
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
44555462 browser.show();
44565463 String filename = browser.getFile();
44575464 if (filename != null && filename.length() > 0)
....@@ -4550,6 +5557,7 @@
45505557 //ps.print(buffer.toString());
45515558 } catch (IOException e)
45525559 {
5560
+ e.printStackTrace();
45535561 }
45545562 }
45555563
....@@ -4564,6 +5572,8 @@
45645572 String filename = browser.getFile();
45655573 if (filename != null && filename.length() > 0)
45665574 {
5575
+ if (!filename.endsWith(".gfd"))
5576
+ filename += ".gfd";
45675577 lastname = browser.getDirectory() + filename;
45685578 save();
45695579 }
....@@ -4730,7 +5740,7 @@
47305740 MenuBar menuBar;
47315741 Menu fileMenu;
47325742 MenuItem newItem;
4733
- MenuItem loadItem;
5743
+ MenuItem openItem;
47345744 MenuItem saveItem;
47355745 MenuItem saveAsItem;
47365746 MenuItem exportAsItem;
....@@ -4753,22 +5763,37 @@
47535763 CheckboxMenuItem toggleSwitchItem;
47545764 CheckboxMenuItem toggleRootItem;
47555765 CheckboxMenuItem animationItem;
5766
+ MenuItem archiveItem;
47565767 CheckboxMenuItem toggleHandleItem;
47575768 CheckboxMenuItem togglePaintItem;
47585769 JSplitPane mainPanel;
47595770 JScrollPane scrollpane;
5771
+
47605772 JPanel toolbarPanel;
5773
+
47615774 cGridBag treePanel;
5775
+
47625776 JPanel radioPanel;
47635777 ButtonGroup buttonGroup;
4764
- cGridBag ctrlPanel;
5778
+
5779
+ cGridBag toolboxPanel;
5780
+ cGridBag skyboxPanel;
47655781 cGridBag materialPanel;
5782
+ cGridBag ctrlPanel;
5783
+
47665784 JScrollPane infoPanel;
5785
+
47675786 cGridBag optionsPanel;
5787
+
47685788 JTabbedPane objectPanel;
5789
+ boolean materialFlushed;
5790
+ Object3D latestObject;
5791
+
47695792 cGridBag XYZPanel;
5793
+
47705794 JSplitPane gridPanel;
47715795 JSplitPane bigPanel;
5796
+
47725797 cGridBag bigThree;
47735798 cGridBag scenePanel;
47745799 cGridBag centralPanel;
....@@ -4826,7 +5851,7 @@
48265851 JLabel colorLabel;
48275852 cNumberSlider colorField;
48285853 JLabel modulationLabel;
4829
- cNumberSlider modulationField;
5854
+ cNumberSlider saturationField;
48305855 JLabel metalnessLabel;
48315856 cNumberSlider metalnessField;
48325857 JLabel diffuseLabel;
....@@ -4883,7 +5908,7 @@
48835908 cNumberSlider fogField;
48845909 JLabel opacityPowerLabel;
48855910 cNumberSlider opacityPowerField;
4886
- JTree jTree;
5911
+ cTree jTree;
48875912 //ObjectUI parent;
48885913
48895914 cNumberSlider normalpushField;