Normand Briere
2019-06-23 f1382bc839a74ef1d1534c61ea94e53cf54716df
ObjEditor.java
....@@ -36,6 +36,8 @@
3636 GroupEditor callee;
3737 JFrame frame;
3838
39
+ static ObjEditor theFrame;
40
+
3941 // SCRIPT
4042
4143 transient JFrame textpanel = null;
....@@ -138,34 +140,42 @@
138140 public void closeUI()
139141 {
140142 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
143
+// System.out.println("this = " + this);
144
+// System.out.println("objEditor = " + objEditor);
143145 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
146
+// objEditor.ctrlPanel.remove(nameField);
147
+
148
+ objEditor.ctrlPanel.remove(namePanel);
145149
146150 if (!GroupEditor.allparams)
147151 return;
148152
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);
153
+// objEditor.ctrlPanel.remove(liveCB);
154
+// objEditor.ctrlPanel.remove(hideCB);
155
+// objEditor.ctrlPanel.remove(markCB);
156
+//
157
+// objEditor.ctrlPanel.remove(randomCB);
158
+// objEditor.ctrlPanel.remove(speedupCB);
159
+// objEditor.ctrlPanel.remove(rewindCB);
160
+//
161
+// objEditor.ctrlPanel.remove(resetButton);
162
+// objEditor.ctrlPanel.remove(stepButton);
163
+//// objEditor.ctrlPanel.remove(stepAllButton);
164
+//// objEditor.ctrlPanel.remove(resetAllButton);
165
+// objEditor.ctrlPanel.remove(link2masterCB);
166
+// //objEditor.ctrlPanel.remove(flipVCB);
167
+// //objEditor.ctrlPanel.remove(texresMenu);
168
+// objEditor.ctrlPanel.remove(slowerButton);
169
+// objEditor.ctrlPanel.remove(fasterButton);
170
+// objEditor.ctrlPanel.remove(remarkButton);
167171
168
- Remove(normalpushField);
172
+ objEditor.ctrlPanel.remove(setupPanel);
173
+ objEditor.ctrlPanel.remove(setupPanel2);
174
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
175
+ objEditor.ctrlPanel.remove(pushPanel);
176
+ //objEditor.ctrlPanel.remove(fillPanel);
177
+
178
+ //Remove(normalpushField);
169179 }
170180
171181 public ObjEditor GetEditor()
....@@ -236,6 +246,7 @@
236246 //localCopy.parent = null;
237247
238248 frame = new JFrame();
249
+ frame.setUndecorated(true);
239250 objEditor = this;
240251 this.callee = callee;
241252
....@@ -269,24 +280,40 @@
269280 void SetupMenu()
270281 {
271282 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..."));
283
+ menuBar.add(fileMenu = new Menu("File"));
284
+ fileMenu.add(newItem = new MenuItem("New"));
285
+ fileMenu.add(loadItem = new MenuItem("Open..."));
286
+
287
+ //oe.menuBar.add(menu = new Menu("Include"));
288
+ Menu menu = new Menu("Import");
289
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
290
+ importOBJItem.addActionListener(this);
291
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
292
+ import3DSItem.addActionListener(this);
293
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
294
+ importVRMLX3DItem.addActionListener(this);
295
+ menu.add("-");
296
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
297
+ importGFDItem.addActionListener(this);
298
+ fileMenu.add(menu);
299
+ fileMenu.add("-");
300
+
301
+ fileMenu.add(saveItem = new MenuItem("Save"));
302
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277303 //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("-");
304
+ fileMenu.add("-");
305
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
306
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
307
+ fileMenu.add("-");
282308 if (client.parent != null)
283309 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
310
+ fileMenu.add(closeItem = new MenuItem("Close"));
285311 } else
286312 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
313
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288314 }
289315
316
+ newItem.addActionListener(this);
290317 loadItem.addActionListener(this);
291318 saveItem.addActionListener(this);
292319 saveAsItem.addActionListener(this);
....@@ -295,79 +322,35 @@
295322 //povItem.addActionListener(this);
296323 closeItem.addActionListener(this);
297324
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
-
353325 objectPanel = new JTabbedPane();
354326 toolbarPanel = new JPanel();
355327 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
328
+ treePanel = new cGridBag();
357329 treePanel.setName("Tree");
358
- ctrlPanel = new cGridBag(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
330
+
331
+ editPanel = new cGridBag().setVertical(true);
332
+ editPanel.setName("Edit");
333
+
334
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
335
+
336
+ editCommandsPanel = new cGridBag();
337
+ editPanel.add(editCommandsPanel);
338
+ editPanel.add(ctrlPanel);
339
+
360340 materialPanel = new cGridBag().setVertical(true);
341
+
361342 materialPanel.setName("Material");
362343 /*JTextPane*/
363344 infoarea = createTextPane();
345
+ doc = infoarea.getStyledDocument();
346
+
364347 infoarea.setEditable(true);
365348 SetText();
366349 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367350 // infoarea.setOpaque(false);
368351 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
352
+// TEXTAREA infoarea.setLineWrap(true);
353
+// TEXTAREA infoarea.setWrapStyleWord(true);
371354 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372355 infoPanel.setPreferredSize(new Dimension(50, 200));
373356 infoPanel.setName("Info");
....@@ -378,15 +361,15 @@
378361 mainPanel.setName("Main");
379362 mainPanel.setContinuousLayout(true);
380363 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382364 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
365
+ mainPanel.setDividerLocation(0.5); //1.0);
366
+ mainPanel.setResizeWeight(0.5);
384367
385368 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386369 //mainPanel.setLayout(new GridBagLayout());
387370 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
371
+// treePanel.setLayout(new GridBagLayout());
372
+ //ctrlPanel.setLayout(new GridBagLayout());
390373 //materialPanel.setLayout(new GridBagLayout());
391374
392375 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
....@@ -426,7 +409,7 @@
426409 static String newline = "\n";
427410 protected static final String buttonString = "JButton";
428411 StyledDocument doc;
429
- JTextArea infoarea;
412
+ JTextPane infoarea;
430413
431414 void ClearInfo()
432415 {
....@@ -449,10 +432,10 @@
449432 e.printStackTrace();
450433 }
451434
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();
435
+// String selection = infoarea.getText();
436
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
437
+// java.awt.datatransfer.Clipboard clipboard =
438
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456439 //clipboard.setContents(data, data);
457440 }
458441
....@@ -475,13 +458,13 @@
475458 //SendInfo("Name:", "bold");
476459 if (sel.GetTextures() != null || debug)
477460 {
478
- si.SendInfo(sel.toString(), "bold");
461
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479462 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480463 if (sel.Size() > 0)
481464 {
482465 si.SendInfo("#children = " + sel.Size(), "regular");
483466 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
467
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485468 if (debug)
486469 {
487470 try
....@@ -493,7 +476,10 @@
493476 }
494477
495478 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
479
+ {
480
+ si.SendInfo(" BBox min: " + minima, "regular");
481
+ si.SendInfo(" BBox max: " + maxima, "regular");
482
+ }
497483
498484 if (sel.bRep != null)
499485 {
....@@ -520,7 +506,7 @@
520506 }
521507 if (sel.support != null)
522508 {
523
- si.SendInfo(" support: " + sel.support, "regular");
509
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524510 }
525511 if (sel.scriptnode != null)
526512 {
....@@ -591,6 +577,9 @@
591577 {
592578 CameraPane.pointflow = (PointFlow) sel;
593579 }
580
+
581
+ si.SendInfo("_____________________", "regular");
582
+ si.SendInfo("", "regular");
594583 }
595584 }
596585
....@@ -606,68 +595,138 @@
606595 }
607596 }
608597
598
+static GraphicsDevice device = GraphicsEnvironment
599
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
600
+
601
+ Rectangle keeprect;
602
+ cRadio radio;
603
+
604
+cButton keepButton;
605
+ cButton twoButton; // Full 3D
606
+ cButton sixButton;
607
+ cButton threeButton;
608
+ cButton sevenButton;
609
+ cButton fourButton; // full panel
610
+ cButton oneButton; // full XYZ
611
+ //cButton currentLayout;
612
+
613
+ boolean maximized;
614
+
615
+ void Minimize()
616
+ {
617
+ frame.setState(Frame.ICONIFIED);
618
+ }
619
+
620
+ void Maximize()
621
+ {
622
+ if (maximized)
623
+ {
624
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
625
+ }
626
+ else
627
+ {
628
+ keeprect = frame.getBounds();
629
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
630
+ Dimension rect2 = frame.getToolkit().getScreenSize();
631
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
632
+// frame.setState(Frame.MAXIMIZED_BOTH);
633
+ }
634
+
635
+ maximized ^= true;
636
+ }
637
+
609638 void ToggleFullScreen()
610639 {
611640 if (CameraPane.FULLSCREEN)
612641 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
642
+ device.setFullScreenWindow(null);
643
+ //frame.setVisible(false);
644
+// frame.removeNotify();
645
+// frame.setUndecorated(false);
646
+// frame.addNotify();
647
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
648
+
649
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
650
+// X framePanel.add(bigThree);
651
+// X frame.getContentPane().add(/*"Center",*/framePanel);
652
+ framePanel.setDividerLocation(1);
653
+
654
+ //frame.setVisible(true);
655
+ radio.layout = keepButton;
656
+ //theFrame = null;
657
+ keepButton = null;
658
+ radio.layout.doClick();
659
+
616660 } else
617661 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
662
+ keepButton = radio.layout;
663
+ //keeprect = frame.getBounds();
664
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
665
+// frame.getToolkit().getScreenSize().height);
666
+ //frame.setVisible(false);
667
+ device.setFullScreenWindow(frame);
668
+// frame.removeNotify();
669
+// frame.setUndecorated(true);
670
+// frame.addNotify();
671
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
672
+// X framePanel.remove(bigThree);
673
+// X frame.getContentPane().add(/*"Center",*/bigThree);
674
+ framePanel.setDividerLocation(0);
675
+
676
+ radio.layout = twoButton;
677
+ radio.layout.doClick();
678
+ //frame.setVisible(true);
621679 }
680
+
622681 cameraView.ToggleFullScreen();
623682 }
624683
625
- private JTextArea createTextPane()
684
+ private JTextPane createTextPane()
626685 {
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
- };
686
+// TEXTAREA String[] initString =
687
+// {
688
+// "This is an editable JTextPane, ", //regular
689
+// "another ", //italic
690
+// "styled ", //bold
691
+// "text ", //small
692
+// "component, ", //large
693
+// "which supports embedded components..." + newline,//regular
694
+// " " + newline, //button
695
+// "...and embedded icons..." + newline, //regular
696
+// " ", //icon
697
+// newline + "JTextPane is a subclass of JEditorPane that "
698
+// + "uses a StyledEditorKit and StyledDocument, and provides "
699
+// + "cover methods for interacting with those objects."
700
+// };
701
+//
702
+// String[] initStyles =
703
+// {
704
+// "regular", "italic", "bold", "small", "large",
705
+// "regular", "button", "regular", "icon",
706
+// "regular"
707
+// };
708
+//
709
+// JTextPane textPane = new JTextPane();
710
+// textPane.setEditable(true);
711
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
712
+// addStylesToDocument(doc);
713
+//
714
+// try
715
+// {
716
+// for (int j = 0; j < 2; j++)
717
+// {
718
+// for (int i = 0; i < initString.length; i++)
719
+// {
720
+// doc.insertString(doc.getLength(), initString[i],
721
+// doc.getStyle(initStyles[i]));
722
+// }
723
+// }
724
+// } catch (BadLocationException ble)
725
+// {
726
+// System.err.println("Couldn't insert initial text into text pane.");
727
+// }
642728
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;
729
+ return new JTextPane(); // textPane;
671730 }
672731
673732 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +779,7 @@
720779 protected static ImageIcon createImageIcon(String path,
721780 String description)
722781 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
782
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724783 if (imgURL != null)
725784 {
726785 return new ImageIcon(imgURL, description);
....@@ -752,6 +811,7 @@
752811 // NumberSlider vDivsField;
753812 // JCheckBox endcaps;
754813 JCheckBox liveCB;
814
+ JCheckBox selectCB;
755815 JCheckBox hideCB;
756816 JCheckBox link2masterCB;
757817 JCheckBox markCB;
....@@ -767,54 +827,48 @@
767827 JButton slowerButton;
768828 JButton fasterButton;
769829 JButton remarkButton;
830
+
831
+ cGridBag editPanel;
832
+ cGridBag editCommandsPanel;
833
+
834
+ cGridBag namePanel;
835
+ cGridBag setupPanel;
836
+ cGridBag setupPanel2;
837
+ cGridBag objectCommandsPanel;
838
+ cGridBag pushPanel;
839
+ cGridBag fillPanel;
770840
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
841
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772842 {
773843 JCheckBox cb;
774844
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);
845
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780846 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784847
785848 return cb;
786849 }
787850
788
- cButton AddButton(ObjEditor oe, String label)
851
+ cButton AddButton(cGridBag panel, String label)
789852 {
790853 cButton cb;
791854
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);
855
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797856 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801857
802858 return cb;
803859 }
804860
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
861
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806862 {
807863 JComboBox combo;
808864
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;
865
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812866 combo.addActionListener(this);
813867
814868 return combo;
815869 }
816870
817
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow)
871
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818872 {
819873 cGridBag control = new cGridBag();
820874
....@@ -826,12 +880,12 @@
826880 control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827881 combo.setFloat(current);
828882
829
- ctrlPanel.add(control);
883
+ panel.add(control);
830884
831
- return combo;
885
+ return control;
832886 }
833887
834
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current)
888
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
835889 {
836890 cGridBag control = new cGridBag();
837891
....@@ -839,25 +893,21 @@
839893
840894 JLabel jlabel = new JLabel(label);
841895 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);
896
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
897
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
844898 combo.setInteger(current);
845899
846
- ctrlPanel.add(control);
900
+ panel.add(control);
847901
848
- return combo;
902
+ return control;
849903 }
850904
851905 JTextArea AddText(cGridBag ctrlPanel, String name)
852906 {
853907 JTextArea text;
854908
855
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
856
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
857909 ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858910 text.addCaretListener(this);
859
- aConstraints.gridx += 1;
860
- aConstraints.gridwidth = 1;
861911
862912 return text;
863913 }
....@@ -896,7 +946,7 @@
896946
897947 /*
898948 */
899
- void Return() // ObjEditor oe)
949
+ void Return0() // ObjEditor oe)
900950 {
901951 aConstraints.gridy += 1;
902952 aConstraints.gridx = 0;
....@@ -951,37 +1001,76 @@
9511001
9521002 void SetupUI2(ObjEditor oe)
9531003 {
954
-// oe.aConstraints.weightx = 0;
955
-// oe.aConstraints.weighty = 0;
956
-// oe.aConstraints.gridx = 0;
957
-// oe.aConstraints.gridy = 0;
958
- SetupName(oe);
1004
+ //SetupName(oe);
1005
+
1006
+ namePanel = new cGridBag();
1007
+
1008
+ nameField = AddText(namePanel, copy.GetName());
1009
+ namePanel.add(nameField);
1010
+ oe.ctrlPanel.add(namePanel);
1011
+
1012
+ oe.ctrlPanel.Return();
9591013
9601014 if (!GroupEditor.allparams)
9611015 return;
9621016
963
- liveCB = AddCheckBox(oe, "Live", copy.live);
964
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
965
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1017
+ setupPanel = new cGridBag().setVertical(false);
1018
+
1019
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1020
+ liveCB.setToolTipText("Animate object");
1021
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1022
+ selectCB.setToolTipText("Make object selectable");
9661023 // 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");
1024
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1025
+ hideCB.setToolTipText("Hide object");
1026
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1027
+ markCB.setToolTipText("Set the animation target transform");
1028
+
1029
+ setupPanel2 = new cGridBag().setVertical(false);
1030
+
1031
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1032
+ rewindCB.setToolTipText("Rewind animation");
1033
+
1034
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1035
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1036
+
1037
+ if (Globals.ADVANCED)
1038
+ {
1039
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1040
+ link2masterCB.setToolTipText("Attach to support");
1041
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1042
+ speedupCB.setToolTipText("Option motion capture");
1043
+ }
1044
+
1045
+ oe.ctrlPanel.add(setupPanel);
1046
+ oe.ctrlPanel.Return();
1047
+ oe.ctrlPanel.add(setupPanel2);
1048
+ oe.ctrlPanel.Return();
1049
+
1050
+ objectCommandsPanel = new cGridBag().setVertical(false);
1051
+
1052
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1053
+ resetButton.setToolTipText("Jump to frame zero");
1054
+ stepButton = AddButton(objectCommandsPanel, "Step");
1055
+ stepButton.setToolTipText("Step one frame");
9731056 // resetAllButton = AddButton(oe, "Reset All");
9741057 // stepAllButton = AddButton(oe, "Step All");
975
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9761058 // Return();
977
- slowerButton = AddButton(oe, "Slow");
978
- fasterButton = AddButton(oe, "Fast");
979
- remarkButton = AddButton(oe, "Rem");
1059
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1060
+ slowerButton.setToolTipText("Decrease animation speed");
1061
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1062
+ fasterButton.setToolTipText("Increase animation speed");
1063
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1064
+ remarkButton.setToolTipText("Set the current transform as the target");
9801065
981
- Return();
1066
+ oe.ctrlPanel.add(objectCommandsPanel);
1067
+ oe.ctrlPanel.Return();
9821068
983
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
984
- Return();
1069
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1070
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1071
+ //Return();
1072
+
1073
+ oe.ctrlPanel.Return();
9851074
9861075 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9871076 // ObjEditor.aConstraints.gridx += 1;
....@@ -1076,7 +1165,7 @@
10761165 oe.aConstraints.gridwidth = 1;
10771166 /**/
10781167 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1168
+ oe.ctrlPanel.Return();
10801169
10811170 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821171 //textureButton.setEnabled(false);
....@@ -1180,8 +1269,11 @@
11801269 //worldPanel.setName("World");
11811270 centralPanel = new cGridBag();
11821271 centralPanel.preferredWidth = 20;
1183
- timelinePanel = new JPanel(new BorderLayout());
1184
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1272
+
1273
+ if (Globals.ADVANCED)
1274
+ {
1275
+ timelinePanel = new JPanel(new BorderLayout());
1276
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11851277
11861278 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11871279 cameraPanel.setContinuousLayout(true);
....@@ -1190,7 +1282,10 @@
11901282 // cameraPanel.setDividerSize(9);
11911283 cameraPanel.setResizeWeight(1.0);
11921284
1285
+ }
1286
+
11931287 centralPanel.add(cameraView);
1288
+ centralPanel.setFocusable(true);
11941289 //frame.setJMenuBar(timelineMenubar);
11951290 //centralPanel.add(timelinePanel);
11961291
....@@ -1253,10 +1348,11 @@
12531348 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12541349 //tmp.setName("Edit");
12551350 objectPanel.add(materialPanel);
1256
- JPanel north = new JPanel(new BorderLayout());
1257
- north.setName("Edit");
1258
- north.add(ctrlPanel, BorderLayout.NORTH);
1259
- objectPanel.add(north);
1351
+// JPanel north = new JPanel(new BorderLayout());
1352
+// north.setName("Edit");
1353
+// north.add(ctrlPanel, BorderLayout.NORTH);
1354
+// objectPanel.add(north);
1355
+ objectPanel.add(editPanel);
12601356 objectPanel.add(infoPanel);
12611357
12621358 /*
....@@ -1278,7 +1374,7 @@
12781374 scrollpane.addMouseWheelListener(this); // Default not fast enough
12791375
12801376 /*JTabbedPane*/ scenePanel = new cGridBag();
1281
- scenePanel.preferredWidth = 7;
1377
+ scenePanel.preferredWidth = 6;
12821378
12831379 JTabbedPane tabbedPane = new JTabbedPane();
12841380 tabbedPane.add(scrollpane);
....@@ -1384,9 +1480,11 @@
13841480
13851481 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13861482
1387
- frame.setSize(1024, 768);
1388
- frame.show();
1483
+ frame.setSize(1280, 860);
1484
+ frame.setVisible(true);
13891485
1486
+ cameraView.requestFocusInWindow();
1487
+
13901488 gridPanel.setDividerLocation(1.0);
13911489
13921490 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1415,7 +1513,7 @@
14151513 ctrlPanel.removeAll();
14161514 }
14171515
1418
- void SetupMaterial(cGridBag ctrlPanel)
1516
+ void SetupMaterial(cGridBag panel)
14191517 {
14201518 /*
14211519 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
....@@ -1424,18 +1522,26 @@
14241522
14251523 cGridBag editBar = new cGridBag().setVertical(false);
14261524
1427
- editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints);
1525
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1526
+ createMaterialButton.setToolTipText("Create material");
14281527
14291528 /*
14301529 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14311530 */
14321531
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);
1532
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1533
+ clearMaterialButton.setToolTipText("Clear material");
1534
+
1535
+ if (Globals.ADVANCED)
1536
+ {
1537
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1538
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1539
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1540
+ }
14371541
1438
- ctrlPanel.add(editBar);
1542
+ editBar.preferredHeight = 15;
1543
+
1544
+ panel.add(editBar);
14391545
14401546 /**/
14411547 //aConstraints.weighty = 0;
....@@ -1445,17 +1551,13 @@
14451551 //aConstraints.gridx += 1;
14461552 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14471553
1448
- JPanel colorPanel = new JPanel(new BorderLayout());
1449
- colorPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1450
-
14511554 cGridBag colorSection = new cGridBag().setVertical(true);
1452
-
1453
- colorPanel.add(colorSection);
14541555
14551556 cGridBag color = new cGridBag();
14561557 color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
14571558 colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
14581559 color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1560
+ //colorField.preferredWidth = 200;
14591561 colorSection.add(color);
14601562
14611563 cGridBag modulation = new cGridBag();
....@@ -1488,16 +1590,13 @@
14881590 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
14891591 colorSection.add(shadowbias);
14901592
1491
- ctrlPanel.add(colorPanel);
1593
+ panel.add(new JSeparator());
1594
+
1595
+ panel.add(colorSection);
14921596
14931597 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14941598
1495
- JPanel diffusePanel = new JPanel(new BorderLayout());
1496
- diffusePanel.setBorder(BorderFactory.createLineBorder(Color.black));
1497
-
14981599 cGridBag diffuseSection = new cGridBag().setVertical(true);
1499
-
1500
- diffusePanel.add(diffuseSection);
15011600
15021601 cGridBag diffuse = new cGridBag();
15031602 diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
....@@ -1541,16 +1640,13 @@
15411640 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15421641 diffuseSection.add(fakedepth);
15431642
1544
- ctrlPanel.add(diffusePanel);
1643
+ panel.add(new JSeparator());
1644
+
1645
+ panel.add(diffuseSection);
15451646
15461647 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15471648
1548
- JPanel specularPanel = new JPanel(new BorderLayout());
1549
- specularPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1550
-
15511649 cGridBag specularSection = new cGridBag().setVertical(true);
1552
-
1553
- specularPanel.add(specularSection);
15541650
15551651 cGridBag specular = new cGridBag();
15561652 specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
....@@ -1582,7 +1678,7 @@
15821678 velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15831679 specularSection.add(velvet);
15841680
1585
- shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1);
1681
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
15861682 //Return();
15871683 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
15881684 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
....@@ -1595,16 +1691,13 @@
15951691 // aConstraints.gridwidth = 1;
15961692
15971693
1598
- ctrlPanel.add(specularPanel);
1694
+ panel.add(new JSeparator());
1695
+
1696
+ panel.add(specularSection);
15991697
16001698 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16011699
1602
- JPanel globalPanel = new JPanel(new BorderLayout());
1603
- globalPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1604
-
16051700 cGridBag globalSection = new cGridBag().setVertical(true);
1606
-
1607
- globalPanel.add(globalSection);
16081701
16091702 cGridBag camera = new cGridBag();
16101703 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
....@@ -1630,16 +1723,13 @@
16301723 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16311724 globalSection.add(opacity);
16321725
1633
- ctrlPanel.add(globalPanel);
1726
+ panel.add(new JSeparator());
1727
+
1728
+ panel.add(globalSection);
16341729
16351730 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16361731
1637
- JPanel texturePanel = new JPanel(new BorderLayout());
1638
- texturePanel.setBorder(BorderFactory.createLineBorder(Color.black));
1639
-
16401732 cGridBag textureSection = new cGridBag().setVertical(true);
1641
-
1642
- texturePanel.add(textureSection);
16431733
16441734 cGridBag bump = new cGridBag();
16451735 bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
....@@ -1677,7 +1767,9 @@
16771767 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16781768 textureSection.add(opacityPower);
16791769
1680
- ctrlPanel.add(texturePanel);
1770
+ panel.add(new JSeparator());
1771
+
1772
+ panel.add(textureSection);
16811773
16821774 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16831775
....@@ -1714,12 +1806,15 @@
17141806 opacityPowerField.addChangeListener(this);
17151807 /**/
17161808
1717
- resetSlidersButton.addActionListener(this);
17181809 clearMaterialButton.addActionListener(this);
17191810 createMaterialButton.addActionListener(this);
1720
-
1721
- propagateToggle.addItemListener(this);
1722
- multiplyToggle.addItemListener(this);
1811
+
1812
+ if (Globals.ADVANCED)
1813
+ {
1814
+ resetSlidersButton.addActionListener(this);
1815
+ propagateToggle.addItemListener(this);
1816
+ multiplyToggle.addItemListener(this);
1817
+ }
17231818 }
17241819
17251820 void DropFile(java.io.File[] files, boolean textures)
....@@ -1890,7 +1985,7 @@
18901985
18911986 //? flashIt = false;
18921987 CameraPane pane = (CameraPane) cameraView;
1893
- pane.clickStart(location.x, location.y, 0);
1988
+ pane.clickStart(location.x, location.y, 0, 0);
18941989 pane.clickEnd(location.x, location.y, 0, true);
18951990
18961991 if (group.selection.size() == 1)
....@@ -1939,6 +2034,7 @@
19392034 e2.printStackTrace();
19402035 }
19412036 }
2037
+
19422038 LoadJMEThread loadThread;
19432039
19442040 class LoadJMEThread extends Thread
....@@ -1996,6 +2092,7 @@
19962092 //LoadFile0(filename, converter);
19972093 }
19982094 }
2095
+
19992096 LoadOBJThread loadObjThread;
20002097
20012098 class LoadOBJThread extends Thread
....@@ -2074,19 +2171,19 @@
20742171
20752172 void LoadObjFile(String fullname)
20762173 {
2077
- /*
2174
+ System.out.println("Loading " + fullname);
2175
+ /**/
20782176 //lastFilename = fullname;
20792177 if(loadObjThread == null)
20802178 {
2081
- loadObjThread = new LoadOBJThread();
2082
- loadObjThread.start();
2179
+ loadObjThread = new LoadOBJThread();
2180
+ loadObjThread.start();
20832181 }
20842182
20852183 loadObjThread.add(fullname);
2086
- */
2184
+ /**/
20872185
2088
- System.out.println("Loading " + fullname);
2089
- makeSomething(new FileObject(fullname, true), true);
2186
+ //makeSomething(new FileObject(fullname, true), true);
20902187 }
20912188
20922189 void LoadGFDFile(String fullname)
....@@ -2347,11 +2444,11 @@
23472444
23482445 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23492446 {
2350
- if (GrafreeD.standAlone)
2447
+ if (Grafreed.standAlone)
23512448 {
23522449 /**/
23532450 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2354
- browser.show();
2451
+ browser.setVisible(true);
23552452 String filename = browser.getFile();
23562453 if (filename != null && filename.length() > 0)
23572454 {
....@@ -2496,6 +2593,7 @@
24962593 }
24972594 if (input == null)
24982595 {
2596
+ new Exception().printStackTrace();
24992597 System.exit(0);
25002598 }
25012599
....@@ -2710,7 +2808,8 @@
27102808 return;
27112809 }
27122810
2713
- multiplyToggle.setSelected(mat.multiply);
2811
+ if (multiplyToggle != null)
2812
+ multiplyToggle.setSelected(mat.multiply);
27142813
27152814 assert (object.projectedVertices != null);
27162815
....@@ -2925,9 +3024,9 @@
29253024 frame.validate();
29263025
29273026 return;
2928
- } else if (event.getSource() == toggleRandomItem)
3027
+ } else if (event.getSource() == toggleSwitchItem)
29293028 {
2930
- cameraView.ToggleRandom();
3029
+ cameraView.ToggleSwitch();
29313030 cameraView.repaint();
29323031 return;
29333032 } else if (event.getSource() == toggleHandleItem)
....@@ -2956,6 +3055,10 @@
29563055 {
29573056 copy.live ^= true;
29583057 return;
3058
+ } else if (event.getSource() == selectCB)
3059
+ {
3060
+ copy.dontselect ^= true;
3061
+ return;
29593062 } else if (event.getSource() == hideCB)
29603063 {
29613064 copy.hide ^= true;
....@@ -2970,6 +3073,7 @@
29703073 if (event.getSource() == randomCB)
29713074 {
29723075 copy.random ^= true;
3076
+ objEditor.refreshContents();
29733077 return;
29743078 }
29753079 if (event.getSource() == speedupCB)
....@@ -2993,8 +3097,9 @@
29933097
29943098 public void actionPerformed(ActionEvent event)
29953099 {
3100
+ Object source = event.getSource();
29963101 // SCRIPT DIALOG
2997
- if (event.getSource() == okbutton)
3102
+ if (source == okbutton)
29983103 {
29993104 textpanel.setVisible(false);
30003105 textpanel.remove(textarea);
....@@ -3006,7 +3111,7 @@
30063111 textarea = null;
30073112 textpanel = null;
30083113 }
3009
- if (event.getSource() == cancelbutton)
3114
+ if (source == cancelbutton)
30103115 {
30113116 textpanel.setVisible(false);
30123117 textpanel.remove(textarea);
....@@ -3018,50 +3123,50 @@
30183123 //applySelf();
30193124 //client.refreshEditWindow();
30203125 //refreshContents();
3021
- if (event.getSource() == nameField)
3126
+ if (source == nameField)
30223127 {
30233128 //System.out.println("ObjEditor " + event);
30243129 applySelf0(true);
30253130 //parent.applySelf();
30263131 objEditor.refreshContents();
3027
- } else if (event.getSource() == resetButton)
3132
+ } else if (source == resetButton)
30283133 {
30293134 CameraPane.fullreset = true;
30303135 copy.Reset(); // ResetMeshes();
30313136 copy.Touch();
30323137 objEditor.refreshContents();
3033
- } else if (event.getSource() == stepItem)
3138
+ } else if (source == stepItem)
30343139 {
30353140 //cameraView.ONESTEP = true;
30363141 Globals.ONESTEP = true;
30373142 cameraView.repaint();
30383143 return;
3039
- } else if (event.getSource() == stepButton)
3144
+ } else if (source == stepButton)
30403145 {
30413146 copy.Step();
30423147 copy.Touch();
30433148 objEditor.refreshContents();
3044
- } else if (event.getSource() == slowerButton)
3149
+ } else if (source == slowerButton)
30453150 {
30463151 copy.Slower();
30473152 copy.Touch();
30483153 objEditor.refreshContents();
3049
- } else if (event.getSource() == fasterButton)
3154
+ } else if (source == fasterButton)
30503155 {
30513156 copy.Faster();
30523157 copy.Touch();
30533158 objEditor.refreshContents();
3054
- } else if (event.getSource() == remarkButton)
3159
+ } else if (source == remarkButton)
30553160 {
30563161 copy.Remark();
30573162 copy.Touch();
30583163 objEditor.refreshContents();
3059
- } else if (event.getSource() == stepAllButton)
3164
+ } else if (source == stepAllButton)
30603165 {
30613166 copy.StepAll();
30623167 copy.Touch();
30633168 objEditor.refreshContents();
3064
- } else if (event.getSource() == resetAllButton)
3169
+ } else if (source == resetAllButton)
30653170 {
30663171 //CameraPane.fullreset = true;
30673172 copy.ResetAll(); // ResetMeshes();
....@@ -3094,53 +3199,75 @@
30943199 // Close();
30953200 // }
30963201 // else
3097
- if (event.getSource() == resetSlidersButton)
3202
+ if (source == resetSlidersButton)
30983203 {
30993204 ResetSliders();
3100
- } else if (event.getSource() == clearMaterialButton)
3205
+ } else if (source == clearMaterialButton)
31013206 {
31023207 ClearMaterial();
3103
- } else if (event.getSource() == createMaterialButton)
3208
+ } else if (source == createMaterialButton)
31043209 {
31053210 CreateMaterial();
3106
- } else if (event.getSource() == clearPanelButton)
3211
+ } else if (source == clearPanelButton)
31073212 {
31083213 copy.ClearUI();
31093214 refreshContents(true);
3110
- } /*
3111
- }
3112
-
3113
- public boolean action(Event event, Object arg)
3114
- {
3115
- */ else if (event.getSource() == closeItem)
3215
+ } else if (source == importGFDItem)
3216
+ {
3217
+ ImportGFD();
3218
+ } else
3219
+ if (source == importVRMLX3DItem)
3220
+ {
3221
+ ImportVRMLX3D();
3222
+ } else
3223
+ if (source == import3DSItem)
3224
+ {
3225
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3226
+ } else
3227
+ if (source == importOBJItem)
3228
+ {
3229
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3230
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3231
+ browser.setVisible(true);
3232
+ String filename = browser.getFile();
3233
+ if (filename != null && filename.length() > 0)
3234
+ {
3235
+ String fullname = browser.getDirectory() + filename;
3236
+ makeSomething(ReadOBJ(fullname), true);
3237
+ }
3238
+ } else
3239
+ if (source == closeItem)
31163240 {
31173241 Close();
31183242 //return true;
3119
- } else if (event.getSource() == loadItem)
3243
+ } else if (source == loadItem)
31203244 {
31213245 load();
31223246 //return true;
3123
- } else if (event.getSource() == saveItem)
3247
+ } else if (source == newItem)
3248
+ {
3249
+ New();
3250
+ } else if (source == saveItem)
31243251 {
31253252 save();
31263253 //return true;
3127
- } else if (event.getSource() == saveAsItem)
3254
+ } else if (source == saveAsItem)
31283255 {
31293256 saveAs();
31303257 //return true;
3131
- } else if (event.getSource() == reexportItem)
3258
+ } else if (source == reexportItem)
31323259 {
31333260 reexport();
31343261 //return true;
3135
- } else if (event.getSource() == exportAsItem)
3262
+ } else if (source == exportAsItem)
31363263 {
31373264 export();
31383265 //return true;
3139
- } else if (event.getSource() == povItem)
3266
+ } else if (source == povItem)
31403267 {
31413268 generatePOV();
31423269 //return true;
3143
- } else if (event.getSource() == zBufferItem)
3270
+ } else if (source == zBufferItem)
31443271 {
31453272 try
31463273 {
....@@ -3162,21 +3289,8 @@
31623289 cameraView.repaint();
31633290 //return true;
31643291 }
3165
- */ else if (event.getSource() == editCameraItem)
3166
- {
3167
- cameraView.ProtectCamera();
3168
- cameraView.repaint();
3169
- return;
3170
- } else if (event.getSource() == revertCameraItem)
3171
- {
3172
- cameraView.RevertCamera();
3173
- cameraView.repaint();
3174
- return;
3175
-// } else if (event.getSource() == textureButton)
3176
-// {
3177
-// return; // true;
3178
- } else // combos...
3179
- if (event.getSource() == texresMenu)
3292
+ */ else // combos...
3293
+ if (source == texresMenu)
31803294 {
31813295 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31823296 copy.texres = texresMenu.getSelectedIndex();
....@@ -3188,12 +3302,268 @@
31883302 }
31893303 }
31903304
3305
+ void New()
3306
+ {
3307
+ while (copy.Size() > 1)
3308
+ {
3309
+ copy.remove(1);
3310
+ }
3311
+
3312
+ ResetModel();
3313
+ objEditor.refreshContents();
3314
+ }
3315
+
3316
+ static public byte[] Compress(Object3D o)
3317
+ {
3318
+ try
3319
+ {
3320
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3321
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3322
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3323
+
3324
+ Object3D parent = o.parent;
3325
+ o.parent = null;
3326
+
3327
+ out.writeObject(o);
3328
+
3329
+ o.parent = parent;
3330
+
3331
+ out.flush();
3332
+
3333
+ zstream.close();
3334
+ out.close();
3335
+
3336
+ return baos.toByteArray();
3337
+ } catch (Exception e)
3338
+ {
3339
+ System.err.println(e);
3340
+ return null;
3341
+ }
3342
+ }
3343
+
3344
+ static public Object Uncompress(byte[] bytes)
3345
+ {
3346
+ System.out.println("#bytes = " + bytes.length);
3347
+ try
3348
+ {
3349
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3350
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3351
+ ObjectInputStream in = new ObjectInputStream(istream);
3352
+ Object obj = in.readObject();
3353
+ in.close();
3354
+
3355
+ return obj;
3356
+ } catch (Exception e)
3357
+ {
3358
+ System.err.println(e);
3359
+ return null;
3360
+ }
3361
+ }
3362
+
3363
+ static public Object clone(Object o)
3364
+ {
3365
+ try
3366
+ {
3367
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3369
+
3370
+ out.writeObject(o);
3371
+
3372
+ out.flush();
3373
+ out.close();
3374
+
3375
+ byte[] bytes = baos.toByteArray();
3376
+
3377
+ System.out.println("clone = " + bytes.length);
3378
+
3379
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3380
+ ObjectInputStream in = new ObjectInputStream(bais);
3381
+ Object obj = in.readObject();
3382
+ in.close();
3383
+
3384
+ return obj;
3385
+ } catch (Exception e)
3386
+ {
3387
+ System.err.println(e);
3388
+ return null;
3389
+ }
3390
+ }
3391
+
3392
+ cRadio GetCurrentTab()
3393
+ {
3394
+ cRadio ab;
3395
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3396
+ {
3397
+ ab = (cRadio)e.nextElement();
3398
+ if(ab.GetObject() == copy)
3399
+ {
3400
+ return ab;
3401
+ }
3402
+ }
3403
+
3404
+ return null;
3405
+ }
3406
+
3407
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3408
+
3409
+ public void Save()
3410
+ {
3411
+ cRadio tab = GetCurrentTab();
3412
+
3413
+ boolean temp = CameraPane.SWITCH;
3414
+ CameraPane.SWITCH = false;
3415
+
3416
+ copy.ExtractBigData(hashtable);
3417
+
3418
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3419
+ tab.graphs[tab.undoindex++] = Compress(copy);
3420
+
3421
+ copy.RestoreBigData(hashtable);
3422
+
3423
+ CameraPane.SWITCH = temp;
3424
+
3425
+ //assert(hashtable.isEmpty());
3426
+
3427
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3428
+ {
3429
+ tab.graphs[i] = null;
3430
+ }
3431
+
3432
+ // test save
3433
+ if (false)
3434
+ {
3435
+ try
3436
+ {
3437
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3438
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3439
+
3440
+ p.writeObject(copy);
3441
+
3442
+ p.flush();
3443
+
3444
+ ostream.close();
3445
+ } catch (Exception e)
3446
+ {
3447
+ e.printStackTrace();
3448
+ }
3449
+ }
3450
+ }
3451
+
3452
+ void CopyChanged(Object3D obj)
3453
+ {
3454
+ boolean temp = CameraPane.SWITCH;
3455
+ CameraPane.SWITCH = false;
3456
+
3457
+ copy.ExtractBigData(hashtable);
3458
+
3459
+ copy.clear();
3460
+
3461
+ for (int i=0; i<obj.Size(); i++)
3462
+ {
3463
+ copy.add(obj.get(i));
3464
+ }
3465
+
3466
+ copy.RestoreBigData(hashtable);
3467
+
3468
+ CameraPane.SWITCH = temp;
3469
+
3470
+ //assert(hashtable.isEmpty());
3471
+
3472
+ copy.Touch();
3473
+
3474
+ ResetModel();
3475
+ copy.HardTouch(); // recompile?
3476
+
3477
+ cRadio ab;
3478
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3479
+ {
3480
+ ab = (cRadio)e.nextElement();
3481
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3482
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3483
+ if (test != null)
3484
+ {
3485
+ test.editWindow = ab.object.editWindow;
3486
+ ab.object = test;
3487
+ }
3488
+ }
3489
+
3490
+ refreshContents();
3491
+ }
3492
+
3493
+ public void Undo()
3494
+ {
3495
+ cRadio tab = GetCurrentTab();
3496
+
3497
+ if (tab.undoindex == 0)
3498
+ {
3499
+ java.awt.Toolkit.getDefaultToolkit().beep();
3500
+ return;
3501
+ }
3502
+
3503
+ if (tab.graphs[tab.undoindex] == null)
3504
+ {
3505
+ Save();
3506
+ tab.undoindex -= 1;
3507
+ }
3508
+
3509
+ tab.undoindex -= 1;
3510
+
3511
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3512
+ }
3513
+
3514
+ public void Redo()
3515
+ {
3516
+ cRadio tab = GetCurrentTab();
3517
+
3518
+ if (tab.graphs[tab.undoindex + 1] == null)
3519
+ {
3520
+ java.awt.Toolkit.getDefaultToolkit().beep();
3521
+ return;
3522
+ }
3523
+
3524
+ tab.undoindex += 1;
3525
+
3526
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3527
+ }
3528
+
3529
+ void ImportGFD()
3530
+ {
3531
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3532
+ browser.show();
3533
+ String filename = browser.getFile();
3534
+ if (filename != null && filename.length() > 0)
3535
+ {
3536
+ String fullname = browser.getDirectory() + filename;
3537
+
3538
+ //Object3D readobj =
3539
+ objEditor.ReadGFD(fullname, objEditor);
3540
+ //makeSomething(readobj);
3541
+ }
3542
+ }
3543
+
3544
+ void ImportVRMLX3D()
3545
+ {
3546
+ if (Grafreed.standAlone)
3547
+ {
3548
+ /**/
3549
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3550
+ browser.show();
3551
+ String filename = browser.getFile();
3552
+ if (filename != null && filename.length() > 0)
3553
+ {
3554
+ String fullname = browser.getDirectory() + filename;
3555
+ LoadVRMLX3D(fullname);
3556
+ }
3557
+ /**/
3558
+ }
3559
+ }
3560
+
31913561 void ToggleAnimation()
31923562 {
31933563 if (!Globals.ANIMATION)
31943564 {
31953565 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3196
- browser.show();
3566
+ browser.setVisible(true);
31973567 String filename = browser.getFile();
31983568 if (filename != null && filename.length() > 0)
31993569 {
....@@ -3203,8 +3573,8 @@
32033573
32043574 Globals.ANIMATION ^= true;
32053575
3206
- GrafreeD.wav.cursor = 0;
3207
- GrafreeD.wav.loop = 0;
3576
+ Grafreed.wav.cursor = 0;
3577
+ Grafreed.wav.loop = 0;
32083578 }
32093579 } else
32103580 {
....@@ -3254,7 +3624,7 @@
32543624 void CreateMaterial()
32553625 {
32563626 //copy.ClearMaterial(); // PATCH
3257
- copy.CreateMaterialS(multiplyToggle.isSelected());
3627
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32583628 if (copy.selection.size() > 0)
32593629 //SetMaterial(copy);
32603630 {
....@@ -3313,11 +3683,11 @@
33133683 {
33143684 copy.ResetBlockLoop(); // temporary problem
33153685
3316
- boolean random = CameraPane.RANDOM;
3317
- CameraPane.RANDOM = false; // parse everything
3686
+ boolean random = CameraPane.SWITCH;
3687
+ CameraPane.SWITCH = false; // parse everything
33183688 copy.ResetDisplayList();
33193689 copy.HardTouch();
3320
- CameraPane.RANDOM = random;
3690
+ CameraPane.SWITCH = random;
33213691 }
33223692
33233693 // public void applySelf()
....@@ -3391,6 +3761,36 @@
33913761 {
33923762 //System.out.println("Propagate = " + propagate);
33933763 copy.UpdateMaterial(anchor, current, propagate);
3764
+
3765
+ if (copy.material != null)
3766
+ {
3767
+ cMaterial mat = copy.material;
3768
+
3769
+ colorField.SetToolTipValue((mat.color));
3770
+ modulationField.SetToolTipValue((mat.modulation));
3771
+ metalnessField.SetToolTipValue((mat.metalness));
3772
+ diffuseField.SetToolTipValue((mat.diffuse));
3773
+ specularField.SetToolTipValue((mat.specular));
3774
+ shininessField.SetToolTipValue((mat.shininess));
3775
+ shiftField.SetToolTipValue((mat.shift));
3776
+ ambientField.SetToolTipValue((mat.ambient));
3777
+ lightareaField.SetToolTipValue((mat.lightarea));
3778
+ diffusenessField.SetToolTipValue((mat.factor));
3779
+ velvetField.SetToolTipValue((mat.velvet));
3780
+ sheenField.SetToolTipValue((mat.sheen));
3781
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3782
+ backlitField.SetToolTipValue((mat.bump));
3783
+ anisoField.SetToolTipValue((mat.aniso));
3784
+ anisoVField.SetToolTipValue((mat.anisoV));
3785
+ cameraField.SetToolTipValue((mat.cameralight));
3786
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3787
+ shadowField.SetToolTipValue((mat.shadow));
3788
+ textureField.SetToolTipValue((mat.texture));
3789
+ opacityField.SetToolTipValue((mat.opacity));
3790
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3791
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3792
+ }
3793
+
33943794 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33953795 {
33963796 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3435,6 +3835,7 @@
34353835 || e.getSource() == apertureField
34363836 || e.getSource() == shadowblurField)
34373837 {
3838
+ new Exception().printStackTrace();
34383839 System.exit(0);
34393840 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34403841 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3505,7 +3906,7 @@
35053906 }
35063907
35073908 if (normalpushField != null)
3508
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3909
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35093910 }
35103911
35113912 void SnapObject()
....@@ -3769,6 +4170,7 @@
37694170
37704171 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37714172 {
4173
+ Save();
37724174 //Tween.set(thing, 0).target(1).start(tweenManager);
37734175 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37744176 // if (thing instanceof GenericJointDemo)
....@@ -3972,6 +4374,7 @@
39724374 }
39734375 }
39744376 }
4377
+
39754378 LoadGFDThread loadGFDThread;
39764379
39774380 void ReadGFD(String fullname, iCallBack cb)
....@@ -3991,8 +4394,10 @@
39914394
39924395 try
39934396 {
4397
+ // Try compressed version first.
39944398 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3995
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4399
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4400
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39964401
39974402 readobj = (Object3D) p.readObject();
39984403 istream.close();
....@@ -4000,7 +4405,20 @@
40004405 readobj.ResetDisplayList();
40014406 } catch (Exception e)
40024407 {
4003
- e.printStackTrace();
4408
+ //e.printStackTrace();
4409
+ try
4410
+ {
4411
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4412
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4413
+
4414
+ readobj = (Object3D) p.readObject();
4415
+ istream.close();
4416
+
4417
+ readobj.ResetDisplayList();
4418
+ } catch (Exception e2)
4419
+ {
4420
+ e2.printStackTrace();
4421
+ }
40044422 }
40054423 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40064424 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4046,6 +4464,12 @@
40464464
40474465 void LoadIt(Object obj)
40484466 {
4467
+ if (obj == null)
4468
+ {
4469
+ // Invalid file
4470
+ return;
4471
+ }
4472
+
40494473 System.out.println("Loaded " + obj);
40504474 //new Exception().printStackTrace();
40514475 Object3D readobj = (Object3D) obj;
....@@ -4055,6 +4479,7 @@
40554479
40564480 if (readobj != null)
40574481 {
4482
+ Save();
40584483 try
40594484 {
40604485 //readobj.deepCopySelf(copy);
....@@ -4117,7 +4542,7 @@
41174542
41184543 void load() // throws ClassNotFoundException
41194544 {
4120
- if (GrafreeD.standAlone)
4545
+ if (Grafreed.standAlone)
41214546 {
41224547 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41234548 browser.show();
....@@ -4204,11 +4629,13 @@
42044629 try
42054630 {
42064631 FileOutputStream ostream = new FileOutputStream(lastname);
4207
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4632
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4633
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42084634
42094635 p.writeObject(copy);
42104636 p.flush();
42114637
4638
+ zstream.close();
42124639 ostream.close();
42134640
42144641 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4218,11 +4645,12 @@
42184645 {
42194646 }
42204647 }
4648
+
42214649 String lastname;
42224650
42234651 void saveAs()
42244652 {
4225
- if (GrafreeD.standAlone)
4653
+ if (Grafreed.standAlone)
42264654 {
42274655 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42284656 browser.setVisible(true);
....@@ -4327,13 +4755,13 @@
43274755 try
43284756 {
43294757 FileOutputStream ostream = new FileOutputStream(filename);
4330
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4331
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4758
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4759
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43324760
43334761 Object3D objectparent = obj.parent;
43344762 obj.parent = null;
43354763
4336
- Object3D object = (Object3D) GrafreeD.clone(obj);
4764
+ Object3D object = (Object3D) Grafreed.clone(obj);
43374765
43384766 obj.parent = objectparent;
43394767
....@@ -4345,8 +4773,8 @@
43454773 p.writeObject(object);
43464774 p.flush();
43474775
4776
+ zstream.close();
43484777 ostream.close();
4349
- // zstream.close();
43504778
43514779 // group.selection.get(0).parent = parent;
43524780 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4367,7 +4795,7 @@
43674795 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43684796 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43694797 copy.generatePOV(buffer);
4370
- if (GrafreeD.standAlone)
4798
+ if (Grafreed.standAlone)
43714799 {
43724800 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43734801 browser.show();
....@@ -4393,7 +4821,8 @@
43934821 Object3D client;
43944822 Object3D copy;
43954823 MenuBar menuBar;
4396
- Menu windowMenu;
4824
+ Menu fileMenu;
4825
+ MenuItem newItem;
43974826 MenuItem loadItem;
43984827 MenuItem saveItem;
43994828 MenuItem saveAsItem;
....@@ -4401,13 +4830,11 @@
44014830 MenuItem reexportItem;
44024831 MenuItem povItem;
44034832 MenuItem closeItem;
4404
- Menu cameraMenu;
4833
+
44054834 CheckboxMenuItem zBufferItem;
44064835 //MenuItem normalLensItem;
4407
- MenuItem editCameraItem;
4408
- MenuItem revertCameraItem;
4409
- CheckboxMenuItem toggleLiveItem;
44104836 MenuItem stepItem;
4837
+ CheckboxMenuItem toggleLiveItem;
44114838 CheckboxMenuItem toggleFullScreenItem;
44124839 CheckboxMenuItem toggleTimelineItem;
44134840 CheckboxMenuItem toggleRenderItem;
....@@ -4416,7 +4843,7 @@
44164843 CheckboxMenuItem toggleFootContactItem;
44174844 CheckboxMenuItem toggleDLItem;
44184845 CheckboxMenuItem toggleTextureItem;
4419
- CheckboxMenuItem toggleRandomItem;
4846
+ CheckboxMenuItem toggleSwitchItem;
44204847 CheckboxMenuItem toggleRootItem;
44214848 CheckboxMenuItem animationItem;
44224849 CheckboxMenuItem toggleHandleItem;
....@@ -4424,7 +4851,7 @@
44244851 JSplitPane mainPanel;
44254852 JScrollPane scrollpane;
44264853 JPanel toolbarPanel;
4427
- JPanel treePanel;
4854
+ cGridBag treePanel;
44284855 JPanel radioPanel;
44294856 ButtonGroup buttonGroup;
44304857 cGridBag ctrlPanel;
....@@ -4553,4 +4980,9 @@
45534980 //ObjectUI parent;
45544981
45554982 cNumberSlider normalpushField;
4983
+
4984
+ private MenuItem importGFDItem;
4985
+ private MenuItem importVRMLX3DItem;
4986
+ private MenuItem import3DSItem;
4987
+ private MenuItem importOBJItem;
45564988 }