Normand Briere
2019-06-16 b33ef80d78f01a6a61f4248b1bb7deaade42d503
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("Open..."));
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 JPanel(); // new GridBagLayout());
326
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
359327 ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
328
+ 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,16 +348,16 @@
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());
390
- materialPanel.setLayout(new GridBagLayout());
358
+// treePanel.setLayout(new GridBagLayout());
359
+ //ctrlPanel.setLayout(new GridBagLayout());
360
+ //materialPanel.setLayout(new GridBagLayout());
391361
392362 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393363 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 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,115 +744,83 @@
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
- NumberSlider AddSlider(JPanel 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 {
819
- NumberSlider combo;
786
+ cGridBag control = new cGridBag();
787
+
788
+ cNumberSlider combo;
820789
821790 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824791 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 1;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
792
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
793
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834794 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
795
+
796
+ panel.add(control);
797
+
798
+ return control;
841799 }
842800
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
801
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
844802 {
845
- NumberSlider combo;
803
+ cGridBag control = new cGridBag();
804
+
805
+ cNumberSlider combo;
846806
847807 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
850808 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
851
- aConstraints.gridwidth = 2;
852
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
855
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
856
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
857
- aConstraints.gridx += 1;
858
- aConstraints.gridwidth = 1;
859
-
809
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
860811 combo.setInteger(current);
861812
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
813
+ panel.add(control);
814
+
815
+ return control;
867816 }
868817
869
- JTextArea AddText(JPanel ctrlPanel, String name)
818
+ JTextArea AddText(cGridBag ctrlPanel, String name)
870819 {
871820 JTextArea text;
872821
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
822
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
876823 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
879824
880825 return text;
881826 }
....@@ -905,9 +850,16 @@
905850 objEditor.ctrlPanel.remove(j);
906851 }
907852
853
+ void Remove(cNumberSlider j)
854
+ {
855
+ j.removeChangeListener(this);
856
+ //objEditor.ctrlPanel.remove(j.label);
857
+ objEditor.ctrlPanel.remove(j);
858
+ }
859
+
908860 /*
909861 */
910
- void Return() // ObjEditor oe)
862
+ void Return0() // ObjEditor oe)
911863 {
912864 aConstraints.gridy += 1;
913865 aConstraints.gridx = 0;
....@@ -962,37 +914,72 @@
962914
963915 void SetupUI2(ObjEditor oe)
964916 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- 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();
970926
971927 if (!GroupEditor.allparams)
972928 return;
973929
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- 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");
977936 // Return();
978
- markCB = AddCheckBox(oe, "Mark", copy.marked);
979
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
980
- randomCB = AddCheckBox(oe, "Rand", copy.random);
981
- Return();
982
- resetButton = AddButton(oe, "Reset");
983
- 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");
984965 // resetAllButton = AddButton(oe, "Reset All");
985966 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
987967 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- 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");
991974
992
- Return();
975
+ oe.ctrlPanel.add(commandsPanel);
976
+ oe.ctrlPanel.Return();
993977
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
978
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
979
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
980
+ //Return();
981
+
982
+ oe.ctrlPanel.Return();
996983
997984 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
998985 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1074,7 @@
10871074 oe.aConstraints.gridwidth = 1;
10881075 /**/
10891076 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1077
+ oe.ctrlPanel.Return();
10911078
10921079 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931080 //textureButton.setEnabled(false);
....@@ -1264,10 +1251,11 @@
12641251 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12651252 //tmp.setName("Edit");
12661253 objectPanel.add(materialPanel);
1267
- JPanel north = new JPanel(new BorderLayout());
1268
- north.setName("Edit");
1269
- north.add(ctrlPanel, BorderLayout.NORTH);
1270
- 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);
12711259 objectPanel.add(infoPanel);
12721260
12731261 /*
....@@ -1289,18 +1277,18 @@
12891277 scrollpane.addMouseWheelListener(this); // Default not fast enough
12901278
12911279 /*JTabbedPane*/ scenePanel = new cGridBag();
1292
- scenePanel.preferredWidth = 7;
1280
+ scenePanel.preferredWidth = 6;
12931281
12941282 JTabbedPane tabbedPane = new JTabbedPane();
12951283 tabbedPane.add(scrollpane);
12961284
12971285 tabbedPane.add(FSPane = new cFileSystemPane(this));
12981286
1299
- optionsPanel = new JPanel(new GridBagLayout());
1287
+ optionsPanel = new cGridBag().setVertical(true);
13001288
13011289 optionsPanel.setName("Options");
13021290
1303
- AddOptions(optionsPanel, aConstraints);
1291
+ AddOptions(optionsPanel); //, aConstraints);
13041292
13051293 tabbedPane.add(optionsPanel);
13061294
....@@ -1395,8 +1383,8 @@
13951383
13961384 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13971385
1398
- frame.setSize(1024, 768);
1399
- frame.show();
1386
+ frame.setSize(1280, 860);
1387
+ frame.setVisible(true);
14001388
14011389 gridPanel.setDividerLocation(1.0);
14021390
....@@ -1411,7 +1399,7 @@
14111399 });
14121400 }
14131401
1414
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1402
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14151403 {
14161404 }
14171405
....@@ -1426,260 +1414,173 @@
14261414 ctrlPanel.removeAll();
14271415 }
14281416
1429
- void SetupMaterial(JPanel ctrlPanel)
1417
+ void SetupMaterial(cGridBag panel)
14301418 {
1431
- aConstraints.weighty = 0;
1432
- //aConstraints.weightx = 1;
1433
- /*
1419
+ /*
14341420 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14351421 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1436
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1437
- aConstraints.gridx += 1;
14381422 */
14391423
1440
- aConstraints.gridwidth = 1;
1441
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
1424
+ cGridBag editBar = new cGridBag().setVertical(false);
1425
+
1426
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1427
+ createMaterialButton.setToolTipText("Create material");
14451428
14461429 /*
14471430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1448
- aConstraints.gridx += 1;
1449
- aConstraints.weighty = 0;
1450
- aConstraints.gridwidth = 1;
14511431 */
14521432
1453
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1454
- aConstraints.gridx += 1;
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
+ }
14551442
1456
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1457
-
1458
- aConstraints.gridx += 1;
1459
-
1460
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1461
-
1462
- aConstraints.gridx += 1;
1463
-
1464
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1465
-
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.weighty = 0;
1469
- aConstraints.gridwidth = 1;
1443
+ editBar.preferredHeight = 15;
1444
+
1445
+ panel.add(editBar);
1446
+
14701447 /**/
14711448 //aConstraints.weighty = 0;
14721449 ////aConstraints.weightx = 1;
14731450 //aConstraints.weighty = 1;
14741451 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14751452 //aConstraints.gridx += 1;
1476
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1477
- aConstraints.weighty = 0;
1478
- aConstraints.gridx = 0;
1479
- aConstraints.gridy += 1;
1480
- aConstraints.gridwidth = 1;
1453
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14811454
1482
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1483
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1484
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1485
- aConstraints.gridx += 1;
1486
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1487
- //aConstraints.weightx = 0;
1488
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1489
- aConstraints.gridx = 0;
1490
- aConstraints.gridy += 1;
1491
- aConstraints.gridwidth = 1;
1455
+ cGridBag colorSection = new cGridBag().setVertical(true);
1456
+
1457
+ cGridBag color = new cGridBag();
1458
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1459
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1460
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1461
+ //colorField.preferredWidth = 200;
1462
+ colorSection.add(color);
14921463
1493
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1494
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1495
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1496
- aConstraints.gridx += 1;
1497
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1498
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1499
- aConstraints.gridx = 0;
1500
- aConstraints.gridy += 1;
1501
- aConstraints.gridwidth = 1;
1464
+ cGridBag modulation = new cGridBag();
1465
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1466
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1467
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1468
+ colorSection.add(modulation);
15021469
1503
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1504
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1505
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1506
- aConstraints.gridx += 1;
1507
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1508
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1509
- aConstraints.gridx = 0;
1510
- aConstraints.gridy += 1;
1511
- aConstraints.gridwidth = 1;
1470
+ cGridBag texture = new cGridBag();
1471
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1472
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1474
+ colorSection.add(texture);
15121475
1513
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1514
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1515
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1516
- aConstraints.gridx += 1;
1517
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1518
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1519
- aConstraints.gridx = 0;
1520
- aConstraints.gridy += 1;
1521
- aConstraints.gridwidth = 1;
1476
+ cGridBag anisoU = new cGridBag();
1477
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1478
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
+ colorSection.add(anisoU);
15221481
1523
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1524
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1525
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1526
- aConstraints.gridx += 1;
1527
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1528
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1529
- aConstraints.gridx = 0;
1530
- aConstraints.gridy += 1;
1531
- aConstraints.gridwidth = 1;
1482
+ cGridBag anisoV = new cGridBag();
1483
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1484
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
+ colorSection.add(anisoV);
15321487
1533
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1534
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1536
- aConstraints.gridx += 1;
1537
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1538
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1539
- aConstraints.gridx = 0;
1540
- aConstraints.gridy += 1;
1541
- aConstraints.gridwidth = 1;
1488
+ cGridBag shadowbias = new cGridBag();
1489
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1490
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1492
+ colorSection.add(shadowbias);
15421493
1543
- //aConstraints.weighty = 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1545
- //aConstraints.gridx += 1;
1546
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1547
- aConstraints.weighty = 0;
1548
- aConstraints.gridx = 0;
1549
- aConstraints.gridy += 1;
1550
- aConstraints.gridwidth = 1;
1494
+ panel.add(new JSeparator());
1495
+
1496
+ panel.add(colorSection);
1497
+
1498
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1499
+
1500
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1501
+
1502
+ cGridBag diffuse = new cGridBag();
1503
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1504
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1505
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1506
+ diffuseSection.add(diffuse);
15511507
1552
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1553
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1554
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1555
- aConstraints.gridx += 1;
1556
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1557
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1558
- aConstraints.gridx = 0;
1559
- aConstraints.gridy += 1;
1560
- aConstraints.gridwidth = 1;
1508
+ cGridBag diffuseness = new cGridBag();
1509
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1510
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1512
+ diffuseSection.add(diffuseness);
15611513
1562
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1563
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1564
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1565
- aConstraints.gridx += 1;
1566
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1567
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1568
- aConstraints.gridx = 0;
1569
- aConstraints.gridy += 1;
1570
- aConstraints.gridwidth = 1;
1514
+ cGridBag selfshadow = new cGridBag();
1515
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1516
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1518
+ diffuseSection.add(selfshadow);
15711519
1572
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1573
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1574
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1575
- aConstraints.gridx += 1;
1576
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1577
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1578
- aConstraints.gridx = 0;
1579
- aConstraints.gridy += 1;
1580
- aConstraints.gridwidth = 1;
1520
+ cGridBag sheen = new cGridBag();
1521
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1522
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1523
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1524
+ diffuseSection.add(sheen);
15811525
1582
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1583
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1585
- aConstraints.gridx += 1;
1586
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1587
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1588
- aConstraints.gridx = 0;
1589
- aConstraints.gridy += 1;
1590
- aConstraints.gridwidth = 1;
1526
+ cGridBag subsurface = new cGridBag();
1527
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1528
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1530
+ diffuseSection.add(subsurface);
15911531
1592
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1593
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1594
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1595
- aConstraints.gridx += 1;
1596
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1597
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1598
- aConstraints.gridx = 0;
1599
- aConstraints.gridy += 1;
1600
- aConstraints.gridwidth = 1;
1532
+ cGridBag shadow = new cGridBag();
1533
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1534
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1536
+ diffuseSection.add(shadow);
16011537
1602
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1603
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1605
- aConstraints.gridx += 1;
1606
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1607
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1608
- aConstraints.gridx = 0;
1609
- aConstraints.gridy += 1;
1610
- aConstraints.gridwidth = 1;
1538
+ cGridBag fakedepth = new cGridBag();
1539
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1540
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1542
+ diffuseSection.add(fakedepth);
16111543
1612
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1613
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1614
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1615
- aConstraints.gridx += 1;
1616
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1617
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1618
- aConstraints.gridx = 0;
1619
- aConstraints.gridy += 1;
1620
- aConstraints.gridwidth = 1;
1544
+ panel.add(new JSeparator());
1545
+
1546
+ panel.add(diffuseSection);
1547
+
1548
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1549
+
1550
+ cGridBag specularSection = new cGridBag().setVertical(true);
16211551
1622
- //aConstraints.weighty = 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1624
- //aConstraints.gridx += 1;
1625
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1626
- aConstraints.weighty = 0;
1627
- aConstraints.gridx = 0;
1628
- aConstraints.gridy += 1;
1629
- aConstraints.gridwidth = 1;
1552
+ cGridBag specular = new cGridBag();
1553
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1554
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1556
+ specularSection.add(specular);
16301557
1631
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1632
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1633
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1634
- aConstraints.gridx += 1;
1635
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1636
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1637
- aConstraints.gridx = 0;
1638
- aConstraints.gridy += 1;
1639
- aConstraints.gridwidth = 1;
1558
+ cGridBag lightarea = new cGridBag();
1559
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1560
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1561
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1562
+ specularSection.add(lightarea);
16401563
1641
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1642
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1643
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1644
- aConstraints.gridx += 1;
1645
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1646
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1647
- aConstraints.gridx = 0;
1648
- aConstraints.gridy += 1;
1649
- aConstraints.gridwidth = 1;
1564
+ cGridBag shininess = new cGridBag();
1565
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1566
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1567
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1568
+ specularSection.add(shininess);
16501569
1651
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1652
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1653
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1654
- aConstraints.gridx += 1;
1655
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1656
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1657
- aConstraints.gridx = 0;
1658
- aConstraints.gridy += 1;
1659
- aConstraints.gridwidth = 1;
1570
+ cGridBag metalness = new cGridBag();
1571
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1572
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1573
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1574
+ specularSection.add(metalness);
16601575
1661
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1662
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1663
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1664
- aConstraints.gridx += 1;
1665
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1666
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1667
- aConstraints.gridx = 0;
1668
- aConstraints.gridy += 1;
1669
- aConstraints.gridwidth = 1;
1576
+ cGridBag velvet = new cGridBag();
1577
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1578
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1580
+ specularSection.add(velvet);
16701581
1671
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1672
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1673
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1674
- aConstraints.gridx += 1;
1675
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1676
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1677
- aConstraints.gridx = 0;
1678
- aConstraints.gridy += 1;
1679
- aConstraints.gridwidth = 1;
1680
-
1681
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1682
- Return();
1582
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1583
+ //Return();
16831584 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16841585 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16851586 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1690,130 +1591,93 @@
16901591 // aConstraints.gridy += 1;
16911592 // aConstraints.gridwidth = 1;
16921593
1693
- //aConstraints.weighty = 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1695
- //aConstraints.gridx += 1;
1696
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1697
- aConstraints.weighty = 0;
1698
- aConstraints.gridx = 0;
1699
- aConstraints.gridy += 1;
1700
- aConstraints.gridwidth = 1;
17011594
1702
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1703
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1704
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1705
- aConstraints.gridx += 1;
1706
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1707
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1708
- aConstraints.gridx = 0;
1709
- aConstraints.gridy += 1;
1710
- aConstraints.gridwidth = 1;
1595
+ panel.add(new JSeparator());
1596
+
1597
+ panel.add(specularSection);
1598
+
1599
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1600
+
1601
+ cGridBag globalSection = new cGridBag().setVertical(true);
17111602
1712
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1713
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1714
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1715
- aConstraints.gridx += 1;
1716
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1717
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1718
- aConstraints.gridx = 0;
1719
- aConstraints.gridy += 1;
1720
- aConstraints.gridwidth = 1;
1603
+ cGridBag camera = new cGridBag();
1604
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1605
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1607
+ globalSection.add(camera);
17211608
1722
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1723
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1724
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1725
- aConstraints.gridx += 1;
1726
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1727
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1728
- aConstraints.gridx = 0;
1729
- aConstraints.gridy += 1;
1730
- aConstraints.gridwidth = 1;
1609
+ cGridBag ambient = new cGridBag();
1610
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1611
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1612
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
+ globalSection.add(ambient);
17311614
1732
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1733
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1734
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1735
- aConstraints.gridx += 1;
1736
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1737
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1738
- aConstraints.gridx = 0;
1739
- aConstraints.gridy += 1;
1740
- aConstraints.gridwidth = 1;
1741
- aConstraints.weighty = 0;
1615
+ cGridBag backlit = new cGridBag();
1616
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1617
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
+ globalSection.add(backlit);
17421620
1743
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1744
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1745
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1746
- aConstraints.gridx += 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1748
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1749
- aConstraints.gridx = 0;
1750
- aConstraints.gridy += 1;
1751
- aConstraints.gridwidth = 1;
1621
+ cGridBag opacity = new cGridBag();
1622
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1623
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1625
+ globalSection.add(opacity);
17521626
1753
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1754
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1755
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1756
- aConstraints.gridx += 1;
1757
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1758
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1759
- aConstraints.gridx = 0;
1760
- aConstraints.gridy += 1;
1761
- aConstraints.gridwidth = 1;
1627
+ panel.add(new JSeparator());
1628
+
1629
+ panel.add(globalSection);
1630
+
1631
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1632
+
1633
+ cGridBag textureSection = new cGridBag().setVertical(true);
17621634
1763
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1764
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1765
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1766
- aConstraints.gridx += 1;
1767
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1768
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1769
- aConstraints.gridx = 0;
1770
- aConstraints.gridy += 1;
1771
- aConstraints.gridwidth = 1;
1635
+ cGridBag bump = new cGridBag();
1636
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1637
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1639
+ textureSection.add(bump);
17721640
1773
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1774
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1775
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1776
- aConstraints.gridx += 1;
1777
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1778
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1779
- aConstraints.gridx = 0;
1780
- aConstraints.gridy += 1;
1781
- aConstraints.gridwidth = 1;
1641
+ cGridBag noise = new cGridBag();
1642
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1643
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1645
+ textureSection.add(noise);
17821646
1783
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1784
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1785
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1786
- aConstraints.gridx += 1;
1787
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1788
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1789
- aConstraints.gridx = 0;
1790
- aConstraints.gridy += 1;
1791
- aConstraints.gridwidth = 1;
1647
+ cGridBag power = new cGridBag();
1648
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1649
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1651
+ textureSection.add(power);
17921652
1793
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1794
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1795
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1796
- aConstraints.gridx += 1;
1797
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1798
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1799
- aConstraints.gridx = 0;
1800
- aConstraints.gridy += 1;
1801
- aConstraints.gridwidth = 1;
1653
+ cGridBag borderfade = new cGridBag();
1654
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1655
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1657
+ textureSection.add(borderfade);
18021658
1803
- //aConstraints.weighty = 1;
1804
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1805
- //aConstraints.gridx += 1;
1806
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1807
- aConstraints.weighty = 0;
1659
+ cGridBag fog = new cGridBag();
1660
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1661
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1663
+ textureSection.add(fog);
18081664
1809
- aConstraints.gridx = 0;
1810
- aConstraints.gridy = 0;
1811
- aConstraints.gridwidth = 1;
1665
+ cGridBag opacityPower = new cGridBag();
1666
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1667
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1668
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1669
+ textureSection.add(opacityPower);
1670
+
1671
+ panel.add(new JSeparator());
1672
+
1673
+ panel.add(textureSection);
1674
+
1675
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18121676
18131677 SetMaterial(copy); // .GetMaterial());
18141678
1815
- colorField.addChangeListener(this);
1816
- modulationField.addChangeListener(this);
1679
+ //colorField.addChangeListener(this);
1680
+// modulationField.addChangeListener(this);
18171681 metalnessField.addChangeListener(this);
18181682 diffuseField.addChangeListener(this);
18191683 specularField.addChangeListener(this);
....@@ -1843,12 +1707,15 @@
18431707 opacityPowerField.addChangeListener(this);
18441708 /**/
18451709
1846
- resetSlidersButton.addActionListener(this);
18471710 clearMaterialButton.addActionListener(this);
18481711 createMaterialButton.addActionListener(this);
1849
-
1850
- propagateToggle.addItemListener(this);
1851
- multiplyToggle.addItemListener(this);
1712
+
1713
+ if (Globals.ADVANCED)
1714
+ {
1715
+ resetSlidersButton.addActionListener(this);
1716
+ propagateToggle.addItemListener(this);
1717
+ multiplyToggle.addItemListener(this);
1718
+ }
18521719 }
18531720
18541721 void DropFile(java.io.File[] files, boolean textures)
....@@ -2019,7 +1886,7 @@
20191886
20201887 //? flashIt = false;
20211888 CameraPane pane = (CameraPane) cameraView;
2022
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
20231890 pane.clickEnd(location.x, location.y, 0, true);
20241891
20251892 if (group.selection.size() == 1)
....@@ -2068,6 +1935,7 @@
20681935 e2.printStackTrace();
20691936 }
20701937 }
1938
+
20711939 LoadJMEThread loadThread;
20721940
20731941 class LoadJMEThread extends Thread
....@@ -2125,6 +1993,7 @@
21251993 //LoadFile0(filename, converter);
21261994 }
21271995 }
1996
+
21281997 LoadOBJThread loadObjThread;
21291998
21301999 class LoadOBJThread extends Thread
....@@ -2203,19 +2072,19 @@
22032072
22042073 void LoadObjFile(String fullname)
22052074 {
2206
- /*
2075
+ System.out.println("Loading " + fullname);
2076
+ /**/
22072077 //lastFilename = fullname;
22082078 if(loadObjThread == null)
22092079 {
2210
- loadObjThread = new LoadOBJThread();
2211
- loadObjThread.start();
2080
+ loadObjThread = new LoadOBJThread();
2081
+ loadObjThread.start();
22122082 }
22132083
22142084 loadObjThread.add(fullname);
2215
- */
2085
+ /**/
22162086
2217
- System.out.println("Loading " + fullname);
2218
- makeSomething(new FileObject(fullname, true), true);
2087
+ //makeSomething(new FileObject(fullname, true), true);
22192088 }
22202089
22212090 void LoadGFDFile(String fullname)
....@@ -2476,11 +2345,11 @@
24762345
24772346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24782347 {
2479
- if (GrafreeD.standAlone)
2348
+ if (Grafreed.standAlone)
24802349 {
24812350 /**/
24822351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2483
- browser.show();
2352
+ browser.setVisible(true);
24842353 String filename = browser.getFile();
24852354 if (filename != null && filename.length() > 0)
24862355 {
....@@ -2625,6 +2494,7 @@
26252494 }
26262495 if (input == null)
26272496 {
2497
+ new Exception().printStackTrace();
26282498 System.exit(0);
26292499 }
26302500
....@@ -2839,7 +2709,8 @@
28392709 return;
28402710 }
28412711
2842
- multiplyToggle.setSelected(mat.multiply);
2712
+ if (multiplyToggle != null)
2713
+ multiplyToggle.setSelected(mat.multiply);
28432714
28442715 assert (object.projectedVertices != null);
28452716
....@@ -3054,9 +2925,9 @@
30542925 frame.validate();
30552926
30562927 return;
3057
- } else if (event.getSource() == toggleRandomItem)
2928
+ } else if (event.getSource() == toggleSwitchItem)
30582929 {
3059
- cameraView.ToggleRandom();
2930
+ cameraView.ToggleSwitch();
30602931 cameraView.repaint();
30612932 return;
30622933 } else if (event.getSource() == toggleHandleItem)
....@@ -3085,6 +2956,10 @@
30852956 {
30862957 copy.live ^= true;
30872958 return;
2959
+ } else if (event.getSource() == selectCB)
2960
+ {
2961
+ copy.dontselect ^= true;
2962
+ return;
30882963 } else if (event.getSource() == hideCB)
30892964 {
30902965 copy.hide ^= true;
....@@ -3099,6 +2974,7 @@
30992974 if (event.getSource() == randomCB)
31002975 {
31012976 copy.random ^= true;
2977
+ objEditor.refreshContents();
31022978 return;
31032979 }
31042980 if (event.getSource() == speedupCB)
....@@ -3122,8 +2998,9 @@
31222998
31232999 public void actionPerformed(ActionEvent event)
31243000 {
3001
+ Object source = event.getSource();
31253002 // SCRIPT DIALOG
3126
- if (event.getSource() == okbutton)
3003
+ if (source == okbutton)
31273004 {
31283005 textpanel.setVisible(false);
31293006 textpanel.remove(textarea);
....@@ -3135,7 +3012,7 @@
31353012 textarea = null;
31363013 textpanel = null;
31373014 }
3138
- if (event.getSource() == cancelbutton)
3015
+ if (source == cancelbutton)
31393016 {
31403017 textpanel.setVisible(false);
31413018 textpanel.remove(textarea);
....@@ -3147,50 +3024,50 @@
31473024 //applySelf();
31483025 //client.refreshEditWindow();
31493026 //refreshContents();
3150
- if (event.getSource() == nameField)
3027
+ if (source == nameField)
31513028 {
31523029 //System.out.println("ObjEditor " + event);
31533030 applySelf0(true);
31543031 //parent.applySelf();
31553032 objEditor.refreshContents();
3156
- } else if (event.getSource() == resetButton)
3033
+ } else if (source == resetButton)
31573034 {
31583035 CameraPane.fullreset = true;
31593036 copy.Reset(); // ResetMeshes();
31603037 copy.Touch();
31613038 objEditor.refreshContents();
3162
- } else if (event.getSource() == stepItem)
3039
+ } else if (source == stepItem)
31633040 {
31643041 //cameraView.ONESTEP = true;
31653042 Globals.ONESTEP = true;
31663043 cameraView.repaint();
31673044 return;
3168
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
31693046 {
31703047 copy.Step();
31713048 copy.Touch();
31723049 objEditor.refreshContents();
3173
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
31743051 {
31753052 copy.Slower();
31763053 copy.Touch();
31773054 objEditor.refreshContents();
3178
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
31793056 {
31803057 copy.Faster();
31813058 copy.Touch();
31823059 objEditor.refreshContents();
3183
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
31843061 {
31853062 copy.Remark();
31863063 copy.Touch();
31873064 objEditor.refreshContents();
3188
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
31893066 {
31903067 copy.StepAll();
31913068 copy.Touch();
31923069 objEditor.refreshContents();
3193
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
31943071 {
31953072 //CameraPane.fullreset = true;
31963073 copy.ResetAll(); // ResetMeshes();
....@@ -3223,53 +3100,75 @@
32233100 // Close();
32243101 // }
32253102 // else
3226
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
32273104 {
32283105 ResetSliders();
3229
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
32303107 {
32313108 ClearMaterial();
3232
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
32333110 {
32343111 CreateMaterial();
3235
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
32363113 {
32373114 copy.ClearUI();
32383115 refreshContents(true);
3239
- } /*
3240
- }
3241
-
3242
- public boolean action(Event event, Object arg)
3243
- {
3244
- */ 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)
32453141 {
32463142 Close();
32473143 //return true;
3248
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
32493145 {
32503146 load();
32513147 //return true;
3252
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
32533152 {
32543153 save();
32553154 //return true;
3256
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
32573156 {
32583157 saveAs();
32593158 //return true;
3260
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
32613160 {
32623161 reexport();
32633162 //return true;
3264
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
32653164 {
32663165 export();
32673166 //return true;
3268
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
32693168 {
32703169 generatePOV();
32713170 //return true;
3272
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
32733172 {
32743173 try
32753174 {
....@@ -3291,21 +3190,8 @@
32913190 cameraView.repaint();
32923191 //return true;
32933192 }
3294
- */ else if (event.getSource() == editCameraItem)
3295
- {
3296
- cameraView.ProtectCamera();
3297
- cameraView.repaint();
3298
- return;
3299
- } else if (event.getSource() == revertCameraItem)
3300
- {
3301
- cameraView.RevertCamera();
3302
- cameraView.repaint();
3303
- return;
3304
-// } else if (event.getSource() == textureButton)
3305
-// {
3306
-// return; // true;
3307
- } else // combos...
3308
- if (event.getSource() == texresMenu)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
33093195 {
33103196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33113197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3317,12 +3203,268 @@
33173203 }
33183204 }
33193205
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 byte[] Compress(Object3D o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3223
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3224
+
3225
+ Object3D parent = o.parent;
3226
+ o.parent = null;
3227
+
3228
+ out.writeObject(o);
3229
+
3230
+ o.parent = parent;
3231
+
3232
+ out.flush();
3233
+
3234
+ zstream.close();
3235
+ out.close();
3236
+
3237
+ return baos.toByteArray();
3238
+ } catch (Exception e)
3239
+ {
3240
+ System.err.println(e);
3241
+ return null;
3242
+ }
3243
+ }
3244
+
3245
+ static public Object Uncompress(byte[] bytes)
3246
+ {
3247
+ System.out.println("#bytes = " + bytes.length);
3248
+ try
3249
+ {
3250
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3251
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3252
+ ObjectInputStream in = new ObjectInputStream(istream);
3253
+ Object obj = in.readObject();
3254
+ in.close();
3255
+
3256
+ return obj;
3257
+ } catch (Exception e)
3258
+ {
3259
+ System.err.println(e);
3260
+ return null;
3261
+ }
3262
+ }
3263
+
3264
+ static public Object clone(Object o)
3265
+ {
3266
+ try
3267
+ {
3268
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3269
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3270
+
3271
+ out.writeObject(o);
3272
+
3273
+ out.flush();
3274
+ out.close();
3275
+
3276
+ byte[] bytes = baos.toByteArray();
3277
+
3278
+ System.out.println("clone = " + bytes.length);
3279
+
3280
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3281
+ ObjectInputStream in = new ObjectInputStream(bais);
3282
+ Object obj = in.readObject();
3283
+ in.close();
3284
+
3285
+ return obj;
3286
+ } catch (Exception e)
3287
+ {
3288
+ System.err.println(e);
3289
+ return null;
3290
+ }
3291
+ }
3292
+
3293
+ cRadio GetCurrentTab()
3294
+ {
3295
+ cRadio ab;
3296
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3297
+ {
3298
+ ab = (cRadio)e.nextElement();
3299
+ if(ab.GetObject() == copy)
3300
+ {
3301
+ return ab;
3302
+ }
3303
+ }
3304
+
3305
+ return null;
3306
+ }
3307
+
3308
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3309
+
3310
+ public void Save()
3311
+ {
3312
+ cRadio tab = GetCurrentTab();
3313
+
3314
+ boolean temp = CameraPane.SWITCH;
3315
+ CameraPane.SWITCH = false;
3316
+
3317
+ copy.ExtractBigData(hashtable);
3318
+
3319
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3320
+ tab.graphs[tab.undoindex++] = Compress(copy);
3321
+
3322
+ copy.RestoreBigData(hashtable);
3323
+
3324
+ CameraPane.SWITCH = temp;
3325
+
3326
+ //assert(hashtable.isEmpty());
3327
+
3328
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3329
+ {
3330
+ tab.graphs[i] = null;
3331
+ }
3332
+
3333
+ // test save
3334
+ if (false)
3335
+ {
3336
+ try
3337
+ {
3338
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3339
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3340
+
3341
+ p.writeObject(copy);
3342
+
3343
+ p.flush();
3344
+
3345
+ ostream.close();
3346
+ } catch (Exception e)
3347
+ {
3348
+ e.printStackTrace();
3349
+ }
3350
+ }
3351
+ }
3352
+
3353
+ void CopyChanged(Object3D obj)
3354
+ {
3355
+ boolean temp = CameraPane.SWITCH;
3356
+ CameraPane.SWITCH = false;
3357
+
3358
+ copy.ExtractBigData(hashtable);
3359
+
3360
+ copy.clear();
3361
+
3362
+ for (int i=0; i<obj.Size(); i++)
3363
+ {
3364
+ copy.add(obj.get(i));
3365
+ }
3366
+
3367
+ copy.RestoreBigData(hashtable);
3368
+
3369
+ CameraPane.SWITCH = temp;
3370
+
3371
+ //assert(hashtable.isEmpty());
3372
+
3373
+ copy.Touch();
3374
+
3375
+ ResetModel();
3376
+ copy.HardTouch(); // recompile?
3377
+
3378
+ cRadio ab;
3379
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3380
+ {
3381
+ ab = (cRadio)e.nextElement();
3382
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3383
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3384
+ if (test != null)
3385
+ {
3386
+ test.editWindow = ab.object.editWindow;
3387
+ ab.object = test;
3388
+ }
3389
+ }
3390
+
3391
+ refreshContents();
3392
+ }
3393
+
3394
+ public void Undo()
3395
+ {
3396
+ cRadio tab = GetCurrentTab();
3397
+
3398
+ if (tab.undoindex == 0)
3399
+ {
3400
+ java.awt.Toolkit.getDefaultToolkit().beep();
3401
+ return;
3402
+ }
3403
+
3404
+ if (tab.graphs[tab.undoindex] == null)
3405
+ {
3406
+ Save();
3407
+ tab.undoindex -= 1;
3408
+ }
3409
+
3410
+ tab.undoindex -= 1;
3411
+
3412
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3413
+ }
3414
+
3415
+ public void Redo()
3416
+ {
3417
+ cRadio tab = GetCurrentTab();
3418
+
3419
+ if (tab.graphs[tab.undoindex + 1] == null)
3420
+ {
3421
+ java.awt.Toolkit.getDefaultToolkit().beep();
3422
+ return;
3423
+ }
3424
+
3425
+ tab.undoindex += 1;
3426
+
3427
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3428
+ }
3429
+
3430
+ void ImportGFD()
3431
+ {
3432
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3433
+ browser.show();
3434
+ String filename = browser.getFile();
3435
+ if (filename != null && filename.length() > 0)
3436
+ {
3437
+ String fullname = browser.getDirectory() + filename;
3438
+
3439
+ //Object3D readobj =
3440
+ objEditor.ReadGFD(fullname, objEditor);
3441
+ //makeSomething(readobj);
3442
+ }
3443
+ }
3444
+
3445
+ void ImportVRMLX3D()
3446
+ {
3447
+ if (Grafreed.standAlone)
3448
+ {
3449
+ /**/
3450
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3451
+ browser.show();
3452
+ String filename = browser.getFile();
3453
+ if (filename != null && filename.length() > 0)
3454
+ {
3455
+ String fullname = browser.getDirectory() + filename;
3456
+ LoadVRMLX3D(fullname);
3457
+ }
3458
+ /**/
3459
+ }
3460
+ }
3461
+
33203462 void ToggleAnimation()
33213463 {
33223464 if (!Globals.ANIMATION)
33233465 {
33243466 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3325
- browser.show();
3467
+ browser.setVisible(true);
33263468 String filename = browser.getFile();
33273469 if (filename != null && filename.length() > 0)
33283470 {
....@@ -3332,8 +3474,8 @@
33323474
33333475 Globals.ANIMATION ^= true;
33343476
3335
- GrafreeD.wav.cursor = 0;
3336
- GrafreeD.wav.loop = 0;
3477
+ Grafreed.wav.cursor = 0;
3478
+ Grafreed.wav.loop = 0;
33373479 }
33383480 } else
33393481 {
....@@ -3383,7 +3525,7 @@
33833525 void CreateMaterial()
33843526 {
33853527 //copy.ClearMaterial(); // PATCH
3386
- copy.CreateMaterialS(multiplyToggle.isSelected());
3528
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33873529 if (copy.selection.size() > 0)
33883530 //SetMaterial(copy);
33893531 {
....@@ -3442,11 +3584,11 @@
34423584 {
34433585 copy.ResetBlockLoop(); // temporary problem
34443586
3445
- boolean random = CameraPane.RANDOM;
3446
- CameraPane.RANDOM = false; // parse everything
3587
+ boolean random = CameraPane.SWITCH;
3588
+ CameraPane.SWITCH = false; // parse everything
34473589 copy.ResetDisplayList();
34483590 copy.HardTouch();
3449
- CameraPane.RANDOM = random;
3591
+ CameraPane.SWITCH = random;
34503592 }
34513593
34523594 // public void applySelf()
....@@ -3516,10 +3658,40 @@
35163658 current.fakedepth = (float) fakedepthField.getFloat();
35173659 current.shadowbias = (float) shadowbiasField.getFloat();
35183660
3519
- if (!NumberSlider.frozen)
3661
+ if (!cNumberSlider.frozen)
35203662 {
35213663 //System.out.println("Propagate = " + propagate);
35223664 copy.UpdateMaterial(anchor, current, propagate);
3665
+
3666
+ if (copy.material != null)
3667
+ {
3668
+ cMaterial mat = copy.material;
3669
+
3670
+ colorField.SetToolTipValue((mat.color));
3671
+ modulationField.SetToolTipValue((mat.modulation));
3672
+ metalnessField.SetToolTipValue((mat.metalness));
3673
+ diffuseField.SetToolTipValue((mat.diffuse));
3674
+ specularField.SetToolTipValue((mat.specular));
3675
+ shininessField.SetToolTipValue((mat.shininess));
3676
+ shiftField.SetToolTipValue((mat.shift));
3677
+ ambientField.SetToolTipValue((mat.ambient));
3678
+ lightareaField.SetToolTipValue((mat.lightarea));
3679
+ diffusenessField.SetToolTipValue((mat.factor));
3680
+ velvetField.SetToolTipValue((mat.velvet));
3681
+ sheenField.SetToolTipValue((mat.sheen));
3682
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3683
+ backlitField.SetToolTipValue((mat.bump));
3684
+ anisoField.SetToolTipValue((mat.aniso));
3685
+ anisoVField.SetToolTipValue((mat.anisoV));
3686
+ cameraField.SetToolTipValue((mat.cameralight));
3687
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3688
+ shadowField.SetToolTipValue((mat.shadow));
3689
+ textureField.SetToolTipValue((mat.texture));
3690
+ opacityField.SetToolTipValue((mat.opacity));
3691
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3692
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3693
+ }
3694
+
35233695 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35243696 {
35253697 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3564,6 +3736,7 @@
35643736 || e.getSource() == apertureField
35653737 || e.getSource() == shadowblurField)
35663738 {
3739
+ new Exception().printStackTrace();
35673740 System.exit(0);
35683741 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35693742 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3634,7 +3807,7 @@
36343807 }
36353808
36363809 if (normalpushField != null)
3637
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3810
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36383811 }
36393812
36403813 void SnapObject()
....@@ -3889,7 +4062,7 @@
38894062
38904063 radioPanel.revalidate();
38914064 radioPanel.repaint();
3892
- ctrlPanel.revalidate(); // ? new
4065
+ ctrlPanel.validate(); // ? new
38934066 ctrlPanel.repaint();
38944067 }
38954068 }
....@@ -3898,6 +4071,7 @@
38984071
38994072 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
39004073 {
4074
+ Save();
39014075 //Tween.set(thing, 0).target(1).start(tweenManager);
39024076 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
39034077 // if (thing instanceof GenericJointDemo)
....@@ -4101,6 +4275,7 @@
41014275 }
41024276 }
41034277 }
4278
+
41044279 LoadGFDThread loadGFDThread;
41054280
41064281 void ReadGFD(String fullname, iCallBack cb)
....@@ -4121,7 +4296,8 @@
41214296 try
41224297 {
41234298 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4124
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4299
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4300
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41254301
41264302 readobj = (Object3D) p.readObject();
41274303 istream.close();
....@@ -4129,7 +4305,20 @@
41294305 readobj.ResetDisplayList();
41304306 } catch (Exception e)
41314307 {
4132
- e.printStackTrace();
4308
+ //e.printStackTrace();
4309
+ try
4310
+ {
4311
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4312
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4313
+
4314
+ readobj = (Object3D) p.readObject();
4315
+ istream.close();
4316
+
4317
+ readobj.ResetDisplayList();
4318
+ } catch (Exception e2)
4319
+ {
4320
+ e2.printStackTrace();
4321
+ }
41334322 }
41344323 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41354324 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4184,6 +4373,7 @@
41844373
41854374 if (readobj != null)
41864375 {
4376
+ Save();
41874377 try
41884378 {
41894379 //readobj.deepCopySelf(copy);
....@@ -4246,7 +4436,7 @@
42464436
42474437 void load() // throws ClassNotFoundException
42484438 {
4249
- if (GrafreeD.standAlone)
4439
+ if (Grafreed.standAlone)
42504440 {
42514441 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42524442 browser.show();
....@@ -4333,11 +4523,13 @@
43334523 try
43344524 {
43354525 FileOutputStream ostream = new FileOutputStream(lastname);
4336
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4526
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4527
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43374528
43384529 p.writeObject(copy);
43394530 p.flush();
43404531
4532
+ zstream.close();
43414533 ostream.close();
43424534
43434535 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4347,11 +4539,12 @@
43474539 {
43484540 }
43494541 }
4542
+
43504543 String lastname;
43514544
43524545 void saveAs()
43534546 {
4354
- if (GrafreeD.standAlone)
4547
+ if (Grafreed.standAlone)
43554548 {
43564549 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43574550 browser.setVisible(true);
....@@ -4456,13 +4649,13 @@
44564649 try
44574650 {
44584651 FileOutputStream ostream = new FileOutputStream(filename);
4459
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4460
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4652
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4653
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44614654
44624655 Object3D objectparent = obj.parent;
44634656 obj.parent = null;
44644657
4465
- Object3D object = (Object3D) GrafreeD.clone(obj);
4658
+ Object3D object = (Object3D) Grafreed.clone(obj);
44664659
44674660 obj.parent = objectparent;
44684661
....@@ -4474,8 +4667,8 @@
44744667 p.writeObject(object);
44754668 p.flush();
44764669
4670
+ zstream.close();
44774671 ostream.close();
4478
- // zstream.close();
44794672
44804673 // group.selection.get(0).parent = parent;
44814674 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4496,7 +4689,7 @@
44964689 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44974690 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44984691 copy.generatePOV(buffer);
4499
- if (GrafreeD.standAlone)
4692
+ if (Grafreed.standAlone)
45004693 {
45014694 FileDialog browser = new FileDialog(frame, "Export POV", 1);
45024695 browser.show();
....@@ -4522,7 +4715,8 @@
45224715 Object3D client;
45234716 Object3D copy;
45244717 MenuBar menuBar;
4525
- Menu windowMenu;
4718
+ Menu fileMenu;
4719
+ MenuItem newItem;
45264720 MenuItem loadItem;
45274721 MenuItem saveItem;
45284722 MenuItem saveAsItem;
....@@ -4530,13 +4724,11 @@
45304724 MenuItem reexportItem;
45314725 MenuItem povItem;
45324726 MenuItem closeItem;
4533
- Menu cameraMenu;
4727
+
45344728 CheckboxMenuItem zBufferItem;
45354729 //MenuItem normalLensItem;
4536
- MenuItem editCameraItem;
4537
- MenuItem revertCameraItem;
4538
- CheckboxMenuItem toggleLiveItem;
45394730 MenuItem stepItem;
4731
+ CheckboxMenuItem toggleLiveItem;
45404732 CheckboxMenuItem toggleFullScreenItem;
45414733 CheckboxMenuItem toggleTimelineItem;
45424734 CheckboxMenuItem toggleRenderItem;
....@@ -4545,7 +4737,7 @@
45454737 CheckboxMenuItem toggleFootContactItem;
45464738 CheckboxMenuItem toggleDLItem;
45474739 CheckboxMenuItem toggleTextureItem;
4548
- CheckboxMenuItem toggleRandomItem;
4740
+ CheckboxMenuItem toggleSwitchItem;
45494741 CheckboxMenuItem toggleRootItem;
45504742 CheckboxMenuItem animationItem;
45514743 CheckboxMenuItem toggleHandleItem;
....@@ -4553,13 +4745,13 @@
45534745 JSplitPane mainPanel;
45544746 JScrollPane scrollpane;
45554747 JPanel toolbarPanel;
4556
- JPanel treePanel;
4748
+ cGridBag treePanel;
45574749 JPanel radioPanel;
45584750 ButtonGroup buttonGroup;
4559
- JPanel ctrlPanel;
4560
- JPanel materialPanel;
4751
+ cGridBag ctrlPanel;
4752
+ cGridBag materialPanel;
45614753 JScrollPane infoPanel;
4562
- JPanel optionsPanel;
4754
+ cGridBag optionsPanel;
45634755 JTabbedPane objectPanel;
45644756 cGridBag XYZPanel;
45654757 JSplitPane gridPanel;
....@@ -4619,67 +4811,72 @@
46194811 // MATERIAL
46204812 JLabel materialLabel;
46214813 JLabel colorLabel;
4622
- NumberSlider colorField;
4814
+ cNumberSlider colorField;
46234815 JLabel modulationLabel;
4624
- NumberSlider modulationField;
4816
+ cNumberSlider modulationField;
46254817 JLabel metalnessLabel;
4626
- NumberSlider metalnessField;
4818
+ cNumberSlider metalnessField;
46274819 JLabel diffuseLabel;
4628
- NumberSlider diffuseField;
4820
+ cNumberSlider diffuseField;
46294821 JLabel specularLabel;
4630
- NumberSlider specularField;
4822
+ cNumberSlider specularField;
46314823 JLabel shininessLabel;
4632
- NumberSlider shininessField;
4824
+ cNumberSlider shininessField;
46334825 JLabel shiftLabel;
4634
- NumberSlider shiftField;
4826
+ cNumberSlider shiftField;
46354827 JLabel ambientLabel;
4636
- NumberSlider ambientField;
4828
+ cNumberSlider ambientField;
46374829 JLabel lightareaLabel;
4638
- NumberSlider lightareaField;
4830
+ cNumberSlider lightareaField;
46394831 JLabel diffusenessLabel;
4640
- NumberSlider diffusenessField;
4832
+ cNumberSlider diffusenessField;
46414833 JLabel velvetLabel;
4642
- NumberSlider velvetField;
4834
+ cNumberSlider velvetField;
46434835 JLabel sheenLabel;
4644
- NumberSlider sheenField;
4836
+ cNumberSlider sheenField;
46454837 JLabel subsurfaceLabel;
4646
- NumberSlider subsurfaceField;
4838
+ cNumberSlider subsurfaceField;
46474839 //JLabel bumpLabel;
46484840 //NumberSlider bumpField;
46494841 JLabel backlitLabel;
4650
- NumberSlider backlitField;
4842
+ cNumberSlider backlitField;
46514843 JLabel anisoLabel;
4652
- NumberSlider anisoField;
4844
+ cNumberSlider anisoField;
46534845 JLabel anisoVLabel;
4654
- NumberSlider anisoVField;
4846
+ cNumberSlider anisoVField;
46554847 JLabel cameraLabel;
4656
- NumberSlider cameraField;
4848
+ cNumberSlider cameraField;
46574849 JLabel selfshadowLabel;
4658
- NumberSlider selfshadowField;
4850
+ cNumberSlider selfshadowField;
46594851 JLabel shadowLabel;
4660
- NumberSlider shadowField;
4852
+ cNumberSlider shadowField;
46614853 JLabel textureLabel;
4662
- NumberSlider textureField;
4854
+ cNumberSlider textureField;
46634855 JLabel opacityLabel;
4664
- NumberSlider opacityField;
4856
+ cNumberSlider opacityField;
46654857 JLabel fakedepthLabel;
4666
- NumberSlider fakedepthField;
4858
+ cNumberSlider fakedepthField;
46674859 JLabel shadowbiasLabel;
4668
- NumberSlider shadowbiasField;
4860
+ cNumberSlider shadowbiasField;
46694861 JLabel bumpLabel;
4670
- NumberSlider bumpField;
4862
+ cNumberSlider bumpField;
46714863 JLabel noiseLabel;
4672
- NumberSlider noiseField;
4864
+ cNumberSlider noiseField;
46734865 JLabel powerLabel;
4674
- NumberSlider powerField;
4866
+ cNumberSlider powerField;
46754867 JLabel borderfadeLabel;
4676
- NumberSlider borderfadeField;
4868
+ cNumberSlider borderfadeField;
46774869 JLabel fogLabel;
4678
- NumberSlider fogField;
4870
+ cNumberSlider fogField;
46794871 JLabel opacityPowerLabel;
4680
- NumberSlider opacityPowerField;
4872
+ cNumberSlider opacityPowerField;
46814873 JTree jTree;
46824874 //ObjectUI parent;
46834875
4684
- NumberSlider normalpushField;
4876
+ cNumberSlider normalpushField;
4877
+
4878
+ private MenuItem importGFDItem;
4879
+ private MenuItem importVRMLX3DItem;
4880
+ private MenuItem import3DSItem;
4881
+ private MenuItem importOBJItem;
46854882 }