Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
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
....@@ -35,6 +39,67 @@
3539
3640 GroupEditor callee;
3741 JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ try
48
+ {
49
+ ImageIcon icon = GetIcon(name);
50
+ return new cButton(icon, border);
51
+ }
52
+ catch (Exception e)
53
+ {
54
+ return new cButton(name, border);
55
+ }
56
+ }
57
+
58
+ cToggleButton GetToggleButton(String name, boolean border)
59
+ {
60
+ try
61
+ {
62
+ ImageIcon icon = GetIcon(name);
63
+ return new cToggleButton(icon, border);
64
+ }
65
+ catch (Exception e)
66
+ {
67
+ return new cToggleButton(name, border);
68
+ }
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ try
74
+ {
75
+ ImageIcon icon = GetIcon(name);
76
+ return new cCheckBox(icon, border);
77
+ }
78
+ catch (Exception e)
79
+ {
80
+ return new cCheckBox(name, border);
81
+ }
82
+ }
83
+
84
+ private ImageIcon GetIcon(String name) throws IOException
85
+ {
86
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
+
88
+ if (image.getWidth() != 24 && image.getHeight() != 24)
89
+ {
90
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
+ Graphics2D g = resized.createGraphics();
92
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
+ g.dispose();
96
+
97
+ image = resized;
98
+ }
99
+
100
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
+ return icon;
102
+ }
38103
39104 // SCRIPT
40105
....@@ -145,7 +210,7 @@
145210
146211 objEditor.ctrlPanel.remove(namePanel);
147212
148
- if (!GroupEditor.allparams)
213
+ if (!allparams)
149214 return;
150215
151216 // objEditor.ctrlPanel.remove(liveCB);
....@@ -168,7 +233,8 @@
168233 // objEditor.ctrlPanel.remove(remarkButton);
169234
170235 objEditor.ctrlPanel.remove(setupPanel);
171
- objEditor.ctrlPanel.remove(commandsPanel);
236
+ objEditor.ctrlPanel.remove(setupPanel2);
237
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
172238 objEditor.ctrlPanel.remove(pushPanel);
173239 //objEditor.ctrlPanel.remove(fillPanel);
174240
....@@ -243,6 +309,7 @@
243309 //localCopy.parent = null;
244310
245311 frame = new JFrame();
312
+ frame.setUndecorated(false);
246313 objEditor = this;
247314 this.callee = callee;
248315
....@@ -273,28 +340,49 @@
273340 return frame.action(event, obj);
274341 }
275342
343
+ // Cannot work without static
344
+ static boolean allparams = true;
345
+
346
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
347
+
276348 void SetupMenu()
277349 {
278350 frame.setMenuBar(menuBar = new MenuBar());
279
- menuBar.add(windowMenu = new Menu("File"));
280
- windowMenu.add(loadItem = new MenuItem("Load..."));
281
- windowMenu.add("-");
282
- windowMenu.add(saveItem = new MenuItem("Save"));
283
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
351
+ menuBar.add(fileMenu = new Menu("File"));
352
+ fileMenu.add(newItem = new MenuItem("New"));
353
+ fileMenu.add(openItem = new MenuItem("Open..."));
354
+
355
+ //oe.menuBar.add(menu = new Menu("Include"));
356
+ Menu menu = new Menu("Import");
357
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
358
+ importOBJItem.addActionListener(this);
359
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
360
+ import3DSItem.addActionListener(this);
361
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
362
+ importVRMLX3DItem.addActionListener(this);
363
+ menu.add("-");
364
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
365
+ importGFDItem.addActionListener(this);
366
+ fileMenu.add(menu);
367
+ fileMenu.add("-");
368
+
369
+ fileMenu.add(saveItem = new MenuItem("Save"));
370
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
284371 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
285
- windowMenu.add("-");
286
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
287
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
288
- windowMenu.add("-");
372
+ fileMenu.add("-");
373
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
374
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
375
+ fileMenu.add("-");
289376 if (client.parent != null)
290377 {
291
- windowMenu.add(closeItem = new MenuItem("Close"));
378
+ fileMenu.add(closeItem = new MenuItem("Close"));
292379 } else
293380 {
294
- windowMenu.add(closeItem = new MenuItem("Exit"));
381
+ fileMenu.add(closeItem = new MenuItem("Exit"));
295382 }
296383
297
- loadItem.addActionListener(this);
384
+ newItem.addActionListener(this);
385
+ openItem.addActionListener(this);
298386 saveItem.addActionListener(this);
299387 saveAsItem.addActionListener(this);
300388 exportAsItem.addActionListener(this);
....@@ -302,70 +390,53 @@
302390 //povItem.addActionListener(this);
303391 closeItem.addActionListener(this);
304392
305
- menuBar.add(cameraMenu = new Menu("View"));
306
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
307
- //zBufferItem.addActionListener(this);
308
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
309
- //normalLensItem.addActionListener(this);
310
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
311
- revertCameraItem.addActionListener(this);
312
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
313
- toggleTimelineItem.addItemListener(this);
314
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
315
- toggleFullScreenItem.addItemListener(this);
316
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
317
- cameraMenu.add("-");
318
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
319
- toggleTextureItem.addItemListener(this);
320
- toggleTextureItem.setState(CameraPane.textureon);
321
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
322
- toggleLiveItem.addItemListener(this);
323
- toggleLiveItem.setState(Globals.isLIVE());
324
- cameraMenu.add(stepItem = new MenuItem("Step"));
325
- stepItem.addActionListener(this);
326
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
327
-// toggleDLItem.addItemListener(this);
328
-// toggleDLItem.setState(false);
329
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
330
- toggleRenderItem.addItemListener(this);
331
- toggleRenderItem.setState(!CameraPane.frozen);
332
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
333
- toggleDebugItem.addItemListener(this);
334
- toggleDebugItem.setState(CameraPane.DEBUG);
335
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
336
- toggleFrustumItem.addItemListener(this);
337
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
338
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
339
- toggleFootContactItem.addItemListener(this);
340
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
341
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
342
- toggleRandomItem.addItemListener(this);
343
- toggleRandomItem.setState(CameraPane.RANDOM);
344
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
345
- toggleHandleItem.addItemListener(this);
346
- toggleHandleItem.setState(CameraPane.HANDLES);
347
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
348
- togglePaintItem.addItemListener(this);
349
- togglePaintItem.setState(CameraPane.PAINTMODE);
350
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
351
-// toggleRootItem.addItemListener(this);
352
-// toggleRootItem.setState(false);
353
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
354
-// animationItem.addItemListener(this);
355
-// animationItem.setState(CameraPane.ANIMATION);
356
- cameraMenu.add("-");
357
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
358
- editCameraItem.addActionListener(this);
359
-
360393 objectPanel = new JTabbedPane();
394
+
395
+ ChangeListener changeListener = new ChangeListener()
396
+ {
397
+ public void stateChanged(ChangeEvent changeEvent)
398
+ {
399
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
400
+// {
401
+// if (latestObject != null)
402
+// {
403
+// refreshContents(true);
404
+// SetMaterial(latestObject);
405
+// }
406
+//
407
+// materialFlushed = true;
408
+// }
409
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
410
+// {
411
+// if (listUI.size() == 0)
412
+// EditSelection(false);
413
+// }
414
+
415
+ refreshContents(false); // To refresh Info tab
416
+ }
417
+ };
418
+ objectPanel.addChangeListener(changeListener);
419
+
361420 toolbarPanel = new JPanel();
362421 toolbarPanel.setName("Toolbar");
363422 treePanel = new cGridBag();
364423 treePanel.setName("Tree");
424
+
425
+ editPanel = new cGridBag().setVertical(true);
426
+ editPanel.setName("Edit");
427
+
365428 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
366
- ctrlPanel.setName("Edit");
429
+
430
+ editCommandsPanel = new cGridBag();
431
+ editPanel.add(editCommandsPanel);
432
+ editPanel.add(ctrlPanel);
433
+
434
+ toolboxPanel = new cGridBag().setVertical(false);
435
+ toolboxPanel.setName("Toolbox");
436
+
367437 materialPanel = new cGridBag().setVertical(true);
368438 materialPanel.setName("Material");
439
+
369440 /*JTextPane*/
370441 infoarea = createTextPane();
371442 doc = infoarea.getStyledDocument();
....@@ -378,7 +449,7 @@
378449 // TEXTAREA infoarea.setLineWrap(true);
379450 // TEXTAREA infoarea.setWrapStyleWord(true);
380451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
381
- infoPanel.setPreferredSize(new Dimension(50, 200));
452
+ infoPanel.setPreferredSize(new Dimension(1, 1));
382453 infoPanel.setName("Info");
383454 //infoPanel.setLayout(new BorderLayout());
384455 //infoPanel.add(createTextPane());
....@@ -390,7 +461,14 @@
390461 mainPanel.setDividerSize(9);
391462 mainPanel.setDividerLocation(0.5); //1.0);
392463 mainPanel.setResizeWeight(0.5);
393
-
464
+
465
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
466
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
467
+ divider.setDividerSize(15);
468
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
469
+
470
+ mainPanel.setUI(new BasicSplitPaneUI());
471
+
394472 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
395473 //mainPanel.setLayout(new GridBagLayout());
396474 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -458,10 +536,10 @@
458536 e.printStackTrace();
459537 }
460538
461
- String selection = infoarea.getText();
462
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
463
- java.awt.datatransfer.Clipboard clipboard =
464
- Toolkit.getDefaultToolkit().getSystemClipboard();
539
+// String selection = infoarea.getText();
540
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
541
+// java.awt.datatransfer.Clipboard clipboard =
542
+// Toolkit.getDefaultToolkit().getSystemClipboard();
465543 //clipboard.setContents(data, data);
466544 }
467545
....@@ -484,13 +562,13 @@
484562 //SendInfo("Name:", "bold");
485563 if (sel.GetTextures() != null || debug)
486564 {
487
- si.SendInfo(sel.toString(), "bold");
565
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
488566 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
489567 if (sel.Size() > 0)
490568 {
491569 si.SendInfo("#children = " + sel.Size(), "regular");
492570 }
493
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
571
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
494572 if (debug)
495573 {
496574 try
....@@ -532,7 +610,7 @@
532610 }
533611 if (sel.support != null)
534612 {
535
- si.SendInfo(" support: " + sel.support, "regular");
613
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
536614 }
537615 if (sel.scriptnode != null)
538616 {
....@@ -621,20 +699,121 @@
621699 }
622700 }
623701
702
+//static GraphicsDevice device = GraphicsEnvironment
703
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
704
+
705
+ Rectangle keeprect;
706
+ cRadio radio;
707
+
708
+cButton keepButton;
709
+ cButton twoButton; // Full 3D
710
+ cButton sixButton;
711
+ cButton threeButton;
712
+ cButton sevenButton;
713
+ cButton fourButton; // full panel
714
+ cButton oneButton; // full XYZ
715
+ //cButton currentLayout;
716
+
717
+ boolean maximized;
718
+
719
+ cButton fullscreenLayout;
720
+
721
+ void Minimize()
722
+ {
723
+ frame.setState(Frame.ICONIFIED);
724
+ frame.validate();
725
+ }
726
+
727
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
728
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
729
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
730
+ void Maximize()
731
+ {
732
+ if (CameraPane.FULLSCREEN)
733
+ {
734
+ ToggleFullScreen();
735
+ }
736
+
737
+ if (maximized)
738
+ {
739
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
740
+ }
741
+ else
742
+ {
743
+ keeprect = frame.getBounds();
744
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
745
+// Dimension rect2 = frame.getToolkit().getScreenSize();
746
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
747
+// frame.setState(Frame.MAXIMIZED_BOTH);
748
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
749
+ }
750
+
751
+ maximized ^= true;
752
+
753
+ frame.validate();
754
+ }
755
+
756
+ cButton minButton;
757
+ cButton maxButton;
758
+ cButton fullButton;
759
+
624760 void ToggleFullScreen()
625761 {
626
- if (CameraPane.FULLSCREEN)
762
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
763
+
764
+ cameraView.ToggleFullScreen();
765
+
766
+ if (!CameraPane.FULLSCREEN)
627767 {
628
- frame.getContentPane().remove(/*"Center",*/bigThree);
629
- framePanel.add(bigThree);
630
- frame.getContentPane().add(/*"Center",*/framePanel);
768
+ device.setFullScreenWindow(null);
769
+ frame.dispose();
770
+ frame.setUndecorated(false);
771
+ frame.validate();
772
+ frame.setVisible(true);
773
+
774
+ //frame.setVisible(false);
775
+// frame.removeNotify();
776
+// frame.setUndecorated(false);
777
+// frame.addNotify();
778
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
779
+
780
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
781
+// X framePanel.add(bigThree);
782
+// X frame.getContentPane().add(/*"Center",*/framePanel);
783
+ framePanel.setDividerLocation(46);
784
+
785
+ //frame.setVisible(true);
786
+ radio.layout = keepButton;
787
+ //theFrame = null;
788
+ keepButton = null;
789
+ radio.layout.doClick();
790
+
631791 } else
632792 {
633
- frame.getContentPane().remove(/*"Center",*/framePanel);
634
- framePanel.remove(bigThree);
635
- frame.getContentPane().add(/*"Center",*/bigThree);
793
+ keepButton = radio.layout;
794
+ //keeprect = frame.getBounds();
795
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
796
+// frame.getToolkit().getScreenSize().height);
797
+ //frame.setVisible(false);
798
+
799
+ frame.dispose();
800
+ frame.setUndecorated(true);
801
+ device.setFullScreenWindow(frame);
802
+ frame.validate();
803
+ frame.setVisible(true);
804
+// frame.removeNotify();
805
+// frame.setUndecorated(true);
806
+// frame.addNotify();
807
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
808
+// X framePanel.remove(bigThree);
809
+// X frame.getContentPane().add(/*"Center",*/bigThree);
810
+ framePanel.setDividerLocation(0);
811
+
812
+ radio.layout = fullscreenLayout;
813
+ radio.layout.doClick();
814
+ //frame.setVisible(true);
636815 }
637
- cameraView.ToggleFullScreen();
816
+ frame.validate();
638817 }
639818
640819 private JTextPane createTextPane()
....@@ -735,7 +914,7 @@
735914 protected static ImageIcon createImageIcon(String path,
736915 String description)
737916 {
738
- java.net.URL imgURL = GrafreeD.class.getResource(path);
917
+ java.net.URL imgURL = Grafreed.class.getResource(path);
739918 if (imgURL != null)
740919 {
741920 return new ImageIcon(imgURL, description);
....@@ -767,6 +946,7 @@
767946 // NumberSlider vDivsField;
768947 // JCheckBox endcaps;
769948 JCheckBox liveCB;
949
+ JCheckBox selectCB;
770950 JCheckBox hideCB;
771951 JCheckBox link2masterCB;
772952 JCheckBox markCB;
....@@ -774,7 +954,12 @@
774954 JCheckBox speedupCB;
775955 JCheckBox rewindCB;
776956 JCheckBox flipVCB;
957
+
958
+ cCheckBox toggleTextureCB;
959
+ cCheckBox toggleSwitchCB;
960
+
777961 JComboBox texresMenu;
962
+
778963 JButton resetButton;
779964 JButton stepButton;
780965 JButton stepAllButton;
....@@ -783,9 +968,13 @@
783968 JButton fasterButton;
784969 JButton remarkButton;
785970
971
+ cGridBag editPanel;
972
+ cGridBag editCommandsPanel;
973
+
786974 cGridBag namePanel;
787975 cGridBag setupPanel;
788
- cGridBag commandsPanel;
976
+ cGridBag setupPanel2;
977
+ cGridBag objectCommandsPanel;
789978 cGridBag pushPanel;
790979 cGridBag fillPanel;
791980
....@@ -957,61 +1146,68 @@
9571146 namePanel = new cGridBag();
9581147
9591148 nameField = AddText(namePanel, copy.GetName());
960
- namePanel.add(nameField);
1149
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9611150 oe.ctrlPanel.add(namePanel);
9621151
9631152 oe.ctrlPanel.Return();
9641153
965
- if (!GroupEditor.allparams)
1154
+ if (!allparams)
9661155 return;
9671156
9681157 setupPanel = new cGridBag().setVertical(false);
9691158
9701159 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
9711160 liveCB.setToolTipText("Animate object");
1161
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1162
+ selectCB.setToolTipText("Make object selectable");
1163
+// Return();
9721164 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
9731165 hideCB.setToolTipText("Hide object");
974
-// Return();
9751166 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
976
- markCB.setToolTipText("Set the animation target transform");
1167
+ markCB.setToolTipText("As animation target transform");
9771168
978
- rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
1169
+ setupPanel2 = new cGridBag().setVertical(false);
1170
+
1171
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
9791172 rewindCB.setToolTipText("Rewind animation");
9801173
981
- randomCB = AddCheckBox(setupPanel, "Random", copy.random);
982
- randomCB.setToolTipText("Option for switch node");
1174
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1175
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
9831176
1177
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1178
+ link2masterCB.setToolTipText("Attach to support");
1179
+
9841180 if (Globals.ADVANCED)
9851181 {
986
- link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
987
- link2masterCB.setToolTipText("Attach to support");
988
- speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
1182
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
9891183 speedupCB.setToolTipText("Option motion capture");
9901184 }
9911185
9921186 oe.ctrlPanel.add(setupPanel);
9931187 oe.ctrlPanel.Return();
1188
+ oe.ctrlPanel.add(setupPanel2);
1189
+ oe.ctrlPanel.Return();
9941190
995
- commandsPanel = new cGridBag().setVertical(false);
1191
+ objectCommandsPanel = new cGridBag().setVertical(false);
9961192
997
- resetButton = AddButton(commandsPanel, "Reset");
1193
+ resetButton = AddButton(objectCommandsPanel, "Reset");
9981194 resetButton.setToolTipText("Jump to frame zero");
999
- stepButton = AddButton(commandsPanel, "Step");
1195
+ stepButton = AddButton(objectCommandsPanel, "Step");
10001196 stepButton.setToolTipText("Step one frame");
10011197 // resetAllButton = AddButton(oe, "Reset All");
10021198 // stepAllButton = AddButton(oe, "Step All");
10031199 // Return();
1004
- slowerButton = AddButton(commandsPanel, "Slow");
1200
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
10051201 slowerButton.setToolTipText("Decrease animation speed");
1006
- fasterButton = AddButton(commandsPanel, "Fast");
1202
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
10071203 fasterButton.setToolTipText("Increase animation speed");
1008
- remarkButton = AddButton(commandsPanel, "Remark");
1204
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
10091205 remarkButton.setToolTipText("Set the current transform as the target");
10101206
1011
- oe.ctrlPanel.add(commandsPanel);
1207
+ oe.ctrlPanel.add(objectCommandsPanel);
10121208 oe.ctrlPanel.Return();
10131209
1014
- pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1);
1210
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
10151211 normalpushField = (cNumberSlider)pushPanel.getComponent(1);
10161212 //Return();
10171213
....@@ -1214,8 +1410,11 @@
12141410 //worldPanel.setName("World");
12151411 centralPanel = new cGridBag();
12161412 centralPanel.preferredWidth = 20;
1217
- timelinePanel = new JPanel(new BorderLayout());
1218
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1413
+
1414
+ if (Globals.ADVANCED)
1415
+ {
1416
+ timelinePanel = new JPanel(new BorderLayout());
1417
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
12191418
12201419 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
12211420 cameraPanel.setContinuousLayout(true);
....@@ -1224,7 +1423,10 @@
12241423 // cameraPanel.setDividerSize(9);
12251424 cameraPanel.setResizeWeight(1.0);
12261425
1426
+ }
1427
+
12271428 centralPanel.add(cameraView);
1429
+ centralPanel.setFocusable(true);
12281430 //frame.setJMenuBar(timelineMenubar);
12291431 //centralPanel.add(timelinePanel);
12301432
....@@ -1291,8 +1493,12 @@
12911493 // north.setName("Edit");
12921494 // north.add(ctrlPanel, BorderLayout.NORTH);
12931495 // objectPanel.add(north);
1294
- objectPanel.add(ctrlPanel);
1295
- objectPanel.add(infoPanel);
1496
+ objectPanel.add(editPanel);
1497
+
1498
+ //if (Globals.ADVANCED)
1499
+ objectPanel.add(infoPanel);
1500
+
1501
+ objectPanel.add(toolboxPanel);
12961502
12971503 /*
12981504 aConstraints.gridx = 0;
....@@ -1301,7 +1507,7 @@
13011507 aConstraints.gridy += 1;
13021508 aConstraints.gridwidth = 1;
13031509 mainPanel.add(objectPanel, aConstraints);
1304
- */
1510
+ */
13051511
13061512 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
13071513 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1313,14 +1519,12 @@
13131519 scrollpane.addMouseWheelListener(this); // Default not fast enough
13141520
13151521 /*JTabbedPane*/ scenePanel = new cGridBag();
1316
- scenePanel.preferredWidth = 7;
1522
+ scenePanel.preferredWidth = 6;
13171523
13181524 JTabbedPane tabbedPane = new JTabbedPane();
13191525 tabbedPane.add(scrollpane);
13201526
1321
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1322
-
1323
- optionsPanel = new cGridBag().setVertical(true);
1527
+ optionsPanel = new cGridBag().setVertical(false);
13241528
13251529 optionsPanel.setName("Options");
13261530
....@@ -1328,6 +1532,8 @@
13281532
13291533 tabbedPane.add(optionsPanel);
13301534
1535
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1536
+
13311537 scenePanel.add(tabbedPane);
13321538
13331539 /*
....@@ -1400,9 +1606,9 @@
14001606 // aConstraints.gridheight = 1;
14011607
14021608 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1403
- framePanel.setContinuousLayout(true);
1404
- framePanel.setOneTouchExpandable(true);
1405
- framePanel.setDividerLocation(0.8);
1609
+ framePanel.setContinuousLayout(false);
1610
+ framePanel.setOneTouchExpandable(false);
1611
+ //.setDividerLocation(0.8);
14061612 //framePanel.setDividerSize(15);
14071613 //framePanel.setResizeWeight(0.15);
14081614 framePanel.setName("Frame");
....@@ -1419,10 +1625,15 @@
14191625
14201626 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14211627
1422
- frame.setSize(1024, 768);
1423
- frame.show();
1424
-
1628
+ frame.setSize(1280, 860);
1629
+
1630
+ cameraView.requestFocusInWindow();
1631
+
14251632 gridPanel.setDividerLocation(1.0);
1633
+
1634
+ frame.validate();
1635
+
1636
+ frame.setVisible(true);
14261637
14271638 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
14281639 frame.addWindowListener(new WindowAdapter()
....@@ -1459,19 +1670,22 @@
14591670
14601671 cGridBag editBar = new cGridBag().setVertical(false);
14611672
1462
- editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1673
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
14631674 createMaterialButton.setToolTipText("Create material");
14641675
14651676 /*
14661677 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14671678 */
14681679
1469
- editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1680
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
14701681 clearMaterialButton.setToolTipText("Clear material");
14711682
1472
- editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1473
- editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1474
- editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1683
+ if (Globals.ADVANCED)
1684
+ {
1685
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1686
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1687
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1688
+ }
14751689
14761690 editBar.preferredHeight = 15;
14771691
....@@ -1505,24 +1719,6 @@
15051719 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
15061720 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
15071721 colorSection.add(texture);
1508
-
1509
- cGridBag anisoU = new cGridBag();
1510
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1511
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1512
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1513
- colorSection.add(anisoU);
1514
-
1515
- cGridBag anisoV = new cGridBag();
1516
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1517
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1518
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1519
- colorSection.add(anisoV);
1520
-
1521
- cGridBag shadowbias = new cGridBag();
1522
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1523
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1524
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1525
- colorSection.add(shadowbias);
15261722
15271723 panel.add(new JSeparator());
15281724
....@@ -1574,6 +1770,12 @@
15741770 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15751771 diffuseSection.add(fakedepth);
15761772
1773
+ cGridBag shadowbias = new cGridBag();
1774
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1775
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1776
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1777
+ diffuseSection.add(shadowbias);
1778
+
15771779 panel.add(new JSeparator());
15781780
15791781 panel.add(diffuseSection);
....@@ -1624,6 +1826,18 @@
16241826 // aConstraints.gridy += 1;
16251827 // aConstraints.gridwidth = 1;
16261828
1829
+ cGridBag anisoU = new cGridBag();
1830
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1831
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1832
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1833
+ specularSection.add(anisoU);
1834
+
1835
+ cGridBag anisoV = new cGridBag();
1836
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1837
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1838
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1839
+ specularSection.add(anisoV);
1840
+
16271841
16281842 panel.add(new JSeparator());
16291843
....@@ -1631,35 +1845,35 @@
16311845
16321846 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16331847
1634
- cGridBag globalSection = new cGridBag().setVertical(true);
1848
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16351849
16361850 cGridBag camera = new cGridBag();
16371851 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16381852 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16391853 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1640
- globalSection.add(camera);
1854
+ colorSection.add(camera);
16411855
16421856 cGridBag ambient = new cGridBag();
16431857 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16441858 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16451859 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1646
- globalSection.add(ambient);
1860
+ colorSection.add(ambient);
16471861
16481862 cGridBag backlit = new cGridBag();
16491863 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
16501864 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16511865 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1652
- globalSection.add(backlit);
1866
+ colorSection.add(backlit);
16531867
16541868 cGridBag opacity = new cGridBag();
16551869 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
16561870 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16571871 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1658
- globalSection.add(opacity);
1872
+ colorSection.add(opacity);
16591873
1660
- panel.add(new JSeparator());
1874
+ //panel.add(new JSeparator());
16611875
1662
- panel.add(globalSection);
1876
+ //panel.add(globalSection);
16631877
16641878 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16651879
....@@ -1740,12 +1954,15 @@
17401954 opacityPowerField.addChangeListener(this);
17411955 /**/
17421956
1743
- resetSlidersButton.addActionListener(this);
17441957 clearMaterialButton.addActionListener(this);
17451958 createMaterialButton.addActionListener(this);
1746
-
1747
- propagateToggle.addItemListener(this);
1748
- multiplyToggle.addItemListener(this);
1959
+
1960
+ if (Globals.ADVANCED)
1961
+ {
1962
+ resetSlidersButton.addActionListener(this);
1963
+ propagateToggle.addItemListener(this);
1964
+ multiplyToggle.addItemListener(this);
1965
+ }
17491966 }
17501967
17511968 void DropFile(java.io.File[] files, boolean textures)
....@@ -1763,8 +1980,9 @@
17631980 // 3D models
17641981 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
17651982 {
1766
- lastConverter = new com.jmex.model.converters.MaxToJme();
1767
- LoadFile(filename, lastConverter);
1983
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
1984
+ //LoadFile(filename, lastConverter);
1985
+ LoadObjFile(filename); // New 3ds loader
17681986 continue;
17691987 }
17701988 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1916,7 +2134,7 @@
19162134
19172135 //? flashIt = false;
19182136 CameraPane pane = (CameraPane) cameraView;
1919
- pane.clickStart(location.x, location.y, 0);
2137
+ pane.clickStart(location.x, location.y, 0, 0);
19202138 pane.clickEnd(location.x, location.y, 0, true);
19212139
19222140 if (group.selection.size() == 1)
....@@ -1965,6 +2183,7 @@
19652183 e2.printStackTrace();
19662184 }
19672185 }
2186
+
19682187 LoadJMEThread loadThread;
19692188
19702189 class LoadJMEThread extends Thread
....@@ -2022,6 +2241,7 @@
20222241 //LoadFile0(filename, converter);
20232242 }
20242243 }
2244
+
20252245 LoadOBJThread loadObjThread;
20262246
20272247 class LoadOBJThread extends Thread
....@@ -2100,19 +2320,19 @@
21002320
21012321 void LoadObjFile(String fullname)
21022322 {
2103
- /*
2323
+ System.out.println("Loading " + fullname);
2324
+ /**/
21042325 //lastFilename = fullname;
21052326 if(loadObjThread == null)
21062327 {
2107
- loadObjThread = new LoadOBJThread();
2108
- loadObjThread.start();
2328
+ loadObjThread = new LoadOBJThread();
2329
+ loadObjThread.start();
21092330 }
21102331
21112332 loadObjThread.add(fullname);
2112
- */
2333
+ /**/
21132334
2114
- System.out.println("Loading " + fullname);
2115
- makeSomething(new FileObject(fullname, true), true);
2335
+ //makeSomething(new FileObject(fullname, true), true);
21162336 }
21172337
21182338 void LoadGFDFile(String fullname)
....@@ -2373,11 +2593,11 @@
23732593
23742594 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23752595 {
2376
- if (GrafreeD.standAlone)
2596
+ if (Grafreed.standAlone)
23772597 {
23782598 /**/
23792599 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2380
- browser.show();
2600
+ browser.setVisible(true);
23812601 String filename = browser.getFile();
23822602 if (filename != null && filename.length() > 0)
23832603 {
....@@ -2488,6 +2708,7 @@
24882708 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
24892709 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
24902710 }
2711
+
24912712 //cJME.count++;
24922713 //cJME.count %= 12;
24932714 if (gc)
....@@ -2671,6 +2892,7 @@
26712892 }
26722893 }
26732894 }
2895
+
26742896 cFileSystemPane FSPane;
26752897
26762898 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2724,11 +2946,14 @@
27242946 }
27252947 }
27262948 }
2949
+
27272950 freezematerial = false;
27282951 }
27292952
27302953 void SetMaterial(Object3D object)
27312954 {
2955
+ latestObject = object;
2956
+
27322957 cMaterial mat = object.material;
27332958
27342959 if (mat == null)
....@@ -2737,7 +2962,8 @@
27372962 return;
27382963 }
27392964
2740
- multiplyToggle.setSelected(mat.multiply);
2965
+ if (multiplyToggle != null)
2966
+ multiplyToggle.setSelected(mat.multiply);
27412967
27422968 assert (object.projectedVertices != null);
27432969
....@@ -2839,12 +3065,17 @@
28393065 // }
28403066
28413067 /**/
2842
- if (deselect)
3068
+ if (deselect || child == null)
28433069 {
28443070 //group.deselectAll();
28453071 //freeze = true;
28463072 GetTree().clearSelection();
28473073 //freeze = false;
3074
+
3075
+ if (child == null)
3076
+ {
3077
+ return;
3078
+ }
28483079 }
28493080
28503081 //group.addSelectee(child);
....@@ -2913,7 +3144,7 @@
29133144 cameraView.ToggleDL();
29143145 cameraView.repaint();
29153146 return;
2916
- } else if (event.getSource() == toggleTextureItem)
3147
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29173148 {
29183149 cameraView.ToggleTexture();
29193150 // june 2013 copy.HardTouch();
....@@ -2952,9 +3183,9 @@
29523183 frame.validate();
29533184
29543185 return;
2955
- } else if (event.getSource() == toggleRandomItem)
3186
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29563187 {
2957
- cameraView.ToggleRandom();
3188
+ cameraView.ToggleSwitch();
29583189 cameraView.repaint();
29593190 return;
29603191 } else if (event.getSource() == toggleHandleItem)
....@@ -2982,6 +3213,10 @@
29823213 } else if (event.getSource() == liveCB)
29833214 {
29843215 copy.live ^= true;
3216
+ return;
3217
+ } else if (event.getSource() == selectCB)
3218
+ {
3219
+ copy.dontselect ^= true;
29853220 return;
29863221 } else if (event.getSource() == hideCB)
29873222 {
....@@ -3021,8 +3256,9 @@
30213256
30223257 public void actionPerformed(ActionEvent event)
30233258 {
3259
+ Object source = event.getSource();
30243260 // SCRIPT DIALOG
3025
- if (event.getSource() == okbutton)
3261
+ if (source == okbutton)
30263262 {
30273263 textpanel.setVisible(false);
30283264 textpanel.remove(textarea);
....@@ -3034,7 +3270,7 @@
30343270 textarea = null;
30353271 textpanel = null;
30363272 }
3037
- if (event.getSource() == cancelbutton)
3273
+ if (source == cancelbutton)
30383274 {
30393275 textpanel.setVisible(false);
30403276 textpanel.remove(textarea);
....@@ -3046,50 +3282,50 @@
30463282 //applySelf();
30473283 //client.refreshEditWindow();
30483284 //refreshContents();
3049
- if (event.getSource() == nameField)
3285
+ if (source == nameField)
30503286 {
30513287 //System.out.println("ObjEditor " + event);
30523288 applySelf0(true);
30533289 //parent.applySelf();
30543290 objEditor.refreshContents();
3055
- } else if (event.getSource() == resetButton)
3291
+ } else if (source == resetButton)
30563292 {
30573293 CameraPane.fullreset = true;
30583294 copy.Reset(); // ResetMeshes();
30593295 copy.Touch();
30603296 objEditor.refreshContents();
3061
- } else if (event.getSource() == stepItem)
3297
+ } else if (source == stepItem)
30623298 {
30633299 //cameraView.ONESTEP = true;
30643300 Globals.ONESTEP = true;
30653301 cameraView.repaint();
30663302 return;
3067
- } else if (event.getSource() == stepButton)
3303
+ } else if (source == stepButton)
30683304 {
30693305 copy.Step();
30703306 copy.Touch();
30713307 objEditor.refreshContents();
3072
- } else if (event.getSource() == slowerButton)
3308
+ } else if (source == slowerButton)
30733309 {
30743310 copy.Slower();
30753311 copy.Touch();
30763312 objEditor.refreshContents();
3077
- } else if (event.getSource() == fasterButton)
3313
+ } else if (source == fasterButton)
30783314 {
30793315 copy.Faster();
30803316 copy.Touch();
30813317 objEditor.refreshContents();
3082
- } else if (event.getSource() == remarkButton)
3318
+ } else if (source == remarkButton)
30833319 {
30843320 copy.Remark();
30853321 copy.Touch();
30863322 objEditor.refreshContents();
3087
- } else if (event.getSource() == stepAllButton)
3323
+ } else if (source == stepAllButton)
30883324 {
30893325 copy.StepAll();
30903326 copy.Touch();
30913327 objEditor.refreshContents();
3092
- } else if (event.getSource() == resetAllButton)
3328
+ } else if (source == resetAllButton)
30933329 {
30943330 //CameraPane.fullreset = true;
30953331 copy.ResetAll(); // ResetMeshes();
....@@ -3122,53 +3358,79 @@
31223358 // Close();
31233359 // }
31243360 // else
3125
- if (event.getSource() == resetSlidersButton)
3361
+ if (source == resetSlidersButton)
31263362 {
31273363 ResetSliders();
3128
- } else if (event.getSource() == clearMaterialButton)
3364
+ } else if (source == clearMaterialButton)
31293365 {
31303366 ClearMaterial();
3131
- } else if (event.getSource() == createMaterialButton)
3367
+ } else if (source == createMaterialButton)
31323368 {
31333369 CreateMaterial();
3134
- } else if (event.getSource() == clearPanelButton)
3370
+ } else if (source == clearPanelButton)
31353371 {
31363372 copy.ClearUI();
31373373 refreshContents(true);
3138
- } /*
3139
- }
3140
-
3141
- public boolean action(Event event, Object arg)
3142
- {
3143
- */ else if (event.getSource() == closeItem)
3374
+ } else if (source == importGFDItem)
3375
+ {
3376
+ ImportGFD();
3377
+ } else
3378
+ if (source == importVRMLX3DItem)
3379
+ {
3380
+ ImportVRMLX3D();
3381
+ } else
3382
+ if (source == import3DSItem)
3383
+ {
3384
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3385
+ } else
3386
+ if (source == importOBJItem)
3387
+ {
3388
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3389
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3390
+ browser.setVisible(true);
3391
+ String filename = browser.getFile();
3392
+ if (filename != null && filename.length() > 0)
3393
+ {
3394
+ String fullname = browser.getDirectory() + filename;
3395
+ makeSomething(ReadOBJ(fullname), true);
3396
+ }
3397
+ } else
3398
+ if (source == closeItem)
31443399 {
31453400 Close();
31463401 //return true;
3147
- } else if (event.getSource() == loadItem)
3402
+ } else if (source == openItem)
31483403 {
3149
- load();
3404
+ Open();
31503405 //return true;
3151
- } else if (event.getSource() == saveItem)
3406
+ } else if (source == newItem)
3407
+ {
3408
+ New();
3409
+ } else if (source == saveItem)
31523410 {
31533411 save();
31543412 //return true;
3155
- } else if (event.getSource() == saveAsItem)
3413
+ } else if (source == saveAsItem)
31563414 {
31573415 saveAs();
31583416 //return true;
3159
- } else if (event.getSource() == reexportItem)
3417
+ } else if (source == reexportItem)
31603418 {
31613419 reexport();
31623420 //return true;
3163
- } else if (event.getSource() == exportAsItem)
3421
+ } else if (source == exportAsItem)
31643422 {
31653423 export();
31663424 //return true;
3167
- } else if (event.getSource() == povItem)
3425
+ } else if (source == povItem)
31683426 {
31693427 generatePOV();
31703428 //return true;
3171
- } else if (event.getSource() == zBufferItem)
3429
+ } else if (event.getSource() == archiveItem)
3430
+ {
3431
+ cTools.Archive(frame);
3432
+ return;
3433
+ } else if (source == zBufferItem)
31723434 {
31733435 try
31743436 {
....@@ -3190,21 +3452,8 @@
31903452 cameraView.repaint();
31913453 //return true;
31923454 }
3193
- */ else if (event.getSource() == editCameraItem)
3194
- {
3195
- cameraView.ProtectCamera();
3196
- cameraView.repaint();
3197
- return;
3198
- } else if (event.getSource() == revertCameraItem)
3199
- {
3200
- cameraView.RevertCamera();
3201
- cameraView.repaint();
3202
- return;
3203
-// } else if (event.getSource() == textureButton)
3204
-// {
3205
-// return; // true;
3206
- } else // combos...
3207
- if (event.getSource() == texresMenu)
3455
+ */ else // combos...
3456
+ if (source == texresMenu)
32083457 {
32093458 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32103459 copy.texres = texresMenu.getSelectedIndex();
....@@ -3216,6 +3465,343 @@
32163465 }
32173466 }
32183467
3468
+ void New()
3469
+ {
3470
+ while (copy.Size() > 1)
3471
+ {
3472
+ copy.remove(1);
3473
+ }
3474
+
3475
+ ResetModel();
3476
+ objEditor.refreshContents();
3477
+ }
3478
+
3479
+ static public byte[] Compress(Object3D o)
3480
+ {
3481
+ try
3482
+ {
3483
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3484
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3485
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3486
+
3487
+ Object3D parent = o.parent;
3488
+ o.parent = null;
3489
+
3490
+ out.writeObject(o);
3491
+
3492
+ o.parent = parent;
3493
+
3494
+ out.flush();
3495
+
3496
+ baos //zstream
3497
+ .close();
3498
+ out.close();
3499
+
3500
+ byte[] bytes = baos.toByteArray();
3501
+
3502
+ System.out.println("save #bytes = " + bytes.length);
3503
+ return bytes;
3504
+ } catch (Exception e)
3505
+ {
3506
+ System.err.println(e);
3507
+ return null;
3508
+ }
3509
+ }
3510
+
3511
+ static public Object Uncompress(byte[] bytes)
3512
+ {
3513
+ System.out.println("restore #bytes = " + bytes.length);
3514
+ try
3515
+ {
3516
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3517
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3518
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3519
+ Object obj = in.readObject();
3520
+
3521
+ bais //istream
3522
+ .close();
3523
+ in.close();
3524
+
3525
+ return obj;
3526
+ } catch (Exception e)
3527
+ {
3528
+ System.err.println(e);
3529
+ return null;
3530
+ }
3531
+ }
3532
+
3533
+ static public Object clone(Object o)
3534
+ {
3535
+ try
3536
+ {
3537
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3538
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3539
+
3540
+ out.writeObject(o);
3541
+
3542
+ out.flush();
3543
+ out.close();
3544
+
3545
+ byte[] bytes = baos.toByteArray();
3546
+
3547
+ System.out.println("clone = " + bytes.length);
3548
+
3549
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3550
+ ObjectInputStream in = new ObjectInputStream(bais);
3551
+ Object obj = in.readObject();
3552
+ in.close();
3553
+
3554
+ return obj;
3555
+ } catch (Exception e)
3556
+ {
3557
+ System.err.println(e);
3558
+ return null;
3559
+ }
3560
+ }
3561
+
3562
+ cRadio GetCurrentTab()
3563
+ {
3564
+ cRadio ab;
3565
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3566
+ {
3567
+ ab = (cRadio)e.nextElement();
3568
+ if(ab.GetObject() == copy)
3569
+ {
3570
+ return ab;
3571
+ }
3572
+ }
3573
+
3574
+ return null;
3575
+ }
3576
+
3577
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3578
+
3579
+ public void Save()
3580
+ {
3581
+ Save(true);
3582
+ }
3583
+
3584
+ private boolean Equal(byte[] compress, byte[] name)
3585
+ {
3586
+ if (compress.length != name.length)
3587
+ {
3588
+ return false;
3589
+ }
3590
+
3591
+ for (int i=compress.length; --i>=0;)
3592
+ {
3593
+ if (compress[i] != name[i])
3594
+ return false;
3595
+ }
3596
+
3597
+ return true;
3598
+ }
3599
+
3600
+ public boolean Save(boolean user)
3601
+ {
3602
+ System.err.println("Save");
3603
+
3604
+ cRadio tab = GetCurrentTab();
3605
+
3606
+ boolean temp = CameraPane.SWITCH;
3607
+ CameraPane.SWITCH = false;
3608
+
3609
+ copy.ExtractBigData(hashtable);
3610
+
3611
+ byte[] compress = Compress(copy);
3612
+
3613
+ CameraPane.SWITCH = temp;
3614
+
3615
+ boolean thesame = false;
3616
+
3617
+ // Quick heuristic using length. Works only when stream is compressed.
3618
+ if (tab.undoindex > 0 && tab.graphs[tab.undoindex-1] != null && Equal(compress, tab.graphs[tab.undoindex-1]))
3619
+ {
3620
+ thesame = true;
3621
+ }
3622
+
3623
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3624
+ if (!thesame)
3625
+ {
3626
+ //tab.user[tab.undoindex] = user;
3627
+ boolean increment = tab.graphs[tab.undoindex] == null;
3628
+
3629
+ tab.graphs[tab.undoindex] = compress;
3630
+
3631
+ if (increment)
3632
+ tab.undoindex++;
3633
+ }
3634
+
3635
+ copy.RestoreBigData(hashtable);
3636
+
3637
+ //assert(hashtable.isEmpty());
3638
+
3639
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3640
+ {
3641
+ //tab.user[i] = false;
3642
+ // tab.graphs[i] = null;
3643
+ }
3644
+
3645
+ SetUndoStates();
3646
+
3647
+ // test save
3648
+ if (false)
3649
+ {
3650
+ try
3651
+ {
3652
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3653
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3654
+
3655
+ p.writeObject(copy);
3656
+
3657
+ p.flush();
3658
+
3659
+ ostream.close();
3660
+ } catch (Exception e)
3661
+ {
3662
+ e.printStackTrace();
3663
+ }
3664
+ }
3665
+
3666
+ return !thesame;
3667
+ }
3668
+
3669
+ void CopyChanged(Object3D obj)
3670
+ {
3671
+ SetUndoStates();
3672
+
3673
+ boolean temp = CameraPane.SWITCH;
3674
+ CameraPane.SWITCH = false;
3675
+
3676
+ copy.ExtractBigData(hashtable);
3677
+
3678
+ copy.clear();
3679
+
3680
+ for (int i=0; i<obj.Size(); i++)
3681
+ {
3682
+ copy.add(obj.get(i));
3683
+ }
3684
+
3685
+ copy.RestoreBigData(hashtable);
3686
+
3687
+ CameraPane.SWITCH = temp;
3688
+
3689
+ //assert(hashtable.isEmpty());
3690
+
3691
+ copy.Touch();
3692
+
3693
+ ResetModel();
3694
+ copy.HardTouch(); // recompile?
3695
+
3696
+ cRadio ab;
3697
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3698
+ {
3699
+ ab = (cRadio)e.nextElement();
3700
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3701
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3702
+ if (test != null)
3703
+ {
3704
+ test.editWindow = ab.object.editWindow;
3705
+ ab.object = test;
3706
+ }
3707
+ }
3708
+
3709
+ refreshContents();
3710
+ }
3711
+
3712
+ cButton undoButton;
3713
+ cButton redoButton;
3714
+
3715
+ void SetUndoStates()
3716
+ {
3717
+ cRadio tab = GetCurrentTab();
3718
+
3719
+ undoButton.setEnabled(tab.undoindex > 0);
3720
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
3721
+ }
3722
+
3723
+ public boolean Undo()
3724
+ {
3725
+ System.err.println("Undo");
3726
+
3727
+ cRadio tab = GetCurrentTab();
3728
+
3729
+ if (tab.undoindex == 0)
3730
+ {
3731
+ java.awt.Toolkit.getDefaultToolkit().beep();
3732
+ return false;
3733
+ }
3734
+
3735
+ if (tab.graphs[tab.undoindex] == null) // || !tab.user[tab.undoindex])
3736
+ {
3737
+ if (Save(false))
3738
+ tab.undoindex -= 1;
3739
+ else
3740
+ {
3741
+ if (tab.undoindex <= 0)
3742
+ return false;
3743
+ else
3744
+ tab.undoindex -= 1;
3745
+ }
3746
+ }
3747
+
3748
+ tab.undoindex -= 1;
3749
+
3750
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3751
+
3752
+ return true;
3753
+ }
3754
+
3755
+ public void Redo()
3756
+ {
3757
+ cRadio tab = GetCurrentTab();
3758
+
3759
+ if (tab.graphs[tab.undoindex + 1] == null)
3760
+ {
3761
+ java.awt.Toolkit.getDefaultToolkit().beep();
3762
+ return;
3763
+ }
3764
+
3765
+ tab.undoindex += 1;
3766
+
3767
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3768
+
3769
+ //if (!tab.user[tab.undoindex])
3770
+ // tab.graphs[tab.undoindex] = null;
3771
+ }
3772
+
3773
+ void ImportGFD()
3774
+ {
3775
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3776
+ browser.show();
3777
+ String filename = browser.getFile();
3778
+ if (filename != null && filename.length() > 0)
3779
+ {
3780
+ String fullname = browser.getDirectory() + filename;
3781
+
3782
+ //Object3D readobj =
3783
+ objEditor.ReadGFD(fullname, objEditor);
3784
+ //makeSomething(readobj);
3785
+ }
3786
+ }
3787
+
3788
+ void ImportVRMLX3D()
3789
+ {
3790
+ if (Grafreed.standAlone)
3791
+ {
3792
+ /**/
3793
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3794
+ browser.show();
3795
+ String filename = browser.getFile();
3796
+ if (filename != null && filename.length() > 0)
3797
+ {
3798
+ String fullname = browser.getDirectory() + filename;
3799
+ LoadVRMLX3D(fullname);
3800
+ }
3801
+ /**/
3802
+ }
3803
+ }
3804
+
32193805 void ToggleAnimation()
32203806 {
32213807 if (!Globals.ANIMATION)
....@@ -3231,8 +3817,8 @@
32313817
32323818 Globals.ANIMATION ^= true;
32333819
3234
- GrafreeD.wav.cursor = 0;
3235
- GrafreeD.wav.loop = 0;
3820
+ Grafreed.wav.cursor = 0;
3821
+ Grafreed.wav.loop = 0;
32363822 }
32373823 } else
32383824 {
....@@ -3253,7 +3839,6 @@
32533839 callee.refreshContents();
32543840 } else
32553841 {
3256
- new Exception().printStackTrace();
32573842 System.exit(0);
32583843 }
32593844 }
....@@ -3283,7 +3868,7 @@
32833868 void CreateMaterial()
32843869 {
32853870 //copy.ClearMaterial(); // PATCH
3286
- copy.CreateMaterialS(multiplyToggle.isSelected());
3871
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32873872 if (copy.selection.size() > 0)
32883873 //SetMaterial(copy);
32893874 {
....@@ -3334,7 +3919,7 @@
33343919 assert false;
33353920 }
33363921
3337
- void EditSelection()
3922
+ void EditSelection(boolean newWindow)
33383923 {
33393924 }
33403925
....@@ -3342,11 +3927,11 @@
33423927 {
33433928 copy.ResetBlockLoop(); // temporary problem
33443929
3345
- boolean random = CameraPane.RANDOM;
3346
- CameraPane.RANDOM = false; // parse everything
3930
+ boolean random = CameraPane.SWITCH;
3931
+ CameraPane.SWITCH = false; // parse everything
33473932 copy.ResetDisplayList();
33483933 copy.HardTouch();
3349
- CameraPane.RANDOM = random;
3934
+ CameraPane.SWITCH = random;
33503935 }
33513936
33523937 // public void applySelf()
....@@ -3420,6 +4005,36 @@
34204005 {
34214006 //System.out.println("Propagate = " + propagate);
34224007 copy.UpdateMaterial(anchor, current, propagate);
4008
+
4009
+ if (copy.material != null)
4010
+ {
4011
+ cMaterial mat = copy.material;
4012
+
4013
+ colorField.SetToolTipValue((mat.color));
4014
+ modulationField.SetToolTipValue((mat.modulation));
4015
+ metalnessField.SetToolTipValue((mat.metalness));
4016
+ diffuseField.SetToolTipValue((mat.diffuse));
4017
+ specularField.SetToolTipValue((mat.specular));
4018
+ shininessField.SetToolTipValue((mat.shininess));
4019
+ shiftField.SetToolTipValue((mat.shift));
4020
+ ambientField.SetToolTipValue((mat.ambient));
4021
+ lightareaField.SetToolTipValue((mat.lightarea));
4022
+ diffusenessField.SetToolTipValue((mat.factor));
4023
+ velvetField.SetToolTipValue((mat.velvet));
4024
+ sheenField.SetToolTipValue((mat.sheen));
4025
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4026
+ backlitField.SetToolTipValue((mat.bump));
4027
+ anisoField.SetToolTipValue((mat.aniso));
4028
+ anisoVField.SetToolTipValue((mat.anisoV));
4029
+ cameraField.SetToolTipValue((mat.cameralight));
4030
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4031
+ shadowField.SetToolTipValue((mat.shadow));
4032
+ textureField.SetToolTipValue((mat.texture));
4033
+ opacityField.SetToolTipValue((mat.opacity));
4034
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4035
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4036
+ }
4037
+
34234038 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34244039 {
34254040 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3535,7 +4150,7 @@
35354150 }
35364151
35374152 if (normalpushField != null)
3538
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4153
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35394154 }
35404155
35414156 void SnapObject()
....@@ -3799,6 +4414,8 @@
37994414
38004415 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38014416 {
4417
+ if (Globals.SAVEONMAKE) // && resetmodel)
4418
+ Save();
38024419 //Tween.set(thing, 0).target(1).start(tweenManager);
38034420 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38044421 // if (thing instanceof GenericJointDemo)
....@@ -3885,6 +4502,12 @@
38854502 {
38864503 ResetModel();
38874504 Select(thing.GetTreePath(), true, false); // unselect... false);
4505
+
4506
+ if (thing.Size() == 0)
4507
+ {
4508
+ //EditSelection(false);
4509
+ }
4510
+
38884511 refreshContents();
38894512 }
38904513
....@@ -4002,6 +4625,7 @@
40024625 }
40034626 }
40044627 }
4628
+
40054629 LoadGFDThread loadGFDThread;
40064630
40074631 void ReadGFD(String fullname, iCallBack cb)
....@@ -4021,8 +4645,10 @@
40214645
40224646 try
40234647 {
4648
+ // Try compressed version first.
40244649 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4025
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4650
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4651
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40264652
40274653 readobj = (Object3D) p.readObject();
40284654 istream.close();
....@@ -4030,7 +4656,20 @@
40304656 readobj.ResetDisplayList();
40314657 } catch (Exception e)
40324658 {
4033
- e.printStackTrace();
4659
+ //e.printStackTrace();
4660
+ try
4661
+ {
4662
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4663
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4664
+
4665
+ readobj = (Object3D) p.readObject();
4666
+ istream.close();
4667
+
4668
+ readobj.ResetDisplayList();
4669
+ } catch (Exception e2)
4670
+ {
4671
+ e2.printStackTrace();
4672
+ }
40344673 }
40354674 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40364675 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4076,6 +4715,12 @@
40764715
40774716 void LoadIt(Object obj)
40784717 {
4718
+ if (obj == null)
4719
+ {
4720
+ // Invalid file
4721
+ return;
4722
+ }
4723
+
40794724 System.out.println("Loaded " + obj);
40804725 //new Exception().printStackTrace();
40814726 Object3D readobj = (Object3D) obj;
....@@ -4085,6 +4730,8 @@
40854730
40864731 if (readobj != null)
40874732 {
4733
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4734
+ // Save();
40884735 try
40894736 {
40904737 //readobj.deepCopySelf(copy);
....@@ -4145,9 +4792,9 @@
41454792 }
41464793 }
41474794
4148
- void load() // throws ClassNotFoundException
4795
+ void Open() // throws ClassNotFoundException
41494796 {
4150
- if (GrafreeD.standAlone)
4797
+ if (Grafreed.standAlone)
41514798 {
41524799 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41534800 browser.show();
....@@ -4234,11 +4881,13 @@
42344881 try
42354882 {
42364883 FileOutputStream ostream = new FileOutputStream(lastname);
4237
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4884
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4885
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42384886
42394887 p.writeObject(copy);
42404888 p.flush();
42414889
4890
+ zstream.close();
42424891 ostream.close();
42434892
42444893 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4248,17 +4897,20 @@
42484897 {
42494898 }
42504899 }
4900
+
42514901 String lastname;
42524902
42534903 void saveAs()
42544904 {
4255
- if (GrafreeD.standAlone)
4905
+ if (Grafreed.standAlone)
42564906 {
42574907 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42584908 browser.setVisible(true);
42594909 String filename = browser.getFile();
42604910 if (filename != null && filename.length() > 0)
42614911 {
4912
+ if (!filename.endsWith(".gfd"))
4913
+ filename += ".gfd";
42624914 lastname = browser.getDirectory() + filename;
42634915 save();
42644916 }
....@@ -4357,13 +5009,13 @@
43575009 try
43585010 {
43595011 FileOutputStream ostream = new FileOutputStream(filename);
4360
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4361
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5012
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5013
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43625014
43635015 Object3D objectparent = obj.parent;
43645016 obj.parent = null;
43655017
4366
- Object3D object = (Object3D) GrafreeD.clone(obj);
5018
+ Object3D object = (Object3D) Grafreed.clone(obj);
43675019
43685020 obj.parent = objectparent;
43695021
....@@ -4375,8 +5027,8 @@
43755027 p.writeObject(object);
43765028 p.flush();
43775029
5030
+ zstream.close();
43785031 ostream.close();
4379
- // zstream.close();
43805032
43815033 // group.selection.get(0).parent = parent;
43825034 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4397,7 +5049,7 @@
43975049 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43985050 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43995051 copy.generatePOV(buffer);
4400
- if (GrafreeD.standAlone)
5052
+ if (Grafreed.standAlone)
44015053 {
44025054 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44035055 browser.show();
....@@ -4423,19 +5075,18 @@
44235075 Object3D client;
44245076 Object3D copy;
44255077 MenuBar menuBar;
4426
- Menu windowMenu;
4427
- MenuItem loadItem;
5078
+ Menu fileMenu;
5079
+ MenuItem newItem;
5080
+ MenuItem openItem;
44285081 MenuItem saveItem;
44295082 MenuItem saveAsItem;
44305083 MenuItem exportAsItem;
44315084 MenuItem reexportItem;
44325085 MenuItem povItem;
44335086 MenuItem closeItem;
4434
- Menu cameraMenu;
5087
+
44355088 CheckboxMenuItem zBufferItem;
44365089 //MenuItem normalLensItem;
4437
- MenuItem editCameraItem;
4438
- MenuItem revertCameraItem;
44395090 MenuItem stepItem;
44405091 CheckboxMenuItem toggleLiveItem;
44415092 CheckboxMenuItem toggleFullScreenItem;
....@@ -4446,25 +5097,39 @@
44465097 CheckboxMenuItem toggleFootContactItem;
44475098 CheckboxMenuItem toggleDLItem;
44485099 CheckboxMenuItem toggleTextureItem;
4449
- CheckboxMenuItem toggleRandomItem;
5100
+ CheckboxMenuItem toggleSwitchItem;
44505101 CheckboxMenuItem toggleRootItem;
44515102 CheckboxMenuItem animationItem;
5103
+ MenuItem archiveItem;
44525104 CheckboxMenuItem toggleHandleItem;
44535105 CheckboxMenuItem togglePaintItem;
44545106 JSplitPane mainPanel;
44555107 JScrollPane scrollpane;
5108
+
44565109 JPanel toolbarPanel;
5110
+
44575111 cGridBag treePanel;
5112
+
44585113 JPanel radioPanel;
44595114 ButtonGroup buttonGroup;
4460
- cGridBag ctrlPanel;
5115
+
5116
+ cGridBag toolboxPanel;
44615117 cGridBag materialPanel;
5118
+ cGridBag ctrlPanel;
5119
+
44625120 JScrollPane infoPanel;
5121
+
44635122 cGridBag optionsPanel;
5123
+
44645124 JTabbedPane objectPanel;
5125
+ boolean materialFlushed;
5126
+ Object3D latestObject;
5127
+
44655128 cGridBag XYZPanel;
5129
+
44665130 JSplitPane gridPanel;
44675131 JSplitPane bigPanel;
5132
+
44685133 cGridBag bigThree;
44695134 cGridBag scenePanel;
44705135 cGridBag centralPanel;
....@@ -4579,8 +5244,13 @@
45795244 cNumberSlider fogField;
45805245 JLabel opacityPowerLabel;
45815246 cNumberSlider opacityPowerField;
4582
- JTree jTree;
5247
+ cTree jTree;
45835248 //ObjectUI parent;
45845249
45855250 cNumberSlider normalpushField;
5251
+
5252
+ private MenuItem importGFDItem;
5253
+ private MenuItem importVRMLX3DItem;
5254
+ private MenuItem import3DSItem;
5255
+ private MenuItem importOBJItem;
45865256 }