Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
ObjEditor.java
....@@ -19,6 +19,8 @@
1919 import //weka.core.
2020 matrix.Matrix;
2121
22
+import grafeme.ui.*;
23
+
2224 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2325 ActionListener, ChangeListener,
2426 InputMethodListener,
....@@ -136,34 +138,42 @@
136138 public void closeUI()
137139 {
138140 //new Exception().printStackTrace();
139
- System.out.println("this = " + this);
140
- System.out.println("objEditor = " + objEditor);
141
+// System.out.println("this = " + this);
142
+// System.out.println("objEditor = " + objEditor);
141143 //nameField.removeActionListener(this);
142
- objEditor.ctrlPanel.remove(nameField);
144
+// objEditor.ctrlPanel.remove(nameField);
145
+
146
+ objEditor.ctrlPanel.remove(namePanel);
143147
144148 if (!GroupEditor.allparams)
145149 return;
146150
147
- objEditor.ctrlPanel.remove(liveCB);
148
- objEditor.ctrlPanel.remove(hideCB);
149
- objEditor.ctrlPanel.remove(markCB);
150
-
151
- objEditor.ctrlPanel.remove(randomCB);
152
- objEditor.ctrlPanel.remove(speedupCB);
153
- objEditor.ctrlPanel.remove(rewindCB);
154
-
155
- objEditor.ctrlPanel.remove(resetButton);
156
- objEditor.ctrlPanel.remove(stepButton);
157
-// objEditor.ctrlPanel.remove(stepAllButton);
158
-// objEditor.ctrlPanel.remove(resetAllButton);
159
- objEditor.ctrlPanel.remove(link2masterCB);
160
- //objEditor.ctrlPanel.remove(flipVCB);
161
- //objEditor.ctrlPanel.remove(texresMenu);
162
- objEditor.ctrlPanel.remove(slowerButton);
163
- objEditor.ctrlPanel.remove(fasterButton);
164
- 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);
165169
166
- Remove(normalpushField);
170
+ objEditor.ctrlPanel.remove(setupPanel);
171
+ objEditor.ctrlPanel.remove(setupPanel2);
172
+ objEditor.ctrlPanel.remove(commandsPanel);
173
+ objEditor.ctrlPanel.remove(pushPanel);
174
+ //objEditor.ctrlPanel.remove(fillPanel);
175
+
176
+ //Remove(normalpushField);
167177 }
168178
169179 public ObjEditor GetEditor()
....@@ -267,24 +277,40 @@
267277 void SetupMenu()
268278 {
269279 frame.setMenuBar(menuBar = new MenuBar());
270
- menuBar.add(windowMenu = new Menu("File"));
271
- windowMenu.add(loadItem = new MenuItem("Load..."));
272
- windowMenu.add("-");
273
- windowMenu.add(saveItem = new MenuItem("Save"));
274
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
280
+ menuBar.add(fileMenu = new Menu("File"));
281
+ fileMenu.add(newItem = new MenuItem("New"));
282
+ fileMenu.add(loadItem = new MenuItem("Open..."));
283
+
284
+ //oe.menuBar.add(menu = new Menu("Include"));
285
+ Menu menu = new Menu("Import");
286
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
287
+ importOBJItem.addActionListener(this);
288
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
289
+ import3DSItem.addActionListener(this);
290
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
291
+ importVRMLX3DItem.addActionListener(this);
292
+ menu.add("-");
293
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
294
+ importGFDItem.addActionListener(this);
295
+ fileMenu.add(menu);
296
+ fileMenu.add("-");
297
+
298
+ fileMenu.add(saveItem = new MenuItem("Save"));
299
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
275300 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
276
- windowMenu.add("-");
277
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
278
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
279
- windowMenu.add("-");
301
+ fileMenu.add("-");
302
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
303
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
304
+ fileMenu.add("-");
280305 if (client.parent != null)
281306 {
282
- windowMenu.add(closeItem = new MenuItem("Close"));
307
+ fileMenu.add(closeItem = new MenuItem("Close"));
283308 } else
284309 {
285
- windowMenu.add(closeItem = new MenuItem("Exit"));
310
+ fileMenu.add(closeItem = new MenuItem("Exit"));
286311 }
287312
313
+ newItem.addActionListener(this);
288314 loadItem.addActionListener(this);
289315 saveItem.addActionListener(this);
290316 saveAsItem.addActionListener(this);
....@@ -293,79 +319,26 @@
293319 //povItem.addActionListener(this);
294320 closeItem.addActionListener(this);
295321
296
- menuBar.add(cameraMenu = new Menu("View"));
297
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
298
- //zBufferItem.addActionListener(this);
299
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
300
- //normalLensItem.addActionListener(this);
301
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
302
- revertCameraItem.addActionListener(this);
303
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
304
- toggleTimelineItem.addItemListener(this);
305
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
306
- toggleFullScreenItem.addItemListener(this);
307
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
308
- cameraMenu.add("-");
309
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
310
- toggleTextureItem.addItemListener(this);
311
- toggleTextureItem.setState(CameraPane.textureon);
312
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
313
- toggleLiveItem.addItemListener(this);
314
- toggleLiveItem.setState(Globals.isLIVE());
315
- cameraMenu.add(stepItem = new MenuItem("Step"));
316
- stepItem.addActionListener(this);
317
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
318
-// toggleDLItem.addItemListener(this);
319
-// toggleDLItem.setState(false);
320
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
321
- toggleRenderItem.addItemListener(this);
322
- toggleRenderItem.setState(!CameraPane.frozen);
323
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
324
- toggleDebugItem.addItemListener(this);
325
- toggleDebugItem.setState(CameraPane.DEBUG);
326
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
327
- toggleFrustumItem.addItemListener(this);
328
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
329
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
330
- toggleFootContactItem.addItemListener(this);
331
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
332
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
333
- toggleRandomItem.addItemListener(this);
334
- toggleRandomItem.setState(CameraPane.RANDOM);
335
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
336
- toggleHandleItem.addItemListener(this);
337
- toggleHandleItem.setState(CameraPane.HANDLES);
338
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
339
- togglePaintItem.addItemListener(this);
340
- togglePaintItem.setState(CameraPane.PAINTMODE);
341
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
342
-// toggleRootItem.addItemListener(this);
343
-// toggleRootItem.setState(false);
344
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
345
-// animationItem.addItemListener(this);
346
-// animationItem.setState(CameraPane.ANIMATION);
347
- cameraMenu.add("-");
348
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
349
- editCameraItem.addActionListener(this);
350
-
351322 objectPanel = new JTabbedPane();
352323 toolbarPanel = new JPanel();
353324 toolbarPanel.setName("Toolbar");
354
- treePanel = new JPanel();
325
+ treePanel = new cGridBag();
355326 treePanel.setName("Tree");
356
- ctrlPanel = new JPanel(); // new GridBagLayout());
327
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
357328 ctrlPanel.setName("Edit");
358
- materialPanel = new JPanel();
329
+ materialPanel = new cGridBag().setVertical(true);
359330 materialPanel.setName("Material");
360331 /*JTextPane*/
361332 infoarea = createTextPane();
333
+ doc = infoarea.getStyledDocument();
334
+
362335 infoarea.setEditable(true);
363336 SetText();
364337 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
365338 // infoarea.setOpaque(false);
366339 // //infoarea.setForeground(textcolor);
367
- infoarea.setLineWrap(true);
368
- infoarea.setWrapStyleWord(true);
340
+// TEXTAREA infoarea.setLineWrap(true);
341
+// TEXTAREA infoarea.setWrapStyleWord(true);
369342 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
370343 infoPanel.setPreferredSize(new Dimension(50, 200));
371344 infoPanel.setName("Info");
....@@ -376,16 +349,16 @@
376349 mainPanel.setName("Main");
377350 mainPanel.setContinuousLayout(true);
378351 mainPanel.setOneTouchExpandable(true);
379
- mainPanel.setDividerLocation(1.0);
380352 mainPanel.setDividerSize(9);
381
- mainPanel.setResizeWeight(0);
353
+ mainPanel.setDividerLocation(0.5); //1.0);
354
+ mainPanel.setResizeWeight(0.5);
382355
383356 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
384357 //mainPanel.setLayout(new GridBagLayout());
385358 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
386
- treePanel.setLayout(new GridBagLayout());
387
- ctrlPanel.setLayout(new GridBagLayout());
388
- materialPanel.setLayout(new GridBagLayout());
359
+// treePanel.setLayout(new GridBagLayout());
360
+ //ctrlPanel.setLayout(new GridBagLayout());
361
+ //materialPanel.setLayout(new GridBagLayout());
389362
390363 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
391364 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -424,7 +397,7 @@
424397 static String newline = "\n";
425398 protected static final String buttonString = "JButton";
426399 StyledDocument doc;
427
- JTextArea infoarea;
400
+ JTextPane infoarea;
428401
429402 void ClearInfo()
430403 {
....@@ -447,10 +420,10 @@
447420 e.printStackTrace();
448421 }
449422
450
- String selection = infoarea.getText();
451
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
452
- java.awt.datatransfer.Clipboard clipboard =
453
- Toolkit.getDefaultToolkit().getSystemClipboard();
423
+// String selection = infoarea.getText();
424
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
425
+// java.awt.datatransfer.Clipboard clipboard =
426
+// Toolkit.getDefaultToolkit().getSystemClipboard();
454427 //clipboard.setContents(data, data);
455428 }
456429
....@@ -473,13 +446,13 @@
473446 //SendInfo("Name:", "bold");
474447 if (sel.GetTextures() != null || debug)
475448 {
476
- si.SendInfo(sel.toString(), "bold");
449
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
477450 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
478451 if (sel.Size() > 0)
479452 {
480453 si.SendInfo("#children = " + sel.Size(), "regular");
481454 }
482
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
455
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
483456 if (debug)
484457 {
485458 try
....@@ -491,7 +464,10 @@
491464 }
492465
493466 if (full)
494
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
467
+ {
468
+ si.SendInfo(" BBox min: " + minima, "regular");
469
+ si.SendInfo(" BBox max: " + maxima, "regular");
470
+ }
495471
496472 if (sel.bRep != null)
497473 {
....@@ -518,7 +494,7 @@
518494 }
519495 if (sel.support != null)
520496 {
521
- si.SendInfo(" support: " + sel.support, "regular");
497
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
522498 }
523499 if (sel.scriptnode != null)
524500 {
....@@ -589,6 +565,9 @@
589565 {
590566 CameraPane.pointflow = (PointFlow) sel;
591567 }
568
+
569
+ si.SendInfo("_____________________", "regular");
570
+ si.SendInfo("", "regular");
592571 }
593572 }
594573
....@@ -620,52 +599,52 @@
620599 cameraView.ToggleFullScreen();
621600 }
622601
623
- private JTextArea createTextPane()
602
+ private JTextPane createTextPane()
624603 {
625
- String[] initString =
626
- {
627
- "This is an editable JTextPane, ", //regular
628
- "another ", //italic
629
- "styled ", //bold
630
- "text ", //small
631
- "component, ", //large
632
- "which supports embedded components..." + newline,//regular
633
- " " + newline, //button
634
- "...and embedded icons..." + newline, //regular
635
- " ", //icon
636
- newline + "JTextPane is a subclass of JEditorPane that "
637
- + "uses a StyledEditorKit and StyledDocument, and provides "
638
- + "cover methods for interacting with those objects."
639
- };
604
+// TEXTAREA String[] initString =
605
+// {
606
+// "This is an editable JTextPane, ", //regular
607
+// "another ", //italic
608
+// "styled ", //bold
609
+// "text ", //small
610
+// "component, ", //large
611
+// "which supports embedded components..." + newline,//regular
612
+// " " + newline, //button
613
+// "...and embedded icons..." + newline, //regular
614
+// " ", //icon
615
+// newline + "JTextPane is a subclass of JEditorPane that "
616
+// + "uses a StyledEditorKit and StyledDocument, and provides "
617
+// + "cover methods for interacting with those objects."
618
+// };
619
+//
620
+// String[] initStyles =
621
+// {
622
+// "regular", "italic", "bold", "small", "large",
623
+// "regular", "button", "regular", "icon",
624
+// "regular"
625
+// };
626
+//
627
+// JTextPane textPane = new JTextPane();
628
+// textPane.setEditable(true);
629
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
630
+// addStylesToDocument(doc);
631
+//
632
+// try
633
+// {
634
+// for (int j = 0; j < 2; j++)
635
+// {
636
+// for (int i = 0; i < initString.length; i++)
637
+// {
638
+// doc.insertString(doc.getLength(), initString[i],
639
+// doc.getStyle(initStyles[i]));
640
+// }
641
+// }
642
+// } catch (BadLocationException ble)
643
+// {
644
+// System.err.println("Couldn't insert initial text into text pane.");
645
+// }
640646
641
- String[] initStyles =
642
- {
643
- "regular", "italic", "bold", "small", "large",
644
- "regular", "button", "regular", "icon",
645
- "regular"
646
- };
647
-
648
- JTextPane textPane = new JTextPane();
649
- textPane.setEditable(true);
650
- /*StyledDocument*/ doc = textPane.getStyledDocument();
651
- addStylesToDocument(doc);
652
-
653
- try
654
- {
655
- for (int j = 0; j < 2; j++)
656
- {
657
- for (int i = 0; i < initString.length; i++)
658
- {
659
- doc.insertString(doc.getLength(), initString[i],
660
- doc.getStyle(initStyles[i]));
661
- }
662
- }
663
- } catch (BadLocationException ble)
664
- {
665
- System.err.println("Couldn't insert initial text into text pane.");
666
- }
667
-
668
- return new JTextArea(); // textPane;
647
+ return new JTextPane(); // textPane;
669648 }
670649
671650 protected void addStylesToDocument(StyledDocument doc)
....@@ -718,7 +697,7 @@
718697 protected static ImageIcon createImageIcon(String path,
719698 String description)
720699 {
721
- java.net.URL imgURL = GrafreeD.class.getResource(path);
700
+ java.net.URL imgURL = Grafreed.class.getResource(path);
722701 if (imgURL != null)
723702 {
724703 return new ImageIcon(imgURL, description);
....@@ -750,6 +729,7 @@
750729 // NumberSlider vDivsField;
751730 // JCheckBox endcaps;
752731 JCheckBox liveCB;
732
+ JCheckBox selectCB;
753733 JCheckBox hideCB;
754734 JCheckBox link2masterCB;
755735 JCheckBox markCB;
....@@ -765,115 +745,84 @@
765745 JButton slowerButton;
766746 JButton fasterButton;
767747 JButton remarkButton;
748
+
749
+ cGridBag namePanel;
750
+ cGridBag setupPanel;
751
+ cGridBag setupPanel2;
752
+ cGridBag commandsPanel;
753
+ cGridBag pushPanel;
754
+ cGridBag fillPanel;
768755
769
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
756
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
770757 {
771758 JCheckBox cb;
772759
773
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
774
- oe.aConstraints.gridwidth = 1; // 3;
775
-// oe.aConstraints.weightx = 1;
776
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
777
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
760
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
778761 cb.addItemListener(this);
779
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
780
- oe.aConstraints.gridwidth = 1;
781
- oe.aConstraints.gridx += 1;
782762
783763 return cb;
784764 }
785765
786
- cButton AddButton(ObjEditor oe, String label)
766
+ cButton AddButton(cGridBag panel, String label)
787767 {
788768 cButton cb;
789769
790
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
791
- oe.aConstraints.gridwidth = 1;
792
-// oe.aConstraints.weightx = 1;
793
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
794
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
770
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
795771 cb.addActionListener(this);
796
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
797
- oe.aConstraints.gridwidth = 1;
798
- oe.aConstraints.gridx += 1;
799772
800773 return cb;
801774 }
802775
803
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
776
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
804777 {
805778 JComboBox combo;
806779
807
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
808
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
809
- oe.aConstraints.gridx += 1;
780
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810781 combo.addActionListener(this);
811782
812783 return combo;
813784 }
814785
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
786
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
816787 {
817
- NumberSlider combo;
788
+ cGridBag control = new cGridBag();
789
+
790
+ cNumberSlider combo;
818791
819792 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822793 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 1;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
794
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
795
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832796 combo.setFloat(current);
833
-
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
797
+
798
+ panel.add(control);
799
+
800
+ return control;
839801 }
840802
841
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
803
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
842804 {
843
- NumberSlider combo;
805
+ cGridBag control = new cGridBag();
806
+
807
+ cNumberSlider combo;
844808
845809 JLabel jlabel = new JLabel(label);
846
-
847
- aConstraints.fill = GridBagConstraints.VERTICAL;
848810 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
849
- aConstraints.gridwidth = 2;
850
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
851
- aConstraints.gridx += 1;
852
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
853
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
854
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
855
- aConstraints.gridx += 1;
856
- aConstraints.gridwidth = 1;
857
-
811
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
858813 combo.setInteger(current);
859814
860
- combo.label = jlabel;
861
-
862
- combo.addChangeListener(this);
863
-
864
- return combo;
815
+ panel.add(control);
816
+
817
+ return control;
865818 }
866819
867
- JTextArea AddText(JPanel ctrlPanel, String name)
820
+ JTextArea AddText(cGridBag ctrlPanel, String name)
868821 {
869822 JTextArea text;
870823
871
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
872
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
873
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
824
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
874825 text.addCaretListener(this);
875
- aConstraints.gridx += 1;
876
- aConstraints.gridwidth = 1;
877826
878827 return text;
879828 }
....@@ -903,9 +852,16 @@
903852 objEditor.ctrlPanel.remove(j);
904853 }
905854
855
+ void Remove(cNumberSlider j)
856
+ {
857
+ j.removeChangeListener(this);
858
+ //objEditor.ctrlPanel.remove(j.label);
859
+ objEditor.ctrlPanel.remove(j);
860
+ }
861
+
906862 /*
907863 */
908
- void Return() // ObjEditor oe)
864
+ void Return0() // ObjEditor oe)
909865 {
910866 aConstraints.gridy += 1;
911867 aConstraints.gridx = 0;
....@@ -960,37 +916,76 @@
960916
961917 void SetupUI2(ObjEditor oe)
962918 {
963
-// oe.aConstraints.weightx = 0;
964
-// oe.aConstraints.weighty = 0;
965
-// oe.aConstraints.gridx = 0;
966
-// oe.aConstraints.gridy = 0;
967
- SetupName(oe);
919
+ //SetupName(oe);
920
+
921
+ namePanel = new cGridBag();
922
+
923
+ nameField = AddText(namePanel, copy.GetName());
924
+ namePanel.add(nameField);
925
+ oe.ctrlPanel.add(namePanel);
926
+
927
+ oe.ctrlPanel.Return();
968928
969929 if (!GroupEditor.allparams)
970930 return;
971931
972
- liveCB = AddCheckBox(oe, "Live", copy.live);
973
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
974
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
932
+ setupPanel = new cGridBag().setVertical(false);
933
+
934
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
935
+ liveCB.setToolTipText("Animate object");
936
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
937
+ selectCB.setToolTipText("Make object selectable");
975938 // Return();
976
- markCB = AddCheckBox(oe, "Mark", copy.marked);
977
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
978
- randomCB = AddCheckBox(oe, "Rand", copy.random);
979
- Return();
980
- resetButton = AddButton(oe, "Reset");
981
- stepButton = AddButton(oe, "Step");
939
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
940
+ hideCB.setToolTipText("Hide object");
941
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
942
+ markCB.setToolTipText("Set the animation target transform");
943
+
944
+ setupPanel2 = new cGridBag().setVertical(false);
945
+
946
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
947
+ rewindCB.setToolTipText("Rewind animation");
948
+
949
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
950
+ randomCB.setToolTipText("Rewind or Go back and forth randomly");
951
+
952
+ if (Globals.ADVANCED)
953
+ {
954
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
955
+ link2masterCB.setToolTipText("Attach to support");
956
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
957
+ speedupCB.setToolTipText("Option motion capture");
958
+ }
959
+
960
+ oe.ctrlPanel.add(setupPanel);
961
+ oe.ctrlPanel.Return();
962
+ oe.ctrlPanel.add(setupPanel2);
963
+ oe.ctrlPanel.Return();
964
+
965
+ commandsPanel = new cGridBag().setVertical(false);
966
+
967
+ resetButton = AddButton(commandsPanel, "Reset");
968
+ resetButton.setToolTipText("Jump to frame zero");
969
+ stepButton = AddButton(commandsPanel, "Step");
970
+ stepButton.setToolTipText("Step one frame");
982971 // resetAllButton = AddButton(oe, "Reset All");
983972 // stepAllButton = AddButton(oe, "Step All");
984
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
985973 // Return();
986
- slowerButton = AddButton(oe, "Slow");
987
- fasterButton = AddButton(oe, "Fast");
988
- remarkButton = AddButton(oe, "Rem");
974
+ slowerButton = AddButton(commandsPanel, "Slow");
975
+ slowerButton.setToolTipText("Decrease animation speed");
976
+ fasterButton = AddButton(commandsPanel, "Fast");
977
+ fasterButton.setToolTipText("Increase animation speed");
978
+ remarkButton = AddButton(commandsPanel, "Remark");
979
+ remarkButton.setToolTipText("Set the current transform as the target");
989980
990
- Return();
981
+ oe.ctrlPanel.add(commandsPanel);
982
+ oe.ctrlPanel.Return();
991983
992
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
993
- Return();
984
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
985
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
986
+ //Return();
987
+
988
+ oe.ctrlPanel.Return();
994989
995990 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
996991 // ObjEditor.aConstraints.gridx += 1;
....@@ -1085,7 +1080,7 @@
10851080 oe.aConstraints.gridwidth = 1;
10861081 /**/
10871082 nameField = AddText(oe.ctrlPanel, copy.GetName());
1088
- Return();
1083
+ oe.ctrlPanel.Return();
10891084
10901085 //ctrlPanel.add(textureButton = new Button("Texture..."));
10911086 //textureButton.setEnabled(false);
....@@ -1187,7 +1182,8 @@
11871182 //JPanel worldPanel =
11881183 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11891184 //worldPanel.setName("World");
1190
- centralPanel = new JPanel(new BorderLayout());
1185
+ centralPanel = new cGridBag();
1186
+ centralPanel.preferredWidth = 20;
11911187 timelinePanel = new JPanel(new BorderLayout());
11921188 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11931189
....@@ -1217,12 +1213,13 @@
12171213 //frontView.object = copy;
12181214 //sideView.object = copy;
12191215
1220
- XYZPanel = new JPanel();
1221
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1216
+ XYZPanel = new cGridBag().setVertical(true);
1217
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12221218
1223
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1224
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1225
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1219
+ XYZPanel.preferredWidth = 5;
1220
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1221
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1222
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
12261223
12271224 /*
12281225 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1260,10 +1257,11 @@
12601257 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12611258 //tmp.setName("Edit");
12621259 objectPanel.add(materialPanel);
1263
- JPanel north = new JPanel(new BorderLayout());
1264
- north.setName("Edit");
1265
- north.add(ctrlPanel, BorderLayout.NORTH);
1266
- objectPanel.add(north);
1260
+// JPanel north = new JPanel(new BorderLayout());
1261
+// north.setName("Edit");
1262
+// north.add(ctrlPanel, BorderLayout.NORTH);
1263
+// objectPanel.add(north);
1264
+ objectPanel.add(ctrlPanel);
12671265 objectPanel.add(infoPanel);
12681266
12691267 /*
....@@ -1284,19 +1282,23 @@
12841282 scrollpane.setWheelScrollingEnabled(true);
12851283 scrollpane.addMouseWheelListener(this); // Default not fast enough
12861284
1287
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1288
- scenePanel.add(scrollpane);
1285
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1286
+ scenePanel.preferredWidth = 6;
1287
+
1288
+ JTabbedPane tabbedPane = new JTabbedPane();
1289
+ tabbedPane.add(scrollpane);
12891290
1290
- scenePanel.add(FSPane = new cFileSystemPane(this));
1291
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12911292
1292
- optionsPanel = new JPanel(new GridBagLayout());
1293
+ optionsPanel = new cGridBag().setVertical(true);
12931294
12941295 optionsPanel.setName("Options");
12951296
1296
- AddOptions(optionsPanel, aConstraints);
1297
+ AddOptions(optionsPanel); //, aConstraints);
12971298
1298
- scenePanel.add(optionsPanel);
1299
-
1299
+ tabbedPane.add(optionsPanel);
1300
+
1301
+ scenePanel.add(tabbedPane);
13001302
13011303 /*
13021304 cTree jTree = new cTree(null);
....@@ -1330,6 +1332,7 @@
13301332 //bigPanel.setSize(new Dimension(10,10));
13311333 //bigPanel.add(ctrlPanel);
13321334 //bigPanel.add(gridPanel);
1335
+ /**
13331336 bigThree = new JPanel();
13341337 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13351338 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1353,7 +1356,13 @@
13531356 // aConstraints.gridheight = 3;
13541357 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13551358 bigThree.add(XYZPanel, aWindowConstraints);
1359
+ /**/
13561360
1361
+ bigThree = new cGridBag();
1362
+ bigThree.addComponent(scenePanel);
1363
+ bigThree.addComponent(centralPanel);
1364
+ bigThree.addComponent(XYZPanel);
1365
+
13571366 // // SIDE EFFECT!!!
13581367 // aConstraints.gridx = 0;
13591368 // aConstraints.gridy = 0;
....@@ -1380,8 +1389,8 @@
13801389
13811390 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13821391
1383
- frame.setSize(1024, 768);
1384
- frame.show();
1392
+ frame.setSize(1280, 860);
1393
+ frame.setVisible(true);
13851394
13861395 gridPanel.setDividerLocation(1.0);
13871396
....@@ -1396,7 +1405,7 @@
13961405 });
13971406 }
13981407
1399
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1408
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14001409 {
14011410 }
14021411
....@@ -1411,260 +1420,173 @@
14111420 ctrlPanel.removeAll();
14121421 }
14131422
1414
- void SetupMaterial(JPanel ctrlPanel)
1423
+ void SetupMaterial(cGridBag panel)
14151424 {
1416
- aConstraints.weighty = 0;
1417
- //aConstraints.weightx = 1;
1418
- /*
1425
+ /*
14191426 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14201427 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
14231428 */
14241429
1425
- aConstraints.gridwidth = 1;
1426
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1427
- aConstraints.gridx += 1;
1428
- aConstraints.weighty = 0;
1429
- aConstraints.gridwidth = 1;
1430
+ cGridBag editBar = new cGridBag().setVertical(false);
1431
+
1432
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1433
+ createMaterialButton.setToolTipText("Create material");
14301434
14311435 /*
14321436 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1433
- aConstraints.gridx += 1;
1434
- aConstraints.weighty = 0;
1435
- aConstraints.gridwidth = 1;
14361437 */
14371438
1438
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1439
- aConstraints.gridx += 1;
1439
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1440
+ clearMaterialButton.setToolTipText("Clear material");
1441
+
1442
+ if (Globals.ADVANCED)
1443
+ {
1444
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1445
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1446
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1447
+ }
14401448
1441
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1442
-
1443
- aConstraints.gridx += 1;
1444
-
1445
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1446
-
1447
- aConstraints.gridx += 1;
1448
-
1449
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1450
-
1451
- aConstraints.gridx = 0;
1452
- aConstraints.gridy += 1;
1453
- aConstraints.weighty = 0;
1454
- aConstraints.gridwidth = 1;
1449
+ editBar.preferredHeight = 15;
1450
+
1451
+ panel.add(editBar);
1452
+
14551453 /**/
14561454 //aConstraints.weighty = 0;
14571455 ////aConstraints.weightx = 1;
14581456 //aConstraints.weighty = 1;
14591457 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14601458 //aConstraints.gridx += 1;
1461
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1462
- aConstraints.weighty = 0;
1463
- aConstraints.gridx = 0;
1464
- aConstraints.gridy += 1;
1465
- aConstraints.gridwidth = 1;
1459
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14661460
1467
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1468
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1469
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1470
- aConstraints.gridx += 1;
1471
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1472
- //aConstraints.weightx = 0;
1473
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1474
- aConstraints.gridx = 0;
1475
- aConstraints.gridy += 1;
1476
- aConstraints.gridwidth = 1;
1461
+ cGridBag colorSection = new cGridBag().setVertical(true);
1462
+
1463
+ cGridBag color = new cGridBag();
1464
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1465
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1466
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1467
+ //colorField.preferredWidth = 200;
1468
+ colorSection.add(color);
14771469
1478
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1479
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1480
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1481
- aConstraints.gridx += 1;
1482
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1483
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1484
- aConstraints.gridx = 0;
1485
- aConstraints.gridy += 1;
1486
- aConstraints.gridwidth = 1;
1470
+ cGridBag modulation = new cGridBag();
1471
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1472
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1474
+ colorSection.add(modulation);
14871475
1488
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1489
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1490
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1491
- aConstraints.gridx += 1;
1492
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1493
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1494
- aConstraints.gridx = 0;
1495
- aConstraints.gridy += 1;
1496
- aConstraints.gridwidth = 1;
1476
+ cGridBag texture = new cGridBag();
1477
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1478
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
+ colorSection.add(texture);
14971481
1498
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1499
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1500
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1501
- aConstraints.gridx += 1;
1502
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1503
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1504
- aConstraints.gridx = 0;
1505
- aConstraints.gridy += 1;
1506
- aConstraints.gridwidth = 1;
1482
+ cGridBag anisoU = new cGridBag();
1483
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1484
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
+ colorSection.add(anisoU);
15071487
1508
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1509
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1510
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1511
- aConstraints.gridx += 1;
1512
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1513
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1514
- aConstraints.gridx = 0;
1515
- aConstraints.gridy += 1;
1516
- aConstraints.gridwidth = 1;
1488
+ cGridBag anisoV = new cGridBag();
1489
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1490
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1492
+ colorSection.add(anisoV);
15171493
1518
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1519
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1520
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1521
- aConstraints.gridx += 1;
1522
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1523
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1524
- aConstraints.gridx = 0;
1525
- aConstraints.gridy += 1;
1526
- aConstraints.gridwidth = 1;
1494
+ cGridBag shadowbias = new cGridBag();
1495
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1496
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1498
+ colorSection.add(shadowbias);
15271499
1528
- //aConstraints.weighty = 1;
1529
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1530
- //aConstraints.gridx += 1;
1531
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1532
- aConstraints.weighty = 0;
1533
- aConstraints.gridx = 0;
1534
- aConstraints.gridy += 1;
1535
- aConstraints.gridwidth = 1;
1500
+ panel.add(new JSeparator());
1501
+
1502
+ panel.add(colorSection);
1503
+
1504
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1505
+
1506
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1507
+
1508
+ cGridBag diffuse = new cGridBag();
1509
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1510
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1512
+ diffuseSection.add(diffuse);
15361513
1537
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1538
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1539
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1540
- aConstraints.gridx += 1;
1541
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1542
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1543
- aConstraints.gridx = 0;
1544
- aConstraints.gridy += 1;
1545
- aConstraints.gridwidth = 1;
1514
+ cGridBag diffuseness = new cGridBag();
1515
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1516
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1518
+ diffuseSection.add(diffuseness);
15461519
1547
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1548
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1549
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1550
- aConstraints.gridx += 1;
1551
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1552
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1553
- aConstraints.gridx = 0;
1554
- aConstraints.gridy += 1;
1555
- aConstraints.gridwidth = 1;
1520
+ cGridBag selfshadow = new cGridBag();
1521
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1522
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1523
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1524
+ diffuseSection.add(selfshadow);
15561525
1557
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1558
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1560
- aConstraints.gridx += 1;
1561
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1562
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1563
- aConstraints.gridx = 0;
1564
- aConstraints.gridy += 1;
1565
- aConstraints.gridwidth = 1;
1526
+ cGridBag sheen = new cGridBag();
1527
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1528
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1530
+ diffuseSection.add(sheen);
15661531
1567
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1568
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1569
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1570
- aConstraints.gridx += 1;
1571
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1572
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1573
- aConstraints.gridx = 0;
1574
- aConstraints.gridy += 1;
1575
- aConstraints.gridwidth = 1;
1532
+ cGridBag subsurface = new cGridBag();
1533
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1534
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1536
+ diffuseSection.add(subsurface);
15761537
1577
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1578
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1580
- aConstraints.gridx += 1;
1581
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1582
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1583
- aConstraints.gridx = 0;
1584
- aConstraints.gridy += 1;
1585
- aConstraints.gridwidth = 1;
1538
+ cGridBag shadow = new cGridBag();
1539
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1540
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1542
+ diffuseSection.add(shadow);
15861543
1587
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1588
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1589
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1590
- aConstraints.gridx += 1;
1591
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1592
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1593
- aConstraints.gridx = 0;
1594
- aConstraints.gridy += 1;
1595
- aConstraints.gridwidth = 1;
1544
+ cGridBag fakedepth = new cGridBag();
1545
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1546
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1548
+ diffuseSection.add(fakedepth);
15961549
1597
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1598
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1599
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1600
- aConstraints.gridx += 1;
1601
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1602
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1603
- aConstraints.gridx = 0;
1604
- aConstraints.gridy += 1;
1605
- aConstraints.gridwidth = 1;
1550
+ panel.add(new JSeparator());
1551
+
1552
+ panel.add(diffuseSection);
1553
+
1554
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1555
+
1556
+ cGridBag specularSection = new cGridBag().setVertical(true);
16061557
1607
- //aConstraints.weighty = 1;
1608
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1609
- //aConstraints.gridx += 1;
1610
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1611
- aConstraints.weighty = 0;
1612
- aConstraints.gridx = 0;
1613
- aConstraints.gridy += 1;
1614
- aConstraints.gridwidth = 1;
1558
+ cGridBag specular = new cGridBag();
1559
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1560
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1561
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1562
+ specularSection.add(specular);
16151563
1616
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1617
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1619
- aConstraints.gridx += 1;
1620
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1621
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1622
- aConstraints.gridx = 0;
1623
- aConstraints.gridy += 1;
1624
- aConstraints.gridwidth = 1;
1564
+ cGridBag lightarea = new cGridBag();
1565
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1566
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1567
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1568
+ specularSection.add(lightarea);
16251569
1626
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1627
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1629
- aConstraints.gridx += 1;
1630
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1631
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1632
- aConstraints.gridx = 0;
1633
- aConstraints.gridy += 1;
1634
- aConstraints.gridwidth = 1;
1570
+ cGridBag shininess = new cGridBag();
1571
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1572
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1573
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1574
+ specularSection.add(shininess);
16351575
1636
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1637
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1639
- aConstraints.gridx += 1;
1640
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1641
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1642
- aConstraints.gridx = 0;
1643
- aConstraints.gridy += 1;
1644
- aConstraints.gridwidth = 1;
1576
+ cGridBag metalness = new cGridBag();
1577
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1578
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1580
+ specularSection.add(metalness);
16451581
1646
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1647
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1648
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1649
- aConstraints.gridx += 1;
1650
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1651
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1652
- aConstraints.gridx = 0;
1653
- aConstraints.gridy += 1;
1654
- aConstraints.gridwidth = 1;
1582
+ cGridBag velvet = new cGridBag();
1583
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1584
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1585
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1586
+ specularSection.add(velvet);
16551587
1656
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1657
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1658
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1659
- aConstraints.gridx += 1;
1660
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1661
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1662
- aConstraints.gridx = 0;
1663
- aConstraints.gridy += 1;
1664
- aConstraints.gridwidth = 1;
1665
-
1666
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1667
- Return();
1588
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1589
+ //Return();
16681590 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16691591 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16701592 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1675,130 +1597,93 @@
16751597 // aConstraints.gridy += 1;
16761598 // aConstraints.gridwidth = 1;
16771599
1678
- //aConstraints.weighty = 1;
1679
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1680
- //aConstraints.gridx += 1;
1681
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1682
- aConstraints.weighty = 0;
1683
- aConstraints.gridx = 0;
1684
- aConstraints.gridy += 1;
1685
- aConstraints.gridwidth = 1;
16861600
1687
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1688
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1689
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1690
- aConstraints.gridx += 1;
1691
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1692
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1693
- aConstraints.gridx = 0;
1694
- aConstraints.gridy += 1;
1695
- aConstraints.gridwidth = 1;
1601
+ panel.add(new JSeparator());
1602
+
1603
+ panel.add(specularSection);
1604
+
1605
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1606
+
1607
+ cGridBag globalSection = new cGridBag().setVertical(true);
16961608
1697
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1698
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1699
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1700
- aConstraints.gridx += 1;
1701
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1702
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1703
- aConstraints.gridx = 0;
1704
- aConstraints.gridy += 1;
1705
- aConstraints.gridwidth = 1;
1609
+ cGridBag camera = new cGridBag();
1610
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1611
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1612
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
+ globalSection.add(camera);
17061614
1707
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1708
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1709
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1710
- aConstraints.gridx += 1;
1711
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1712
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1713
- aConstraints.gridx = 0;
1714
- aConstraints.gridy += 1;
1715
- aConstraints.gridwidth = 1;
1615
+ cGridBag ambient = new cGridBag();
1616
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1617
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
+ globalSection.add(ambient);
17161620
1717
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1718
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1719
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1720
- aConstraints.gridx += 1;
1721
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1722
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1723
- aConstraints.gridx = 0;
1724
- aConstraints.gridy += 1;
1725
- aConstraints.gridwidth = 1;
1726
- aConstraints.weighty = 0;
1621
+ cGridBag backlit = new cGridBag();
1622
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1623
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1625
+ globalSection.add(backlit);
17271626
1728
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1729
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1730
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1731
- aConstraints.gridx += 1;
1732
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1733
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1734
- aConstraints.gridx = 0;
1735
- aConstraints.gridy += 1;
1736
- aConstraints.gridwidth = 1;
1627
+ cGridBag opacity = new cGridBag();
1628
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1629
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1630
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1631
+ globalSection.add(opacity);
17371632
1738
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1739
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1740
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1741
- aConstraints.gridx += 1;
1742
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1743
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1744
- aConstraints.gridx = 0;
1745
- aConstraints.gridy += 1;
1746
- aConstraints.gridwidth = 1;
1633
+ panel.add(new JSeparator());
1634
+
1635
+ panel.add(globalSection);
1636
+
1637
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1638
+
1639
+ cGridBag textureSection = new cGridBag().setVertical(true);
17471640
1748
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1749
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1750
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1751
- aConstraints.gridx += 1;
1752
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1753
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1754
- aConstraints.gridx = 0;
1755
- aConstraints.gridy += 1;
1756
- aConstraints.gridwidth = 1;
1641
+ cGridBag bump = new cGridBag();
1642
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1643
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1645
+ textureSection.add(bump);
17571646
1758
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1759
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1760
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1761
- aConstraints.gridx += 1;
1762
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1763
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1764
- aConstraints.gridx = 0;
1765
- aConstraints.gridy += 1;
1766
- aConstraints.gridwidth = 1;
1647
+ cGridBag noise = new cGridBag();
1648
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1649
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1651
+ textureSection.add(noise);
17671652
1768
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1769
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1771
- aConstraints.gridx += 1;
1772
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1773
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1774
- aConstraints.gridx = 0;
1775
- aConstraints.gridy += 1;
1776
- aConstraints.gridwidth = 1;
1653
+ cGridBag power = new cGridBag();
1654
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1655
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1657
+ textureSection.add(power);
17771658
1778
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1779
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1780
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1781
- aConstraints.gridx += 1;
1782
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1783
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1784
- aConstraints.gridx = 0;
1785
- aConstraints.gridy += 1;
1786
- aConstraints.gridwidth = 1;
1659
+ cGridBag borderfade = new cGridBag();
1660
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1661
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1663
+ textureSection.add(borderfade);
17871664
1788
- //aConstraints.weighty = 1;
1789
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1790
- //aConstraints.gridx += 1;
1791
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1792
- aConstraints.weighty = 0;
1665
+ cGridBag fog = new cGridBag();
1666
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1667
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1668
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1669
+ textureSection.add(fog);
17931670
1794
- aConstraints.gridx = 0;
1795
- aConstraints.gridy = 0;
1796
- aConstraints.gridwidth = 1;
1671
+ cGridBag opacityPower = new cGridBag();
1672
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1673
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1674
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1675
+ textureSection.add(opacityPower);
1676
+
1677
+ panel.add(new JSeparator());
1678
+
1679
+ panel.add(textureSection);
1680
+
1681
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17971682
17981683 SetMaterial(copy); // .GetMaterial());
17991684
1800
- colorField.addChangeListener(this);
1801
- modulationField.addChangeListener(this);
1685
+ //colorField.addChangeListener(this);
1686
+// modulationField.addChangeListener(this);
18021687 metalnessField.addChangeListener(this);
18031688 diffuseField.addChangeListener(this);
18041689 specularField.addChangeListener(this);
....@@ -1828,12 +1713,15 @@
18281713 opacityPowerField.addChangeListener(this);
18291714 /**/
18301715
1831
- resetSlidersButton.addActionListener(this);
18321716 clearMaterialButton.addActionListener(this);
18331717 createMaterialButton.addActionListener(this);
1834
-
1835
- propagateToggle.addItemListener(this);
1836
- multiplyToggle.addItemListener(this);
1718
+
1719
+ if (Globals.ADVANCED)
1720
+ {
1721
+ resetSlidersButton.addActionListener(this);
1722
+ propagateToggle.addItemListener(this);
1723
+ multiplyToggle.addItemListener(this);
1724
+ }
18371725 }
18381726
18391727 void DropFile(java.io.File[] files, boolean textures)
....@@ -2004,7 +1892,7 @@
20041892
20051893 //? flashIt = false;
20061894 CameraPane pane = (CameraPane) cameraView;
2007
- pane.clickStart(location.x, location.y, 0);
1895
+ pane.clickStart(location.x, location.y, 0, 0);
20081896 pane.clickEnd(location.x, location.y, 0, true);
20091897
20101898 if (group.selection.size() == 1)
....@@ -2053,6 +1941,7 @@
20531941 e2.printStackTrace();
20541942 }
20551943 }
1944
+
20561945 LoadJMEThread loadThread;
20571946
20581947 class LoadJMEThread extends Thread
....@@ -2110,6 +1999,7 @@
21101999 //LoadFile0(filename, converter);
21112000 }
21122001 }
2002
+
21132003 LoadOBJThread loadObjThread;
21142004
21152005 class LoadOBJThread extends Thread
....@@ -2188,19 +2078,19 @@
21882078
21892079 void LoadObjFile(String fullname)
21902080 {
2191
- /*
2081
+ System.out.println("Loading " + fullname);
2082
+ /**/
21922083 //lastFilename = fullname;
21932084 if(loadObjThread == null)
21942085 {
2195
- loadObjThread = new LoadOBJThread();
2196
- loadObjThread.start();
2086
+ loadObjThread = new LoadOBJThread();
2087
+ loadObjThread.start();
21972088 }
21982089
21992090 loadObjThread.add(fullname);
2200
- */
2091
+ /**/
22012092
2202
- System.out.println("Loading " + fullname);
2203
- makeSomething(new FileObject(fullname, true), true);
2093
+ //makeSomething(new FileObject(fullname, true), true);
22042094 }
22052095
22062096 void LoadGFDFile(String fullname)
....@@ -2461,11 +2351,11 @@
24612351
24622352 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24632353 {
2464
- if (GrafreeD.standAlone)
2354
+ if (Grafreed.standAlone)
24652355 {
24662356 /**/
24672357 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2468
- browser.show();
2358
+ browser.setVisible(true);
24692359 String filename = browser.getFile();
24702360 if (filename != null && filename.length() > 0)
24712361 {
....@@ -2610,6 +2500,7 @@
26102500 }
26112501 if (input == null)
26122502 {
2503
+ new Exception().printStackTrace();
26132504 System.exit(0);
26142505 }
26152506
....@@ -2824,7 +2715,8 @@
28242715 return;
28252716 }
28262717
2827
- multiplyToggle.setSelected(mat.multiply);
2718
+ if (multiplyToggle != null)
2719
+ multiplyToggle.setSelected(mat.multiply);
28282720
28292721 assert (object.projectedVertices != null);
28302722
....@@ -3039,9 +2931,9 @@
30392931 frame.validate();
30402932
30412933 return;
3042
- } else if (event.getSource() == toggleRandomItem)
2934
+ } else if (event.getSource() == toggleSwitchItem)
30432935 {
3044
- cameraView.ToggleRandom();
2936
+ cameraView.ToggleSwitch();
30452937 cameraView.repaint();
30462938 return;
30472939 } else if (event.getSource() == toggleHandleItem)
....@@ -3070,6 +2962,10 @@
30702962 {
30712963 copy.live ^= true;
30722964 return;
2965
+ } else if (event.getSource() == selectCB)
2966
+ {
2967
+ copy.dontselect ^= true;
2968
+ return;
30732969 } else if (event.getSource() == hideCB)
30742970 {
30752971 copy.hide ^= true;
....@@ -3084,6 +2980,7 @@
30842980 if (event.getSource() == randomCB)
30852981 {
30862982 copy.random ^= true;
2983
+ objEditor.refreshContents();
30872984 return;
30882985 }
30892986 if (event.getSource() == speedupCB)
....@@ -3107,8 +3004,9 @@
31073004
31083005 public void actionPerformed(ActionEvent event)
31093006 {
3007
+ Object source = event.getSource();
31103008 // SCRIPT DIALOG
3111
- if (event.getSource() == okbutton)
3009
+ if (source == okbutton)
31123010 {
31133011 textpanel.setVisible(false);
31143012 textpanel.remove(textarea);
....@@ -3120,7 +3018,7 @@
31203018 textarea = null;
31213019 textpanel = null;
31223020 }
3123
- if (event.getSource() == cancelbutton)
3021
+ if (source == cancelbutton)
31243022 {
31253023 textpanel.setVisible(false);
31263024 textpanel.remove(textarea);
....@@ -3132,50 +3030,50 @@
31323030 //applySelf();
31333031 //client.refreshEditWindow();
31343032 //refreshContents();
3135
- if (event.getSource() == nameField)
3033
+ if (source == nameField)
31363034 {
31373035 //System.out.println("ObjEditor " + event);
31383036 applySelf0(true);
31393037 //parent.applySelf();
31403038 objEditor.refreshContents();
3141
- } else if (event.getSource() == resetButton)
3039
+ } else if (source == resetButton)
31423040 {
31433041 CameraPane.fullreset = true;
31443042 copy.Reset(); // ResetMeshes();
31453043 copy.Touch();
31463044 objEditor.refreshContents();
3147
- } else if (event.getSource() == stepItem)
3045
+ } else if (source == stepItem)
31483046 {
31493047 //cameraView.ONESTEP = true;
31503048 Globals.ONESTEP = true;
31513049 cameraView.repaint();
31523050 return;
3153
- } else if (event.getSource() == stepButton)
3051
+ } else if (source == stepButton)
31543052 {
31553053 copy.Step();
31563054 copy.Touch();
31573055 objEditor.refreshContents();
3158
- } else if (event.getSource() == slowerButton)
3056
+ } else if (source == slowerButton)
31593057 {
31603058 copy.Slower();
31613059 copy.Touch();
31623060 objEditor.refreshContents();
3163
- } else if (event.getSource() == fasterButton)
3061
+ } else if (source == fasterButton)
31643062 {
31653063 copy.Faster();
31663064 copy.Touch();
31673065 objEditor.refreshContents();
3168
- } else if (event.getSource() == remarkButton)
3066
+ } else if (source == remarkButton)
31693067 {
31703068 copy.Remark();
31713069 copy.Touch();
31723070 objEditor.refreshContents();
3173
- } else if (event.getSource() == stepAllButton)
3071
+ } else if (source == stepAllButton)
31743072 {
31753073 copy.StepAll();
31763074 copy.Touch();
31773075 objEditor.refreshContents();
3178
- } else if (event.getSource() == resetAllButton)
3076
+ } else if (source == resetAllButton)
31793077 {
31803078 //CameraPane.fullreset = true;
31813079 copy.ResetAll(); // ResetMeshes();
....@@ -3208,53 +3106,75 @@
32083106 // Close();
32093107 // }
32103108 // else
3211
- if (event.getSource() == resetSlidersButton)
3109
+ if (source == resetSlidersButton)
32123110 {
32133111 ResetSliders();
3214
- } else if (event.getSource() == clearMaterialButton)
3112
+ } else if (source == clearMaterialButton)
32153113 {
32163114 ClearMaterial();
3217
- } else if (event.getSource() == createMaterialButton)
3115
+ } else if (source == createMaterialButton)
32183116 {
32193117 CreateMaterial();
3220
- } else if (event.getSource() == clearPanelButton)
3118
+ } else if (source == clearPanelButton)
32213119 {
32223120 copy.ClearUI();
32233121 refreshContents(true);
3224
- } /*
3225
- }
3226
-
3227
- public boolean action(Event event, Object arg)
3228
- {
3229
- */ else if (event.getSource() == closeItem)
3122
+ } else if (source == importGFDItem)
3123
+ {
3124
+ ImportGFD();
3125
+ } else
3126
+ if (source == importVRMLX3DItem)
3127
+ {
3128
+ ImportVRMLX3D();
3129
+ } else
3130
+ if (source == import3DSItem)
3131
+ {
3132
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3133
+ } else
3134
+ if (source == importOBJItem)
3135
+ {
3136
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3137
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3138
+ browser.setVisible(true);
3139
+ String filename = browser.getFile();
3140
+ if (filename != null && filename.length() > 0)
3141
+ {
3142
+ String fullname = browser.getDirectory() + filename;
3143
+ makeSomething(ReadOBJ(fullname), true);
3144
+ }
3145
+ } else
3146
+ if (source == closeItem)
32303147 {
32313148 Close();
32323149 //return true;
3233
- } else if (event.getSource() == loadItem)
3150
+ } else if (source == loadItem)
32343151 {
32353152 load();
32363153 //return true;
3237
- } else if (event.getSource() == saveItem)
3154
+ } else if (source == newItem)
3155
+ {
3156
+ New();
3157
+ } else if (source == saveItem)
32383158 {
32393159 save();
32403160 //return true;
3241
- } else if (event.getSource() == saveAsItem)
3161
+ } else if (source == saveAsItem)
32423162 {
32433163 saveAs();
32443164 //return true;
3245
- } else if (event.getSource() == reexportItem)
3165
+ } else if (source == reexportItem)
32463166 {
32473167 reexport();
32483168 //return true;
3249
- } else if (event.getSource() == exportAsItem)
3169
+ } else if (source == exportAsItem)
32503170 {
32513171 export();
32523172 //return true;
3253
- } else if (event.getSource() == povItem)
3173
+ } else if (source == povItem)
32543174 {
32553175 generatePOV();
32563176 //return true;
3257
- } else if (event.getSource() == zBufferItem)
3177
+ } else if (source == zBufferItem)
32583178 {
32593179 try
32603180 {
....@@ -3276,21 +3196,8 @@
32763196 cameraView.repaint();
32773197 //return true;
32783198 }
3279
- */ else if (event.getSource() == editCameraItem)
3280
- {
3281
- cameraView.ProtectCamera();
3282
- cameraView.repaint();
3283
- return;
3284
- } else if (event.getSource() == revertCameraItem)
3285
- {
3286
- cameraView.RevertCamera();
3287
- cameraView.repaint();
3288
- return;
3289
-// } else if (event.getSource() == textureButton)
3290
-// {
3291
-// return; // true;
3292
- } else // combos...
3293
- if (event.getSource() == texresMenu)
3199
+ */ else // combos...
3200
+ if (source == texresMenu)
32943201 {
32953202 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32963203 copy.texres = texresMenu.getSelectedIndex();
....@@ -3302,12 +3209,268 @@
33023209 }
33033210 }
33043211
3212
+ void New()
3213
+ {
3214
+ while (copy.Size() > 1)
3215
+ {
3216
+ copy.remove(1);
3217
+ }
3218
+
3219
+ ResetModel();
3220
+ objEditor.refreshContents();
3221
+ }
3222
+
3223
+ static public byte[] Compress(Object3D o)
3224
+ {
3225
+ try
3226
+ {
3227
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3228
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3229
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3230
+
3231
+ Object3D parent = o.parent;
3232
+ o.parent = null;
3233
+
3234
+ out.writeObject(o);
3235
+
3236
+ o.parent = parent;
3237
+
3238
+ out.flush();
3239
+
3240
+ zstream.close();
3241
+ out.close();
3242
+
3243
+ return baos.toByteArray();
3244
+ } catch (Exception e)
3245
+ {
3246
+ System.err.println(e);
3247
+ return null;
3248
+ }
3249
+ }
3250
+
3251
+ static public Object Uncompress(byte[] bytes)
3252
+ {
3253
+ System.out.println("#bytes = " + bytes.length);
3254
+ try
3255
+ {
3256
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3257
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3258
+ ObjectInputStream in = new ObjectInputStream(istream);
3259
+ Object obj = in.readObject();
3260
+ in.close();
3261
+
3262
+ return obj;
3263
+ } catch (Exception e)
3264
+ {
3265
+ System.err.println(e);
3266
+ return null;
3267
+ }
3268
+ }
3269
+
3270
+ static public Object clone(Object o)
3271
+ {
3272
+ try
3273
+ {
3274
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3275
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3276
+
3277
+ out.writeObject(o);
3278
+
3279
+ out.flush();
3280
+ out.close();
3281
+
3282
+ byte[] bytes = baos.toByteArray();
3283
+
3284
+ System.out.println("clone = " + bytes.length);
3285
+
3286
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3287
+ ObjectInputStream in = new ObjectInputStream(bais);
3288
+ Object obj = in.readObject();
3289
+ in.close();
3290
+
3291
+ return obj;
3292
+ } catch (Exception e)
3293
+ {
3294
+ System.err.println(e);
3295
+ return null;
3296
+ }
3297
+ }
3298
+
3299
+ cRadio GetCurrentTab()
3300
+ {
3301
+ cRadio ab;
3302
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3303
+ {
3304
+ ab = (cRadio)e.nextElement();
3305
+ if(ab.GetObject() == copy)
3306
+ {
3307
+ return ab;
3308
+ }
3309
+ }
3310
+
3311
+ return null;
3312
+ }
3313
+
3314
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3315
+
3316
+ public void Save()
3317
+ {
3318
+ cRadio tab = GetCurrentTab();
3319
+
3320
+ boolean temp = CameraPane.SWITCH;
3321
+ CameraPane.SWITCH = false;
3322
+
3323
+ copy.ExtractBigData(hashtable);
3324
+
3325
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3326
+ tab.graphs[tab.undoindex++] = Compress(copy);
3327
+
3328
+ copy.RestoreBigData(hashtable);
3329
+
3330
+ CameraPane.SWITCH = temp;
3331
+
3332
+ //assert(hashtable.isEmpty());
3333
+
3334
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3335
+ {
3336
+ tab.graphs[i] = null;
3337
+ }
3338
+
3339
+ // test save
3340
+ if (false)
3341
+ {
3342
+ try
3343
+ {
3344
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3345
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3346
+
3347
+ p.writeObject(copy);
3348
+
3349
+ p.flush();
3350
+
3351
+ ostream.close();
3352
+ } catch (Exception e)
3353
+ {
3354
+ e.printStackTrace();
3355
+ }
3356
+ }
3357
+ }
3358
+
3359
+ void CopyChanged(Object3D obj)
3360
+ {
3361
+ boolean temp = CameraPane.SWITCH;
3362
+ CameraPane.SWITCH = false;
3363
+
3364
+ copy.ExtractBigData(hashtable);
3365
+
3366
+ copy.clear();
3367
+
3368
+ for (int i=0; i<obj.Size(); i++)
3369
+ {
3370
+ copy.add(obj.get(i));
3371
+ }
3372
+
3373
+ copy.RestoreBigData(hashtable);
3374
+
3375
+ CameraPane.SWITCH = temp;
3376
+
3377
+ //assert(hashtable.isEmpty());
3378
+
3379
+ copy.Touch();
3380
+
3381
+ ResetModel();
3382
+ copy.HardTouch(); // recompile?
3383
+
3384
+ cRadio ab;
3385
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3386
+ {
3387
+ ab = (cRadio)e.nextElement();
3388
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3389
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3390
+ if (test != null)
3391
+ {
3392
+ test.editWindow = ab.object.editWindow;
3393
+ ab.object = test;
3394
+ }
3395
+ }
3396
+
3397
+ refreshContents();
3398
+ }
3399
+
3400
+ public void Undo()
3401
+ {
3402
+ cRadio tab = GetCurrentTab();
3403
+
3404
+ if (tab.undoindex == 0)
3405
+ {
3406
+ java.awt.Toolkit.getDefaultToolkit().beep();
3407
+ return;
3408
+ }
3409
+
3410
+ if (tab.graphs[tab.undoindex] == null)
3411
+ {
3412
+ Save();
3413
+ tab.undoindex -= 1;
3414
+ }
3415
+
3416
+ tab.undoindex -= 1;
3417
+
3418
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3419
+ }
3420
+
3421
+ public void Redo()
3422
+ {
3423
+ cRadio tab = GetCurrentTab();
3424
+
3425
+ if (tab.graphs[tab.undoindex + 1] == null)
3426
+ {
3427
+ java.awt.Toolkit.getDefaultToolkit().beep();
3428
+ return;
3429
+ }
3430
+
3431
+ tab.undoindex += 1;
3432
+
3433
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3434
+ }
3435
+
3436
+ void ImportGFD()
3437
+ {
3438
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3439
+ browser.show();
3440
+ String filename = browser.getFile();
3441
+ if (filename != null && filename.length() > 0)
3442
+ {
3443
+ String fullname = browser.getDirectory() + filename;
3444
+
3445
+ //Object3D readobj =
3446
+ objEditor.ReadGFD(fullname, objEditor);
3447
+ //makeSomething(readobj);
3448
+ }
3449
+ }
3450
+
3451
+ void ImportVRMLX3D()
3452
+ {
3453
+ if (Grafreed.standAlone)
3454
+ {
3455
+ /**/
3456
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3457
+ browser.show();
3458
+ String filename = browser.getFile();
3459
+ if (filename != null && filename.length() > 0)
3460
+ {
3461
+ String fullname = browser.getDirectory() + filename;
3462
+ LoadVRMLX3D(fullname);
3463
+ }
3464
+ /**/
3465
+ }
3466
+ }
3467
+
33053468 void ToggleAnimation()
33063469 {
33073470 if (!Globals.ANIMATION)
33083471 {
33093472 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3310
- browser.show();
3473
+ browser.setVisible(true);
33113474 String filename = browser.getFile();
33123475 if (filename != null && filename.length() > 0)
33133476 {
....@@ -3317,8 +3480,8 @@
33173480
33183481 Globals.ANIMATION ^= true;
33193482
3320
- GrafreeD.wav.cursor = 0;
3321
- GrafreeD.wav.loop = 0;
3483
+ Grafreed.wav.cursor = 0;
3484
+ Grafreed.wav.loop = 0;
33223485 }
33233486 } else
33243487 {
....@@ -3368,7 +3531,7 @@
33683531 void CreateMaterial()
33693532 {
33703533 //copy.ClearMaterial(); // PATCH
3371
- copy.CreateMaterialS(multiplyToggle.isSelected());
3534
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33723535 if (copy.selection.size() > 0)
33733536 //SetMaterial(copy);
33743537 {
....@@ -3427,11 +3590,11 @@
34273590 {
34283591 copy.ResetBlockLoop(); // temporary problem
34293592
3430
- boolean random = CameraPane.RANDOM;
3431
- CameraPane.RANDOM = false; // parse everything
3593
+ boolean random = CameraPane.SWITCH;
3594
+ CameraPane.SWITCH = false; // parse everything
34323595 copy.ResetDisplayList();
34333596 copy.HardTouch();
3434
- CameraPane.RANDOM = random;
3597
+ CameraPane.SWITCH = random;
34353598 }
34363599
34373600 // public void applySelf()
....@@ -3501,10 +3664,40 @@
35013664 current.fakedepth = (float) fakedepthField.getFloat();
35023665 current.shadowbias = (float) shadowbiasField.getFloat();
35033666
3504
- if (!NumberSlider.frozen)
3667
+ if (!cNumberSlider.frozen)
35053668 {
35063669 //System.out.println("Propagate = " + propagate);
35073670 copy.UpdateMaterial(anchor, current, propagate);
3671
+
3672
+ if (copy.material != null)
3673
+ {
3674
+ cMaterial mat = copy.material;
3675
+
3676
+ colorField.SetToolTipValue((mat.color));
3677
+ modulationField.SetToolTipValue((mat.modulation));
3678
+ metalnessField.SetToolTipValue((mat.metalness));
3679
+ diffuseField.SetToolTipValue((mat.diffuse));
3680
+ specularField.SetToolTipValue((mat.specular));
3681
+ shininessField.SetToolTipValue((mat.shininess));
3682
+ shiftField.SetToolTipValue((mat.shift));
3683
+ ambientField.SetToolTipValue((mat.ambient));
3684
+ lightareaField.SetToolTipValue((mat.lightarea));
3685
+ diffusenessField.SetToolTipValue((mat.factor));
3686
+ velvetField.SetToolTipValue((mat.velvet));
3687
+ sheenField.SetToolTipValue((mat.sheen));
3688
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3689
+ backlitField.SetToolTipValue((mat.bump));
3690
+ anisoField.SetToolTipValue((mat.aniso));
3691
+ anisoVField.SetToolTipValue((mat.anisoV));
3692
+ cameraField.SetToolTipValue((mat.cameralight));
3693
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3694
+ shadowField.SetToolTipValue((mat.shadow));
3695
+ textureField.SetToolTipValue((mat.texture));
3696
+ opacityField.SetToolTipValue((mat.opacity));
3697
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3698
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3699
+ }
3700
+
35083701 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35093702 {
35103703 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3549,6 +3742,7 @@
35493742 || e.getSource() == apertureField
35503743 || e.getSource() == shadowblurField)
35513744 {
3745
+ new Exception().printStackTrace();
35523746 System.exit(0);
35533747 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35543748 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3619,7 +3813,7 @@
36193813 }
36203814
36213815 if (normalpushField != null)
3622
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3816
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36233817 }
36243818
36253819 void SnapObject()
....@@ -3874,7 +4068,7 @@
38744068
38754069 radioPanel.revalidate();
38764070 radioPanel.repaint();
3877
- ctrlPanel.revalidate(); // ? new
4071
+ ctrlPanel.validate(); // ? new
38784072 ctrlPanel.repaint();
38794073 }
38804074 }
....@@ -3883,6 +4077,7 @@
38834077
38844078 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38854079 {
4080
+ Save();
38864081 //Tween.set(thing, 0).target(1).start(tweenManager);
38874082 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38884083 // if (thing instanceof GenericJointDemo)
....@@ -4086,6 +4281,7 @@
40864281 }
40874282 }
40884283 }
4284
+
40894285 LoadGFDThread loadGFDThread;
40904286
40914287 void ReadGFD(String fullname, iCallBack cb)
....@@ -4105,8 +4301,10 @@
41054301
41064302 try
41074303 {
4304
+ // Try compressed version first.
41084305 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4109
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4306
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4307
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41104308
41114309 readobj = (Object3D) p.readObject();
41124310 istream.close();
....@@ -4114,7 +4312,20 @@
41144312 readobj.ResetDisplayList();
41154313 } catch (Exception e)
41164314 {
4117
- e.printStackTrace();
4315
+ //e.printStackTrace();
4316
+ try
4317
+ {
4318
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4319
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4320
+
4321
+ readobj = (Object3D) p.readObject();
4322
+ istream.close();
4323
+
4324
+ readobj.ResetDisplayList();
4325
+ } catch (Exception e2)
4326
+ {
4327
+ e2.printStackTrace();
4328
+ }
41184329 }
41194330 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41204331 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4160,6 +4371,12 @@
41604371
41614372 void LoadIt(Object obj)
41624373 {
4374
+ if (obj == null)
4375
+ {
4376
+ // Invalid file
4377
+ return;
4378
+ }
4379
+
41634380 System.out.println("Loaded " + obj);
41644381 //new Exception().printStackTrace();
41654382 Object3D readobj = (Object3D) obj;
....@@ -4169,6 +4386,7 @@
41694386
41704387 if (readobj != null)
41714388 {
4389
+ Save();
41724390 try
41734391 {
41744392 //readobj.deepCopySelf(copy);
....@@ -4231,7 +4449,7 @@
42314449
42324450 void load() // throws ClassNotFoundException
42334451 {
4234
- if (GrafreeD.standAlone)
4452
+ if (Grafreed.standAlone)
42354453 {
42364454 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42374455 browser.show();
....@@ -4318,11 +4536,13 @@
43184536 try
43194537 {
43204538 FileOutputStream ostream = new FileOutputStream(lastname);
4321
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4539
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4540
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43224541
43234542 p.writeObject(copy);
43244543 p.flush();
43254544
4545
+ zstream.close();
43264546 ostream.close();
43274547
43284548 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4332,11 +4552,12 @@
43324552 {
43334553 }
43344554 }
4555
+
43354556 String lastname;
43364557
43374558 void saveAs()
43384559 {
4339
- if (GrafreeD.standAlone)
4560
+ if (Grafreed.standAlone)
43404561 {
43414562 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43424563 browser.setVisible(true);
....@@ -4441,13 +4662,13 @@
44414662 try
44424663 {
44434664 FileOutputStream ostream = new FileOutputStream(filename);
4444
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4445
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4665
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4666
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44464667
44474668 Object3D objectparent = obj.parent;
44484669 obj.parent = null;
44494670
4450
- Object3D object = (Object3D) GrafreeD.clone(obj);
4671
+ Object3D object = (Object3D) Grafreed.clone(obj);
44514672
44524673 obj.parent = objectparent;
44534674
....@@ -4459,8 +4680,8 @@
44594680 p.writeObject(object);
44604681 p.flush();
44614682
4683
+ zstream.close();
44624684 ostream.close();
4463
- // zstream.close();
44644685
44654686 // group.selection.get(0).parent = parent;
44664687 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4481,7 +4702,7 @@
44814702 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44824703 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44834704 copy.generatePOV(buffer);
4484
- if (GrafreeD.standAlone)
4705
+ if (Grafreed.standAlone)
44854706 {
44864707 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44874708 browser.show();
....@@ -4507,7 +4728,8 @@
45074728 Object3D client;
45084729 Object3D copy;
45094730 MenuBar menuBar;
4510
- Menu windowMenu;
4731
+ Menu fileMenu;
4732
+ MenuItem newItem;
45114733 MenuItem loadItem;
45124734 MenuItem saveItem;
45134735 MenuItem saveAsItem;
....@@ -4515,13 +4737,11 @@
45154737 MenuItem reexportItem;
45164738 MenuItem povItem;
45174739 MenuItem closeItem;
4518
- Menu cameraMenu;
4740
+
45194741 CheckboxMenuItem zBufferItem;
45204742 //MenuItem normalLensItem;
4521
- MenuItem editCameraItem;
4522
- MenuItem revertCameraItem;
4523
- CheckboxMenuItem toggleLiveItem;
45244743 MenuItem stepItem;
4744
+ CheckboxMenuItem toggleLiveItem;
45254745 CheckboxMenuItem toggleFullScreenItem;
45264746 CheckboxMenuItem toggleTimelineItem;
45274747 CheckboxMenuItem toggleRenderItem;
....@@ -4530,7 +4750,7 @@
45304750 CheckboxMenuItem toggleFootContactItem;
45314751 CheckboxMenuItem toggleDLItem;
45324752 CheckboxMenuItem toggleTextureItem;
4533
- CheckboxMenuItem toggleRandomItem;
4753
+ CheckboxMenuItem toggleSwitchItem;
45344754 CheckboxMenuItem toggleRootItem;
45354755 CheckboxMenuItem animationItem;
45364756 CheckboxMenuItem toggleHandleItem;
....@@ -4538,20 +4758,20 @@
45384758 JSplitPane mainPanel;
45394759 JScrollPane scrollpane;
45404760 JPanel toolbarPanel;
4541
- JPanel treePanel;
4761
+ cGridBag treePanel;
45424762 JPanel radioPanel;
45434763 ButtonGroup buttonGroup;
4544
- JPanel ctrlPanel;
4545
- JPanel materialPanel;
4764
+ cGridBag ctrlPanel;
4765
+ cGridBag materialPanel;
45464766 JScrollPane infoPanel;
4547
- JPanel optionsPanel;
4767
+ cGridBag optionsPanel;
45484768 JTabbedPane objectPanel;
4549
- JPanel XYZPanel;
4769
+ cGridBag XYZPanel;
45504770 JSplitPane gridPanel;
45514771 JSplitPane bigPanel;
4552
- JPanel bigThree;
4553
- JTabbedPane scenePanel;
4554
- JPanel centralPanel;
4772
+ cGridBag bigThree;
4773
+ cGridBag scenePanel;
4774
+ cGridBag centralPanel;
45554775 JSplitPane cameraPanel;
45564776 JPanel timelinePanel;
45574777 JMenuBar timelineMenubar;
....@@ -4604,67 +4824,72 @@
46044824 // MATERIAL
46054825 JLabel materialLabel;
46064826 JLabel colorLabel;
4607
- NumberSlider colorField;
4827
+ cNumberSlider colorField;
46084828 JLabel modulationLabel;
4609
- NumberSlider modulationField;
4829
+ cNumberSlider modulationField;
46104830 JLabel metalnessLabel;
4611
- NumberSlider metalnessField;
4831
+ cNumberSlider metalnessField;
46124832 JLabel diffuseLabel;
4613
- NumberSlider diffuseField;
4833
+ cNumberSlider diffuseField;
46144834 JLabel specularLabel;
4615
- NumberSlider specularField;
4835
+ cNumberSlider specularField;
46164836 JLabel shininessLabel;
4617
- NumberSlider shininessField;
4837
+ cNumberSlider shininessField;
46184838 JLabel shiftLabel;
4619
- NumberSlider shiftField;
4839
+ cNumberSlider shiftField;
46204840 JLabel ambientLabel;
4621
- NumberSlider ambientField;
4841
+ cNumberSlider ambientField;
46224842 JLabel lightareaLabel;
4623
- NumberSlider lightareaField;
4843
+ cNumberSlider lightareaField;
46244844 JLabel diffusenessLabel;
4625
- NumberSlider diffusenessField;
4845
+ cNumberSlider diffusenessField;
46264846 JLabel velvetLabel;
4627
- NumberSlider velvetField;
4847
+ cNumberSlider velvetField;
46284848 JLabel sheenLabel;
4629
- NumberSlider sheenField;
4849
+ cNumberSlider sheenField;
46304850 JLabel subsurfaceLabel;
4631
- NumberSlider subsurfaceField;
4851
+ cNumberSlider subsurfaceField;
46324852 //JLabel bumpLabel;
46334853 //NumberSlider bumpField;
46344854 JLabel backlitLabel;
4635
- NumberSlider backlitField;
4855
+ cNumberSlider backlitField;
46364856 JLabel anisoLabel;
4637
- NumberSlider anisoField;
4857
+ cNumberSlider anisoField;
46384858 JLabel anisoVLabel;
4639
- NumberSlider anisoVField;
4859
+ cNumberSlider anisoVField;
46404860 JLabel cameraLabel;
4641
- NumberSlider cameraField;
4861
+ cNumberSlider cameraField;
46424862 JLabel selfshadowLabel;
4643
- NumberSlider selfshadowField;
4863
+ cNumberSlider selfshadowField;
46444864 JLabel shadowLabel;
4645
- NumberSlider shadowField;
4865
+ cNumberSlider shadowField;
46464866 JLabel textureLabel;
4647
- NumberSlider textureField;
4867
+ cNumberSlider textureField;
46484868 JLabel opacityLabel;
4649
- NumberSlider opacityField;
4869
+ cNumberSlider opacityField;
46504870 JLabel fakedepthLabel;
4651
- NumberSlider fakedepthField;
4871
+ cNumberSlider fakedepthField;
46524872 JLabel shadowbiasLabel;
4653
- NumberSlider shadowbiasField;
4873
+ cNumberSlider shadowbiasField;
46544874 JLabel bumpLabel;
4655
- NumberSlider bumpField;
4875
+ cNumberSlider bumpField;
46564876 JLabel noiseLabel;
4657
- NumberSlider noiseField;
4877
+ cNumberSlider noiseField;
46584878 JLabel powerLabel;
4659
- NumberSlider powerField;
4879
+ cNumberSlider powerField;
46604880 JLabel borderfadeLabel;
4661
- NumberSlider borderfadeField;
4881
+ cNumberSlider borderfadeField;
46624882 JLabel fogLabel;
4663
- NumberSlider fogField;
4883
+ cNumberSlider fogField;
46644884 JLabel opacityPowerLabel;
4665
- NumberSlider opacityPowerField;
4885
+ cNumberSlider opacityPowerField;
46664886 JTree jTree;
46674887 //ObjectUI parent;
46684888
4669
- NumberSlider normalpushField;
4889
+ cNumberSlider normalpushField;
4890
+
4891
+ private MenuItem importGFDItem;
4892
+ private MenuItem importVRMLX3DItem;
4893
+ private MenuItem import3DSItem;
4894
+ private MenuItem importOBJItem;
46704895 }