Normand Briere
2019-08-12 8f1afe25ea8fc8801aab66331c32a50859a758c2
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,79 @@
3742 JFrame frame;
3843
3944 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
+ }
40118
41119 // SCRIPT
42120
....@@ -147,7 +225,7 @@
147225
148226 objEditor.ctrlPanel.remove(namePanel);
149227
150
- if (!GroupEditor.allparams)
228
+ if (!allparams)
151229 return;
152230
153231 // objEditor.ctrlPanel.remove(liveCB);
....@@ -219,6 +297,14 @@
219297 client = inClient;
220298 copy = client;
221299
300
+// if (copy.versionlist == null)
301
+// {
302
+// copy.versionlist = new Object3D[100];
303
+// copy.versionindex = -1;
304
+//
305
+// callee.Save(true);
306
+// }
307
+
222308 // "this" is not called: SetupUI2(objEditor);
223309 }
224310
....@@ -232,6 +318,14 @@
232318 client = inClient;
233319 copy = client;
234320
321
+ if (copy.versionlist == null)
322
+ {
323
+ copy.versionlist = new Object3D[100];
324
+ copy.versionindex = -1;
325
+
326
+// Save(true);
327
+ }
328
+
235329 SetupUI2(callee.GetEditor());
236330 }
237331
....@@ -246,7 +340,7 @@
246340 //localCopy.parent = null;
247341
248342 frame = new JFrame();
249
- frame.setUndecorated(true);
343
+ frame.setUndecorated(false);
250344 objEditor = this;
251345 this.callee = callee;
252346
....@@ -264,6 +358,14 @@
264358 copy = localCopy;
265359 copy.editWindow = this;
266360
361
+// if (copy.versionlist == null)
362
+// {
363
+// copy.versionlist = new Object3D[100];
364
+// copy.versionindex = -1;
365
+//
366
+// Save(true);
367
+// }
368
+
267369 SetupMenu();
268370
269371 //SetupName(objEditor); // new
....@@ -277,12 +379,17 @@
277379 return frame.action(event, obj);
278380 }
279381
382
+ // Cannot work without static
383
+ static boolean allparams = true;
384
+
385
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
386
+
280387 void SetupMenu()
281388 {
282389 frame.setMenuBar(menuBar = new MenuBar());
283390 menuBar.add(fileMenu = new Menu("File"));
284391 fileMenu.add(newItem = new MenuItem("New"));
285
- fileMenu.add(loadItem = new MenuItem("Open..."));
392
+ fileMenu.add(openItem = new MenuItem("Open..."));
286393
287394 //oe.menuBar.add(menu = new Menu("Include"));
288395 Menu menu = new Menu("Import");
....@@ -314,7 +421,7 @@
314421 }
315422
316423 newItem.addActionListener(this);
317
- loadItem.addActionListener(this);
424
+ openItem.addActionListener(this);
318425 saveItem.addActionListener(this);
319426 saveAsItem.addActionListener(this);
320427 exportAsItem.addActionListener(this);
....@@ -323,13 +430,40 @@
323430 closeItem.addActionListener(this);
324431
325432 objectPanel = new JTabbedPane();
433
+
434
+ ChangeListener changeListener = new ChangeListener()
435
+ {
436
+ public void stateChanged(ChangeEvent changeEvent)
437
+ {
438
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
439
+// {
440
+// if (latestObject != null)
441
+// {
442
+// refreshContents(true);
443
+// SetMaterial(latestObject);
444
+// }
445
+//
446
+// materialFlushed = true;
447
+// }
448
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
449
+// {
450
+// if (listUI.size() == 0)
451
+// EditSelection(false);
452
+// }
453
+
454
+// refreshContents(false); // To refresh Info tab
455
+ }
456
+ };
457
+ objectPanel.addChangeListener(changeListener);
458
+
326459 toolbarPanel = new JPanel();
327460 toolbarPanel.setName("Toolbar");
461
+
328462 treePanel = new cGridBag();
329463 treePanel.setName("Tree");
330464
331465 editPanel = new cGridBag().setVertical(true);
332
- editPanel.setName("Edit");
466
+ //editPanel.setName("Edit");
333467
334468 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
335469
....@@ -337,23 +471,29 @@
337471 editPanel.add(editCommandsPanel);
338472 editPanel.add(ctrlPanel);
339473
340
- materialPanel = new cGridBag().setVertical(true);
474
+ toolboxPanel = new cGridBag().setVertical(true);
475
+ //toolboxPanel.setName("Toolbox");
341476
342
- materialPanel.setName("Material");
477
+ skyboxPanel = new cGridBag().setVertical(true);
478
+
479
+ materialPanel = new cGridBag().setVertical(false);
480
+ //materialPanel.setName("Material");
481
+
343482 /*JTextPane*/
344483 infoarea = createTextPane();
345484 doc = infoarea.getStyledDocument();
346485
347486 infoarea.setEditable(true);
348487 SetText();
488
+
349489 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
350490 // infoarea.setOpaque(false);
351491 // //infoarea.setForeground(textcolor);
352492 // TEXTAREA infoarea.setLineWrap(true);
353493 // TEXTAREA infoarea.setWrapStyleWord(true);
354494 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
355
- infoPanel.setPreferredSize(new Dimension(50, 200));
356
- infoPanel.setName("Info");
495
+ infoPanel.setPreferredSize(new Dimension(1, 1));
496
+ //infoPanel.setName("Info");
357497 //infoPanel.setLayout(new BorderLayout());
358498 //infoPanel.add(createTextPane());
359499
....@@ -364,7 +504,14 @@
364504 mainPanel.setDividerSize(9);
365505 mainPanel.setDividerLocation(0.5); //1.0);
366506 mainPanel.setResizeWeight(0.5);
367
-
507
+
508
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
509
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
510
+ divider.setDividerSize(15);
511
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
512
+
513
+ mainPanel.setUI(new BasicSplitPaneUI());
514
+
368515 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
369516 //mainPanel.setLayout(new GridBagLayout());
370517 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -595,8 +742,8 @@
595742 }
596743 }
597744
598
-static GraphicsDevice device = GraphicsEnvironment
599
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
745
+//static GraphicsDevice device = GraphicsEnvironment
746
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
600747
601748 Rectangle keeprect;
602749 cRadio radio;
....@@ -612,13 +759,25 @@
612759
613760 boolean maximized;
614761
762
+ cButton fullscreenLayout;
763
+ cButton expandedLayout;
764
+
615765 void Minimize()
616766 {
617767 frame.setState(Frame.ICONIFIED);
768
+ frame.validate();
618769 }
619770
771
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
772
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
773
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
620774 void Maximize()
621775 {
776
+ if (CameraPane.FULLSCREEN)
777
+ {
778
+ ToggleFullScreen();
779
+ }
780
+
622781 if (maximized)
623782 {
624783 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -626,20 +785,38 @@
626785 else
627786 {
628787 keeprect = frame.getBounds();
629
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
630
- Dimension rect2 = frame.getToolkit().getScreenSize();
631
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
788
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
789
+// Dimension rect2 = frame.getToolkit().getScreenSize();
790
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
632791 // frame.setState(Frame.MAXIMIZED_BOTH);
792
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
633793 }
634794
635795 maximized ^= true;
796
+
797
+ frame.validate();
636798 }
799
+
800
+ cButton minButton;
801
+ cButton maxButton;
802
+ cButton fullButton;
803
+ cButton collapseButton;
804
+ cButton maximize3DButton;
637805
638806 void ToggleFullScreen()
639807 {
640
- if (CameraPane.FULLSCREEN)
808
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
809
+
810
+ cameraView.ToggleFullScreen();
811
+
812
+ if (!CameraPane.FULLSCREEN)
641813 {
642814 device.setFullScreenWindow(null);
815
+ frame.dispose();
816
+ frame.setUndecorated(false);
817
+ frame.validate();
818
+ frame.setVisible(true);
819
+
643820 //frame.setVisible(false);
644821 // frame.removeNotify();
645822 // frame.setUndecorated(false);
....@@ -649,13 +826,13 @@
649826 // X frame.getContentPane().remove(/*"Center",*/bigThree);
650827 // X framePanel.add(bigThree);
651828 // X frame.getContentPane().add(/*"Center",*/framePanel);
652
- framePanel.setDividerLocation(1);
829
+// framePanel.setDividerLocation(46); // icons are 24x24
653830
654831 //frame.setVisible(true);
655
- radio.layout = keepButton;
832
+// radio.layout = keepButton;
656833 //theFrame = null;
657834 keepButton = null;
658
- radio.layout.doClick();
835
+// radio.layout.doClick();
659836
660837 } else
661838 {
....@@ -664,22 +841,59 @@
664841 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
665842 // frame.getToolkit().getScreenSize().height);
666843 //frame.setVisible(false);
844
+
845
+ frame.dispose();
846
+ frame.setUndecorated(true);
667847 device.setFullScreenWindow(frame);
848
+ frame.validate();
849
+ frame.setVisible(true);
668850 // frame.removeNotify();
669851 // frame.setUndecorated(true);
670852 // frame.addNotify();
671853 // X frame.getContentPane().remove(/*"Center",*/framePanel);
672854 // X framePanel.remove(bigThree);
673855 // X frame.getContentPane().add(/*"Center",*/bigThree);
674
- framePanel.setDividerLocation(0);
856
+// framePanel.setDividerLocation(0);
675857
676
- radio.layout = twoButton;
677
- radio.layout.doClick();
858
+// radio.layout = fullscreenLayout;
859
+// radio.layout.doClick();
678860 //frame.setVisible(true);
679861 }
680
-
681
- cameraView.ToggleFullScreen();
862
+ frame.validate();
863
+
864
+ cameraView.requestFocusInWindow();
682865 }
866
+
867
+ void CollapseToolbar()
868
+ {
869
+ framePanel.setDividerLocation(0);
870
+ //frame.validate();
871
+
872
+ cameraView.requestFocusInWindow();
873
+ }
874
+
875
+ private Object3D Duplicate(Object3D object)
876
+ {
877
+ boolean temp = CameraPane.SWITCH;
878
+ CameraPane.SWITCH = false;
879
+
880
+ object.ExtractBigData(versiontable);
881
+ // if (copy == client)
882
+
883
+ Object3D versions[] = object.versionlist;
884
+ object.versionlist = null;
885
+
886
+ //byte[] compress = Compress(copy);
887
+ Object3D compress = (Object3D)Grafreed.clone(object);
888
+
889
+ object.versionlist = versions;
890
+
891
+ object.RestoreBigData(versiontable);
892
+
893
+ CameraPane.SWITCH = temp;
894
+
895
+ return compress;
896
+ }
683897
684898 private JTextPane createTextPane()
685899 {
....@@ -802,6 +1016,7 @@
8021016 {
8031017 SetupMaterial(materialPanel);
8041018 }
1019
+
8051020 //SetupName();
8061021 //SetupViews();
8071022 }
....@@ -811,7 +1026,7 @@
8111026 // NumberSlider vDivsField;
8121027 // JCheckBox endcaps;
8131028 JCheckBox liveCB;
814
- JCheckBox selectCB;
1029
+ JCheckBox selectableCB;
8151030 JCheckBox hideCB;
8161031 JCheckBox link2masterCB;
8171032 JCheckBox markCB;
....@@ -819,7 +1034,12 @@
8191034 JCheckBox speedupCB;
8201035 JCheckBox rewindCB;
8211036 JCheckBox flipVCB;
1037
+
1038
+ cCheckBox toggleTextureCB;
1039
+ cCheckBox toggleSwitchCB;
1040
+
8221041 JComboBox texresMenu;
1042
+
8231043 JButton resetButton;
8241044 JButton stepButton;
8251045 JButton stepAllButton;
....@@ -1005,39 +1225,55 @@
10051225
10061226 namePanel = new cGridBag();
10071227
1228
+ //if (copy.pinned)
1229
+ {
1230
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1231
+ pinButton.setSelected(copy.pinned);
1232
+ cGridBag t = new cGridBag();
1233
+ t.preferredWidth = 2;
1234
+ t.add(pinButton);
1235
+ namePanel.add(t);
1236
+
1237
+ pinButton.addItemListener(this);
1238
+ }
1239
+
10081240 nameField = AddText(namePanel, copy.GetName());
1009
- namePanel.add(nameField);
1241
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
10101242 oe.ctrlPanel.add(namePanel);
10111243
10121244 oe.ctrlPanel.Return();
10131245
1014
- if (!GroupEditor.allparams)
1246
+ if (!allparams)
10151247 return;
10161248
10171249 setupPanel = new cGridBag().setVertical(false);
10181250
10191251 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
10201252 liveCB.setToolTipText("Animate object");
1021
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1022
- selectCB.setToolTipText("Make object selectable");
1253
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1254
+ selectableCB.setToolTipText("Make object selectable");
10231255 // Return();
1256
+
10241257 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10251258 hideCB.setToolTipText("Hide object");
10261259 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1027
- markCB.setToolTipText("Set the animation target transform");
1260
+ markCB.setToolTipText("As animation target transform");
1261
+
1262
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10281263
10291264 setupPanel2 = new cGridBag().setVertical(false);
10301265
10311266 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10321267 rewindCB.setToolTipText("Rewind animation");
10331268
1034
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1035
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1269
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1270
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10361271
1272
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1273
+ link2masterCB.setToolTipText("Attach to support");
1274
+
10371275 if (Globals.ADVANCED)
10381276 {
1039
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1040
- link2masterCB.setToolTipText("Attach to support");
10411277 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
10421278 speedupCB.setToolTipText("Option motion capture");
10431279 }
....@@ -1311,6 +1547,7 @@
13111547 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
13121548 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
13131549 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1550
+ //XYZPanel.setName("XYZ");
13141551
13151552 /*
13161553 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1348,13 +1585,29 @@
13481585 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
13491586 //tmp.setName("Edit");
13501587 objectPanel.add(materialPanel);
1588
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1589
+ objectPanel.setToolTipTextAt(0, "Material");
1590
+
1591
+ objectPanel.add(toolboxPanel);
1592
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1593
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1594
+
1595
+ objectPanel.add(skyboxPanel);
1596
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1597
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1598
+
13511599 // JPanel north = new JPanel(new BorderLayout());
13521600 // north.setName("Edit");
13531601 // north.add(ctrlPanel, BorderLayout.NORTH);
13541602 // objectPanel.add(north);
13551603 objectPanel.add(editPanel);
1356
- objectPanel.add(infoPanel);
1357
-
1604
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1605
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1606
+
1607
+ objectPanel.add(XYZPanel);
1608
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1609
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1610
+
13581611 /*
13591612 aConstraints.gridx = 0;
13601613 aConstraints.gridwidth = 1;
....@@ -1362,7 +1615,7 @@
13621615 aConstraints.gridy += 1;
13631616 aConstraints.gridwidth = 1;
13641617 mainPanel.add(objectPanel, aConstraints);
1365
- */
1618
+ */
13661619
13671620 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
13681621 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1374,14 +1627,12 @@
13741627 scrollpane.addMouseWheelListener(this); // Default not fast enough
13751628
13761629 /*JTabbedPane*/ scenePanel = new cGridBag();
1377
- scenePanel.preferredWidth = 6;
1630
+ scenePanel.preferredWidth = 5;
13781631
13791632 JTabbedPane tabbedPane = new JTabbedPane();
13801633 tabbedPane.add(scrollpane);
13811634
1382
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1383
-
1384
- optionsPanel = new cGridBag().setVertical(true);
1635
+ optionsPanel = new cGridBag().setVertical(false);
13851636
13861637 optionsPanel.setName("Options");
13871638
....@@ -1389,8 +1640,15 @@
13891640
13901641 tabbedPane.add(optionsPanel);
13911642
1643
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1644
+
13921645 scenePanel.add(tabbedPane);
13931646
1647
+ //if (Globals.ADVANCED)
1648
+ tabbedPane.add(infoPanel);
1649
+ tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1650
+ tabbedPane.setToolTipTextAt(3, "Information");
1651
+
13941652 /*
13951653 cTree jTree = new cTree(null);
13961654 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1452,7 +1710,7 @@
14521710 bigThree = new cGridBag();
14531711 bigThree.addComponent(scenePanel);
14541712 bigThree.addComponent(centralPanel);
1455
- bigThree.addComponent(XYZPanel);
1713
+ //bigThree.addComponent(XYZPanel);
14561714
14571715 // // SIDE EFFECT!!!
14581716 // aConstraints.gridx = 0;
....@@ -1461,9 +1719,26 @@
14611719 // aConstraints.gridheight = 1;
14621720
14631721 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1464
- framePanel.setContinuousLayout(true);
1465
- framePanel.setOneTouchExpandable(true);
1466
- framePanel.setDividerLocation(0.8);
1722
+
1723
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1724
+ new java.beans.PropertyChangeListener()
1725
+ {
1726
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1727
+ {
1728
+ if ((Integer)pce.getOldValue() == 1)
1729
+ {
1730
+ if (radio.layout != expandedLayout)
1731
+ {
1732
+ radio.layout = expandedLayout;
1733
+ radio.layout.doClick();
1734
+ }
1735
+ }
1736
+ }
1737
+ });
1738
+
1739
+ framePanel.setContinuousLayout(false);
1740
+ framePanel.setOneTouchExpandable(false);
1741
+ //.setDividerLocation(0.8);
14671742 //framePanel.setDividerSize(15);
14681743 //framePanel.setResizeWeight(0.15);
14691744 framePanel.setName("Frame");
....@@ -1481,16 +1756,18 @@
14811756 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14821757
14831758 frame.setSize(1280, 860);
1484
- frame.setVisible(true);
1485
-
1759
+
14861760 cameraView.requestFocusInWindow();
14871761
14881762 gridPanel.setDividerLocation(1.0);
1763
+
1764
+ frame.validate();
1765
+
1766
+ frame.setVisible(true);
14891767
14901768 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
14911769 frame.addWindowListener(new WindowAdapter()
14921770 {
1493
-
14941771 public void windowClosing(WindowEvent e)
14951772 {
14961773 Close();
....@@ -1513,12 +1790,403 @@
15131790 ctrlPanel.removeAll();
15141791 }
15151792
1516
- void SetupMaterial(cGridBag panel)
1793
+ void SetupMaterial(cGridBag materialpanel)
15171794 {
1518
- /*
1795
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1796
+
1797
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1798
+ skin.setToolTipText("Skin");
1799
+ skin.addMouseListener(new MouseAdapter()
1800
+ {
1801
+ public void mouseClicked(MouseEvent e)
1802
+ {
1803
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1804
+ cMaterial material = object.material;
1805
+
1806
+ // Skin
1807
+ colorField.setFloat(material.color);
1808
+ saturationField.setFloat(material.modulation);
1809
+ subsurfaceField.setFloat(material.subsurface);
1810
+ selfshadowField.setFloat(material.diffuseness);
1811
+ diffusenessField.setFloat(material.factor);
1812
+ shininessField.setFloat(material.shininess);
1813
+ shadowbiasField.setFloat(material.shadowbias);
1814
+ diffuseField.setFloat(material.diffuse);
1815
+ specularField.setFloat(material.specular);
1816
+
1817
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1818
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1819
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1820
+
1821
+ materialtouched = true;
1822
+ applySelf();
1823
+ }
1824
+ });
1825
+ presetpanel.add(skin);
1826
+
1827
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1828
+ lambert.setToolTipText("Diffuse");
1829
+ lambert.addMouseListener(new MouseAdapter()
1830
+ {
1831
+ public void mouseClicked(MouseEvent e)
1832
+ {
1833
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1834
+ cMaterial material = object.material;
1835
+
1836
+ diffusenessField.setFloat(material.factor);
1837
+ selfshadowField.setFloat(material.diffuseness);
1838
+
1839
+ materialtouched = true;
1840
+ applySelf();
1841
+ }
1842
+ });
1843
+ presetpanel.add(lambert);
1844
+
1845
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1846
+ diffuse2.setToolTipText("Diffuse2");
1847
+ diffuse2.addMouseListener(new MouseAdapter()
1848
+ {
1849
+ public void mouseClicked(MouseEvent e)
1850
+ {
1851
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1852
+ cMaterial material = object.material;
1853
+
1854
+ diffusenessField.setFloat(material.factor);
1855
+ selfshadowField.setFloat(material.diffuseness);
1856
+
1857
+ materialtouched = true;
1858
+ applySelf();
1859
+ }
1860
+ });
1861
+ presetpanel.add(diffuse2);
1862
+
1863
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1864
+ diffusemoon.setToolTipText("Moon");
1865
+ diffusemoon.addMouseListener(new MouseAdapter()
1866
+ {
1867
+ public void mouseClicked(MouseEvent e)
1868
+ {
1869
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1870
+ cMaterial material = object.material;
1871
+
1872
+ diffusenessField.setFloat(material.factor);
1873
+ selfshadowField.setFloat(material.diffuseness);
1874
+
1875
+ materialtouched = true;
1876
+ applySelf();
1877
+ }
1878
+ });
1879
+ presetpanel.add(diffusemoon);
1880
+
1881
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1882
+ diffusemoon2.setToolTipText("Moon2");
1883
+ diffusemoon2.addMouseListener(new MouseAdapter()
1884
+ {
1885
+ public void mouseClicked(MouseEvent e)
1886
+ {
1887
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1888
+ cMaterial material = object.material;
1889
+
1890
+ diffusenessField.setFloat(material.factor);
1891
+ selfshadowField.setFloat(material.diffuseness);
1892
+
1893
+ materialtouched = true;
1894
+ applySelf();
1895
+ }
1896
+ });
1897
+ presetpanel.add(diffusemoon2);
1898
+
1899
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1900
+ diffusemoon3.setToolTipText("Moon3");
1901
+ diffusemoon3.addMouseListener(new MouseAdapter()
1902
+ {
1903
+ public void mouseClicked(MouseEvent e)
1904
+ {
1905
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1906
+ cMaterial material = object.material;
1907
+
1908
+ diffusenessField.setFloat(material.factor);
1909
+ selfshadowField.setFloat(material.diffuseness);
1910
+
1911
+ materialtouched = true;
1912
+ applySelf();
1913
+ }
1914
+ });
1915
+ presetpanel.add(diffusemoon3);
1916
+
1917
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1918
+ diffusesheen.setToolTipText("Sheen");
1919
+ diffusesheen.addMouseListener(new MouseAdapter()
1920
+ {
1921
+ public void mouseClicked(MouseEvent e)
1922
+ {
1923
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1924
+ cMaterial material = object.material;
1925
+
1926
+ sheenField.setFloat(material.sheen);
1927
+
1928
+ materialtouched = true;
1929
+ applySelf();
1930
+ }
1931
+ });
1932
+ presetpanel.add(diffusesheen);
1933
+
1934
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1935
+ rough.setToolTipText("Rough metal");
1936
+ rough.addMouseListener(new MouseAdapter()
1937
+ {
1938
+ public void mouseClicked(MouseEvent e)
1939
+ {
1940
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1941
+ cMaterial material = object.material;
1942
+
1943
+ shininessField.setFloat(material.shininess);
1944
+ velvetField.setFloat(material.velvet);
1945
+
1946
+ materialtouched = true;
1947
+ applySelf();
1948
+ }
1949
+ });
1950
+ presetpanel.add(rough);
1951
+
1952
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
1953
+ rough2.setToolTipText("Medium metal");
1954
+ rough2.addMouseListener(new MouseAdapter()
1955
+ {
1956
+ public void mouseClicked(MouseEvent e)
1957
+ {
1958
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
1959
+ cMaterial material = object.material;
1960
+
1961
+ shininessField.setFloat(material.shininess);
1962
+ lightareaField.setFloat(material.lightarea);
1963
+
1964
+ materialtouched = true;
1965
+ applySelf();
1966
+ }
1967
+ });
1968
+ presetpanel.add(rough2);
1969
+
1970
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
1971
+ shini0.setToolTipText("Shiny");
1972
+ shini0.addMouseListener(new MouseAdapter()
1973
+ {
1974
+ public void mouseClicked(MouseEvent e)
1975
+ {
1976
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
1977
+ cMaterial material = object.material;
1978
+
1979
+ shininessField.setFloat(material.shininess);
1980
+ lightareaField.setFloat(material.lightarea);
1981
+
1982
+ materialtouched = true;
1983
+ applySelf();
1984
+ }
1985
+ });
1986
+ presetpanel.add(shini0);
1987
+
1988
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
1989
+ shini1.setToolTipText("Shiny2");
1990
+ shini1.addMouseListener(new MouseAdapter()
1991
+ {
1992
+ public void mouseClicked(MouseEvent e)
1993
+ {
1994
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
1995
+ cMaterial material = object.material;
1996
+
1997
+ shininessField.setFloat(material.shininess);
1998
+ lightareaField.setFloat(material.lightarea);
1999
+
2000
+ materialtouched = true;
2001
+ applySelf();
2002
+ }
2003
+ });
2004
+ presetpanel.add(shini1);
2005
+
2006
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2007
+ shini2.setToolTipText("Shiny3");
2008
+ shini2.addMouseListener(new MouseAdapter()
2009
+ {
2010
+ public void mouseClicked(MouseEvent e)
2011
+ {
2012
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2013
+ cMaterial material = object.material;
2014
+
2015
+ shininessField.setFloat(material.shininess);
2016
+ lightareaField.setFloat(material.lightarea);
2017
+
2018
+ materialtouched = true;
2019
+ applySelf();
2020
+ }
2021
+ });
2022
+ presetpanel.add(shini2);
2023
+
2024
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2025
+ aniso.setToolTipText("AnisoU");
2026
+ aniso.addMouseListener(new MouseAdapter()
2027
+ {
2028
+ public void mouseClicked(MouseEvent e)
2029
+ {
2030
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2031
+ cMaterial material = object.material;
2032
+
2033
+ anisoField.setFloat(material.aniso);
2034
+ anisoVField.setFloat(material.anisoV);
2035
+
2036
+ materialtouched = true;
2037
+ applySelf();
2038
+ }
2039
+ });
2040
+ presetpanel.add(aniso);
2041
+
2042
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2043
+ aniso2.setToolTipText("AnisoV");
2044
+ aniso2.addMouseListener(new MouseAdapter()
2045
+ {
2046
+ public void mouseClicked(MouseEvent e)
2047
+ {
2048
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2049
+ cMaterial material = object.material;
2050
+
2051
+ anisoField.setFloat(material.aniso);
2052
+ anisoVField.setFloat(material.anisoV);
2053
+
2054
+ materialtouched = true;
2055
+ applySelf();
2056
+ }
2057
+ });
2058
+ presetpanel.add(aniso2);
2059
+
2060
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2061
+ aniso3.setToolTipText("AnisoUV");
2062
+ aniso3.addMouseListener(new MouseAdapter()
2063
+ {
2064
+ public void mouseClicked(MouseEvent e)
2065
+ {
2066
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2067
+ cMaterial material = object.material;
2068
+
2069
+ anisoField.setFloat(material.aniso);
2070
+ anisoVField.setFloat(material.anisoV);
2071
+
2072
+ materialtouched = true;
2073
+ applySelf();
2074
+ }
2075
+ });
2076
+ presetpanel.add(aniso3);
2077
+
2078
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2079
+ velvet0.setToolTipText("Velvet");
2080
+ velvet0.addMouseListener(new MouseAdapter()
2081
+ {
2082
+ public void mouseClicked(MouseEvent e)
2083
+ {
2084
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2085
+ cMaterial material = object.material;
2086
+
2087
+ diffusenessField.setFloat(material.factor);
2088
+ selfshadowField.setFloat(material.diffuseness);
2089
+ sheenField.setFloat(material.sheen);
2090
+ shininessField.setFloat(material.shininess);
2091
+ velvetField.setFloat(material.velvet);
2092
+ shiftField.setFloat(material.shift);
2093
+
2094
+ materialtouched = true;
2095
+ applySelf();
2096
+ }
2097
+ });
2098
+ presetpanel.add(velvet0);
2099
+
2100
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2101
+ bump0.setToolTipText("Bump texture");
2102
+ bump0.addMouseListener(new MouseAdapter()
2103
+ {
2104
+ public void mouseClicked(MouseEvent e)
2105
+ {
2106
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2107
+ cMaterial material = object.material;
2108
+
2109
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2110
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2111
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2112
+
2113
+ materialtouched = true;
2114
+ applySelf();
2115
+ }
2116
+ });
2117
+ presetpanel.add(bump0);
2118
+
2119
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2120
+ halo.setToolTipText("Halo");
2121
+ halo.addMouseListener(new MouseAdapter()
2122
+ {
2123
+ public void mouseClicked(MouseEvent e)
2124
+ {
2125
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2126
+ cMaterial material = object.material;
2127
+
2128
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2129
+
2130
+ materialtouched = true;
2131
+ applySelf();
2132
+ }
2133
+ });
2134
+ presetpanel.add(halo);
2135
+
2136
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2137
+ candle.setToolTipText("Candle");
2138
+ candle.addMouseListener(new MouseAdapter()
2139
+ {
2140
+ public void mouseClicked(MouseEvent e)
2141
+ {
2142
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2143
+ cMaterial material = object.material;
2144
+
2145
+ subsurfaceField.setFloat(material.subsurface);
2146
+ shadowbiasField.setFloat(material.shadowbias);
2147
+ ambientField.setFloat(material.ambient);
2148
+ specularField.setFloat(material.specular);
2149
+ lightareaField.setFloat(material.lightarea);
2150
+ shininessField.setFloat(material.shininess);
2151
+
2152
+ materialtouched = true;
2153
+ applySelf();
2154
+ }
2155
+ });
2156
+ presetpanel.add(candle);
2157
+
2158
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2159
+ shadowShader.setToolTipText("Shadow");
2160
+ shadowShader.addMouseListener(new MouseAdapter()
2161
+ {
2162
+ public void mouseClicked(MouseEvent e)
2163
+ {
2164
+ diffuseField.setFloat(0.001);
2165
+ ambientField.setFloat(0.001);
2166
+ cameraField.setFloat(0.001);
2167
+ specularField.setFloat(0.001);
2168
+ fakedepthField.setFloat(0.001);
2169
+ opacityField.setFloat(0.6);
2170
+
2171
+ materialtouched = true;
2172
+ applySelf();
2173
+ }
2174
+ });
2175
+ presetpanel.add(shadowShader);
2176
+
2177
+ cGridBag panel = new cGridBag().setVertical(true);
2178
+
2179
+ presetpanel.preferredWidth = 1;
2180
+
2181
+ materialpanel.add(presetpanel);
2182
+ materialpanel.add(panel);
2183
+
2184
+ panel.preferredWidth = 8;
2185
+
2186
+ /*
15192187 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
15202188 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1521
- */
2189
+ */
15222190
15232191 cGridBag editBar = new cGridBag().setVertical(false);
15242192
....@@ -1552,45 +2220,50 @@
15522220 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15532221
15542222 cGridBag colorSection = new cGridBag().setVertical(true);
2223
+
2224
+ cGridBag huepanel = new cGridBag();
2225
+ cGridBag huelabel = new cGridBag();
2226
+ skin = GetLabel("icons/hue.png", false);
2227
+ skin.fit = true;
2228
+ huelabel.add(skin);
2229
+ huelabel.preferredWidth = 20;
2230
+ huepanel.add(new cGridBag()); // Label
2231
+ huepanel.add(huelabel); // Field/slider
2232
+
2233
+ huepanel.preferredHeight = 7;
2234
+
2235
+ colorSection.add(huepanel);
15552236
15562237 cGridBag color = new cGridBag();
1557
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1558
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2238
+
2239
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2240
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2241
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2242
+
15602243 //colorField.preferredWidth = 200;
15612244 colorSection.add(color);
15622245
15632246 cGridBag modulation = new cGridBag();
15642247 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
15652248 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2249
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
15672250 colorSection.add(modulation);
15682251
2252
+ cGridBag opacity = new cGridBag();
2253
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2254
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2255
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2256
+ colorSection.add(opacity);
2257
+
2258
+ colorSection.add(GetSeparator());
2259
+
15692260 cGridBag texture = new cGridBag();
15702261 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
15712262 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
15722263 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
15732264 colorSection.add(texture);
15742265
1575
- cGridBag anisoU = new cGridBag();
1576
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1577
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1579
- colorSection.add(anisoU);
1580
-
1581
- cGridBag anisoV = new cGridBag();
1582
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1583
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1585
- colorSection.add(anisoV);
1586
-
1587
- cGridBag shadowbias = new cGridBag();
1588
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1589
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1591
- colorSection.add(shadowbias);
1592
-
1593
- panel.add(new JSeparator());
2266
+ panel.add(GetSeparator());
15942267
15952268 panel.add(colorSection);
15962269
....@@ -1640,7 +2313,13 @@
16402313 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16412314 diffuseSection.add(fakedepth);
16422315
1643
- panel.add(new JSeparator());
2316
+ cGridBag shadowbias = new cGridBag();
2317
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2318
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2319
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2320
+ diffuseSection.add(shadowbias);
2321
+
2322
+ panel.add(GetSeparator());
16442323
16452324 panel.add(diffuseSection);
16462325
....@@ -1690,42 +2369,48 @@
16902369 // aConstraints.gridy += 1;
16912370 // aConstraints.gridwidth = 1;
16922371
2372
+ cGridBag anisoU = new cGridBag();
2373
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2374
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2375
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2376
+ specularSection.add(anisoU);
16932377
1694
- panel.add(new JSeparator());
2378
+ cGridBag anisoV = new cGridBag();
2379
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2380
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2381
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2382
+ specularSection.add(anisoV);
2383
+
2384
+
2385
+ panel.add(GetSeparator());
16952386
16962387 panel.add(specularSection);
16972388
16982389 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16992390
1700
- cGridBag globalSection = new cGridBag().setVertical(true);
2391
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17012392
17022393 cGridBag camera = new cGridBag();
17032394 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
17042395 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17052396 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
- globalSection.add(camera);
2397
+ colorSection.add(camera);
17072398
17082399 cGridBag ambient = new cGridBag();
17092400 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
17102401 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17112402 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1712
- globalSection.add(ambient);
2403
+ colorSection.add(ambient);
17132404
17142405 cGridBag backlit = new cGridBag();
17152406 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17162407 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17172408 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1718
- globalSection.add(backlit);
2409
+ colorSection.add(backlit);
17192410
1720
- cGridBag opacity = new cGridBag();
1721
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1722
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1724
- globalSection.add(opacity);
1725
-
1726
- panel.add(new JSeparator());
2411
+ //panel.add(new JSeparator());
17272412
1728
- panel.add(globalSection);
2413
+ //panel.add(globalSection);
17292414
17302415 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17312416
....@@ -1767,7 +2452,7 @@
17672452 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
17682453 textureSection.add(opacityPower);
17692454
1770
- panel.add(new JSeparator());
2455
+ panel.add(GetSeparator());
17712456
17722457 panel.add(textureSection);
17732458
....@@ -1832,8 +2517,9 @@
18322517 // 3D models
18332518 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18342519 {
1835
- lastConverter = new com.jmex.model.converters.MaxToJme();
1836
- LoadFile(filename, lastConverter);
2520
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2521
+ //LoadFile(filename, lastConverter);
2522
+ LoadObjFile(filename); // New 3ds loader
18372523 continue;
18382524 }
18392525 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2559,6 +3245,7 @@
25593245 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25603246 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25613247 }
3248
+
25623249 //cJME.count++;
25633250 //cJME.count %= 12;
25643251 if (gc)
....@@ -2742,6 +3429,7 @@
27423429 }
27433430 }
27443431 }
3432
+
27453433 cFileSystemPane FSPane;
27463434
27473435 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2751,7 +3439,7 @@
27513439
27523440 freezematerial = true;
27533441 colorField.setFloat(mat.color);
2754
- modulationField.setFloat(mat.modulation);
3442
+ saturationField.setFloat(mat.modulation);
27553443 metalnessField.setFloat(mat.metalness);
27563444 diffuseField.setFloat(mat.diffuse);
27573445 specularField.setFloat(mat.specular);
....@@ -2795,11 +3483,14 @@
27953483 }
27963484 }
27973485 }
3486
+
27983487 freezematerial = false;
27993488 }
28003489
28013490 void SetMaterial(Object3D object)
28023491 {
3492
+ latestObject = object;
3493
+
28033494 cMaterial mat = object.material;
28043495
28053496 if (mat == null)
....@@ -2911,12 +3602,17 @@
29113602 // }
29123603
29133604 /**/
2914
- if (deselect)
3605
+ if (deselect || child == null)
29153606 {
29163607 //group.deselectAll();
29173608 //freeze = true;
29183609 GetTree().clearSelection();
29193610 //freeze = false;
3611
+
3612
+ if (child == null)
3613
+ {
3614
+ return;
3615
+ }
29203616 }
29213617
29223618 //group.addSelectee(child);
....@@ -2950,6 +3646,17 @@
29503646 public void itemStateChanged(ItemEvent event)
29513647 {
29523648 // System.out.println("Propagate = " + propagate);
3649
+ if (event.getSource() == pinButton)
3650
+ {
3651
+ copy.pinned ^= true;
3652
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3653
+ {
3654
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3655
+ copy.CloseUI();
3656
+ //copy.editWindow.refreshContents();
3657
+ }
3658
+ }
3659
+ else
29533660 if (event.getSource() == propagateToggle)
29543661 {
29553662 propagate ^= true;
....@@ -2985,7 +3692,7 @@
29853692 cameraView.ToggleDL();
29863693 cameraView.repaint();
29873694 return;
2988
- } else if (event.getSource() == toggleTextureItem)
3695
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29893696 {
29903697 cameraView.ToggleTexture();
29913698 // june 2013 copy.HardTouch();
....@@ -3024,7 +3731,7 @@
30243731 frame.validate();
30253732
30263733 return;
3027
- } else if (event.getSource() == toggleSwitchItem)
3734
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30283735 {
30293736 cameraView.ToggleSwitch();
30303737 cameraView.repaint();
....@@ -3054,8 +3761,9 @@
30543761 } else if (event.getSource() == liveCB)
30553762 {
30563763 copy.live ^= true;
3764
+ objEditor.refreshContents(true); // To show item colors
30573765 return;
3058
- } else if (event.getSource() == selectCB)
3766
+ } else if (event.getSource() == selectableCB)
30593767 {
30603768 copy.dontselect ^= true;
30613769 return;
....@@ -3063,7 +3771,7 @@
30633771 {
30643772 copy.hide ^= true;
30653773 copy.Touch(); // display list issue
3066
- objEditor.refreshContents();
3774
+ objEditor.refreshContents(true); // To show item colors
30673775 return;
30683776 } else if (event.getSource() == link2masterCB)
30693777 {
....@@ -3240,9 +3948,9 @@
32403948 {
32413949 Close();
32423950 //return true;
3243
- } else if (source == loadItem)
3951
+ } else if (source == openItem)
32443952 {
3245
- load();
3953
+ Open();
32463954 //return true;
32473955 } else if (source == newItem)
32483956 {
....@@ -3267,6 +3975,10 @@
32673975 {
32683976 generatePOV();
32693977 //return true;
3978
+ } else if (event.getSource() == archiveItem)
3979
+ {
3980
+ cTools.Archive(frame);
3981
+ return;
32703982 } else if (source == zBufferItem)
32713983 {
32723984 try
....@@ -3315,11 +4027,12 @@
33154027
33164028 static public byte[] Compress(Object3D o)
33174029 {
4030
+ // Slower to actually compress.
33184031 try
33194032 {
33204033 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3321
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3322
- ObjectOutputStream out = new ObjectOutputStream(zstream);
4034
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4035
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
33234036
33244037 Object3D parent = o.parent;
33254038 o.parent = null;
....@@ -3330,10 +4043,14 @@
33304043
33314044 out.flush();
33324045
3333
- zstream.close();
4046
+ baos //zstream
4047
+ .close();
33344048 out.close();
33354049
3336
- return baos.toByteArray();
4050
+ byte[] bytes = baos.toByteArray();
4051
+
4052
+ System.out.println("save #bytes = " + bytes.length);
4053
+ return bytes;
33374054 } catch (Exception e)
33384055 {
33394056 System.err.println(e);
....@@ -3343,13 +4060,16 @@
33434060
33444061 static public Object Uncompress(byte[] bytes)
33454062 {
3346
- System.out.println("#bytes = " + bytes.length);
4063
+ System.out.println("restore #bytes = " + bytes.length);
33474064 try
33484065 {
33494066 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3350
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3351
- ObjectInputStream in = new ObjectInputStream(istream);
4067
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4068
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
33524069 Object obj = in.readObject();
4070
+
4071
+ bais //istream
4072
+ .close();
33534073 in.close();
33544074
33554075 return obj;
....@@ -3404,37 +4124,95 @@
34044124 return null;
34054125 }
34064126
3407
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
34084127
34094128 public void Save()
34104129 {
3411
- cRadio tab = GetCurrentTab();
4130
+ //Save(true);
4131
+ Replace();
4132
+ SetUndoStates();
4133
+ }
4134
+
4135
+ private boolean Equal(byte[] compress, byte[] name)
4136
+ {
4137
+ if (compress.length != name.length)
4138
+ {
4139
+ return false;
4140
+ }
34124141
3413
- boolean temp = CameraPane.SWITCH;
3414
- CameraPane.SWITCH = false;
4142
+ for (int i=compress.length; --i>=0;)
4143
+ {
4144
+ if (compress[i] != name[i])
4145
+ return false;
4146
+ }
34154147
3416
- copy.ExtractBigData(hashtable);
4148
+ return true;
4149
+ }
4150
+
4151
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4152
+
4153
+ void DeleteVersion()
4154
+ {
4155
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4156
+ {
4157
+ copy.versionlist[i] = copy.versionlist[i+1];
4158
+ }
4159
+
4160
+ CopyChanged();
4161
+
4162
+ SetUndoStates();
4163
+ }
4164
+
4165
+ public boolean Save(boolean user)
4166
+ {
4167
+ System.err.println("Save");
4168
+ Replace();
4169
+
4170
+ //cRadio tab = GetCurrentTab();
4171
+
4172
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
4173
+
4174
+ boolean thesame = false;
4175
+
4176
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4177
+// {
4178
+// thesame = true;
4179
+// }
34174180
34184181 //EditorFrame.m_MainFrame.requestFocusInWindow();
3419
- tab.graphs[tab.undoindex++] = Compress(copy);
3420
-
3421
- copy.RestoreBigData(hashtable);
3422
-
3423
- CameraPane.SWITCH = temp;
3424
-
3425
- //assert(hashtable.isEmpty());
3426
-
3427
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
4182
+ if (!thesame)
34284183 {
3429
- tab.graphs[i] = null;
4184
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4185
+ {
4186
+ copy.versionlist[i] = copy.versionlist[i-1];
4187
+ }
4188
+
4189
+ //tab.user[tab.versionindex] = user;
4190
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4191
+
4192
+ copy.versionlist[++copy.versionindex] = compress;
4193
+
4194
+ // if (increment)
4195
+ // tab.versionindex++;
34304196 }
34314197
4198
+ //copy.RestoreBigData(versiontable);
4199
+
4200
+ //assert(hashtable.isEmpty());
4201
+
4202
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4203
+// {
4204
+// //tab.user[i] = false;
4205
+// copy.versionlist[i] = null;
4206
+// }
4207
+
4208
+ SetUndoStates();
4209
+
34324210 // test save
34334211 if (false)
34344212 {
34354213 try
34364214 {
3437
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
4215
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
34384216 ObjectOutputStream p = new ObjectOutputStream(ostream);
34394217
34404218 p.writeObject(copy);
....@@ -3447,26 +4225,68 @@
34474225 e.printStackTrace();
34484226 }
34494227 }
4228
+
4229
+ return !thesame;
4230
+ }
4231
+
4232
+ boolean flashIt = true;
4233
+
4234
+ void RefreshSelection()
4235
+ {
4236
+ Object3D selection = new Object3D();
4237
+
4238
+ for (int i = 0; i < copy.selection.size(); i++)
4239
+ {
4240
+ Object3D elem = copy.selection.elementAt(i);
4241
+
4242
+ Object3D obj = copy.GetObject(elem.GetUUID());
4243
+
4244
+ if (obj == null)
4245
+ {
4246
+ copy.selection.remove(i--);
4247
+ }
4248
+ else
4249
+ {
4250
+ selection.add(obj);
4251
+ copy.selection.setElementAt(obj, i);
4252
+ }
4253
+ }
4254
+
4255
+ flashIt = false;
4256
+ GetTree().clearSelection();
4257
+ for (int i = 0; i < selection.size(); i++)
4258
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4259
+ flashIt = true;
4260
+
4261
+ //refreshContents(false);
34504262 }
34514263
3452
- void CopyChanged(Object3D obj)
4264
+ void CopyChanged()
34534265 {
4266
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4267
+
4268
+ SetUndoStates();
4269
+
34544270 boolean temp = CameraPane.SWITCH;
34554271 CameraPane.SWITCH = false;
34564272
3457
- copy.ExtractBigData(hashtable);
4273
+ copy.ExtractBigData(versiontable);
34584274
34594275 copy.clear();
34604276
4277
+ copy.skyboxname = obj.skyboxname;
4278
+ copy.skyboxext = obj.skyboxext;
4279
+
34614280 for (int i=0; i<obj.Size(); i++)
34624281 {
34634282 copy.add(obj.get(i));
34644283 }
34654284
3466
- copy.RestoreBigData(hashtable);
4285
+ copy.RestoreBigData(versiontable);
34674286
34684287 CameraPane.SWITCH = temp;
34694288
4289
+ RefreshSelection();
34704290 //assert(hashtable.isEmpty());
34714291
34724292 copy.Touch();
....@@ -3487,43 +4307,144 @@
34874307 }
34884308 }
34894309
3490
- refreshContents();
4310
+ refreshContents(true);
34914311 }
34924312
3493
- public void Undo()
3494
- {
3495
- cRadio tab = GetCurrentTab();
4313
+ cButton previousVersionButton;
4314
+ cButton restoreButton;
4315
+ cButton replaceButton;
4316
+ cButton nextVersionButton;
4317
+ cButton saveVersionButton;
4318
+ cButton deleteVersionButton;
34964319
3497
- if (tab.undoindex == 0)
4320
+ boolean muteSlider;
4321
+
4322
+ int VersionCount()
4323
+ {
4324
+ int count = 0;
4325
+
4326
+ for (int i = copy.versionlist.length; --i >= 0;)
4327
+ {
4328
+ if (copy.versionlist[i] != null)
4329
+ count++;
4330
+ }
4331
+
4332
+ return count;
4333
+ }
4334
+
4335
+ void SetUndoStates()
4336
+ {
4337
+ //if (true)
4338
+ // return;
4339
+
4340
+ //cRadio tab = GetCurrentTab();
4341
+
4342
+ restoreButton.setEnabled(copy.versionindex != -1);
4343
+ replaceButton.setEnabled(copy.versionindex != -1);
4344
+
4345
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4346
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4347
+
4348
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4349
+ copy.versionlist[copy.versionindex + 1] != null);
4350
+
4351
+ muteSlider = true;
4352
+ versionSlider.setMinimum(0);
4353
+ versionSlider.setMaximum(VersionCount() - 1);
4354
+ versionSlider.setInteger(copy.versionindex);
4355
+ versionSlider.setEnabled(copy.versionindex != -1);
4356
+ muteSlider = false;
4357
+ }
4358
+
4359
+ public boolean PreviousVersion()
4360
+ {
4361
+ // Option?
4362
+ Replace();
4363
+
4364
+ System.err.println("Undo");
4365
+
4366
+ //cRadio tab = GetCurrentTab();
4367
+
4368
+ if (copy.versionindex == 0)
34984369 {
34994370 java.awt.Toolkit.getDefaultToolkit().beep();
3500
- return;
4371
+ return false;
35014372 }
35024373
3503
- if (tab.graphs[tab.undoindex] == null)
3504
- {
3505
- Save();
3506
- tab.undoindex -= 1;
3507
- }
4374
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4375
+// {
4376
+// if (Save(false))
4377
+// tab.versionindex -= 1;
4378
+// else
4379
+// {
4380
+// if (tab.versionindex <= 0)
4381
+// return false;
4382
+// else
4383
+// tab.versionindex -= 1;
4384
+// }
4385
+// }
35084386
3509
- tab.undoindex -= 1;
4387
+ copy.versionindex -= 1;
35104388
3511
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4389
+ CopyChanged();
4390
+
4391
+ return true;
35124392 }
35134393
3514
- public void Redo()
4394
+ public boolean Restore()
35154395 {
3516
- cRadio tab = GetCurrentTab();
4396
+ System.err.println("Restore");
35174397
3518
- if (tab.graphs[tab.undoindex + 1] == null)
4398
+ //cRadio tab = GetCurrentTab();
4399
+
4400
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4401
+ {
4402
+ java.awt.Toolkit.getDefaultToolkit().beep();
4403
+ return false;
4404
+ }
4405
+
4406
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4407
+ CopyChanged();
4408
+
4409
+ return true;
4410
+ }
4411
+
4412
+ public boolean Replace()
4413
+ {
4414
+ System.err.println("Replace");
4415
+
4416
+ //cRadio tab = GetCurrentTab();
4417
+
4418
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4419
+ {
4420
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4421
+ return false;
4422
+ }
4423
+
4424
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4425
+
4426
+ return true;
4427
+ }
4428
+
4429
+ public void NextVersion()
4430
+ {
4431
+ // Option?
4432
+ Replace();
4433
+
4434
+ //cRadio tab = GetCurrentTab();
4435
+
4436
+ if (copy.versionlist[copy.versionindex + 1] == null)
35194437 {
35204438 java.awt.Toolkit.getDefaultToolkit().beep();
35214439 return;
35224440 }
35234441
3524
- tab.undoindex += 1;
4442
+ copy.versionindex += 1;
35254443
3526
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4444
+ CopyChanged();
4445
+
4446
+ //if (!tab.user[tab.versionindex])
4447
+ // tab.graphs[tab.versionindex] = null;
35274448 }
35284449
35294450 void ImportGFD()
....@@ -3675,7 +4596,7 @@
36754596 assert false;
36764597 }
36774598
3678
- void EditSelection()
4599
+ void EditSelection(boolean newWindow)
36794600 {
36804601 }
36814602
....@@ -3734,7 +4655,7 @@
37344655 //copy.material = new cMaterial(copy.GetMaterial());
37354656
37364657 current.color = (float) colorField.getFloat();
3737
- current.modulation = (float) modulationField.getFloat();
4658
+ current.modulation = (float) saturationField.getFloat();
37384659 current.metalness = (float) metalnessField.getFloat();
37394660 current.diffuse = (float) diffuseField.getFloat();
37404661 current.specular = (float) specularField.getFloat();
....@@ -3767,7 +4688,7 @@
37674688 cMaterial mat = copy.material;
37684689
37694690 colorField.SetToolTipValue((mat.color));
3770
- modulationField.SetToolTipValue((mat.modulation));
4691
+ saturationField.SetToolTipValue((mat.modulation));
37714692 metalnessField.SetToolTipValue((mat.metalness));
37724693 diffuseField.SetToolTipValue((mat.diffuse));
37734694 specularField.SetToolTipValue((mat.specular));
....@@ -3819,9 +4740,26 @@
38194740 //copy.Touch();
38204741 }
38214742
4743
+ cNumberSlider versionSlider;
4744
+
38224745 public void stateChanged(ChangeEvent e)
38234746 {
38244747 // assert(false);
4748
+ if (e.getSource() == versionSlider)
4749
+ {
4750
+ if (muteSlider)
4751
+ return;
4752
+
4753
+ int version = versionSlider.getInteger();
4754
+
4755
+ if (version != -1 && copy.versionlist[version] != null)
4756
+ {
4757
+ copy.versionindex = version;
4758
+ CopyChanged();
4759
+ }
4760
+
4761
+ return;
4762
+ }
38254763
38264764 if (freezematerial)
38274765 {
....@@ -3857,6 +4795,12 @@
38574795 {
38584796 //System.out.println("stateChanged = " + this);
38594797 materialtouched = true;
4798
+
4799
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4800
+ {
4801
+ saturationField.setFloat(1);
4802
+ }
4803
+
38604804 applySelf();
38614805 //System.out.println("this = " + this);
38624806 //System.out.println("PARENT = " + parent);
....@@ -4156,6 +5100,7 @@
41565100 {
41575101 if (GetTree() != null)
41585102 {
5103
+ GetTree().revalidate();
41595104 GetTree().repaint();
41605105 }
41615106
....@@ -4164,13 +5109,17 @@
41645109 ctrlPanel.validate(); // ? new
41655110 ctrlPanel.repaint();
41665111 }
5112
+
5113
+ if (previousVersionButton != null && copy.versionlist != null)
5114
+ SetUndoStates();
41675115 }
41685116
41695117 static TweenManager tweenManager = new TweenManager();
41705118
41715119 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
41725120 {
4173
- Save();
5121
+ if (Globals.REPLACEONMAKE) // && resetmodel)
5122
+ Save();
41745123 //Tween.set(thing, 0).target(1).start(tweenManager);
41755124 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
41765125 // if (thing instanceof GenericJointDemo)
....@@ -4257,6 +5206,12 @@
42575206 {
42585207 ResetModel();
42595208 Select(thing.GetTreePath(), true, false); // unselect... false);
5209
+
5210
+ if (thing.Size() == 0)
5211
+ {
5212
+ //EditSelection(false);
5213
+ }
5214
+
42605215 refreshContents();
42615216 }
42625217
....@@ -4405,7 +5360,9 @@
44055360 readobj.ResetDisplayList();
44065361 } catch (Exception e)
44075362 {
4408
- //e.printStackTrace();
5363
+ if (!e.toString().contains("GZIP"))
5364
+ e.printStackTrace();
5365
+
44095366 try
44105367 {
44115368 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4479,11 +5436,14 @@
44795436
44805437 if (readobj != null)
44815438 {
4482
- Save();
5439
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5440
+ // Save();
44835441 try
44845442 {
44855443 //readobj.deepCopySelf(copy);
44865444 copy.clear(); // june 2014
5445
+ copy.skyboxname = readobj.skyboxname;
5446
+ copy.skyboxext = readobj.skyboxext;
44875447 for (int i = 0; i < readobj.size(); i++)
44885448 {
44895449 Object3D child = readobj.get(i); // reserve(i);
....@@ -4524,6 +5484,7 @@
45245484 }
45255485 } catch (ClassCastException e)
45265486 {
5487
+ e.printStackTrace();
45275488 assert (false);
45285489 Composite c = (Composite) copy;
45295490 c.children.clear();
....@@ -4534,17 +5495,31 @@
45345495 c.addChild(csg);
45355496 }
45365497
5498
+ copy.versionlist = readobj.versionlist;
5499
+ copy.versionindex = readobj.versionindex;
5500
+
5501
+ if (copy.versionlist == null)
5502
+ {
5503
+ // Backward compatibility
5504
+ copy.versionlist = new Object3D[100];
5505
+ copy.versionindex = -1;
5506
+
5507
+ Save(true);
5508
+ }
5509
+
5510
+ //? SetUndoStates();
5511
+
45375512 ResetModel();
45385513 copy.HardTouch(); // recompile?
45395514 refreshContents();
45405515 }
45415516 }
45425517
4543
- void load() // throws ClassNotFoundException
5518
+ void Open() // throws ClassNotFoundException
45445519 {
45455520 if (Grafreed.standAlone)
45465521 {
4547
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5522
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
45485523 browser.show();
45495524 String filename = browser.getFile();
45505525 if (filename != null && filename.length() > 0)
....@@ -4643,6 +5618,7 @@
46435618 //ps.print(buffer.toString());
46445619 } catch (IOException e)
46455620 {
5621
+ e.printStackTrace();
46465622 }
46475623 }
46485624
....@@ -4657,6 +5633,8 @@
46575633 String filename = browser.getFile();
46585634 if (filename != null && filename.length() > 0)
46595635 {
5636
+ if (!filename.endsWith(".gfd"))
5637
+ filename += ".gfd";
46605638 lastname = browser.getDirectory() + filename;
46615639 save();
46625640 }
....@@ -4823,7 +5801,7 @@
48235801 MenuBar menuBar;
48245802 Menu fileMenu;
48255803 MenuItem newItem;
4826
- MenuItem loadItem;
5804
+ MenuItem openItem;
48275805 MenuItem saveItem;
48285806 MenuItem saveAsItem;
48295807 MenuItem exportAsItem;
....@@ -4846,22 +5824,37 @@
48465824 CheckboxMenuItem toggleSwitchItem;
48475825 CheckboxMenuItem toggleRootItem;
48485826 CheckboxMenuItem animationItem;
5827
+ MenuItem archiveItem;
48495828 CheckboxMenuItem toggleHandleItem;
48505829 CheckboxMenuItem togglePaintItem;
48515830 JSplitPane mainPanel;
48525831 JScrollPane scrollpane;
5832
+
48535833 JPanel toolbarPanel;
5834
+
48545835 cGridBag treePanel;
5836
+
48555837 JPanel radioPanel;
48565838 ButtonGroup buttonGroup;
4857
- cGridBag ctrlPanel;
5839
+
5840
+ cGridBag toolboxPanel;
5841
+ cGridBag skyboxPanel;
48585842 cGridBag materialPanel;
5843
+ cGridBag ctrlPanel;
5844
+
48595845 JScrollPane infoPanel;
5846
+
48605847 cGridBag optionsPanel;
5848
+
48615849 JTabbedPane objectPanel;
5850
+ boolean materialFlushed;
5851
+ Object3D latestObject;
5852
+
48625853 cGridBag XYZPanel;
5854
+
48635855 JSplitPane gridPanel;
48645856 JSplitPane bigPanel;
5857
+
48655858 cGridBag bigThree;
48665859 cGridBag scenePanel;
48675860 cGridBag centralPanel;
....@@ -4919,7 +5912,7 @@
49195912 JLabel colorLabel;
49205913 cNumberSlider colorField;
49215914 JLabel modulationLabel;
4922
- cNumberSlider modulationField;
5915
+ cNumberSlider saturationField;
49235916 JLabel metalnessLabel;
49245917 cNumberSlider metalnessField;
49255918 JLabel diffuseLabel;
....@@ -4950,6 +5943,7 @@
49505943 cNumberSlider anisoField;
49515944 JLabel anisoVLabel;
49525945 cNumberSlider anisoVField;
5946
+
49535947 JLabel cameraLabel;
49545948 cNumberSlider cameraField;
49555949 JLabel selfshadowLabel;
....@@ -4964,6 +5958,7 @@
49645958 cNumberSlider fakedepthField;
49655959 JLabel shadowbiasLabel;
49665960 cNumberSlider shadowbiasField;
5961
+
49675962 JLabel bumpLabel;
49685963 cNumberSlider bumpField;
49695964 JLabel noiseLabel;
....@@ -4976,7 +5971,7 @@
49765971 cNumberSlider fogField;
49775972 JLabel opacityPowerLabel;
49785973 cNumberSlider opacityPowerField;
4979
- JTree jTree;
5974
+ cTree jTree;
49805975 //ObjectUI parent;
49815976
49825977 cNumberSlider normalpushField;