Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
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,67 @@
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
+ cToggleButton GetToggleButton(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cToggleButton(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cToggleButton(name, border);
65
+ }
66
+ }
67
+
68
+ cCheckBox GetCheckBox(String name, boolean border)
69
+ {
70
+ try
71
+ {
72
+ ImageIcon icon = GetIcon(name);
73
+ return new cCheckBox(icon, border);
74
+ }
75
+ catch (Exception e)
76
+ {
77
+ return new cCheckBox(name, border);
78
+ }
79
+ }
80
+
81
+ private ImageIcon GetIcon(String name) throws IOException
82
+ {
83
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
84
+
85
+ if (image.getWidth() != 24 && image.getHeight() != 24)
86
+ {
87
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
88
+ Graphics2D g = resized.createGraphics();
89
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
90
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
91
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
92
+ g.dispose();
93
+
94
+ image = resized;
95
+ }
96
+
97
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
98
+ return icon;
99
+ }
38100
39101 // SCRIPT
40102
....@@ -138,34 +200,42 @@
138200 public void closeUI()
139201 {
140202 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
203
+// System.out.println("this = " + this);
204
+// System.out.println("objEditor = " + objEditor);
143205 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
206
+// objEditor.ctrlPanel.remove(nameField);
207
+
208
+ objEditor.ctrlPanel.remove(namePanel);
145209
146210 if (!GroupEditor.allparams)
147211 return;
148212
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);
213
+// objEditor.ctrlPanel.remove(liveCB);
214
+// objEditor.ctrlPanel.remove(hideCB);
215
+// objEditor.ctrlPanel.remove(markCB);
216
+//
217
+// objEditor.ctrlPanel.remove(randomCB);
218
+// objEditor.ctrlPanel.remove(speedupCB);
219
+// objEditor.ctrlPanel.remove(rewindCB);
220
+//
221
+// objEditor.ctrlPanel.remove(resetButton);
222
+// objEditor.ctrlPanel.remove(stepButton);
223
+//// objEditor.ctrlPanel.remove(stepAllButton);
224
+//// objEditor.ctrlPanel.remove(resetAllButton);
225
+// objEditor.ctrlPanel.remove(link2masterCB);
226
+// //objEditor.ctrlPanel.remove(flipVCB);
227
+// //objEditor.ctrlPanel.remove(texresMenu);
228
+// objEditor.ctrlPanel.remove(slowerButton);
229
+// objEditor.ctrlPanel.remove(fasterButton);
230
+// objEditor.ctrlPanel.remove(remarkButton);
167231
168
- Remove(normalpushField);
232
+ objEditor.ctrlPanel.remove(setupPanel);
233
+ objEditor.ctrlPanel.remove(setupPanel2);
234
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
235
+ objEditor.ctrlPanel.remove(pushPanel);
236
+ //objEditor.ctrlPanel.remove(fillPanel);
237
+
238
+ //Remove(normalpushField);
169239 }
170240
171241 public ObjEditor GetEditor()
....@@ -236,6 +306,7 @@
236306 //localCopy.parent = null;
237307
238308 frame = new JFrame();
309
+ frame.setUndecorated(true);
239310 objEditor = this;
240311 this.callee = callee;
241312
....@@ -269,24 +340,40 @@
269340 void SetupMenu()
270341 {
271342 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..."));
343
+ menuBar.add(fileMenu = new Menu("File"));
344
+ fileMenu.add(newItem = new MenuItem("New"));
345
+ fileMenu.add(loadItem = new MenuItem("Open..."));
346
+
347
+ //oe.menuBar.add(menu = new Menu("Include"));
348
+ Menu menu = new Menu("Import");
349
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
350
+ importOBJItem.addActionListener(this);
351
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
352
+ import3DSItem.addActionListener(this);
353
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
354
+ importVRMLX3DItem.addActionListener(this);
355
+ menu.add("-");
356
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
357
+ importGFDItem.addActionListener(this);
358
+ fileMenu.add(menu);
359
+ fileMenu.add("-");
360
+
361
+ fileMenu.add(saveItem = new MenuItem("Save"));
362
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277363 //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("-");
364
+ fileMenu.add("-");
365
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
366
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
367
+ fileMenu.add("-");
282368 if (client.parent != null)
283369 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
370
+ fileMenu.add(closeItem = new MenuItem("Close"));
285371 } else
286372 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
373
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288374 }
289375
376
+ newItem.addActionListener(this);
290377 loadItem.addActionListener(this);
291378 saveItem.addActionListener(this);
292379 saveAsItem.addActionListener(this);
....@@ -295,79 +382,38 @@
295382 //povItem.addActionListener(this);
296383 closeItem.addActionListener(this);
297384
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
-
353385 objectPanel = new JTabbedPane();
354386 toolbarPanel = new JPanel();
355387 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
388
+ treePanel = new cGridBag();
357389 treePanel.setName("Tree");
358
- ctrlPanel = new cGridBag(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
390
+
391
+ editPanel = new cGridBag().setVertical(true);
392
+ editPanel.setName("Edit");
393
+
394
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
395
+
396
+ editCommandsPanel = new cGridBag();
397
+ editPanel.add(editCommandsPanel);
398
+ editPanel.add(ctrlPanel);
399
+
400
+ toolboxPanel = new cGridBag().setVertical(false);
401
+ toolboxPanel.setName("Toolbox");
402
+
360403 materialPanel = new cGridBag().setVertical(true);
361404 materialPanel.setName("Material");
405
+
362406 /*JTextPane*/
363407 infoarea = createTextPane();
408
+ doc = infoarea.getStyledDocument();
409
+
364410 infoarea.setEditable(true);
365411 SetText();
366412 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367413 // infoarea.setOpaque(false);
368414 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
415
+// TEXTAREA infoarea.setLineWrap(true);
416
+// TEXTAREA infoarea.setWrapStyleWord(true);
371417 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372418 infoPanel.setPreferredSize(new Dimension(50, 200));
373419 infoPanel.setName("Info");
....@@ -378,15 +424,15 @@
378424 mainPanel.setName("Main");
379425 mainPanel.setContinuousLayout(true);
380426 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382427 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
428
+ mainPanel.setDividerLocation(0.5); //1.0);
429
+ mainPanel.setResizeWeight(0.5);
384430
385431 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386432 //mainPanel.setLayout(new GridBagLayout());
387433 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
434
+// treePanel.setLayout(new GridBagLayout());
435
+ //ctrlPanel.setLayout(new GridBagLayout());
390436 //materialPanel.setLayout(new GridBagLayout());
391437
392438 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
....@@ -426,7 +472,7 @@
426472 static String newline = "\n";
427473 protected static final String buttonString = "JButton";
428474 StyledDocument doc;
429
- JTextArea infoarea;
475
+ JTextPane infoarea;
430476
431477 void ClearInfo()
432478 {
....@@ -449,10 +495,10 @@
449495 e.printStackTrace();
450496 }
451497
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();
498
+// String selection = infoarea.getText();
499
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
500
+// java.awt.datatransfer.Clipboard clipboard =
501
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456502 //clipboard.setContents(data, data);
457503 }
458504
....@@ -475,13 +521,13 @@
475521 //SendInfo("Name:", "bold");
476522 if (sel.GetTextures() != null || debug)
477523 {
478
- si.SendInfo(sel.toString(), "bold");
524
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479525 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480526 if (sel.Size() > 0)
481527 {
482528 si.SendInfo("#children = " + sel.Size(), "regular");
483529 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
530
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485531 if (debug)
486532 {
487533 try
....@@ -493,7 +539,10 @@
493539 }
494540
495541 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
542
+ {
543
+ si.SendInfo(" BBox min: " + minima, "regular");
544
+ si.SendInfo(" BBox max: " + maxima, "regular");
545
+ }
497546
498547 if (sel.bRep != null)
499548 {
....@@ -520,7 +569,7 @@
520569 }
521570 if (sel.support != null)
522571 {
523
- si.SendInfo(" support: " + sel.support, "regular");
572
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524573 }
525574 if (sel.scriptnode != null)
526575 {
....@@ -591,6 +640,9 @@
591640 {
592641 CameraPane.pointflow = (PointFlow) sel;
593642 }
643
+
644
+ si.SendInfo("_____________________", "regular");
645
+ si.SendInfo("", "regular");
594646 }
595647 }
596648
....@@ -606,68 +658,140 @@
606658 }
607659 }
608660
661
+static GraphicsDevice device = GraphicsEnvironment
662
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
663
+
664
+ Rectangle keeprect;
665
+ cRadio radio;
666
+
667
+cButton keepButton;
668
+ cButton twoButton; // Full 3D
669
+ cButton sixButton;
670
+ cButton threeButton;
671
+ cButton sevenButton;
672
+ cButton fourButton; // full panel
673
+ cButton oneButton; // full XYZ
674
+ //cButton currentLayout;
675
+
676
+ boolean maximized;
677
+
678
+ cButton fullscreenLayout;
679
+
680
+ void Minimize()
681
+ {
682
+ frame.setState(Frame.ICONIFIED);
683
+ }
684
+
685
+ void Maximize()
686
+ {
687
+ if (maximized)
688
+ {
689
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
690
+ }
691
+ else
692
+ {
693
+ keeprect = frame.getBounds();
694
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
695
+ Dimension rect2 = frame.getToolkit().getScreenSize();
696
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
697
+// frame.setState(Frame.MAXIMIZED_BOTH);
698
+ }
699
+
700
+ maximized ^= true;
701
+ }
702
+
609703 void ToggleFullScreen()
610704 {
611705 if (CameraPane.FULLSCREEN)
612706 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
707
+ device.setFullScreenWindow(null);
708
+ //frame.setVisible(false);
709
+// frame.removeNotify();
710
+// frame.setUndecorated(false);
711
+// frame.addNotify();
712
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
713
+
714
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
715
+// X framePanel.add(bigThree);
716
+// X frame.getContentPane().add(/*"Center",*/framePanel);
717
+ framePanel.setDividerLocation(1);
718
+
719
+ //frame.setVisible(true);
720
+ radio.layout = keepButton;
721
+ //theFrame = null;
722
+ keepButton = null;
723
+ radio.layout.doClick();
724
+
616725 } else
617726 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
727
+ keepButton = radio.layout;
728
+ //keeprect = frame.getBounds();
729
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
730
+// frame.getToolkit().getScreenSize().height);
731
+ //frame.setVisible(false);
732
+ device.setFullScreenWindow(frame);
733
+// frame.removeNotify();
734
+// frame.setUndecorated(true);
735
+// frame.addNotify();
736
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
737
+// X framePanel.remove(bigThree);
738
+// X frame.getContentPane().add(/*"Center",*/bigThree);
739
+ framePanel.setDividerLocation(0);
740
+
741
+ radio.layout = fullscreenLayout;
742
+ radio.layout.doClick();
743
+ //frame.setVisible(true);
621744 }
745
+
622746 cameraView.ToggleFullScreen();
623747 }
624748
625
- private JTextArea createTextPane()
749
+ private JTextPane createTextPane()
626750 {
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
- };
751
+// TEXTAREA String[] initString =
752
+// {
753
+// "This is an editable JTextPane, ", //regular
754
+// "another ", //italic
755
+// "styled ", //bold
756
+// "text ", //small
757
+// "component, ", //large
758
+// "which supports embedded components..." + newline,//regular
759
+// " " + newline, //button
760
+// "...and embedded icons..." + newline, //regular
761
+// " ", //icon
762
+// newline + "JTextPane is a subclass of JEditorPane that "
763
+// + "uses a StyledEditorKit and StyledDocument, and provides "
764
+// + "cover methods for interacting with those objects."
765
+// };
766
+//
767
+// String[] initStyles =
768
+// {
769
+// "regular", "italic", "bold", "small", "large",
770
+// "regular", "button", "regular", "icon",
771
+// "regular"
772
+// };
773
+//
774
+// JTextPane textPane = new JTextPane();
775
+// textPane.setEditable(true);
776
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
777
+// addStylesToDocument(doc);
778
+//
779
+// try
780
+// {
781
+// for (int j = 0; j < 2; j++)
782
+// {
783
+// for (int i = 0; i < initString.length; i++)
784
+// {
785
+// doc.insertString(doc.getLength(), initString[i],
786
+// doc.getStyle(initStyles[i]));
787
+// }
788
+// }
789
+// } catch (BadLocationException ble)
790
+// {
791
+// System.err.println("Couldn't insert initial text into text pane.");
792
+// }
642793
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;
794
+ return new JTextPane(); // textPane;
671795 }
672796
673797 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +844,7 @@
720844 protected static ImageIcon createImageIcon(String path,
721845 String description)
722846 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
847
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724848 if (imgURL != null)
725849 {
726850 return new ImageIcon(imgURL, description);
....@@ -752,6 +876,7 @@
752876 // NumberSlider vDivsField;
753877 // JCheckBox endcaps;
754878 JCheckBox liveCB;
879
+ JCheckBox selectCB;
755880 JCheckBox hideCB;
756881 JCheckBox link2masterCB;
757882 JCheckBox markCB;
....@@ -767,54 +892,48 @@
767892 JButton slowerButton;
768893 JButton fasterButton;
769894 JButton remarkButton;
895
+
896
+ cGridBag editPanel;
897
+ cGridBag editCommandsPanel;
898
+
899
+ cGridBag namePanel;
900
+ cGridBag setupPanel;
901
+ cGridBag setupPanel2;
902
+ cGridBag objectCommandsPanel;
903
+ cGridBag pushPanel;
904
+ cGridBag fillPanel;
770905
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
906
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772907 {
773908 JCheckBox cb;
774909
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);
910
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780911 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784912
785913 return cb;
786914 }
787915
788
- cButton AddButton(ObjEditor oe, String label)
916
+ cButton AddButton(cGridBag panel, String label)
789917 {
790918 cButton cb;
791919
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);
920
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797921 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801922
802923 return cb;
803924 }
804925
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
926
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806927 {
807928 JComboBox combo;
808929
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;
930
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812931 combo.addActionListener(this);
813932
814933 return combo;
815934 }
816935
817
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow)
936
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818937 {
819938 cGridBag control = new cGridBag();
820939
....@@ -826,12 +945,12 @@
826945 control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827946 combo.setFloat(current);
828947
829
- ctrlPanel.add(control);
948
+ panel.add(control);
830949
831
- return combo;
950
+ return control;
832951 }
833952
834
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current)
953
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
835954 {
836955 cGridBag control = new cGridBag();
837956
....@@ -839,25 +958,21 @@
839958
840959 JLabel jlabel = new JLabel(label);
841960 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);
961
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
962
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
844963 combo.setInteger(current);
845964
846
- ctrlPanel.add(control);
965
+ panel.add(control);
847966
848
- return combo;
967
+ return control;
849968 }
850969
851970 JTextArea AddText(cGridBag ctrlPanel, String name)
852971 {
853972 JTextArea text;
854973
855
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
856
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
857974 ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858975 text.addCaretListener(this);
859
- aConstraints.gridx += 1;
860
- aConstraints.gridwidth = 1;
861976
862977 return text;
863978 }
....@@ -896,7 +1011,7 @@
8961011
8971012 /*
8981013 */
899
- void Return() // ObjEditor oe)
1014
+ void Return0() // ObjEditor oe)
9001015 {
9011016 aConstraints.gridy += 1;
9021017 aConstraints.gridx = 0;
....@@ -951,37 +1066,76 @@
9511066
9521067 void SetupUI2(ObjEditor oe)
9531068 {
954
-// oe.aConstraints.weightx = 0;
955
-// oe.aConstraints.weighty = 0;
956
-// oe.aConstraints.gridx = 0;
957
-// oe.aConstraints.gridy = 0;
958
- SetupName(oe);
1069
+ //SetupName(oe);
1070
+
1071
+ namePanel = new cGridBag();
1072
+
1073
+ nameField = AddText(namePanel, copy.GetName());
1074
+ namePanel.add(nameField);
1075
+ oe.ctrlPanel.add(namePanel);
1076
+
1077
+ oe.ctrlPanel.Return();
9591078
9601079 if (!GroupEditor.allparams)
9611080 return;
9621081
963
- liveCB = AddCheckBox(oe, "Live", copy.live);
964
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
965
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1082
+ setupPanel = new cGridBag().setVertical(false);
1083
+
1084
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1085
+ liveCB.setToolTipText("Animate object");
1086
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1087
+ selectCB.setToolTipText("Make object selectable");
9661088 // 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");
1089
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1090
+ hideCB.setToolTipText("Hide object");
1091
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1092
+ markCB.setToolTipText("Set the animation target transform");
1093
+
1094
+ setupPanel2 = new cGridBag().setVertical(false);
1095
+
1096
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1097
+ rewindCB.setToolTipText("Rewind animation");
1098
+
1099
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1100
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1101
+
1102
+ if (Globals.ADVANCED)
1103
+ {
1104
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1105
+ link2masterCB.setToolTipText("Attach to support");
1106
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1107
+ speedupCB.setToolTipText("Option motion capture");
1108
+ }
1109
+
1110
+ oe.ctrlPanel.add(setupPanel);
1111
+ oe.ctrlPanel.Return();
1112
+ oe.ctrlPanel.add(setupPanel2);
1113
+ oe.ctrlPanel.Return();
1114
+
1115
+ objectCommandsPanel = new cGridBag().setVertical(false);
1116
+
1117
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1118
+ resetButton.setToolTipText("Jump to frame zero");
1119
+ stepButton = AddButton(objectCommandsPanel, "Step");
1120
+ stepButton.setToolTipText("Step one frame");
9731121 // resetAllButton = AddButton(oe, "Reset All");
9741122 // stepAllButton = AddButton(oe, "Step All");
975
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9761123 // Return();
977
- slowerButton = AddButton(oe, "Slow");
978
- fasterButton = AddButton(oe, "Fast");
979
- remarkButton = AddButton(oe, "Rem");
1124
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1125
+ slowerButton.setToolTipText("Decrease animation speed");
1126
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1127
+ fasterButton.setToolTipText("Increase animation speed");
1128
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1129
+ remarkButton.setToolTipText("Set the current transform as the target");
9801130
981
- //Return();
1131
+ oe.ctrlPanel.add(objectCommandsPanel);
1132
+ oe.ctrlPanel.Return();
9821133
983
- //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
1134
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1135
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
9841136 //Return();
1137
+
1138
+ oe.ctrlPanel.Return();
9851139
9861140 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9871141 // ObjEditor.aConstraints.gridx += 1;
....@@ -1076,7 +1230,7 @@
10761230 oe.aConstraints.gridwidth = 1;
10771231 /**/
10781232 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1233
+ oe.ctrlPanel.Return();
10801234
10811235 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821236 //textureButton.setEnabled(false);
....@@ -1180,8 +1334,11 @@
11801334 //worldPanel.setName("World");
11811335 centralPanel = new cGridBag();
11821336 centralPanel.preferredWidth = 20;
1183
- timelinePanel = new JPanel(new BorderLayout());
1184
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1337
+
1338
+ if (Globals.ADVANCED)
1339
+ {
1340
+ timelinePanel = new JPanel(new BorderLayout());
1341
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11851342
11861343 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11871344 cameraPanel.setContinuousLayout(true);
....@@ -1190,7 +1347,10 @@
11901347 // cameraPanel.setDividerSize(9);
11911348 cameraPanel.setResizeWeight(1.0);
11921349
1350
+ }
1351
+
11931352 centralPanel.add(cameraView);
1353
+ centralPanel.setFocusable(true);
11941354 //frame.setJMenuBar(timelineMenubar);
11951355 //centralPanel.add(timelinePanel);
11961356
....@@ -1252,11 +1412,13 @@
12521412
12531413 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12541414 //tmp.setName("Edit");
1415
+ objectPanel.add(toolboxPanel);
12551416 objectPanel.add(materialPanel);
1256
- JPanel north = new JPanel(new BorderLayout());
1257
- north.setName("Edit");
1258
- north.add(ctrlPanel, BorderLayout.NORTH);
1259
- objectPanel.add(north);
1417
+// JPanel north = new JPanel(new BorderLayout());
1418
+// north.setName("Edit");
1419
+// north.add(ctrlPanel, BorderLayout.NORTH);
1420
+// objectPanel.add(north);
1421
+ objectPanel.add(editPanel);
12601422 objectPanel.add(infoPanel);
12611423
12621424 /*
....@@ -1278,7 +1440,7 @@
12781440 scrollpane.addMouseWheelListener(this); // Default not fast enough
12791441
12801442 /*JTabbedPane*/ scenePanel = new cGridBag();
1281
- scenePanel.preferredWidth = 7;
1443
+ scenePanel.preferredWidth = 6;
12821444
12831445 JTabbedPane tabbedPane = new JTabbedPane();
12841446 tabbedPane.add(scrollpane);
....@@ -1384,9 +1546,11 @@
13841546
13851547 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13861548
1387
- frame.setSize(1024, 768);
1388
- frame.show();
1549
+ frame.setSize(1280, 860);
1550
+ frame.setVisible(true);
13891551
1552
+ cameraView.requestFocusInWindow();
1553
+
13901554 gridPanel.setDividerLocation(1.0);
13911555
13921556 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1415,7 +1579,7 @@
14151579 ctrlPanel.removeAll();
14161580 }
14171581
1418
- void SetupMaterial(cGridBag ctrlPanel)
1582
+ void SetupMaterial(cGridBag panel)
14191583 {
14201584 /*
14211585 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
....@@ -1424,18 +1588,26 @@
14241588
14251589 cGridBag editBar = new cGridBag().setVertical(false);
14261590
1427
- editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints);
1591
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1592
+ createMaterialButton.setToolTipText("Create material");
14281593
14291594 /*
14301595 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14311596 */
14321597
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);
1598
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1599
+ clearMaterialButton.setToolTipText("Clear material");
1600
+
1601
+ if (Globals.ADVANCED)
1602
+ {
1603
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1604
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1605
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1606
+ }
14371607
1438
- ctrlPanel.add(editBar);
1608
+ editBar.preferredHeight = 15;
1609
+
1610
+ panel.add(editBar);
14391611
14401612 /**/
14411613 //aConstraints.weighty = 0;
....@@ -1484,9 +1656,9 @@
14841656 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
14851657 colorSection.add(shadowbias);
14861658
1487
- ctrlPanel.add(new JSeparator());
1659
+ panel.add(new JSeparator());
14881660
1489
- ctrlPanel.add(colorSection);
1661
+ panel.add(colorSection);
14901662
14911663 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14921664
....@@ -1534,9 +1706,9 @@
15341706 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15351707 diffuseSection.add(fakedepth);
15361708
1537
- ctrlPanel.add(new JSeparator());
1709
+ panel.add(new JSeparator());
15381710
1539
- ctrlPanel.add(diffuseSection);
1711
+ panel.add(diffuseSection);
15401712
15411713 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15421714
....@@ -1572,7 +1744,7 @@
15721744 velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15731745 specularSection.add(velvet);
15741746
1575
- shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1);
1747
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
15761748 //Return();
15771749 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
15781750 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
....@@ -1585,9 +1757,9 @@
15851757 // aConstraints.gridwidth = 1;
15861758
15871759
1588
- ctrlPanel.add(new JSeparator());
1760
+ panel.add(new JSeparator());
15891761
1590
- ctrlPanel.add(specularSection);
1762
+ panel.add(specularSection);
15911763
15921764 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15931765
....@@ -1617,9 +1789,9 @@
16171789 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16181790 globalSection.add(opacity);
16191791
1620
- ctrlPanel.add(new JSeparator());
1792
+ panel.add(new JSeparator());
16211793
1622
- ctrlPanel.add(globalSection);
1794
+ panel.add(globalSection);
16231795
16241796 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16251797
....@@ -1661,9 +1833,9 @@
16611833 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16621834 textureSection.add(opacityPower);
16631835
1664
- ctrlPanel.add(new JSeparator());
1836
+ panel.add(new JSeparator());
16651837
1666
- ctrlPanel.add(textureSection);
1838
+ panel.add(textureSection);
16671839
16681840 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16691841
....@@ -1700,12 +1872,15 @@
17001872 opacityPowerField.addChangeListener(this);
17011873 /**/
17021874
1703
- resetSlidersButton.addActionListener(this);
17041875 clearMaterialButton.addActionListener(this);
17051876 createMaterialButton.addActionListener(this);
1706
-
1707
- propagateToggle.addItemListener(this);
1708
- multiplyToggle.addItemListener(this);
1877
+
1878
+ if (Globals.ADVANCED)
1879
+ {
1880
+ resetSlidersButton.addActionListener(this);
1881
+ propagateToggle.addItemListener(this);
1882
+ multiplyToggle.addItemListener(this);
1883
+ }
17091884 }
17101885
17111886 void DropFile(java.io.File[] files, boolean textures)
....@@ -1876,7 +2051,7 @@
18762051
18772052 //? flashIt = false;
18782053 CameraPane pane = (CameraPane) cameraView;
1879
- pane.clickStart(location.x, location.y, 0);
2054
+ pane.clickStart(location.x, location.y, 0, 0);
18802055 pane.clickEnd(location.x, location.y, 0, true);
18812056
18822057 if (group.selection.size() == 1)
....@@ -1925,6 +2100,7 @@
19252100 e2.printStackTrace();
19262101 }
19272102 }
2103
+
19282104 LoadJMEThread loadThread;
19292105
19302106 class LoadJMEThread extends Thread
....@@ -1982,6 +2158,7 @@
19822158 //LoadFile0(filename, converter);
19832159 }
19842160 }
2161
+
19852162 LoadOBJThread loadObjThread;
19862163
19872164 class LoadOBJThread extends Thread
....@@ -2060,19 +2237,19 @@
20602237
20612238 void LoadObjFile(String fullname)
20622239 {
2063
- /*
2240
+ System.out.println("Loading " + fullname);
2241
+ /**/
20642242 //lastFilename = fullname;
20652243 if(loadObjThread == null)
20662244 {
2067
- loadObjThread = new LoadOBJThread();
2068
- loadObjThread.start();
2245
+ loadObjThread = new LoadOBJThread();
2246
+ loadObjThread.start();
20692247 }
20702248
20712249 loadObjThread.add(fullname);
2072
- */
2250
+ /**/
20732251
2074
- System.out.println("Loading " + fullname);
2075
- makeSomething(new FileObject(fullname, true), true);
2252
+ //makeSomething(new FileObject(fullname, true), true);
20762253 }
20772254
20782255 void LoadGFDFile(String fullname)
....@@ -2333,11 +2510,11 @@
23332510
23342511 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23352512 {
2336
- if (GrafreeD.standAlone)
2513
+ if (Grafreed.standAlone)
23372514 {
23382515 /**/
23392516 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2340
- browser.show();
2517
+ browser.setVisible(true);
23412518 String filename = browser.getFile();
23422519 if (filename != null && filename.length() > 0)
23432520 {
....@@ -2482,6 +2659,7 @@
24822659 }
24832660 if (input == null)
24842661 {
2662
+ new Exception().printStackTrace();
24852663 System.exit(0);
24862664 }
24872665
....@@ -2696,7 +2874,8 @@
26962874 return;
26972875 }
26982876
2699
- multiplyToggle.setSelected(mat.multiply);
2877
+ if (multiplyToggle != null)
2878
+ multiplyToggle.setSelected(mat.multiply);
27002879
27012880 assert (object.projectedVertices != null);
27022881
....@@ -2911,9 +3090,9 @@
29113090 frame.validate();
29123091
29133092 return;
2914
- } else if (event.getSource() == toggleRandomItem)
3093
+ } else if (event.getSource() == toggleSwitchItem)
29153094 {
2916
- cameraView.ToggleRandom();
3095
+ cameraView.ToggleSwitch();
29173096 cameraView.repaint();
29183097 return;
29193098 } else if (event.getSource() == toggleHandleItem)
....@@ -2942,6 +3121,10 @@
29423121 {
29433122 copy.live ^= true;
29443123 return;
3124
+ } else if (event.getSource() == selectCB)
3125
+ {
3126
+ copy.dontselect ^= true;
3127
+ return;
29453128 } else if (event.getSource() == hideCB)
29463129 {
29473130 copy.hide ^= true;
....@@ -2956,6 +3139,7 @@
29563139 if (event.getSource() == randomCB)
29573140 {
29583141 copy.random ^= true;
3142
+ objEditor.refreshContents();
29593143 return;
29603144 }
29613145 if (event.getSource() == speedupCB)
....@@ -2979,8 +3163,9 @@
29793163
29803164 public void actionPerformed(ActionEvent event)
29813165 {
3166
+ Object source = event.getSource();
29823167 // SCRIPT DIALOG
2983
- if (event.getSource() == okbutton)
3168
+ if (source == okbutton)
29843169 {
29853170 textpanel.setVisible(false);
29863171 textpanel.remove(textarea);
....@@ -2992,7 +3177,7 @@
29923177 textarea = null;
29933178 textpanel = null;
29943179 }
2995
- if (event.getSource() == cancelbutton)
3180
+ if (source == cancelbutton)
29963181 {
29973182 textpanel.setVisible(false);
29983183 textpanel.remove(textarea);
....@@ -3004,50 +3189,50 @@
30043189 //applySelf();
30053190 //client.refreshEditWindow();
30063191 //refreshContents();
3007
- if (event.getSource() == nameField)
3192
+ if (source == nameField)
30083193 {
30093194 //System.out.println("ObjEditor " + event);
30103195 applySelf0(true);
30113196 //parent.applySelf();
30123197 objEditor.refreshContents();
3013
- } else if (event.getSource() == resetButton)
3198
+ } else if (source == resetButton)
30143199 {
30153200 CameraPane.fullreset = true;
30163201 copy.Reset(); // ResetMeshes();
30173202 copy.Touch();
30183203 objEditor.refreshContents();
3019
- } else if (event.getSource() == stepItem)
3204
+ } else if (source == stepItem)
30203205 {
30213206 //cameraView.ONESTEP = true;
30223207 Globals.ONESTEP = true;
30233208 cameraView.repaint();
30243209 return;
3025
- } else if (event.getSource() == stepButton)
3210
+ } else if (source == stepButton)
30263211 {
30273212 copy.Step();
30283213 copy.Touch();
30293214 objEditor.refreshContents();
3030
- } else if (event.getSource() == slowerButton)
3215
+ } else if (source == slowerButton)
30313216 {
30323217 copy.Slower();
30333218 copy.Touch();
30343219 objEditor.refreshContents();
3035
- } else if (event.getSource() == fasterButton)
3220
+ } else if (source == fasterButton)
30363221 {
30373222 copy.Faster();
30383223 copy.Touch();
30393224 objEditor.refreshContents();
3040
- } else if (event.getSource() == remarkButton)
3225
+ } else if (source == remarkButton)
30413226 {
30423227 copy.Remark();
30433228 copy.Touch();
30443229 objEditor.refreshContents();
3045
- } else if (event.getSource() == stepAllButton)
3230
+ } else if (source == stepAllButton)
30463231 {
30473232 copy.StepAll();
30483233 copy.Touch();
30493234 objEditor.refreshContents();
3050
- } else if (event.getSource() == resetAllButton)
3235
+ } else if (source == resetAllButton)
30513236 {
30523237 //CameraPane.fullreset = true;
30533238 copy.ResetAll(); // ResetMeshes();
....@@ -3080,53 +3265,75 @@
30803265 // Close();
30813266 // }
30823267 // else
3083
- if (event.getSource() == resetSlidersButton)
3268
+ if (source == resetSlidersButton)
30843269 {
30853270 ResetSliders();
3086
- } else if (event.getSource() == clearMaterialButton)
3271
+ } else if (source == clearMaterialButton)
30873272 {
30883273 ClearMaterial();
3089
- } else if (event.getSource() == createMaterialButton)
3274
+ } else if (source == createMaterialButton)
30903275 {
30913276 CreateMaterial();
3092
- } else if (event.getSource() == clearPanelButton)
3277
+ } else if (source == clearPanelButton)
30933278 {
30943279 copy.ClearUI();
30953280 refreshContents(true);
3096
- } /*
3097
- }
3098
-
3099
- public boolean action(Event event, Object arg)
3100
- {
3101
- */ else if (event.getSource() == closeItem)
3281
+ } else if (source == importGFDItem)
3282
+ {
3283
+ ImportGFD();
3284
+ } else
3285
+ if (source == importVRMLX3DItem)
3286
+ {
3287
+ ImportVRMLX3D();
3288
+ } else
3289
+ if (source == import3DSItem)
3290
+ {
3291
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3292
+ } else
3293
+ if (source == importOBJItem)
3294
+ {
3295
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3296
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3297
+ browser.setVisible(true);
3298
+ String filename = browser.getFile();
3299
+ if (filename != null && filename.length() > 0)
3300
+ {
3301
+ String fullname = browser.getDirectory() + filename;
3302
+ makeSomething(ReadOBJ(fullname), true);
3303
+ }
3304
+ } else
3305
+ if (source == closeItem)
31023306 {
31033307 Close();
31043308 //return true;
3105
- } else if (event.getSource() == loadItem)
3309
+ } else if (source == loadItem)
31063310 {
31073311 load();
31083312 //return true;
3109
- } else if (event.getSource() == saveItem)
3313
+ } else if (source == newItem)
3314
+ {
3315
+ New();
3316
+ } else if (source == saveItem)
31103317 {
31113318 save();
31123319 //return true;
3113
- } else if (event.getSource() == saveAsItem)
3320
+ } else if (source == saveAsItem)
31143321 {
31153322 saveAs();
31163323 //return true;
3117
- } else if (event.getSource() == reexportItem)
3324
+ } else if (source == reexportItem)
31183325 {
31193326 reexport();
31203327 //return true;
3121
- } else if (event.getSource() == exportAsItem)
3328
+ } else if (source == exportAsItem)
31223329 {
31233330 export();
31243331 //return true;
3125
- } else if (event.getSource() == povItem)
3332
+ } else if (source == povItem)
31263333 {
31273334 generatePOV();
31283335 //return true;
3129
- } else if (event.getSource() == zBufferItem)
3336
+ } else if (source == zBufferItem)
31303337 {
31313338 try
31323339 {
....@@ -3148,21 +3355,8 @@
31483355 cameraView.repaint();
31493356 //return true;
31503357 }
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)
3358
+ */ else // combos...
3359
+ if (source == texresMenu)
31663360 {
31673361 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31683362 copy.texres = texresMenu.getSelectedIndex();
....@@ -3174,12 +3368,272 @@
31743368 }
31753369 }
31763370
3371
+ void New()
3372
+ {
3373
+ while (copy.Size() > 1)
3374
+ {
3375
+ copy.remove(1);
3376
+ }
3377
+
3378
+ ResetModel();
3379
+ objEditor.refreshContents();
3380
+ }
3381
+
3382
+ static public byte[] Compress(Object3D o)
3383
+ {
3384
+ try
3385
+ {
3386
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3387
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3388
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3389
+
3390
+ Object3D parent = o.parent;
3391
+ o.parent = null;
3392
+
3393
+ out.writeObject(o);
3394
+
3395
+ o.parent = parent;
3396
+
3397
+ out.flush();
3398
+
3399
+ zstream.close();
3400
+ out.close();
3401
+
3402
+ return baos.toByteArray();
3403
+ } catch (Exception e)
3404
+ {
3405
+ System.err.println(e);
3406
+ return null;
3407
+ }
3408
+ }
3409
+
3410
+ static public Object Uncompress(byte[] bytes)
3411
+ {
3412
+ System.out.println("#bytes = " + bytes.length);
3413
+ try
3414
+ {
3415
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3416
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3417
+ ObjectInputStream in = new ObjectInputStream(istream);
3418
+ Object obj = in.readObject();
3419
+ in.close();
3420
+
3421
+ return obj;
3422
+ } catch (Exception e)
3423
+ {
3424
+ System.err.println(e);
3425
+ return null;
3426
+ }
3427
+ }
3428
+
3429
+ static public Object clone(Object o)
3430
+ {
3431
+ try
3432
+ {
3433
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3434
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3435
+
3436
+ out.writeObject(o);
3437
+
3438
+ out.flush();
3439
+ out.close();
3440
+
3441
+ byte[] bytes = baos.toByteArray();
3442
+
3443
+ System.out.println("clone = " + bytes.length);
3444
+
3445
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3446
+ ObjectInputStream in = new ObjectInputStream(bais);
3447
+ Object obj = in.readObject();
3448
+ in.close();
3449
+
3450
+ return obj;
3451
+ } catch (Exception e)
3452
+ {
3453
+ System.err.println(e);
3454
+ return null;
3455
+ }
3456
+ }
3457
+
3458
+ cRadio GetCurrentTab()
3459
+ {
3460
+ cRadio ab;
3461
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3462
+ {
3463
+ ab = (cRadio)e.nextElement();
3464
+ if(ab.GetObject() == copy)
3465
+ {
3466
+ return ab;
3467
+ }
3468
+ }
3469
+
3470
+ return null;
3471
+ }
3472
+
3473
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3474
+
3475
+ public void Save()
3476
+ {
3477
+ System.err.println("Save");
3478
+
3479
+ cRadio tab = GetCurrentTab();
3480
+
3481
+ boolean temp = CameraPane.SWITCH;
3482
+ CameraPane.SWITCH = false;
3483
+
3484
+ copy.ExtractBigData(hashtable);
3485
+
3486
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3487
+ tab.graphs[tab.undoindex++] = Compress(copy);
3488
+
3489
+ copy.RestoreBigData(hashtable);
3490
+
3491
+ CameraPane.SWITCH = temp;
3492
+
3493
+ //assert(hashtable.isEmpty());
3494
+
3495
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3496
+ {
3497
+ tab.graphs[i] = null;
3498
+ }
3499
+
3500
+ // test save
3501
+ if (false)
3502
+ {
3503
+ try
3504
+ {
3505
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3506
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3507
+
3508
+ p.writeObject(copy);
3509
+
3510
+ p.flush();
3511
+
3512
+ ostream.close();
3513
+ } catch (Exception e)
3514
+ {
3515
+ e.printStackTrace();
3516
+ }
3517
+ }
3518
+ }
3519
+
3520
+ void CopyChanged(Object3D obj)
3521
+ {
3522
+ boolean temp = CameraPane.SWITCH;
3523
+ CameraPane.SWITCH = false;
3524
+
3525
+ copy.ExtractBigData(hashtable);
3526
+
3527
+ copy.clear();
3528
+
3529
+ for (int i=0; i<obj.Size(); i++)
3530
+ {
3531
+ copy.add(obj.get(i));
3532
+ }
3533
+
3534
+ copy.RestoreBigData(hashtable);
3535
+
3536
+ CameraPane.SWITCH = temp;
3537
+
3538
+ //assert(hashtable.isEmpty());
3539
+
3540
+ copy.Touch();
3541
+
3542
+ ResetModel();
3543
+ copy.HardTouch(); // recompile?
3544
+
3545
+ cRadio ab;
3546
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3547
+ {
3548
+ ab = (cRadio)e.nextElement();
3549
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3550
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3551
+ if (test != null)
3552
+ {
3553
+ test.editWindow = ab.object.editWindow;
3554
+ ab.object = test;
3555
+ }
3556
+ }
3557
+
3558
+ refreshContents();
3559
+ }
3560
+
3561
+ public void Undo()
3562
+ {
3563
+ System.err.println("Undo");
3564
+
3565
+ cRadio tab = GetCurrentTab();
3566
+
3567
+ if (tab.undoindex == 0)
3568
+ {
3569
+ java.awt.Toolkit.getDefaultToolkit().beep();
3570
+ return;
3571
+ }
3572
+
3573
+ if (tab.graphs[tab.undoindex] == null)
3574
+ {
3575
+ Save();
3576
+ tab.undoindex -= 1;
3577
+ }
3578
+
3579
+ tab.undoindex -= 1;
3580
+
3581
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3582
+ }
3583
+
3584
+ public void Redo()
3585
+ {
3586
+ cRadio tab = GetCurrentTab();
3587
+
3588
+ if (tab.graphs[tab.undoindex + 1] == null)
3589
+ {
3590
+ java.awt.Toolkit.getDefaultToolkit().beep();
3591
+ return;
3592
+ }
3593
+
3594
+ tab.undoindex += 1;
3595
+
3596
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3597
+ }
3598
+
3599
+ void ImportGFD()
3600
+ {
3601
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3602
+ browser.show();
3603
+ String filename = browser.getFile();
3604
+ if (filename != null && filename.length() > 0)
3605
+ {
3606
+ String fullname = browser.getDirectory() + filename;
3607
+
3608
+ //Object3D readobj =
3609
+ objEditor.ReadGFD(fullname, objEditor);
3610
+ //makeSomething(readobj);
3611
+ }
3612
+ }
3613
+
3614
+ void ImportVRMLX3D()
3615
+ {
3616
+ if (Grafreed.standAlone)
3617
+ {
3618
+ /**/
3619
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3620
+ browser.show();
3621
+ String filename = browser.getFile();
3622
+ if (filename != null && filename.length() > 0)
3623
+ {
3624
+ String fullname = browser.getDirectory() + filename;
3625
+ LoadVRMLX3D(fullname);
3626
+ }
3627
+ /**/
3628
+ }
3629
+ }
3630
+
31773631 void ToggleAnimation()
31783632 {
31793633 if (!Globals.ANIMATION)
31803634 {
31813635 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3182
- browser.show();
3636
+ browser.setVisible(true);
31833637 String filename = browser.getFile();
31843638 if (filename != null && filename.length() > 0)
31853639 {
....@@ -3189,8 +3643,8 @@
31893643
31903644 Globals.ANIMATION ^= true;
31913645
3192
- GrafreeD.wav.cursor = 0;
3193
- GrafreeD.wav.loop = 0;
3646
+ Grafreed.wav.cursor = 0;
3647
+ Grafreed.wav.loop = 0;
31943648 }
31953649 } else
31963650 {
....@@ -3240,7 +3694,7 @@
32403694 void CreateMaterial()
32413695 {
32423696 //copy.ClearMaterial(); // PATCH
3243
- copy.CreateMaterialS(multiplyToggle.isSelected());
3697
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32443698 if (copy.selection.size() > 0)
32453699 //SetMaterial(copy);
32463700 {
....@@ -3291,7 +3745,7 @@
32913745 assert false;
32923746 }
32933747
3294
- void EditSelection()
3748
+ void EditSelection(boolean newWindow)
32953749 {
32963750 }
32973751
....@@ -3299,11 +3753,11 @@
32993753 {
33003754 copy.ResetBlockLoop(); // temporary problem
33013755
3302
- boolean random = CameraPane.RANDOM;
3303
- CameraPane.RANDOM = false; // parse everything
3756
+ boolean random = CameraPane.SWITCH;
3757
+ CameraPane.SWITCH = false; // parse everything
33043758 copy.ResetDisplayList();
33053759 copy.HardTouch();
3306
- CameraPane.RANDOM = random;
3760
+ CameraPane.SWITCH = random;
33073761 }
33083762
33093763 // public void applySelf()
....@@ -3377,6 +3831,36 @@
33773831 {
33783832 //System.out.println("Propagate = " + propagate);
33793833 copy.UpdateMaterial(anchor, current, propagate);
3834
+
3835
+ if (copy.material != null)
3836
+ {
3837
+ cMaterial mat = copy.material;
3838
+
3839
+ colorField.SetToolTipValue((mat.color));
3840
+ modulationField.SetToolTipValue((mat.modulation));
3841
+ metalnessField.SetToolTipValue((mat.metalness));
3842
+ diffuseField.SetToolTipValue((mat.diffuse));
3843
+ specularField.SetToolTipValue((mat.specular));
3844
+ shininessField.SetToolTipValue((mat.shininess));
3845
+ shiftField.SetToolTipValue((mat.shift));
3846
+ ambientField.SetToolTipValue((mat.ambient));
3847
+ lightareaField.SetToolTipValue((mat.lightarea));
3848
+ diffusenessField.SetToolTipValue((mat.factor));
3849
+ velvetField.SetToolTipValue((mat.velvet));
3850
+ sheenField.SetToolTipValue((mat.sheen));
3851
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3852
+ backlitField.SetToolTipValue((mat.bump));
3853
+ anisoField.SetToolTipValue((mat.aniso));
3854
+ anisoVField.SetToolTipValue((mat.anisoV));
3855
+ cameraField.SetToolTipValue((mat.cameralight));
3856
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3857
+ shadowField.SetToolTipValue((mat.shadow));
3858
+ textureField.SetToolTipValue((mat.texture));
3859
+ opacityField.SetToolTipValue((mat.opacity));
3860
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3861
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3862
+ }
3863
+
33803864 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33813865 {
33823866 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3421,6 +3905,7 @@
34213905 || e.getSource() == apertureField
34223906 || e.getSource() == shadowblurField)
34233907 {
3908
+ new Exception().printStackTrace();
34243909 System.exit(0);
34253910 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34263911 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3491,7 +3976,7 @@
34913976 }
34923977
34933978 if (normalpushField != null)
3494
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3979
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34953980 }
34963981
34973982 void SnapObject()
....@@ -3755,6 +4240,8 @@
37554240
37564241 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37574242 {
4243
+ if (Globals.SAVEONMAKE) // && resetmodel)
4244
+ Save();
37584245 //Tween.set(thing, 0).target(1).start(tweenManager);
37594246 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37604247 // if (thing instanceof GenericJointDemo)
....@@ -3841,6 +4328,12 @@
38414328 {
38424329 ResetModel();
38434330 Select(thing.GetTreePath(), true, false); // unselect... false);
4331
+
4332
+ if (thing.Size() == 0)
4333
+ {
4334
+ //EditSelection(false);
4335
+ }
4336
+
38444337 refreshContents();
38454338 }
38464339
....@@ -3958,6 +4451,7 @@
39584451 }
39594452 }
39604453 }
4454
+
39614455 LoadGFDThread loadGFDThread;
39624456
39634457 void ReadGFD(String fullname, iCallBack cb)
....@@ -3977,8 +4471,10 @@
39774471
39784472 try
39794473 {
4474
+ // Try compressed version first.
39804475 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3981
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4476
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4477
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39824478
39834479 readobj = (Object3D) p.readObject();
39844480 istream.close();
....@@ -3986,7 +4482,20 @@
39864482 readobj.ResetDisplayList();
39874483 } catch (Exception e)
39884484 {
3989
- e.printStackTrace();
4485
+ //e.printStackTrace();
4486
+ try
4487
+ {
4488
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4489
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4490
+
4491
+ readobj = (Object3D) p.readObject();
4492
+ istream.close();
4493
+
4494
+ readobj.ResetDisplayList();
4495
+ } catch (Exception e2)
4496
+ {
4497
+ e2.printStackTrace();
4498
+ }
39904499 }
39914500 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
39924501 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4032,6 +4541,12 @@
40324541
40334542 void LoadIt(Object obj)
40344543 {
4544
+ if (obj == null)
4545
+ {
4546
+ // Invalid file
4547
+ return;
4548
+ }
4549
+
40354550 System.out.println("Loaded " + obj);
40364551 //new Exception().printStackTrace();
40374552 Object3D readobj = (Object3D) obj;
....@@ -4041,6 +4556,8 @@
40414556
40424557 if (readobj != null)
40434558 {
4559
+ if (Globals.SAVEONMAKE)
4560
+ Save();
40444561 try
40454562 {
40464563 //readobj.deepCopySelf(copy);
....@@ -4103,7 +4620,7 @@
41034620
41044621 void load() // throws ClassNotFoundException
41054622 {
4106
- if (GrafreeD.standAlone)
4623
+ if (Grafreed.standAlone)
41074624 {
41084625 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41094626 browser.show();
....@@ -4190,11 +4707,13 @@
41904707 try
41914708 {
41924709 FileOutputStream ostream = new FileOutputStream(lastname);
4193
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4710
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4711
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
41944712
41954713 p.writeObject(copy);
41964714 p.flush();
41974715
4716
+ zstream.close();
41984717 ostream.close();
41994718
42004719 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4204,11 +4723,12 @@
42044723 {
42054724 }
42064725 }
4726
+
42074727 String lastname;
42084728
42094729 void saveAs()
42104730 {
4211
- if (GrafreeD.standAlone)
4731
+ if (Grafreed.standAlone)
42124732 {
42134733 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42144734 browser.setVisible(true);
....@@ -4313,13 +4833,13 @@
43134833 try
43144834 {
43154835 FileOutputStream ostream = new FileOutputStream(filename);
4316
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4317
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4836
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4837
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43184838
43194839 Object3D objectparent = obj.parent;
43204840 obj.parent = null;
43214841
4322
- Object3D object = (Object3D) GrafreeD.clone(obj);
4842
+ Object3D object = (Object3D) Grafreed.clone(obj);
43234843
43244844 obj.parent = objectparent;
43254845
....@@ -4331,8 +4851,8 @@
43314851 p.writeObject(object);
43324852 p.flush();
43334853
4854
+ zstream.close();
43344855 ostream.close();
4335
- // zstream.close();
43364856
43374857 // group.selection.get(0).parent = parent;
43384858 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4353,7 +4873,7 @@
43534873 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43544874 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43554875 copy.generatePOV(buffer);
4356
- if (GrafreeD.standAlone)
4876
+ if (Grafreed.standAlone)
43574877 {
43584878 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43594879 browser.show();
....@@ -4379,7 +4899,8 @@
43794899 Object3D client;
43804900 Object3D copy;
43814901 MenuBar menuBar;
4382
- Menu windowMenu;
4902
+ Menu fileMenu;
4903
+ MenuItem newItem;
43834904 MenuItem loadItem;
43844905 MenuItem saveItem;
43854906 MenuItem saveAsItem;
....@@ -4387,13 +4908,11 @@
43874908 MenuItem reexportItem;
43884909 MenuItem povItem;
43894910 MenuItem closeItem;
4390
- Menu cameraMenu;
4911
+
43914912 CheckboxMenuItem zBufferItem;
43924913 //MenuItem normalLensItem;
4393
- MenuItem editCameraItem;
4394
- MenuItem revertCameraItem;
4395
- CheckboxMenuItem toggleLiveItem;
43964914 MenuItem stepItem;
4915
+ CheckboxMenuItem toggleLiveItem;
43974916 CheckboxMenuItem toggleFullScreenItem;
43984917 CheckboxMenuItem toggleTimelineItem;
43994918 CheckboxMenuItem toggleRenderItem;
....@@ -4402,25 +4921,36 @@
44024921 CheckboxMenuItem toggleFootContactItem;
44034922 CheckboxMenuItem toggleDLItem;
44044923 CheckboxMenuItem toggleTextureItem;
4405
- CheckboxMenuItem toggleRandomItem;
4924
+ CheckboxMenuItem toggleSwitchItem;
44064925 CheckboxMenuItem toggleRootItem;
44074926 CheckboxMenuItem animationItem;
44084927 CheckboxMenuItem toggleHandleItem;
44094928 CheckboxMenuItem togglePaintItem;
44104929 JSplitPane mainPanel;
44114930 JScrollPane scrollpane;
4931
+
44124932 JPanel toolbarPanel;
4413
- JPanel treePanel;
4933
+
4934
+ cGridBag treePanel;
4935
+
44144936 JPanel radioPanel;
44154937 ButtonGroup buttonGroup;
4416
- cGridBag ctrlPanel;
4938
+
4939
+ cGridBag toolboxPanel;
44174940 cGridBag materialPanel;
4941
+ cGridBag ctrlPanel;
4942
+
44184943 JScrollPane infoPanel;
4944
+
44194945 cGridBag optionsPanel;
4946
+
44204947 JTabbedPane objectPanel;
4948
+
44214949 cGridBag XYZPanel;
4950
+
44224951 JSplitPane gridPanel;
44234952 JSplitPane bigPanel;
4953
+
44244954 cGridBag bigThree;
44254955 cGridBag scenePanel;
44264956 cGridBag centralPanel;
....@@ -4535,8 +5065,13 @@
45355065 cNumberSlider fogField;
45365066 JLabel opacityPowerLabel;
45375067 cNumberSlider opacityPowerField;
4538
- JTree jTree;
5068
+ cTree jTree;
45395069 //ObjectUI parent;
45405070
45415071 cNumberSlider normalpushField;
5072
+
5073
+ private MenuItem importGFDItem;
5074
+ private MenuItem importVRMLX3DItem;
5075
+ private MenuItem import3DSItem;
5076
+ private MenuItem importOBJItem;
45425077 }