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,
....@@ -31,6 +33,9 @@
3133 boolean timeline;
3234 boolean wasFullScreen;
3335
36
+ GroupEditor callee;
37
+ JFrame frame;
38
+
3439 // SCRIPT
3540
3641 transient JFrame textpanel = null;
....@@ -121,47 +126,54 @@
121126 void keyPressed(int key, int modifiers)
122127 {
123128 System.out.println("KEY PRESSED");
124
- CameraPane.theRenderer.keyPressed(key, modifiers);
129
+ Globals.theRenderer.keyPressed(key, modifiers);
125130 }
126131 */
127132
128133 static GridBagConstraints aConstraints;
129134 static GridBagConstraints aWindowConstraints;
130
- GroupEditor callee;
131
- JFrame frame;
135
+
132136 static int GRIDWIDTH = 100; // 4;
133137
134138 public void closeUI()
135139 {
136140 //new Exception().printStackTrace();
137
- System.out.println("this = " + this);
138
- System.out.println("objEditor = " + objEditor);
141
+// System.out.println("this = " + this);
142
+// System.out.println("objEditor = " + objEditor);
139143 //nameField.removeActionListener(this);
140
- objEditor.ctrlPanel.remove(nameField);
144
+// objEditor.ctrlPanel.remove(nameField);
145
+
146
+ objEditor.ctrlPanel.remove(namePanel);
141147
142148 if (!GroupEditor.allparams)
143149 return;
144150
145
- objEditor.ctrlPanel.remove(liveCB);
146
- objEditor.ctrlPanel.remove(hideCB);
147
- objEditor.ctrlPanel.remove(markCB);
148
-
149
- objEditor.ctrlPanel.remove(randomCB);
150
- objEditor.ctrlPanel.remove(speedupCB);
151
- objEditor.ctrlPanel.remove(rewindCB);
152
-
153
- objEditor.ctrlPanel.remove(resetButton);
154
- objEditor.ctrlPanel.remove(stepButton);
155
-// objEditor.ctrlPanel.remove(stepAllButton);
156
-// objEditor.ctrlPanel.remove(resetAllButton);
157
- objEditor.ctrlPanel.remove(link2masterCB);
158
- //objEditor.ctrlPanel.remove(flipVCB);
159
- //objEditor.ctrlPanel.remove(texresMenu);
160
- objEditor.ctrlPanel.remove(slowerButton);
161
- objEditor.ctrlPanel.remove(fasterButton);
162
- 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);
163169
164
- 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);
165177 }
166178
167179 public ObjEditor GetEditor()
....@@ -265,24 +277,40 @@
265277 void SetupMenu()
266278 {
267279 frame.setMenuBar(menuBar = new MenuBar());
268
- menuBar.add(windowMenu = new Menu("File"));
269
- windowMenu.add(loadItem = new MenuItem("Load..."));
270
- windowMenu.add("-");
271
- windowMenu.add(saveItem = new MenuItem("Save"));
272
- 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..."));
273300 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
274
- windowMenu.add("-");
275
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
276
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
277
- windowMenu.add("-");
301
+ fileMenu.add("-");
302
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
303
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
304
+ fileMenu.add("-");
278305 if (client.parent != null)
279306 {
280
- windowMenu.add(closeItem = new MenuItem("Close"));
307
+ fileMenu.add(closeItem = new MenuItem("Close"));
281308 } else
282309 {
283
- windowMenu.add(closeItem = new MenuItem("Exit"));
310
+ fileMenu.add(closeItem = new MenuItem("Exit"));
284311 }
285312
313
+ newItem.addActionListener(this);
286314 loadItem.addActionListener(this);
287315 saveItem.addActionListener(this);
288316 saveAsItem.addActionListener(this);
....@@ -291,79 +319,26 @@
291319 //povItem.addActionListener(this);
292320 closeItem.addActionListener(this);
293321
294
- menuBar.add(cameraMenu = new Menu("View"));
295
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
296
- //zBufferItem.addActionListener(this);
297
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
298
- //normalLensItem.addActionListener(this);
299
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
300
- revertCameraItem.addActionListener(this);
301
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
302
- toggleTimelineItem.addItemListener(this);
303
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
304
- toggleFullScreenItem.addItemListener(this);
305
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
306
- cameraMenu.add("-");
307
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
308
- toggleTextureItem.addItemListener(this);
309
- toggleTextureItem.setState(CameraPane.textureon);
310
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
311
- toggleLiveItem.addItemListener(this);
312
- toggleLiveItem.setState(CameraPane.isLIVE());
313
- cameraMenu.add(stepItem = new MenuItem("Step"));
314
- stepItem.addActionListener(this);
315
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
316
-// toggleDLItem.addItemListener(this);
317
-// toggleDLItem.setState(false);
318
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
319
- toggleRenderItem.addItemListener(this);
320
- toggleRenderItem.setState(!CameraPane.frozen);
321
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
322
- toggleDebugItem.addItemListener(this);
323
- toggleDebugItem.setState(CameraPane.DEBUG);
324
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
325
- toggleFrustumItem.addItemListener(this);
326
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
327
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
328
- toggleFootContactItem.addItemListener(this);
329
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
330
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
331
- toggleRandomItem.addItemListener(this);
332
- toggleRandomItem.setState(CameraPane.RANDOM);
333
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
334
- toggleHandleItem.addItemListener(this);
335
- toggleHandleItem.setState(CameraPane.HANDLES);
336
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
337
- togglePaintItem.addItemListener(this);
338
- togglePaintItem.setState(CameraPane.PAINTMODE);
339
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
340
-// toggleRootItem.addItemListener(this);
341
-// toggleRootItem.setState(false);
342
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
343
-// animationItem.addItemListener(this);
344
-// animationItem.setState(CameraPane.ANIMATION);
345
- cameraMenu.add("-");
346
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
347
- editCameraItem.addActionListener(this);
348
-
349322 objectPanel = new JTabbedPane();
350323 toolbarPanel = new JPanel();
351324 toolbarPanel.setName("Toolbar");
352
- treePanel = new JPanel();
325
+ treePanel = new cGridBag();
353326 treePanel.setName("Tree");
354
- ctrlPanel = new JPanel(); // new GridBagLayout());
327
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
355328 ctrlPanel.setName("Edit");
356
- materialPanel = new JPanel();
329
+ materialPanel = new cGridBag().setVertical(true);
357330 materialPanel.setName("Material");
358331 /*JTextPane*/
359332 infoarea = createTextPane();
333
+ doc = infoarea.getStyledDocument();
334
+
360335 infoarea.setEditable(true);
361336 SetText();
362337 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
363338 // infoarea.setOpaque(false);
364339 // //infoarea.setForeground(textcolor);
365
- infoarea.setLineWrap(true);
366
- infoarea.setWrapStyleWord(true);
340
+// TEXTAREA infoarea.setLineWrap(true);
341
+// TEXTAREA infoarea.setWrapStyleWord(true);
367342 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
368343 infoPanel.setPreferredSize(new Dimension(50, 200));
369344 infoPanel.setName("Info");
....@@ -374,16 +349,16 @@
374349 mainPanel.setName("Main");
375350 mainPanel.setContinuousLayout(true);
376351 mainPanel.setOneTouchExpandable(true);
377
- mainPanel.setDividerLocation(1.0);
378352 mainPanel.setDividerSize(9);
379
- mainPanel.setResizeWeight(0);
353
+ mainPanel.setDividerLocation(0.5); //1.0);
354
+ mainPanel.setResizeWeight(0.5);
380355
381356 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
382357 //mainPanel.setLayout(new GridBagLayout());
383358 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
384
- treePanel.setLayout(new GridBagLayout());
385
- ctrlPanel.setLayout(new GridBagLayout());
386
- materialPanel.setLayout(new GridBagLayout());
359
+// treePanel.setLayout(new GridBagLayout());
360
+ //ctrlPanel.setLayout(new GridBagLayout());
361
+ //materialPanel.setLayout(new GridBagLayout());
387362
388363 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
389364 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -422,7 +397,7 @@
422397 static String newline = "\n";
423398 protected static final String buttonString = "JButton";
424399 StyledDocument doc;
425
- JTextArea infoarea;
400
+ JTextPane infoarea;
426401
427402 void ClearInfo()
428403 {
....@@ -445,10 +420,10 @@
445420 e.printStackTrace();
446421 }
447422
448
- String selection = infoarea.getText();
449
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
450
- java.awt.datatransfer.Clipboard clipboard =
451
- 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();
452427 //clipboard.setContents(data, data);
453428 }
454429
....@@ -471,13 +446,13 @@
471446 //SendInfo("Name:", "bold");
472447 if (sel.GetTextures() != null || debug)
473448 {
474
- si.SendInfo(sel.toString(), "bold");
449
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
475450 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
476451 if (sel.Size() > 0)
477452 {
478453 si.SendInfo("#children = " + sel.Size(), "regular");
479454 }
480
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
455
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
481456 if (debug)
482457 {
483458 try
....@@ -489,7 +464,10 @@
489464 }
490465
491466 if (full)
492
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
467
+ {
468
+ si.SendInfo(" BBox min: " + minima, "regular");
469
+ si.SendInfo(" BBox max: " + maxima, "regular");
470
+ }
493471
494472 if (sel.bRep != null)
495473 {
....@@ -516,7 +494,7 @@
516494 }
517495 if (sel.support != null)
518496 {
519
- si.SendInfo(" support: " + sel.support, "regular");
497
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
520498 }
521499 if (sel.scriptnode != null)
522500 {
....@@ -587,6 +565,9 @@
587565 {
588566 CameraPane.pointflow = (PointFlow) sel;
589567 }
568
+
569
+ si.SendInfo("_____________________", "regular");
570
+ si.SendInfo("", "regular");
590571 }
591572 }
592573
....@@ -618,52 +599,52 @@
618599 cameraView.ToggleFullScreen();
619600 }
620601
621
- private JTextArea createTextPane()
602
+ private JTextPane createTextPane()
622603 {
623
- String[] initString =
624
- {
625
- "This is an editable JTextPane, ", //regular
626
- "another ", //italic
627
- "styled ", //bold
628
- "text ", //small
629
- "component, ", //large
630
- "which supports embedded components..." + newline,//regular
631
- " " + newline, //button
632
- "...and embedded icons..." + newline, //regular
633
- " ", //icon
634
- newline + "JTextPane is a subclass of JEditorPane that "
635
- + "uses a StyledEditorKit and StyledDocument, and provides "
636
- + "cover methods for interacting with those objects."
637
- };
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
+// }
638646
639
- String[] initStyles =
640
- {
641
- "regular", "italic", "bold", "small", "large",
642
- "regular", "button", "regular", "icon",
643
- "regular"
644
- };
645
-
646
- JTextPane textPane = new JTextPane();
647
- textPane.setEditable(true);
648
- /*StyledDocument*/ doc = textPane.getStyledDocument();
649
- addStylesToDocument(doc);
650
-
651
- try
652
- {
653
- for (int j = 0; j < 2; j++)
654
- {
655
- for (int i = 0; i < initString.length; i++)
656
- {
657
- doc.insertString(doc.getLength(), initString[i],
658
- doc.getStyle(initStyles[i]));
659
- }
660
- }
661
- } catch (BadLocationException ble)
662
- {
663
- System.err.println("Couldn't insert initial text into text pane.");
664
- }
665
-
666
- return new JTextArea(); // textPane;
647
+ return new JTextPane(); // textPane;
667648 }
668649
669650 protected void addStylesToDocument(StyledDocument doc)
....@@ -716,7 +697,7 @@
716697 protected static ImageIcon createImageIcon(String path,
717698 String description)
718699 {
719
- java.net.URL imgURL = GrafreeD.class.getResource(path);
700
+ java.net.URL imgURL = Grafreed.class.getResource(path);
720701 if (imgURL != null)
721702 {
722703 return new ImageIcon(imgURL, description);
....@@ -748,6 +729,7 @@
748729 // NumberSlider vDivsField;
749730 // JCheckBox endcaps;
750731 JCheckBox liveCB;
732
+ JCheckBox selectCB;
751733 JCheckBox hideCB;
752734 JCheckBox link2masterCB;
753735 JCheckBox markCB;
....@@ -763,115 +745,84 @@
763745 JButton slowerButton;
764746 JButton fasterButton;
765747 JButton remarkButton;
748
+
749
+ cGridBag namePanel;
750
+ cGridBag setupPanel;
751
+ cGridBag setupPanel2;
752
+ cGridBag commandsPanel;
753
+ cGridBag pushPanel;
754
+ cGridBag fillPanel;
766755
767
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
756
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
768757 {
769758 JCheckBox cb;
770759
771
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
772
- oe.aConstraints.gridwidth = 1; // 3;
773
-// oe.aConstraints.weightx = 1;
774
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
775
- 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);
776761 cb.addItemListener(this);
777
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
778
- oe.aConstraints.gridwidth = 1;
779
- oe.aConstraints.gridx += 1;
780762
781763 return cb;
782764 }
783765
784
- cButton AddButton(ObjEditor oe, String label)
766
+ cButton AddButton(cGridBag panel, String label)
785767 {
786768 cButton cb;
787769
788
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
789
- oe.aConstraints.gridwidth = 1;
790
-// oe.aConstraints.weightx = 1;
791
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
792
- 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);
793771 cb.addActionListener(this);
794
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
795
- oe.aConstraints.gridwidth = 1;
796
- oe.aConstraints.gridx += 1;
797772
798773 return cb;
799774 }
800775
801
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
776
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
802777 {
803778 JComboBox combo;
804779
805
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
806
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
807
- oe.aConstraints.gridx += 1;
780
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
808781 combo.addActionListener(this);
809782
810783 return combo;
811784 }
812785
813
- 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)
814787 {
815
- NumberSlider combo;
788
+ cGridBag control = new cGridBag();
789
+
790
+ cNumberSlider combo;
816791
817792 JLabel jlabel = new JLabel(label);
818
-
819
- aConstraints.fill = GridBagConstraints.VERTICAL;
820793 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
821
- aConstraints.gridwidth = 1;
822
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
823
- aConstraints.gridx += 1;
824
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
825
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
826
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.gridwidth = 1;
829
-
794
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
795
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
830796 combo.setFloat(current);
831
-
832
- combo.label = jlabel;
833
-
834
- combo.addChangeListener(this);
835
-
836
- return combo;
797
+
798
+ panel.add(control);
799
+
800
+ return control;
837801 }
838802
839
- 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)
840804 {
841
- NumberSlider combo;
805
+ cGridBag control = new cGridBag();
806
+
807
+ cNumberSlider combo;
842808
843809 JLabel jlabel = new JLabel(label);
844
-
845
- aConstraints.fill = GridBagConstraints.VERTICAL;
846810 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
847
- aConstraints.gridwidth = 2;
848
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
849
- aConstraints.gridx += 1;
850
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
851
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
852
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.gridwidth = 1;
855
-
811
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
856813 combo.setInteger(current);
857814
858
- combo.label = jlabel;
859
-
860
- combo.addChangeListener(this);
861
-
862
- return combo;
815
+ panel.add(control);
816
+
817
+ return control;
863818 }
864819
865
- JTextArea AddText(JPanel ctrlPanel, String name)
820
+ JTextArea AddText(cGridBag ctrlPanel, String name)
866821 {
867822 JTextArea text;
868823
869
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
870
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
871
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
824
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
872825 text.addCaretListener(this);
873
- aConstraints.gridx += 1;
874
- aConstraints.gridwidth = 1;
875826
876827 return text;
877828 }
....@@ -901,9 +852,16 @@
901852 objEditor.ctrlPanel.remove(j);
902853 }
903854
855
+ void Remove(cNumberSlider j)
856
+ {
857
+ j.removeChangeListener(this);
858
+ //objEditor.ctrlPanel.remove(j.label);
859
+ objEditor.ctrlPanel.remove(j);
860
+ }
861
+
904862 /*
905863 */
906
- void Return() // ObjEditor oe)
864
+ void Return0() // ObjEditor oe)
907865 {
908866 aConstraints.gridy += 1;
909867 aConstraints.gridx = 0;
....@@ -958,37 +916,76 @@
958916
959917 void SetupUI2(ObjEditor oe)
960918 {
961
-// oe.aConstraints.weightx = 0;
962
-// oe.aConstraints.weighty = 0;
963
-// oe.aConstraints.gridx = 0;
964
-// oe.aConstraints.gridy = 0;
965
- 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();
966928
967929 if (!GroupEditor.allparams)
968930 return;
969931
970
- liveCB = AddCheckBox(oe, "Live", copy.live);
971
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
972
- 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");
973938 // Return();
974
- markCB = AddCheckBox(oe, "Mark", copy.marked);
975
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
976
- randomCB = AddCheckBox(oe, "Rand", copy.random);
977
- Return();
978
- resetButton = AddButton(oe, "Reset");
979
- 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");
980971 // resetAllButton = AddButton(oe, "Reset All");
981972 // stepAllButton = AddButton(oe, "Step All");
982
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
983973 // Return();
984
- slowerButton = AddButton(oe, "Slow");
985
- fasterButton = AddButton(oe, "Fast");
986
- 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");
987980
988
- Return();
981
+ oe.ctrlPanel.add(commandsPanel);
982
+ oe.ctrlPanel.Return();
989983
990
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
991
- 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();
992989
993990 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
994991 // ObjEditor.aConstraints.gridx += 1;
....@@ -1083,7 +1080,7 @@
10831080 oe.aConstraints.gridwidth = 1;
10841081 /**/
10851082 nameField = AddText(oe.ctrlPanel, copy.GetName());
1086
- Return();
1083
+ oe.ctrlPanel.Return();
10871084
10881085 //ctrlPanel.add(textureButton = new Button("Texture..."));
10891086 //textureButton.setEnabled(false);
....@@ -1185,10 +1182,18 @@
11851182 //JPanel worldPanel =
11861183 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11871184 //worldPanel.setName("World");
1188
- centralPanel = new JPanel(new BorderLayout());
1185
+ centralPanel = new cGridBag();
1186
+ centralPanel.preferredWidth = 20;
11891187 timelinePanel = new JPanel(new BorderLayout());
11901188 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11911189
1190
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1191
+ cameraPanel.setContinuousLayout(true);
1192
+ cameraPanel.setOneTouchExpandable(true);
1193
+// cameraPanel.setDividerLocation(0.9);
1194
+// cameraPanel.setDividerSize(9);
1195
+ cameraPanel.setResizeWeight(1.0);
1196
+
11921197 centralPanel.add(cameraView);
11931198 //frame.setJMenuBar(timelineMenubar);
11941199 //centralPanel.add(timelinePanel);
....@@ -1208,12 +1213,13 @@
12081213 //frontView.object = copy;
12091214 //sideView.object = copy;
12101215
1211
- XYZPanel = new JPanel();
1212
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1216
+ XYZPanel = new cGridBag().setVertical(true);
1217
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12131218
1214
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1215
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1216
- 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);
12171223
12181224 /*
12191225 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1251,10 +1257,11 @@
12511257 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12521258 //tmp.setName("Edit");
12531259 objectPanel.add(materialPanel);
1254
- JPanel north = new JPanel(new BorderLayout());
1255
- north.setName("Edit");
1256
- north.add(ctrlPanel, BorderLayout.NORTH);
1257
- 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);
12581265 objectPanel.add(infoPanel);
12591266
12601267 /*
....@@ -1275,16 +1282,23 @@
12751282 scrollpane.setWheelScrollingEnabled(true);
12761283 scrollpane.addMouseWheelListener(this); // Default not fast enough
12771284
1278
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1279
- scenePanel.add(scrollpane);
1285
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1286
+ scenePanel.preferredWidth = 6;
1287
+
1288
+ JTabbedPane tabbedPane = new JTabbedPane();
1289
+ tabbedPane.add(scrollpane);
12801290
1281
- scenePanel.add(FSPane = new cFileSystemPane(this));
1291
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12821292
1283
- optionsPanel = new JPanel(new GridBagLayout());
1293
+ optionsPanel = new cGridBag().setVertical(true);
12841294
12851295 optionsPanel.setName("Options");
1286
- scenePanel.add(optionsPanel);
1287
-
1296
+
1297
+ AddOptions(optionsPanel); //, aConstraints);
1298
+
1299
+ tabbedPane.add(optionsPanel);
1300
+
1301
+ scenePanel.add(tabbedPane);
12881302
12891303 /*
12901304 cTree jTree = new cTree(null);
....@@ -1318,6 +1332,7 @@
13181332 //bigPanel.setSize(new Dimension(10,10));
13191333 //bigPanel.add(ctrlPanel);
13201334 //bigPanel.add(gridPanel);
1335
+ /**
13211336 bigThree = new JPanel();
13221337 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13231338 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1341,7 +1356,13 @@
13411356 // aConstraints.gridheight = 3;
13421357 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13431358 bigThree.add(XYZPanel, aWindowConstraints);
1359
+ /**/
13441360
1361
+ bigThree = new cGridBag();
1362
+ bigThree.addComponent(scenePanel);
1363
+ bigThree.addComponent(centralPanel);
1364
+ bigThree.addComponent(XYZPanel);
1365
+
13451366 // // SIDE EFFECT!!!
13461367 // aConstraints.gridx = 0;
13471368 // aConstraints.gridy = 0;
....@@ -1362,13 +1383,14 @@
13621383 //worldPane.add(bigPanel);
13631384 //worldPane.add(worldPanel);
13641385 /**/
1365
- frame.getContentPane().add(/*"Center",*/framePanel);
1386
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1387
+ frame.add(/*"Center",*/framePanel);
13661388 //frame.getContentPane().add(/*"Center",*/ worldPane);
13671389
13681390 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13691391
1370
- frame.setSize(1024, 768);
1371
- frame.show();
1392
+ frame.setSize(1280, 860);
1393
+ frame.setVisible(true);
13721394
13731395 gridPanel.setDividerLocation(1.0);
13741396
....@@ -1383,6 +1405,10 @@
13831405 });
13841406 }
13851407
1408
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1409
+ {
1410
+ }
1411
+
13861412 JTree GetTree()
13871413 {
13881414 return objEditor.jTree;
....@@ -1394,260 +1420,173 @@
13941420 ctrlPanel.removeAll();
13951421 }
13961422
1397
- void SetupMaterial(JPanel ctrlPanel)
1423
+ void SetupMaterial(cGridBag panel)
13981424 {
1399
- aConstraints.weighty = 0;
1400
- //aConstraints.weightx = 1;
1401
- /*
1425
+ /*
14021426 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14031427 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1404
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1405
- aConstraints.gridx += 1;
14061428 */
14071429
1408
- aConstraints.gridwidth = 1;
1409
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1410
- aConstraints.gridx += 1;
1411
- aConstraints.weighty = 0;
1412
- 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");
14131434
14141435 /*
14151436 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1416
- aConstraints.gridx += 1;
1417
- aConstraints.weighty = 0;
1418
- aConstraints.gridwidth = 1;
14191437 */
14201438
1421
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1422
- 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
+ }
14231448
1424
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1425
-
1426
- aConstraints.gridx += 1;
1427
-
1428
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1429
-
1430
- aConstraints.gridx += 1;
1431
-
1432
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1433
-
1434
- aConstraints.gridx = 0;
1435
- aConstraints.gridy += 1;
1436
- aConstraints.weighty = 0;
1437
- aConstraints.gridwidth = 1;
1449
+ editBar.preferredHeight = 15;
1450
+
1451
+ panel.add(editBar);
1452
+
14381453 /**/
14391454 //aConstraints.weighty = 0;
14401455 ////aConstraints.weightx = 1;
14411456 //aConstraints.weighty = 1;
14421457 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14431458 //aConstraints.gridx += 1;
1444
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1445
- aConstraints.weighty = 0;
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
1459
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14491460
1450
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1451
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- //aConstraints.weightx = 0;
1456
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1457
- aConstraints.gridx = 0;
1458
- aConstraints.gridy += 1;
1459
- 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);
14601469
1461
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1462
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1463
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1464
- aConstraints.gridx += 1;
1465
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1466
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1467
- aConstraints.gridx = 0;
1468
- aConstraints.gridy += 1;
1469
- 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);
14701475
1471
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1472
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1474
- aConstraints.gridx += 1;
1475
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1476
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1477
- aConstraints.gridx = 0;
1478
- aConstraints.gridy += 1;
1479
- 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);
14801481
1481
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1482
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1483
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1484
- aConstraints.gridx += 1;
1485
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1486
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1487
- aConstraints.gridx = 0;
1488
- aConstraints.gridy += 1;
1489
- 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);
14901487
1491
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1492
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1493
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1494
- aConstraints.gridx += 1;
1495
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1496
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1497
- aConstraints.gridx = 0;
1498
- aConstraints.gridy += 1;
1499
- 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);
15001493
1501
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1502
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1503
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1504
- aConstraints.gridx += 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1506
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1507
- aConstraints.gridx = 0;
1508
- aConstraints.gridy += 1;
1509
- 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);
15101499
1511
- //aConstraints.weighty = 1;
1512
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1513
- //aConstraints.gridx += 1;
1514
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1515
- aConstraints.weighty = 0;
1516
- aConstraints.gridx = 0;
1517
- aConstraints.gridy += 1;
1518
- 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);
15191513
1520
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1521
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1522
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1523
- aConstraints.gridx += 1;
1524
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1525
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1526
- aConstraints.gridx = 0;
1527
- aConstraints.gridy += 1;
1528
- 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);
15291519
1530
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1531
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1532
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1533
- aConstraints.gridx += 1;
1534
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1535
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1536
- aConstraints.gridx = 0;
1537
- aConstraints.gridy += 1;
1538
- 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);
15391525
1540
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1541
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1542
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1543
- aConstraints.gridx += 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1545
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1546
- aConstraints.gridx = 0;
1547
- aConstraints.gridy += 1;
1548
- 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);
15491531
1550
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1551
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1552
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1553
- aConstraints.gridx += 1;
1554
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1555
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1556
- aConstraints.gridx = 0;
1557
- aConstraints.gridy += 1;
1558
- 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);
15591537
1560
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1561
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1562
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1563
- aConstraints.gridx += 1;
1564
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1565
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1566
- aConstraints.gridx = 0;
1567
- aConstraints.gridy += 1;
1568
- 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);
15691543
1570
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1571
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1573
- aConstraints.gridx += 1;
1574
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1575
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1576
- aConstraints.gridx = 0;
1577
- aConstraints.gridy += 1;
1578
- 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);
15791549
1580
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1581
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1582
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1583
- aConstraints.gridx += 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1585
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1586
- aConstraints.gridx = 0;
1587
- aConstraints.gridy += 1;
1588
- 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);
15891557
1590
- //aConstraints.weighty = 1;
1591
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1592
- //aConstraints.gridx += 1;
1593
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1594
- aConstraints.weighty = 0;
1595
- aConstraints.gridx = 0;
1596
- aConstraints.gridy += 1;
1597
- 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);
15981563
1599
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1600
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1601
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1602
- aConstraints.gridx += 1;
1603
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1604
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1605
- aConstraints.gridx = 0;
1606
- aConstraints.gridy += 1;
1607
- 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);
16081569
1609
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1610
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1611
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1612
- aConstraints.gridx += 1;
1613
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1614
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1615
- aConstraints.gridx = 0;
1616
- aConstraints.gridy += 1;
1617
- 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);
16181575
1619
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1620
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1621
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1622
- aConstraints.gridx += 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1624
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1625
- aConstraints.gridx = 0;
1626
- aConstraints.gridy += 1;
1627
- 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);
16281581
1629
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1630
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1632
- aConstraints.gridx += 1;
1633
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1634
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- 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);
16381587
1639
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1640
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1648
-
1649
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1650
- Return();
1588
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1589
+ //Return();
16511590 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16521591 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16531592 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1658,130 +1597,93 @@
16581597 // aConstraints.gridy += 1;
16591598 // aConstraints.gridwidth = 1;
16601599
1661
- //aConstraints.weighty = 1;
1662
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1663
- //aConstraints.gridx += 1;
1664
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1665
- aConstraints.weighty = 0;
1666
- aConstraints.gridx = 0;
1667
- aConstraints.gridy += 1;
1668
- aConstraints.gridwidth = 1;
16691600
1670
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1671
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1673
- aConstraints.gridx += 1;
1674
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1675
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1676
- aConstraints.gridx = 0;
1677
- aConstraints.gridy += 1;
1678
- 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);
16791608
1680
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1681
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- 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);
16891614
1690
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1691
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- 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);
16991620
1700
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1701
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1709
- 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);
17101626
1711
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1712
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1713
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1714
- aConstraints.gridx += 1;
1715
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1716
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1717
- aConstraints.gridx = 0;
1718
- aConstraints.gridy += 1;
1719
- 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);
17201632
1721
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1722
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1724
- aConstraints.gridx += 1;
1725
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1726
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1727
- aConstraints.gridx = 0;
1728
- aConstraints.gridy += 1;
1729
- 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);
17301640
1731
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1732
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1733
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1734
- aConstraints.gridx += 1;
1735
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1736
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1737
- aConstraints.gridx = 0;
1738
- aConstraints.gridy += 1;
1739
- 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);
17401646
1741
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1742
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1744
- aConstraints.gridx += 1;
1745
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1746
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1747
- aConstraints.gridx = 0;
1748
- aConstraints.gridy += 1;
1749
- 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);
17501652
1751
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1752
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1754
- aConstraints.gridx += 1;
1755
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1756
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1757
- aConstraints.gridx = 0;
1758
- aConstraints.gridy += 1;
1759
- 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);
17601658
1761
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1762
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1763
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1764
- aConstraints.gridx += 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1766
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1767
- aConstraints.gridx = 0;
1768
- aConstraints.gridy += 1;
1769
- 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);
17701664
1771
- //aConstraints.weighty = 1;
1772
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1773
- //aConstraints.gridx += 1;
1774
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1775
- 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);
17761670
1777
- aConstraints.gridx = 0;
1778
- aConstraints.gridy = 0;
1779
- 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);
17801682
17811683 SetMaterial(copy); // .GetMaterial());
17821684
1783
- colorField.addChangeListener(this);
1784
- modulationField.addChangeListener(this);
1685
+ //colorField.addChangeListener(this);
1686
+// modulationField.addChangeListener(this);
17851687 metalnessField.addChangeListener(this);
17861688 diffuseField.addChangeListener(this);
17871689 specularField.addChangeListener(this);
....@@ -1811,12 +1713,15 @@
18111713 opacityPowerField.addChangeListener(this);
18121714 /**/
18131715
1814
- resetSlidersButton.addActionListener(this);
18151716 clearMaterialButton.addActionListener(this);
18161717 createMaterialButton.addActionListener(this);
1817
-
1818
- propagateToggle.addItemListener(this);
1819
- multiplyToggle.addItemListener(this);
1718
+
1719
+ if (Globals.ADVANCED)
1720
+ {
1721
+ resetSlidersButton.addActionListener(this);
1722
+ propagateToggle.addItemListener(this);
1723
+ multiplyToggle.addItemListener(this);
1724
+ }
18201725 }
18211726
18221727 void DropFile(java.io.File[] files, boolean textures)
....@@ -1987,7 +1892,7 @@
19871892
19881893 //? flashIt = false;
19891894 CameraPane pane = (CameraPane) cameraView;
1990
- pane.clickStart(location.x, location.y, 0);
1895
+ pane.clickStart(location.x, location.y, 0, 0);
19911896 pane.clickEnd(location.x, location.y, 0, true);
19921897
19931898 if (group.selection.size() == 1)
....@@ -2036,6 +1941,7 @@
20361941 e2.printStackTrace();
20371942 }
20381943 }
1944
+
20391945 LoadJMEThread loadThread;
20401946
20411947 class LoadJMEThread extends Thread
....@@ -2093,6 +1999,7 @@
20931999 //LoadFile0(filename, converter);
20942000 }
20952001 }
2002
+
20962003 LoadOBJThread loadObjThread;
20972004
20982005 class LoadOBJThread extends Thread
....@@ -2171,19 +2078,19 @@
21712078
21722079 void LoadObjFile(String fullname)
21732080 {
2174
- /*
2081
+ System.out.println("Loading " + fullname);
2082
+ /**/
21752083 //lastFilename = fullname;
21762084 if(loadObjThread == null)
21772085 {
2178
- loadObjThread = new LoadOBJThread();
2179
- loadObjThread.start();
2086
+ loadObjThread = new LoadOBJThread();
2087
+ loadObjThread.start();
21802088 }
21812089
21822090 loadObjThread.add(fullname);
2183
- */
2091
+ /**/
21842092
2185
- System.out.println("Loading " + fullname);
2186
- makeSomething(new FileObject(fullname, true), true);
2093
+ //makeSomething(new FileObject(fullname, true), true);
21872094 }
21882095
21892096 void LoadGFDFile(String fullname)
....@@ -2444,11 +2351,11 @@
24442351
24452352 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24462353 {
2447
- if (GrafreeD.standAlone)
2354
+ if (Grafreed.standAlone)
24482355 {
24492356 /**/
24502357 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2451
- browser.show();
2358
+ browser.setVisible(true);
24522359 String filename = browser.getFile();
24532360 if (filename != null && filename.length() > 0)
24542361 {
....@@ -2593,6 +2500,7 @@
25932500 }
25942501 if (input == null)
25952502 {
2503
+ new Exception().printStackTrace();
25962504 System.exit(0);
25972505 }
25982506
....@@ -2807,7 +2715,8 @@
28072715 return;
28082716 }
28092717
2810
- multiplyToggle.setSelected(mat.multiply);
2718
+ if (multiplyToggle != null)
2719
+ multiplyToggle.setSelected(mat.multiply);
28112720
28122721 assert (object.projectedVertices != null);
28132722
....@@ -2996,7 +2905,8 @@
29962905 if (timeline)
29972906 {
29982907 centralPanel.remove(cameraView);
2999
- centralPanel.add(timelinePanel);
2908
+ cameraPanel.add(cameraView);
2909
+ centralPanel.add(cameraPanel);
30002910 frame.setJMenuBar(timelineMenubar);
30012911 wasFullScreen = CameraPane.FULLSCREEN;
30022912 if (!CameraPane.FULLSCREEN)
....@@ -3005,7 +2915,7 @@
30052915 }
30062916 else
30072917 {
3008
- centralPanel.remove(timelinePanel);
2918
+ centralPanel.remove(cameraPanel);
30092919 centralPanel.add(cameraView);
30102920 frame.setJMenuBar(null);
30112921 if (!wasFullScreen)
....@@ -3021,9 +2931,9 @@
30212931 frame.validate();
30222932
30232933 return;
3024
- } else if (event.getSource() == toggleRandomItem)
2934
+ } else if (event.getSource() == toggleSwitchItem)
30252935 {
3026
- cameraView.ToggleRandom();
2936
+ cameraView.ToggleSwitch();
30272937 cameraView.repaint();
30282938 return;
30292939 } else if (event.getSource() == toggleHandleItem)
....@@ -3052,6 +2962,10 @@
30522962 {
30532963 copy.live ^= true;
30542964 return;
2965
+ } else if (event.getSource() == selectCB)
2966
+ {
2967
+ copy.dontselect ^= true;
2968
+ return;
30552969 } else if (event.getSource() == hideCB)
30562970 {
30572971 copy.hide ^= true;
....@@ -3066,6 +2980,7 @@
30662980 if (event.getSource() == randomCB)
30672981 {
30682982 copy.random ^= true;
2983
+ objEditor.refreshContents();
30692984 return;
30702985 }
30712986 if (event.getSource() == speedupCB)
....@@ -3089,8 +3004,9 @@
30893004
30903005 public void actionPerformed(ActionEvent event)
30913006 {
3007
+ Object source = event.getSource();
30923008 // SCRIPT DIALOG
3093
- if (event.getSource() == okbutton)
3009
+ if (source == okbutton)
30943010 {
30953011 textpanel.setVisible(false);
30963012 textpanel.remove(textarea);
....@@ -3102,7 +3018,7 @@
31023018 textarea = null;
31033019 textpanel = null;
31043020 }
3105
- if (event.getSource() == cancelbutton)
3021
+ if (source == cancelbutton)
31063022 {
31073023 textpanel.setVisible(false);
31083024 textpanel.remove(textarea);
....@@ -3114,49 +3030,50 @@
31143030 //applySelf();
31153031 //client.refreshEditWindow();
31163032 //refreshContents();
3117
- if (event.getSource() == nameField)
3033
+ if (source == nameField)
31183034 {
31193035 //System.out.println("ObjEditor " + event);
31203036 applySelf0(true);
31213037 //parent.applySelf();
31223038 objEditor.refreshContents();
3123
- } else if (event.getSource() == resetButton)
3039
+ } else if (source == resetButton)
31243040 {
31253041 CameraPane.fullreset = true;
31263042 copy.Reset(); // ResetMeshes();
31273043 copy.Touch();
31283044 objEditor.refreshContents();
3129
- } else if (event.getSource() == stepItem)
3045
+ } else if (source == stepItem)
31303046 {
3131
- cameraView.ONESTEP = true;
3047
+ //cameraView.ONESTEP = true;
3048
+ Globals.ONESTEP = true;
31323049 cameraView.repaint();
31333050 return;
3134
- } else if (event.getSource() == stepButton)
3051
+ } else if (source == stepButton)
31353052 {
31363053 copy.Step();
31373054 copy.Touch();
31383055 objEditor.refreshContents();
3139
- } else if (event.getSource() == slowerButton)
3056
+ } else if (source == slowerButton)
31403057 {
31413058 copy.Slower();
31423059 copy.Touch();
31433060 objEditor.refreshContents();
3144
- } else if (event.getSource() == fasterButton)
3061
+ } else if (source == fasterButton)
31453062 {
31463063 copy.Faster();
31473064 copy.Touch();
31483065 objEditor.refreshContents();
3149
- } else if (event.getSource() == remarkButton)
3066
+ } else if (source == remarkButton)
31503067 {
31513068 copy.Remark();
31523069 copy.Touch();
31533070 objEditor.refreshContents();
3154
- } else if (event.getSource() == stepAllButton)
3071
+ } else if (source == stepAllButton)
31553072 {
31563073 copy.StepAll();
31573074 copy.Touch();
31583075 objEditor.refreshContents();
3159
- } else if (event.getSource() == resetAllButton)
3076
+ } else if (source == resetAllButton)
31603077 {
31613078 //CameraPane.fullreset = true;
31623079 copy.ResetAll(); // ResetMeshes();
....@@ -3189,53 +3106,75 @@
31893106 // Close();
31903107 // }
31913108 // else
3192
- if (event.getSource() == resetSlidersButton)
3109
+ if (source == resetSlidersButton)
31933110 {
31943111 ResetSliders();
3195
- } else if (event.getSource() == clearMaterialButton)
3112
+ } else if (source == clearMaterialButton)
31963113 {
31973114 ClearMaterial();
3198
- } else if (event.getSource() == createMaterialButton)
3115
+ } else if (source == createMaterialButton)
31993116 {
32003117 CreateMaterial();
3201
- } else if (event.getSource() == clearPanelButton)
3118
+ } else if (source == clearPanelButton)
32023119 {
32033120 copy.ClearUI();
32043121 refreshContents(true);
3205
- } /*
3206
- }
3207
-
3208
- public boolean action(Event event, Object arg)
3209
- {
3210
- */ 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)
32113147 {
32123148 Close();
32133149 //return true;
3214
- } else if (event.getSource() == loadItem)
3150
+ } else if (source == loadItem)
32153151 {
32163152 load();
32173153 //return true;
3218
- } else if (event.getSource() == saveItem)
3154
+ } else if (source == newItem)
3155
+ {
3156
+ New();
3157
+ } else if (source == saveItem)
32193158 {
32203159 save();
32213160 //return true;
3222
- } else if (event.getSource() == saveAsItem)
3161
+ } else if (source == saveAsItem)
32233162 {
32243163 saveAs();
32253164 //return true;
3226
- } else if (event.getSource() == reexportItem)
3165
+ } else if (source == reexportItem)
32273166 {
32283167 reexport();
32293168 //return true;
3230
- } else if (event.getSource() == exportAsItem)
3169
+ } else if (source == exportAsItem)
32313170 {
32323171 export();
32333172 //return true;
3234
- } else if (event.getSource() == povItem)
3173
+ } else if (source == povItem)
32353174 {
32363175 generatePOV();
32373176 //return true;
3238
- } else if (event.getSource() == zBufferItem)
3177
+ } else if (source == zBufferItem)
32393178 {
32403179 try
32413180 {
....@@ -3257,21 +3196,8 @@
32573196 cameraView.repaint();
32583197 //return true;
32593198 }
3260
- */ else if (event.getSource() == editCameraItem)
3261
- {
3262
- cameraView.ProtectCamera();
3263
- cameraView.repaint();
3264
- return;
3265
- } else if (event.getSource() == revertCameraItem)
3266
- {
3267
- cameraView.RevertCamera();
3268
- cameraView.repaint();
3269
- return;
3270
-// } else if (event.getSource() == textureButton)
3271
-// {
3272
-// return; // true;
3273
- } else // combos...
3274
- if (event.getSource() == texresMenu)
3199
+ */ else // combos...
3200
+ if (source == texresMenu)
32753201 {
32763202 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32773203 copy.texres = texresMenu.getSelectedIndex();
....@@ -3283,27 +3209,283 @@
32833209 }
32843210 }
32853211
3286
- void ToggleAnimation()
3212
+ void New()
32873213 {
3288
- if (!CameraPane.ANIMATION)
3214
+ while (copy.Size() > 1)
32893215 {
3290
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
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);
32913439 browser.show();
32923440 String filename = browser.getFile();
32933441 if (filename != null && filename.length() > 0)
32943442 {
3295
- CameraPane.filename = browser.getDirectory() + filename;
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
+
3468
+ void ToggleAnimation()
3469
+ {
3470
+ if (!Globals.ANIMATION)
3471
+ {
3472
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3473
+ browser.setVisible(true);
3474
+ String filename = browser.getFile();
3475
+ if (filename != null && filename.length() > 0)
3476
+ {
3477
+ Globals.filename = browser.getDirectory() + filename;
32963478 //CameraPane.framecount = 0;
3297
- CameraPane.imagecount = 0;
3479
+ Globals.imagecount = 0;
32983480
3299
- CameraPane.ANIMATION ^= true;
3481
+ Globals.ANIMATION ^= true;
33003482
3301
- GrafreeD.wav.cursor = 0;
3302
- GrafreeD.wav.loop = 0;
3483
+ Grafreed.wav.cursor = 0;
3484
+ Grafreed.wav.loop = 0;
33033485 }
33043486 } else
33053487 {
3306
- CameraPane.ANIMATION ^= true;
3488
+ Globals.ANIMATION ^= true;
33073489 }
33083490 }
33093491
....@@ -3349,7 +3531,7 @@
33493531 void CreateMaterial()
33503532 {
33513533 //copy.ClearMaterial(); // PATCH
3352
- copy.CreateMaterialS(multiplyToggle.isSelected());
3534
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33533535 if (copy.selection.size() > 0)
33543536 //SetMaterial(copy);
33553537 {
....@@ -3408,11 +3590,11 @@
34083590 {
34093591 copy.ResetBlockLoop(); // temporary problem
34103592
3411
- boolean random = CameraPane.RANDOM;
3412
- CameraPane.RANDOM = false; // parse everything
3593
+ boolean random = CameraPane.SWITCH;
3594
+ CameraPane.SWITCH = false; // parse everything
34133595 copy.ResetDisplayList();
34143596 copy.HardTouch();
3415
- CameraPane.RANDOM = random;
3597
+ CameraPane.SWITCH = random;
34163598 }
34173599
34183600 // public void applySelf()
....@@ -3482,10 +3664,40 @@
34823664 current.fakedepth = (float) fakedepthField.getFloat();
34833665 current.shadowbias = (float) shadowbiasField.getFloat();
34843666
3485
- if (!NumberSlider.frozen)
3667
+ if (!cNumberSlider.frozen)
34863668 {
34873669 //System.out.println("Propagate = " + propagate);
34883670 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
+
34893701 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34903702 {
34913703 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3530,6 +3742,7 @@
35303742 || e.getSource() == apertureField
35313743 || e.getSource() == shadowblurField)
35323744 {
3745
+ new Exception().printStackTrace();
35333746 System.exit(0);
35343747 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35353748 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3600,7 +3813,7 @@
36003813 }
36013814
36023815 if (normalpushField != null)
3603
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3816
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36043817 }
36053818
36063819 void SnapObject()
....@@ -3855,7 +4068,7 @@
38554068
38564069 radioPanel.revalidate();
38574070 radioPanel.repaint();
3858
- ctrlPanel.revalidate(); // ? new
4071
+ ctrlPanel.validate(); // ? new
38594072 ctrlPanel.repaint();
38604073 }
38614074 }
....@@ -3864,6 +4077,7 @@
38644077
38654078 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38664079 {
4080
+ Save();
38674081 //Tween.set(thing, 0).target(1).start(tweenManager);
38684082 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38694083 // if (thing instanceof GenericJointDemo)
....@@ -4067,6 +4281,7 @@
40674281 }
40684282 }
40694283 }
4284
+
40704285 LoadGFDThread loadGFDThread;
40714286
40724287 void ReadGFD(String fullname, iCallBack cb)
....@@ -4086,8 +4301,10 @@
40864301
40874302 try
40884303 {
4304
+ // Try compressed version first.
40894305 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4090
- 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);
40914308
40924309 readobj = (Object3D) p.readObject();
40934310 istream.close();
....@@ -4095,7 +4312,20 @@
40954312 readobj.ResetDisplayList();
40964313 } catch (Exception e)
40974314 {
4098
- 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
+ }
40994329 }
41004330 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41014331 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4141,6 +4371,12 @@
41414371
41424372 void LoadIt(Object obj)
41434373 {
4374
+ if (obj == null)
4375
+ {
4376
+ // Invalid file
4377
+ return;
4378
+ }
4379
+
41444380 System.out.println("Loaded " + obj);
41454381 //new Exception().printStackTrace();
41464382 Object3D readobj = (Object3D) obj;
....@@ -4150,6 +4386,7 @@
41504386
41514387 if (readobj != null)
41524388 {
4389
+ Save();
41534390 try
41544391 {
41554392 //readobj.deepCopySelf(copy);
....@@ -4212,7 +4449,7 @@
42124449
42134450 void load() // throws ClassNotFoundException
42144451 {
4215
- if (GrafreeD.standAlone)
4452
+ if (Grafreed.standAlone)
42164453 {
42174454 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42184455 browser.show();
....@@ -4299,11 +4536,13 @@
42994536 try
43004537 {
43014538 FileOutputStream ostream = new FileOutputStream(lastname);
4302
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4539
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4540
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43034541
43044542 p.writeObject(copy);
43054543 p.flush();
43064544
4545
+ zstream.close();
43074546 ostream.close();
43084547
43094548 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4313,11 +4552,12 @@
43134552 {
43144553 }
43154554 }
4555
+
43164556 String lastname;
43174557
43184558 void saveAs()
43194559 {
4320
- if (GrafreeD.standAlone)
4560
+ if (Grafreed.standAlone)
43214561 {
43224562 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43234563 browser.setVisible(true);
....@@ -4422,13 +4662,13 @@
44224662 try
44234663 {
44244664 FileOutputStream ostream = new FileOutputStream(filename);
4425
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4426
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4665
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4666
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44274667
44284668 Object3D objectparent = obj.parent;
44294669 obj.parent = null;
44304670
4431
- Object3D object = (Object3D) GrafreeD.clone(obj);
4671
+ Object3D object = (Object3D) Grafreed.clone(obj);
44324672
44334673 obj.parent = objectparent;
44344674
....@@ -4440,8 +4680,8 @@
44404680 p.writeObject(object);
44414681 p.flush();
44424682
4683
+ zstream.close();
44434684 ostream.close();
4444
- // zstream.close();
44454685
44464686 // group.selection.get(0).parent = parent;
44474687 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4462,7 +4702,7 @@
44624702 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44634703 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44644704 copy.generatePOV(buffer);
4465
- if (GrafreeD.standAlone)
4705
+ if (Grafreed.standAlone)
44664706 {
44674707 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44684708 browser.show();
....@@ -4488,7 +4728,8 @@
44884728 Object3D client;
44894729 Object3D copy;
44904730 MenuBar menuBar;
4491
- Menu windowMenu;
4731
+ Menu fileMenu;
4732
+ MenuItem newItem;
44924733 MenuItem loadItem;
44934734 MenuItem saveItem;
44944735 MenuItem saveAsItem;
....@@ -4496,13 +4737,11 @@
44964737 MenuItem reexportItem;
44974738 MenuItem povItem;
44984739 MenuItem closeItem;
4499
- Menu cameraMenu;
4740
+
45004741 CheckboxMenuItem zBufferItem;
45014742 //MenuItem normalLensItem;
4502
- MenuItem editCameraItem;
4503
- MenuItem revertCameraItem;
4504
- CheckboxMenuItem toggleLiveItem;
45054743 MenuItem stepItem;
4744
+ CheckboxMenuItem toggleLiveItem;
45064745 CheckboxMenuItem toggleFullScreenItem;
45074746 CheckboxMenuItem toggleTimelineItem;
45084747 CheckboxMenuItem toggleRenderItem;
....@@ -4511,7 +4750,7 @@
45114750 CheckboxMenuItem toggleFootContactItem;
45124751 CheckboxMenuItem toggleDLItem;
45134752 CheckboxMenuItem toggleTextureItem;
4514
- CheckboxMenuItem toggleRandomItem;
4753
+ CheckboxMenuItem toggleSwitchItem;
45154754 CheckboxMenuItem toggleRootItem;
45164755 CheckboxMenuItem animationItem;
45174756 CheckboxMenuItem toggleHandleItem;
....@@ -4519,20 +4758,21 @@
45194758 JSplitPane mainPanel;
45204759 JScrollPane scrollpane;
45214760 JPanel toolbarPanel;
4522
- JPanel treePanel;
4761
+ cGridBag treePanel;
45234762 JPanel radioPanel;
45244763 ButtonGroup buttonGroup;
4525
- JPanel ctrlPanel;
4526
- JPanel materialPanel;
4764
+ cGridBag ctrlPanel;
4765
+ cGridBag materialPanel;
45274766 JScrollPane infoPanel;
4528
- JPanel optionsPanel;
4767
+ cGridBag optionsPanel;
45294768 JTabbedPane objectPanel;
4530
- JPanel XYZPanel;
4769
+ cGridBag XYZPanel;
45314770 JSplitPane gridPanel;
45324771 JSplitPane bigPanel;
4533
- JPanel bigThree;
4534
- JTabbedPane scenePanel;
4535
- JPanel centralPanel;
4772
+ cGridBag bigThree;
4773
+ cGridBag scenePanel;
4774
+ cGridBag centralPanel;
4775
+ JSplitPane cameraPanel;
45364776 JPanel timelinePanel;
45374777 JMenuBar timelineMenubar;
45384778 JSplitPane framePanel;
....@@ -4584,67 +4824,72 @@
45844824 // MATERIAL
45854825 JLabel materialLabel;
45864826 JLabel colorLabel;
4587
- NumberSlider colorField;
4827
+ cNumberSlider colorField;
45884828 JLabel modulationLabel;
4589
- NumberSlider modulationField;
4829
+ cNumberSlider modulationField;
45904830 JLabel metalnessLabel;
4591
- NumberSlider metalnessField;
4831
+ cNumberSlider metalnessField;
45924832 JLabel diffuseLabel;
4593
- NumberSlider diffuseField;
4833
+ cNumberSlider diffuseField;
45944834 JLabel specularLabel;
4595
- NumberSlider specularField;
4835
+ cNumberSlider specularField;
45964836 JLabel shininessLabel;
4597
- NumberSlider shininessField;
4837
+ cNumberSlider shininessField;
45984838 JLabel shiftLabel;
4599
- NumberSlider shiftField;
4839
+ cNumberSlider shiftField;
46004840 JLabel ambientLabel;
4601
- NumberSlider ambientField;
4841
+ cNumberSlider ambientField;
46024842 JLabel lightareaLabel;
4603
- NumberSlider lightareaField;
4843
+ cNumberSlider lightareaField;
46044844 JLabel diffusenessLabel;
4605
- NumberSlider diffusenessField;
4845
+ cNumberSlider diffusenessField;
46064846 JLabel velvetLabel;
4607
- NumberSlider velvetField;
4847
+ cNumberSlider velvetField;
46084848 JLabel sheenLabel;
4609
- NumberSlider sheenField;
4849
+ cNumberSlider sheenField;
46104850 JLabel subsurfaceLabel;
4611
- NumberSlider subsurfaceField;
4851
+ cNumberSlider subsurfaceField;
46124852 //JLabel bumpLabel;
46134853 //NumberSlider bumpField;
46144854 JLabel backlitLabel;
4615
- NumberSlider backlitField;
4855
+ cNumberSlider backlitField;
46164856 JLabel anisoLabel;
4617
- NumberSlider anisoField;
4857
+ cNumberSlider anisoField;
46184858 JLabel anisoVLabel;
4619
- NumberSlider anisoVField;
4859
+ cNumberSlider anisoVField;
46204860 JLabel cameraLabel;
4621
- NumberSlider cameraField;
4861
+ cNumberSlider cameraField;
46224862 JLabel selfshadowLabel;
4623
- NumberSlider selfshadowField;
4863
+ cNumberSlider selfshadowField;
46244864 JLabel shadowLabel;
4625
- NumberSlider shadowField;
4865
+ cNumberSlider shadowField;
46264866 JLabel textureLabel;
4627
- NumberSlider textureField;
4867
+ cNumberSlider textureField;
46284868 JLabel opacityLabel;
4629
- NumberSlider opacityField;
4869
+ cNumberSlider opacityField;
46304870 JLabel fakedepthLabel;
4631
- NumberSlider fakedepthField;
4871
+ cNumberSlider fakedepthField;
46324872 JLabel shadowbiasLabel;
4633
- NumberSlider shadowbiasField;
4873
+ cNumberSlider shadowbiasField;
46344874 JLabel bumpLabel;
4635
- NumberSlider bumpField;
4875
+ cNumberSlider bumpField;
46364876 JLabel noiseLabel;
4637
- NumberSlider noiseField;
4877
+ cNumberSlider noiseField;
46384878 JLabel powerLabel;
4639
- NumberSlider powerField;
4879
+ cNumberSlider powerField;
46404880 JLabel borderfadeLabel;
4641
- NumberSlider borderfadeField;
4881
+ cNumberSlider borderfadeField;
46424882 JLabel fogLabel;
4643
- NumberSlider fogField;
4883
+ cNumberSlider fogField;
46444884 JLabel opacityPowerLabel;
4645
- NumberSlider opacityPowerField;
4885
+ cNumberSlider opacityPowerField;
46464886 JTree jTree;
46474887 //ObjectUI parent;
46484888
4649
- NumberSlider normalpushField;
4889
+ cNumberSlider normalpushField;
4890
+
4891
+ private MenuItem importGFDItem;
4892
+ private MenuItem importVRMLX3DItem;
4893
+ private MenuItem import3DSItem;
4894
+ private MenuItem importOBJItem;
46504895 }