Normand Briere
2019-06-17 13e9febe94aaeebad9c97f6d3e2aa4d73b2495c8
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,53 @@
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(commandsPanel);
172
+ objEditor.ctrlPanel.remove(pushPanel);
173
+ //objEditor.ctrlPanel.remove(fillPanel);
174
+
175
+ //Remove(normalpushField);
165176 }
166177
167178 public ObjEditor GetEditor()
....@@ -265,24 +276,40 @@
265276 void SetupMenu()
266277 {
267278 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..."));
279
+ menuBar.add(fileMenu = new Menu("File"));
280
+ fileMenu.add(newItem = new MenuItem("New"));
281
+ fileMenu.add(loadItem = new MenuItem("Open..."));
282
+
283
+ //oe.menuBar.add(menu = new Menu("Include"));
284
+ Menu menu = new Menu("Import");
285
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
286
+ importOBJItem.addActionListener(this);
287
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
288
+ import3DSItem.addActionListener(this);
289
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
290
+ importVRMLX3DItem.addActionListener(this);
291
+ menu.add("-");
292
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
293
+ importGFDItem.addActionListener(this);
294
+ fileMenu.add(menu);
295
+ fileMenu.add("-");
296
+
297
+ fileMenu.add(saveItem = new MenuItem("Save"));
298
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
273299 //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("-");
300
+ fileMenu.add("-");
301
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
302
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
303
+ fileMenu.add("-");
278304 if (client.parent != null)
279305 {
280
- windowMenu.add(closeItem = new MenuItem("Close"));
306
+ fileMenu.add(closeItem = new MenuItem("Close"));
281307 } else
282308 {
283
- windowMenu.add(closeItem = new MenuItem("Exit"));
309
+ fileMenu.add(closeItem = new MenuItem("Exit"));
284310 }
285311
312
+ newItem.addActionListener(this);
286313 loadItem.addActionListener(this);
287314 saveItem.addActionListener(this);
288315 saveAsItem.addActionListener(this);
....@@ -291,79 +318,26 @@
291318 //povItem.addActionListener(this);
292319 closeItem.addActionListener(this);
293320
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
-
349321 objectPanel = new JTabbedPane();
350322 toolbarPanel = new JPanel();
351323 toolbarPanel.setName("Toolbar");
352
- treePanel = new JPanel();
324
+ treePanel = new cGridBag();
353325 treePanel.setName("Tree");
354
- ctrlPanel = new JPanel(); // new GridBagLayout());
326
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
355327 ctrlPanel.setName("Edit");
356
- materialPanel = new JPanel();
328
+ materialPanel = new cGridBag().setVertical(true);
357329 materialPanel.setName("Material");
358330 /*JTextPane*/
359331 infoarea = createTextPane();
332
+ doc = infoarea.getStyledDocument();
333
+
360334 infoarea.setEditable(true);
361335 SetText();
362336 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
363337 // infoarea.setOpaque(false);
364338 // //infoarea.setForeground(textcolor);
365
- infoarea.setLineWrap(true);
366
- infoarea.setWrapStyleWord(true);
339
+// TEXTAREA infoarea.setLineWrap(true);
340
+// TEXTAREA infoarea.setWrapStyleWord(true);
367341 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
368342 infoPanel.setPreferredSize(new Dimension(50, 200));
369343 infoPanel.setName("Info");
....@@ -374,16 +348,16 @@
374348 mainPanel.setName("Main");
375349 mainPanel.setContinuousLayout(true);
376350 mainPanel.setOneTouchExpandable(true);
377
- mainPanel.setDividerLocation(1.0);
378351 mainPanel.setDividerSize(9);
379
- mainPanel.setResizeWeight(0);
352
+ mainPanel.setDividerLocation(0.5); //1.0);
353
+ mainPanel.setResizeWeight(0.5);
380354
381355 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
382356 //mainPanel.setLayout(new GridBagLayout());
383357 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
384
- treePanel.setLayout(new GridBagLayout());
385
- ctrlPanel.setLayout(new GridBagLayout());
386
- materialPanel.setLayout(new GridBagLayout());
358
+// treePanel.setLayout(new GridBagLayout());
359
+ //ctrlPanel.setLayout(new GridBagLayout());
360
+ //materialPanel.setLayout(new GridBagLayout());
387361
388362 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
389363 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -422,7 +396,7 @@
422396 static String newline = "\n";
423397 protected static final String buttonString = "JButton";
424398 StyledDocument doc;
425
- JTextArea infoarea;
399
+ JTextPane infoarea;
426400
427401 void ClearInfo()
428402 {
....@@ -445,10 +419,10 @@
445419 e.printStackTrace();
446420 }
447421
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();
422
+// String selection = infoarea.getText();
423
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
424
+// java.awt.datatransfer.Clipboard clipboard =
425
+// Toolkit.getDefaultToolkit().getSystemClipboard();
452426 //clipboard.setContents(data, data);
453427 }
454428
....@@ -471,13 +445,13 @@
471445 //SendInfo("Name:", "bold");
472446 if (sel.GetTextures() != null || debug)
473447 {
474
- si.SendInfo(sel.toString(), "bold");
448
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
475449 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
476450 if (sel.Size() > 0)
477451 {
478452 si.SendInfo("#children = " + sel.Size(), "regular");
479453 }
480
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
454
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
481455 if (debug)
482456 {
483457 try
....@@ -489,7 +463,10 @@
489463 }
490464
491465 if (full)
492
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
466
+ {
467
+ si.SendInfo(" BBox min: " + minima, "regular");
468
+ si.SendInfo(" BBox max: " + maxima, "regular");
469
+ }
493470
494471 if (sel.bRep != null)
495472 {
....@@ -516,7 +493,7 @@
516493 }
517494 if (sel.support != null)
518495 {
519
- si.SendInfo(" support: " + sel.support, "regular");
496
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
520497 }
521498 if (sel.scriptnode != null)
522499 {
....@@ -587,6 +564,9 @@
587564 {
588565 CameraPane.pointflow = (PointFlow) sel;
589566 }
567
+
568
+ si.SendInfo("_____________________", "regular");
569
+ si.SendInfo("", "regular");
590570 }
591571 }
592572
....@@ -618,52 +598,52 @@
618598 cameraView.ToggleFullScreen();
619599 }
620600
621
- private JTextArea createTextPane()
601
+ private JTextPane createTextPane()
622602 {
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
- };
603
+// TEXTAREA String[] initString =
604
+// {
605
+// "This is an editable JTextPane, ", //regular
606
+// "another ", //italic
607
+// "styled ", //bold
608
+// "text ", //small
609
+// "component, ", //large
610
+// "which supports embedded components..." + newline,//regular
611
+// " " + newline, //button
612
+// "...and embedded icons..." + newline, //regular
613
+// " ", //icon
614
+// newline + "JTextPane is a subclass of JEditorPane that "
615
+// + "uses a StyledEditorKit and StyledDocument, and provides "
616
+// + "cover methods for interacting with those objects."
617
+// };
618
+//
619
+// String[] initStyles =
620
+// {
621
+// "regular", "italic", "bold", "small", "large",
622
+// "regular", "button", "regular", "icon",
623
+// "regular"
624
+// };
625
+//
626
+// JTextPane textPane = new JTextPane();
627
+// textPane.setEditable(true);
628
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
629
+// addStylesToDocument(doc);
630
+//
631
+// try
632
+// {
633
+// for (int j = 0; j < 2; j++)
634
+// {
635
+// for (int i = 0; i < initString.length; i++)
636
+// {
637
+// doc.insertString(doc.getLength(), initString[i],
638
+// doc.getStyle(initStyles[i]));
639
+// }
640
+// }
641
+// } catch (BadLocationException ble)
642
+// {
643
+// System.err.println("Couldn't insert initial text into text pane.");
644
+// }
638645
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;
646
+ return new JTextPane(); // textPane;
667647 }
668648
669649 protected void addStylesToDocument(StyledDocument doc)
....@@ -716,7 +696,7 @@
716696 protected static ImageIcon createImageIcon(String path,
717697 String description)
718698 {
719
- java.net.URL imgURL = GrafreeD.class.getResource(path);
699
+ java.net.URL imgURL = Grafreed.class.getResource(path);
720700 if (imgURL != null)
721701 {
722702 return new ImageIcon(imgURL, description);
....@@ -748,6 +728,7 @@
748728 // NumberSlider vDivsField;
749729 // JCheckBox endcaps;
750730 JCheckBox liveCB;
731
+ JCheckBox selectCB;
751732 JCheckBox hideCB;
752733 JCheckBox link2masterCB;
753734 JCheckBox markCB;
....@@ -763,115 +744,83 @@
763744 JButton slowerButton;
764745 JButton fasterButton;
765746 JButton remarkButton;
747
+
748
+ cGridBag namePanel;
749
+ cGridBag setupPanel;
750
+ cGridBag commandsPanel;
751
+ cGridBag pushPanel;
752
+ cGridBag fillPanel;
766753
767
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
754
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
768755 {
769756 JCheckBox cb;
770757
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);
758
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
776759 cb.addItemListener(this);
777
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
778
- oe.aConstraints.gridwidth = 1;
779
- oe.aConstraints.gridx += 1;
780760
781761 return cb;
782762 }
783763
784
- cButton AddButton(ObjEditor oe, String label)
764
+ cButton AddButton(cGridBag panel, String label)
785765 {
786766 cButton cb;
787767
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);
768
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
793769 cb.addActionListener(this);
794
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
795
- oe.aConstraints.gridwidth = 1;
796
- oe.aConstraints.gridx += 1;
797770
798771 return cb;
799772 }
800773
801
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
774
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
802775 {
803776 JComboBox combo;
804777
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;
778
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
808779 combo.addActionListener(this);
809780
810781 return combo;
811782 }
812783
813
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
784
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
814785 {
815
- NumberSlider combo;
786
+ cGridBag control = new cGridBag();
787
+
788
+ cNumberSlider combo;
816789
817790 JLabel jlabel = new JLabel(label);
818
-
819
- aConstraints.fill = GridBagConstraints.VERTICAL;
820791 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
-
792
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
793
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
830794 combo.setFloat(current);
831
-
832
- combo.label = jlabel;
833
-
834
- combo.addChangeListener(this);
835
-
836
- return combo;
795
+
796
+ panel.add(control);
797
+
798
+ return control;
837799 }
838800
839
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
801
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
840802 {
841
- NumberSlider combo;
803
+ cGridBag control = new cGridBag();
804
+
805
+ cNumberSlider combo;
842806
843807 JLabel jlabel = new JLabel(label);
844
-
845
- aConstraints.fill = GridBagConstraints.VERTICAL;
846808 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
-
809
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
856811 combo.setInteger(current);
857812
858
- combo.label = jlabel;
859
-
860
- combo.addChangeListener(this);
861
-
862
- return combo;
813
+ panel.add(control);
814
+
815
+ return control;
863816 }
864817
865
- JTextArea AddText(JPanel ctrlPanel, String name)
818
+ JTextArea AddText(cGridBag ctrlPanel, String name)
866819 {
867820 JTextArea text;
868821
869
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
870
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
871
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
822
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
872823 text.addCaretListener(this);
873
- aConstraints.gridx += 1;
874
- aConstraints.gridwidth = 1;
875824
876825 return text;
877826 }
....@@ -901,9 +850,16 @@
901850 objEditor.ctrlPanel.remove(j);
902851 }
903852
853
+ void Remove(cNumberSlider j)
854
+ {
855
+ j.removeChangeListener(this);
856
+ //objEditor.ctrlPanel.remove(j.label);
857
+ objEditor.ctrlPanel.remove(j);
858
+ }
859
+
904860 /*
905861 */
906
- void Return() // ObjEditor oe)
862
+ void Return0() // ObjEditor oe)
907863 {
908864 aConstraints.gridy += 1;
909865 aConstraints.gridx = 0;
....@@ -958,37 +914,72 @@
958914
959915 void SetupUI2(ObjEditor oe)
960916 {
961
-// oe.aConstraints.weightx = 0;
962
-// oe.aConstraints.weighty = 0;
963
-// oe.aConstraints.gridx = 0;
964
-// oe.aConstraints.gridy = 0;
965
- SetupName(oe);
917
+ //SetupName(oe);
918
+
919
+ namePanel = new cGridBag();
920
+
921
+ nameField = AddText(namePanel, copy.GetName());
922
+ namePanel.add(nameField);
923
+ oe.ctrlPanel.add(namePanel);
924
+
925
+ oe.ctrlPanel.Return();
966926
967927 if (!GroupEditor.allparams)
968928 return;
969929
970
- liveCB = AddCheckBox(oe, "Live", copy.live);
971
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
972
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
930
+ setupPanel = new cGridBag().setVertical(false);
931
+
932
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
933
+ liveCB.setToolTipText("Animate object");
934
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
935
+ selectCB.setToolTipText("Make object selectable");
973936 // 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");
937
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
938
+ hideCB.setToolTipText("Hide object");
939
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
940
+ markCB.setToolTipText("Set the animation target transform");
941
+
942
+ rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
943
+ rewindCB.setToolTipText("Rewind animation");
944
+
945
+ randomCB = AddCheckBox(setupPanel, "Random", copy.random);
946
+ randomCB.setToolTipText("Option for switch node");
947
+
948
+ if (Globals.ADVANCED)
949
+ {
950
+ link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
951
+ link2masterCB.setToolTipText("Attach to support");
952
+ speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
953
+ speedupCB.setToolTipText("Option motion capture");
954
+ }
955
+
956
+ oe.ctrlPanel.add(setupPanel);
957
+ oe.ctrlPanel.Return();
958
+
959
+ commandsPanel = new cGridBag().setVertical(false);
960
+
961
+ resetButton = AddButton(commandsPanel, "Reset");
962
+ resetButton.setToolTipText("Jump to frame zero");
963
+ stepButton = AddButton(commandsPanel, "Step");
964
+ stepButton.setToolTipText("Step one frame");
980965 // resetAllButton = AddButton(oe, "Reset All");
981966 // stepAllButton = AddButton(oe, "Step All");
982
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
983967 // Return();
984
- slowerButton = AddButton(oe, "Slow");
985
- fasterButton = AddButton(oe, "Fast");
986
- remarkButton = AddButton(oe, "Rem");
968
+ slowerButton = AddButton(commandsPanel, "Slow");
969
+ slowerButton.setToolTipText("Decrease animation speed");
970
+ fasterButton = AddButton(commandsPanel, "Fast");
971
+ fasterButton.setToolTipText("Increase animation speed");
972
+ remarkButton = AddButton(commandsPanel, "Remark");
973
+ remarkButton.setToolTipText("Set the current transform as the target");
987974
988
- Return();
975
+ oe.ctrlPanel.add(commandsPanel);
976
+ oe.ctrlPanel.Return();
989977
990
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
991
- Return();
978
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
979
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
980
+ //Return();
981
+
982
+ oe.ctrlPanel.Return();
992983
993984 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
994985 // ObjEditor.aConstraints.gridx += 1;
....@@ -1083,7 +1074,7 @@
10831074 oe.aConstraints.gridwidth = 1;
10841075 /**/
10851076 nameField = AddText(oe.ctrlPanel, copy.GetName());
1086
- Return();
1077
+ oe.ctrlPanel.Return();
10871078
10881079 //ctrlPanel.add(textureButton = new Button("Texture..."));
10891080 //textureButton.setEnabled(false);
....@@ -1185,7 +1176,8 @@
11851176 //JPanel worldPanel =
11861177 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11871178 //worldPanel.setName("World");
1188
- centralPanel = new JPanel(new BorderLayout());
1179
+ centralPanel = new cGridBag();
1180
+ centralPanel.preferredWidth = 20;
11891181 timelinePanel = new JPanel(new BorderLayout());
11901182 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11911183
....@@ -1215,12 +1207,13 @@
12151207 //frontView.object = copy;
12161208 //sideView.object = copy;
12171209
1218
- XYZPanel = new JPanel();
1219
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1210
+ XYZPanel = new cGridBag().setVertical(true);
1211
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12201212
1221
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1222
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1223
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1213
+ XYZPanel.preferredWidth = 5;
1214
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1215
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1216
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
12241217
12251218 /*
12261219 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1258,10 +1251,11 @@
12581251 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12591252 //tmp.setName("Edit");
12601253 objectPanel.add(materialPanel);
1261
- JPanel north = new JPanel(new BorderLayout());
1262
- north.setName("Edit");
1263
- north.add(ctrlPanel, BorderLayout.NORTH);
1264
- objectPanel.add(north);
1254
+// JPanel north = new JPanel(new BorderLayout());
1255
+// north.setName("Edit");
1256
+// north.add(ctrlPanel, BorderLayout.NORTH);
1257
+// objectPanel.add(north);
1258
+ objectPanel.add(ctrlPanel);
12651259 objectPanel.add(infoPanel);
12661260
12671261 /*
....@@ -1282,16 +1276,23 @@
12821276 scrollpane.setWheelScrollingEnabled(true);
12831277 scrollpane.addMouseWheelListener(this); // Default not fast enough
12841278
1285
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1286
- scenePanel.add(scrollpane);
1279
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1280
+ scenePanel.preferredWidth = 6;
1281
+
1282
+ JTabbedPane tabbedPane = new JTabbedPane();
1283
+ tabbedPane.add(scrollpane);
12871284
1288
- scenePanel.add(FSPane = new cFileSystemPane(this));
1285
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12891286
1290
- optionsPanel = new JPanel(new GridBagLayout());
1287
+ optionsPanel = new cGridBag().setVertical(true);
12911288
12921289 optionsPanel.setName("Options");
1293
- scenePanel.add(optionsPanel);
1294
-
1290
+
1291
+ AddOptions(optionsPanel); //, aConstraints);
1292
+
1293
+ tabbedPane.add(optionsPanel);
1294
+
1295
+ scenePanel.add(tabbedPane);
12951296
12961297 /*
12971298 cTree jTree = new cTree(null);
....@@ -1325,6 +1326,7 @@
13251326 //bigPanel.setSize(new Dimension(10,10));
13261327 //bigPanel.add(ctrlPanel);
13271328 //bigPanel.add(gridPanel);
1329
+ /**
13281330 bigThree = new JPanel();
13291331 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13301332 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1348,7 +1350,13 @@
13481350 // aConstraints.gridheight = 3;
13491351 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13501352 bigThree.add(XYZPanel, aWindowConstraints);
1353
+ /**/
13511354
1355
+ bigThree = new cGridBag();
1356
+ bigThree.addComponent(scenePanel);
1357
+ bigThree.addComponent(centralPanel);
1358
+ bigThree.addComponent(XYZPanel);
1359
+
13521360 // // SIDE EFFECT!!!
13531361 // aConstraints.gridx = 0;
13541362 // aConstraints.gridy = 0;
....@@ -1369,13 +1377,14 @@
13691377 //worldPane.add(bigPanel);
13701378 //worldPane.add(worldPanel);
13711379 /**/
1372
- frame.getContentPane().add(/*"Center",*/framePanel);
1380
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1381
+ frame.add(/*"Center",*/framePanel);
13731382 //frame.getContentPane().add(/*"Center",*/ worldPane);
13741383
13751384 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13761385
1377
- frame.setSize(1024, 768);
1378
- frame.show();
1386
+ frame.setSize(1280, 860);
1387
+ frame.setVisible(true);
13791388
13801389 gridPanel.setDividerLocation(1.0);
13811390
....@@ -1390,6 +1399,10 @@
13901399 });
13911400 }
13921401
1402
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1403
+ {
1404
+ }
1405
+
13931406 JTree GetTree()
13941407 {
13951408 return objEditor.jTree;
....@@ -1401,260 +1414,173 @@
14011414 ctrlPanel.removeAll();
14021415 }
14031416
1404
- void SetupMaterial(JPanel ctrlPanel)
1417
+ void SetupMaterial(cGridBag panel)
14051418 {
1406
- aConstraints.weighty = 0;
1407
- //aConstraints.weightx = 1;
1408
- /*
1419
+ /*
14091420 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14101421 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1411
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1412
- aConstraints.gridx += 1;
14131422 */
14141423
1415
- aConstraints.gridwidth = 1;
1416
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1417
- aConstraints.gridx += 1;
1418
- aConstraints.weighty = 0;
1419
- aConstraints.gridwidth = 1;
1424
+ cGridBag editBar = new cGridBag().setVertical(false);
1425
+
1426
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1427
+ createMaterialButton.setToolTipText("Create material");
14201428
14211429 /*
14221430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1423
- aConstraints.gridx += 1;
1424
- aConstraints.weighty = 0;
1425
- aConstraints.gridwidth = 1;
14261431 */
14271432
1428
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1429
- aConstraints.gridx += 1;
1433
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1434
+ clearMaterialButton.setToolTipText("Clear material");
1435
+
1436
+ if (Globals.ADVANCED)
1437
+ {
1438
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1439
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1440
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1441
+ }
14301442
1431
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1432
-
1433
- aConstraints.gridx += 1;
1434
-
1435
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1436
-
1437
- aConstraints.gridx += 1;
1438
-
1439
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1440
-
1441
- aConstraints.gridx = 0;
1442
- aConstraints.gridy += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
1443
+ editBar.preferredHeight = 15;
1444
+
1445
+ panel.add(editBar);
1446
+
14451447 /**/
14461448 //aConstraints.weighty = 0;
14471449 ////aConstraints.weightx = 1;
14481450 //aConstraints.weighty = 1;
14491451 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14501452 //aConstraints.gridx += 1;
1451
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1452
- aConstraints.weighty = 0;
1453
- aConstraints.gridx = 0;
1454
- aConstraints.gridy += 1;
1455
- aConstraints.gridwidth = 1;
1453
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14561454
1457
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1458
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1459
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1460
- aConstraints.gridx += 1;
1461
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1462
- //aConstraints.weightx = 0;
1463
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1464
- aConstraints.gridx = 0;
1465
- aConstraints.gridy += 1;
1466
- aConstraints.gridwidth = 1;
1455
+ cGridBag colorSection = new cGridBag().setVertical(true);
1456
+
1457
+ cGridBag color = new cGridBag();
1458
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1459
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1460
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1461
+ //colorField.preferredWidth = 200;
1462
+ colorSection.add(color);
14671463
1468
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1469
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1470
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1471
- aConstraints.gridx += 1;
1472
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1473
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1474
- aConstraints.gridx = 0;
1475
- aConstraints.gridy += 1;
1476
- aConstraints.gridwidth = 1;
1464
+ cGridBag modulation = new cGridBag();
1465
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1466
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1467
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1468
+ colorSection.add(modulation);
14771469
1478
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1479
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1480
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1481
- aConstraints.gridx += 1;
1482
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1483
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1484
- aConstraints.gridx = 0;
1485
- aConstraints.gridy += 1;
1486
- aConstraints.gridwidth = 1;
1470
+ cGridBag texture = new cGridBag();
1471
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1472
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1474
+ colorSection.add(texture);
14871475
1488
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1489
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1490
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1491
- aConstraints.gridx += 1;
1492
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1493
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1494
- aConstraints.gridx = 0;
1495
- aConstraints.gridy += 1;
1496
- aConstraints.gridwidth = 1;
1476
+ cGridBag anisoU = new cGridBag();
1477
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1478
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
+ colorSection.add(anisoU);
14971481
1498
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1499
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1500
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1501
- aConstraints.gridx += 1;
1502
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1503
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1504
- aConstraints.gridx = 0;
1505
- aConstraints.gridy += 1;
1506
- aConstraints.gridwidth = 1;
1482
+ cGridBag anisoV = new cGridBag();
1483
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1484
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
+ colorSection.add(anisoV);
15071487
1508
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1509
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1510
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1511
- aConstraints.gridx += 1;
1512
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1513
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1514
- aConstraints.gridx = 0;
1515
- aConstraints.gridy += 1;
1516
- aConstraints.gridwidth = 1;
1488
+ cGridBag shadowbias = new cGridBag();
1489
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1490
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1492
+ colorSection.add(shadowbias);
15171493
1518
- //aConstraints.weighty = 1;
1519
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1520
- //aConstraints.gridx += 1;
1521
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1522
- aConstraints.weighty = 0;
1523
- aConstraints.gridx = 0;
1524
- aConstraints.gridy += 1;
1525
- aConstraints.gridwidth = 1;
1494
+ panel.add(new JSeparator());
1495
+
1496
+ panel.add(colorSection);
1497
+
1498
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1499
+
1500
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1501
+
1502
+ cGridBag diffuse = new cGridBag();
1503
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1504
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1505
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1506
+ diffuseSection.add(diffuse);
15261507
1527
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1528
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1530
- aConstraints.gridx += 1;
1531
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1532
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1533
- aConstraints.gridx = 0;
1534
- aConstraints.gridy += 1;
1535
- aConstraints.gridwidth = 1;
1508
+ cGridBag diffuseness = new cGridBag();
1509
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1510
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1512
+ diffuseSection.add(diffuseness);
15361513
1537
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1538
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1539
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1540
- aConstraints.gridx += 1;
1541
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1542
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1543
- aConstraints.gridx = 0;
1544
- aConstraints.gridy += 1;
1545
- aConstraints.gridwidth = 1;
1514
+ cGridBag selfshadow = new cGridBag();
1515
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1516
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1518
+ diffuseSection.add(selfshadow);
15461519
1547
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1548
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1549
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1550
- aConstraints.gridx += 1;
1551
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1552
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1553
- aConstraints.gridx = 0;
1554
- aConstraints.gridy += 1;
1555
- aConstraints.gridwidth = 1;
1520
+ cGridBag sheen = new cGridBag();
1521
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1522
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1523
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1524
+ diffuseSection.add(sheen);
15561525
1557
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1558
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1560
- aConstraints.gridx += 1;
1561
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1562
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1563
- aConstraints.gridx = 0;
1564
- aConstraints.gridy += 1;
1565
- aConstraints.gridwidth = 1;
1526
+ cGridBag subsurface = new cGridBag();
1527
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1528
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1530
+ diffuseSection.add(subsurface);
15661531
1567
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1568
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1569
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1570
- aConstraints.gridx += 1;
1571
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1572
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1573
- aConstraints.gridx = 0;
1574
- aConstraints.gridy += 1;
1575
- aConstraints.gridwidth = 1;
1532
+ cGridBag shadow = new cGridBag();
1533
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1534
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1536
+ diffuseSection.add(shadow);
15761537
1577
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1578
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1580
- aConstraints.gridx += 1;
1581
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1582
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1583
- aConstraints.gridx = 0;
1584
- aConstraints.gridy += 1;
1585
- aConstraints.gridwidth = 1;
1538
+ cGridBag fakedepth = new cGridBag();
1539
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1540
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1542
+ diffuseSection.add(fakedepth);
15861543
1587
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1588
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1589
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1590
- aConstraints.gridx += 1;
1591
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1592
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1593
- aConstraints.gridx = 0;
1594
- aConstraints.gridy += 1;
1595
- aConstraints.gridwidth = 1;
1544
+ panel.add(new JSeparator());
1545
+
1546
+ panel.add(diffuseSection);
1547
+
1548
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1549
+
1550
+ cGridBag specularSection = new cGridBag().setVertical(true);
15961551
1597
- //aConstraints.weighty = 1;
1598
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1599
- //aConstraints.gridx += 1;
1600
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1601
- aConstraints.weighty = 0;
1602
- aConstraints.gridx = 0;
1603
- aConstraints.gridy += 1;
1604
- aConstraints.gridwidth = 1;
1552
+ cGridBag specular = new cGridBag();
1553
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1554
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1556
+ specularSection.add(specular);
16051557
1606
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1607
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1608
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1609
- aConstraints.gridx += 1;
1610
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1611
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1612
- aConstraints.gridx = 0;
1613
- aConstraints.gridy += 1;
1614
- aConstraints.gridwidth = 1;
1558
+ cGridBag lightarea = new cGridBag();
1559
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1560
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1561
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1562
+ specularSection.add(lightarea);
16151563
1616
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1617
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1619
- aConstraints.gridx += 1;
1620
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1621
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1622
- aConstraints.gridx = 0;
1623
- aConstraints.gridy += 1;
1624
- aConstraints.gridwidth = 1;
1564
+ cGridBag shininess = new cGridBag();
1565
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1566
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1567
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1568
+ specularSection.add(shininess);
16251569
1626
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1627
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1629
- aConstraints.gridx += 1;
1630
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1631
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1632
- aConstraints.gridx = 0;
1633
- aConstraints.gridy += 1;
1634
- aConstraints.gridwidth = 1;
1570
+ cGridBag metalness = new cGridBag();
1571
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1572
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1573
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1574
+ specularSection.add(metalness);
16351575
1636
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1637
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1639
- aConstraints.gridx += 1;
1640
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1641
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1642
- aConstraints.gridx = 0;
1643
- aConstraints.gridy += 1;
1644
- aConstraints.gridwidth = 1;
1576
+ cGridBag velvet = new cGridBag();
1577
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1578
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1580
+ specularSection.add(velvet);
16451581
1646
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1647
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1648
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1649
- aConstraints.gridx += 1;
1650
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1651
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1652
- aConstraints.gridx = 0;
1653
- aConstraints.gridy += 1;
1654
- aConstraints.gridwidth = 1;
1655
-
1656
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1657
- Return();
1582
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1583
+ //Return();
16581584 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16591585 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16601586 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1665,130 +1591,93 @@
16651591 // aConstraints.gridy += 1;
16661592 // aConstraints.gridwidth = 1;
16671593
1668
- //aConstraints.weighty = 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1670
- //aConstraints.gridx += 1;
1671
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1672
- aConstraints.weighty = 0;
1673
- aConstraints.gridx = 0;
1674
- aConstraints.gridy += 1;
1675
- aConstraints.gridwidth = 1;
16761594
1677
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1678
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1679
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1680
- aConstraints.gridx += 1;
1681
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1682
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1683
- aConstraints.gridx = 0;
1684
- aConstraints.gridy += 1;
1685
- aConstraints.gridwidth = 1;
1595
+ panel.add(new JSeparator());
1596
+
1597
+ panel.add(specularSection);
1598
+
1599
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1600
+
1601
+ cGridBag globalSection = new cGridBag().setVertical(true);
16861602
1687
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1688
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1689
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1690
- aConstraints.gridx += 1;
1691
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1692
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1693
- aConstraints.gridx = 0;
1694
- aConstraints.gridy += 1;
1695
- aConstraints.gridwidth = 1;
1603
+ cGridBag camera = new cGridBag();
1604
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1605
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1607
+ globalSection.add(camera);
16961608
1697
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1698
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1699
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1700
- aConstraints.gridx += 1;
1701
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1702
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1703
- aConstraints.gridx = 0;
1704
- aConstraints.gridy += 1;
1705
- aConstraints.gridwidth = 1;
1609
+ cGridBag ambient = new cGridBag();
1610
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1611
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1612
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
+ globalSection.add(ambient);
17061614
1707
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1708
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1709
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1710
- aConstraints.gridx += 1;
1711
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1712
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1713
- aConstraints.gridx = 0;
1714
- aConstraints.gridy += 1;
1715
- aConstraints.gridwidth = 1;
1716
- aConstraints.weighty = 0;
1615
+ cGridBag backlit = new cGridBag();
1616
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1617
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
+ globalSection.add(backlit);
17171620
1718
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1719
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1720
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1721
- aConstraints.gridx += 1;
1722
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1723
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1724
- aConstraints.gridx = 0;
1725
- aConstraints.gridy += 1;
1726
- aConstraints.gridwidth = 1;
1621
+ cGridBag opacity = new cGridBag();
1622
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1623
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1625
+ globalSection.add(opacity);
17271626
1728
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1729
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1730
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1731
- aConstraints.gridx += 1;
1732
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1733
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1734
- aConstraints.gridx = 0;
1735
- aConstraints.gridy += 1;
1736
- aConstraints.gridwidth = 1;
1627
+ panel.add(new JSeparator());
1628
+
1629
+ panel.add(globalSection);
1630
+
1631
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1632
+
1633
+ cGridBag textureSection = new cGridBag().setVertical(true);
17371634
1738
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1739
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1740
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1741
- aConstraints.gridx += 1;
1742
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1743
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1744
- aConstraints.gridx = 0;
1745
- aConstraints.gridy += 1;
1746
- aConstraints.gridwidth = 1;
1635
+ cGridBag bump = new cGridBag();
1636
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1637
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1639
+ textureSection.add(bump);
17471640
1748
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1749
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1750
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1751
- aConstraints.gridx += 1;
1752
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1753
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1754
- aConstraints.gridx = 0;
1755
- aConstraints.gridy += 1;
1756
- aConstraints.gridwidth = 1;
1641
+ cGridBag noise = new cGridBag();
1642
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1643
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1645
+ textureSection.add(noise);
17571646
1758
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1759
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1760
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1761
- aConstraints.gridx += 1;
1762
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1763
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1764
- aConstraints.gridx = 0;
1765
- aConstraints.gridy += 1;
1766
- aConstraints.gridwidth = 1;
1647
+ cGridBag power = new cGridBag();
1648
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1649
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1651
+ textureSection.add(power);
17671652
1768
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1769
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1771
- aConstraints.gridx += 1;
1772
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1773
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1774
- aConstraints.gridx = 0;
1775
- aConstraints.gridy += 1;
1776
- aConstraints.gridwidth = 1;
1653
+ cGridBag borderfade = new cGridBag();
1654
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1655
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1657
+ textureSection.add(borderfade);
17771658
1778
- //aConstraints.weighty = 1;
1779
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1780
- //aConstraints.gridx += 1;
1781
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1782
- aConstraints.weighty = 0;
1659
+ cGridBag fog = new cGridBag();
1660
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1661
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1663
+ textureSection.add(fog);
17831664
1784
- aConstraints.gridx = 0;
1785
- aConstraints.gridy = 0;
1786
- aConstraints.gridwidth = 1;
1665
+ cGridBag opacityPower = new cGridBag();
1666
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1667
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1668
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1669
+ textureSection.add(opacityPower);
1670
+
1671
+ panel.add(new JSeparator());
1672
+
1673
+ panel.add(textureSection);
1674
+
1675
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17871676
17881677 SetMaterial(copy); // .GetMaterial());
17891678
1790
- colorField.addChangeListener(this);
1791
- modulationField.addChangeListener(this);
1679
+ //colorField.addChangeListener(this);
1680
+// modulationField.addChangeListener(this);
17921681 metalnessField.addChangeListener(this);
17931682 diffuseField.addChangeListener(this);
17941683 specularField.addChangeListener(this);
....@@ -1818,12 +1707,15 @@
18181707 opacityPowerField.addChangeListener(this);
18191708 /**/
18201709
1821
- resetSlidersButton.addActionListener(this);
18221710 clearMaterialButton.addActionListener(this);
18231711 createMaterialButton.addActionListener(this);
1824
-
1825
- propagateToggle.addItemListener(this);
1826
- multiplyToggle.addItemListener(this);
1712
+
1713
+ if (Globals.ADVANCED)
1714
+ {
1715
+ resetSlidersButton.addActionListener(this);
1716
+ propagateToggle.addItemListener(this);
1717
+ multiplyToggle.addItemListener(this);
1718
+ }
18271719 }
18281720
18291721 void DropFile(java.io.File[] files, boolean textures)
....@@ -1994,7 +1886,7 @@
19941886
19951887 //? flashIt = false;
19961888 CameraPane pane = (CameraPane) cameraView;
1997
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
19981890 pane.clickEnd(location.x, location.y, 0, true);
19991891
20001892 if (group.selection.size() == 1)
....@@ -2043,6 +1935,7 @@
20431935 e2.printStackTrace();
20441936 }
20451937 }
1938
+
20461939 LoadJMEThread loadThread;
20471940
20481941 class LoadJMEThread extends Thread
....@@ -2100,6 +1993,7 @@
21001993 //LoadFile0(filename, converter);
21011994 }
21021995 }
1996
+
21031997 LoadOBJThread loadObjThread;
21041998
21051999 class LoadOBJThread extends Thread
....@@ -2178,19 +2072,19 @@
21782072
21792073 void LoadObjFile(String fullname)
21802074 {
2181
- /*
2075
+ System.out.println("Loading " + fullname);
2076
+ /**/
21822077 //lastFilename = fullname;
21832078 if(loadObjThread == null)
21842079 {
2185
- loadObjThread = new LoadOBJThread();
2186
- loadObjThread.start();
2080
+ loadObjThread = new LoadOBJThread();
2081
+ loadObjThread.start();
21872082 }
21882083
21892084 loadObjThread.add(fullname);
2190
- */
2085
+ /**/
21912086
2192
- System.out.println("Loading " + fullname);
2193
- makeSomething(new FileObject(fullname, true), true);
2087
+ //makeSomething(new FileObject(fullname, true), true);
21942088 }
21952089
21962090 void LoadGFDFile(String fullname)
....@@ -2451,11 +2345,11 @@
24512345
24522346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24532347 {
2454
- if (GrafreeD.standAlone)
2348
+ if (Grafreed.standAlone)
24552349 {
24562350 /**/
24572351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2458
- browser.show();
2352
+ browser.setVisible(true);
24592353 String filename = browser.getFile();
24602354 if (filename != null && filename.length() > 0)
24612355 {
....@@ -2600,6 +2494,7 @@
26002494 }
26012495 if (input == null)
26022496 {
2497
+ new Exception().printStackTrace();
26032498 System.exit(0);
26042499 }
26052500
....@@ -2814,7 +2709,8 @@
28142709 return;
28152710 }
28162711
2817
- multiplyToggle.setSelected(mat.multiply);
2712
+ if (multiplyToggle != null)
2713
+ multiplyToggle.setSelected(mat.multiply);
28182714
28192715 assert (object.projectedVertices != null);
28202716
....@@ -3029,9 +2925,9 @@
30292925 frame.validate();
30302926
30312927 return;
3032
- } else if (event.getSource() == toggleRandomItem)
2928
+ } else if (event.getSource() == toggleSwitchItem)
30332929 {
3034
- cameraView.ToggleRandom();
2930
+ cameraView.ToggleSwitch();
30352931 cameraView.repaint();
30362932 return;
30372933 } else if (event.getSource() == toggleHandleItem)
....@@ -3060,6 +2956,10 @@
30602956 {
30612957 copy.live ^= true;
30622958 return;
2959
+ } else if (event.getSource() == selectCB)
2960
+ {
2961
+ copy.dontselect ^= true;
2962
+ return;
30632963 } else if (event.getSource() == hideCB)
30642964 {
30652965 copy.hide ^= true;
....@@ -3074,6 +2974,7 @@
30742974 if (event.getSource() == randomCB)
30752975 {
30762976 copy.random ^= true;
2977
+ objEditor.refreshContents();
30772978 return;
30782979 }
30792980 if (event.getSource() == speedupCB)
....@@ -3097,8 +2998,9 @@
30972998
30982999 public void actionPerformed(ActionEvent event)
30993000 {
3001
+ Object source = event.getSource();
31003002 // SCRIPT DIALOG
3101
- if (event.getSource() == okbutton)
3003
+ if (source == okbutton)
31023004 {
31033005 textpanel.setVisible(false);
31043006 textpanel.remove(textarea);
....@@ -3110,7 +3012,7 @@
31103012 textarea = null;
31113013 textpanel = null;
31123014 }
3113
- if (event.getSource() == cancelbutton)
3015
+ if (source == cancelbutton)
31143016 {
31153017 textpanel.setVisible(false);
31163018 textpanel.remove(textarea);
....@@ -3122,49 +3024,50 @@
31223024 //applySelf();
31233025 //client.refreshEditWindow();
31243026 //refreshContents();
3125
- if (event.getSource() == nameField)
3027
+ if (source == nameField)
31263028 {
31273029 //System.out.println("ObjEditor " + event);
31283030 applySelf0(true);
31293031 //parent.applySelf();
31303032 objEditor.refreshContents();
3131
- } else if (event.getSource() == resetButton)
3033
+ } else if (source == resetButton)
31323034 {
31333035 CameraPane.fullreset = true;
31343036 copy.Reset(); // ResetMeshes();
31353037 copy.Touch();
31363038 objEditor.refreshContents();
3137
- } else if (event.getSource() == stepItem)
3039
+ } else if (source == stepItem)
31383040 {
3139
- cameraView.ONESTEP = true;
3041
+ //cameraView.ONESTEP = true;
3042
+ Globals.ONESTEP = true;
31403043 cameraView.repaint();
31413044 return;
3142
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
31433046 {
31443047 copy.Step();
31453048 copy.Touch();
31463049 objEditor.refreshContents();
3147
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
31483051 {
31493052 copy.Slower();
31503053 copy.Touch();
31513054 objEditor.refreshContents();
3152
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
31533056 {
31543057 copy.Faster();
31553058 copy.Touch();
31563059 objEditor.refreshContents();
3157
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
31583061 {
31593062 copy.Remark();
31603063 copy.Touch();
31613064 objEditor.refreshContents();
3162
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
31633066 {
31643067 copy.StepAll();
31653068 copy.Touch();
31663069 objEditor.refreshContents();
3167
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
31683071 {
31693072 //CameraPane.fullreset = true;
31703073 copy.ResetAll(); // ResetMeshes();
....@@ -3197,53 +3100,75 @@
31973100 // Close();
31983101 // }
31993102 // else
3200
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
32013104 {
32023105 ResetSliders();
3203
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
32043107 {
32053108 ClearMaterial();
3206
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
32073110 {
32083111 CreateMaterial();
3209
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
32103113 {
32113114 copy.ClearUI();
32123115 refreshContents(true);
3213
- } /*
3214
- }
3215
-
3216
- public boolean action(Event event, Object arg)
3217
- {
3218
- */ else if (event.getSource() == closeItem)
3116
+ } else if (source == importGFDItem)
3117
+ {
3118
+ ImportGFD();
3119
+ } else
3120
+ if (source == importVRMLX3DItem)
3121
+ {
3122
+ ImportVRMLX3D();
3123
+ } else
3124
+ if (source == import3DSItem)
3125
+ {
3126
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3127
+ } else
3128
+ if (source == importOBJItem)
3129
+ {
3130
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3131
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3132
+ browser.setVisible(true);
3133
+ String filename = browser.getFile();
3134
+ if (filename != null && filename.length() > 0)
3135
+ {
3136
+ String fullname = browser.getDirectory() + filename;
3137
+ makeSomething(ReadOBJ(fullname), true);
3138
+ }
3139
+ } else
3140
+ if (source == closeItem)
32193141 {
32203142 Close();
32213143 //return true;
3222
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
32233145 {
32243146 load();
32253147 //return true;
3226
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
32273152 {
32283153 save();
32293154 //return true;
3230
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
32313156 {
32323157 saveAs();
32333158 //return true;
3234
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
32353160 {
32363161 reexport();
32373162 //return true;
3238
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
32393164 {
32403165 export();
32413166 //return true;
3242
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
32433168 {
32443169 generatePOV();
32453170 //return true;
3246
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
32473172 {
32483173 try
32493174 {
....@@ -3265,21 +3190,8 @@
32653190 cameraView.repaint();
32663191 //return true;
32673192 }
3268
- */ else if (event.getSource() == editCameraItem)
3269
- {
3270
- cameraView.ProtectCamera();
3271
- cameraView.repaint();
3272
- return;
3273
- } else if (event.getSource() == revertCameraItem)
3274
- {
3275
- cameraView.RevertCamera();
3276
- cameraView.repaint();
3277
- return;
3278
-// } else if (event.getSource() == textureButton)
3279
-// {
3280
-// return; // true;
3281
- } else // combos...
3282
- if (event.getSource() == texresMenu)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
32833195 {
32843196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32853197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3291,27 +3203,283 @@
32913203 }
32923204 }
32933205
3294
- void ToggleAnimation()
3206
+ void New()
32953207 {
3296
- if (!CameraPane.ANIMATION)
3208
+ while (copy.Size() > 1)
32973209 {
3298
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3210
+ copy.remove(1);
3211
+ }
3212
+
3213
+ ResetModel();
3214
+ objEditor.refreshContents();
3215
+ }
3216
+
3217
+ static public byte[] Compress(Object3D o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3223
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3224
+
3225
+ Object3D parent = o.parent;
3226
+ o.parent = null;
3227
+
3228
+ out.writeObject(o);
3229
+
3230
+ o.parent = parent;
3231
+
3232
+ out.flush();
3233
+
3234
+ zstream.close();
3235
+ out.close();
3236
+
3237
+ return baos.toByteArray();
3238
+ } catch (Exception e)
3239
+ {
3240
+ System.err.println(e);
3241
+ return null;
3242
+ }
3243
+ }
3244
+
3245
+ static public Object Uncompress(byte[] bytes)
3246
+ {
3247
+ System.out.println("#bytes = " + bytes.length);
3248
+ try
3249
+ {
3250
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3251
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3252
+ ObjectInputStream in = new ObjectInputStream(istream);
3253
+ Object obj = in.readObject();
3254
+ in.close();
3255
+
3256
+ return obj;
3257
+ } catch (Exception e)
3258
+ {
3259
+ System.err.println(e);
3260
+ return null;
3261
+ }
3262
+ }
3263
+
3264
+ static public Object clone(Object o)
3265
+ {
3266
+ try
3267
+ {
3268
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3269
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3270
+
3271
+ out.writeObject(o);
3272
+
3273
+ out.flush();
3274
+ out.close();
3275
+
3276
+ byte[] bytes = baos.toByteArray();
3277
+
3278
+ System.out.println("clone = " + bytes.length);
3279
+
3280
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3281
+ ObjectInputStream in = new ObjectInputStream(bais);
3282
+ Object obj = in.readObject();
3283
+ in.close();
3284
+
3285
+ return obj;
3286
+ } catch (Exception e)
3287
+ {
3288
+ System.err.println(e);
3289
+ return null;
3290
+ }
3291
+ }
3292
+
3293
+ cRadio GetCurrentTab()
3294
+ {
3295
+ cRadio ab;
3296
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3297
+ {
3298
+ ab = (cRadio)e.nextElement();
3299
+ if(ab.GetObject() == copy)
3300
+ {
3301
+ return ab;
3302
+ }
3303
+ }
3304
+
3305
+ return null;
3306
+ }
3307
+
3308
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3309
+
3310
+ public void Save()
3311
+ {
3312
+ cRadio tab = GetCurrentTab();
3313
+
3314
+ boolean temp = CameraPane.SWITCH;
3315
+ CameraPane.SWITCH = false;
3316
+
3317
+ copy.ExtractBigData(hashtable);
3318
+
3319
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3320
+ tab.graphs[tab.undoindex++] = Compress(copy);
3321
+
3322
+ copy.RestoreBigData(hashtable);
3323
+
3324
+ CameraPane.SWITCH = temp;
3325
+
3326
+ //assert(hashtable.isEmpty());
3327
+
3328
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3329
+ {
3330
+ tab.graphs[i] = null;
3331
+ }
3332
+
3333
+ // test save
3334
+ if (false)
3335
+ {
3336
+ try
3337
+ {
3338
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3339
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3340
+
3341
+ p.writeObject(copy);
3342
+
3343
+ p.flush();
3344
+
3345
+ ostream.close();
3346
+ } catch (Exception e)
3347
+ {
3348
+ e.printStackTrace();
3349
+ }
3350
+ }
3351
+ }
3352
+
3353
+ void CopyChanged(Object3D obj)
3354
+ {
3355
+ boolean temp = CameraPane.SWITCH;
3356
+ CameraPane.SWITCH = false;
3357
+
3358
+ copy.ExtractBigData(hashtable);
3359
+
3360
+ copy.clear();
3361
+
3362
+ for (int i=0; i<obj.Size(); i++)
3363
+ {
3364
+ copy.add(obj.get(i));
3365
+ }
3366
+
3367
+ copy.RestoreBigData(hashtable);
3368
+
3369
+ CameraPane.SWITCH = temp;
3370
+
3371
+ //assert(hashtable.isEmpty());
3372
+
3373
+ copy.Touch();
3374
+
3375
+ ResetModel();
3376
+ copy.HardTouch(); // recompile?
3377
+
3378
+ cRadio ab;
3379
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3380
+ {
3381
+ ab = (cRadio)e.nextElement();
3382
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3383
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3384
+ if (test != null)
3385
+ {
3386
+ test.editWindow = ab.object.editWindow;
3387
+ ab.object = test;
3388
+ }
3389
+ }
3390
+
3391
+ refreshContents();
3392
+ }
3393
+
3394
+ public void Undo()
3395
+ {
3396
+ cRadio tab = GetCurrentTab();
3397
+
3398
+ if (tab.undoindex == 0)
3399
+ {
3400
+ java.awt.Toolkit.getDefaultToolkit().beep();
3401
+ return;
3402
+ }
3403
+
3404
+ if (tab.graphs[tab.undoindex] == null)
3405
+ {
3406
+ Save();
3407
+ tab.undoindex -= 1;
3408
+ }
3409
+
3410
+ tab.undoindex -= 1;
3411
+
3412
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3413
+ }
3414
+
3415
+ public void Redo()
3416
+ {
3417
+ cRadio tab = GetCurrentTab();
3418
+
3419
+ if (tab.graphs[tab.undoindex + 1] == null)
3420
+ {
3421
+ java.awt.Toolkit.getDefaultToolkit().beep();
3422
+ return;
3423
+ }
3424
+
3425
+ tab.undoindex += 1;
3426
+
3427
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3428
+ }
3429
+
3430
+ void ImportGFD()
3431
+ {
3432
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32993433 browser.show();
33003434 String filename = browser.getFile();
33013435 if (filename != null && filename.length() > 0)
33023436 {
3303
- CameraPane.filename = browser.getDirectory() + filename;
3437
+ String fullname = browser.getDirectory() + filename;
3438
+
3439
+ //Object3D readobj =
3440
+ objEditor.ReadGFD(fullname, objEditor);
3441
+ //makeSomething(readobj);
3442
+ }
3443
+ }
3444
+
3445
+ void ImportVRMLX3D()
3446
+ {
3447
+ if (Grafreed.standAlone)
3448
+ {
3449
+ /**/
3450
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3451
+ browser.show();
3452
+ String filename = browser.getFile();
3453
+ if (filename != null && filename.length() > 0)
3454
+ {
3455
+ String fullname = browser.getDirectory() + filename;
3456
+ LoadVRMLX3D(fullname);
3457
+ }
3458
+ /**/
3459
+ }
3460
+ }
3461
+
3462
+ void ToggleAnimation()
3463
+ {
3464
+ if (!Globals.ANIMATION)
3465
+ {
3466
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3467
+ browser.setVisible(true);
3468
+ String filename = browser.getFile();
3469
+ if (filename != null && filename.length() > 0)
3470
+ {
3471
+ Globals.filename = browser.getDirectory() + filename;
33043472 //CameraPane.framecount = 0;
3305
- CameraPane.imagecount = 0;
3473
+ Globals.imagecount = 0;
33063474
3307
- CameraPane.ANIMATION ^= true;
3475
+ Globals.ANIMATION ^= true;
33083476
3309
- GrafreeD.wav.cursor = 0;
3310
- GrafreeD.wav.loop = 0;
3477
+ Grafreed.wav.cursor = 0;
3478
+ Grafreed.wav.loop = 0;
33113479 }
33123480 } else
33133481 {
3314
- CameraPane.ANIMATION ^= true;
3482
+ Globals.ANIMATION ^= true;
33153483 }
33163484 }
33173485
....@@ -3357,7 +3525,7 @@
33573525 void CreateMaterial()
33583526 {
33593527 //copy.ClearMaterial(); // PATCH
3360
- copy.CreateMaterialS(multiplyToggle.isSelected());
3528
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33613529 if (copy.selection.size() > 0)
33623530 //SetMaterial(copy);
33633531 {
....@@ -3416,11 +3584,11 @@
34163584 {
34173585 copy.ResetBlockLoop(); // temporary problem
34183586
3419
- boolean random = CameraPane.RANDOM;
3420
- CameraPane.RANDOM = false; // parse everything
3587
+ boolean random = CameraPane.SWITCH;
3588
+ CameraPane.SWITCH = false; // parse everything
34213589 copy.ResetDisplayList();
34223590 copy.HardTouch();
3423
- CameraPane.RANDOM = random;
3591
+ CameraPane.SWITCH = random;
34243592 }
34253593
34263594 // public void applySelf()
....@@ -3490,10 +3658,40 @@
34903658 current.fakedepth = (float) fakedepthField.getFloat();
34913659 current.shadowbias = (float) shadowbiasField.getFloat();
34923660
3493
- if (!NumberSlider.frozen)
3661
+ if (!cNumberSlider.frozen)
34943662 {
34953663 //System.out.println("Propagate = " + propagate);
34963664 copy.UpdateMaterial(anchor, current, propagate);
3665
+
3666
+ if (copy.material != null)
3667
+ {
3668
+ cMaterial mat = copy.material;
3669
+
3670
+ colorField.SetToolTipValue((mat.color));
3671
+ modulationField.SetToolTipValue((mat.modulation));
3672
+ metalnessField.SetToolTipValue((mat.metalness));
3673
+ diffuseField.SetToolTipValue((mat.diffuse));
3674
+ specularField.SetToolTipValue((mat.specular));
3675
+ shininessField.SetToolTipValue((mat.shininess));
3676
+ shiftField.SetToolTipValue((mat.shift));
3677
+ ambientField.SetToolTipValue((mat.ambient));
3678
+ lightareaField.SetToolTipValue((mat.lightarea));
3679
+ diffusenessField.SetToolTipValue((mat.factor));
3680
+ velvetField.SetToolTipValue((mat.velvet));
3681
+ sheenField.SetToolTipValue((mat.sheen));
3682
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3683
+ backlitField.SetToolTipValue((mat.bump));
3684
+ anisoField.SetToolTipValue((mat.aniso));
3685
+ anisoVField.SetToolTipValue((mat.anisoV));
3686
+ cameraField.SetToolTipValue((mat.cameralight));
3687
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3688
+ shadowField.SetToolTipValue((mat.shadow));
3689
+ textureField.SetToolTipValue((mat.texture));
3690
+ opacityField.SetToolTipValue((mat.opacity));
3691
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3692
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3693
+ }
3694
+
34973695 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34983696 {
34993697 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3538,6 +3736,7 @@
35383736 || e.getSource() == apertureField
35393737 || e.getSource() == shadowblurField)
35403738 {
3739
+ new Exception().printStackTrace();
35413740 System.exit(0);
35423741 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35433742 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3608,7 +3807,7 @@
36083807 }
36093808
36103809 if (normalpushField != null)
3611
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3810
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36123811 }
36133812
36143813 void SnapObject()
....@@ -3863,7 +4062,7 @@
38634062
38644063 radioPanel.revalidate();
38654064 radioPanel.repaint();
3866
- ctrlPanel.revalidate(); // ? new
4065
+ ctrlPanel.validate(); // ? new
38674066 ctrlPanel.repaint();
38684067 }
38694068 }
....@@ -3872,6 +4071,7 @@
38724071
38734072 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38744073 {
4074
+ Save();
38754075 //Tween.set(thing, 0).target(1).start(tweenManager);
38764076 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38774077 // if (thing instanceof GenericJointDemo)
....@@ -4075,6 +4275,7 @@
40754275 }
40764276 }
40774277 }
4278
+
40784279 LoadGFDThread loadGFDThread;
40794280
40804281 void ReadGFD(String fullname, iCallBack cb)
....@@ -4094,8 +4295,10 @@
40944295
40954296 try
40964297 {
4298
+ // Try compressed version first.
40974299 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4098
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4300
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4301
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40994302
41004303 readobj = (Object3D) p.readObject();
41014304 istream.close();
....@@ -4103,7 +4306,20 @@
41034306 readobj.ResetDisplayList();
41044307 } catch (Exception e)
41054308 {
4106
- e.printStackTrace();
4309
+ //e.printStackTrace();
4310
+ try
4311
+ {
4312
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4313
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4314
+
4315
+ readobj = (Object3D) p.readObject();
4316
+ istream.close();
4317
+
4318
+ readobj.ResetDisplayList();
4319
+ } catch (Exception e2)
4320
+ {
4321
+ e2.printStackTrace();
4322
+ }
41074323 }
41084324 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41094325 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4149,6 +4365,12 @@
41494365
41504366 void LoadIt(Object obj)
41514367 {
4368
+ if (obj == null)
4369
+ {
4370
+ // Invalid file
4371
+ return;
4372
+ }
4373
+
41524374 System.out.println("Loaded " + obj);
41534375 //new Exception().printStackTrace();
41544376 Object3D readobj = (Object3D) obj;
....@@ -4158,6 +4380,7 @@
41584380
41594381 if (readobj != null)
41604382 {
4383
+ Save();
41614384 try
41624385 {
41634386 //readobj.deepCopySelf(copy);
....@@ -4220,7 +4443,7 @@
42204443
42214444 void load() // throws ClassNotFoundException
42224445 {
4223
- if (GrafreeD.standAlone)
4446
+ if (Grafreed.standAlone)
42244447 {
42254448 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42264449 browser.show();
....@@ -4307,11 +4530,13 @@
43074530 try
43084531 {
43094532 FileOutputStream ostream = new FileOutputStream(lastname);
4310
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4533
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4534
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43114535
43124536 p.writeObject(copy);
43134537 p.flush();
43144538
4539
+ zstream.close();
43154540 ostream.close();
43164541
43174542 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4321,11 +4546,12 @@
43214546 {
43224547 }
43234548 }
4549
+
43244550 String lastname;
43254551
43264552 void saveAs()
43274553 {
4328
- if (GrafreeD.standAlone)
4554
+ if (Grafreed.standAlone)
43294555 {
43304556 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43314557 browser.setVisible(true);
....@@ -4430,13 +4656,13 @@
44304656 try
44314657 {
44324658 FileOutputStream ostream = new FileOutputStream(filename);
4433
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4434
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4659
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4660
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44354661
44364662 Object3D objectparent = obj.parent;
44374663 obj.parent = null;
44384664
4439
- Object3D object = (Object3D) GrafreeD.clone(obj);
4665
+ Object3D object = (Object3D) Grafreed.clone(obj);
44404666
44414667 obj.parent = objectparent;
44424668
....@@ -4448,8 +4674,8 @@
44484674 p.writeObject(object);
44494675 p.flush();
44504676
4677
+ zstream.close();
44514678 ostream.close();
4452
- // zstream.close();
44534679
44544680 // group.selection.get(0).parent = parent;
44554681 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4470,7 +4696,7 @@
44704696 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44714697 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44724698 copy.generatePOV(buffer);
4473
- if (GrafreeD.standAlone)
4699
+ if (Grafreed.standAlone)
44744700 {
44754701 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44764702 browser.show();
....@@ -4496,7 +4722,8 @@
44964722 Object3D client;
44974723 Object3D copy;
44984724 MenuBar menuBar;
4499
- Menu windowMenu;
4725
+ Menu fileMenu;
4726
+ MenuItem newItem;
45004727 MenuItem loadItem;
45014728 MenuItem saveItem;
45024729 MenuItem saveAsItem;
....@@ -4504,13 +4731,11 @@
45044731 MenuItem reexportItem;
45054732 MenuItem povItem;
45064733 MenuItem closeItem;
4507
- Menu cameraMenu;
4734
+
45084735 CheckboxMenuItem zBufferItem;
45094736 //MenuItem normalLensItem;
4510
- MenuItem editCameraItem;
4511
- MenuItem revertCameraItem;
4512
- CheckboxMenuItem toggleLiveItem;
45134737 MenuItem stepItem;
4738
+ CheckboxMenuItem toggleLiveItem;
45144739 CheckboxMenuItem toggleFullScreenItem;
45154740 CheckboxMenuItem toggleTimelineItem;
45164741 CheckboxMenuItem toggleRenderItem;
....@@ -4519,7 +4744,7 @@
45194744 CheckboxMenuItem toggleFootContactItem;
45204745 CheckboxMenuItem toggleDLItem;
45214746 CheckboxMenuItem toggleTextureItem;
4522
- CheckboxMenuItem toggleRandomItem;
4747
+ CheckboxMenuItem toggleSwitchItem;
45234748 CheckboxMenuItem toggleRootItem;
45244749 CheckboxMenuItem animationItem;
45254750 CheckboxMenuItem toggleHandleItem;
....@@ -4527,20 +4752,20 @@
45274752 JSplitPane mainPanel;
45284753 JScrollPane scrollpane;
45294754 JPanel toolbarPanel;
4530
- JPanel treePanel;
4755
+ cGridBag treePanel;
45314756 JPanel radioPanel;
45324757 ButtonGroup buttonGroup;
4533
- JPanel ctrlPanel;
4534
- JPanel materialPanel;
4758
+ cGridBag ctrlPanel;
4759
+ cGridBag materialPanel;
45354760 JScrollPane infoPanel;
4536
- JPanel optionsPanel;
4761
+ cGridBag optionsPanel;
45374762 JTabbedPane objectPanel;
4538
- JPanel XYZPanel;
4763
+ cGridBag XYZPanel;
45394764 JSplitPane gridPanel;
45404765 JSplitPane bigPanel;
4541
- JPanel bigThree;
4542
- JTabbedPane scenePanel;
4543
- JPanel centralPanel;
4766
+ cGridBag bigThree;
4767
+ cGridBag scenePanel;
4768
+ cGridBag centralPanel;
45444769 JSplitPane cameraPanel;
45454770 JPanel timelinePanel;
45464771 JMenuBar timelineMenubar;
....@@ -4593,67 +4818,72 @@
45934818 // MATERIAL
45944819 JLabel materialLabel;
45954820 JLabel colorLabel;
4596
- NumberSlider colorField;
4821
+ cNumberSlider colorField;
45974822 JLabel modulationLabel;
4598
- NumberSlider modulationField;
4823
+ cNumberSlider modulationField;
45994824 JLabel metalnessLabel;
4600
- NumberSlider metalnessField;
4825
+ cNumberSlider metalnessField;
46014826 JLabel diffuseLabel;
4602
- NumberSlider diffuseField;
4827
+ cNumberSlider diffuseField;
46034828 JLabel specularLabel;
4604
- NumberSlider specularField;
4829
+ cNumberSlider specularField;
46054830 JLabel shininessLabel;
4606
- NumberSlider shininessField;
4831
+ cNumberSlider shininessField;
46074832 JLabel shiftLabel;
4608
- NumberSlider shiftField;
4833
+ cNumberSlider shiftField;
46094834 JLabel ambientLabel;
4610
- NumberSlider ambientField;
4835
+ cNumberSlider ambientField;
46114836 JLabel lightareaLabel;
4612
- NumberSlider lightareaField;
4837
+ cNumberSlider lightareaField;
46134838 JLabel diffusenessLabel;
4614
- NumberSlider diffusenessField;
4839
+ cNumberSlider diffusenessField;
46154840 JLabel velvetLabel;
4616
- NumberSlider velvetField;
4841
+ cNumberSlider velvetField;
46174842 JLabel sheenLabel;
4618
- NumberSlider sheenField;
4843
+ cNumberSlider sheenField;
46194844 JLabel subsurfaceLabel;
4620
- NumberSlider subsurfaceField;
4845
+ cNumberSlider subsurfaceField;
46214846 //JLabel bumpLabel;
46224847 //NumberSlider bumpField;
46234848 JLabel backlitLabel;
4624
- NumberSlider backlitField;
4849
+ cNumberSlider backlitField;
46254850 JLabel anisoLabel;
4626
- NumberSlider anisoField;
4851
+ cNumberSlider anisoField;
46274852 JLabel anisoVLabel;
4628
- NumberSlider anisoVField;
4853
+ cNumberSlider anisoVField;
46294854 JLabel cameraLabel;
4630
- NumberSlider cameraField;
4855
+ cNumberSlider cameraField;
46314856 JLabel selfshadowLabel;
4632
- NumberSlider selfshadowField;
4857
+ cNumberSlider selfshadowField;
46334858 JLabel shadowLabel;
4634
- NumberSlider shadowField;
4859
+ cNumberSlider shadowField;
46354860 JLabel textureLabel;
4636
- NumberSlider textureField;
4861
+ cNumberSlider textureField;
46374862 JLabel opacityLabel;
4638
- NumberSlider opacityField;
4863
+ cNumberSlider opacityField;
46394864 JLabel fakedepthLabel;
4640
- NumberSlider fakedepthField;
4865
+ cNumberSlider fakedepthField;
46414866 JLabel shadowbiasLabel;
4642
- NumberSlider shadowbiasField;
4867
+ cNumberSlider shadowbiasField;
46434868 JLabel bumpLabel;
4644
- NumberSlider bumpField;
4869
+ cNumberSlider bumpField;
46454870 JLabel noiseLabel;
4646
- NumberSlider noiseField;
4871
+ cNumberSlider noiseField;
46474872 JLabel powerLabel;
4648
- NumberSlider powerField;
4873
+ cNumberSlider powerField;
46494874 JLabel borderfadeLabel;
4650
- NumberSlider borderfadeField;
4875
+ cNumberSlider borderfadeField;
46514876 JLabel fogLabel;
4652
- NumberSlider fogField;
4877
+ cNumberSlider fogField;
46534878 JLabel opacityPowerLabel;
4654
- NumberSlider opacityPowerField;
4879
+ cNumberSlider opacityPowerField;
46554880 JTree jTree;
46564881 //ObjectUI parent;
46574882
4658
- NumberSlider normalpushField;
4883
+ cNumberSlider normalpushField;
4884
+
4885
+ private MenuItem importGFDItem;
4886
+ private MenuItem importVRMLX3DItem;
4887
+ private MenuItem import3DSItem;
4888
+ private MenuItem importOBJItem;
46594889 }