Normand Briere
2019-06-11 1d909ffa0c2beb51d453b53b845c4f3a749ca5f0
ObjEditor.java
....@@ -138,34 +138,41 @@
138138 public void closeUI()
139139 {
140140 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
141
+// System.out.println("this = " + this);
142
+// System.out.println("objEditor = " + objEditor);
143143 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
144
+// objEditor.ctrlPanel.remove(nameField);
145
+
146
+ objEditor.ctrlPanel.remove(namePanel);
145147
146148 if (!GroupEditor.allparams)
147149 return;
148150
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);
151
+// objEditor.ctrlPanel.remove(liveCB);
152
+// objEditor.ctrlPanel.remove(hideCB);
153
+// objEditor.ctrlPanel.remove(markCB);
154
+//
155
+// objEditor.ctrlPanel.remove(randomCB);
156
+// objEditor.ctrlPanel.remove(speedupCB);
157
+// objEditor.ctrlPanel.remove(rewindCB);
158
+//
159
+// objEditor.ctrlPanel.remove(resetButton);
160
+// objEditor.ctrlPanel.remove(stepButton);
161
+//// objEditor.ctrlPanel.remove(stepAllButton);
162
+//// objEditor.ctrlPanel.remove(resetAllButton);
163
+// objEditor.ctrlPanel.remove(link2masterCB);
164
+// //objEditor.ctrlPanel.remove(flipVCB);
165
+// //objEditor.ctrlPanel.remove(texresMenu);
166
+// objEditor.ctrlPanel.remove(slowerButton);
167
+// objEditor.ctrlPanel.remove(fasterButton);
168
+// objEditor.ctrlPanel.remove(remarkButton);
167169
168
- Remove(normalpushField);
170
+ objEditor.ctrlPanel.remove(setupPanel);
171
+ objEditor.ctrlPanel.remove(commandsPanel);
172
+ objEditor.ctrlPanel.remove(pushPanel);
173
+ //objEditor.ctrlPanel.remove(fillPanel);
174
+
175
+ //Remove(normalpushField);
169176 }
170177
171178 public ObjEditor GetEditor()
....@@ -269,24 +276,40 @@
269276 void SetupMenu()
270277 {
271278 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..."));
279
+ menuBar.add(fileMenu = new Menu("File"));
280
+ fileMenu.add(newItem = new MenuItem("New"));
281
+ fileMenu.add(loadItem = new MenuItem("Load..."));
282
+
283
+ //oe.menuBar.add(menu = new Menu("Include"));
284
+ Menu menu = new Menu("Import");
285
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
286
+ importOBJItem.addActionListener(this);
287
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
288
+ import3DSItem.addActionListener(this);
289
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
290
+ importVRMLX3DItem.addActionListener(this);
291
+ menu.add("-");
292
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
293
+ importGFDItem.addActionListener(this);
294
+ fileMenu.add(menu);
295
+ fileMenu.add("-");
296
+
297
+ fileMenu.add(saveItem = new MenuItem("Save"));
298
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277299 //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("-");
300
+ fileMenu.add("-");
301
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
302
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
303
+ fileMenu.add("-");
282304 if (client.parent != null)
283305 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
306
+ fileMenu.add(closeItem = new MenuItem("Close"));
285307 } else
286308 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
309
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288310 }
289311
312
+ newItem.addActionListener(this);
290313 loadItem.addActionListener(this);
291314 saveItem.addActionListener(this);
292315 saveAsItem.addActionListener(this);
....@@ -295,79 +318,26 @@
295318 //povItem.addActionListener(this);
296319 closeItem.addActionListener(this);
297320
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
-
353321 objectPanel = new JTabbedPane();
354322 toolbarPanel = new JPanel();
355323 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
324
+ treePanel = new cGridBag();
357325 treePanel.setName("Tree");
358
- ctrlPanel = new cGridBag(); // new GridBagLayout());
326
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
359327 ctrlPanel.setName("Edit");
360328 materialPanel = new cGridBag().setVertical(true);
361329 materialPanel.setName("Material");
362330 /*JTextPane*/
363331 infoarea = createTextPane();
332
+ doc = infoarea.getStyledDocument();
333
+
364334 infoarea.setEditable(true);
365335 SetText();
366336 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367337 // infoarea.setOpaque(false);
368338 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
339
+// TEXTAREA infoarea.setLineWrap(true);
340
+// TEXTAREA infoarea.setWrapStyleWord(true);
371341 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372342 infoPanel.setPreferredSize(new Dimension(50, 200));
373343 infoPanel.setName("Info");
....@@ -378,15 +348,15 @@
378348 mainPanel.setName("Main");
379349 mainPanel.setContinuousLayout(true);
380350 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382351 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
352
+ mainPanel.setDividerLocation(0.5); //1.0);
353
+ mainPanel.setResizeWeight(0.5);
384354
385355 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386356 //mainPanel.setLayout(new GridBagLayout());
387357 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
358
+// treePanel.setLayout(new GridBagLayout());
359
+ //ctrlPanel.setLayout(new GridBagLayout());
390360 //materialPanel.setLayout(new GridBagLayout());
391361
392362 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
....@@ -426,7 +396,7 @@
426396 static String newline = "\n";
427397 protected static final String buttonString = "JButton";
428398 StyledDocument doc;
429
- JTextArea infoarea;
399
+ JTextPane infoarea;
430400
431401 void ClearInfo()
432402 {
....@@ -475,13 +445,13 @@
475445 //SendInfo("Name:", "bold");
476446 if (sel.GetTextures() != null || debug)
477447 {
478
- si.SendInfo(sel.toString(), "bold");
448
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479449 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480450 if (sel.Size() > 0)
481451 {
482452 si.SendInfo("#children = " + sel.Size(), "regular");
483453 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
454
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485455 if (debug)
486456 {
487457 try
....@@ -493,7 +463,10 @@
493463 }
494464
495465 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
466
+ {
467
+ si.SendInfo(" BBox min: " + minima, "regular");
468
+ si.SendInfo(" BBox max: " + maxima, "regular");
469
+ }
497470
498471 if (sel.bRep != null)
499472 {
....@@ -520,7 +493,7 @@
520493 }
521494 if (sel.support != null)
522495 {
523
- si.SendInfo(" support: " + sel.support, "regular");
496
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524497 }
525498 if (sel.scriptnode != null)
526499 {
....@@ -591,6 +564,9 @@
591564 {
592565 CameraPane.pointflow = (PointFlow) sel;
593566 }
567
+
568
+ si.SendInfo("_____________________", "regular");
569
+ si.SendInfo("", "regular");
594570 }
595571 }
596572
....@@ -622,52 +598,52 @@
622598 cameraView.ToggleFullScreen();
623599 }
624600
625
- private JTextArea createTextPane()
601
+ private JTextPane createTextPane()
626602 {
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
- };
603
+// TEXTAREA String[] initString =
604
+// {
605
+// "This is an editable JTextPane, ", //regular
606
+// "another ", //italic
607
+// "styled ", //bold
608
+// "text ", //small
609
+// "component, ", //large
610
+// "which supports embedded components..." + newline,//regular
611
+// " " + newline, //button
612
+// "...and embedded icons..." + newline, //regular
613
+// " ", //icon
614
+// newline + "JTextPane is a subclass of JEditorPane that "
615
+// + "uses a StyledEditorKit and StyledDocument, and provides "
616
+// + "cover methods for interacting with those objects."
617
+// };
618
+//
619
+// String[] initStyles =
620
+// {
621
+// "regular", "italic", "bold", "small", "large",
622
+// "regular", "button", "regular", "icon",
623
+// "regular"
624
+// };
625
+//
626
+// JTextPane textPane = new JTextPane();
627
+// textPane.setEditable(true);
628
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
629
+// addStylesToDocument(doc);
630
+//
631
+// try
632
+// {
633
+// for (int j = 0; j < 2; j++)
634
+// {
635
+// for (int i = 0; i < initString.length; i++)
636
+// {
637
+// doc.insertString(doc.getLength(), initString[i],
638
+// doc.getStyle(initStyles[i]));
639
+// }
640
+// }
641
+// } catch (BadLocationException ble)
642
+// {
643
+// System.err.println("Couldn't insert initial text into text pane.");
644
+// }
642645
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;
646
+ return new JTextPane(); // textPane;
671647 }
672648
673649 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +696,7 @@
720696 protected static ImageIcon createImageIcon(String path,
721697 String description)
722698 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
699
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724700 if (imgURL != null)
725701 {
726702 return new ImageIcon(imgURL, description);
....@@ -752,6 +728,7 @@
752728 // NumberSlider vDivsField;
753729 // JCheckBox endcaps;
754730 JCheckBox liveCB;
731
+ JCheckBox selectCB;
755732 JCheckBox hideCB;
756733 JCheckBox link2masterCB;
757734 JCheckBox markCB;
....@@ -767,54 +744,44 @@
767744 JButton slowerButton;
768745 JButton fasterButton;
769746 JButton remarkButton;
747
+
748
+ cGridBag namePanel;
749
+ cGridBag setupPanel;
750
+ cGridBag commandsPanel;
751
+ cGridBag pushPanel;
752
+ cGridBag fillPanel;
770753
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
754
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772755 {
773756 JCheckBox cb;
774757
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);
758
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780759 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784760
785761 return cb;
786762 }
787763
788
- cButton AddButton(ObjEditor oe, String label)
764
+ cButton AddButton(cGridBag panel, String label)
789765 {
790766 cButton cb;
791767
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);
768
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797769 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801770
802771 return cb;
803772 }
804773
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
774
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806775 {
807776 JComboBox combo;
808777
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;
778
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812779 combo.addActionListener(this);
813780
814781 return combo;
815782 }
816783
817
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow)
784
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818785 {
819786 cGridBag control = new cGridBag();
820787
....@@ -826,12 +793,12 @@
826793 control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827794 combo.setFloat(current);
828795
829
- ctrlPanel.add(control);
796
+ panel.add(control);
830797
831
- return combo;
798
+ return control;
832799 }
833800
834
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current)
801
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
835802 {
836803 cGridBag control = new cGridBag();
837804
....@@ -839,25 +806,21 @@
839806
840807 JLabel jlabel = new JLabel(label);
841808 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);
809
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
844811 combo.setInteger(current);
845812
846
- ctrlPanel.add(control);
813
+ panel.add(control);
847814
848
- return combo;
815
+ return control;
849816 }
850817
851818 JTextArea AddText(cGridBag ctrlPanel, String name)
852819 {
853820 JTextArea text;
854821
855
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
856
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
857822 ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858823 text.addCaretListener(this);
859
- aConstraints.gridx += 1;
860
- aConstraints.gridwidth = 1;
861824
862825 return text;
863826 }
....@@ -896,7 +859,7 @@
896859
897860 /*
898861 */
899
- void Return() // ObjEditor oe)
862
+ void Return0() // ObjEditor oe)
900863 {
901864 aConstraints.gridy += 1;
902865 aConstraints.gridx = 0;
....@@ -951,37 +914,72 @@
951914
952915 void SetupUI2(ObjEditor oe)
953916 {
954
-// oe.aConstraints.weightx = 0;
955
-// oe.aConstraints.weighty = 0;
956
-// oe.aConstraints.gridx = 0;
957
-// oe.aConstraints.gridy = 0;
958
- SetupName(oe);
917
+ //SetupName(oe);
918
+
919
+ namePanel = new cGridBag();
920
+
921
+ nameField = AddText(namePanel, copy.GetName());
922
+ namePanel.add(nameField);
923
+ oe.ctrlPanel.add(namePanel);
924
+
925
+ oe.ctrlPanel.Return();
959926
960927 if (!GroupEditor.allparams)
961928 return;
962929
963
- liveCB = AddCheckBox(oe, "Live", copy.live);
964
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
965
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
930
+ setupPanel = new cGridBag().setVertical(false);
931
+
932
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
933
+ liveCB.setToolTipText("Animate object");
934
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
935
+ selectCB.setToolTipText("Make object selectable");
966936 // 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");
937
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
938
+ hideCB.setToolTipText("Hide object");
939
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
940
+ markCB.setToolTipText("Set the animation target transform");
941
+
942
+ rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
943
+ rewindCB.setToolTipText("Rewind animation");
944
+
945
+ randomCB = AddCheckBox(setupPanel, "Random", copy.random);
946
+ randomCB.setToolTipText("Option for switch node");
947
+
948
+ if (Globals.ADVANCED)
949
+ {
950
+ link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
951
+ link2masterCB.setToolTipText("Attach to support");
952
+ speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
953
+ speedupCB.setToolTipText("Option motion capture");
954
+ }
955
+
956
+ oe.ctrlPanel.add(setupPanel);
957
+ oe.ctrlPanel.Return();
958
+
959
+ commandsPanel = new cGridBag().setVertical(false);
960
+
961
+ resetButton = AddButton(commandsPanel, "Reset");
962
+ resetButton.setToolTipText("Jump to frame zero");
963
+ stepButton = AddButton(commandsPanel, "Step");
964
+ stepButton.setToolTipText("Step one frame");
973965 // resetAllButton = AddButton(oe, "Reset All");
974966 // stepAllButton = AddButton(oe, "Step All");
975
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
976967 // Return();
977
- slowerButton = AddButton(oe, "Slow");
978
- fasterButton = AddButton(oe, "Fast");
979
- remarkButton = AddButton(oe, "Rem");
968
+ slowerButton = AddButton(commandsPanel, "Slow");
969
+ slowerButton.setToolTipText("Decrease animation speed");
970
+ fasterButton = AddButton(commandsPanel, "Fast");
971
+ fasterButton.setToolTipText("Increase animation speed");
972
+ remarkButton = AddButton(commandsPanel, "Remark");
973
+ remarkButton.setToolTipText("Set the current transform as the target");
980974
981
- //Return();
975
+ oe.ctrlPanel.add(commandsPanel);
976
+ oe.ctrlPanel.Return();
982977
983
- //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
978
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
979
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
984980 //Return();
981
+
982
+ oe.ctrlPanel.Return();
985983
986984 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
987985 // ObjEditor.aConstraints.gridx += 1;
....@@ -1076,7 +1074,7 @@
10761074 oe.aConstraints.gridwidth = 1;
10771075 /**/
10781076 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1077
+ oe.ctrlPanel.Return();
10801078
10811079 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821080 //textureButton.setEnabled(false);
....@@ -1253,10 +1251,11 @@
12531251 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12541252 //tmp.setName("Edit");
12551253 objectPanel.add(materialPanel);
1256
- JPanel north = new JPanel(new BorderLayout());
1257
- north.setName("Edit");
1258
- north.add(ctrlPanel, BorderLayout.NORTH);
1259
- objectPanel.add(north);
1254
+// JPanel north = new JPanel(new BorderLayout());
1255
+// north.setName("Edit");
1256
+// north.add(ctrlPanel, BorderLayout.NORTH);
1257
+// objectPanel.add(north);
1258
+ objectPanel.add(ctrlPanel);
12601259 objectPanel.add(infoPanel);
12611260
12621261 /*
....@@ -1278,7 +1277,7 @@
12781277 scrollpane.addMouseWheelListener(this); // Default not fast enough
12791278
12801279 /*JTabbedPane*/ scenePanel = new cGridBag();
1281
- scenePanel.preferredWidth = 7;
1280
+ scenePanel.preferredWidth = 6;
12821281
12831282 JTabbedPane tabbedPane = new JTabbedPane();
12841283 tabbedPane.add(scrollpane);
....@@ -1384,8 +1383,8 @@
13841383
13851384 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13861385
1387
- frame.setSize(1024, 768);
1388
- frame.show();
1386
+ frame.setSize(1280, 860);
1387
+ frame.setVisible(true);
13891388
13901389 gridPanel.setDividerLocation(1.0);
13911390
....@@ -1415,7 +1414,7 @@
14151414 ctrlPanel.removeAll();
14161415 }
14171416
1418
- void SetupMaterial(cGridBag ctrlPanel)
1417
+ void SetupMaterial(cGridBag panel)
14191418 {
14201419 /*
14211420 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
....@@ -1424,18 +1423,26 @@
14241423
14251424 cGridBag editBar = new cGridBag().setVertical(false);
14261425
1427
- editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints);
1426
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1427
+ createMaterialButton.setToolTipText("Create material");
14281428
14291429 /*
14301430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14311431 */
14321432
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);
1433
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1434
+ clearMaterialButton.setToolTipText("Clear material");
1435
+
1436
+ if (Globals.ADVANCED)
1437
+ {
1438
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1439
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1440
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1441
+ }
14371442
1438
- ctrlPanel.add(editBar);
1443
+ editBar.preferredHeight = 15;
1444
+
1445
+ panel.add(editBar);
14391446
14401447 /**/
14411448 //aConstraints.weighty = 0;
....@@ -1484,9 +1491,9 @@
14841491 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
14851492 colorSection.add(shadowbias);
14861493
1487
- ctrlPanel.add(new JSeparator());
1494
+ panel.add(new JSeparator());
14881495
1489
- ctrlPanel.add(colorSection);
1496
+ panel.add(colorSection);
14901497
14911498 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14921499
....@@ -1534,9 +1541,9 @@
15341541 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15351542 diffuseSection.add(fakedepth);
15361543
1537
- ctrlPanel.add(new JSeparator());
1544
+ panel.add(new JSeparator());
15381545
1539
- ctrlPanel.add(diffuseSection);
1546
+ panel.add(diffuseSection);
15401547
15411548 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15421549
....@@ -1572,7 +1579,7 @@
15721579 velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15731580 specularSection.add(velvet);
15741581
1575
- shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1);
1582
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
15761583 //Return();
15771584 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
15781585 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
....@@ -1585,9 +1592,9 @@
15851592 // aConstraints.gridwidth = 1;
15861593
15871594
1588
- ctrlPanel.add(new JSeparator());
1595
+ panel.add(new JSeparator());
15891596
1590
- ctrlPanel.add(specularSection);
1597
+ panel.add(specularSection);
15911598
15921599 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15931600
....@@ -1617,9 +1624,9 @@
16171624 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16181625 globalSection.add(opacity);
16191626
1620
- ctrlPanel.add(new JSeparator());
1627
+ panel.add(new JSeparator());
16211628
1622
- ctrlPanel.add(globalSection);
1629
+ panel.add(globalSection);
16231630
16241631 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16251632
....@@ -1661,9 +1668,9 @@
16611668 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16621669 textureSection.add(opacityPower);
16631670
1664
- ctrlPanel.add(new JSeparator());
1671
+ panel.add(new JSeparator());
16651672
1666
- ctrlPanel.add(textureSection);
1673
+ panel.add(textureSection);
16671674
16681675 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16691676
....@@ -1700,12 +1707,15 @@
17001707 opacityPowerField.addChangeListener(this);
17011708 /**/
17021709
1703
- resetSlidersButton.addActionListener(this);
17041710 clearMaterialButton.addActionListener(this);
17051711 createMaterialButton.addActionListener(this);
1706
-
1707
- propagateToggle.addItemListener(this);
1708
- multiplyToggle.addItemListener(this);
1712
+
1713
+ if (Globals.ADVANCED)
1714
+ {
1715
+ resetSlidersButton.addActionListener(this);
1716
+ propagateToggle.addItemListener(this);
1717
+ multiplyToggle.addItemListener(this);
1718
+ }
17091719 }
17101720
17111721 void DropFile(java.io.File[] files, boolean textures)
....@@ -1876,7 +1886,7 @@
18761886
18771887 //? flashIt = false;
18781888 CameraPane pane = (CameraPane) cameraView;
1879
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
18801890 pane.clickEnd(location.x, location.y, 0, true);
18811891
18821892 if (group.selection.size() == 1)
....@@ -1925,6 +1935,7 @@
19251935 e2.printStackTrace();
19261936 }
19271937 }
1938
+
19281939 LoadJMEThread loadThread;
19291940
19301941 class LoadJMEThread extends Thread
....@@ -1982,6 +1993,7 @@
19821993 //LoadFile0(filename, converter);
19831994 }
19841995 }
1996
+
19851997 LoadOBJThread loadObjThread;
19861998
19871999 class LoadOBJThread extends Thread
....@@ -2333,11 +2345,11 @@
23332345
23342346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23352347 {
2336
- if (GrafreeD.standAlone)
2348
+ if (Grafreed.standAlone)
23372349 {
23382350 /**/
23392351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2340
- browser.show();
2352
+ browser.setVisible(true);
23412353 String filename = browser.getFile();
23422354 if (filename != null && filename.length() > 0)
23432355 {
....@@ -2482,6 +2494,7 @@
24822494 }
24832495 if (input == null)
24842496 {
2497
+ new Exception().printStackTrace();
24852498 System.exit(0);
24862499 }
24872500
....@@ -2696,7 +2709,8 @@
26962709 return;
26972710 }
26982711
2699
- multiplyToggle.setSelected(mat.multiply);
2712
+ if (multiplyToggle != null)
2713
+ multiplyToggle.setSelected(mat.multiply);
27002714
27012715 assert (object.projectedVertices != null);
27022716
....@@ -2911,7 +2925,7 @@
29112925 frame.validate();
29122926
29132927 return;
2914
- } else if (event.getSource() == toggleRandomItem)
2928
+ } else if (event.getSource() == toggleSwitchItem)
29152929 {
29162930 cameraView.ToggleRandom();
29172931 cameraView.repaint();
....@@ -2942,6 +2956,10 @@
29422956 {
29432957 copy.live ^= true;
29442958 return;
2959
+ } else if (event.getSource() == selectCB)
2960
+ {
2961
+ copy.dontselect ^= true;
2962
+ return;
29452963 } else if (event.getSource() == hideCB)
29462964 {
29472965 copy.hide ^= true;
....@@ -2956,6 +2974,7 @@
29562974 if (event.getSource() == randomCB)
29572975 {
29582976 copy.random ^= true;
2977
+ objEditor.refreshContents();
29592978 return;
29602979 }
29612980 if (event.getSource() == speedupCB)
....@@ -2979,8 +2998,9 @@
29792998
29802999 public void actionPerformed(ActionEvent event)
29813000 {
3001
+ Object source = event.getSource();
29823002 // SCRIPT DIALOG
2983
- if (event.getSource() == okbutton)
3003
+ if (source == okbutton)
29843004 {
29853005 textpanel.setVisible(false);
29863006 textpanel.remove(textarea);
....@@ -2992,7 +3012,7 @@
29923012 textarea = null;
29933013 textpanel = null;
29943014 }
2995
- if (event.getSource() == cancelbutton)
3015
+ if (source == cancelbutton)
29963016 {
29973017 textpanel.setVisible(false);
29983018 textpanel.remove(textarea);
....@@ -3004,50 +3024,50 @@
30043024 //applySelf();
30053025 //client.refreshEditWindow();
30063026 //refreshContents();
3007
- if (event.getSource() == nameField)
3027
+ if (source == nameField)
30083028 {
30093029 //System.out.println("ObjEditor " + event);
30103030 applySelf0(true);
30113031 //parent.applySelf();
30123032 objEditor.refreshContents();
3013
- } else if (event.getSource() == resetButton)
3033
+ } else if (source == resetButton)
30143034 {
30153035 CameraPane.fullreset = true;
30163036 copy.Reset(); // ResetMeshes();
30173037 copy.Touch();
30183038 objEditor.refreshContents();
3019
- } else if (event.getSource() == stepItem)
3039
+ } else if (source == stepItem)
30203040 {
30213041 //cameraView.ONESTEP = true;
30223042 Globals.ONESTEP = true;
30233043 cameraView.repaint();
30243044 return;
3025
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
30263046 {
30273047 copy.Step();
30283048 copy.Touch();
30293049 objEditor.refreshContents();
3030
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
30313051 {
30323052 copy.Slower();
30333053 copy.Touch();
30343054 objEditor.refreshContents();
3035
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
30363056 {
30373057 copy.Faster();
30383058 copy.Touch();
30393059 objEditor.refreshContents();
3040
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
30413061 {
30423062 copy.Remark();
30433063 copy.Touch();
30443064 objEditor.refreshContents();
3045
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
30463066 {
30473067 copy.StepAll();
30483068 copy.Touch();
30493069 objEditor.refreshContents();
3050
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
30513071 {
30523072 //CameraPane.fullreset = true;
30533073 copy.ResetAll(); // ResetMeshes();
....@@ -3080,53 +3100,75 @@
30803100 // Close();
30813101 // }
30823102 // else
3083
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
30843104 {
30853105 ResetSliders();
3086
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
30873107 {
30883108 ClearMaterial();
3089
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
30903110 {
30913111 CreateMaterial();
3092
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
30933113 {
30943114 copy.ClearUI();
30953115 refreshContents(true);
3096
- } /*
3097
- }
3098
-
3099
- public boolean action(Event event, Object arg)
3100
- {
3101
- */ else if (event.getSource() == closeItem)
3116
+ } else if (source == importGFDItem)
3117
+ {
3118
+ ImportGFD();
3119
+ } else
3120
+ if (source == importVRMLX3DItem)
3121
+ {
3122
+ ImportVRMLX3D();
3123
+ } else
3124
+ if (source == import3DSItem)
3125
+ {
3126
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3127
+ } else
3128
+ if (source == importOBJItem)
3129
+ {
3130
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3131
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3132
+ browser.setVisible(true);
3133
+ String filename = browser.getFile();
3134
+ if (filename != null && filename.length() > 0)
3135
+ {
3136
+ String fullname = browser.getDirectory() + filename;
3137
+ makeSomething(ReadOBJ(fullname), true);
3138
+ }
3139
+ } else
3140
+ if (source == closeItem)
31023141 {
31033142 Close();
31043143 //return true;
3105
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
31063145 {
31073146 load();
31083147 //return true;
3109
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
31103152 {
31113153 save();
31123154 //return true;
3113
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
31143156 {
31153157 saveAs();
31163158 //return true;
3117
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
31183160 {
31193161 reexport();
31203162 //return true;
3121
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
31223164 {
31233165 export();
31243166 //return true;
3125
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
31263168 {
31273169 generatePOV();
31283170 //return true;
3129
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
31303172 {
31313173 try
31323174 {
....@@ -3148,21 +3190,8 @@
31483190 cameraView.repaint();
31493191 //return true;
31503192 }
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)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
31663195 {
31673196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31683197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3174,12 +3203,190 @@
31743203 }
31753204 }
31763205
3206
+ void New()
3207
+ {
3208
+ while (copy.Size() > 1)
3209
+ {
3210
+ copy.remove(1);
3211
+ }
3212
+
3213
+ ResetModel();
3214
+ objEditor.refreshContents();
3215
+ }
3216
+
3217
+ static public Object clone(Object o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3223
+
3224
+ out.writeObject(o);
3225
+
3226
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
3227
+ ObjectInputStream in = new ObjectInputStream(bais);
3228
+ Object obj = in.readObject();
3229
+ in.close();
3230
+ out.close();
3231
+ return obj;
3232
+ } catch (Exception e)
3233
+ {
3234
+ System.err.println(e);
3235
+ return null;
3236
+ }
3237
+ }
3238
+
3239
+ cRadio GetCurrentTab()
3240
+ {
3241
+ cRadio ab;
3242
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3243
+ {
3244
+ ab = (cRadio)e.nextElement();
3245
+ if(ab.GetObject() == copy)
3246
+ {
3247
+ return ab;
3248
+ }
3249
+ }
3250
+
3251
+ return null;
3252
+ }
3253
+
3254
+ public void Save()
3255
+ {
3256
+ cRadio tab = GetCurrentTab();
3257
+
3258
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3259
+ tab.graphs[tab.undoindex++] = (Object3D)clone(copy);
3260
+
3261
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3262
+ {
3263
+ tab.graphs[i] = null;
3264
+ }
3265
+
3266
+ // test save
3267
+ if (false)
3268
+ {
3269
+ try
3270
+ {
3271
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3272
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3273
+
3274
+ p.writeObject(copy);
3275
+
3276
+ p.flush();
3277
+
3278
+ ostream.close();
3279
+ } catch (Exception e)
3280
+ {
3281
+ e.printStackTrace();
3282
+ }
3283
+ }
3284
+ }
3285
+
3286
+ void CopyChanged(Object3D obj)
3287
+ {
3288
+ copy.clear();
3289
+
3290
+ for (int i=0; i<obj.Size(); i++)
3291
+ {
3292
+ copy.add(obj.get(i));
3293
+ }
3294
+
3295
+ copy.Touch();
3296
+
3297
+ ResetModel();
3298
+ copy.HardTouch(); // recompile?
3299
+
3300
+ cRadio ab;
3301
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3302
+ {
3303
+ ab = (cRadio)e.nextElement();
3304
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3305
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3306
+ if (test != null)
3307
+ {
3308
+ test.editWindow = ab.object.editWindow;
3309
+ ab.object = test;
3310
+ }
3311
+ }
3312
+
3313
+ refreshContents();
3314
+ }
3315
+
3316
+ public void Undo()
3317
+ {
3318
+ cRadio tab = GetCurrentTab();
3319
+
3320
+ if (tab.undoindex == 0)
3321
+ {
3322
+ java.awt.Toolkit.getDefaultToolkit().beep();
3323
+ return;
3324
+ }
3325
+
3326
+ if (tab.graphs[tab.undoindex] == null)
3327
+ {
3328
+ Save();
3329
+ tab.undoindex -= 1;
3330
+ }
3331
+
3332
+ tab.undoindex -= 1;
3333
+
3334
+ CopyChanged(tab.graphs[tab.undoindex]);
3335
+ }
3336
+
3337
+ public void Redo()
3338
+ {
3339
+ cRadio tab = GetCurrentTab();
3340
+
3341
+ if (tab.graphs[tab.undoindex + 1] == null)
3342
+ {
3343
+ java.awt.Toolkit.getDefaultToolkit().beep();
3344
+ return;
3345
+ }
3346
+
3347
+ tab.undoindex += 1;
3348
+
3349
+ CopyChanged(tab.graphs[tab.undoindex]);
3350
+ }
3351
+
3352
+ void ImportGFD()
3353
+ {
3354
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3355
+ browser.show();
3356
+ String filename = browser.getFile();
3357
+ if (filename != null && filename.length() > 0)
3358
+ {
3359
+ String fullname = browser.getDirectory() + filename;
3360
+
3361
+ //Object3D readobj =
3362
+ objEditor.ReadGFD(fullname, objEditor);
3363
+ //makeSomething(readobj);
3364
+ }
3365
+ }
3366
+
3367
+ void ImportVRMLX3D()
3368
+ {
3369
+ if (Grafreed.standAlone)
3370
+ {
3371
+ /**/
3372
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3373
+ browser.show();
3374
+ String filename = browser.getFile();
3375
+ if (filename != null && filename.length() > 0)
3376
+ {
3377
+ String fullname = browser.getDirectory() + filename;
3378
+ LoadVRMLX3D(fullname);
3379
+ }
3380
+ /**/
3381
+ }
3382
+ }
3383
+
31773384 void ToggleAnimation()
31783385 {
31793386 if (!Globals.ANIMATION)
31803387 {
31813388 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3182
- browser.show();
3389
+ browser.setVisible(true);
31833390 String filename = browser.getFile();
31843391 if (filename != null && filename.length() > 0)
31853392 {
....@@ -3189,8 +3396,8 @@
31893396
31903397 Globals.ANIMATION ^= true;
31913398
3192
- GrafreeD.wav.cursor = 0;
3193
- GrafreeD.wav.loop = 0;
3399
+ Grafreed.wav.cursor = 0;
3400
+ Grafreed.wav.loop = 0;
31943401 }
31953402 } else
31963403 {
....@@ -3240,7 +3447,7 @@
32403447 void CreateMaterial()
32413448 {
32423449 //copy.ClearMaterial(); // PATCH
3243
- copy.CreateMaterialS(multiplyToggle.isSelected());
3450
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32443451 if (copy.selection.size() > 0)
32453452 //SetMaterial(copy);
32463453 {
....@@ -3299,11 +3506,11 @@
32993506 {
33003507 copy.ResetBlockLoop(); // temporary problem
33013508
3302
- boolean random = CameraPane.RANDOM;
3303
- CameraPane.RANDOM = false; // parse everything
3509
+ boolean random = CameraPane.SWITCH;
3510
+ CameraPane.SWITCH = false; // parse everything
33043511 copy.ResetDisplayList();
33053512 copy.HardTouch();
3306
- CameraPane.RANDOM = random;
3513
+ CameraPane.SWITCH = random;
33073514 }
33083515
33093516 // public void applySelf()
....@@ -3377,6 +3584,36 @@
33773584 {
33783585 //System.out.println("Propagate = " + propagate);
33793586 copy.UpdateMaterial(anchor, current, propagate);
3587
+
3588
+ if (copy.material != null)
3589
+ {
3590
+ cMaterial mat = copy.material;
3591
+
3592
+ colorField.SetToolTipValue((mat.color));
3593
+ modulationField.SetToolTipValue((mat.modulation));
3594
+ metalnessField.SetToolTipValue((mat.metalness));
3595
+ diffuseField.SetToolTipValue((mat.diffuse));
3596
+ specularField.SetToolTipValue((mat.specular));
3597
+ shininessField.SetToolTipValue((mat.shininess));
3598
+ shiftField.SetToolTipValue((mat.shift));
3599
+ ambientField.SetToolTipValue((mat.ambient));
3600
+ lightareaField.SetToolTipValue((mat.lightarea));
3601
+ diffusenessField.SetToolTipValue((mat.factor));
3602
+ velvetField.SetToolTipValue((mat.velvet));
3603
+ sheenField.SetToolTipValue((mat.sheen));
3604
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3605
+ backlitField.SetToolTipValue((mat.bump));
3606
+ anisoField.SetToolTipValue((mat.aniso));
3607
+ anisoVField.SetToolTipValue((mat.anisoV));
3608
+ cameraField.SetToolTipValue((mat.cameralight));
3609
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3610
+ shadowField.SetToolTipValue((mat.shadow));
3611
+ textureField.SetToolTipValue((mat.texture));
3612
+ opacityField.SetToolTipValue((mat.opacity));
3613
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3614
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3615
+ }
3616
+
33803617 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33813618 {
33823619 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3421,6 +3658,7 @@
34213658 || e.getSource() == apertureField
34223659 || e.getSource() == shadowblurField)
34233660 {
3661
+ new Exception().printStackTrace();
34243662 System.exit(0);
34253663 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34263664 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3491,7 +3729,7 @@
34913729 }
34923730
34933731 if (normalpushField != null)
3494
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3732
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34953733 }
34963734
34973735 void SnapObject()
....@@ -3755,6 +3993,7 @@
37553993
37563994 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37573995 {
3996
+ Save();
37583997 //Tween.set(thing, 0).target(1).start(tweenManager);
37593998 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37603999 // if (thing instanceof GenericJointDemo)
....@@ -3958,6 +4197,7 @@
39584197 }
39594198 }
39604199 }
4200
+
39614201 LoadGFDThread loadGFDThread;
39624202
39634203 void ReadGFD(String fullname, iCallBack cb)
....@@ -3978,7 +4218,8 @@
39784218 try
39794219 {
39804220 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3981
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4221
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4222
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39824223
39834224 readobj = (Object3D) p.readObject();
39844225 istream.close();
....@@ -3986,7 +4227,20 @@
39864227 readobj.ResetDisplayList();
39874228 } catch (Exception e)
39884229 {
3989
- e.printStackTrace();
4230
+ //e.printStackTrace();
4231
+ try
4232
+ {
4233
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4234
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4235
+
4236
+ readobj = (Object3D) p.readObject();
4237
+ istream.close();
4238
+
4239
+ readobj.ResetDisplayList();
4240
+ } catch (Exception e2)
4241
+ {
4242
+ e2.printStackTrace();
4243
+ }
39904244 }
39914245 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
39924246 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4103,7 +4357,7 @@
41034357
41044358 void load() // throws ClassNotFoundException
41054359 {
4106
- if (GrafreeD.standAlone)
4360
+ if (Grafreed.standAlone)
41074361 {
41084362 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41094363 browser.show();
....@@ -4190,11 +4444,13 @@
41904444 try
41914445 {
41924446 FileOutputStream ostream = new FileOutputStream(lastname);
4193
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4447
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4448
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
41944449
41954450 p.writeObject(copy);
41964451 p.flush();
41974452
4453
+ zstream.close();
41984454 ostream.close();
41994455
42004456 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4204,11 +4460,12 @@
42044460 {
42054461 }
42064462 }
4463
+
42074464 String lastname;
42084465
42094466 void saveAs()
42104467 {
4211
- if (GrafreeD.standAlone)
4468
+ if (Grafreed.standAlone)
42124469 {
42134470 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42144471 browser.setVisible(true);
....@@ -4313,13 +4570,13 @@
43134570 try
43144571 {
43154572 FileOutputStream ostream = new FileOutputStream(filename);
4316
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4317
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4573
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4574
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43184575
43194576 Object3D objectparent = obj.parent;
43204577 obj.parent = null;
43214578
4322
- Object3D object = (Object3D) GrafreeD.clone(obj);
4579
+ Object3D object = (Object3D) Grafreed.clone(obj);
43234580
43244581 obj.parent = objectparent;
43254582
....@@ -4331,8 +4588,8 @@
43314588 p.writeObject(object);
43324589 p.flush();
43334590
4591
+ zstream.close();
43344592 ostream.close();
4335
- // zstream.close();
43364593
43374594 // group.selection.get(0).parent = parent;
43384595 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4353,7 +4610,7 @@
43534610 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43544611 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43554612 copy.generatePOV(buffer);
4356
- if (GrafreeD.standAlone)
4613
+ if (Grafreed.standAlone)
43574614 {
43584615 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43594616 browser.show();
....@@ -4379,7 +4636,8 @@
43794636 Object3D client;
43804637 Object3D copy;
43814638 MenuBar menuBar;
4382
- Menu windowMenu;
4639
+ Menu fileMenu;
4640
+ MenuItem newItem;
43834641 MenuItem loadItem;
43844642 MenuItem saveItem;
43854643 MenuItem saveAsItem;
....@@ -4387,13 +4645,11 @@
43874645 MenuItem reexportItem;
43884646 MenuItem povItem;
43894647 MenuItem closeItem;
4390
- Menu cameraMenu;
4648
+
43914649 CheckboxMenuItem zBufferItem;
43924650 //MenuItem normalLensItem;
4393
- MenuItem editCameraItem;
4394
- MenuItem revertCameraItem;
4395
- CheckboxMenuItem toggleLiveItem;
43964651 MenuItem stepItem;
4652
+ CheckboxMenuItem toggleLiveItem;
43974653 CheckboxMenuItem toggleFullScreenItem;
43984654 CheckboxMenuItem toggleTimelineItem;
43994655 CheckboxMenuItem toggleRenderItem;
....@@ -4402,7 +4658,7 @@
44024658 CheckboxMenuItem toggleFootContactItem;
44034659 CheckboxMenuItem toggleDLItem;
44044660 CheckboxMenuItem toggleTextureItem;
4405
- CheckboxMenuItem toggleRandomItem;
4661
+ CheckboxMenuItem toggleSwitchItem;
44064662 CheckboxMenuItem toggleRootItem;
44074663 CheckboxMenuItem animationItem;
44084664 CheckboxMenuItem toggleHandleItem;
....@@ -4410,7 +4666,7 @@
44104666 JSplitPane mainPanel;
44114667 JScrollPane scrollpane;
44124668 JPanel toolbarPanel;
4413
- JPanel treePanel;
4669
+ cGridBag treePanel;
44144670 JPanel radioPanel;
44154671 ButtonGroup buttonGroup;
44164672 cGridBag ctrlPanel;
....@@ -4539,4 +4795,9 @@
45394795 //ObjectUI parent;
45404796
45414797 cNumberSlider normalpushField;
4798
+
4799
+ private MenuItem importGFDItem;
4800
+ private MenuItem importVRMLX3DItem;
4801
+ private MenuItem import3DSItem;
4802
+ private MenuItem importOBJItem;
45424803 }