Normand Briere
2019-08-01 c99d954f5e2bffa601c599142371cfeb45630f40
ObjEditor.java
....@@ -15,6 +15,9 @@
1515 //import javax.swing.plaf.ColorUIResource;
1616 //import javax.swing.plaf.metal.DefaultMetalTheme;
1717
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1821 //import javax.media.opengl.GLCanvas;
1922
2023 import //weka.core.
....@@ -38,51 +41,78 @@
3841 JFrame frame;
3942
4043 static ObjEditor theFrame;
44
+
45
+ public cGridBag GetSeparator()
46
+ {
47
+ cGridBag separator = new cGridBag();
48
+ separator.add(new JSeparator());
49
+ separator.preferredHeight = 5;
50
+ return separator;
51
+ }
4152
4253 cButton GetButton(String name, boolean border)
4354 {
44
- try
45
- {
46
- ImageIcon icon = GetIcon(name);
47
- return new cButton(icon, border);
48
- }
49
- catch (Exception e)
50
- {
51
- return new cButton(name, border);
52
- }
55
+ ImageIcon icon = GetIcon(name);
56
+ return new cButton(icon, border);
57
+ }
58
+
59
+ cLabel GetLabel(String name, boolean border)
60
+ {
61
+ //ImageIcon icon = GetIcon(name);
62
+ return new cLabel(GetImage(name), border);
63
+ }
64
+
65
+ cToggleButton GetToggleButton(String name, boolean border)
66
+ {
67
+ ImageIcon icon = GetIcon(name);
68
+ return new cToggleButton(icon, border);
5369 }
5470
5571 cCheckBox GetCheckBox(String name, boolean border)
5672 {
73
+ ImageIcon icon = GetIcon(name);
74
+ return new cCheckBox(icon, border);
75
+ }
76
+
77
+ ImageIcon GetIcon(String name)
78
+ {
5779 try
5880 {
59
- ImageIcon icon = GetIcon(name);
60
- return new cCheckBox(icon, border);
81
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
82
+
83
+// if (image.getWidth() > 48 && image.getHeight() > 48)
84
+// {
85
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
86
+// Graphics2D g = resized.createGraphics();
87
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
88
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
89
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
90
+// g.dispose();
91
+//
92
+// image = resized;
93
+// }
94
+
95
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
96
+ return icon;
6197 }
6298 catch (Exception e)
6399 {
64
- return new cCheckBox(name, border);
100
+ return null;
65101 }
66102 }
67
-
68
- private ImageIcon GetIcon(String name) throws IOException
103
+
104
+ BufferedImage GetImage(String name)
69105 {
70
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
71
-
72
- if (image.getWidth() != 24 && image.getHeight() != 24)
106
+ try
73107 {
74
- BufferedImage resized = new BufferedImage(24, 24, image.getType());
75
- Graphics2D g = resized.createGraphics();
76
- g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
77
- //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
78
- g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
79
- g.dispose();
80
-
81
- image = resized;
108
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
109
+
110
+ return image;
82111 }
83
-
84
- javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
85
- return icon;
112
+ catch (Exception e)
113
+ {
114
+ return null;
115
+ }
86116 }
87117
88118 // SCRIPT
....@@ -194,7 +224,7 @@
194224
195225 objEditor.ctrlPanel.remove(namePanel);
196226
197
- if (!GroupEditor.allparams)
227
+ if (!allparams)
198228 return;
199229
200230 // objEditor.ctrlPanel.remove(liveCB);
....@@ -266,6 +296,12 @@
266296 client = inClient;
267297 copy = client;
268298
299
+ if (copy.versions == null)
300
+ {
301
+ copy.versions = new byte[100][];
302
+ copy.versionindex = -1;
303
+ }
304
+
269305 // "this" is not called: SetupUI2(objEditor);
270306 }
271307
....@@ -279,6 +315,12 @@
279315 client = inClient;
280316 copy = client;
281317
318
+ if (copy.versions == null)
319
+ {
320
+ copy.versions = new byte[100][];
321
+ copy.versionindex = -1;
322
+ }
323
+
282324 SetupUI2(callee.GetEditor());
283325 }
284326
....@@ -293,7 +335,7 @@
293335 //localCopy.parent = null;
294336
295337 frame = new JFrame();
296
- frame.setUndecorated(true);
338
+ frame.setUndecorated(false);
297339 objEditor = this;
298340 this.callee = callee;
299341
....@@ -311,6 +353,12 @@
311353 copy = localCopy;
312354 copy.editWindow = this;
313355
356
+ if (copy.versions == null)
357
+ {
358
+// copy.versions = new byte[100][];
359
+// copy.versionindex = -1;
360
+ }
361
+
314362 SetupMenu();
315363
316364 //SetupName(objEditor); // new
....@@ -324,12 +372,17 @@
324372 return frame.action(event, obj);
325373 }
326374
375
+ // Cannot work without static
376
+ static boolean allparams = true;
377
+
378
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
379
+
327380 void SetupMenu()
328381 {
329382 frame.setMenuBar(menuBar = new MenuBar());
330383 menuBar.add(fileMenu = new Menu("File"));
331384 fileMenu.add(newItem = new MenuItem("New"));
332
- fileMenu.add(loadItem = new MenuItem("Open..."));
385
+ fileMenu.add(openItem = new MenuItem("Open..."));
333386
334387 //oe.menuBar.add(menu = new Menu("Include"));
335388 Menu menu = new Menu("Import");
....@@ -361,7 +414,7 @@
361414 }
362415
363416 newItem.addActionListener(this);
364
- loadItem.addActionListener(this);
417
+ openItem.addActionListener(this);
365418 saveItem.addActionListener(this);
366419 saveAsItem.addActionListener(this);
367420 exportAsItem.addActionListener(this);
....@@ -370,13 +423,40 @@
370423 closeItem.addActionListener(this);
371424
372425 objectPanel = new JTabbedPane();
426
+
427
+ ChangeListener changeListener = new ChangeListener()
428
+ {
429
+ public void stateChanged(ChangeEvent changeEvent)
430
+ {
431
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
432
+// {
433
+// if (latestObject != null)
434
+// {
435
+// refreshContents(true);
436
+// SetMaterial(latestObject);
437
+// }
438
+//
439
+// materialFlushed = true;
440
+// }
441
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
442
+// {
443
+// if (listUI.size() == 0)
444
+// EditSelection(false);
445
+// }
446
+
447
+ refreshContents(false); // To refresh Info tab
448
+ }
449
+ };
450
+ objectPanel.addChangeListener(changeListener);
451
+
373452 toolbarPanel = new JPanel();
374453 toolbarPanel.setName("Toolbar");
454
+
375455 treePanel = new cGridBag();
376456 treePanel.setName("Tree");
377457
378458 editPanel = new cGridBag().setVertical(true);
379
- editPanel.setName("Edit");
459
+ //editPanel.setName("Edit");
380460
381461 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
382462
....@@ -384,23 +464,27 @@
384464 editPanel.add(editCommandsPanel);
385465 editPanel.add(ctrlPanel);
386466
387
- materialPanel = new cGridBag().setVertical(true);
467
+ toolboxPanel = new cGridBag().setVertical(true);
468
+ //toolboxPanel.setName("Toolbox");
388469
389
- materialPanel.setName("Material");
470
+ materialPanel = new cGridBag().setVertical(true);
471
+ //materialPanel.setName("Material");
472
+
390473 /*JTextPane*/
391474 infoarea = createTextPane();
392475 doc = infoarea.getStyledDocument();
393476
394477 infoarea.setEditable(true);
395478 SetText();
479
+
396480 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
397481 // infoarea.setOpaque(false);
398482 // //infoarea.setForeground(textcolor);
399483 // TEXTAREA infoarea.setLineWrap(true);
400484 // TEXTAREA infoarea.setWrapStyleWord(true);
401485 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
402
- infoPanel.setPreferredSize(new Dimension(50, 200));
403
- infoPanel.setName("Info");
486
+ infoPanel.setPreferredSize(new Dimension(1, 1));
487
+ //infoPanel.setName("Info");
404488 //infoPanel.setLayout(new BorderLayout());
405489 //infoPanel.add(createTextPane());
406490
....@@ -411,7 +495,14 @@
411495 mainPanel.setDividerSize(9);
412496 mainPanel.setDividerLocation(0.5); //1.0);
413497 mainPanel.setResizeWeight(0.5);
414
-
498
+
499
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
500
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
501
+ divider.setDividerSize(15);
502
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
503
+
504
+ mainPanel.setUI(new BasicSplitPaneUI());
505
+
415506 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
416507 //mainPanel.setLayout(new GridBagLayout());
417508 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -642,8 +733,8 @@
642733 }
643734 }
644735
645
-static GraphicsDevice device = GraphicsEnvironment
646
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
736
+//static GraphicsDevice device = GraphicsEnvironment
737
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
647738
648739 Rectangle keeprect;
649740 cRadio radio;
....@@ -659,13 +750,24 @@
659750
660751 boolean maximized;
661752
753
+ cButton fullscreenLayout;
754
+
662755 void Minimize()
663756 {
664757 frame.setState(Frame.ICONIFIED);
758
+ frame.validate();
665759 }
666760
761
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
762
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
763
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
667764 void Maximize()
668765 {
766
+ if (CameraPane.FULLSCREEN)
767
+ {
768
+ ToggleFullScreen();
769
+ }
770
+
669771 if (maximized)
670772 {
671773 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -673,20 +775,36 @@
673775 else
674776 {
675777 keeprect = frame.getBounds();
676
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
677
- Dimension rect2 = frame.getToolkit().getScreenSize();
678
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
778
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
779
+// Dimension rect2 = frame.getToolkit().getScreenSize();
780
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
679781 // frame.setState(Frame.MAXIMIZED_BOTH);
782
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
680783 }
681784
682785 maximized ^= true;
786
+
787
+ frame.validate();
683788 }
789
+
790
+ cButton minButton;
791
+ cButton maxButton;
792
+ cButton fullButton;
684793
685794 void ToggleFullScreen()
686795 {
687
- if (CameraPane.FULLSCREEN)
796
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
797
+
798
+ cameraView.ToggleFullScreen();
799
+
800
+ if (!CameraPane.FULLSCREEN)
688801 {
689802 device.setFullScreenWindow(null);
803
+ frame.dispose();
804
+ frame.setUndecorated(false);
805
+ frame.validate();
806
+ frame.setVisible(true);
807
+
690808 //frame.setVisible(false);
691809 // frame.removeNotify();
692810 // frame.setUndecorated(false);
....@@ -696,7 +814,7 @@
696814 // X frame.getContentPane().remove(/*"Center",*/bigThree);
697815 // X framePanel.add(bigThree);
698816 // X frame.getContentPane().add(/*"Center",*/framePanel);
699
- framePanel.setDividerLocation(1);
817
+ framePanel.setDividerLocation(46);
700818
701819 //frame.setVisible(true);
702820 radio.layout = keepButton;
....@@ -711,7 +829,12 @@
711829 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
712830 // frame.getToolkit().getScreenSize().height);
713831 //frame.setVisible(false);
832
+
833
+ frame.dispose();
834
+ frame.setUndecorated(true);
714835 device.setFullScreenWindow(frame);
836
+ frame.validate();
837
+ frame.setVisible(true);
715838 // frame.removeNotify();
716839 // frame.setUndecorated(true);
717840 // frame.addNotify();
....@@ -720,13 +843,34 @@
720843 // X frame.getContentPane().add(/*"Center",*/bigThree);
721844 framePanel.setDividerLocation(0);
722845
723
- radio.layout = twoButton;
846
+ radio.layout = fullscreenLayout;
724847 radio.layout.doClick();
725848 //frame.setVisible(true);
726849 }
727
-
728
- cameraView.ToggleFullScreen();
850
+ frame.validate();
729851 }
852
+
853
+ private byte[] CompressCopy()
854
+ {
855
+ boolean temp = CameraPane.SWITCH;
856
+ CameraPane.SWITCH = false;
857
+
858
+ copy.ExtractBigData(versiontable);
859
+ // if (copy == client)
860
+
861
+ byte[] versions[] = copy.versions;
862
+ copy.versions = null;
863
+
864
+ byte[] compress = Compress(copy);
865
+
866
+ copy.versions = versions;
867
+
868
+ copy.RestoreBigData(versiontable);
869
+
870
+ CameraPane.SWITCH = temp;
871
+
872
+ return compress;
873
+ }
730874
731875 private JTextPane createTextPane()
732876 {
....@@ -858,7 +1002,7 @@
8581002 // NumberSlider vDivsField;
8591003 // JCheckBox endcaps;
8601004 JCheckBox liveCB;
861
- JCheckBox selectCB;
1005
+ JCheckBox selectableCB;
8621006 JCheckBox hideCB;
8631007 JCheckBox link2masterCB;
8641008 JCheckBox markCB;
....@@ -866,7 +1010,12 @@
8661010 JCheckBox speedupCB;
8671011 JCheckBox rewindCB;
8681012 JCheckBox flipVCB;
1013
+
1014
+ cCheckBox toggleTextureCB;
1015
+ cCheckBox toggleSwitchCB;
1016
+
8691017 JComboBox texresMenu;
1018
+
8701019 JButton resetButton;
8711020 JButton stepButton;
8721021 JButton stepAllButton;
....@@ -1053,38 +1202,42 @@
10531202 namePanel = new cGridBag();
10541203
10551204 nameField = AddText(namePanel, copy.GetName());
1056
- namePanel.add(nameField);
1205
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
10571206 oe.ctrlPanel.add(namePanel);
10581207
10591208 oe.ctrlPanel.Return();
10601209
1061
- if (!GroupEditor.allparams)
1210
+ if (!allparams)
10621211 return;
10631212
10641213 setupPanel = new cGridBag().setVertical(false);
10651214
10661215 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
10671216 liveCB.setToolTipText("Animate object");
1068
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1069
- selectCB.setToolTipText("Make object selectable");
1217
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1218
+ selectableCB.setToolTipText("Make object selectable");
10701219 // Return();
1220
+
10711221 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10721222 hideCB.setToolTipText("Hide object");
10731223 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1074
- markCB.setToolTipText("Set the animation target transform");
1224
+ markCB.setToolTipText("As animation target transform");
1225
+
1226
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10751227
10761228 setupPanel2 = new cGridBag().setVertical(false);
10771229
10781230 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10791231 rewindCB.setToolTipText("Rewind animation");
10801232
1081
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1082
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1233
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1234
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10831235
1236
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1237
+ link2masterCB.setToolTipText("Attach to support");
1238
+
10841239 if (Globals.ADVANCED)
10851240 {
1086
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1087
- link2masterCB.setToolTipText("Attach to support");
10881241 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
10891242 speedupCB.setToolTipText("Option motion capture");
10901243 }
....@@ -1358,6 +1511,7 @@
13581511 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
13591512 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
13601513 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1514
+ //XYZPanel.setName("XYZ");
13611515
13621516 /*
13631517 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1395,12 +1549,29 @@
13951549 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
13961550 //tmp.setName("Edit");
13971551 objectPanel.add(materialPanel);
1552
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1553
+ objectPanel.setToolTipTextAt(0, "Material panel");
1554
+
13981555 // JPanel north = new JPanel(new BorderLayout());
13991556 // north.setName("Edit");
14001557 // north.add(ctrlPanel, BorderLayout.NORTH);
14011558 // objectPanel.add(north);
14021559 objectPanel.add(editPanel);
1403
- objectPanel.add(infoPanel);
1560
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1561
+ objectPanel.setToolTipTextAt(1, "Edit panel");
1562
+
1563
+ //if (Globals.ADVANCED)
1564
+ objectPanel.add(infoPanel);
1565
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1566
+ objectPanel.setToolTipTextAt(2, "Info panel");
1567
+
1568
+ objectPanel.add(XYZPanel);
1569
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1570
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB panel");
1571
+
1572
+ objectPanel.add(toolboxPanel);
1573
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1574
+ objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel");
14041575
14051576 /*
14061577 aConstraints.gridx = 0;
....@@ -1409,7 +1580,7 @@
14091580 aConstraints.gridy += 1;
14101581 aConstraints.gridwidth = 1;
14111582 mainPanel.add(objectPanel, aConstraints);
1412
- */
1583
+ */
14131584
14141585 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14151586 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1421,14 +1592,12 @@
14211592 scrollpane.addMouseWheelListener(this); // Default not fast enough
14221593
14231594 /*JTabbedPane*/ scenePanel = new cGridBag();
1424
- scenePanel.preferredWidth = 6;
1595
+ scenePanel.preferredWidth = 5;
14251596
14261597 JTabbedPane tabbedPane = new JTabbedPane();
14271598 tabbedPane.add(scrollpane);
14281599
1429
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1430
-
1431
- optionsPanel = new cGridBag().setVertical(true);
1600
+ optionsPanel = new cGridBag().setVertical(false);
14321601
14331602 optionsPanel.setName("Options");
14341603
....@@ -1436,6 +1605,8 @@
14361605
14371606 tabbedPane.add(optionsPanel);
14381607
1608
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1609
+
14391610 scenePanel.add(tabbedPane);
14401611
14411612 /*
....@@ -1499,7 +1670,7 @@
14991670 bigThree = new cGridBag();
15001671 bigThree.addComponent(scenePanel);
15011672 bigThree.addComponent(centralPanel);
1502
- bigThree.addComponent(XYZPanel);
1673
+ //bigThree.addComponent(XYZPanel);
15031674
15041675 // // SIDE EFFECT!!!
15051676 // aConstraints.gridx = 0;
....@@ -1508,9 +1679,9 @@
15081679 // aConstraints.gridheight = 1;
15091680
15101681 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1511
- framePanel.setContinuousLayout(true);
1512
- framePanel.setOneTouchExpandable(true);
1513
- framePanel.setDividerLocation(0.8);
1682
+ framePanel.setContinuousLayout(false);
1683
+ framePanel.setOneTouchExpandable(false);
1684
+ //.setDividerLocation(0.8);
15141685 //framePanel.setDividerSize(15);
15151686 //framePanel.setResizeWeight(0.15);
15161687 framePanel.setName("Frame");
....@@ -1528,16 +1699,18 @@
15281699 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
15291700
15301701 frame.setSize(1280, 860);
1531
- frame.setVisible(true);
1532
-
1702
+
15331703 cameraView.requestFocusInWindow();
15341704
15351705 gridPanel.setDividerLocation(1.0);
1706
+
1707
+ frame.validate();
1708
+
1709
+ frame.setVisible(true);
15361710
15371711 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
15381712 frame.addWindowListener(new WindowAdapter()
15391713 {
1540
-
15411714 public void windowClosing(WindowEvent e)
15421715 {
15431716 Close();
....@@ -1599,45 +1772,48 @@
15991772 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16001773
16011774 cGridBag colorSection = new cGridBag().setVertical(true);
1775
+
1776
+ cGridBag huepanel = new cGridBag();
1777
+ cGridBag huelabel = new cGridBag();
1778
+ huelabel.add(GetLabel("icons/hue.png", false));
1779
+ huelabel.preferredWidth = 20;
1780
+ huepanel.add(new cGridBag()); // Label
1781
+ huepanel.add(huelabel); // Field/slider
1782
+
1783
+ huepanel.preferredHeight = 7;
1784
+
1785
+ colorSection.add(huepanel);
16021786
16031787 cGridBag color = new cGridBag();
1604
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1605
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1788
+
1789
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1790
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1791
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1792
+
16071793 //colorField.preferredWidth = 200;
16081794 colorSection.add(color);
16091795
16101796 cGridBag modulation = new cGridBag();
16111797 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
16121798 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1613
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1799
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
16141800 colorSection.add(modulation);
16151801
1802
+ cGridBag opacity = new cGridBag();
1803
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1804
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1805
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1806
+ colorSection.add(opacity);
1807
+
1808
+ colorSection.add(GetSeparator());
1809
+
16161810 cGridBag texture = new cGridBag();
16171811 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
16181812 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16191813 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16201814 colorSection.add(texture);
16211815
1622
- cGridBag anisoU = new cGridBag();
1623
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1624
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1625
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1626
- colorSection.add(anisoU);
1627
-
1628
- cGridBag anisoV = new cGridBag();
1629
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1630
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1632
- colorSection.add(anisoV);
1633
-
1634
- cGridBag shadowbias = new cGridBag();
1635
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1636
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1637
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1638
- colorSection.add(shadowbias);
1639
-
1640
- panel.add(new JSeparator());
1816
+ panel.add(GetSeparator());
16411817
16421818 panel.add(colorSection);
16431819
....@@ -1687,7 +1863,13 @@
16871863 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16881864 diffuseSection.add(fakedepth);
16891865
1690
- panel.add(new JSeparator());
1866
+ cGridBag shadowbias = new cGridBag();
1867
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1868
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1869
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1870
+ diffuseSection.add(shadowbias);
1871
+
1872
+ panel.add(GetSeparator());
16911873
16921874 panel.add(diffuseSection);
16931875
....@@ -1737,42 +1919,48 @@
17371919 // aConstraints.gridy += 1;
17381920 // aConstraints.gridwidth = 1;
17391921
1922
+ cGridBag anisoU = new cGridBag();
1923
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1924
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1925
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1926
+ specularSection.add(anisoU);
17401927
1741
- panel.add(new JSeparator());
1928
+ cGridBag anisoV = new cGridBag();
1929
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1930
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1931
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1932
+ specularSection.add(anisoV);
1933
+
1934
+
1935
+ panel.add(GetSeparator());
17421936
17431937 panel.add(specularSection);
17441938
17451939 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17461940
1747
- cGridBag globalSection = new cGridBag().setVertical(true);
1941
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17481942
17491943 cGridBag camera = new cGridBag();
17501944 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
17511945 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17521946 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1753
- globalSection.add(camera);
1947
+ colorSection.add(camera);
17541948
17551949 cGridBag ambient = new cGridBag();
17561950 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
17571951 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17581952 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1759
- globalSection.add(ambient);
1953
+ colorSection.add(ambient);
17601954
17611955 cGridBag backlit = new cGridBag();
17621956 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17631957 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17641958 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1765
- globalSection.add(backlit);
1959
+ colorSection.add(backlit);
17661960
1767
- cGridBag opacity = new cGridBag();
1768
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1769
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1771
- globalSection.add(opacity);
1772
-
1773
- panel.add(new JSeparator());
1961
+ //panel.add(new JSeparator());
17741962
1775
- panel.add(globalSection);
1963
+ //panel.add(globalSection);
17761964
17771965 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17781966
....@@ -1814,7 +2002,7 @@
18142002 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
18152003 textureSection.add(opacityPower);
18162004
1817
- panel.add(new JSeparator());
2005
+ panel.add(GetSeparator());
18182006
18192007 panel.add(textureSection);
18202008
....@@ -1879,8 +2067,9 @@
18792067 // 3D models
18802068 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18812069 {
1882
- lastConverter = new com.jmex.model.converters.MaxToJme();
1883
- LoadFile(filename, lastConverter);
2070
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2071
+ //LoadFile(filename, lastConverter);
2072
+ LoadObjFile(filename); // New 3ds loader
18842073 continue;
18852074 }
18862075 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2606,6 +2795,7 @@
26062795 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
26072796 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
26082797 }
2798
+
26092799 //cJME.count++;
26102800 //cJME.count %= 12;
26112801 if (gc)
....@@ -2789,6 +2979,7 @@
27892979 }
27902980 }
27912981 }
2982
+
27922983 cFileSystemPane FSPane;
27932984
27942985 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2842,11 +3033,14 @@
28423033 }
28433034 }
28443035 }
3036
+
28453037 freezematerial = false;
28463038 }
28473039
28483040 void SetMaterial(Object3D object)
28493041 {
3042
+ latestObject = object;
3043
+
28503044 cMaterial mat = object.material;
28513045
28523046 if (mat == null)
....@@ -2958,12 +3152,17 @@
29583152 // }
29593153
29603154 /**/
2961
- if (deselect)
3155
+ if (deselect || child == null)
29623156 {
29633157 //group.deselectAll();
29643158 //freeze = true;
29653159 GetTree().clearSelection();
29663160 //freeze = false;
3161
+
3162
+ if (child == null)
3163
+ {
3164
+ return;
3165
+ }
29673166 }
29683167
29693168 //group.addSelectee(child);
....@@ -3032,7 +3231,7 @@
30323231 cameraView.ToggleDL();
30333232 cameraView.repaint();
30343233 return;
3035
- } else if (event.getSource() == toggleTextureItem)
3234
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30363235 {
30373236 cameraView.ToggleTexture();
30383237 // june 2013 copy.HardTouch();
....@@ -3071,7 +3270,7 @@
30713270 frame.validate();
30723271
30733272 return;
3074
- } else if (event.getSource() == toggleSwitchItem)
3273
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30753274 {
30763275 cameraView.ToggleSwitch();
30773276 cameraView.repaint();
....@@ -3102,7 +3301,7 @@
31023301 {
31033302 copy.live ^= true;
31043303 return;
3105
- } else if (event.getSource() == selectCB)
3304
+ } else if (event.getSource() == selectableCB)
31063305 {
31073306 copy.dontselect ^= true;
31083307 return;
....@@ -3287,9 +3486,9 @@
32873486 {
32883487 Close();
32893488 //return true;
3290
- } else if (source == loadItem)
3489
+ } else if (source == openItem)
32913490 {
3292
- load();
3491
+ Open();
32933492 //return true;
32943493 } else if (source == newItem)
32953494 {
....@@ -3314,6 +3513,10 @@
33143513 {
33153514 generatePOV();
33163515 //return true;
3516
+ } else if (event.getSource() == archiveItem)
3517
+ {
3518
+ cTools.Archive(frame);
3519
+ return;
33173520 } else if (source == zBufferItem)
33183521 {
33193522 try
....@@ -3365,8 +3568,8 @@
33653568 try
33663569 {
33673570 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3369
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3571
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3572
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
33703573
33713574 Object3D parent = o.parent;
33723575 o.parent = null;
....@@ -3377,10 +3580,14 @@
33773580
33783581 out.flush();
33793582
3380
- zstream.close();
3583
+ baos //zstream
3584
+ .close();
33813585 out.close();
33823586
3383
- return baos.toByteArray();
3587
+ byte[] bytes = baos.toByteArray();
3588
+
3589
+ System.out.println("save #bytes = " + bytes.length);
3590
+ return bytes;
33843591 } catch (Exception e)
33853592 {
33863593 System.err.println(e);
....@@ -3390,13 +3597,16 @@
33903597
33913598 static public Object Uncompress(byte[] bytes)
33923599 {
3393
- System.out.println("#bytes = " + bytes.length);
3600
+ System.out.println("restore #bytes = " + bytes.length);
33943601 try
33953602 {
33963603 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3397
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3398
- ObjectInputStream in = new ObjectInputStream(istream);
3604
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3605
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
33993606 Object obj = in.readObject();
3607
+
3608
+ bais //istream
3609
+ .close();
34003610 in.close();
34013611
34023612 return obj;
....@@ -3451,39 +3661,77 @@
34513661 return null;
34523662 }
34533663
3454
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
34553664
34563665 public void Save()
3666
+ {
3667
+ //Save(true);
3668
+ Replace();
3669
+ }
3670
+
3671
+ private boolean Equal(byte[] compress, byte[] name)
3672
+ {
3673
+ if (compress.length != name.length)
3674
+ {
3675
+ return false;
3676
+ }
3677
+
3678
+ for (int i=compress.length; --i>=0;)
3679
+ {
3680
+ if (compress[i] != name[i])
3681
+ return false;
3682
+ }
3683
+
3684
+ return true;
3685
+ }
3686
+
3687
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3688
+
3689
+ public boolean Save(boolean user)
34573690 {
34583691 System.err.println("Save");
34593692
34603693 cRadio tab = GetCurrentTab();
34613694
3462
- boolean temp = CameraPane.SWITCH;
3463
- CameraPane.SWITCH = false;
3695
+ byte[] compress = CompressCopy(); // Saved version. No need for "Replace".
34643696
3465
- copy.ExtractBigData(hashtable);
3697
+ boolean thesame = false;
3698
+
3699
+ // Quick heuristic using length. Works only when stream is compressed.
3700
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3701
+ {
3702
+ thesame = true;
3703
+ }
34663704
34673705 //EditorFrame.m_MainFrame.requestFocusInWindow();
3468
- tab.graphs[tab.undoindex++] = Compress(copy);
3469
-
3470
- copy.RestoreBigData(hashtable);
3471
-
3472
- CameraPane.SWITCH = temp;
3473
-
3474
- //assert(hashtable.isEmpty());
3475
-
3476
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3706
+ if (!thesame)
34773707 {
3478
- tab.graphs[i] = null;
3708
+ //tab.user[tab.versionindex] = user;
3709
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3710
+
3711
+ copy.versions[++copy.versionindex] = compress;
3712
+
3713
+ // if (increment)
3714
+ // tab.versionindex++;
34793715 }
34803716
3717
+ //copy.RestoreBigData(versiontable);
3718
+
3719
+ //assert(hashtable.isEmpty());
3720
+
3721
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3722
+ {
3723
+ //tab.user[i] = false;
3724
+ copy.versions[i] = null;
3725
+ }
3726
+
3727
+ SetUndoStates();
3728
+
34813729 // test save
34823730 if (false)
34833731 {
34843732 try
34853733 {
3486
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3734
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
34873735 ObjectOutputStream p = new ObjectOutputStream(ostream);
34883736
34893737 p.writeObject(copy);
....@@ -3496,23 +3744,30 @@
34963744 e.printStackTrace();
34973745 }
34983746 }
3747
+
3748
+ return !thesame;
34993749 }
35003750
35013751 void CopyChanged(Object3D obj)
35023752 {
3753
+ SetUndoStates();
3754
+
35033755 boolean temp = CameraPane.SWITCH;
35043756 CameraPane.SWITCH = false;
35053757
3506
- copy.ExtractBigData(hashtable);
3758
+ copy.ExtractBigData(versiontable);
35073759
35083760 copy.clear();
35093761
3762
+ copy.skyboxname = obj.skyboxname;
3763
+ copy.skyboxext = obj.skyboxext;
3764
+
35103765 for (int i=0; i<obj.Size(); i++)
35113766 {
35123767 copy.add(obj.get(i));
35133768 }
35143769
3515
- copy.RestoreBigData(hashtable);
3770
+ copy.RestoreBigData(versiontable);
35163771
35173772 CameraPane.SWITCH = temp;
35183773
....@@ -3539,42 +3794,130 @@
35393794 refreshContents();
35403795 }
35413796
3542
- public void Undo()
3797
+ cButton undoButton;
3798
+ cButton restoreButton;
3799
+ cButton replaceButton;
3800
+ cButton redoButton;
3801
+
3802
+ boolean muteSlider;
3803
+
3804
+ int VersionCount()
35433805 {
3806
+ int count = 0;
3807
+
3808
+ for (int i = copy.versions.length; --i >= 0;)
3809
+ {
3810
+ if (copy.versions[i] != null)
3811
+ count++;
3812
+ }
3813
+
3814
+ return count;
3815
+ }
3816
+
3817
+ void SetUndoStates()
3818
+ {
3819
+ cRadio tab = GetCurrentTab();
3820
+
3821
+ restoreButton.setEnabled(copy.versionindex != -1);
3822
+ replaceButton.setEnabled(copy.versionindex != -1);
3823
+
3824
+ undoButton.setEnabled(copy.versionindex > 0);
3825
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3826
+
3827
+ muteSlider = true;
3828
+ versionSlider.setMaximum(VersionCount() - 1);
3829
+ versionSlider.setInteger(copy.versionindex);
3830
+ muteSlider = false;
3831
+ }
3832
+
3833
+ public boolean Undo()
3834
+ {
3835
+ // Option?
3836
+ Replace();
3837
+
35443838 System.err.println("Undo");
35453839
35463840 cRadio tab = GetCurrentTab();
35473841
3548
- if (tab.undoindex == 0)
3842
+ if (copy.versionindex == 0)
35493843 {
35503844 java.awt.Toolkit.getDefaultToolkit().beep();
3551
- return;
3845
+ return false;
35523846 }
35533847
3554
- if (tab.graphs[tab.undoindex] == null)
3848
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3849
+// {
3850
+// if (Save(false))
3851
+// tab.versionindex -= 1;
3852
+// else
3853
+// {
3854
+// if (tab.versionindex <= 0)
3855
+// return false;
3856
+// else
3857
+// tab.versionindex -= 1;
3858
+// }
3859
+// }
3860
+
3861
+ copy.versionindex -= 1;
3862
+
3863
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3864
+
3865
+ return true;
3866
+ }
3867
+
3868
+ public boolean Restore()
3869
+ {
3870
+ System.err.println("Restore");
3871
+
3872
+ cRadio tab = GetCurrentTab();
3873
+
3874
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
35553875 {
3556
- Save();
3557
- tab.undoindex -= 1;
3876
+ java.awt.Toolkit.getDefaultToolkit().beep();
3877
+ return false;
35583878 }
35593879
3560
- tab.undoindex -= 1;
3880
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3881
+
3882
+ return true;
3883
+ }
35613884
3562
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3885
+ public boolean Replace()
3886
+ {
3887
+ System.err.println("Replace");
3888
+
3889
+ cRadio tab = GetCurrentTab();
3890
+
3891
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3892
+ {
3893
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3894
+ return false;
3895
+ }
3896
+
3897
+ copy.versions[copy.versionindex] = CompressCopy();
3898
+
3899
+ return true;
35633900 }
35643901
35653902 public void Redo()
35663903 {
3904
+ // Option?
3905
+ Replace();
3906
+
35673907 cRadio tab = GetCurrentTab();
35683908
3569
- if (tab.graphs[tab.undoindex + 1] == null)
3909
+ if (copy.versions[copy.versionindex + 1] == null)
35703910 {
35713911 java.awt.Toolkit.getDefaultToolkit().beep();
35723912 return;
35733913 }
35743914
3575
- tab.undoindex += 1;
3915
+ copy.versionindex += 1;
35763916
3577
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3917
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3918
+
3919
+ //if (!tab.user[tab.versionindex])
3920
+ // tab.graphs[tab.versionindex] = null;
35783921 }
35793922
35803923 void ImportGFD()
....@@ -3726,7 +4069,7 @@
37264069 assert false;
37274070 }
37284071
3729
- void EditSelection()
4072
+ void EditSelection(boolean newWindow)
37304073 {
37314074 }
37324075
....@@ -3870,9 +4213,25 @@
38704213 //copy.Touch();
38714214 }
38724215
4216
+ cNumberSlider versionSlider;
4217
+
38734218 public void stateChanged(ChangeEvent e)
38744219 {
38754220 // assert(false);
4221
+ if (e.getSource() == versionSlider)
4222
+ {
4223
+ if (muteSlider)
4224
+ return;
4225
+
4226
+ int version = versionSlider.getInteger();
4227
+
4228
+ if (copy.versions[version] != null)
4229
+ {
4230
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4231
+ }
4232
+
4233
+ return;
4234
+ }
38764235
38774236 if (freezematerial)
38784237 {
....@@ -4221,7 +4580,7 @@
42214580
42224581 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
42234582 {
4224
- if (Globals.SAVEONMAKE)
4583
+ if (Globals.REPLACEONMAKE) // && resetmodel)
42254584 Save();
42264585 //Tween.set(thing, 0).target(1).start(tweenManager);
42274586 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4309,6 +4668,12 @@
43094668 {
43104669 ResetModel();
43114670 Select(thing.GetTreePath(), true, false); // unselect... false);
4671
+
4672
+ if (thing.Size() == 0)
4673
+ {
4674
+ //EditSelection(false);
4675
+ }
4676
+
43124677 refreshContents();
43134678 }
43144679
....@@ -4457,7 +4822,9 @@
44574822 readobj.ResetDisplayList();
44584823 } catch (Exception e)
44594824 {
4460
- //e.printStackTrace();
4825
+ if (!e.toString().contains("GZIP"))
4826
+ e.printStackTrace();
4827
+
44614828 try
44624829 {
44634830 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4531,12 +4898,14 @@
45314898
45324899 if (readobj != null)
45334900 {
4534
- if (Globals.SAVEONMAKE)
4535
- Save();
4901
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4902
+ // Save();
45364903 try
45374904 {
45384905 //readobj.deepCopySelf(copy);
45394906 copy.clear(); // june 2014
4907
+ copy.skyboxname = readobj.skyboxname;
4908
+ copy.skyboxext = readobj.skyboxext;
45404909 for (int i = 0; i < readobj.size(); i++)
45414910 {
45424911 Object3D child = readobj.get(i); // reserve(i);
....@@ -4577,6 +4946,7 @@
45774946 }
45784947 } catch (ClassCastException e)
45794948 {
4949
+ e.printStackTrace();
45804950 assert (false);
45814951 Composite c = (Composite) copy;
45824952 c.children.clear();
....@@ -4587,13 +4957,24 @@
45874957 c.addChild(csg);
45884958 }
45894959
4960
+ copy.versions = readobj.versions;
4961
+ copy.versionindex = readobj.versionindex;
4962
+
4963
+ if (copy.versions == null)
4964
+ {
4965
+ copy.versions = new byte[100][];
4966
+ copy.versionindex = -1;
4967
+ }
4968
+
4969
+ //? SetUndoStates();
4970
+
45904971 ResetModel();
45914972 copy.HardTouch(); // recompile?
45924973 refreshContents();
45934974 }
45944975 }
45954976
4596
- void load() // throws ClassNotFoundException
4977
+ void Open() // throws ClassNotFoundException
45974978 {
45984979 if (Grafreed.standAlone)
45994980 {
....@@ -4696,6 +5077,7 @@
46965077 //ps.print(buffer.toString());
46975078 } catch (IOException e)
46985079 {
5080
+ e.printStackTrace();
46995081 }
47005082 }
47015083
....@@ -4710,6 +5092,8 @@
47105092 String filename = browser.getFile();
47115093 if (filename != null && filename.length() > 0)
47125094 {
5095
+ if (!filename.endsWith(".gfd"))
5096
+ filename += ".gfd";
47135097 lastname = browser.getDirectory() + filename;
47145098 save();
47155099 }
....@@ -4876,7 +5260,7 @@
48765260 MenuBar menuBar;
48775261 Menu fileMenu;
48785262 MenuItem newItem;
4879
- MenuItem loadItem;
5263
+ MenuItem openItem;
48805264 MenuItem saveItem;
48815265 MenuItem saveAsItem;
48825266 MenuItem exportAsItem;
....@@ -4899,22 +5283,36 @@
48995283 CheckboxMenuItem toggleSwitchItem;
49005284 CheckboxMenuItem toggleRootItem;
49015285 CheckboxMenuItem animationItem;
5286
+ MenuItem archiveItem;
49025287 CheckboxMenuItem toggleHandleItem;
49035288 CheckboxMenuItem togglePaintItem;
49045289 JSplitPane mainPanel;
49055290 JScrollPane scrollpane;
5291
+
49065292 JPanel toolbarPanel;
5293
+
49075294 cGridBag treePanel;
5295
+
49085296 JPanel radioPanel;
49095297 ButtonGroup buttonGroup;
4910
- cGridBag ctrlPanel;
5298
+
5299
+ cGridBag toolboxPanel;
49115300 cGridBag materialPanel;
5301
+ cGridBag ctrlPanel;
5302
+
49125303 JScrollPane infoPanel;
5304
+
49135305 cGridBag optionsPanel;
5306
+
49145307 JTabbedPane objectPanel;
5308
+ boolean materialFlushed;
5309
+ Object3D latestObject;
5310
+
49155311 cGridBag XYZPanel;
5312
+
49165313 JSplitPane gridPanel;
49175314 JSplitPane bigPanel;
5315
+
49185316 cGridBag bigThree;
49195317 cGridBag scenePanel;
49205318 cGridBag centralPanel;
....@@ -5029,7 +5427,7 @@
50295427 cNumberSlider fogField;
50305428 JLabel opacityPowerLabel;
50315429 cNumberSlider opacityPowerField;
5032
- JTree jTree;
5430
+ cTree jTree;
50335431 //ObjectUI parent;
50345432
50355433 cNumberSlider normalpushField;