Normand Briere
2019-08-01 c49ad213b600f844e9070cb09390c3e6d3d13db4
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 Object3D[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 Object3D[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,35 @@
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 Object3D CompressCopy()
854
+ {
855
+ boolean temp = CameraPane.SWITCH;
856
+ CameraPane.SWITCH = false;
857
+
858
+ copy.ExtractBigData(versiontable);
859
+ // if (copy == client)
860
+
861
+ Object3D versions[] = copy.versions;
862
+ copy.versions = null;
863
+
864
+ //byte[] compress = Compress(copy);
865
+ Object3D compress = (Object3D)Grafreed.clone(copy);
866
+
867
+ copy.versions = versions;
868
+
869
+ copy.RestoreBigData(versiontable);
870
+
871
+ CameraPane.SWITCH = temp;
872
+
873
+ return compress;
874
+ }
730875
731876 private JTextPane createTextPane()
732877 {
....@@ -858,7 +1003,7 @@
8581003 // NumberSlider vDivsField;
8591004 // JCheckBox endcaps;
8601005 JCheckBox liveCB;
861
- JCheckBox selectCB;
1006
+ JCheckBox selectableCB;
8621007 JCheckBox hideCB;
8631008 JCheckBox link2masterCB;
8641009 JCheckBox markCB;
....@@ -866,7 +1011,12 @@
8661011 JCheckBox speedupCB;
8671012 JCheckBox rewindCB;
8681013 JCheckBox flipVCB;
1014
+
1015
+ cCheckBox toggleTextureCB;
1016
+ cCheckBox toggleSwitchCB;
1017
+
8691018 JComboBox texresMenu;
1019
+
8701020 JButton resetButton;
8711021 JButton stepButton;
8721022 JButton stepAllButton;
....@@ -1053,38 +1203,42 @@
10531203 namePanel = new cGridBag();
10541204
10551205 nameField = AddText(namePanel, copy.GetName());
1056
- namePanel.add(nameField);
1206
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
10571207 oe.ctrlPanel.add(namePanel);
10581208
10591209 oe.ctrlPanel.Return();
10601210
1061
- if (!GroupEditor.allparams)
1211
+ if (!allparams)
10621212 return;
10631213
10641214 setupPanel = new cGridBag().setVertical(false);
10651215
10661216 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
10671217 liveCB.setToolTipText("Animate object");
1068
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1069
- selectCB.setToolTipText("Make object selectable");
1218
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1219
+ selectableCB.setToolTipText("Make object selectable");
10701220 // Return();
1221
+
10711222 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10721223 hideCB.setToolTipText("Hide object");
10731224 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1074
- markCB.setToolTipText("Set the animation target transform");
1225
+ markCB.setToolTipText("As animation target transform");
1226
+
1227
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10751228
10761229 setupPanel2 = new cGridBag().setVertical(false);
10771230
10781231 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10791232 rewindCB.setToolTipText("Rewind animation");
10801233
1081
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1082
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1234
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1235
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10831236
1237
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1238
+ link2masterCB.setToolTipText("Attach to support");
1239
+
10841240 if (Globals.ADVANCED)
10851241 {
1086
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1087
- link2masterCB.setToolTipText("Attach to support");
10881242 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
10891243 speedupCB.setToolTipText("Option motion capture");
10901244 }
....@@ -1358,6 +1512,7 @@
13581512 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
13591513 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
13601514 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1515
+ //XYZPanel.setName("XYZ");
13611516
13621517 /*
13631518 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1395,12 +1550,29 @@
13951550 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
13961551 //tmp.setName("Edit");
13971552 objectPanel.add(materialPanel);
1553
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1554
+ objectPanel.setToolTipTextAt(0, "Material panel");
1555
+
13981556 // JPanel north = new JPanel(new BorderLayout());
13991557 // north.setName("Edit");
14001558 // north.add(ctrlPanel, BorderLayout.NORTH);
14011559 // objectPanel.add(north);
14021560 objectPanel.add(editPanel);
1403
- objectPanel.add(infoPanel);
1561
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1562
+ objectPanel.setToolTipTextAt(1, "Edit panel");
1563
+
1564
+ //if (Globals.ADVANCED)
1565
+ objectPanel.add(infoPanel);
1566
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1567
+ objectPanel.setToolTipTextAt(2, "Info panel");
1568
+
1569
+ objectPanel.add(XYZPanel);
1570
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1571
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB panel");
1572
+
1573
+ objectPanel.add(toolboxPanel);
1574
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1575
+ objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel");
14041576
14051577 /*
14061578 aConstraints.gridx = 0;
....@@ -1409,7 +1581,7 @@
14091581 aConstraints.gridy += 1;
14101582 aConstraints.gridwidth = 1;
14111583 mainPanel.add(objectPanel, aConstraints);
1412
- */
1584
+ */
14131585
14141586 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14151587 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1421,14 +1593,12 @@
14211593 scrollpane.addMouseWheelListener(this); // Default not fast enough
14221594
14231595 /*JTabbedPane*/ scenePanel = new cGridBag();
1424
- scenePanel.preferredWidth = 6;
1596
+ scenePanel.preferredWidth = 5;
14251597
14261598 JTabbedPane tabbedPane = new JTabbedPane();
14271599 tabbedPane.add(scrollpane);
14281600
1429
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1430
-
1431
- optionsPanel = new cGridBag().setVertical(true);
1601
+ optionsPanel = new cGridBag().setVertical(false);
14321602
14331603 optionsPanel.setName("Options");
14341604
....@@ -1436,6 +1606,8 @@
14361606
14371607 tabbedPane.add(optionsPanel);
14381608
1609
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1610
+
14391611 scenePanel.add(tabbedPane);
14401612
14411613 /*
....@@ -1499,7 +1671,7 @@
14991671 bigThree = new cGridBag();
15001672 bigThree.addComponent(scenePanel);
15011673 bigThree.addComponent(centralPanel);
1502
- bigThree.addComponent(XYZPanel);
1674
+ //bigThree.addComponent(XYZPanel);
15031675
15041676 // // SIDE EFFECT!!!
15051677 // aConstraints.gridx = 0;
....@@ -1508,9 +1680,9 @@
15081680 // aConstraints.gridheight = 1;
15091681
15101682 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1511
- framePanel.setContinuousLayout(true);
1512
- framePanel.setOneTouchExpandable(true);
1513
- framePanel.setDividerLocation(0.8);
1683
+ framePanel.setContinuousLayout(false);
1684
+ framePanel.setOneTouchExpandable(false);
1685
+ //.setDividerLocation(0.8);
15141686 //framePanel.setDividerSize(15);
15151687 //framePanel.setResizeWeight(0.15);
15161688 framePanel.setName("Frame");
....@@ -1528,16 +1700,18 @@
15281700 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
15291701
15301702 frame.setSize(1280, 860);
1531
- frame.setVisible(true);
1532
-
1703
+
15331704 cameraView.requestFocusInWindow();
15341705
15351706 gridPanel.setDividerLocation(1.0);
1707
+
1708
+ frame.validate();
1709
+
1710
+ frame.setVisible(true);
15361711
15371712 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
15381713 frame.addWindowListener(new WindowAdapter()
15391714 {
1540
-
15411715 public void windowClosing(WindowEvent e)
15421716 {
15431717 Close();
....@@ -1599,45 +1773,48 @@
15991773 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16001774
16011775 cGridBag colorSection = new cGridBag().setVertical(true);
1776
+
1777
+ cGridBag huepanel = new cGridBag();
1778
+ cGridBag huelabel = new cGridBag();
1779
+ huelabel.add(GetLabel("icons/hue.png", false));
1780
+ huelabel.preferredWidth = 20;
1781
+ huepanel.add(new cGridBag()); // Label
1782
+ huepanel.add(huelabel); // Field/slider
1783
+
1784
+ huepanel.preferredHeight = 7;
1785
+
1786
+ colorSection.add(huepanel);
16021787
16031788 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);
1789
+
1790
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1791
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1792
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1793
+
16071794 //colorField.preferredWidth = 200;
16081795 colorSection.add(color);
16091796
16101797 cGridBag modulation = new cGridBag();
16111798 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
16121799 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1613
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1800
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
16141801 colorSection.add(modulation);
16151802
1803
+ cGridBag opacity = new cGridBag();
1804
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1805
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1806
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1807
+ colorSection.add(opacity);
1808
+
1809
+ colorSection.add(GetSeparator());
1810
+
16161811 cGridBag texture = new cGridBag();
16171812 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
16181813 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16191814 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16201815 colorSection.add(texture);
16211816
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());
1817
+ panel.add(GetSeparator());
16411818
16421819 panel.add(colorSection);
16431820
....@@ -1687,7 +1864,13 @@
16871864 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16881865 diffuseSection.add(fakedepth);
16891866
1690
- panel.add(new JSeparator());
1867
+ cGridBag shadowbias = new cGridBag();
1868
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1869
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1870
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1871
+ diffuseSection.add(shadowbias);
1872
+
1873
+ panel.add(GetSeparator());
16911874
16921875 panel.add(diffuseSection);
16931876
....@@ -1737,42 +1920,48 @@
17371920 // aConstraints.gridy += 1;
17381921 // aConstraints.gridwidth = 1;
17391922
1923
+ cGridBag anisoU = new cGridBag();
1924
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1925
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1926
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1927
+ specularSection.add(anisoU);
17401928
1741
- panel.add(new JSeparator());
1929
+ cGridBag anisoV = new cGridBag();
1930
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1931
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1932
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1933
+ specularSection.add(anisoV);
1934
+
1935
+
1936
+ panel.add(GetSeparator());
17421937
17431938 panel.add(specularSection);
17441939
17451940 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17461941
1747
- cGridBag globalSection = new cGridBag().setVertical(true);
1942
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17481943
17491944 cGridBag camera = new cGridBag();
17501945 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
17511946 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17521947 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1753
- globalSection.add(camera);
1948
+ colorSection.add(camera);
17541949
17551950 cGridBag ambient = new cGridBag();
17561951 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
17571952 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17581953 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1759
- globalSection.add(ambient);
1954
+ colorSection.add(ambient);
17601955
17611956 cGridBag backlit = new cGridBag();
17621957 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17631958 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17641959 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1765
- globalSection.add(backlit);
1960
+ colorSection.add(backlit);
17661961
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());
1962
+ //panel.add(new JSeparator());
17741963
1775
- panel.add(globalSection);
1964
+ //panel.add(globalSection);
17761965
17771966 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17781967
....@@ -1814,7 +2003,7 @@
18142003 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
18152004 textureSection.add(opacityPower);
18162005
1817
- panel.add(new JSeparator());
2006
+ panel.add(GetSeparator());
18182007
18192008 panel.add(textureSection);
18202009
....@@ -1879,8 +2068,9 @@
18792068 // 3D models
18802069 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18812070 {
1882
- lastConverter = new com.jmex.model.converters.MaxToJme();
1883
- LoadFile(filename, lastConverter);
2071
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2072
+ //LoadFile(filename, lastConverter);
2073
+ LoadObjFile(filename); // New 3ds loader
18842074 continue;
18852075 }
18862076 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2606,6 +2796,7 @@
26062796 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
26072797 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
26082798 }
2799
+
26092800 //cJME.count++;
26102801 //cJME.count %= 12;
26112802 if (gc)
....@@ -2789,6 +2980,7 @@
27892980 }
27902981 }
27912982 }
2983
+
27922984 cFileSystemPane FSPane;
27932985
27942986 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2842,11 +3034,14 @@
28423034 }
28433035 }
28443036 }
3037
+
28453038 freezematerial = false;
28463039 }
28473040
28483041 void SetMaterial(Object3D object)
28493042 {
3043
+ latestObject = object;
3044
+
28503045 cMaterial mat = object.material;
28513046
28523047 if (mat == null)
....@@ -2958,12 +3153,17 @@
29583153 // }
29593154
29603155 /**/
2961
- if (deselect)
3156
+ if (deselect || child == null)
29623157 {
29633158 //group.deselectAll();
29643159 //freeze = true;
29653160 GetTree().clearSelection();
29663161 //freeze = false;
3162
+
3163
+ if (child == null)
3164
+ {
3165
+ return;
3166
+ }
29673167 }
29683168
29693169 //group.addSelectee(child);
....@@ -3032,7 +3232,7 @@
30323232 cameraView.ToggleDL();
30333233 cameraView.repaint();
30343234 return;
3035
- } else if (event.getSource() == toggleTextureItem)
3235
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30363236 {
30373237 cameraView.ToggleTexture();
30383238 // june 2013 copy.HardTouch();
....@@ -3071,7 +3271,7 @@
30713271 frame.validate();
30723272
30733273 return;
3074
- } else if (event.getSource() == toggleSwitchItem)
3274
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30753275 {
30763276 cameraView.ToggleSwitch();
30773277 cameraView.repaint();
....@@ -3102,7 +3302,7 @@
31023302 {
31033303 copy.live ^= true;
31043304 return;
3105
- } else if (event.getSource() == selectCB)
3305
+ } else if (event.getSource() == selectableCB)
31063306 {
31073307 copy.dontselect ^= true;
31083308 return;
....@@ -3287,9 +3487,9 @@
32873487 {
32883488 Close();
32893489 //return true;
3290
- } else if (source == loadItem)
3490
+ } else if (source == openItem)
32913491 {
3292
- load();
3492
+ Open();
32933493 //return true;
32943494 } else if (source == newItem)
32953495 {
....@@ -3314,6 +3514,10 @@
33143514 {
33153515 generatePOV();
33163516 //return true;
3517
+ } else if (event.getSource() == archiveItem)
3518
+ {
3519
+ cTools.Archive(frame);
3520
+ return;
33173521 } else if (source == zBufferItem)
33183522 {
33193523 try
....@@ -3362,11 +3566,12 @@
33623566
33633567 static public byte[] Compress(Object3D o)
33643568 {
3569
+ // Slower to actually compress.
33653570 try
33663571 {
33673572 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3369
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3573
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3574
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
33703575
33713576 Object3D parent = o.parent;
33723577 o.parent = null;
....@@ -3377,10 +3582,14 @@
33773582
33783583 out.flush();
33793584
3380
- zstream.close();
3585
+ baos //zstream
3586
+ .close();
33813587 out.close();
33823588
3383
- return baos.toByteArray();
3589
+ byte[] bytes = baos.toByteArray();
3590
+
3591
+ System.out.println("save #bytes = " + bytes.length);
3592
+ return bytes;
33843593 } catch (Exception e)
33853594 {
33863595 System.err.println(e);
....@@ -3390,13 +3599,16 @@
33903599
33913600 static public Object Uncompress(byte[] bytes)
33923601 {
3393
- System.out.println("#bytes = " + bytes.length);
3602
+ System.out.println("restore #bytes = " + bytes.length);
33943603 try
33953604 {
33963605 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3397
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3398
- ObjectInputStream in = new ObjectInputStream(istream);
3606
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3607
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
33993608 Object obj = in.readObject();
3609
+
3610
+ bais //istream
3611
+ .close();
34003612 in.close();
34013613
34023614 return obj;
....@@ -3451,39 +3663,76 @@
34513663 return null;
34523664 }
34533665
3454
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
34553666
34563667 public void Save()
3668
+ {
3669
+ //Save(true);
3670
+ Replace();
3671
+ }
3672
+
3673
+ private boolean Equal(byte[] compress, byte[] name)
3674
+ {
3675
+ if (compress.length != name.length)
3676
+ {
3677
+ return false;
3678
+ }
3679
+
3680
+ for (int i=compress.length; --i>=0;)
3681
+ {
3682
+ if (compress[i] != name[i])
3683
+ return false;
3684
+ }
3685
+
3686
+ return true;
3687
+ }
3688
+
3689
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3690
+
3691
+ public boolean Save(boolean user)
34573692 {
34583693 System.err.println("Save");
34593694
34603695 cRadio tab = GetCurrentTab();
34613696
3462
- boolean temp = CameraPane.SWITCH;
3463
- CameraPane.SWITCH = false;
3697
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace".
34643698
3465
- copy.ExtractBigData(hashtable);
3699
+ boolean thesame = false;
3700
+
3701
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3702
+// {
3703
+// thesame = true;
3704
+// }
34663705
34673706 //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++)
3707
+ if (!thesame)
34773708 {
3478
- tab.graphs[i] = null;
3709
+ //tab.user[tab.versionindex] = user;
3710
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3711
+
3712
+ copy.versions[++copy.versionindex] = compress;
3713
+
3714
+ // if (increment)
3715
+ // tab.versionindex++;
34793716 }
34803717
3718
+ //copy.RestoreBigData(versiontable);
3719
+
3720
+ //assert(hashtable.isEmpty());
3721
+
3722
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3723
+ {
3724
+ //tab.user[i] = false;
3725
+ copy.versions[i] = null;
3726
+ }
3727
+
3728
+ SetUndoStates();
3729
+
34813730 // test save
34823731 if (false)
34833732 {
34843733 try
34853734 {
3486
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3735
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
34873736 ObjectOutputStream p = new ObjectOutputStream(ostream);
34883737
34893738 p.writeObject(copy);
....@@ -3496,23 +3745,30 @@
34963745 e.printStackTrace();
34973746 }
34983747 }
3748
+
3749
+ return !thesame;
34993750 }
35003751
35013752 void CopyChanged(Object3D obj)
35023753 {
3754
+ SetUndoStates();
3755
+
35033756 boolean temp = CameraPane.SWITCH;
35043757 CameraPane.SWITCH = false;
35053758
3506
- copy.ExtractBigData(hashtable);
3759
+ copy.ExtractBigData(versiontable);
35073760
35083761 copy.clear();
35093762
3763
+ copy.skyboxname = obj.skyboxname;
3764
+ copy.skyboxext = obj.skyboxext;
3765
+
35103766 for (int i=0; i<obj.Size(); i++)
35113767 {
35123768 copy.add(obj.get(i));
35133769 }
35143770
3515
- copy.RestoreBigData(hashtable);
3771
+ copy.RestoreBigData(versiontable);
35163772
35173773 CameraPane.SWITCH = temp;
35183774
....@@ -3539,42 +3795,131 @@
35393795 refreshContents();
35403796 }
35413797
3542
- public void Undo()
3798
+ cButton undoButton;
3799
+ cButton restoreButton;
3800
+ cButton replaceButton;
3801
+ cButton redoButton;
3802
+
3803
+ boolean muteSlider;
3804
+
3805
+ int VersionCount()
35433806 {
3807
+ int count = 0;
3808
+
3809
+ for (int i = copy.versions.length; --i >= 0;)
3810
+ {
3811
+ if (copy.versions[i] != null)
3812
+ count++;
3813
+ }
3814
+
3815
+ return count;
3816
+ }
3817
+
3818
+ void SetUndoStates()
3819
+ {
3820
+ cRadio tab = GetCurrentTab();
3821
+
3822
+ restoreButton.setEnabled(copy.versionindex != -1);
3823
+ replaceButton.setEnabled(copy.versionindex != -1);
3824
+
3825
+ undoButton.setEnabled(copy.versionindex > 0);
3826
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3827
+
3828
+ muteSlider = true;
3829
+ versionSlider.setMaximum(VersionCount() - 1);
3830
+ versionSlider.setInteger(copy.versionindex);
3831
+ muteSlider = false;
3832
+ }
3833
+
3834
+ public boolean Undo()
3835
+ {
3836
+ // Option?
3837
+ Replace();
3838
+
35443839 System.err.println("Undo");
35453840
35463841 cRadio tab = GetCurrentTab();
35473842
3548
- if (tab.undoindex == 0)
3843
+ if (copy.versionindex == 0)
35493844 {
35503845 java.awt.Toolkit.getDefaultToolkit().beep();
3551
- return;
3846
+ return false;
35523847 }
35533848
3554
- if (tab.graphs[tab.undoindex] == null)
3849
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3850
+// {
3851
+// if (Save(false))
3852
+// tab.versionindex -= 1;
3853
+// else
3854
+// {
3855
+// if (tab.versionindex <= 0)
3856
+// return false;
3857
+// else
3858
+// tab.versionindex -= 1;
3859
+// }
3860
+// }
3861
+
3862
+ copy.versionindex -= 1;
3863
+
3864
+ CopyChanged((Object3D)copy.versions[copy.versionindex]);
3865
+
3866
+ return true;
3867
+ }
3868
+
3869
+ public boolean Restore()
3870
+ {
3871
+ System.err.println("Restore");
3872
+
3873
+ cRadio tab = GetCurrentTab();
3874
+
3875
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
35553876 {
3556
- Save();
3557
- tab.undoindex -= 1;
3877
+ java.awt.Toolkit.getDefaultToolkit().beep();
3878
+ return false;
35583879 }
35593880
3560
- tab.undoindex -= 1;
3881
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3882
+ CopyChanged(copy.versions[copy.versionindex]);
3883
+
3884
+ return true;
3885
+ }
35613886
3562
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3887
+ public boolean Replace()
3888
+ {
3889
+ System.err.println("Replace");
3890
+
3891
+ cRadio tab = GetCurrentTab();
3892
+
3893
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3894
+ {
3895
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3896
+ return false;
3897
+ }
3898
+
3899
+ copy.versions[copy.versionindex] = CompressCopy();
3900
+
3901
+ return true;
35633902 }
35643903
35653904 public void Redo()
35663905 {
3906
+ // Option?
3907
+ Replace();
3908
+
35673909 cRadio tab = GetCurrentTab();
35683910
3569
- if (tab.graphs[tab.undoindex + 1] == null)
3911
+ if (copy.versions[copy.versionindex + 1] == null)
35703912 {
35713913 java.awt.Toolkit.getDefaultToolkit().beep();
35723914 return;
35733915 }
35743916
3575
- tab.undoindex += 1;
3917
+ copy.versionindex += 1;
35763918
3577
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3919
+ CopyChanged(copy.versions[copy.versionindex]);
3920
+
3921
+ //if (!tab.user[tab.versionindex])
3922
+ // tab.graphs[tab.versionindex] = null;
35783923 }
35793924
35803925 void ImportGFD()
....@@ -3726,7 +4071,7 @@
37264071 assert false;
37274072 }
37284073
3729
- void EditSelection()
4074
+ void EditSelection(boolean newWindow)
37304075 {
37314076 }
37324077
....@@ -3870,9 +4215,25 @@
38704215 //copy.Touch();
38714216 }
38724217
4218
+ cNumberSlider versionSlider;
4219
+
38734220 public void stateChanged(ChangeEvent e)
38744221 {
38754222 // assert(false);
4223
+ if (e.getSource() == versionSlider)
4224
+ {
4225
+ if (muteSlider)
4226
+ return;
4227
+
4228
+ int version = versionSlider.getInteger();
4229
+
4230
+ if (copy.versions[version] != null)
4231
+ {
4232
+ CopyChanged(copy.versions[copy.versionindex = version]);
4233
+ }
4234
+
4235
+ return;
4236
+ }
38764237
38774238 if (freezematerial)
38784239 {
....@@ -4221,7 +4582,7 @@
42214582
42224583 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
42234584 {
4224
- if (Globals.SAVEONMAKE)
4585
+ if (Globals.REPLACEONMAKE) // && resetmodel)
42254586 Save();
42264587 //Tween.set(thing, 0).target(1).start(tweenManager);
42274588 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4309,6 +4670,12 @@
43094670 {
43104671 ResetModel();
43114672 Select(thing.GetTreePath(), true, false); // unselect... false);
4673
+
4674
+ if (thing.Size() == 0)
4675
+ {
4676
+ //EditSelection(false);
4677
+ }
4678
+
43124679 refreshContents();
43134680 }
43144681
....@@ -4457,7 +4824,9 @@
44574824 readobj.ResetDisplayList();
44584825 } catch (Exception e)
44594826 {
4460
- //e.printStackTrace();
4827
+ if (!e.toString().contains("GZIP"))
4828
+ e.printStackTrace();
4829
+
44614830 try
44624831 {
44634832 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4531,12 +4900,14 @@
45314900
45324901 if (readobj != null)
45334902 {
4534
- if (Globals.SAVEONMAKE)
4535
- Save();
4903
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4904
+ // Save();
45364905 try
45374906 {
45384907 //readobj.deepCopySelf(copy);
45394908 copy.clear(); // june 2014
4909
+ copy.skyboxname = readobj.skyboxname;
4910
+ copy.skyboxext = readobj.skyboxext;
45404911 for (int i = 0; i < readobj.size(); i++)
45414912 {
45424913 Object3D child = readobj.get(i); // reserve(i);
....@@ -4577,6 +4948,7 @@
45774948 }
45784949 } catch (ClassCastException e)
45794950 {
4951
+ e.printStackTrace();
45804952 assert (false);
45814953 Composite c = (Composite) copy;
45824954 c.children.clear();
....@@ -4587,13 +4959,24 @@
45874959 c.addChild(csg);
45884960 }
45894961
4962
+ copy.versions = readobj.versions;
4963
+ copy.versionindex = readobj.versionindex;
4964
+
4965
+ if (copy.versions == null)
4966
+ {
4967
+ copy.versions = new Object3D[100];
4968
+ copy.versionindex = -1;
4969
+ }
4970
+
4971
+ //? SetUndoStates();
4972
+
45904973 ResetModel();
45914974 copy.HardTouch(); // recompile?
45924975 refreshContents();
45934976 }
45944977 }
45954978
4596
- void load() // throws ClassNotFoundException
4979
+ void Open() // throws ClassNotFoundException
45974980 {
45984981 if (Grafreed.standAlone)
45994982 {
....@@ -4696,6 +5079,7 @@
46965079 //ps.print(buffer.toString());
46975080 } catch (IOException e)
46985081 {
5082
+ e.printStackTrace();
46995083 }
47005084 }
47015085
....@@ -4710,6 +5094,8 @@
47105094 String filename = browser.getFile();
47115095 if (filename != null && filename.length() > 0)
47125096 {
5097
+ if (!filename.endsWith(".gfd"))
5098
+ filename += ".gfd";
47135099 lastname = browser.getDirectory() + filename;
47145100 save();
47155101 }
....@@ -4876,7 +5262,7 @@
48765262 MenuBar menuBar;
48775263 Menu fileMenu;
48785264 MenuItem newItem;
4879
- MenuItem loadItem;
5265
+ MenuItem openItem;
48805266 MenuItem saveItem;
48815267 MenuItem saveAsItem;
48825268 MenuItem exportAsItem;
....@@ -4899,22 +5285,36 @@
48995285 CheckboxMenuItem toggleSwitchItem;
49005286 CheckboxMenuItem toggleRootItem;
49015287 CheckboxMenuItem animationItem;
5288
+ MenuItem archiveItem;
49025289 CheckboxMenuItem toggleHandleItem;
49035290 CheckboxMenuItem togglePaintItem;
49045291 JSplitPane mainPanel;
49055292 JScrollPane scrollpane;
5293
+
49065294 JPanel toolbarPanel;
5295
+
49075296 cGridBag treePanel;
5297
+
49085298 JPanel radioPanel;
49095299 ButtonGroup buttonGroup;
4910
- cGridBag ctrlPanel;
5300
+
5301
+ cGridBag toolboxPanel;
49115302 cGridBag materialPanel;
5303
+ cGridBag ctrlPanel;
5304
+
49125305 JScrollPane infoPanel;
5306
+
49135307 cGridBag optionsPanel;
5308
+
49145309 JTabbedPane objectPanel;
5310
+ boolean materialFlushed;
5311
+ Object3D latestObject;
5312
+
49155313 cGridBag XYZPanel;
5314
+
49165315 JSplitPane gridPanel;
49175316 JSplitPane bigPanel;
5317
+
49185318 cGridBag bigThree;
49195319 cGridBag scenePanel;
49205320 cGridBag centralPanel;
....@@ -5029,7 +5429,7 @@
50295429 cNumberSlider fogField;
50305430 JLabel opacityPowerLabel;
50315431 cNumberSlider opacityPowerField;
5032
- JTree jTree;
5432
+ cTree jTree;
50335433 //ObjectUI parent;
50345434
50355435 cNumberSlider normalpushField;