Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
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.*;
....@@ -35,6 +36,54 @@
3536
3637 GroupEditor callee;
3738 JFrame frame;
39
+
40
+ static ObjEditor theFrame;
41
+
42
+ cButton GetButton(String name, boolean border)
43
+ {
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
+ }
53
+ }
54
+
55
+ cCheckBox GetCheckBox(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cCheckBox(name, border);
65
+ }
66
+ }
67
+
68
+ private ImageIcon GetIcon(String name) throws IOException
69
+ {
70
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
71
+
72
+ if (image.getWidth() != 24 && image.getHeight() != 24)
73
+ {
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;
82
+ }
83
+
84
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
85
+ return icon;
86
+ }
3887
3988 // SCRIPT
4089
....@@ -138,34 +187,42 @@
138187 public void closeUI()
139188 {
140189 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
190
+// System.out.println("this = " + this);
191
+// System.out.println("objEditor = " + objEditor);
143192 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
193
+// objEditor.ctrlPanel.remove(nameField);
194
+
195
+ objEditor.ctrlPanel.remove(namePanel);
145196
146197 if (!GroupEditor.allparams)
147198 return;
148199
149
- objEditor.ctrlPanel.remove(liveCB);
150
- objEditor.ctrlPanel.remove(hideCB);
151
- objEditor.ctrlPanel.remove(markCB);
152
-
153
- objEditor.ctrlPanel.remove(randomCB);
154
- objEditor.ctrlPanel.remove(speedupCB);
155
- objEditor.ctrlPanel.remove(rewindCB);
156
-
157
- objEditor.ctrlPanel.remove(resetButton);
158
- objEditor.ctrlPanel.remove(stepButton);
159
-// objEditor.ctrlPanel.remove(stepAllButton);
160
-// objEditor.ctrlPanel.remove(resetAllButton);
161
- objEditor.ctrlPanel.remove(link2masterCB);
162
- //objEditor.ctrlPanel.remove(flipVCB);
163
- //objEditor.ctrlPanel.remove(texresMenu);
164
- objEditor.ctrlPanel.remove(slowerButton);
165
- objEditor.ctrlPanel.remove(fasterButton);
166
- objEditor.ctrlPanel.remove(remarkButton);
200
+// objEditor.ctrlPanel.remove(liveCB);
201
+// objEditor.ctrlPanel.remove(hideCB);
202
+// objEditor.ctrlPanel.remove(markCB);
203
+//
204
+// objEditor.ctrlPanel.remove(randomCB);
205
+// objEditor.ctrlPanel.remove(speedupCB);
206
+// objEditor.ctrlPanel.remove(rewindCB);
207
+//
208
+// objEditor.ctrlPanel.remove(resetButton);
209
+// objEditor.ctrlPanel.remove(stepButton);
210
+//// objEditor.ctrlPanel.remove(stepAllButton);
211
+//// objEditor.ctrlPanel.remove(resetAllButton);
212
+// objEditor.ctrlPanel.remove(link2masterCB);
213
+// //objEditor.ctrlPanel.remove(flipVCB);
214
+// //objEditor.ctrlPanel.remove(texresMenu);
215
+// objEditor.ctrlPanel.remove(slowerButton);
216
+// objEditor.ctrlPanel.remove(fasterButton);
217
+// objEditor.ctrlPanel.remove(remarkButton);
167218
168
- Remove(normalpushField);
219
+ objEditor.ctrlPanel.remove(setupPanel);
220
+ objEditor.ctrlPanel.remove(setupPanel2);
221
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
222
+ objEditor.ctrlPanel.remove(pushPanel);
223
+ //objEditor.ctrlPanel.remove(fillPanel);
224
+
225
+ //Remove(normalpushField);
169226 }
170227
171228 public ObjEditor GetEditor()
....@@ -236,6 +293,7 @@
236293 //localCopy.parent = null;
237294
238295 frame = new JFrame();
296
+ frame.setUndecorated(true);
239297 objEditor = this;
240298 this.callee = callee;
241299
....@@ -269,24 +327,40 @@
269327 void SetupMenu()
270328 {
271329 frame.setMenuBar(menuBar = new MenuBar());
272
- menuBar.add(windowMenu = new Menu("File"));
273
- windowMenu.add(loadItem = new MenuItem("Load..."));
274
- windowMenu.add("-");
275
- windowMenu.add(saveItem = new MenuItem("Save"));
276
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
330
+ menuBar.add(fileMenu = new Menu("File"));
331
+ fileMenu.add(newItem = new MenuItem("New"));
332
+ fileMenu.add(loadItem = new MenuItem("Open..."));
333
+
334
+ //oe.menuBar.add(menu = new Menu("Include"));
335
+ Menu menu = new Menu("Import");
336
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
337
+ importOBJItem.addActionListener(this);
338
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
339
+ import3DSItem.addActionListener(this);
340
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
341
+ importVRMLX3DItem.addActionListener(this);
342
+ menu.add("-");
343
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
344
+ importGFDItem.addActionListener(this);
345
+ fileMenu.add(menu);
346
+ fileMenu.add("-");
347
+
348
+ fileMenu.add(saveItem = new MenuItem("Save"));
349
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277350 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
278
- windowMenu.add("-");
279
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
280
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
281
- windowMenu.add("-");
351
+ fileMenu.add("-");
352
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
353
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
354
+ fileMenu.add("-");
282355 if (client.parent != null)
283356 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
357
+ fileMenu.add(closeItem = new MenuItem("Close"));
285358 } else
286359 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
360
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288361 }
289362
363
+ newItem.addActionListener(this);
290364 loadItem.addActionListener(this);
291365 saveItem.addActionListener(this);
292366 saveAsItem.addActionListener(this);
....@@ -295,79 +369,35 @@
295369 //povItem.addActionListener(this);
296370 closeItem.addActionListener(this);
297371
298
- menuBar.add(cameraMenu = new Menu("View"));
299
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
300
- //zBufferItem.addActionListener(this);
301
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
302
- //normalLensItem.addActionListener(this);
303
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
304
- revertCameraItem.addActionListener(this);
305
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
- toggleTimelineItem.addItemListener(this);
307
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308
- toggleFullScreenItem.addItemListener(this);
309
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
310
- cameraMenu.add("-");
311
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
312
- toggleTextureItem.addItemListener(this);
313
- toggleTextureItem.setState(CameraPane.textureon);
314
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
315
- toggleLiveItem.addItemListener(this);
316
- toggleLiveItem.setState(Globals.isLIVE());
317
- cameraMenu.add(stepItem = new MenuItem("Step"));
318
- stepItem.addActionListener(this);
319
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
320
-// toggleDLItem.addItemListener(this);
321
-// toggleDLItem.setState(false);
322
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
323
- toggleRenderItem.addItemListener(this);
324
- toggleRenderItem.setState(!CameraPane.frozen);
325
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
326
- toggleDebugItem.addItemListener(this);
327
- toggleDebugItem.setState(CameraPane.DEBUG);
328
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
329
- toggleFrustumItem.addItemListener(this);
330
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
331
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
332
- toggleFootContactItem.addItemListener(this);
333
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
334
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
335
- toggleRandomItem.addItemListener(this);
336
- toggleRandomItem.setState(CameraPane.RANDOM);
337
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
338
- toggleHandleItem.addItemListener(this);
339
- toggleHandleItem.setState(CameraPane.HANDLES);
340
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
341
- togglePaintItem.addItemListener(this);
342
- togglePaintItem.setState(CameraPane.PAINTMODE);
343
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
344
-// toggleRootItem.addItemListener(this);
345
-// toggleRootItem.setState(false);
346
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
347
-// animationItem.addItemListener(this);
348
-// animationItem.setState(CameraPane.ANIMATION);
349
- cameraMenu.add("-");
350
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
351
- editCameraItem.addActionListener(this);
352
-
353372 objectPanel = new JTabbedPane();
354373 toolbarPanel = new JPanel();
355374 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
375
+ treePanel = new cGridBag();
357376 treePanel.setName("Tree");
358
- ctrlPanel = new cGridBag(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
377
+
378
+ editPanel = new cGridBag().setVertical(true);
379
+ editPanel.setName("Edit");
380
+
381
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
382
+
383
+ editCommandsPanel = new cGridBag();
384
+ editPanel.add(editCommandsPanel);
385
+ editPanel.add(ctrlPanel);
386
+
360387 materialPanel = new cGridBag().setVertical(true);
388
+
361389 materialPanel.setName("Material");
362390 /*JTextPane*/
363391 infoarea = createTextPane();
392
+ doc = infoarea.getStyledDocument();
393
+
364394 infoarea.setEditable(true);
365395 SetText();
366396 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367397 // infoarea.setOpaque(false);
368398 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
399
+// TEXTAREA infoarea.setLineWrap(true);
400
+// TEXTAREA infoarea.setWrapStyleWord(true);
371401 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372402 infoPanel.setPreferredSize(new Dimension(50, 200));
373403 infoPanel.setName("Info");
....@@ -378,15 +408,15 @@
378408 mainPanel.setName("Main");
379409 mainPanel.setContinuousLayout(true);
380410 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382411 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
412
+ mainPanel.setDividerLocation(0.5); //1.0);
413
+ mainPanel.setResizeWeight(0.5);
384414
385415 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386416 //mainPanel.setLayout(new GridBagLayout());
387417 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
418
+// treePanel.setLayout(new GridBagLayout());
419
+ //ctrlPanel.setLayout(new GridBagLayout());
390420 //materialPanel.setLayout(new GridBagLayout());
391421
392422 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
....@@ -426,7 +456,7 @@
426456 static String newline = "\n";
427457 protected static final String buttonString = "JButton";
428458 StyledDocument doc;
429
- JTextArea infoarea;
459
+ JTextPane infoarea;
430460
431461 void ClearInfo()
432462 {
....@@ -449,10 +479,10 @@
449479 e.printStackTrace();
450480 }
451481
452
- String selection = infoarea.getText();
453
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
454
- java.awt.datatransfer.Clipboard clipboard =
455
- Toolkit.getDefaultToolkit().getSystemClipboard();
482
+// String selection = infoarea.getText();
483
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
484
+// java.awt.datatransfer.Clipboard clipboard =
485
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456486 //clipboard.setContents(data, data);
457487 }
458488
....@@ -475,13 +505,13 @@
475505 //SendInfo("Name:", "bold");
476506 if (sel.GetTextures() != null || debug)
477507 {
478
- si.SendInfo(sel.toString(), "bold");
508
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479509 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480510 if (sel.Size() > 0)
481511 {
482512 si.SendInfo("#children = " + sel.Size(), "regular");
483513 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
514
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485515 if (debug)
486516 {
487517 try
....@@ -493,7 +523,10 @@
493523 }
494524
495525 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
526
+ {
527
+ si.SendInfo(" BBox min: " + minima, "regular");
528
+ si.SendInfo(" BBox max: " + maxima, "regular");
529
+ }
497530
498531 if (sel.bRep != null)
499532 {
....@@ -520,7 +553,7 @@
520553 }
521554 if (sel.support != null)
522555 {
523
- si.SendInfo(" support: " + sel.support, "regular");
556
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524557 }
525558 if (sel.scriptnode != null)
526559 {
....@@ -591,6 +624,9 @@
591624 {
592625 CameraPane.pointflow = (PointFlow) sel;
593626 }
627
+
628
+ si.SendInfo("_____________________", "regular");
629
+ si.SendInfo("", "regular");
594630 }
595631 }
596632
....@@ -606,68 +642,138 @@
606642 }
607643 }
608644
645
+static GraphicsDevice device = GraphicsEnvironment
646
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
647
+
648
+ Rectangle keeprect;
649
+ cRadio radio;
650
+
651
+cButton keepButton;
652
+ cButton twoButton; // Full 3D
653
+ cButton sixButton;
654
+ cButton threeButton;
655
+ cButton sevenButton;
656
+ cButton fourButton; // full panel
657
+ cButton oneButton; // full XYZ
658
+ //cButton currentLayout;
659
+
660
+ boolean maximized;
661
+
662
+ void Minimize()
663
+ {
664
+ frame.setState(Frame.ICONIFIED);
665
+ }
666
+
667
+ void Maximize()
668
+ {
669
+ if (maximized)
670
+ {
671
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
672
+ }
673
+ else
674
+ {
675
+ 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);
679
+// frame.setState(Frame.MAXIMIZED_BOTH);
680
+ }
681
+
682
+ maximized ^= true;
683
+ }
684
+
609685 void ToggleFullScreen()
610686 {
611687 if (CameraPane.FULLSCREEN)
612688 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
689
+ device.setFullScreenWindow(null);
690
+ //frame.setVisible(false);
691
+// frame.removeNotify();
692
+// frame.setUndecorated(false);
693
+// frame.addNotify();
694
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
695
+
696
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
697
+// X framePanel.add(bigThree);
698
+// X frame.getContentPane().add(/*"Center",*/framePanel);
699
+ framePanel.setDividerLocation(1);
700
+
701
+ //frame.setVisible(true);
702
+ radio.layout = keepButton;
703
+ //theFrame = null;
704
+ keepButton = null;
705
+ radio.layout.doClick();
706
+
616707 } else
617708 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
709
+ keepButton = radio.layout;
710
+ //keeprect = frame.getBounds();
711
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
712
+// frame.getToolkit().getScreenSize().height);
713
+ //frame.setVisible(false);
714
+ device.setFullScreenWindow(frame);
715
+// frame.removeNotify();
716
+// frame.setUndecorated(true);
717
+// frame.addNotify();
718
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
719
+// X framePanel.remove(bigThree);
720
+// X frame.getContentPane().add(/*"Center",*/bigThree);
721
+ framePanel.setDividerLocation(0);
722
+
723
+ radio.layout = twoButton;
724
+ radio.layout.doClick();
725
+ //frame.setVisible(true);
621726 }
727
+
622728 cameraView.ToggleFullScreen();
623729 }
624730
625
- private JTextArea createTextPane()
731
+ private JTextPane createTextPane()
626732 {
627
- String[] initString =
628
- {
629
- "This is an editable JTextPane, ", //regular
630
- "another ", //italic
631
- "styled ", //bold
632
- "text ", //small
633
- "component, ", //large
634
- "which supports embedded components..." + newline,//regular
635
- " " + newline, //button
636
- "...and embedded icons..." + newline, //regular
637
- " ", //icon
638
- newline + "JTextPane is a subclass of JEditorPane that "
639
- + "uses a StyledEditorKit and StyledDocument, and provides "
640
- + "cover methods for interacting with those objects."
641
- };
733
+// TEXTAREA String[] initString =
734
+// {
735
+// "This is an editable JTextPane, ", //regular
736
+// "another ", //italic
737
+// "styled ", //bold
738
+// "text ", //small
739
+// "component, ", //large
740
+// "which supports embedded components..." + newline,//regular
741
+// " " + newline, //button
742
+// "...and embedded icons..." + newline, //regular
743
+// " ", //icon
744
+// newline + "JTextPane is a subclass of JEditorPane that "
745
+// + "uses a StyledEditorKit and StyledDocument, and provides "
746
+// + "cover methods for interacting with those objects."
747
+// };
748
+//
749
+// String[] initStyles =
750
+// {
751
+// "regular", "italic", "bold", "small", "large",
752
+// "regular", "button", "regular", "icon",
753
+// "regular"
754
+// };
755
+//
756
+// JTextPane textPane = new JTextPane();
757
+// textPane.setEditable(true);
758
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
759
+// addStylesToDocument(doc);
760
+//
761
+// try
762
+// {
763
+// for (int j = 0; j < 2; j++)
764
+// {
765
+// for (int i = 0; i < initString.length; i++)
766
+// {
767
+// doc.insertString(doc.getLength(), initString[i],
768
+// doc.getStyle(initStyles[i]));
769
+// }
770
+// }
771
+// } catch (BadLocationException ble)
772
+// {
773
+// System.err.println("Couldn't insert initial text into text pane.");
774
+// }
642775
643
- String[] initStyles =
644
- {
645
- "regular", "italic", "bold", "small", "large",
646
- "regular", "button", "regular", "icon",
647
- "regular"
648
- };
649
-
650
- JTextPane textPane = new JTextPane();
651
- textPane.setEditable(true);
652
- /*StyledDocument*/ doc = textPane.getStyledDocument();
653
- addStylesToDocument(doc);
654
-
655
- try
656
- {
657
- for (int j = 0; j < 2; j++)
658
- {
659
- for (int i = 0; i < initString.length; i++)
660
- {
661
- doc.insertString(doc.getLength(), initString[i],
662
- doc.getStyle(initStyles[i]));
663
- }
664
- }
665
- } catch (BadLocationException ble)
666
- {
667
- System.err.println("Couldn't insert initial text into text pane.");
668
- }
669
-
670
- return new JTextArea(); // textPane;
776
+ return new JTextPane(); // textPane;
671777 }
672778
673779 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +826,7 @@
720826 protected static ImageIcon createImageIcon(String path,
721827 String description)
722828 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
829
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724830 if (imgURL != null)
725831 {
726832 return new ImageIcon(imgURL, description);
....@@ -752,6 +858,7 @@
752858 // NumberSlider vDivsField;
753859 // JCheckBox endcaps;
754860 JCheckBox liveCB;
861
+ JCheckBox selectCB;
755862 JCheckBox hideCB;
756863 JCheckBox link2masterCB;
757864 JCheckBox markCB;
....@@ -767,54 +874,48 @@
767874 JButton slowerButton;
768875 JButton fasterButton;
769876 JButton remarkButton;
877
+
878
+ cGridBag editPanel;
879
+ cGridBag editCommandsPanel;
880
+
881
+ cGridBag namePanel;
882
+ cGridBag setupPanel;
883
+ cGridBag setupPanel2;
884
+ cGridBag objectCommandsPanel;
885
+ cGridBag pushPanel;
886
+ cGridBag fillPanel;
770887
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
888
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772889 {
773890 JCheckBox cb;
774891
775
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
776
- oe.aConstraints.gridwidth = 1; // 3;
777
-// oe.aConstraints.weightx = 1;
778
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
779
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
892
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780893 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784894
785895 return cb;
786896 }
787897
788
- cButton AddButton(ObjEditor oe, String label)
898
+ cButton AddButton(cGridBag panel, String label)
789899 {
790900 cButton cb;
791901
792
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
793
- oe.aConstraints.gridwidth = 1;
794
-// oe.aConstraints.weightx = 1;
795
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
796
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
902
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797903 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801904
802905 return cb;
803906 }
804907
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
908
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806909 {
807910 JComboBox combo;
808911
809
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
810
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
811
- oe.aConstraints.gridx += 1;
912
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812913 combo.addActionListener(this);
813914
814915 return combo;
815916 }
816917
817
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow)
918
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818919 {
819920 cGridBag control = new cGridBag();
820921
....@@ -826,12 +927,12 @@
826927 control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827928 combo.setFloat(current);
828929
829
- ctrlPanel.add(control);
930
+ panel.add(control);
830931
831
- return combo;
932
+ return control;
832933 }
833934
834
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current)
935
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
835936 {
836937 cGridBag control = new cGridBag();
837938
....@@ -839,25 +940,21 @@
839940
840941 JLabel jlabel = new JLabel(label);
841942 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
842
- ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
843
- ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
943
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
944
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
844945 combo.setInteger(current);
845946
846
- ctrlPanel.add(control);
947
+ panel.add(control);
847948
848
- return combo;
949
+ return control;
849950 }
850951
851952 JTextArea AddText(cGridBag ctrlPanel, String name)
852953 {
853954 JTextArea text;
854955
855
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
856
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
857956 ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858957 text.addCaretListener(this);
859
- aConstraints.gridx += 1;
860
- aConstraints.gridwidth = 1;
861958
862959 return text;
863960 }
....@@ -896,7 +993,7 @@
896993
897994 /*
898995 */
899
- void Return() // ObjEditor oe)
996
+ void Return0() // ObjEditor oe)
900997 {
901998 aConstraints.gridy += 1;
902999 aConstraints.gridx = 0;
....@@ -951,37 +1048,76 @@
9511048
9521049 void SetupUI2(ObjEditor oe)
9531050 {
954
-// oe.aConstraints.weightx = 0;
955
-// oe.aConstraints.weighty = 0;
956
-// oe.aConstraints.gridx = 0;
957
-// oe.aConstraints.gridy = 0;
958
- SetupName(oe);
1051
+ //SetupName(oe);
1052
+
1053
+ namePanel = new cGridBag();
1054
+
1055
+ nameField = AddText(namePanel, copy.GetName());
1056
+ namePanel.add(nameField);
1057
+ oe.ctrlPanel.add(namePanel);
1058
+
1059
+ oe.ctrlPanel.Return();
9591060
9601061 if (!GroupEditor.allparams)
9611062 return;
9621063
963
- liveCB = AddCheckBox(oe, "Live", copy.live);
964
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
965
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1064
+ setupPanel = new cGridBag().setVertical(false);
1065
+
1066
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1067
+ liveCB.setToolTipText("Animate object");
1068
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1069
+ selectCB.setToolTipText("Make object selectable");
9661070 // Return();
967
- markCB = AddCheckBox(oe, "Mark", copy.marked);
968
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
969
- randomCB = AddCheckBox(oe, "Rand", copy.random);
970
- Return();
971
- resetButton = AddButton(oe, "Reset");
972
- stepButton = AddButton(oe, "Step");
1071
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1072
+ hideCB.setToolTipText("Hide object");
1073
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1074
+ markCB.setToolTipText("Set the animation target transform");
1075
+
1076
+ setupPanel2 = new cGridBag().setVertical(false);
1077
+
1078
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1079
+ rewindCB.setToolTipText("Rewind animation");
1080
+
1081
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1082
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1083
+
1084
+ if (Globals.ADVANCED)
1085
+ {
1086
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1087
+ link2masterCB.setToolTipText("Attach to support");
1088
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1089
+ speedupCB.setToolTipText("Option motion capture");
1090
+ }
1091
+
1092
+ oe.ctrlPanel.add(setupPanel);
1093
+ oe.ctrlPanel.Return();
1094
+ oe.ctrlPanel.add(setupPanel2);
1095
+ oe.ctrlPanel.Return();
1096
+
1097
+ objectCommandsPanel = new cGridBag().setVertical(false);
1098
+
1099
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1100
+ resetButton.setToolTipText("Jump to frame zero");
1101
+ stepButton = AddButton(objectCommandsPanel, "Step");
1102
+ stepButton.setToolTipText("Step one frame");
9731103 // resetAllButton = AddButton(oe, "Reset All");
9741104 // stepAllButton = AddButton(oe, "Step All");
975
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9761105 // Return();
977
- slowerButton = AddButton(oe, "Slow");
978
- fasterButton = AddButton(oe, "Fast");
979
- remarkButton = AddButton(oe, "Rem");
1106
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1107
+ slowerButton.setToolTipText("Decrease animation speed");
1108
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1109
+ fasterButton.setToolTipText("Increase animation speed");
1110
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1111
+ remarkButton.setToolTipText("Set the current transform as the target");
9801112
981
- //Return();
1113
+ oe.ctrlPanel.add(objectCommandsPanel);
1114
+ oe.ctrlPanel.Return();
9821115
983
- //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
1116
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1117
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
9841118 //Return();
1119
+
1120
+ oe.ctrlPanel.Return();
9851121
9861122 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9871123 // ObjEditor.aConstraints.gridx += 1;
....@@ -1076,7 +1212,7 @@
10761212 oe.aConstraints.gridwidth = 1;
10771213 /**/
10781214 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1215
+ oe.ctrlPanel.Return();
10801216
10811217 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821218 //textureButton.setEnabled(false);
....@@ -1180,8 +1316,11 @@
11801316 //worldPanel.setName("World");
11811317 centralPanel = new cGridBag();
11821318 centralPanel.preferredWidth = 20;
1183
- timelinePanel = new JPanel(new BorderLayout());
1184
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1319
+
1320
+ if (Globals.ADVANCED)
1321
+ {
1322
+ timelinePanel = new JPanel(new BorderLayout());
1323
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11851324
11861325 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11871326 cameraPanel.setContinuousLayout(true);
....@@ -1190,7 +1329,10 @@
11901329 // cameraPanel.setDividerSize(9);
11911330 cameraPanel.setResizeWeight(1.0);
11921331
1332
+ }
1333
+
11931334 centralPanel.add(cameraView);
1335
+ centralPanel.setFocusable(true);
11941336 //frame.setJMenuBar(timelineMenubar);
11951337 //centralPanel.add(timelinePanel);
11961338
....@@ -1253,10 +1395,11 @@
12531395 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12541396 //tmp.setName("Edit");
12551397 objectPanel.add(materialPanel);
1256
- JPanel north = new JPanel(new BorderLayout());
1257
- north.setName("Edit");
1258
- north.add(ctrlPanel, BorderLayout.NORTH);
1259
- objectPanel.add(north);
1398
+// JPanel north = new JPanel(new BorderLayout());
1399
+// north.setName("Edit");
1400
+// north.add(ctrlPanel, BorderLayout.NORTH);
1401
+// objectPanel.add(north);
1402
+ objectPanel.add(editPanel);
12601403 objectPanel.add(infoPanel);
12611404
12621405 /*
....@@ -1278,7 +1421,7 @@
12781421 scrollpane.addMouseWheelListener(this); // Default not fast enough
12791422
12801423 /*JTabbedPane*/ scenePanel = new cGridBag();
1281
- scenePanel.preferredWidth = 7;
1424
+ scenePanel.preferredWidth = 6;
12821425
12831426 JTabbedPane tabbedPane = new JTabbedPane();
12841427 tabbedPane.add(scrollpane);
....@@ -1384,9 +1527,11 @@
13841527
13851528 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13861529
1387
- frame.setSize(1024, 768);
1388
- frame.show();
1530
+ frame.setSize(1280, 860);
1531
+ frame.setVisible(true);
13891532
1533
+ cameraView.requestFocusInWindow();
1534
+
13901535 gridPanel.setDividerLocation(1.0);
13911536
13921537 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1415,7 +1560,7 @@
14151560 ctrlPanel.removeAll();
14161561 }
14171562
1418
- void SetupMaterial(cGridBag ctrlPanel)
1563
+ void SetupMaterial(cGridBag panel)
14191564 {
14201565 /*
14211566 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
....@@ -1424,18 +1569,26 @@
14241569
14251570 cGridBag editBar = new cGridBag().setVertical(false);
14261571
1427
- editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints);
1572
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1573
+ createMaterialButton.setToolTipText("Create material");
14281574
14291575 /*
14301576 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14311577 */
14321578
1433
- editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints);
1434
- editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints);
1435
- editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1436
- editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1579
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1580
+ clearMaterialButton.setToolTipText("Clear material");
1581
+
1582
+ if (Globals.ADVANCED)
1583
+ {
1584
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1585
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1586
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1587
+ }
14371588
1438
- ctrlPanel.add(editBar);
1589
+ editBar.preferredHeight = 15;
1590
+
1591
+ panel.add(editBar);
14391592
14401593 /**/
14411594 //aConstraints.weighty = 0;
....@@ -1484,9 +1637,9 @@
14841637 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
14851638 colorSection.add(shadowbias);
14861639
1487
- ctrlPanel.add(new JSeparator());
1640
+ panel.add(new JSeparator());
14881641
1489
- ctrlPanel.add(colorSection);
1642
+ panel.add(colorSection);
14901643
14911644 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14921645
....@@ -1534,9 +1687,9 @@
15341687 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15351688 diffuseSection.add(fakedepth);
15361689
1537
- ctrlPanel.add(new JSeparator());
1690
+ panel.add(new JSeparator());
15381691
1539
- ctrlPanel.add(diffuseSection);
1692
+ panel.add(diffuseSection);
15401693
15411694 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15421695
....@@ -1572,7 +1725,7 @@
15721725 velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15731726 specularSection.add(velvet);
15741727
1575
- shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1);
1728
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
15761729 //Return();
15771730 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
15781731 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
....@@ -1585,9 +1738,9 @@
15851738 // aConstraints.gridwidth = 1;
15861739
15871740
1588
- ctrlPanel.add(new JSeparator());
1741
+ panel.add(new JSeparator());
15891742
1590
- ctrlPanel.add(specularSection);
1743
+ panel.add(specularSection);
15911744
15921745 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15931746
....@@ -1617,9 +1770,9 @@
16171770 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16181771 globalSection.add(opacity);
16191772
1620
- ctrlPanel.add(new JSeparator());
1773
+ panel.add(new JSeparator());
16211774
1622
- ctrlPanel.add(globalSection);
1775
+ panel.add(globalSection);
16231776
16241777 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16251778
....@@ -1661,9 +1814,9 @@
16611814 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16621815 textureSection.add(opacityPower);
16631816
1664
- ctrlPanel.add(new JSeparator());
1817
+ panel.add(new JSeparator());
16651818
1666
- ctrlPanel.add(textureSection);
1819
+ panel.add(textureSection);
16671820
16681821 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16691822
....@@ -1700,12 +1853,15 @@
17001853 opacityPowerField.addChangeListener(this);
17011854 /**/
17021855
1703
- resetSlidersButton.addActionListener(this);
17041856 clearMaterialButton.addActionListener(this);
17051857 createMaterialButton.addActionListener(this);
1706
-
1707
- propagateToggle.addItemListener(this);
1708
- multiplyToggle.addItemListener(this);
1858
+
1859
+ if (Globals.ADVANCED)
1860
+ {
1861
+ resetSlidersButton.addActionListener(this);
1862
+ propagateToggle.addItemListener(this);
1863
+ multiplyToggle.addItemListener(this);
1864
+ }
17091865 }
17101866
17111867 void DropFile(java.io.File[] files, boolean textures)
....@@ -1876,7 +2032,7 @@
18762032
18772033 //? flashIt = false;
18782034 CameraPane pane = (CameraPane) cameraView;
1879
- pane.clickStart(location.x, location.y, 0);
2035
+ pane.clickStart(location.x, location.y, 0, 0);
18802036 pane.clickEnd(location.x, location.y, 0, true);
18812037
18822038 if (group.selection.size() == 1)
....@@ -1925,6 +2081,7 @@
19252081 e2.printStackTrace();
19262082 }
19272083 }
2084
+
19282085 LoadJMEThread loadThread;
19292086
19302087 class LoadJMEThread extends Thread
....@@ -1982,6 +2139,7 @@
19822139 //LoadFile0(filename, converter);
19832140 }
19842141 }
2142
+
19852143 LoadOBJThread loadObjThread;
19862144
19872145 class LoadOBJThread extends Thread
....@@ -2060,19 +2218,19 @@
20602218
20612219 void LoadObjFile(String fullname)
20622220 {
2063
- /*
2221
+ System.out.println("Loading " + fullname);
2222
+ /**/
20642223 //lastFilename = fullname;
20652224 if(loadObjThread == null)
20662225 {
2067
- loadObjThread = new LoadOBJThread();
2068
- loadObjThread.start();
2226
+ loadObjThread = new LoadOBJThread();
2227
+ loadObjThread.start();
20692228 }
20702229
20712230 loadObjThread.add(fullname);
2072
- */
2231
+ /**/
20732232
2074
- System.out.println("Loading " + fullname);
2075
- makeSomething(new FileObject(fullname, true), true);
2233
+ //makeSomething(new FileObject(fullname, true), true);
20762234 }
20772235
20782236 void LoadGFDFile(String fullname)
....@@ -2333,11 +2491,11 @@
23332491
23342492 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23352493 {
2336
- if (GrafreeD.standAlone)
2494
+ if (Grafreed.standAlone)
23372495 {
23382496 /**/
23392497 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2340
- browser.show();
2498
+ browser.setVisible(true);
23412499 String filename = browser.getFile();
23422500 if (filename != null && filename.length() > 0)
23432501 {
....@@ -2482,6 +2640,7 @@
24822640 }
24832641 if (input == null)
24842642 {
2643
+ new Exception().printStackTrace();
24852644 System.exit(0);
24862645 }
24872646
....@@ -2696,7 +2855,8 @@
26962855 return;
26972856 }
26982857
2699
- multiplyToggle.setSelected(mat.multiply);
2858
+ if (multiplyToggle != null)
2859
+ multiplyToggle.setSelected(mat.multiply);
27002860
27012861 assert (object.projectedVertices != null);
27022862
....@@ -2911,9 +3071,9 @@
29113071 frame.validate();
29123072
29133073 return;
2914
- } else if (event.getSource() == toggleRandomItem)
3074
+ } else if (event.getSource() == toggleSwitchItem)
29153075 {
2916
- cameraView.ToggleRandom();
3076
+ cameraView.ToggleSwitch();
29173077 cameraView.repaint();
29183078 return;
29193079 } else if (event.getSource() == toggleHandleItem)
....@@ -2942,6 +3102,10 @@
29423102 {
29433103 copy.live ^= true;
29443104 return;
3105
+ } else if (event.getSource() == selectCB)
3106
+ {
3107
+ copy.dontselect ^= true;
3108
+ return;
29453109 } else if (event.getSource() == hideCB)
29463110 {
29473111 copy.hide ^= true;
....@@ -2956,6 +3120,7 @@
29563120 if (event.getSource() == randomCB)
29573121 {
29583122 copy.random ^= true;
3123
+ objEditor.refreshContents();
29593124 return;
29603125 }
29613126 if (event.getSource() == speedupCB)
....@@ -2979,8 +3144,9 @@
29793144
29803145 public void actionPerformed(ActionEvent event)
29813146 {
3147
+ Object source = event.getSource();
29823148 // SCRIPT DIALOG
2983
- if (event.getSource() == okbutton)
3149
+ if (source == okbutton)
29843150 {
29853151 textpanel.setVisible(false);
29863152 textpanel.remove(textarea);
....@@ -2992,7 +3158,7 @@
29923158 textarea = null;
29933159 textpanel = null;
29943160 }
2995
- if (event.getSource() == cancelbutton)
3161
+ if (source == cancelbutton)
29963162 {
29973163 textpanel.setVisible(false);
29983164 textpanel.remove(textarea);
....@@ -3004,50 +3170,50 @@
30043170 //applySelf();
30053171 //client.refreshEditWindow();
30063172 //refreshContents();
3007
- if (event.getSource() == nameField)
3173
+ if (source == nameField)
30083174 {
30093175 //System.out.println("ObjEditor " + event);
30103176 applySelf0(true);
30113177 //parent.applySelf();
30123178 objEditor.refreshContents();
3013
- } else if (event.getSource() == resetButton)
3179
+ } else if (source == resetButton)
30143180 {
30153181 CameraPane.fullreset = true;
30163182 copy.Reset(); // ResetMeshes();
30173183 copy.Touch();
30183184 objEditor.refreshContents();
3019
- } else if (event.getSource() == stepItem)
3185
+ } else if (source == stepItem)
30203186 {
30213187 //cameraView.ONESTEP = true;
30223188 Globals.ONESTEP = true;
30233189 cameraView.repaint();
30243190 return;
3025
- } else if (event.getSource() == stepButton)
3191
+ } else if (source == stepButton)
30263192 {
30273193 copy.Step();
30283194 copy.Touch();
30293195 objEditor.refreshContents();
3030
- } else if (event.getSource() == slowerButton)
3196
+ } else if (source == slowerButton)
30313197 {
30323198 copy.Slower();
30333199 copy.Touch();
30343200 objEditor.refreshContents();
3035
- } else if (event.getSource() == fasterButton)
3201
+ } else if (source == fasterButton)
30363202 {
30373203 copy.Faster();
30383204 copy.Touch();
30393205 objEditor.refreshContents();
3040
- } else if (event.getSource() == remarkButton)
3206
+ } else if (source == remarkButton)
30413207 {
30423208 copy.Remark();
30433209 copy.Touch();
30443210 objEditor.refreshContents();
3045
- } else if (event.getSource() == stepAllButton)
3211
+ } else if (source == stepAllButton)
30463212 {
30473213 copy.StepAll();
30483214 copy.Touch();
30493215 objEditor.refreshContents();
3050
- } else if (event.getSource() == resetAllButton)
3216
+ } else if (source == resetAllButton)
30513217 {
30523218 //CameraPane.fullreset = true;
30533219 copy.ResetAll(); // ResetMeshes();
....@@ -3080,53 +3246,75 @@
30803246 // Close();
30813247 // }
30823248 // else
3083
- if (event.getSource() == resetSlidersButton)
3249
+ if (source == resetSlidersButton)
30843250 {
30853251 ResetSliders();
3086
- } else if (event.getSource() == clearMaterialButton)
3252
+ } else if (source == clearMaterialButton)
30873253 {
30883254 ClearMaterial();
3089
- } else if (event.getSource() == createMaterialButton)
3255
+ } else if (source == createMaterialButton)
30903256 {
30913257 CreateMaterial();
3092
- } else if (event.getSource() == clearPanelButton)
3258
+ } else if (source == clearPanelButton)
30933259 {
30943260 copy.ClearUI();
30953261 refreshContents(true);
3096
- } /*
3097
- }
3098
-
3099
- public boolean action(Event event, Object arg)
3100
- {
3101
- */ else if (event.getSource() == closeItem)
3262
+ } else if (source == importGFDItem)
3263
+ {
3264
+ ImportGFD();
3265
+ } else
3266
+ if (source == importVRMLX3DItem)
3267
+ {
3268
+ ImportVRMLX3D();
3269
+ } else
3270
+ if (source == import3DSItem)
3271
+ {
3272
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3273
+ } else
3274
+ if (source == importOBJItem)
3275
+ {
3276
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3277
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3278
+ browser.setVisible(true);
3279
+ String filename = browser.getFile();
3280
+ if (filename != null && filename.length() > 0)
3281
+ {
3282
+ String fullname = browser.getDirectory() + filename;
3283
+ makeSomething(ReadOBJ(fullname), true);
3284
+ }
3285
+ } else
3286
+ if (source == closeItem)
31023287 {
31033288 Close();
31043289 //return true;
3105
- } else if (event.getSource() == loadItem)
3290
+ } else if (source == loadItem)
31063291 {
31073292 load();
31083293 //return true;
3109
- } else if (event.getSource() == saveItem)
3294
+ } else if (source == newItem)
3295
+ {
3296
+ New();
3297
+ } else if (source == saveItem)
31103298 {
31113299 save();
31123300 //return true;
3113
- } else if (event.getSource() == saveAsItem)
3301
+ } else if (source == saveAsItem)
31143302 {
31153303 saveAs();
31163304 //return true;
3117
- } else if (event.getSource() == reexportItem)
3305
+ } else if (source == reexportItem)
31183306 {
31193307 reexport();
31203308 //return true;
3121
- } else if (event.getSource() == exportAsItem)
3309
+ } else if (source == exportAsItem)
31223310 {
31233311 export();
31243312 //return true;
3125
- } else if (event.getSource() == povItem)
3313
+ } else if (source == povItem)
31263314 {
31273315 generatePOV();
31283316 //return true;
3129
- } else if (event.getSource() == zBufferItem)
3317
+ } else if (source == zBufferItem)
31303318 {
31313319 try
31323320 {
....@@ -3148,21 +3336,8 @@
31483336 cameraView.repaint();
31493337 //return true;
31503338 }
3151
- */ else if (event.getSource() == editCameraItem)
3152
- {
3153
- cameraView.ProtectCamera();
3154
- cameraView.repaint();
3155
- return;
3156
- } else if (event.getSource() == revertCameraItem)
3157
- {
3158
- cameraView.RevertCamera();
3159
- cameraView.repaint();
3160
- return;
3161
-// } else if (event.getSource() == textureButton)
3162
-// {
3163
-// return; // true;
3164
- } else // combos...
3165
- if (event.getSource() == texresMenu)
3339
+ */ else // combos...
3340
+ if (source == texresMenu)
31663341 {
31673342 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31683343 copy.texres = texresMenu.getSelectedIndex();
....@@ -3174,12 +3349,272 @@
31743349 }
31753350 }
31763351
3352
+ void New()
3353
+ {
3354
+ while (copy.Size() > 1)
3355
+ {
3356
+ copy.remove(1);
3357
+ }
3358
+
3359
+ ResetModel();
3360
+ objEditor.refreshContents();
3361
+ }
3362
+
3363
+ static public byte[] Compress(Object3D o)
3364
+ {
3365
+ try
3366
+ {
3367
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3369
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3370
+
3371
+ Object3D parent = o.parent;
3372
+ o.parent = null;
3373
+
3374
+ out.writeObject(o);
3375
+
3376
+ o.parent = parent;
3377
+
3378
+ out.flush();
3379
+
3380
+ zstream.close();
3381
+ out.close();
3382
+
3383
+ return baos.toByteArray();
3384
+ } catch (Exception e)
3385
+ {
3386
+ System.err.println(e);
3387
+ return null;
3388
+ }
3389
+ }
3390
+
3391
+ static public Object Uncompress(byte[] bytes)
3392
+ {
3393
+ System.out.println("#bytes = " + bytes.length);
3394
+ try
3395
+ {
3396
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3397
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3398
+ ObjectInputStream in = new ObjectInputStream(istream);
3399
+ Object obj = in.readObject();
3400
+ in.close();
3401
+
3402
+ return obj;
3403
+ } catch (Exception e)
3404
+ {
3405
+ System.err.println(e);
3406
+ return null;
3407
+ }
3408
+ }
3409
+
3410
+ static public Object clone(Object o)
3411
+ {
3412
+ try
3413
+ {
3414
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3415
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3416
+
3417
+ out.writeObject(o);
3418
+
3419
+ out.flush();
3420
+ out.close();
3421
+
3422
+ byte[] bytes = baos.toByteArray();
3423
+
3424
+ System.out.println("clone = " + bytes.length);
3425
+
3426
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3427
+ ObjectInputStream in = new ObjectInputStream(bais);
3428
+ Object obj = in.readObject();
3429
+ in.close();
3430
+
3431
+ return obj;
3432
+ } catch (Exception e)
3433
+ {
3434
+ System.err.println(e);
3435
+ return null;
3436
+ }
3437
+ }
3438
+
3439
+ cRadio GetCurrentTab()
3440
+ {
3441
+ cRadio ab;
3442
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3443
+ {
3444
+ ab = (cRadio)e.nextElement();
3445
+ if(ab.GetObject() == copy)
3446
+ {
3447
+ return ab;
3448
+ }
3449
+ }
3450
+
3451
+ return null;
3452
+ }
3453
+
3454
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3455
+
3456
+ public void Save()
3457
+ {
3458
+ System.err.println("Save");
3459
+
3460
+ cRadio tab = GetCurrentTab();
3461
+
3462
+ boolean temp = CameraPane.SWITCH;
3463
+ CameraPane.SWITCH = false;
3464
+
3465
+ copy.ExtractBigData(hashtable);
3466
+
3467
+ //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++)
3477
+ {
3478
+ tab.graphs[i] = null;
3479
+ }
3480
+
3481
+ // test save
3482
+ if (false)
3483
+ {
3484
+ try
3485
+ {
3486
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3487
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3488
+
3489
+ p.writeObject(copy);
3490
+
3491
+ p.flush();
3492
+
3493
+ ostream.close();
3494
+ } catch (Exception e)
3495
+ {
3496
+ e.printStackTrace();
3497
+ }
3498
+ }
3499
+ }
3500
+
3501
+ void CopyChanged(Object3D obj)
3502
+ {
3503
+ boolean temp = CameraPane.SWITCH;
3504
+ CameraPane.SWITCH = false;
3505
+
3506
+ copy.ExtractBigData(hashtable);
3507
+
3508
+ copy.clear();
3509
+
3510
+ for (int i=0; i<obj.Size(); i++)
3511
+ {
3512
+ copy.add(obj.get(i));
3513
+ }
3514
+
3515
+ copy.RestoreBigData(hashtable);
3516
+
3517
+ CameraPane.SWITCH = temp;
3518
+
3519
+ //assert(hashtable.isEmpty());
3520
+
3521
+ copy.Touch();
3522
+
3523
+ ResetModel();
3524
+ copy.HardTouch(); // recompile?
3525
+
3526
+ cRadio ab;
3527
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3528
+ {
3529
+ ab = (cRadio)e.nextElement();
3530
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3531
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3532
+ if (test != null)
3533
+ {
3534
+ test.editWindow = ab.object.editWindow;
3535
+ ab.object = test;
3536
+ }
3537
+ }
3538
+
3539
+ refreshContents();
3540
+ }
3541
+
3542
+ public void Undo()
3543
+ {
3544
+ System.err.println("Undo");
3545
+
3546
+ cRadio tab = GetCurrentTab();
3547
+
3548
+ if (tab.undoindex == 0)
3549
+ {
3550
+ java.awt.Toolkit.getDefaultToolkit().beep();
3551
+ return;
3552
+ }
3553
+
3554
+ if (tab.graphs[tab.undoindex] == null)
3555
+ {
3556
+ Save();
3557
+ tab.undoindex -= 1;
3558
+ }
3559
+
3560
+ tab.undoindex -= 1;
3561
+
3562
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3563
+ }
3564
+
3565
+ public void Redo()
3566
+ {
3567
+ cRadio tab = GetCurrentTab();
3568
+
3569
+ if (tab.graphs[tab.undoindex + 1] == null)
3570
+ {
3571
+ java.awt.Toolkit.getDefaultToolkit().beep();
3572
+ return;
3573
+ }
3574
+
3575
+ tab.undoindex += 1;
3576
+
3577
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3578
+ }
3579
+
3580
+ void ImportGFD()
3581
+ {
3582
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3583
+ browser.show();
3584
+ String filename = browser.getFile();
3585
+ if (filename != null && filename.length() > 0)
3586
+ {
3587
+ String fullname = browser.getDirectory() + filename;
3588
+
3589
+ //Object3D readobj =
3590
+ objEditor.ReadGFD(fullname, objEditor);
3591
+ //makeSomething(readobj);
3592
+ }
3593
+ }
3594
+
3595
+ void ImportVRMLX3D()
3596
+ {
3597
+ if (Grafreed.standAlone)
3598
+ {
3599
+ /**/
3600
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3601
+ browser.show();
3602
+ String filename = browser.getFile();
3603
+ if (filename != null && filename.length() > 0)
3604
+ {
3605
+ String fullname = browser.getDirectory() + filename;
3606
+ LoadVRMLX3D(fullname);
3607
+ }
3608
+ /**/
3609
+ }
3610
+ }
3611
+
31773612 void ToggleAnimation()
31783613 {
31793614 if (!Globals.ANIMATION)
31803615 {
31813616 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3182
- browser.show();
3617
+ browser.setVisible(true);
31833618 String filename = browser.getFile();
31843619 if (filename != null && filename.length() > 0)
31853620 {
....@@ -3189,8 +3624,8 @@
31893624
31903625 Globals.ANIMATION ^= true;
31913626
3192
- GrafreeD.wav.cursor = 0;
3193
- GrafreeD.wav.loop = 0;
3627
+ Grafreed.wav.cursor = 0;
3628
+ Grafreed.wav.loop = 0;
31943629 }
31953630 } else
31963631 {
....@@ -3240,7 +3675,7 @@
32403675 void CreateMaterial()
32413676 {
32423677 //copy.ClearMaterial(); // PATCH
3243
- copy.CreateMaterialS(multiplyToggle.isSelected());
3678
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32443679 if (copy.selection.size() > 0)
32453680 //SetMaterial(copy);
32463681 {
....@@ -3299,11 +3734,11 @@
32993734 {
33003735 copy.ResetBlockLoop(); // temporary problem
33013736
3302
- boolean random = CameraPane.RANDOM;
3303
- CameraPane.RANDOM = false; // parse everything
3737
+ boolean random = CameraPane.SWITCH;
3738
+ CameraPane.SWITCH = false; // parse everything
33043739 copy.ResetDisplayList();
33053740 copy.HardTouch();
3306
- CameraPane.RANDOM = random;
3741
+ CameraPane.SWITCH = random;
33073742 }
33083743
33093744 // public void applySelf()
....@@ -3377,6 +3812,36 @@
33773812 {
33783813 //System.out.println("Propagate = " + propagate);
33793814 copy.UpdateMaterial(anchor, current, propagate);
3815
+
3816
+ if (copy.material != null)
3817
+ {
3818
+ cMaterial mat = copy.material;
3819
+
3820
+ colorField.SetToolTipValue((mat.color));
3821
+ modulationField.SetToolTipValue((mat.modulation));
3822
+ metalnessField.SetToolTipValue((mat.metalness));
3823
+ diffuseField.SetToolTipValue((mat.diffuse));
3824
+ specularField.SetToolTipValue((mat.specular));
3825
+ shininessField.SetToolTipValue((mat.shininess));
3826
+ shiftField.SetToolTipValue((mat.shift));
3827
+ ambientField.SetToolTipValue((mat.ambient));
3828
+ lightareaField.SetToolTipValue((mat.lightarea));
3829
+ diffusenessField.SetToolTipValue((mat.factor));
3830
+ velvetField.SetToolTipValue((mat.velvet));
3831
+ sheenField.SetToolTipValue((mat.sheen));
3832
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3833
+ backlitField.SetToolTipValue((mat.bump));
3834
+ anisoField.SetToolTipValue((mat.aniso));
3835
+ anisoVField.SetToolTipValue((mat.anisoV));
3836
+ cameraField.SetToolTipValue((mat.cameralight));
3837
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3838
+ shadowField.SetToolTipValue((mat.shadow));
3839
+ textureField.SetToolTipValue((mat.texture));
3840
+ opacityField.SetToolTipValue((mat.opacity));
3841
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3842
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3843
+ }
3844
+
33803845 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33813846 {
33823847 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3421,6 +3886,7 @@
34213886 || e.getSource() == apertureField
34223887 || e.getSource() == shadowblurField)
34233888 {
3889
+ new Exception().printStackTrace();
34243890 System.exit(0);
34253891 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34263892 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3491,7 +3957,7 @@
34913957 }
34923958
34933959 if (normalpushField != null)
3494
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3960
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34953961 }
34963962
34973963 void SnapObject()
....@@ -3755,6 +4221,8 @@
37554221
37564222 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37574223 {
4224
+ if (Globals.SAVEONMAKE)
4225
+ Save();
37584226 //Tween.set(thing, 0).target(1).start(tweenManager);
37594227 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37604228 // if (thing instanceof GenericJointDemo)
....@@ -3958,6 +4426,7 @@
39584426 }
39594427 }
39604428 }
4429
+
39614430 LoadGFDThread loadGFDThread;
39624431
39634432 void ReadGFD(String fullname, iCallBack cb)
....@@ -3977,8 +4446,10 @@
39774446
39784447 try
39794448 {
4449
+ // Try compressed version first.
39804450 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3981
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4451
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4452
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39824453
39834454 readobj = (Object3D) p.readObject();
39844455 istream.close();
....@@ -3986,7 +4457,20 @@
39864457 readobj.ResetDisplayList();
39874458 } catch (Exception e)
39884459 {
3989
- e.printStackTrace();
4460
+ //e.printStackTrace();
4461
+ try
4462
+ {
4463
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4464
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4465
+
4466
+ readobj = (Object3D) p.readObject();
4467
+ istream.close();
4468
+
4469
+ readobj.ResetDisplayList();
4470
+ } catch (Exception e2)
4471
+ {
4472
+ e2.printStackTrace();
4473
+ }
39904474 }
39914475 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
39924476 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4032,6 +4516,12 @@
40324516
40334517 void LoadIt(Object obj)
40344518 {
4519
+ if (obj == null)
4520
+ {
4521
+ // Invalid file
4522
+ return;
4523
+ }
4524
+
40354525 System.out.println("Loaded " + obj);
40364526 //new Exception().printStackTrace();
40374527 Object3D readobj = (Object3D) obj;
....@@ -4041,6 +4531,8 @@
40414531
40424532 if (readobj != null)
40434533 {
4534
+ if (Globals.SAVEONMAKE)
4535
+ Save();
40444536 try
40454537 {
40464538 //readobj.deepCopySelf(copy);
....@@ -4103,7 +4595,7 @@
41034595
41044596 void load() // throws ClassNotFoundException
41054597 {
4106
- if (GrafreeD.standAlone)
4598
+ if (Grafreed.standAlone)
41074599 {
41084600 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41094601 browser.show();
....@@ -4190,11 +4682,13 @@
41904682 try
41914683 {
41924684 FileOutputStream ostream = new FileOutputStream(lastname);
4193
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4685
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4686
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
41944687
41954688 p.writeObject(copy);
41964689 p.flush();
41974690
4691
+ zstream.close();
41984692 ostream.close();
41994693
42004694 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4204,11 +4698,12 @@
42044698 {
42054699 }
42064700 }
4701
+
42074702 String lastname;
42084703
42094704 void saveAs()
42104705 {
4211
- if (GrafreeD.standAlone)
4706
+ if (Grafreed.standAlone)
42124707 {
42134708 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42144709 browser.setVisible(true);
....@@ -4313,13 +4808,13 @@
43134808 try
43144809 {
43154810 FileOutputStream ostream = new FileOutputStream(filename);
4316
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4317
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4811
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4812
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43184813
43194814 Object3D objectparent = obj.parent;
43204815 obj.parent = null;
43214816
4322
- Object3D object = (Object3D) GrafreeD.clone(obj);
4817
+ Object3D object = (Object3D) Grafreed.clone(obj);
43234818
43244819 obj.parent = objectparent;
43254820
....@@ -4331,8 +4826,8 @@
43314826 p.writeObject(object);
43324827 p.flush();
43334828
4829
+ zstream.close();
43344830 ostream.close();
4335
- // zstream.close();
43364831
43374832 // group.selection.get(0).parent = parent;
43384833 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4353,7 +4848,7 @@
43534848 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43544849 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43554850 copy.generatePOV(buffer);
4356
- if (GrafreeD.standAlone)
4851
+ if (Grafreed.standAlone)
43574852 {
43584853 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43594854 browser.show();
....@@ -4379,7 +4874,8 @@
43794874 Object3D client;
43804875 Object3D copy;
43814876 MenuBar menuBar;
4382
- Menu windowMenu;
4877
+ Menu fileMenu;
4878
+ MenuItem newItem;
43834879 MenuItem loadItem;
43844880 MenuItem saveItem;
43854881 MenuItem saveAsItem;
....@@ -4387,13 +4883,11 @@
43874883 MenuItem reexportItem;
43884884 MenuItem povItem;
43894885 MenuItem closeItem;
4390
- Menu cameraMenu;
4886
+
43914887 CheckboxMenuItem zBufferItem;
43924888 //MenuItem normalLensItem;
4393
- MenuItem editCameraItem;
4394
- MenuItem revertCameraItem;
4395
- CheckboxMenuItem toggleLiveItem;
43964889 MenuItem stepItem;
4890
+ CheckboxMenuItem toggleLiveItem;
43974891 CheckboxMenuItem toggleFullScreenItem;
43984892 CheckboxMenuItem toggleTimelineItem;
43994893 CheckboxMenuItem toggleRenderItem;
....@@ -4402,7 +4896,7 @@
44024896 CheckboxMenuItem toggleFootContactItem;
44034897 CheckboxMenuItem toggleDLItem;
44044898 CheckboxMenuItem toggleTextureItem;
4405
- CheckboxMenuItem toggleRandomItem;
4899
+ CheckboxMenuItem toggleSwitchItem;
44064900 CheckboxMenuItem toggleRootItem;
44074901 CheckboxMenuItem animationItem;
44084902 CheckboxMenuItem toggleHandleItem;
....@@ -4410,7 +4904,7 @@
44104904 JSplitPane mainPanel;
44114905 JScrollPane scrollpane;
44124906 JPanel toolbarPanel;
4413
- JPanel treePanel;
4907
+ cGridBag treePanel;
44144908 JPanel radioPanel;
44154909 ButtonGroup buttonGroup;
44164910 cGridBag ctrlPanel;
....@@ -4539,4 +5033,9 @@
45395033 //ObjectUI parent;
45405034
45415035 cNumberSlider normalpushField;
5036
+
5037
+ private MenuItem importGFDItem;
5038
+ private MenuItem importVRMLX3DItem;
5039
+ private MenuItem import3DSItem;
5040
+ private MenuItem importOBJItem;
45425041 }