Normand Briere
2019-07-30 475f8cbdbd96fdbf8f5b216ffebb31a51f25c2f9
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
....@@ -37,6 +41,51 @@
3741 JFrame frame;
3842
3943 static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ ImageIcon icon = GetIcon(name);
48
+ return new cButton(icon, border);
49
+ }
50
+
51
+ cToggleButton GetToggleButton(String name, boolean border)
52
+ {
53
+ ImageIcon icon = GetIcon(name);
54
+ return new cToggleButton(icon, border);
55
+ }
56
+
57
+ cCheckBox GetCheckBox(String name, boolean border)
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+
63
+ ImageIcon GetIcon(String name)
64
+ {
65
+ try
66
+ {
67
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
68
+
69
+// if (image.getWidth() > 48 && image.getHeight() > 48)
70
+// {
71
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
72
+// Graphics2D g = resized.createGraphics();
73
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
74
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
76
+// g.dispose();
77
+//
78
+// image = resized;
79
+// }
80
+
81
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
82
+ return icon;
83
+ }
84
+ catch (Exception e)
85
+ {
86
+ return null;
87
+ }
88
+ }
4089
4190 // SCRIPT
4291
....@@ -147,7 +196,7 @@
147196
148197 objEditor.ctrlPanel.remove(namePanel);
149198
150
- if (!GroupEditor.allparams)
199
+ if (!allparams)
151200 return;
152201
153202 // objEditor.ctrlPanel.remove(liveCB);
....@@ -171,7 +220,7 @@
171220
172221 objEditor.ctrlPanel.remove(setupPanel);
173222 objEditor.ctrlPanel.remove(setupPanel2);
174
- objEditor.ctrlPanel.remove(commandsPanel);
223
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
175224 objEditor.ctrlPanel.remove(pushPanel);
176225 //objEditor.ctrlPanel.remove(fillPanel);
177226
....@@ -219,6 +268,12 @@
219268 client = inClient;
220269 copy = client;
221270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
222277 // "this" is not called: SetupUI2(objEditor);
223278 }
224279
....@@ -232,6 +287,12 @@
232287 client = inClient;
233288 copy = client;
234289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
235296 SetupUI2(callee.GetEditor());
236297 }
237298
....@@ -246,7 +307,7 @@
246307 //localCopy.parent = null;
247308
248309 frame = new JFrame();
249
- frame.setUndecorated(true);
310
+ frame.setUndecorated(false);
250311 objEditor = this;
251312 this.callee = callee;
252313
....@@ -264,6 +325,12 @@
264325 copy = localCopy;
265326 copy.editWindow = this;
266327
328
+ if (copy.versions == null)
329
+ {
330
+// copy.versions = new byte[100][];
331
+// copy.versionindex = -1;
332
+ }
333
+
267334 SetupMenu();
268335
269336 //SetupName(objEditor); // new
....@@ -277,12 +344,17 @@
277344 return frame.action(event, obj);
278345 }
279346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
280352 void SetupMenu()
281353 {
282354 frame.setMenuBar(menuBar = new MenuBar());
283355 menuBar.add(fileMenu = new Menu("File"));
284356 fileMenu.add(newItem = new MenuItem("New"));
285
- fileMenu.add(loadItem = new MenuItem("Open..."));
357
+ fileMenu.add(openItem = new MenuItem("Open..."));
286358
287359 //oe.menuBar.add(menu = new Menu("Include"));
288360 Menu menu = new Menu("Import");
....@@ -314,7 +386,7 @@
314386 }
315387
316388 newItem.addActionListener(this);
317
- loadItem.addActionListener(this);
389
+ openItem.addActionListener(this);
318390 saveItem.addActionListener(this);
319391 saveAsItem.addActionListener(this);
320392 exportAsItem.addActionListener(this);
....@@ -323,28 +395,68 @@
323395 closeItem.addActionListener(this);
324396
325397 objectPanel = new JTabbedPane();
398
+
399
+ ChangeListener changeListener = new ChangeListener()
400
+ {
401
+ public void stateChanged(ChangeEvent changeEvent)
402
+ {
403
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
404
+// {
405
+// if (latestObject != null)
406
+// {
407
+// refreshContents(true);
408
+// SetMaterial(latestObject);
409
+// }
410
+//
411
+// materialFlushed = true;
412
+// }
413
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
414
+// {
415
+// if (listUI.size() == 0)
416
+// EditSelection(false);
417
+// }
418
+
419
+ refreshContents(false); // To refresh Info tab
420
+ }
421
+ };
422
+ objectPanel.addChangeListener(changeListener);
423
+
326424 toolbarPanel = new JPanel();
327425 toolbarPanel.setName("Toolbar");
426
+
328427 treePanel = new cGridBag();
329428 treePanel.setName("Tree");
429
+
430
+ editPanel = new cGridBag().setVertical(true);
431
+ //editPanel.setName("Edit");
432
+
330433 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
331
- ctrlPanel.setName("Edit");
434
+
435
+ editCommandsPanel = new cGridBag();
436
+ editPanel.add(editCommandsPanel);
437
+ editPanel.add(ctrlPanel);
438
+
439
+ toolboxPanel = new cGridBag().setVertical(true);
440
+ //toolboxPanel.setName("Toolbox");
441
+
332442 materialPanel = new cGridBag().setVertical(true);
333
- materialPanel.setName("Material");
443
+ //materialPanel.setName("Material");
444
+
334445 /*JTextPane*/
335446 infoarea = createTextPane();
336447 doc = infoarea.getStyledDocument();
337448
338449 infoarea.setEditable(true);
339450 SetText();
451
+
340452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
341453 // infoarea.setOpaque(false);
342454 // //infoarea.setForeground(textcolor);
343455 // TEXTAREA infoarea.setLineWrap(true);
344456 // TEXTAREA infoarea.setWrapStyleWord(true);
345457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
346
- infoPanel.setPreferredSize(new Dimension(50, 200));
347
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
348460 //infoPanel.setLayout(new BorderLayout());
349461 //infoPanel.add(createTextPane());
350462
....@@ -355,7 +467,14 @@
355467 mainPanel.setDividerSize(9);
356468 mainPanel.setDividerLocation(0.5); //1.0);
357469 mainPanel.setResizeWeight(0.5);
358
-
470
+
471
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
472
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
473
+ divider.setDividerSize(15);
474
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
475
+
476
+ mainPanel.setUI(new BasicSplitPaneUI());
477
+
359478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
360479 //mainPanel.setLayout(new GridBagLayout());
361480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -586,8 +705,8 @@
586705 }
587706 }
588707
589
-static GraphicsDevice device = GraphicsEnvironment
590
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
708
+//static GraphicsDevice device = GraphicsEnvironment
709
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
591710
592711 Rectangle keeprect;
593712 cRadio radio;
....@@ -603,13 +722,24 @@
603722
604723 boolean maximized;
605724
725
+ cButton fullscreenLayout;
726
+
606727 void Minimize()
607728 {
608729 frame.setState(Frame.ICONIFIED);
730
+ frame.validate();
609731 }
610732
733
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
734
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
735
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
611736 void Maximize()
612737 {
738
+ if (CameraPane.FULLSCREEN)
739
+ {
740
+ ToggleFullScreen();
741
+ }
742
+
613743 if (maximized)
614744 {
615745 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -617,20 +747,36 @@
617747 else
618748 {
619749 keeprect = frame.getBounds();
620
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
621
- Dimension rect2 = frame.getToolkit().getScreenSize();
622
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
750
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
751
+// Dimension rect2 = frame.getToolkit().getScreenSize();
752
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
623753 // frame.setState(Frame.MAXIMIZED_BOTH);
754
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
624755 }
625756
626757 maximized ^= true;
758
+
759
+ frame.validate();
627760 }
761
+
762
+ cButton minButton;
763
+ cButton maxButton;
764
+ cButton fullButton;
628765
629766 void ToggleFullScreen()
630767 {
631
- if (CameraPane.FULLSCREEN)
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
632773 {
633774 device.setFullScreenWindow(null);
775
+ frame.dispose();
776
+ frame.setUndecorated(false);
777
+ frame.validate();
778
+ frame.setVisible(true);
779
+
634780 //frame.setVisible(false);
635781 // frame.removeNotify();
636782 // frame.setUndecorated(false);
....@@ -640,7 +786,7 @@
640786 // X frame.getContentPane().remove(/*"Center",*/bigThree);
641787 // X framePanel.add(bigThree);
642788 // X frame.getContentPane().add(/*"Center",*/framePanel);
643
- framePanel.setDividerLocation(1);
789
+ framePanel.setDividerLocation(46);
644790
645791 //frame.setVisible(true);
646792 radio.layout = keepButton;
....@@ -655,7 +801,12 @@
655801 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
656802 // frame.getToolkit().getScreenSize().height);
657803 //frame.setVisible(false);
804
+
805
+ frame.dispose();
806
+ frame.setUndecorated(true);
658807 device.setFullScreenWindow(frame);
808
+ frame.validate();
809
+ frame.setVisible(true);
659810 // frame.removeNotify();
660811 // frame.setUndecorated(true);
661812 // frame.addNotify();
....@@ -664,13 +815,34 @@
664815 // X frame.getContentPane().add(/*"Center",*/bigThree);
665816 framePanel.setDividerLocation(0);
666817
667
- radio.layout = twoButton;
818
+ radio.layout = fullscreenLayout;
668819 radio.layout.doClick();
669820 //frame.setVisible(true);
670821 }
671
-
672
- cameraView.ToggleFullScreen();
822
+ frame.validate();
673823 }
824
+
825
+ private byte[] CompressCopy()
826
+ {
827
+ boolean temp = CameraPane.SWITCH;
828
+ CameraPane.SWITCH = false;
829
+
830
+ copy.ExtractBigData(versiontable);
831
+ // if (copy == client)
832
+
833
+ byte[] versions[] = copy.versions;
834
+ copy.versions = null;
835
+
836
+ byte[] compress = Compress(copy);
837
+
838
+ copy.versions = versions;
839
+
840
+ copy.RestoreBigData(versiontable);
841
+
842
+ CameraPane.SWITCH = temp;
843
+
844
+ return compress;
845
+ }
674846
675847 private JTextPane createTextPane()
676848 {
....@@ -802,7 +974,7 @@
802974 // NumberSlider vDivsField;
803975 // JCheckBox endcaps;
804976 JCheckBox liveCB;
805
- JCheckBox selectCB;
977
+ JCheckBox selectableCB;
806978 JCheckBox hideCB;
807979 JCheckBox link2masterCB;
808980 JCheckBox markCB;
....@@ -810,7 +982,12 @@
810982 JCheckBox speedupCB;
811983 JCheckBox rewindCB;
812984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
813989 JComboBox texresMenu;
990
+
814991 JButton resetButton;
815992 JButton stepButton;
816993 JButton stepAllButton;
....@@ -819,10 +996,13 @@
819996 JButton fasterButton;
820997 JButton remarkButton;
821998
999
+ cGridBag editPanel;
1000
+ cGridBag editCommandsPanel;
1001
+
8221002 cGridBag namePanel;
8231003 cGridBag setupPanel;
8241004 cGridBag setupPanel2;
825
- cGridBag commandsPanel;
1005
+ cGridBag objectCommandsPanel;
8261006 cGridBag pushPanel;
8271007 cGridBag fillPanel;
8281008
....@@ -994,38 +1174,42 @@
9941174 namePanel = new cGridBag();
9951175
9961176 nameField = AddText(namePanel, copy.GetName());
997
- namePanel.add(nameField);
1177
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9981178 oe.ctrlPanel.add(namePanel);
9991179
10001180 oe.ctrlPanel.Return();
10011181
1002
- if (!GroupEditor.allparams)
1182
+ if (!allparams)
10031183 return;
10041184
10051185 setupPanel = new cGridBag().setVertical(false);
10061186
10071187 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
10081188 liveCB.setToolTipText("Animate object");
1009
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1010
- selectCB.setToolTipText("Make object selectable");
1189
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectableCB.setToolTipText("Make object selectable");
10111191 // Return();
1192
+
10121193 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10131194 hideCB.setToolTipText("Hide object");
10141195 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1015
- markCB.setToolTipText("Set the animation target transform");
1196
+ markCB.setToolTipText("As animation target transform");
1197
+
1198
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10161199
10171200 setupPanel2 = new cGridBag().setVertical(false);
10181201
10191202 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10201203 rewindCB.setToolTipText("Rewind animation");
10211204
1022
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1023
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1205
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1206
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10241207
1208
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1209
+ link2masterCB.setToolTipText("Attach to support");
1210
+
10251211 if (Globals.ADVANCED)
10261212 {
1027
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1028
- link2masterCB.setToolTipText("Attach to support");
10291213 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
10301214 speedupCB.setToolTipText("Option motion capture");
10311215 }
....@@ -1035,23 +1219,23 @@
10351219 oe.ctrlPanel.add(setupPanel2);
10361220 oe.ctrlPanel.Return();
10371221
1038
- commandsPanel = new cGridBag().setVertical(false);
1222
+ objectCommandsPanel = new cGridBag().setVertical(false);
10391223
1040
- resetButton = AddButton(commandsPanel, "Reset");
1224
+ resetButton = AddButton(objectCommandsPanel, "Reset");
10411225 resetButton.setToolTipText("Jump to frame zero");
1042
- stepButton = AddButton(commandsPanel, "Step");
1226
+ stepButton = AddButton(objectCommandsPanel, "Step");
10431227 stepButton.setToolTipText("Step one frame");
10441228 // resetAllButton = AddButton(oe, "Reset All");
10451229 // stepAllButton = AddButton(oe, "Step All");
10461230 // Return();
1047
- slowerButton = AddButton(commandsPanel, "Slow");
1231
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
10481232 slowerButton.setToolTipText("Decrease animation speed");
1049
- fasterButton = AddButton(commandsPanel, "Fast");
1233
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
10501234 fasterButton.setToolTipText("Increase animation speed");
1051
- remarkButton = AddButton(commandsPanel, "Remark");
1235
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
10521236 remarkButton.setToolTipText("Set the current transform as the target");
10531237
1054
- oe.ctrlPanel.add(commandsPanel);
1238
+ oe.ctrlPanel.add(objectCommandsPanel);
10551239 oe.ctrlPanel.Return();
10561240
10571241 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1299,6 +1483,7 @@
12991483 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
13001484 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
13011485 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1486
+ //XYZPanel.setName("XYZ");
13021487
13031488 /*
13041489 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1336,12 +1521,23 @@
13361521 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
13371522 //tmp.setName("Edit");
13381523 objectPanel.add(materialPanel);
1524
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
13391525 // JPanel north = new JPanel(new BorderLayout());
13401526 // north.setName("Edit");
13411527 // north.add(ctrlPanel, BorderLayout.NORTH);
13421528 // objectPanel.add(north);
1343
- objectPanel.add(ctrlPanel);
1344
- objectPanel.add(infoPanel);
1529
+ objectPanel.add(editPanel);
1530
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1531
+
1532
+ //if (Globals.ADVANCED)
1533
+ objectPanel.add(infoPanel);
1534
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1535
+
1536
+ objectPanel.add(XYZPanel);
1537
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1538
+
1539
+ objectPanel.add(toolboxPanel);
1540
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
13451541
13461542 /*
13471543 aConstraints.gridx = 0;
....@@ -1350,7 +1546,7 @@
13501546 aConstraints.gridy += 1;
13511547 aConstraints.gridwidth = 1;
13521548 mainPanel.add(objectPanel, aConstraints);
1353
- */
1549
+ */
13541550
13551551 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
13561552 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1362,14 +1558,12 @@
13621558 scrollpane.addMouseWheelListener(this); // Default not fast enough
13631559
13641560 /*JTabbedPane*/ scenePanel = new cGridBag();
1365
- scenePanel.preferredWidth = 6;
1561
+ scenePanel.preferredWidth = 5;
13661562
13671563 JTabbedPane tabbedPane = new JTabbedPane();
13681564 tabbedPane.add(scrollpane);
13691565
1370
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1371
-
1372
- optionsPanel = new cGridBag().setVertical(true);
1566
+ optionsPanel = new cGridBag().setVertical(false);
13731567
13741568 optionsPanel.setName("Options");
13751569
....@@ -1377,6 +1571,8 @@
13771571
13781572 tabbedPane.add(optionsPanel);
13791573
1574
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1575
+
13801576 scenePanel.add(tabbedPane);
13811577
13821578 /*
....@@ -1438,9 +1634,9 @@
14381634 /**/
14391635
14401636 bigThree = new cGridBag();
1441
- bigThree.addComponent(scenePanel);
14421637 bigThree.addComponent(centralPanel);
1443
- bigThree.addComponent(XYZPanel);
1638
+ bigThree.addComponent(scenePanel);
1639
+ //bigThree.addComponent(XYZPanel);
14441640
14451641 // // SIDE EFFECT!!!
14461642 // aConstraints.gridx = 0;
....@@ -1449,9 +1645,9 @@
14491645 // aConstraints.gridheight = 1;
14501646
14511647 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1452
- framePanel.setContinuousLayout(true);
1453
- framePanel.setOneTouchExpandable(true);
1454
- framePanel.setDividerLocation(0.8);
1648
+ framePanel.setContinuousLayout(false);
1649
+ framePanel.setOneTouchExpandable(false);
1650
+ //.setDividerLocation(0.8);
14551651 //framePanel.setDividerSize(15);
14561652 //framePanel.setResizeWeight(0.15);
14571653 framePanel.setName("Frame");
....@@ -1469,11 +1665,14 @@
14691665 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14701666
14711667 frame.setSize(1280, 860);
1472
- frame.setVisible(true);
1473
-
1668
+
14741669 cameraView.requestFocusInWindow();
14751670
14761671 gridPanel.setDividerLocation(1.0);
1672
+
1673
+ frame.validate();
1674
+
1675
+ frame.setVisible(true);
14771676
14781677 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
14791678 frame.addWindowListener(new WindowAdapter()
....@@ -1560,24 +1759,6 @@
15601759 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
15611760 colorSection.add(texture);
15621761
1563
- cGridBag anisoU = new cGridBag();
1564
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1565
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1567
- colorSection.add(anisoU);
1568
-
1569
- cGridBag anisoV = new cGridBag();
1570
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1571
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1573
- colorSection.add(anisoV);
1574
-
1575
- cGridBag shadowbias = new cGridBag();
1576
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1577
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1579
- colorSection.add(shadowbias);
1580
-
15811762 panel.add(new JSeparator());
15821763
15831764 panel.add(colorSection);
....@@ -1627,6 +1808,12 @@
16271808 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16281809 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16291810 diffuseSection.add(fakedepth);
1811
+
1812
+ cGridBag shadowbias = new cGridBag();
1813
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1814
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1815
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1816
+ diffuseSection.add(shadowbias);
16301817
16311818 panel.add(new JSeparator());
16321819
....@@ -1678,6 +1865,18 @@
16781865 // aConstraints.gridy += 1;
16791866 // aConstraints.gridwidth = 1;
16801867
1868
+ cGridBag anisoU = new cGridBag();
1869
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1870
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1871
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1872
+ specularSection.add(anisoU);
1873
+
1874
+ cGridBag anisoV = new cGridBag();
1875
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1876
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1877
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1878
+ specularSection.add(anisoV);
1879
+
16811880
16821881 panel.add(new JSeparator());
16831882
....@@ -1685,35 +1884,35 @@
16851884
16861885 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16871886
1688
- cGridBag globalSection = new cGridBag().setVertical(true);
1887
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16891888
16901889 cGridBag camera = new cGridBag();
16911890 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16921891 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16931892 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1694
- globalSection.add(camera);
1893
+ colorSection.add(camera);
16951894
16961895 cGridBag ambient = new cGridBag();
16971896 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16981897 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16991898 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1700
- globalSection.add(ambient);
1899
+ colorSection.add(ambient);
17011900
17021901 cGridBag backlit = new cGridBag();
17031902 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17041903 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17051904 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
- globalSection.add(backlit);
1905
+ colorSection.add(backlit);
17071906
17081907 cGridBag opacity = new cGridBag();
17091908 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
17101909 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17111910 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1712
- globalSection.add(opacity);
1911
+ colorSection.add(opacity);
17131912
1714
- panel.add(new JSeparator());
1913
+ //panel.add(new JSeparator());
17151914
1716
- panel.add(globalSection);
1915
+ //panel.add(globalSection);
17171916
17181917 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17191918
....@@ -1820,8 +2019,9 @@
18202019 // 3D models
18212020 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18222021 {
1823
- lastConverter = new com.jmex.model.converters.MaxToJme();
1824
- LoadFile(filename, lastConverter);
2022
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2023
+ //LoadFile(filename, lastConverter);
2024
+ LoadObjFile(filename); // New 3ds loader
18252025 continue;
18262026 }
18272027 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2547,6 +2747,7 @@
25472747 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25482748 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25492749 }
2750
+
25502751 //cJME.count++;
25512752 //cJME.count %= 12;
25522753 if (gc)
....@@ -2730,6 +2931,7 @@
27302931 }
27312932 }
27322933 }
2934
+
27332935 cFileSystemPane FSPane;
27342936
27352937 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2783,11 +2985,14 @@
27832985 }
27842986 }
27852987 }
2988
+
27862989 freezematerial = false;
27872990 }
27882991
27892992 void SetMaterial(Object3D object)
27902993 {
2994
+ latestObject = object;
2995
+
27912996 cMaterial mat = object.material;
27922997
27932998 if (mat == null)
....@@ -2899,12 +3104,17 @@
28993104 // }
29003105
29013106 /**/
2902
- if (deselect)
3107
+ if (deselect || child == null)
29033108 {
29043109 //group.deselectAll();
29053110 //freeze = true;
29063111 GetTree().clearSelection();
29073112 //freeze = false;
3113
+
3114
+ if (child == null)
3115
+ {
3116
+ return;
3117
+ }
29083118 }
29093119
29103120 //group.addSelectee(child);
....@@ -2973,7 +3183,7 @@
29733183 cameraView.ToggleDL();
29743184 cameraView.repaint();
29753185 return;
2976
- } else if (event.getSource() == toggleTextureItem)
3186
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29773187 {
29783188 cameraView.ToggleTexture();
29793189 // june 2013 copy.HardTouch();
....@@ -3012,7 +3222,7 @@
30123222 frame.validate();
30133223
30143224 return;
3015
- } else if (event.getSource() == toggleSwitchItem)
3225
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30163226 {
30173227 cameraView.ToggleSwitch();
30183228 cameraView.repaint();
....@@ -3043,7 +3253,7 @@
30433253 {
30443254 copy.live ^= true;
30453255 return;
3046
- } else if (event.getSource() == selectCB)
3256
+ } else if (event.getSource() == selectableCB)
30473257 {
30483258 copy.dontselect ^= true;
30493259 return;
....@@ -3228,9 +3438,9 @@
32283438 {
32293439 Close();
32303440 //return true;
3231
- } else if (source == loadItem)
3441
+ } else if (source == openItem)
32323442 {
3233
- load();
3443
+ Open();
32343444 //return true;
32353445 } else if (source == newItem)
32363446 {
....@@ -3255,6 +3465,10 @@
32553465 {
32563466 generatePOV();
32573467 //return true;
3468
+ } else if (event.getSource() == archiveItem)
3469
+ {
3470
+ cTools.Archive(frame);
3471
+ return;
32583472 } else if (source == zBufferItem)
32593473 {
32603474 try
....@@ -3306,8 +3520,8 @@
33063520 try
33073521 {
33083522 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3309
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3310
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3523
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3524
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
33113525
33123526 Object3D parent = o.parent;
33133527 o.parent = null;
....@@ -3318,10 +3532,14 @@
33183532
33193533 out.flush();
33203534
3321
- zstream.close();
3535
+ baos //zstream
3536
+ .close();
33223537 out.close();
33233538
3324
- return baos.toByteArray();
3539
+ byte[] bytes = baos.toByteArray();
3540
+
3541
+ System.out.println("save #bytes = " + bytes.length);
3542
+ return bytes;
33253543 } catch (Exception e)
33263544 {
33273545 System.err.println(e);
....@@ -3331,13 +3549,16 @@
33313549
33323550 static public Object Uncompress(byte[] bytes)
33333551 {
3334
- System.out.println("#bytes = " + bytes.length);
3552
+ System.out.println("restore #bytes = " + bytes.length);
33353553 try
33363554 {
33373555 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3338
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3339
- ObjectInputStream in = new ObjectInputStream(istream);
3556
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3557
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
33403558 Object obj = in.readObject();
3559
+
3560
+ bais //istream
3561
+ .close();
33413562 in.close();
33423563
33433564 return obj;
....@@ -3392,37 +3613,77 @@
33923613 return null;
33933614 }
33943615
3395
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
33963616
33973617 public void Save()
33983618 {
3619
+ //Save(true);
3620
+ Replace();
3621
+ }
3622
+
3623
+ private boolean Equal(byte[] compress, byte[] name)
3624
+ {
3625
+ if (compress.length != name.length)
3626
+ {
3627
+ return false;
3628
+ }
3629
+
3630
+ for (int i=compress.length; --i>=0;)
3631
+ {
3632
+ if (compress[i] != name[i])
3633
+ return false;
3634
+ }
3635
+
3636
+ return true;
3637
+ }
3638
+
3639
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3640
+
3641
+ public boolean Save(boolean user)
3642
+ {
3643
+ System.err.println("Save");
3644
+
33993645 cRadio tab = GetCurrentTab();
34003646
3401
- boolean temp = CameraPane.SWITCH;
3402
- CameraPane.SWITCH = false;
3647
+ byte[] compress = CompressCopy();
34033648
3404
- copy.ExtractBigData(hashtable);
3649
+ boolean thesame = false;
3650
+
3651
+ // Quick heuristic using length. Works only when stream is compressed.
3652
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3653
+ {
3654
+ thesame = true;
3655
+ }
34053656
34063657 //EditorFrame.m_MainFrame.requestFocusInWindow();
3407
- tab.graphs[tab.undoindex++] = Compress(copy);
3408
-
3409
- copy.RestoreBigData(hashtable);
3410
-
3411
- CameraPane.SWITCH = temp;
3412
-
3413
- //assert(hashtable.isEmpty());
3414
-
3415
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3658
+ if (!thesame)
34163659 {
3417
- tab.graphs[i] = null;
3660
+ //tab.user[tab.versionindex] = user;
3661
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3662
+
3663
+ copy.versions[++copy.versionindex] = compress;
3664
+
3665
+ // if (increment)
3666
+ // tab.versionindex++;
34183667 }
34193668
3669
+ //copy.RestoreBigData(versiontable);
3670
+
3671
+ //assert(hashtable.isEmpty());
3672
+
3673
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3674
+ {
3675
+ //tab.user[i] = false;
3676
+ copy.versions[i] = null;
3677
+ }
3678
+
3679
+ SetUndoStates();
3680
+
34203681 // test save
34213682 if (false)
34223683 {
34233684 try
34243685 {
3425
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3686
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
34263687 ObjectOutputStream p = new ObjectOutputStream(ostream);
34273688
34283689 p.writeObject(copy);
....@@ -3435,14 +3696,18 @@
34353696 e.printStackTrace();
34363697 }
34373698 }
3699
+
3700
+ return !thesame;
34383701 }
34393702
34403703 void CopyChanged(Object3D obj)
34413704 {
3705
+ SetUndoStates();
3706
+
34423707 boolean temp = CameraPane.SWITCH;
34433708 CameraPane.SWITCH = false;
34443709
3445
- copy.ExtractBigData(hashtable);
3710
+ copy.ExtractBigData(versiontable);
34463711
34473712 copy.clear();
34483713
....@@ -3451,7 +3716,7 @@
34513716 copy.add(obj.get(i));
34523717 }
34533718
3454
- copy.RestoreBigData(hashtable);
3719
+ copy.RestoreBigData(versiontable);
34553720
34563721 CameraPane.SWITCH = temp;
34573722
....@@ -3478,40 +3743,130 @@
34783743 refreshContents();
34793744 }
34803745
3481
- public void Undo()
3746
+ cButton undoButton;
3747
+ cButton restoreButton;
3748
+ cButton replaceButton;
3749
+ cButton redoButton;
3750
+
3751
+ boolean muteSlider;
3752
+
3753
+ int VersionCount()
3754
+ {
3755
+ int count = 0;
3756
+
3757
+ for (int i = copy.versions.length; --i >= 0;)
3758
+ {
3759
+ if (copy.versions[i] != null)
3760
+ count++;
3761
+ }
3762
+
3763
+ return count;
3764
+ }
3765
+
3766
+ void SetUndoStates()
34823767 {
34833768 cRadio tab = GetCurrentTab();
34843769
3485
- if (tab.undoindex == 0)
3770
+ restoreButton.setEnabled(copy.versionindex != -1);
3771
+ replaceButton.setEnabled(copy.versionindex != -1);
3772
+
3773
+ undoButton.setEnabled(copy.versionindex > 0);
3774
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3775
+
3776
+ muteSlider = true;
3777
+ versionSlider.setMaximum(VersionCount() - 1);
3778
+ versionSlider.setInteger(copy.versionindex);
3779
+ muteSlider = false;
3780
+ }
3781
+
3782
+ public boolean Undo()
3783
+ {
3784
+ // Option?
3785
+ Replace();
3786
+
3787
+ System.err.println("Undo");
3788
+
3789
+ cRadio tab = GetCurrentTab();
3790
+
3791
+ if (copy.versionindex == 0)
34863792 {
34873793 java.awt.Toolkit.getDefaultToolkit().beep();
3488
- return;
3794
+ return false;
34893795 }
34903796
3491
- if (tab.graphs[tab.undoindex] == null)
3797
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3798
+// {
3799
+// if (Save(false))
3800
+// tab.versionindex -= 1;
3801
+// else
3802
+// {
3803
+// if (tab.versionindex <= 0)
3804
+// return false;
3805
+// else
3806
+// tab.versionindex -= 1;
3807
+// }
3808
+// }
3809
+
3810
+ copy.versionindex -= 1;
3811
+
3812
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3813
+
3814
+ return true;
3815
+ }
3816
+
3817
+ public boolean Restore()
3818
+ {
3819
+ System.err.println("Restore");
3820
+
3821
+ cRadio tab = GetCurrentTab();
3822
+
3823
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
34923824 {
3493
- Save();
3494
- tab.undoindex -= 1;
3825
+ java.awt.Toolkit.getDefaultToolkit().beep();
3826
+ return false;
34953827 }
34963828
3497
- tab.undoindex -= 1;
3829
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3830
+
3831
+ return true;
3832
+ }
34983833
3499
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3834
+ public boolean Replace()
3835
+ {
3836
+ System.err.println("Replace");
3837
+
3838
+ cRadio tab = GetCurrentTab();
3839
+
3840
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3841
+ {
3842
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3843
+ return false;
3844
+ }
3845
+
3846
+ copy.versions[copy.versionindex] = CompressCopy();
3847
+
3848
+ return true;
35003849 }
35013850
35023851 public void Redo()
35033852 {
3853
+ // Option?
3854
+ Replace();
3855
+
35043856 cRadio tab = GetCurrentTab();
35053857
3506
- if (tab.graphs[tab.undoindex + 1] == null)
3858
+ if (copy.versions[copy.versionindex + 1] == null)
35073859 {
35083860 java.awt.Toolkit.getDefaultToolkit().beep();
35093861 return;
35103862 }
35113863
3512
- tab.undoindex += 1;
3864
+ copy.versionindex += 1;
35133865
3514
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3866
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3867
+
3868
+ //if (!tab.user[tab.versionindex])
3869
+ // tab.graphs[tab.versionindex] = null;
35153870 }
35163871
35173872 void ImportGFD()
....@@ -3663,7 +4018,7 @@
36634018 assert false;
36644019 }
36654020
3666
- void EditSelection()
4021
+ void EditSelection(boolean newWindow)
36674022 {
36684023 }
36694024
....@@ -3807,9 +4162,25 @@
38074162 //copy.Touch();
38084163 }
38094164
4165
+ cNumberSlider versionSlider;
4166
+
38104167 public void stateChanged(ChangeEvent e)
38114168 {
38124169 // assert(false);
4170
+ if (e.getSource() == versionSlider)
4171
+ {
4172
+ if (muteSlider)
4173
+ return;
4174
+
4175
+ int version = versionSlider.getInteger();
4176
+
4177
+ if (copy.versions[version] != null)
4178
+ {
4179
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4180
+ }
4181
+
4182
+ return;
4183
+ }
38134184
38144185 if (freezematerial)
38154186 {
....@@ -4158,7 +4529,8 @@
41584529
41594530 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
41604531 {
4161
- Save();
4532
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4533
+ Save();
41624534 //Tween.set(thing, 0).target(1).start(tweenManager);
41634535 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
41644536 // if (thing instanceof GenericJointDemo)
....@@ -4245,6 +4617,12 @@
42454617 {
42464618 ResetModel();
42474619 Select(thing.GetTreePath(), true, false); // unselect... false);
4620
+
4621
+ if (thing.Size() == 0)
4622
+ {
4623
+ //EditSelection(false);
4624
+ }
4625
+
42484626 refreshContents();
42494627 }
42504628
....@@ -4393,7 +4771,9 @@
43934771 readobj.ResetDisplayList();
43944772 } catch (Exception e)
43954773 {
4396
- //e.printStackTrace();
4774
+ if (!e.toString().contains("GZIP"))
4775
+ e.printStackTrace();
4776
+
43974777 try
43984778 {
43994779 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4467,11 +4847,14 @@
44674847
44684848 if (readobj != null)
44694849 {
4470
- Save();
4850
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4851
+ // Save();
44714852 try
44724853 {
44734854 //readobj.deepCopySelf(copy);
44744855 copy.clear(); // june 2014
4856
+ copy.skyboxname = readobj.skyboxname;
4857
+ copy.skyboxext = readobj.skyboxext;
44754858 for (int i = 0; i < readobj.size(); i++)
44764859 {
44774860 Object3D child = readobj.get(i); // reserve(i);
....@@ -4512,6 +4895,7 @@
45124895 }
45134896 } catch (ClassCastException e)
45144897 {
4898
+ e.printStackTrace();
45154899 assert (false);
45164900 Composite c = (Composite) copy;
45174901 c.children.clear();
....@@ -4522,13 +4906,24 @@
45224906 c.addChild(csg);
45234907 }
45244908
4909
+ copy.versions = readobj.versions;
4910
+ copy.versionindex = readobj.versionindex;
4911
+
4912
+ if (copy.versions == null)
4913
+ {
4914
+ copy.versions = new byte[100][];
4915
+ copy.versionindex = -1;
4916
+ }
4917
+
4918
+ //? SetUndoStates();
4919
+
45254920 ResetModel();
45264921 copy.HardTouch(); // recompile?
45274922 refreshContents();
45284923 }
45294924 }
45304925
4531
- void load() // throws ClassNotFoundException
4926
+ void Open() // throws ClassNotFoundException
45324927 {
45334928 if (Grafreed.standAlone)
45344929 {
....@@ -4631,6 +5026,7 @@
46315026 //ps.print(buffer.toString());
46325027 } catch (IOException e)
46335028 {
5029
+ e.printStackTrace();
46345030 }
46355031 }
46365032
....@@ -4645,6 +5041,8 @@
46455041 String filename = browser.getFile();
46465042 if (filename != null && filename.length() > 0)
46475043 {
5044
+ if (!filename.endsWith(".gfd"))
5045
+ filename += ".gfd";
46485046 lastname = browser.getDirectory() + filename;
46495047 save();
46505048 }
....@@ -4811,7 +5209,7 @@
48115209 MenuBar menuBar;
48125210 Menu fileMenu;
48135211 MenuItem newItem;
4814
- MenuItem loadItem;
5212
+ MenuItem openItem;
48155213 MenuItem saveItem;
48165214 MenuItem saveAsItem;
48175215 MenuItem exportAsItem;
....@@ -4834,22 +5232,36 @@
48345232 CheckboxMenuItem toggleSwitchItem;
48355233 CheckboxMenuItem toggleRootItem;
48365234 CheckboxMenuItem animationItem;
5235
+ MenuItem archiveItem;
48375236 CheckboxMenuItem toggleHandleItem;
48385237 CheckboxMenuItem togglePaintItem;
48395238 JSplitPane mainPanel;
48405239 JScrollPane scrollpane;
5240
+
48415241 JPanel toolbarPanel;
5242
+
48425243 cGridBag treePanel;
5244
+
48435245 JPanel radioPanel;
48445246 ButtonGroup buttonGroup;
4845
- cGridBag ctrlPanel;
5247
+
5248
+ cGridBag toolboxPanel;
48465249 cGridBag materialPanel;
5250
+ cGridBag ctrlPanel;
5251
+
48475252 JScrollPane infoPanel;
5253
+
48485254 cGridBag optionsPanel;
5255
+
48495256 JTabbedPane objectPanel;
5257
+ boolean materialFlushed;
5258
+ Object3D latestObject;
5259
+
48505260 cGridBag XYZPanel;
5261
+
48515262 JSplitPane gridPanel;
48525263 JSplitPane bigPanel;
5264
+
48535265 cGridBag bigThree;
48545266 cGridBag scenePanel;
48555267 cGridBag centralPanel;
....@@ -4964,7 +5376,7 @@
49645376 cNumberSlider fogField;
49655377 JLabel opacityPowerLabel;
49665378 cNumberSlider opacityPowerField;
4967
- JTree jTree;
5379
+ cTree jTree;
49685380 //ObjectUI parent;
49695381
49705382 cNumberSlider normalpushField;