Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
ObjEditor.java
....@@ -34,6 +34,7 @@
3434 iSendInfo
3535 //KeyListener
3636 {
37
+ public cToggleButton pinButton;
3738 boolean timeline;
3839 boolean wasFullScreen;
3940
....@@ -41,64 +42,119 @@
4142 JFrame frame;
4243
4344 static ObjEditor theFrame;
45
+
46
+ public void AllocProjectedVertices(Object3D object)
47
+ {
48
+ assert (object.projectedVertices != null);
49
+
50
+ if (object.projectedVertices.length <= 2)
51
+ {
52
+ // Side effect...
53
+ Object3D.cVector2[] keep = object.projectedVertices;
54
+ object.projectedVertices = new Object3D.cVector2[3];
55
+ for (int i = 0; i < 3; i++)
56
+ {
57
+ if (i < keep.length)
58
+ {
59
+ object.projectedVertices[i] = keep[i];
60
+ } else
61
+ {
62
+ object.projectedVertices[i] = new Object3D.cVector2();
63
+ }
64
+ /*
65
+ if(keep.length == 0)
66
+ object.projectedVertices[0] = new Object3D.cVector2();
67
+ else
68
+ object.projectedVertices[0] = keep[0];
69
+ object.projectedVertices[1] = new Object3D.cVector2();
70
+ */
71
+ }
72
+ }
73
+ }
74
+
75
+ public cGridBag GetSeparator()
76
+ {
77
+ cGridBag separator = new cGridBag();
78
+ separator.add(new JSeparator());
79
+ separator.preferredHeight = 5;
80
+ return separator;
81
+ }
4482
4583 cButton GetButton(String name, boolean border)
4684 {
47
- try
48
- {
49
- ImageIcon icon = GetIcon(name);
50
- return new cButton(icon, border);
51
- }
52
- catch (Exception e)
53
- {
54
- return new cButton(name, border);
55
- }
85
+ ImageIcon icon = GetIcon(name);
86
+ return new cButton(icon, border);
87
+ }
88
+
89
+ cLabel GetLabel(String name, boolean border)
90
+ {
91
+ //ImageIcon icon = GetIcon(name);
92
+ return new cLabel(GetImage(name), border);
5693 }
5794
5895 cToggleButton GetToggleButton(String name, boolean border)
5996 {
60
- try
61
- {
62
- ImageIcon icon = GetIcon(name);
63
- return new cToggleButton(icon, border);
64
- }
65
- catch (Exception e)
66
- {
67
- return new cToggleButton(name, border);
68
- }
97
+ ImageIcon icon = GetIcon(name);
98
+ return new cToggleButton(icon, border);
6999 }
70100
71101 cCheckBox GetCheckBox(String name, boolean border)
72102 {
103
+ ImageIcon icon = GetIcon(name);
104
+ return new cCheckBox(icon, border);
105
+ }
106
+
107
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
108
+
109
+ ImageIcon GetIcon(String name)
110
+ {
111
+ javax.swing.ImageIcon iconCache = icons.get(name);
112
+ if (iconCache != null)
113
+ {
114
+ return iconCache;
115
+ }
116
+
73117 try
74118 {
75
- ImageIcon icon = GetIcon(name);
76
- return new cCheckBox(icon, border);
119
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
120
+
121
+// if (image.getWidth() > 48 && image.getHeight() > 48)
122
+// {
123
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
124
+// Graphics2D g = resized.createGraphics();
125
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
126
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
127
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
128
+// g.dispose();
129
+//
130
+// image = resized;
131
+// }
132
+
133
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
134
+
135
+ icons.put(name, icon);
136
+
137
+ return icon;
77138 }
78139 catch (Exception e)
79140 {
80
- return new cCheckBox(name, border);
141
+ //icons.put(name, null);
142
+ return null;
81143 }
82144 }
83
-
84
- private ImageIcon GetIcon(String name) throws IOException
145
+
146
+ BufferedImage GetImage(String name)
85147 {
86
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
-
88
- if (image.getWidth() != 24 && image.getHeight() != 24)
148
+ try
89149 {
90
- BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
- Graphics2D g = resized.createGraphics();
92
- g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
- //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
- g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
- g.dispose();
96
-
97
- image = resized;
150
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
151
+
152
+ return image;
98153 }
99
-
100
- javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
- return icon;
154
+ catch (Exception e)
155
+ {
156
+ return null;
157
+ }
102158 }
103159
104160 // SCRIPT
....@@ -282,6 +338,14 @@
282338 client = inClient;
283339 copy = client;
284340
341
+// if (copy.versionlist == null)
342
+// {
343
+// copy.versionlist = new Object3D[100];
344
+// copy.versionindex = -1;
345
+//
346
+// callee.Save(true);
347
+// }
348
+
285349 // "this" is not called: SetupUI2(objEditor);
286350 }
287351
....@@ -295,6 +359,14 @@
295359 client = inClient;
296360 copy = client;
297361
362
+ if (copy.versionlist == null)
363
+ {
364
+ copy.versionlist = new Object3D[100];
365
+ copy.versionindex = -1;
366
+
367
+// Save(true);
368
+ }
369
+
298370 SetupUI2(callee.GetEditor());
299371 }
300372
....@@ -309,14 +381,15 @@
309381 //localCopy.parent = null;
310382
311383 frame = new JFrame();
312
- frame.setUndecorated(true);
384
+ frame.setUndecorated(false);
313385 objEditor = this;
314386 this.callee = callee;
315387
316388 //parent = p;
317389
318390 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
319
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
391
+ if (Globals.DEBUG)
392
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
320393 //gd.setFullScreenWindow(this);
321394 //setResizable(false);
322395 //if (!isDisplayable())
....@@ -327,6 +400,14 @@
327400 copy = localCopy;
328401 copy.editWindow = this;
329402
403
+// if (copy.versionlist == null)
404
+// {
405
+// copy.versionlist = new Object3D[100];
406
+// copy.versionindex = -1;
407
+//
408
+// Save(true);
409
+// }
410
+
330411 SetupMenu();
331412
332413 //SetupName(objEditor); // new
....@@ -350,7 +431,7 @@
350431 frame.setMenuBar(menuBar = new MenuBar());
351432 menuBar.add(fileMenu = new Menu("File"));
352433 fileMenu.add(newItem = new MenuItem("New"));
353
- fileMenu.add(loadItem = new MenuItem("Open..."));
434
+ fileMenu.add(openItem = new MenuItem("Open..."));
354435
355436 //oe.menuBar.add(menu = new Menu("Include"));
356437 Menu menu = new Menu("Import");
....@@ -382,7 +463,7 @@
382463 }
383464
384465 newItem.addActionListener(this);
385
- loadItem.addActionListener(this);
466
+ openItem.addActionListener(this);
386467 saveItem.addActionListener(this);
387468 saveAsItem.addActionListener(this);
388469 exportAsItem.addActionListener(this);
....@@ -394,6 +475,8 @@
394475
395476 ChangeListener changeListener = new ChangeListener()
396477 {
478
+ //String name;
479
+
397480 public void stateChanged(ChangeEvent changeEvent)
398481 {
399482 // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
....@@ -412,18 +495,49 @@
412495 // EditSelection(false);
413496 // }
414497
415
- refreshContents(false); // To refresh Info tab
498
+// if (objectPanel.getSelectedIndex() == 4)
499
+// {
500
+// name = copy.skyboxname;
501
+//
502
+// if (name == null)
503
+// {
504
+// name = "";
505
+// }
506
+//
507
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
508
+// copy.skyboxext = "jpg";
509
+// }
510
+// else
511
+// {
512
+// if (name != null)
513
+// {
514
+// if (name.equals(""))
515
+// {
516
+// copy.skyboxname = null;
517
+// copy.skyboxext = null;
518
+// }
519
+// else
520
+// {
521
+// copy.skyboxname = name;
522
+// }
523
+// }
524
+// }
525
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
526
+
527
+// refreshContents(false); // To refresh Info tab
528
+ cameraView.repaint();
416529 }
417530 };
418531 objectPanel.addChangeListener(changeListener);
419532
420533 toolbarPanel = new JPanel();
421534 toolbarPanel.setName("Toolbar");
535
+
422536 treePanel = new cGridBag();
423537 treePanel.setName("Tree");
424538
425539 editPanel = new cGridBag().setVertical(true);
426
- editPanel.setName("Edit");
540
+ //editPanel.setName("Edit");
427541
428542 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
429543
....@@ -431,11 +545,13 @@
431545 editPanel.add(editCommandsPanel);
432546 editPanel.add(ctrlPanel);
433547
434
- toolboxPanel = new cGridBag().setVertical(false);
435
- toolboxPanel.setName("Toolbox");
548
+ toolboxPanel = new cGridBag().setVertical(true);
549
+ //toolboxPanel.setName("Toolbox");
436550
437
- materialPanel = new cGridBag().setVertical(true);
438
- materialPanel.setName("Material");
551
+ skyboxPanel = new cGridBag().setVertical(true);
552
+
553
+ materialPanel = new cGridBag().setVertical(false);
554
+ //materialPanel.setName("Material");
439555
440556 /*JTextPane*/
441557 infoarea = createTextPane();
....@@ -443,14 +559,15 @@
443559
444560 infoarea.setEditable(true);
445561 SetText();
562
+
446563 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
447564 // infoarea.setOpaque(false);
448565 // //infoarea.setForeground(textcolor);
449566 // TEXTAREA infoarea.setLineWrap(true);
450567 // TEXTAREA infoarea.setWrapStyleWord(true);
451568 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
452
- //infoPanel.setPreferredSize(new Dimension(50, 200));
453
- infoPanel.setName("Info");
569
+ infoPanel.setPreferredSize(new Dimension(1, 1));
570
+ //infoPanel.setName("Info");
454571 //infoPanel.setLayout(new BorderLayout());
455572 //infoPanel.add(createTextPane());
456573
....@@ -699,8 +816,8 @@
699816 }
700817 }
701818
702
-static GraphicsDevice device = GraphicsEnvironment
703
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
819
+//static GraphicsDevice device = GraphicsEnvironment
820
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
704821
705822 Rectangle keeprect;
706823 cRadio radio;
....@@ -717,6 +834,7 @@
717834 boolean maximized;
718835
719836 cButton fullscreenLayout;
837
+ cButton expandedLayout;
720838
721839 void Minimize()
722840 {
....@@ -741,10 +859,11 @@
741859 else
742860 {
743861 keeprect = frame.getBounds();
744
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
745
- Dimension rect2 = frame.getToolkit().getScreenSize();
746
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
862
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
863
+// Dimension rect2 = frame.getToolkit().getScreenSize();
864
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
747865 // frame.setState(Frame.MAXIMIZED_BOTH);
866
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
748867 }
749868
750869 maximized ^= true;
....@@ -755,15 +874,22 @@
755874 cButton minButton;
756875 cButton maxButton;
757876 cButton fullButton;
877
+ cButton collapseButton;
878
+ cButton maximize3DButton;
758879
759880 void ToggleFullScreen()
760881 {
882
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
883
+
761884 cameraView.ToggleFullScreen();
762885
763886 if (!CameraPane.FULLSCREEN)
764887 {
765888 device.setFullScreenWindow(null);
889
+ frame.dispose();
890
+ frame.setUndecorated(false);
766891 frame.validate();
892
+ frame.setVisible(true);
767893
768894 //frame.setVisible(false);
769895 // frame.removeNotify();
....@@ -774,13 +900,13 @@
774900 // X frame.getContentPane().remove(/*"Center",*/bigThree);
775901 // X framePanel.add(bigThree);
776902 // X frame.getContentPane().add(/*"Center",*/framePanel);
777
- framePanel.setDividerLocation(1);
903
+// framePanel.setDividerLocation(46); // icons are 24x24
778904
779905 //frame.setVisible(true);
780
- radio.layout = keepButton;
906
+// radio.layout = keepButton;
781907 //theFrame = null;
782908 keepButton = null;
783
- radio.layout.doClick();
909
+// radio.layout.doClick();
784910
785911 } else
786912 {
....@@ -789,22 +915,59 @@
789915 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
790916 // frame.getToolkit().getScreenSize().height);
791917 //frame.setVisible(false);
918
+
919
+ frame.dispose();
920
+ frame.setUndecorated(true);
792921 device.setFullScreenWindow(frame);
793922 frame.validate();
923
+ frame.setVisible(true);
794924 // frame.removeNotify();
795925 // frame.setUndecorated(true);
796926 // frame.addNotify();
797927 // X frame.getContentPane().remove(/*"Center",*/framePanel);
798928 // X framePanel.remove(bigThree);
799929 // X frame.getContentPane().add(/*"Center",*/bigThree);
800
- framePanel.setDividerLocation(0);
930
+// framePanel.setDividerLocation(0);
801931
802
- radio.layout = fullscreenLayout;
803
- radio.layout.doClick();
932
+// radio.layout = fullscreenLayout;
933
+// radio.layout.doClick();
804934 //frame.setVisible(true);
805935 }
806936 frame.validate();
937
+
938
+ cameraView.requestFocusInWindow();
807939 }
940
+
941
+ void CollapseToolbar()
942
+ {
943
+ framePanel.setDividerLocation(0);
944
+ //frame.validate();
945
+
946
+ cameraView.requestFocusInWindow();
947
+ }
948
+
949
+ private Object3D Duplicate(Object3D object)
950
+ {
951
+ boolean temp = CameraPane.SWITCH;
952
+ CameraPane.SWITCH = false;
953
+
954
+ object.ExtractBigData(versiontable);
955
+ // if (copy == client)
956
+
957
+ Object3D versions[] = object.versionlist;
958
+ object.versionlist = null;
959
+
960
+ //byte[] compress = Compress(copy);
961
+ Object3D compress = (Object3D)Grafreed.clone(object);
962
+
963
+ object.versionlist = versions;
964
+
965
+ object.RestoreBigData(versiontable);
966
+
967
+ CameraPane.SWITCH = temp;
968
+
969
+ return compress;
970
+ }
808971
809972 private JTextPane createTextPane()
810973 {
....@@ -927,6 +1090,7 @@
9271090 {
9281091 SetupMaterial(materialPanel);
9291092 }
1093
+
9301094 //SetupName();
9311095 //SetupViews();
9321096 }
....@@ -936,7 +1100,7 @@
9361100 // NumberSlider vDivsField;
9371101 // JCheckBox endcaps;
9381102 JCheckBox liveCB;
939
- JCheckBox selectCB;
1103
+ JCheckBox selectableCB;
9401104 JCheckBox hideCB;
9411105 JCheckBox link2masterCB;
9421106 JCheckBox markCB;
....@@ -1135,6 +1299,18 @@
11351299
11361300 namePanel = new cGridBag();
11371301
1302
+ //if (copy.pinned)
1303
+ {
1304
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1305
+ pinButton.setSelected(copy.pinned);
1306
+ cGridBag t = new cGridBag();
1307
+ t.preferredWidth = 2;
1308
+ t.add(pinButton);
1309
+ namePanel.add(t);
1310
+
1311
+ pinButton.addItemListener(this);
1312
+ }
1313
+
11381314 nameField = AddText(namePanel, copy.GetName());
11391315 namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11401316 oe.ctrlPanel.add(namePanel);
....@@ -1148,13 +1324,16 @@
11481324
11491325 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
11501326 liveCB.setToolTipText("Animate object");
1151
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1152
- selectCB.setToolTipText("Make object selectable");
1327
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1328
+ markCB.setToolTipText("Set target transform");
1329
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1330
+ selectableCB.setToolTipText("Make object selectable");
11531331 // Return();
1332
+
11541333 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11551334 hideCB.setToolTipText("Hide object");
1156
- markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1157
- markCB.setToolTipText("As animation target transform");
1335
+
1336
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
11581337
11591338 setupPanel2 = new cGridBag().setVertical(false);
11601339
....@@ -1164,10 +1343,11 @@
11641343 randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
11651344 randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
11661345
1346
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1347
+ link2masterCB.setToolTipText("Attach to support");
1348
+
11671349 if (Globals.ADVANCED)
11681350 {
1169
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1170
- link2masterCB.setToolTipText("Attach to support");
11711351 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
11721352 speedupCB.setToolTipText("Option motion capture");
11731353 }
....@@ -1353,6 +1533,7 @@
13531533
13541534 if (cam == null || !(copy.get(0) instanceof cGroup))
13551535 {
1536
+ if (Globals.DEBUG)
13561537 System.out.println("CREATE CAMERAS");
13571538 cams = new cTemplate();
13581539 cams.name = "Cameras";
....@@ -1441,6 +1622,7 @@
14411622 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
14421623 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
14431624 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1625
+ //XYZPanel.setName("XYZ");
14441626
14451627 /*
14461628 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1478,14 +1660,29 @@
14781660 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14791661 //tmp.setName("Edit");
14801662 objectPanel.add(materialPanel);
1663
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1664
+ objectPanel.setToolTipTextAt(0, "Material");
1665
+
1666
+ objectPanel.add(toolboxPanel);
1667
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1668
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1669
+
1670
+ objectPanel.add(skyboxPanel);
1671
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1672
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1673
+
14811674 // JPanel north = new JPanel(new BorderLayout());
14821675 // north.setName("Edit");
14831676 // north.add(ctrlPanel, BorderLayout.NORTH);
14841677 // objectPanel.add(north);
14851678 objectPanel.add(editPanel);
1486
- objectPanel.add(infoPanel);
1487
- objectPanel.add(toolboxPanel);
1488
-
1679
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1680
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1681
+
1682
+ objectPanel.add(XYZPanel);
1683
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1684
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1685
+
14891686 /*
14901687 aConstraints.gridx = 0;
14911688 aConstraints.gridwidth = 1;
....@@ -1505,7 +1702,7 @@
15051702 scrollpane.addMouseWheelListener(this); // Default not fast enough
15061703
15071704 /*JTabbedPane*/ scenePanel = new cGridBag();
1508
- scenePanel.preferredWidth = 6;
1705
+ scenePanel.preferredWidth = 5;
15091706
15101707 JTabbedPane tabbedPane = new JTabbedPane();
15111708 tabbedPane.add(scrollpane);
....@@ -1522,6 +1719,11 @@
15221719
15231720 scenePanel.add(tabbedPane);
15241721
1722
+ //if (Globals.ADVANCED)
1723
+// tabbedPane.add(infoPanel);
1724
+// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1725
+// tabbedPane.setToolTipTextAt(3, "Information");
1726
+
15251727 /*
15261728 cTree jTree = new cTree(null);
15271729 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1583,7 +1785,7 @@
15831785 bigThree = new cGridBag();
15841786 bigThree.addComponent(scenePanel);
15851787 bigThree.addComponent(centralPanel);
1586
- bigThree.addComponent(XYZPanel);
1788
+ //bigThree.addComponent(XYZPanel);
15871789
15881790 // // SIDE EFFECT!!!
15891791 // aConstraints.gridx = 0;
....@@ -1592,16 +1794,33 @@
15921794 // aConstraints.gridheight = 1;
15931795
15941796 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1595
- framePanel.setContinuousLayout(true);
1596
- framePanel.setOneTouchExpandable(true);
1597
- framePanel.setDividerLocation(0.8);
1797
+
1798
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1799
+ new java.beans.PropertyChangeListener()
1800
+ {
1801
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1802
+ {
1803
+ if ((Integer)pce.getOldValue() == 1)
1804
+ {
1805
+ if (radio.layout != expandedLayout)
1806
+ {
1807
+ radio.layout = expandedLayout;
1808
+ radio.layout.doClick();
1809
+ }
1810
+ }
1811
+ }
1812
+ });
1813
+
1814
+ framePanel.setContinuousLayout(false);
1815
+ framePanel.setOneTouchExpandable(false);
1816
+ //.setDividerLocation(0.8);
15981817 //framePanel.setDividerSize(15);
15991818 //framePanel.setResizeWeight(0.15);
16001819 framePanel.setName("Frame");
16011820
16021821 frame.getContentPane().setLayout(new BorderLayout());
16031822 /**/
1604
- JTabbedPane worldPane = new JTabbedPane();
1823
+ //JTabbedPane worldPane = new JTabbedPane();
16051824 //worldPane.add(bigPanel);
16061825 //worldPane.add(worldPanel);
16071826 /**/
....@@ -1613,17 +1832,17 @@
16131832
16141833 frame.setSize(1280, 860);
16151834
1616
- frame.validate();
1617
- frame.setVisible(true);
1618
-
16191835 cameraView.requestFocusInWindow();
16201836
16211837 gridPanel.setDividerLocation(1.0);
1838
+
1839
+ frame.validate();
1840
+
1841
+ frame.setVisible(true);
16221842
16231843 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16241844 frame.addWindowListener(new WindowAdapter()
16251845 {
1626
-
16271846 public void windowClosing(WindowEvent e)
16281847 {
16291848 Close();
....@@ -1646,12 +1865,418 @@
16461865 ctrlPanel.removeAll();
16471866 }
16481867
1649
- void SetupMaterial(cGridBag panel)
1868
+ void SetupMaterial(cGridBag materialpanel)
16501869 {
1651
- /*
1870
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1871
+
1872
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1873
+ skin.setToolTipText("Skin");
1874
+ skin.addMouseListener(new MouseAdapter()
1875
+ {
1876
+ public void mouseClicked(MouseEvent e)
1877
+ {
1878
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1879
+ cMaterial material = object.material;
1880
+
1881
+ // Skin
1882
+ colorField.setFloat(material.color);
1883
+ saturationField.setFloat(material.modulation);
1884
+ subsurfaceField.setFloat(material.subsurface);
1885
+ selfshadowField.setFloat(material.diffuseness);
1886
+ diffusenessField.setFloat(material.factor);
1887
+ shininessField.setFloat(material.shininess);
1888
+ shadowbiasField.setFloat(material.shadowbias);
1889
+ diffuseField.setFloat(material.diffuse);
1890
+ specularField.setFloat(material.specular);
1891
+
1892
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1893
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1894
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1895
+
1896
+ materialtouched = true;
1897
+ applySelf();
1898
+ }
1899
+ });
1900
+ presetpanel.add(skin);
1901
+
1902
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1903
+ lambert.setToolTipText("Diffuse");
1904
+ lambert.addMouseListener(new MouseAdapter()
1905
+ {
1906
+ public void mouseClicked(MouseEvent e)
1907
+ {
1908
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1909
+ cMaterial material = object.material;
1910
+
1911
+ diffusenessField.setFloat(material.factor);
1912
+ selfshadowField.setFloat(material.diffuseness);
1913
+
1914
+ materialtouched = true;
1915
+ applySelf();
1916
+ }
1917
+ });
1918
+ presetpanel.add(lambert);
1919
+
1920
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1921
+ diffuse2.setToolTipText("Diffuse2");
1922
+ diffuse2.addMouseListener(new MouseAdapter()
1923
+ {
1924
+ public void mouseClicked(MouseEvent e)
1925
+ {
1926
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1927
+ cMaterial material = object.material;
1928
+
1929
+ diffusenessField.setFloat(material.factor);
1930
+ selfshadowField.setFloat(material.diffuseness);
1931
+
1932
+ materialtouched = true;
1933
+ applySelf();
1934
+ }
1935
+ });
1936
+ presetpanel.add(diffuse2);
1937
+
1938
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1939
+ diffusemoon.setToolTipText("Moon");
1940
+ diffusemoon.addMouseListener(new MouseAdapter()
1941
+ {
1942
+ public void mouseClicked(MouseEvent e)
1943
+ {
1944
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1945
+ cMaterial material = object.material;
1946
+
1947
+ diffusenessField.setFloat(material.factor);
1948
+ selfshadowField.setFloat(material.diffuseness);
1949
+
1950
+ materialtouched = true;
1951
+ applySelf();
1952
+ }
1953
+ });
1954
+ presetpanel.add(diffusemoon);
1955
+
1956
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1957
+ diffusemoon2.setToolTipText("Moon2");
1958
+ diffusemoon2.addMouseListener(new MouseAdapter()
1959
+ {
1960
+ public void mouseClicked(MouseEvent e)
1961
+ {
1962
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1963
+ cMaterial material = object.material;
1964
+
1965
+ diffusenessField.setFloat(material.factor);
1966
+ selfshadowField.setFloat(material.diffuseness);
1967
+
1968
+ materialtouched = true;
1969
+ applySelf();
1970
+ }
1971
+ });
1972
+ presetpanel.add(diffusemoon2);
1973
+
1974
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1975
+ diffusemoon3.setToolTipText("Moon3");
1976
+ diffusemoon3.addMouseListener(new MouseAdapter()
1977
+ {
1978
+ public void mouseClicked(MouseEvent e)
1979
+ {
1980
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1981
+ cMaterial material = object.material;
1982
+
1983
+ diffusenessField.setFloat(material.factor);
1984
+ selfshadowField.setFloat(material.diffuseness);
1985
+
1986
+ materialtouched = true;
1987
+ applySelf();
1988
+ }
1989
+ });
1990
+ presetpanel.add(diffusemoon3);
1991
+
1992
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1993
+ diffusesheen.setToolTipText("Sheen");
1994
+ diffusesheen.addMouseListener(new MouseAdapter()
1995
+ {
1996
+ public void mouseClicked(MouseEvent e)
1997
+ {
1998
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1999
+ cMaterial material = object.material;
2000
+
2001
+ sheenField.setFloat(material.sheen);
2002
+
2003
+ materialtouched = true;
2004
+ applySelf();
2005
+ }
2006
+ });
2007
+ presetpanel.add(diffusesheen);
2008
+
2009
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2010
+ rough.setToolTipText("Rough metal");
2011
+ rough.addMouseListener(new MouseAdapter()
2012
+ {
2013
+ public void mouseClicked(MouseEvent e)
2014
+ {
2015
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
2016
+ cMaterial material = object.material;
2017
+
2018
+ shininessField.setFloat(material.shininess);
2019
+ velvetField.setFloat(material.velvet);
2020
+
2021
+ materialtouched = true;
2022
+ applySelf();
2023
+ }
2024
+ });
2025
+ presetpanel.add(rough);
2026
+
2027
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2028
+ rough2.setToolTipText("Medium metal");
2029
+ rough2.addMouseListener(new MouseAdapter()
2030
+ {
2031
+ public void mouseClicked(MouseEvent e)
2032
+ {
2033
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2034
+ cMaterial material = object.material;
2035
+
2036
+ shininessField.setFloat(material.shininess);
2037
+ lightareaField.setFloat(material.lightarea);
2038
+
2039
+ materialtouched = true;
2040
+ applySelf();
2041
+ }
2042
+ });
2043
+ presetpanel.add(rough2);
2044
+
2045
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2046
+ shini0.setToolTipText("Shiny");
2047
+ shini0.addMouseListener(new MouseAdapter()
2048
+ {
2049
+ public void mouseClicked(MouseEvent e)
2050
+ {
2051
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2052
+ cMaterial material = object.material;
2053
+
2054
+ shininessField.setFloat(material.shininess);
2055
+ lightareaField.setFloat(material.lightarea);
2056
+
2057
+ materialtouched = true;
2058
+ applySelf();
2059
+ }
2060
+ });
2061
+ presetpanel.add(shini0);
2062
+
2063
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2064
+ shini1.setToolTipText("Shiny2");
2065
+ shini1.addMouseListener(new MouseAdapter()
2066
+ {
2067
+ public void mouseClicked(MouseEvent e)
2068
+ {
2069
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2070
+ cMaterial material = object.material;
2071
+
2072
+ shininessField.setFloat(material.shininess);
2073
+ lightareaField.setFloat(material.lightarea);
2074
+
2075
+ materialtouched = true;
2076
+ applySelf();
2077
+ }
2078
+ });
2079
+ presetpanel.add(shini1);
2080
+
2081
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2082
+ shini2.setToolTipText("Shiny3");
2083
+ shini2.addMouseListener(new MouseAdapter()
2084
+ {
2085
+ public void mouseClicked(MouseEvent e)
2086
+ {
2087
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2088
+ cMaterial material = object.material;
2089
+
2090
+ shininessField.setFloat(material.shininess);
2091
+ lightareaField.setFloat(material.lightarea);
2092
+
2093
+ materialtouched = true;
2094
+ applySelf();
2095
+ }
2096
+ });
2097
+ presetpanel.add(shini2);
2098
+
2099
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2100
+ aniso.setToolTipText("AnisoU");
2101
+ aniso.addMouseListener(new MouseAdapter()
2102
+ {
2103
+ public void mouseClicked(MouseEvent e)
2104
+ {
2105
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2106
+ cMaterial material = object.material;
2107
+
2108
+ anisoField.setFloat(material.aniso);
2109
+ anisoVField.setFloat(material.anisoV);
2110
+
2111
+ materialtouched = true;
2112
+ applySelf();
2113
+ }
2114
+ });
2115
+ presetpanel.add(aniso);
2116
+
2117
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2118
+ aniso2.setToolTipText("AnisoV");
2119
+ aniso2.addMouseListener(new MouseAdapter()
2120
+ {
2121
+ public void mouseClicked(MouseEvent e)
2122
+ {
2123
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2124
+ cMaterial material = object.material;
2125
+
2126
+ anisoField.setFloat(material.aniso);
2127
+ anisoVField.setFloat(material.anisoV);
2128
+
2129
+ materialtouched = true;
2130
+ applySelf();
2131
+ }
2132
+ });
2133
+ presetpanel.add(aniso2);
2134
+
2135
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2136
+ aniso3.setToolTipText("AnisoUV");
2137
+ aniso3.addMouseListener(new MouseAdapter()
2138
+ {
2139
+ public void mouseClicked(MouseEvent e)
2140
+ {
2141
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2142
+ cMaterial material = object.material;
2143
+
2144
+ anisoField.setFloat(material.aniso);
2145
+ anisoVField.setFloat(material.anisoV);
2146
+
2147
+ materialtouched = true;
2148
+ applySelf();
2149
+ }
2150
+ });
2151
+ presetpanel.add(aniso3);
2152
+
2153
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2154
+ velvet0.setToolTipText("Velvet");
2155
+ velvet0.addMouseListener(new MouseAdapter()
2156
+ {
2157
+ public void mouseClicked(MouseEvent e)
2158
+ {
2159
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2160
+ cMaterial material = object.material;
2161
+
2162
+ diffusenessField.setFloat(material.factor);
2163
+ selfshadowField.setFloat(material.diffuseness);
2164
+ sheenField.setFloat(material.sheen);
2165
+ shininessField.setFloat(material.shininess);
2166
+ velvetField.setFloat(material.velvet);
2167
+ shiftField.setFloat(material.shift);
2168
+
2169
+ materialtouched = true;
2170
+ applySelf();
2171
+ }
2172
+ });
2173
+ presetpanel.add(velvet0);
2174
+
2175
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2176
+ bump0.setToolTipText("Bump texture");
2177
+ bump0.addMouseListener(new MouseAdapter()
2178
+ {
2179
+ public void mouseClicked(MouseEvent e)
2180
+ {
2181
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2182
+ cMaterial material = object.material;
2183
+
2184
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2185
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2186
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2187
+
2188
+ materialtouched = true;
2189
+ applySelf();
2190
+ }
2191
+ });
2192
+ presetpanel.add(bump0);
2193
+
2194
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2195
+ borderShader.setToolTipText("Border fade");
2196
+ borderShader.addMouseListener(new MouseAdapter()
2197
+ {
2198
+ public void mouseClicked(MouseEvent e)
2199
+ {
2200
+ borderfadeField.setFloat(0.5);
2201
+ opacityField.setFloat(0.75);
2202
+
2203
+ materialtouched = true;
2204
+ applySelf();
2205
+ }
2206
+ });
2207
+ presetpanel.add(borderShader);
2208
+
2209
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2210
+ halo.setToolTipText("Halo");
2211
+ halo.addMouseListener(new MouseAdapter()
2212
+ {
2213
+ public void mouseClicked(MouseEvent e)
2214
+ {
2215
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2216
+ cMaterial material = object.material;
2217
+
2218
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2219
+
2220
+ materialtouched = true;
2221
+ applySelf();
2222
+ }
2223
+ });
2224
+ presetpanel.add(halo);
2225
+
2226
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2227
+ candle.setToolTipText("Candle");
2228
+ candle.addMouseListener(new MouseAdapter()
2229
+ {
2230
+ public void mouseClicked(MouseEvent e)
2231
+ {
2232
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2233
+ cMaterial material = object.material;
2234
+
2235
+ subsurfaceField.setFloat(material.subsurface);
2236
+ shadowbiasField.setFloat(material.shadowbias);
2237
+ ambientField.setFloat(material.ambient);
2238
+ specularField.setFloat(material.specular);
2239
+ lightareaField.setFloat(material.lightarea);
2240
+ shininessField.setFloat(material.shininess);
2241
+
2242
+ materialtouched = true;
2243
+ applySelf();
2244
+ }
2245
+ });
2246
+ presetpanel.add(candle);
2247
+
2248
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2249
+ shadowShader.setToolTipText("Shadow");
2250
+ shadowShader.addMouseListener(new MouseAdapter()
2251
+ {
2252
+ public void mouseClicked(MouseEvent e)
2253
+ {
2254
+ diffuseField.setFloat(0.001);
2255
+ ambientField.setFloat(0.001);
2256
+ cameraField.setFloat(0.001);
2257
+ specularField.setFloat(0.001);
2258
+ fakedepthField.setFloat(0.001);
2259
+ opacityField.setFloat(0.6);
2260
+
2261
+ materialtouched = true;
2262
+ applySelf();
2263
+ }
2264
+ });
2265
+ presetpanel.add(shadowShader);
2266
+
2267
+ cGridBag panel = new cGridBag().setVertical(true);
2268
+
2269
+ presetpanel.preferredWidth = 1;
2270
+
2271
+ materialpanel.add(presetpanel);
2272
+ materialpanel.add(panel);
2273
+
2274
+ panel.preferredWidth = 8;
2275
+
2276
+ /*
16522277 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
16532278 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1654
- */
2279
+ */
16552280
16562281 cGridBag editBar = new cGridBag().setVertical(false);
16572282
....@@ -1685,27 +2310,61 @@
16852310 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16862311
16872312 cGridBag colorSection = new cGridBag().setVertical(true);
2313
+
2314
+ cGridBag huepanel = new cGridBag();
2315
+ cGridBag huelabel = new cGridBag();
2316
+ cLabel hue = GetLabel("icons/hue.png", false);
2317
+ hue.fit = true;
2318
+
2319
+ hue.addMouseListener(new MouseAdapter()
2320
+ {
2321
+ public void mousePressed(MouseEvent e)
2322
+ {
2323
+ int x = e.getX();
2324
+
2325
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2326
+ }
2327
+ });
2328
+
2329
+ huelabel.add(hue);
2330
+ huelabel.preferredWidth = 20;
2331
+ huepanel.add(new cGridBag()); // Label
2332
+ huepanel.add(huelabel); // Field/slider
2333
+
2334
+ huepanel.preferredHeight = 7;
2335
+
2336
+ colorSection.add(huepanel);
16882337
16892338 cGridBag color = new cGridBag();
1690
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1691
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2339
+
2340
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2341
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2342
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2343
+
16932344 //colorField.preferredWidth = 200;
16942345 colorSection.add(color);
16952346
16962347 cGridBag modulation = new cGridBag();
16972348 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
16982349 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1699
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2350
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
17002351 colorSection.add(modulation);
17012352
2353
+ cGridBag opacity = new cGridBag();
2354
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2355
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2356
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2357
+ colorSection.add(opacity);
2358
+
2359
+ colorSection.add(GetSeparator());
2360
+
17022361 cGridBag texture = new cGridBag();
17032362 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
17042363 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17052364 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
17062365 colorSection.add(texture);
17072366
1708
- panel.add(new JSeparator());
2367
+ panel.add(GetSeparator());
17092368
17102369 panel.add(colorSection);
17112370
....@@ -1761,7 +2420,7 @@
17612420 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
17622421 diffuseSection.add(shadowbias);
17632422
1764
- panel.add(new JSeparator());
2423
+ panel.add(GetSeparator());
17652424
17662425 panel.add(diffuseSection);
17672426
....@@ -1824,7 +2483,7 @@
18242483 specularSection.add(anisoV);
18252484
18262485
1827
- panel.add(new JSeparator());
2486
+ panel.add(GetSeparator());
18282487
18292488 panel.add(specularSection);
18302489
....@@ -1849,12 +2508,6 @@
18492508 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18502509 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
18512510 colorSection.add(backlit);
1852
-
1853
- cGridBag opacity = new cGridBag();
1854
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1855
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1856
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1857
- colorSection.add(opacity);
18582511
18592512 //panel.add(new JSeparator());
18602513
....@@ -1900,7 +2553,7 @@
19002553 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
19012554 textureSection.add(opacityPower);
19022555
1903
- panel.add(new JSeparator());
2556
+ panel.add(GetSeparator());
19042557
19052558 panel.add(textureSection);
19062559
....@@ -1965,8 +2618,9 @@
19652618 // 3D models
19662619 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
19672620 {
1968
- lastConverter = new com.jmex.model.converters.MaxToJme();
1969
- LoadFile(filename, lastConverter);
2621
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2622
+ //LoadFile(filename, lastConverter);
2623
+ LoadObjFile(filename); // New 3ds loader
19702624 continue;
19712625 }
19722626 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2692,6 +3346,7 @@
26923346 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
26933347 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
26943348 }
3349
+
26953350 //cJME.count++;
26963351 //cJME.count %= 12;
26973352 if (gc)
....@@ -2875,6 +3530,7 @@
28753530 }
28763531 }
28773532 }
3533
+
28783534 cFileSystemPane FSPane;
28793535
28803536 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2884,7 +3540,7 @@
28843540
28853541 freezematerial = true;
28863542 colorField.setFloat(mat.color);
2887
- modulationField.setFloat(mat.modulation);
3543
+ saturationField.setFloat(mat.modulation);
28883544 metalnessField.setFloat(mat.metalness);
28893545 diffuseField.setFloat(mat.diffuse);
28903546 specularField.setFloat(mat.specular);
....@@ -2928,6 +3584,7 @@
29283584 }
29293585 }
29303586 }
3587
+
29313588 freezematerial = false;
29323589 }
29333590
....@@ -2945,32 +3602,8 @@
29453602
29463603 if (multiplyToggle != null)
29473604 multiplyToggle.setSelected(mat.multiply);
2948
-
2949
- assert (object.projectedVertices != null);
2950
-
2951
- if (object.projectedVertices.length <= 2)
2952
- {
2953
- // Side effect...
2954
- Object3D.cVector2[] keep = object.projectedVertices;
2955
- object.projectedVertices = new Object3D.cVector2[3];
2956
- for (int i = 0; i < 3; i++)
2957
- {
2958
- if (i < keep.length)
2959
- {
2960
- object.projectedVertices[i] = keep[i];
2961
- } else
2962
- {
2963
- object.projectedVertices[i] = new Object3D.cVector2();
2964
- }
2965
- /*
2966
- if(keep.length == 0)
2967
- object.projectedVertices[0] = new Object3D.cVector2();
2968
- else
2969
- object.projectedVertices[0] = keep[0];
2970
- object.projectedVertices[1] = new Object3D.cVector2();
2971
- */
2972
- }
2973
- }
3605
+
3606
+ AllocProjectedVertices(object);
29743607
29753608 SetMaterial(mat, object.projectedVertices);
29763609 }
....@@ -3090,6 +3723,17 @@
30903723 public void itemStateChanged(ItemEvent event)
30913724 {
30923725 // System.out.println("Propagate = " + propagate);
3726
+ if (event.getSource() == pinButton)
3727
+ {
3728
+ copy.pinned ^= true;
3729
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3730
+ {
3731
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3732
+ copy.CloseUI();
3733
+ //copy.editWindow.refreshContents();
3734
+ }
3735
+ }
3736
+ else
30933737 if (event.getSource() == propagateToggle)
30943738 {
30953739 propagate ^= true;
....@@ -3194,8 +3838,9 @@
31943838 } else if (event.getSource() == liveCB)
31953839 {
31963840 copy.live ^= true;
3841
+ objEditor.refreshContents(true); // To show item colors
31973842 return;
3198
- } else if (event.getSource() == selectCB)
3843
+ } else if (event.getSource() == selectableCB)
31993844 {
32003845 copy.dontselect ^= true;
32013846 return;
....@@ -3203,7 +3848,7 @@
32033848 {
32043849 copy.hide ^= true;
32053850 copy.Touch(); // display list issue
3206
- objEditor.refreshContents();
3851
+ objEditor.refreshContents(true); // To show item colors
32073852 return;
32083853 } else if (event.getSource() == link2masterCB)
32093854 {
....@@ -3380,9 +4025,9 @@
33804025 {
33814026 Close();
33824027 //return true;
3383
- } else if (source == loadItem)
4028
+ } else if (source == openItem)
33844029 {
3385
- load();
4030
+ Open();
33864031 //return true;
33874032 } else if (source == newItem)
33884033 {
....@@ -3407,6 +4052,10 @@
34074052 {
34084053 generatePOV();
34094054 //return true;
4055
+ } else if (event.getSource() == archiveItem)
4056
+ {
4057
+ cTools.Archive(frame);
4058
+ return;
34104059 } else if (source == zBufferItem)
34114060 {
34124061 try
....@@ -3455,11 +4104,12 @@
34554104
34564105 static public byte[] Compress(Object3D o)
34574106 {
4107
+ // Slower to actually compress.
34584108 try
34594109 {
34604110 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3461
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3462
- ObjectOutputStream out = new ObjectOutputStream(zstream);
4111
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4112
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
34634113
34644114 Object3D parent = o.parent;
34654115 o.parent = null;
....@@ -3470,10 +4120,14 @@
34704120
34714121 out.flush();
34724122
3473
- zstream.close();
4123
+ baos //zstream
4124
+ .close();
34744125 out.close();
34754126
3476
- return baos.toByteArray();
4127
+ byte[] bytes = baos.toByteArray();
4128
+
4129
+ System.out.println("save #bytes = " + bytes.length);
4130
+ return bytes;
34774131 } catch (Exception e)
34784132 {
34794133 System.err.println(e);
....@@ -3483,13 +4137,16 @@
34834137
34844138 static public Object Uncompress(byte[] bytes)
34854139 {
3486
- System.out.println("#bytes = " + bytes.length);
4140
+ System.out.println("restore #bytes = " + bytes.length);
34874141 try
34884142 {
34894143 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3490
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3491
- ObjectInputStream in = new ObjectInputStream(istream);
4144
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4145
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
34924146 Object obj = in.readObject();
4147
+
4148
+ bais //istream
4149
+ .close();
34934150 in.close();
34944151
34954152 return obj;
....@@ -3544,43 +4201,95 @@
35444201 return null;
35454202 }
35464203
3547
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
35484204
35494205 public void Save()
35504206 {
4207
+ //Save(true);
4208
+ Replace();
4209
+ SetVersionStates();
4210
+ }
4211
+
4212
+ private boolean Equal(byte[] compress, byte[] name)
4213
+ {
4214
+ if (compress.length != name.length)
4215
+ {
4216
+ return false;
4217
+ }
4218
+
4219
+ for (int i=compress.length; --i>=0;)
4220
+ {
4221
+ if (compress[i] != name[i])
4222
+ return false;
4223
+ }
4224
+
4225
+ return true;
4226
+ }
4227
+
4228
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4229
+
4230
+ void DeleteVersion()
4231
+ {
4232
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4233
+ {
4234
+ copy.versionlist[i] = copy.versionlist[i+1];
4235
+ }
4236
+
4237
+ CopyChanged();
4238
+
4239
+ SetVersionStates();
4240
+ }
4241
+
4242
+ public boolean Save(boolean user)
4243
+ {
35514244 System.err.println("Save");
4245
+ Replace();
35524246
3553
- cRadio tab = GetCurrentTab();
4247
+ //cRadio tab = GetCurrentTab();
35544248
3555
- boolean temp = CameraPane.SWITCH;
3556
- CameraPane.SWITCH = false;
4249
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
35574250
3558
- copy.ExtractBigData(hashtable);
4251
+ boolean thesame = false;
35594252
3560
- byte[] compress = Compress(copy);
4253
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4254
+// {
4255
+// thesame = true;
4256
+// }
35614257
35624258 //EditorFrame.m_MainFrame.requestFocusInWindow();
3563
- tab.graphs[tab.undoindex++] = compress;
3564
-
3565
- copy.RestoreBigData(hashtable);
3566
-
3567
- CameraPane.SWITCH = temp;
3568
-
3569
- //assert(hashtable.isEmpty());
3570
-
3571
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
4259
+ if (!thesame)
35724260 {
3573
- tab.graphs[i] = null;
4261
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4262
+ {
4263
+ copy.versionlist[i] = copy.versionlist[i-1];
4264
+ }
4265
+
4266
+ //tab.user[tab.versionindex] = user;
4267
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4268
+
4269
+ copy.versionlist[++copy.versionindex] = compress;
4270
+
4271
+ // if (increment)
4272
+ // tab.versionindex++;
35744273 }
35754274
3576
- SetUndoStates();
4275
+ //copy.RestoreBigData(versiontable);
4276
+
4277
+ //assert(hashtable.isEmpty());
4278
+
4279
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4280
+// {
4281
+// //tab.user[i] = false;
4282
+// copy.versionlist[i] = null;
4283
+// }
4284
+
4285
+ SetVersionStates();
35774286
35784287 // test save
35794288 if (false)
35804289 {
35814290 try
35824291 {
3583
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
4292
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
35844293 ObjectOutputStream p = new ObjectOutputStream(ostream);
35854294
35864295 p.writeObject(copy);
....@@ -3593,28 +4302,68 @@
35934302 e.printStackTrace();
35944303 }
35954304 }
4305
+
4306
+ return !thesame;
4307
+ }
4308
+
4309
+ boolean flashIt = true;
4310
+
4311
+ void RefreshSelection()
4312
+ {
4313
+ Object3D selection = new Object3D();
4314
+
4315
+ for (int i = 0; i < copy.selection.size(); i++)
4316
+ {
4317
+ Object3D elem = copy.selection.elementAt(i);
4318
+
4319
+ Object3D obj = copy.GetObject(elem.GetUUID());
4320
+
4321
+ if (obj == null)
4322
+ {
4323
+ copy.selection.remove(i--);
4324
+ }
4325
+ else
4326
+ {
4327
+ selection.add(obj);
4328
+ copy.selection.setElementAt(obj, i);
4329
+ }
4330
+ }
4331
+
4332
+ flashIt = false;
4333
+ GetTree().clearSelection();
4334
+ for (int i = 0; i < selection.size(); i++)
4335
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4336
+ flashIt = true;
4337
+
4338
+ //refreshContents(false);
35964339 }
35974340
3598
- void CopyChanged(Object3D obj)
4341
+ void CopyChanged()
35994342 {
3600
- SetUndoStates();
4343
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4344
+
4345
+ SetVersionStates();
36014346
36024347 boolean temp = CameraPane.SWITCH;
36034348 CameraPane.SWITCH = false;
36044349
3605
- copy.ExtractBigData(hashtable);
4350
+ copy.ExtractBigData(versiontable);
36064351
36074352 copy.clear();
36084353
4354
+ copy.skyboxname = obj.skyboxname;
4355
+ copy.skyboxext = obj.skyboxext;
4356
+
36094357 for (int i=0; i<obj.Size(); i++)
36104358 {
36114359 copy.add(obj.get(i));
36124360 }
36134361
3614
- copy.RestoreBigData(hashtable);
4362
+ copy.RestoreBigData(versiontable);
36154363
36164364 CameraPane.SWITCH = temp;
36174365
4366
+ RefreshSelection();
36184367 //assert(hashtable.isEmpty());
36194368
36204369 copy.Touch();
....@@ -3635,56 +4384,144 @@
36354384 }
36364385 }
36374386
3638
- refreshContents();
4387
+ refreshContents(true);
36394388 }
36404389
3641
- cButton undoButton;
3642
- cButton redoButton;
4390
+ cButton previousVersionButton;
4391
+ cButton restoreButton;
4392
+ cButton replaceButton;
4393
+ cButton nextVersionButton;
4394
+ cButton saveVersionButton;
4395
+ cButton deleteVersionButton;
36434396
3644
- void SetUndoStates()
4397
+ boolean muteSlider;
4398
+
4399
+ int VersionCount()
36454400 {
3646
- cRadio tab = GetCurrentTab();
4401
+ int count = 0;
36474402
3648
- undoButton.setEnabled(tab.undoindex > 0);
3649
- redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
4403
+ for (int i = copy.versionlist.length; --i >= 0;)
4404
+ {
4405
+ if (copy.versionlist[i] != null)
4406
+ count++;
4407
+ }
4408
+
4409
+ return count;
36504410 }
36514411
3652
- public void Undo()
4412
+ void SetVersionStates()
36534413 {
4414
+ //if (true)
4415
+ // return;
4416
+
4417
+ //cRadio tab = GetCurrentTab();
4418
+
4419
+ restoreButton.setEnabled(copy.versionindex != -1);
4420
+ replaceButton.setEnabled(copy.versionindex != -1);
4421
+
4422
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4423
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4424
+
4425
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4426
+ copy.versionlist[copy.versionindex + 1] != null);
4427
+
4428
+ muteSlider = true;
4429
+ versionSlider.setMinimum(0);
4430
+ versionSlider.setMaximum(VersionCount() - 1);
4431
+ versionSlider.setInteger(copy.versionindex);
4432
+ versionSlider.setEnabled(copy.versionindex != -1);
4433
+ muteSlider = false;
4434
+ }
4435
+
4436
+ public boolean PreviousVersion()
4437
+ {
4438
+ // Option?
4439
+ Replace();
4440
+
36544441 System.err.println("Undo");
36554442
3656
- cRadio tab = GetCurrentTab();
4443
+ //cRadio tab = GetCurrentTab();
36574444
3658
- if (tab.undoindex == 0)
4445
+ if (copy.versionindex == 0)
36594446 {
36604447 java.awt.Toolkit.getDefaultToolkit().beep();
3661
- return;
4448
+ return false;
36624449 }
36634450
3664
- if (tab.graphs[tab.undoindex] == null)
3665
- {
3666
- Save();
3667
- tab.undoindex -= 1;
3668
- }
4451
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4452
+// {
4453
+// if (Save(false))
4454
+// tab.versionindex -= 1;
4455
+// else
4456
+// {
4457
+// if (tab.versionindex <= 0)
4458
+// return false;
4459
+// else
4460
+// tab.versionindex -= 1;
4461
+// }
4462
+// }
36694463
3670
- tab.undoindex -= 1;
4464
+ copy.versionindex -= 1;
36714465
3672
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4466
+ CopyChanged();
4467
+
4468
+ return true;
36734469 }
36744470
3675
- public void Redo()
4471
+ public boolean Restore()
36764472 {
3677
- cRadio tab = GetCurrentTab();
4473
+ System.err.println("Restore");
36784474
3679
- if (tab.graphs[tab.undoindex + 1] == null)
4475
+ //cRadio tab = GetCurrentTab();
4476
+
4477
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4478
+ {
4479
+ java.awt.Toolkit.getDefaultToolkit().beep();
4480
+ return false;
4481
+ }
4482
+
4483
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4484
+ CopyChanged();
4485
+
4486
+ return true;
4487
+ }
4488
+
4489
+ public boolean Replace()
4490
+ {
4491
+ System.err.println("Replace");
4492
+
4493
+ //cRadio tab = GetCurrentTab();
4494
+
4495
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4496
+ {
4497
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4498
+ return false;
4499
+ }
4500
+
4501
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4502
+
4503
+ return true;
4504
+ }
4505
+
4506
+ public void NextVersion()
4507
+ {
4508
+ // Option?
4509
+ Replace();
4510
+
4511
+ //cRadio tab = GetCurrentTab();
4512
+
4513
+ if (copy.versionlist[copy.versionindex + 1] == null)
36804514 {
36814515 java.awt.Toolkit.getDefaultToolkit().beep();
36824516 return;
36834517 }
36844518
3685
- tab.undoindex += 1;
4519
+ copy.versionindex += 1;
36864520
3687
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4521
+ CopyChanged();
4522
+
4523
+ //if (!tab.user[tab.versionindex])
4524
+ // tab.graphs[tab.versionindex] = null;
36884525 }
36894526
36904527 void ImportGFD()
....@@ -3895,7 +4732,7 @@
38954732 //copy.material = new cMaterial(copy.GetMaterial());
38964733
38974734 current.color = (float) colorField.getFloat();
3898
- current.modulation = (float) modulationField.getFloat();
4735
+ current.modulation = (float) saturationField.getFloat();
38994736 current.metalness = (float) metalnessField.getFloat();
39004737 current.diffuse = (float) diffuseField.getFloat();
39014738 current.specular = (float) specularField.getFloat();
....@@ -3928,7 +4765,7 @@
39284765 cMaterial mat = copy.material;
39294766
39304767 colorField.SetToolTipValue((mat.color));
3931
- modulationField.SetToolTipValue((mat.modulation));
4768
+ saturationField.SetToolTipValue((mat.modulation));
39324769 metalnessField.SetToolTipValue((mat.metalness));
39334770 diffuseField.SetToolTipValue((mat.diffuse));
39344771 specularField.SetToolTipValue((mat.specular));
....@@ -3980,9 +4817,28 @@
39804817 //copy.Touch();
39814818 }
39824819
4820
+ cNumberSlider versionSlider;
4821
+
39834822 public void stateChanged(ChangeEvent e)
39844823 {
39854824 // assert(false);
4825
+ if (e.getSource() == versionSlider)
4826
+ {
4827
+ if (muteSlider)
4828
+ return;
4829
+
4830
+ Replace();
4831
+
4832
+ int version = versionSlider.getInteger();
4833
+
4834
+ if (version != -1 && copy.versionlist[version] != null)
4835
+ {
4836
+ copy.versionindex = version;
4837
+ CopyChanged();
4838
+ }
4839
+
4840
+ return;
4841
+ }
39864842
39874843 if (freezematerial)
39884844 {
....@@ -4018,6 +4874,12 @@
40184874 {
40194875 //System.out.println("stateChanged = " + this);
40204876 materialtouched = true;
4877
+
4878
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4879
+ {
4880
+ saturationField.setFloat(1);
4881
+ }
4882
+
40214883 applySelf();
40224884 //System.out.println("this = " + this);
40234885 //System.out.println("PARENT = " + parent);
....@@ -4317,6 +5179,7 @@
43175179 {
43185180 if (GetTree() != null)
43195181 {
5182
+ GetTree().revalidate();
43205183 GetTree().repaint();
43215184 }
43225185
....@@ -4325,13 +5188,18 @@
43255188 ctrlPanel.validate(); // ? new
43265189 ctrlPanel.repaint();
43275190 }
5191
+
5192
+ if (previousVersionButton != null && copy.versionlist != null)
5193
+ SetVersionStates();
5194
+
5195
+ cameraView.requestFocusInWindow();
43285196 }
43295197
43305198 static TweenManager tweenManager = new TweenManager();
43315199
43325200 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
43335201 {
4334
- if (Globals.SAVEONMAKE) // && resetmodel)
5202
+ if (Globals.REPLACEONMAKE) // && resetmodel)
43355203 Save();
43365204 //Tween.set(thing, 0).target(1).start(tweenManager);
43375205 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4356,7 +5224,7 @@
43565224 // group = (Composite) group.get(0);
43575225 // }
43585226
4359
- System.out.println("makeSomething of " + thing);
5227
+ //System.out.println("makeSomething of " + thing);
43605228
43615229 /*
43625230 if (deselect && jList != null)
....@@ -4573,7 +5441,9 @@
45735441 readobj.ResetDisplayList();
45745442 } catch (Exception e)
45755443 {
4576
- //e.printStackTrace();
5444
+ if (!e.toString().contains("GZIP"))
5445
+ e.printStackTrace();
5446
+
45775447 try
45785448 {
45795449 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4647,12 +5517,14 @@
46475517
46485518 if (readobj != null)
46495519 {
4650
- if (Globals.SAVEONMAKE)
4651
- Save();
5520
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5521
+ // Save();
46525522 try
46535523 {
46545524 //readobj.deepCopySelf(copy);
46555525 copy.clear(); // june 2014
5526
+ copy.skyboxname = readobj.skyboxname;
5527
+ copy.skyboxext = readobj.skyboxext;
46565528 for (int i = 0; i < readobj.size(); i++)
46575529 {
46585530 Object3D child = readobj.get(i); // reserve(i);
....@@ -4693,6 +5565,7 @@
46935565 }
46945566 } catch (ClassCastException e)
46955567 {
5568
+ e.printStackTrace();
46965569 assert (false);
46975570 Composite c = (Composite) copy;
46985571 c.children.clear();
....@@ -4703,17 +5576,31 @@
47035576 c.addChild(csg);
47045577 }
47055578
5579
+ copy.versionlist = readobj.versionlist;
5580
+ copy.versionindex = readobj.versionindex;
5581
+
5582
+ if (copy.versionlist == null)
5583
+ {
5584
+ // Backward compatibility
5585
+ copy.versionlist = new Object3D[100];
5586
+ copy.versionindex = -1;
5587
+
5588
+ //Save(true);
5589
+ }
5590
+
5591
+ //? SetUndoStates();
5592
+
47065593 ResetModel();
47075594 copy.HardTouch(); // recompile?
47085595 refreshContents();
47095596 }
47105597 }
47115598
4712
- void load() // throws ClassNotFoundException
5599
+ void Open() // throws ClassNotFoundException
47135600 {
47145601 if (Grafreed.standAlone)
47155602 {
4716
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5603
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
47175604 browser.show();
47185605 String filename = browser.getFile();
47195606 if (filename != null && filename.length() > 0)
....@@ -4790,6 +5677,8 @@
47905677
47915678 void save()
47925679 {
5680
+ Replace();
5681
+
47935682 if (lastname == null)
47945683 {
47955684 return;
....@@ -4812,6 +5701,7 @@
48125701 //ps.print(buffer.toString());
48135702 } catch (IOException e)
48145703 {
5704
+ e.printStackTrace();
48155705 }
48165706 }
48175707
....@@ -4994,7 +5884,7 @@
49945884 MenuBar menuBar;
49955885 Menu fileMenu;
49965886 MenuItem newItem;
4997
- MenuItem loadItem;
5887
+ MenuItem openItem;
49985888 MenuItem saveItem;
49995889 MenuItem saveAsItem;
50005890 MenuItem exportAsItem;
....@@ -5017,6 +5907,7 @@
50175907 CheckboxMenuItem toggleSwitchItem;
50185908 CheckboxMenuItem toggleRootItem;
50195909 CheckboxMenuItem animationItem;
5910
+ MenuItem archiveItem;
50205911 CheckboxMenuItem toggleHandleItem;
50215912 CheckboxMenuItem togglePaintItem;
50225913 JSplitPane mainPanel;
....@@ -5030,6 +5921,7 @@
50305921 ButtonGroup buttonGroup;
50315922
50325923 cGridBag toolboxPanel;
5924
+ cGridBag skyboxPanel;
50335925 cGridBag materialPanel;
50345926 cGridBag ctrlPanel;
50355927
....@@ -5103,7 +5995,7 @@
51035995 JLabel colorLabel;
51045996 cNumberSlider colorField;
51055997 JLabel modulationLabel;
5106
- cNumberSlider modulationField;
5998
+ cNumberSlider saturationField;
51075999 JLabel metalnessLabel;
51086000 cNumberSlider metalnessField;
51096001 JLabel diffuseLabel;
....@@ -5134,6 +6026,7 @@
51346026 cNumberSlider anisoField;
51356027 JLabel anisoVLabel;
51366028 cNumberSlider anisoVField;
6029
+
51376030 JLabel cameraLabel;
51386031 cNumberSlider cameraField;
51396032 JLabel selfshadowLabel;
....@@ -5148,6 +6041,7 @@
51486041 cNumberSlider fakedepthField;
51496042 JLabel shadowbiasLabel;
51506043 cNumberSlider shadowbiasField;
6044
+
51516045 JLabel bumpLabel;
51526046 cNumberSlider bumpField;
51536047 JLabel noiseLabel;