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,51 +126,62 @@
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);
169
+
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);
163177 }
164178
165179 public ObjEditor GetEditor()
166180 {
167181 return objEditor; //.GetEditor();
168182 }
183
+
184
+ // Sometimes myself, sometimes my callee's.
169185 ObjEditor objEditor;
170186
171187 /*
....@@ -261,24 +277,40 @@
261277 void SetupMenu()
262278 {
263279 frame.setMenuBar(menuBar = new MenuBar());
264
- menuBar.add(windowMenu = new Menu("File"));
265
- windowMenu.add(loadItem = new MenuItem("Load..."));
266
- windowMenu.add("-");
267
- windowMenu.add(saveItem = new MenuItem("Save"));
268
- 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..."));
269300 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
270
- windowMenu.add("-");
271
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
272
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
273
- windowMenu.add("-");
301
+ fileMenu.add("-");
302
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
303
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
304
+ fileMenu.add("-");
274305 if (client.parent != null)
275306 {
276
- windowMenu.add(closeItem = new MenuItem("Close"));
307
+ fileMenu.add(closeItem = new MenuItem("Close"));
277308 } else
278309 {
279
- windowMenu.add(closeItem = new MenuItem("Exit"));
310
+ fileMenu.add(closeItem = new MenuItem("Exit"));
280311 }
281312
313
+ newItem.addActionListener(this);
282314 loadItem.addActionListener(this);
283315 saveItem.addActionListener(this);
284316 saveAsItem.addActionListener(this);
....@@ -287,79 +319,26 @@
287319 //povItem.addActionListener(this);
288320 closeItem.addActionListener(this);
289321
290
- menuBar.add(cameraMenu = new Menu("View"));
291
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
292
- //zBufferItem.addActionListener(this);
293
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
294
- //normalLensItem.addActionListener(this);
295
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
296
- revertCameraItem.addActionListener(this);
297
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
298
- toggleTimelineItem.addItemListener(this);
299
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
300
- toggleFullScreenItem.addItemListener(this);
301
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
302
- cameraMenu.add("-");
303
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
304
- toggleTextureItem.addItemListener(this);
305
- toggleTextureItem.setState(CameraPane.textureon);
306
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
307
- toggleLiveItem.addItemListener(this);
308
- toggleLiveItem.setState(CameraPane.isLIVE());
309
- cameraMenu.add(stepItem = new MenuItem("Step"));
310
- stepItem.addActionListener(this);
311
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
312
-// toggleDLItem.addItemListener(this);
313
-// toggleDLItem.setState(false);
314
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
315
- toggleRenderItem.addItemListener(this);
316
- toggleRenderItem.setState(!CameraPane.frozen);
317
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
318
- toggleDebugItem.addItemListener(this);
319
- toggleDebugItem.setState(CameraPane.DEBUG);
320
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
321
- toggleFrustumItem.addItemListener(this);
322
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
323
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
324
- toggleFootContactItem.addItemListener(this);
325
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
326
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
327
- toggleRandomItem.addItemListener(this);
328
- toggleRandomItem.setState(CameraPane.RANDOM);
329
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
330
- toggleHandleItem.addItemListener(this);
331
- toggleHandleItem.setState(CameraPane.HANDLES);
332
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
333
- togglePaintItem.addItemListener(this);
334
- togglePaintItem.setState(CameraPane.PAINTMODE);
335
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
336
-// toggleRootItem.addItemListener(this);
337
-// toggleRootItem.setState(false);
338
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
339
-// animationItem.addItemListener(this);
340
-// animationItem.setState(CameraPane.ANIMATION);
341
- cameraMenu.add("-");
342
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
343
- editCameraItem.addActionListener(this);
344
-
345322 objectPanel = new JTabbedPane();
346323 toolbarPanel = new JPanel();
347324 toolbarPanel.setName("Toolbar");
348
- treePanel = new JPanel();
325
+ treePanel = new cGridBag();
349326 treePanel.setName("Tree");
350
- ctrlPanel = new JPanel(); // new GridBagLayout());
327
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
351328 ctrlPanel.setName("Edit");
352
- materialPanel = new JPanel();
329
+ materialPanel = new cGridBag().setVertical(true);
353330 materialPanel.setName("Material");
354331 /*JTextPane*/
355332 infoarea = createTextPane();
333
+ doc = infoarea.getStyledDocument();
334
+
356335 infoarea.setEditable(true);
357336 SetText();
358337 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
359338 // infoarea.setOpaque(false);
360339 // //infoarea.setForeground(textcolor);
361
- infoarea.setLineWrap(true);
362
- infoarea.setWrapStyleWord(true);
340
+// TEXTAREA infoarea.setLineWrap(true);
341
+// TEXTAREA infoarea.setWrapStyleWord(true);
363342 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
364343 infoPanel.setPreferredSize(new Dimension(50, 200));
365344 infoPanel.setName("Info");
....@@ -370,16 +349,16 @@
370349 mainPanel.setName("Main");
371350 mainPanel.setContinuousLayout(true);
372351 mainPanel.setOneTouchExpandable(true);
373
- mainPanel.setDividerLocation(1.0);
374352 mainPanel.setDividerSize(9);
375
- mainPanel.setResizeWeight(0);
353
+ mainPanel.setDividerLocation(0.5); //1.0);
354
+ mainPanel.setResizeWeight(0.5);
376355
377356 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
378357 //mainPanel.setLayout(new GridBagLayout());
379358 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
380
- treePanel.setLayout(new GridBagLayout());
381
- ctrlPanel.setLayout(new GridBagLayout());
382
- materialPanel.setLayout(new GridBagLayout());
359
+// treePanel.setLayout(new GridBagLayout());
360
+ //ctrlPanel.setLayout(new GridBagLayout());
361
+ //materialPanel.setLayout(new GridBagLayout());
383362
384363 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
385364 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -418,7 +397,7 @@
418397 static String newline = "\n";
419398 protected static final String buttonString = "JButton";
420399 StyledDocument doc;
421
- JTextArea infoarea;
400
+ JTextPane infoarea;
422401
423402 void ClearInfo()
424403 {
....@@ -441,10 +420,10 @@
441420 e.printStackTrace();
442421 }
443422
444
- String selection = infoarea.getText();
445
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
446
- java.awt.datatransfer.Clipboard clipboard =
447
- 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();
448427 //clipboard.setContents(data, data);
449428 }
450429
....@@ -467,13 +446,13 @@
467446 //SendInfo("Name:", "bold");
468447 if (sel.GetTextures() != null || debug)
469448 {
470
- si.SendInfo(sel.toString(), "bold");
449
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
471450 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
472451 if (sel.Size() > 0)
473452 {
474453 si.SendInfo("#children = " + sel.Size(), "regular");
475454 }
476
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
455
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
477456 if (debug)
478457 {
479458 try
....@@ -485,7 +464,10 @@
485464 }
486465
487466 if (full)
488
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
467
+ {
468
+ si.SendInfo(" BBox min: " + minima, "regular");
469
+ si.SendInfo(" BBox max: " + maxima, "regular");
470
+ }
489471
490472 if (sel.bRep != null)
491473 {
....@@ -512,7 +494,7 @@
512494 }
513495 if (sel.support != null)
514496 {
515
- si.SendInfo(" support: " + sel.support, "regular");
497
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
516498 }
517499 if (sel.scriptnode != null)
518500 {
....@@ -583,6 +565,9 @@
583565 {
584566 CameraPane.pointflow = (PointFlow) sel;
585567 }
568
+
569
+ si.SendInfo("_____________________", "regular");
570
+ si.SendInfo("", "regular");
586571 }
587572 }
588573
....@@ -614,52 +599,52 @@
614599 cameraView.ToggleFullScreen();
615600 }
616601
617
- private JTextArea createTextPane()
602
+ private JTextPane createTextPane()
618603 {
619
- String[] initString =
620
- {
621
- "This is an editable JTextPane, ", //regular
622
- "another ", //italic
623
- "styled ", //bold
624
- "text ", //small
625
- "component, ", //large
626
- "which supports embedded components..." + newline,//regular
627
- " " + newline, //button
628
- "...and embedded icons..." + newline, //regular
629
- " ", //icon
630
- newline + "JTextPane is a subclass of JEditorPane that "
631
- + "uses a StyledEditorKit and StyledDocument, and provides "
632
- + "cover methods for interacting with those objects."
633
- };
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
+// }
634646
635
- String[] initStyles =
636
- {
637
- "regular", "italic", "bold", "small", "large",
638
- "regular", "button", "regular", "icon",
639
- "regular"
640
- };
641
-
642
- JTextPane textPane = new JTextPane();
643
- textPane.setEditable(true);
644
- /*StyledDocument*/ doc = textPane.getStyledDocument();
645
- addStylesToDocument(doc);
646
-
647
- try
648
- {
649
- for (int j = 0; j < 2; j++)
650
- {
651
- for (int i = 0; i < initString.length; i++)
652
- {
653
- doc.insertString(doc.getLength(), initString[i],
654
- doc.getStyle(initStyles[i]));
655
- }
656
- }
657
- } catch (BadLocationException ble)
658
- {
659
- System.err.println("Couldn't insert initial text into text pane.");
660
- }
661
-
662
- return new JTextArea(); // textPane;
647
+ return new JTextPane(); // textPane;
663648 }
664649
665650 protected void addStylesToDocument(StyledDocument doc)
....@@ -712,7 +697,7 @@
712697 protected static ImageIcon createImageIcon(String path,
713698 String description)
714699 {
715
- java.net.URL imgURL = GrafreeD.class.getResource(path);
700
+ java.net.URL imgURL = Grafreed.class.getResource(path);
716701 if (imgURL != null)
717702 {
718703 return new ImageIcon(imgURL, description);
....@@ -744,6 +729,7 @@
744729 // NumberSlider vDivsField;
745730 // JCheckBox endcaps;
746731 JCheckBox liveCB;
732
+ JCheckBox selectCB;
747733 JCheckBox hideCB;
748734 JCheckBox link2masterCB;
749735 JCheckBox markCB;
....@@ -759,115 +745,84 @@
759745 JButton slowerButton;
760746 JButton fasterButton;
761747 JButton remarkButton;
748
+
749
+ cGridBag namePanel;
750
+ cGridBag setupPanel;
751
+ cGridBag setupPanel2;
752
+ cGridBag commandsPanel;
753
+ cGridBag pushPanel;
754
+ cGridBag fillPanel;
762755
763
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
756
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
764757 {
765758 JCheckBox cb;
766759
767
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
768
- oe.aConstraints.gridwidth = 1; // 3;
769
-// oe.aConstraints.weightx = 1;
770
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
771
- 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);
772761 cb.addItemListener(this);
773
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
774
- oe.aConstraints.gridwidth = 1;
775
- oe.aConstraints.gridx += 1;
776762
777763 return cb;
778764 }
779765
780
- cButton AddButton(ObjEditor oe, String label)
766
+ cButton AddButton(cGridBag panel, String label)
781767 {
782768 cButton cb;
783769
784
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
785
- oe.aConstraints.gridwidth = 1;
786
-// oe.aConstraints.weightx = 1;
787
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
788
- 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);
789771 cb.addActionListener(this);
790
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
791
- oe.aConstraints.gridwidth = 1;
792
- oe.aConstraints.gridx += 1;
793772
794773 return cb;
795774 }
796775
797
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
776
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
798777 {
799778 JComboBox combo;
800779
801
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
802
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- oe.aConstraints.gridx += 1;
780
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
804781 combo.addActionListener(this);
805782
806783 return combo;
807784 }
808785
809
- 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)
810787 {
811
- NumberSlider combo;
788
+ cGridBag control = new cGridBag();
789
+
790
+ cNumberSlider combo;
812791
813792 JLabel jlabel = new JLabel(label);
814
-
815
- aConstraints.fill = GridBagConstraints.VERTICAL;
816793 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
817
- aConstraints.gridwidth = 2;
818
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
819
- aConstraints.gridx += 1;
820
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
821
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
822
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
823
- aConstraints.gridx += 1;
824
- aConstraints.gridwidth = 1;
825
-
794
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
795
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
826796 combo.setFloat(current);
827
-
828
- combo.label = jlabel;
829
-
830
- combo.addChangeListener(this);
831
-
832
- return combo;
797
+
798
+ panel.add(control);
799
+
800
+ return control;
833801 }
834802
835
- 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)
836804 {
837
- NumberSlider combo;
805
+ cGridBag control = new cGridBag();
806
+
807
+ cNumberSlider combo;
838808
839809 JLabel jlabel = new JLabel(label);
840
-
841
- aConstraints.fill = GridBagConstraints.VERTICAL;
842810 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
843
- aConstraints.gridwidth = 2;
844
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
845
- aConstraints.gridx += 1;
846
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
847
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
848
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851
-
811
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
852813 combo.setInteger(current);
853814
854
- combo.label = jlabel;
855
-
856
- combo.addChangeListener(this);
857
-
858
- return combo;
815
+ panel.add(control);
816
+
817
+ return control;
859818 }
860819
861
- JTextArea AddText(JPanel ctrlPanel, String name)
820
+ JTextArea AddText(cGridBag ctrlPanel, String name)
862821 {
863822 JTextArea text;
864823
865
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
866
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
867
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
824
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
868825 text.addCaretListener(this);
869
- aConstraints.gridx += 1;
870
- aConstraints.gridwidth = 1;
871826
872827 return text;
873828 }
....@@ -897,9 +852,16 @@
897852 objEditor.ctrlPanel.remove(j);
898853 }
899854
855
+ void Remove(cNumberSlider j)
856
+ {
857
+ j.removeChangeListener(this);
858
+ //objEditor.ctrlPanel.remove(j.label);
859
+ objEditor.ctrlPanel.remove(j);
860
+ }
861
+
900862 /*
901863 */
902
- void Return() // ObjEditor oe)
864
+ void Return0() // ObjEditor oe)
903865 {
904866 aConstraints.gridy += 1;
905867 aConstraints.gridx = 0;
....@@ -954,35 +916,77 @@
954916
955917 void SetupUI2(ObjEditor oe)
956918 {
957
-// oe.aConstraints.weightx = 0;
958
-// oe.aConstraints.weighty = 0;
959
-// oe.aConstraints.gridx = 0;
960
-// oe.aConstraints.gridy = 0;
961
- 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();
962928
963929 if (!GroupEditor.allparams)
964930 return;
965931
966
- liveCB = AddCheckBox(oe, "Live", copy.live);
967
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
968
- 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");
969938 // Return();
970
- markCB = AddCheckBox(oe, "Mark", copy.marked);
971
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
972
- randomCB = AddCheckBox(oe, "Rand", copy.random);
973
- Return();
974
- resetButton = AddButton(oe, "Reset");
975
- 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");
976971 // resetAllButton = AddButton(oe, "Reset All");
977972 // stepAllButton = AddButton(oe, "Step All");
978
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
979973 // Return();
980
- slowerButton = AddButton(oe, "Slow");
981
- fasterButton = AddButton(oe, "Fast");
982
- 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");
983980
984
- Return();
981
+ oe.ctrlPanel.add(commandsPanel);
982
+ oe.ctrlPanel.Return();
985983
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();
989
+
986990 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
987991 // ObjEditor.aConstraints.gridx += 1;
988992
....@@ -1076,7 +1080,7 @@
10761080 oe.aConstraints.gridwidth = 1;
10771081 /**/
10781082 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1083
+ oe.ctrlPanel.Return();
10801084
10811085 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821086 //textureButton.setEnabled(false);
....@@ -1178,10 +1182,18 @@
11781182 //JPanel worldPanel =
11791183 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11801184 //worldPanel.setName("World");
1181
- centralPanel = new JPanel(new BorderLayout());
1185
+ centralPanel = new cGridBag();
1186
+ centralPanel.preferredWidth = 20;
11821187 timelinePanel = new JPanel(new BorderLayout());
11831188 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11841189
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
+
11851197 centralPanel.add(cameraView);
11861198 //frame.setJMenuBar(timelineMenubar);
11871199 //centralPanel.add(timelinePanel);
....@@ -1201,12 +1213,13 @@
12011213 //frontView.object = copy;
12021214 //sideView.object = copy;
12031215
1204
- XYZPanel = new JPanel();
1205
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1216
+ XYZPanel = new cGridBag().setVertical(true);
1217
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12061218
1207
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1208
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1209
- 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);
12101223
12111224 /*
12121225 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1244,10 +1257,11 @@
12441257 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12451258 //tmp.setName("Edit");
12461259 objectPanel.add(materialPanel);
1247
- JPanel north = new JPanel(new BorderLayout());
1248
- north.setName("Edit");
1249
- north.add(ctrlPanel, BorderLayout.NORTH);
1250
- 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);
12511265 objectPanel.add(infoPanel);
12521266
12531267 /*
....@@ -1268,16 +1282,23 @@
12681282 scrollpane.setWheelScrollingEnabled(true);
12691283 scrollpane.addMouseWheelListener(this); // Default not fast enough
12701284
1271
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1272
- scenePanel.add(scrollpane);
1285
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1286
+ scenePanel.preferredWidth = 6;
1287
+
1288
+ JTabbedPane tabbedPane = new JTabbedPane();
1289
+ tabbedPane.add(scrollpane);
12731290
1274
- scenePanel.add(FSPane = new cFileSystemPane(this));
1291
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12751292
1276
- optionsPanel = new JPanel(new GridBagLayout());
1293
+ optionsPanel = new cGridBag().setVertical(true);
12771294
12781295 optionsPanel.setName("Options");
1279
- scenePanel.add(optionsPanel);
1280
-
1296
+
1297
+ AddOptions(optionsPanel); //, aConstraints);
1298
+
1299
+ tabbedPane.add(optionsPanel);
1300
+
1301
+ scenePanel.add(tabbedPane);
12811302
12821303 /*
12831304 cTree jTree = new cTree(null);
....@@ -1311,6 +1332,7 @@
13111332 //bigPanel.setSize(new Dimension(10,10));
13121333 //bigPanel.add(ctrlPanel);
13131334 //bigPanel.add(gridPanel);
1335
+ /**
13141336 bigThree = new JPanel();
13151337 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13161338 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1334,7 +1356,13 @@
13341356 // aConstraints.gridheight = 3;
13351357 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13361358 bigThree.add(XYZPanel, aWindowConstraints);
1359
+ /**/
13371360
1361
+ bigThree = new cGridBag();
1362
+ bigThree.addComponent(scenePanel);
1363
+ bigThree.addComponent(centralPanel);
1364
+ bigThree.addComponent(XYZPanel);
1365
+
13381366 // // SIDE EFFECT!!!
13391367 // aConstraints.gridx = 0;
13401368 // aConstraints.gridy = 0;
....@@ -1355,13 +1383,14 @@
13551383 //worldPane.add(bigPanel);
13561384 //worldPane.add(worldPanel);
13571385 /**/
1358
- frame.getContentPane().add(/*"Center",*/framePanel);
1386
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1387
+ frame.add(/*"Center",*/framePanel);
13591388 //frame.getContentPane().add(/*"Center",*/ worldPane);
13601389
13611390 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13621391
1363
- frame.setSize(1024, 768);
1364
- frame.show();
1392
+ frame.setSize(1280, 860);
1393
+ frame.setVisible(true);
13651394
13661395 gridPanel.setDividerLocation(1.0);
13671396
....@@ -1376,6 +1405,10 @@
13761405 });
13771406 }
13781407
1408
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1409
+ {
1410
+ }
1411
+
13791412 JTree GetTree()
13801413 {
13811414 return objEditor.jTree;
....@@ -1387,260 +1420,173 @@
13871420 ctrlPanel.removeAll();
13881421 }
13891422
1390
- void SetupMaterial(JPanel ctrlPanel)
1423
+ void SetupMaterial(cGridBag panel)
13911424 {
1392
- aConstraints.weighty = 0;
1393
- //aConstraints.weightx = 1;
1394
- /*
1425
+ /*
13951426 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13961427 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1397
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1398
- aConstraints.gridx += 1;
13991428 */
14001429
1401
- aConstraints.gridwidth = 1;
1402
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1403
- aConstraints.gridx += 1;
1404
- aConstraints.weighty = 0;
1405
- 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");
14061434
14071435 /*
14081436 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1409
- aConstraints.gridx += 1;
1410
- aConstraints.weighty = 0;
1411
- aConstraints.gridwidth = 1;
14121437 */
14131438
1414
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1415
- 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
+ }
14161448
1417
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1418
-
1419
- aConstraints.gridx += 1;
1420
-
1421
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1422
-
1423
- aConstraints.gridx += 1;
1424
-
1425
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1426
-
1427
- aConstraints.gridx = 0;
1428
- aConstraints.gridy += 1;
1429
- aConstraints.weighty = 0;
1430
- aConstraints.gridwidth = 1;
1449
+ editBar.preferredHeight = 15;
1450
+
1451
+ panel.add(editBar);
1452
+
14311453 /**/
14321454 //aConstraints.weighty = 0;
14331455 ////aConstraints.weightx = 1;
14341456 //aConstraints.weighty = 1;
14351457 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14361458 //aConstraints.gridx += 1;
1437
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1438
- aConstraints.weighty = 0;
1439
- aConstraints.gridx = 0;
1440
- aConstraints.gridy += 1;
1441
- aConstraints.gridwidth = 1;
1459
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14421460
1443
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1444
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1445
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1446
- aConstraints.gridx += 1;
1447
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1448
- //aConstraints.weightx = 0;
1449
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1450
- aConstraints.gridx = 0;
1451
- aConstraints.gridy += 1;
1452
- 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);
14531469
1454
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1455
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1456
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1457
- aConstraints.gridx += 1;
1458
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1459
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1460
- aConstraints.gridx = 0;
1461
- aConstraints.gridy += 1;
1462
- 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);
14631475
1464
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1465
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1466
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1467
- aConstraints.gridx += 1;
1468
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1469
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1470
- aConstraints.gridx = 0;
1471
- aConstraints.gridy += 1;
1472
- 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);
14731481
1474
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1475
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1476
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1477
- aConstraints.gridx += 1;
1478
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1479
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1480
- aConstraints.gridx = 0;
1481
- aConstraints.gridy += 1;
1482
- 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);
14831487
1484
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1485
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1486
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1487
- aConstraints.gridx += 1;
1488
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1489
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1490
- aConstraints.gridx = 0;
1491
- aConstraints.gridy += 1;
1492
- 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);
14931493
1494
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1495
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1496
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1497
- aConstraints.gridx += 1;
1498
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1499
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1500
- aConstraints.gridx = 0;
1501
- aConstraints.gridy += 1;
1502
- 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);
15031499
1504
- //aConstraints.weighty = 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1506
- //aConstraints.gridx += 1;
1507
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1508
- aConstraints.weighty = 0;
1509
- aConstraints.gridx = 0;
1510
- aConstraints.gridy += 1;
1511
- 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);
15121513
1513
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1514
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1515
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1516
- aConstraints.gridx += 1;
1517
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1518
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1519
- aConstraints.gridx = 0;
1520
- aConstraints.gridy += 1;
1521
- 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);
15221519
1523
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1524
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1525
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1526
- aConstraints.gridx += 1;
1527
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1528
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1529
- aConstraints.gridx = 0;
1530
- aConstraints.gridy += 1;
1531
- 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);
15321525
1533
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1534
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1536
- aConstraints.gridx += 1;
1537
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1538
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1539
- aConstraints.gridx = 0;
1540
- aConstraints.gridy += 1;
1541
- 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);
15421531
1543
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1544
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1545
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1546
- aConstraints.gridx += 1;
1547
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1548
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1549
- aConstraints.gridx = 0;
1550
- aConstraints.gridy += 1;
1551
- 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);
15521537
1553
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1554
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1556
- aConstraints.gridx += 1;
1557
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1558
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1559
- aConstraints.gridx = 0;
1560
- aConstraints.gridy += 1;
1561
- 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);
15621543
1563
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1564
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1565
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1566
- aConstraints.gridx += 1;
1567
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1568
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1569
- aConstraints.gridx = 0;
1570
- aConstraints.gridy += 1;
1571
- 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);
15721549
1573
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1574
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1575
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1576
- aConstraints.gridx += 1;
1577
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1578
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1579
- aConstraints.gridx = 0;
1580
- aConstraints.gridy += 1;
1581
- 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);
15821557
1583
- //aConstraints.weighty = 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1585
- //aConstraints.gridx += 1;
1586
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1587
- aConstraints.weighty = 0;
1588
- aConstraints.gridx = 0;
1589
- aConstraints.gridy += 1;
1590
- 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);
15911563
1592
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1593
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1594
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1595
- aConstraints.gridx += 1;
1596
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1597
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1598
- aConstraints.gridx = 0;
1599
- aConstraints.gridy += 1;
1600
- 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);
16011569
1602
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1603
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1605
- aConstraints.gridx += 1;
1606
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1607
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1608
- aConstraints.gridx = 0;
1609
- aConstraints.gridy += 1;
1610
- 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);
16111575
1612
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1613
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1614
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1615
- aConstraints.gridx += 1;
1616
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1617
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1618
- aConstraints.gridx = 0;
1619
- aConstraints.gridy += 1;
1620
- 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);
16211581
1622
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1623
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1625
- aConstraints.gridx += 1;
1626
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1627
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1628
- aConstraints.gridx = 0;
1629
- aConstraints.gridy += 1;
1630
- 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);
16311587
1632
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1633
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1635
- aConstraints.gridx += 1;
1636
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1637
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1638
- aConstraints.gridx = 0;
1639
- aConstraints.gridy += 1;
1640
- aConstraints.gridwidth = 1;
1641
-
1642
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1643
- Return();
1588
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1589
+ //Return();
16441590 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16451591 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16461592 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1651,130 +1597,93 @@
16511597 // aConstraints.gridy += 1;
16521598 // aConstraints.gridwidth = 1;
16531599
1654
- //aConstraints.weighty = 1;
1655
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1656
- //aConstraints.gridx += 1;
1657
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1658
- aConstraints.weighty = 0;
1659
- aConstraints.gridx = 0;
1660
- aConstraints.gridy += 1;
1661
- aConstraints.gridwidth = 1;
16621600
1663
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1664
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1665
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1666
- aConstraints.gridx += 1;
1667
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1668
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1669
- aConstraints.gridx = 0;
1670
- aConstraints.gridy += 1;
1671
- 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);
16721608
1673
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1674
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1675
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1676
- aConstraints.gridx += 1;
1677
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1678
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1679
- aConstraints.gridx = 0;
1680
- aConstraints.gridy += 1;
1681
- 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);
16821614
1683
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1684
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1685
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1686
- aConstraints.gridx += 1;
1687
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1688
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1689
- aConstraints.gridx = 0;
1690
- aConstraints.gridy += 1;
1691
- 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);
16921620
1693
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1694
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1695
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1696
- aConstraints.gridx += 1;
1697
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1698
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1699
- aConstraints.gridx = 0;
1700
- aConstraints.gridy += 1;
1701
- aConstraints.gridwidth = 1;
1702
- 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);
17031626
1704
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1705
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1706
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1707
- aConstraints.gridx += 1;
1708
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1709
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1710
- aConstraints.gridx = 0;
1711
- aConstraints.gridy += 1;
1712
- 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);
17131632
1714
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1715
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1716
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1717
- aConstraints.gridx += 1;
1718
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1719
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1720
- aConstraints.gridx = 0;
1721
- aConstraints.gridy += 1;
1722
- 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);
17231640
1724
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1725
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1726
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1727
- aConstraints.gridx += 1;
1728
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1729
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1730
- aConstraints.gridx = 0;
1731
- aConstraints.gridy += 1;
1732
- 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);
17331646
1734
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1735
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1736
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1737
- aConstraints.gridx += 1;
1738
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1739
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1740
- aConstraints.gridx = 0;
1741
- aConstraints.gridy += 1;
1742
- 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);
17431652
1744
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1745
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1746
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1747
- aConstraints.gridx += 1;
1748
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1749
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1750
- aConstraints.gridx = 0;
1751
- aConstraints.gridy += 1;
1752
- 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);
17531658
1754
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1755
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1756
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1757
- aConstraints.gridx += 1;
1758
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1759
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1760
- aConstraints.gridx = 0;
1761
- aConstraints.gridy += 1;
1762
- 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);
17631664
1764
- //aConstraints.weighty = 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1766
- //aConstraints.gridx += 1;
1767
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1768
- 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);
17691670
1770
- aConstraints.gridx = 0;
1771
- aConstraints.gridy = 0;
1772
- 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);
17731682
17741683 SetMaterial(copy); // .GetMaterial());
17751684
1776
- colorField.addChangeListener(this);
1777
- modulationField.addChangeListener(this);
1685
+ //colorField.addChangeListener(this);
1686
+// modulationField.addChangeListener(this);
17781687 metalnessField.addChangeListener(this);
17791688 diffuseField.addChangeListener(this);
17801689 specularField.addChangeListener(this);
....@@ -1804,12 +1713,15 @@
18041713 opacityPowerField.addChangeListener(this);
18051714 /**/
18061715
1807
- resetSlidersButton.addActionListener(this);
18081716 clearMaterialButton.addActionListener(this);
18091717 createMaterialButton.addActionListener(this);
1810
-
1811
- propagateToggle.addItemListener(this);
1812
- multiplyToggle.addItemListener(this);
1718
+
1719
+ if (Globals.ADVANCED)
1720
+ {
1721
+ resetSlidersButton.addActionListener(this);
1722
+ propagateToggle.addItemListener(this);
1723
+ multiplyToggle.addItemListener(this);
1724
+ }
18131725 }
18141726
18151727 void DropFile(java.io.File[] files, boolean textures)
....@@ -1980,7 +1892,7 @@
19801892
19811893 //? flashIt = false;
19821894 CameraPane pane = (CameraPane) cameraView;
1983
- pane.clickStart(location.x, location.y, 0);
1895
+ pane.clickStart(location.x, location.y, 0, 0);
19841896 pane.clickEnd(location.x, location.y, 0, true);
19851897
19861898 if (group.selection.size() == 1)
....@@ -2029,6 +1941,7 @@
20291941 e2.printStackTrace();
20301942 }
20311943 }
1944
+
20321945 LoadJMEThread loadThread;
20331946
20341947 class LoadJMEThread extends Thread
....@@ -2086,6 +1999,7 @@
20861999 //LoadFile0(filename, converter);
20872000 }
20882001 }
2002
+
20892003 LoadOBJThread loadObjThread;
20902004
20912005 class LoadOBJThread extends Thread
....@@ -2164,19 +2078,19 @@
21642078
21652079 void LoadObjFile(String fullname)
21662080 {
2167
- /*
2081
+ System.out.println("Loading " + fullname);
2082
+ /**/
21682083 //lastFilename = fullname;
21692084 if(loadObjThread == null)
21702085 {
2171
- loadObjThread = new LoadOBJThread();
2172
- loadObjThread.start();
2086
+ loadObjThread = new LoadOBJThread();
2087
+ loadObjThread.start();
21732088 }
21742089
21752090 loadObjThread.add(fullname);
2176
- */
2091
+ /**/
21772092
2178
- System.out.println("Loading " + fullname);
2179
- makeSomething(new FileObject(fullname, true), true);
2093
+ //makeSomething(new FileObject(fullname, true), true);
21802094 }
21812095
21822096 void LoadGFDFile(String fullname)
....@@ -2437,11 +2351,11 @@
24372351
24382352 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24392353 {
2440
- if (GrafreeD.standAlone)
2354
+ if (Grafreed.standAlone)
24412355 {
24422356 /**/
24432357 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2444
- browser.show();
2358
+ browser.setVisible(true);
24452359 String filename = browser.getFile();
24462360 if (filename != null && filename.length() > 0)
24472361 {
....@@ -2586,6 +2500,7 @@
25862500 }
25872501 if (input == null)
25882502 {
2503
+ new Exception().printStackTrace();
25892504 System.exit(0);
25902505 }
25912506
....@@ -2800,7 +2715,8 @@
28002715 return;
28012716 }
28022717
2803
- multiplyToggle.setSelected(mat.multiply);
2718
+ if (multiplyToggle != null)
2719
+ multiplyToggle.setSelected(mat.multiply);
28042720
28052721 assert (object.projectedVertices != null);
28062722
....@@ -2989,7 +2905,8 @@
29892905 if (timeline)
29902906 {
29912907 centralPanel.remove(cameraView);
2992
- centralPanel.add(timelinePanel);
2908
+ cameraPanel.add(cameraView);
2909
+ centralPanel.add(cameraPanel);
29932910 frame.setJMenuBar(timelineMenubar);
29942911 wasFullScreen = CameraPane.FULLSCREEN;
29952912 if (!CameraPane.FULLSCREEN)
....@@ -2998,7 +2915,7 @@
29982915 }
29992916 else
30002917 {
3001
- centralPanel.remove(timelinePanel);
2918
+ centralPanel.remove(cameraPanel);
30022919 centralPanel.add(cameraView);
30032920 frame.setJMenuBar(null);
30042921 if (!wasFullScreen)
....@@ -3014,9 +2931,9 @@
30142931 frame.validate();
30152932
30162933 return;
3017
- } else if (event.getSource() == toggleRandomItem)
2934
+ } else if (event.getSource() == toggleSwitchItem)
30182935 {
3019
- cameraView.ToggleRandom();
2936
+ cameraView.ToggleSwitch();
30202937 cameraView.repaint();
30212938 return;
30222939 } else if (event.getSource() == toggleHandleItem)
....@@ -3045,6 +2962,10 @@
30452962 {
30462963 copy.live ^= true;
30472964 return;
2965
+ } else if (event.getSource() == selectCB)
2966
+ {
2967
+ copy.dontselect ^= true;
2968
+ return;
30482969 } else if (event.getSource() == hideCB)
30492970 {
30502971 copy.hide ^= true;
....@@ -3059,6 +2980,7 @@
30592980 if (event.getSource() == randomCB)
30602981 {
30612982 copy.random ^= true;
2983
+ objEditor.refreshContents();
30622984 return;
30632985 }
30642986 if (event.getSource() == speedupCB)
....@@ -3082,8 +3004,9 @@
30823004
30833005 public void actionPerformed(ActionEvent event)
30843006 {
3007
+ Object source = event.getSource();
30853008 // SCRIPT DIALOG
3086
- if (event.getSource() == okbutton)
3009
+ if (source == okbutton)
30873010 {
30883011 textpanel.setVisible(false);
30893012 textpanel.remove(textarea);
....@@ -3095,7 +3018,7 @@
30953018 textarea = null;
30963019 textpanel = null;
30973020 }
3098
- if (event.getSource() == cancelbutton)
3021
+ if (source == cancelbutton)
30993022 {
31003023 textpanel.setVisible(false);
31013024 textpanel.remove(textarea);
....@@ -3107,49 +3030,50 @@
31073030 //applySelf();
31083031 //client.refreshEditWindow();
31093032 //refreshContents();
3110
- if (event.getSource() == nameField)
3033
+ if (source == nameField)
31113034 {
31123035 //System.out.println("ObjEditor " + event);
31133036 applySelf0(true);
31143037 //parent.applySelf();
31153038 objEditor.refreshContents();
3116
- } else if (event.getSource() == resetButton)
3039
+ } else if (source == resetButton)
31173040 {
31183041 CameraPane.fullreset = true;
31193042 copy.Reset(); // ResetMeshes();
31203043 copy.Touch();
31213044 objEditor.refreshContents();
3122
- } else if (event.getSource() == stepItem)
3045
+ } else if (source == stepItem)
31233046 {
3124
- cameraView.ONESTEP = true;
3047
+ //cameraView.ONESTEP = true;
3048
+ Globals.ONESTEP = true;
31253049 cameraView.repaint();
31263050 return;
3127
- } else if (event.getSource() == stepButton)
3051
+ } else if (source == stepButton)
31283052 {
31293053 copy.Step();
31303054 copy.Touch();
31313055 objEditor.refreshContents();
3132
- } else if (event.getSource() == slowerButton)
3056
+ } else if (source == slowerButton)
31333057 {
31343058 copy.Slower();
31353059 copy.Touch();
31363060 objEditor.refreshContents();
3137
- } else if (event.getSource() == fasterButton)
3061
+ } else if (source == fasterButton)
31383062 {
31393063 copy.Faster();
31403064 copy.Touch();
31413065 objEditor.refreshContents();
3142
- } else if (event.getSource() == remarkButton)
3066
+ } else if (source == remarkButton)
31433067 {
31443068 copy.Remark();
31453069 copy.Touch();
31463070 objEditor.refreshContents();
3147
- } else if (event.getSource() == stepAllButton)
3071
+ } else if (source == stepAllButton)
31483072 {
31493073 copy.StepAll();
31503074 copy.Touch();
31513075 objEditor.refreshContents();
3152
- } else if (event.getSource() == resetAllButton)
3076
+ } else if (source == resetAllButton)
31533077 {
31543078 //CameraPane.fullreset = true;
31553079 copy.ResetAll(); // ResetMeshes();
....@@ -3182,53 +3106,75 @@
31823106 // Close();
31833107 // }
31843108 // else
3185
- if (event.getSource() == resetSlidersButton)
3109
+ if (source == resetSlidersButton)
31863110 {
31873111 ResetSliders();
3188
- } else if (event.getSource() == clearMaterialButton)
3112
+ } else if (source == clearMaterialButton)
31893113 {
31903114 ClearMaterial();
3191
- } else if (event.getSource() == createMaterialButton)
3115
+ } else if (source == createMaterialButton)
31923116 {
31933117 CreateMaterial();
3194
- } else if (event.getSource() == clearPanelButton)
3118
+ } else if (source == clearPanelButton)
31953119 {
31963120 copy.ClearUI();
31973121 refreshContents(true);
3198
- } /*
3199
- }
3200
-
3201
- public boolean action(Event event, Object arg)
3202
- {
3203
- */ 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)
32043147 {
32053148 Close();
32063149 //return true;
3207
- } else if (event.getSource() == loadItem)
3150
+ } else if (source == loadItem)
32083151 {
32093152 load();
32103153 //return true;
3211
- } else if (event.getSource() == saveItem)
3154
+ } else if (source == newItem)
3155
+ {
3156
+ New();
3157
+ } else if (source == saveItem)
32123158 {
32133159 save();
32143160 //return true;
3215
- } else if (event.getSource() == saveAsItem)
3161
+ } else if (source == saveAsItem)
32163162 {
32173163 saveAs();
32183164 //return true;
3219
- } else if (event.getSource() == reexportItem)
3165
+ } else if (source == reexportItem)
32203166 {
32213167 reexport();
32223168 //return true;
3223
- } else if (event.getSource() == exportAsItem)
3169
+ } else if (source == exportAsItem)
32243170 {
32253171 export();
32263172 //return true;
3227
- } else if (event.getSource() == povItem)
3173
+ } else if (source == povItem)
32283174 {
32293175 generatePOV();
32303176 //return true;
3231
- } else if (event.getSource() == zBufferItem)
3177
+ } else if (source == zBufferItem)
32323178 {
32333179 try
32343180 {
....@@ -3250,21 +3196,8 @@
32503196 cameraView.repaint();
32513197 //return true;
32523198 }
3253
- */ else if (event.getSource() == editCameraItem)
3254
- {
3255
- cameraView.ProtectCamera();
3256
- cameraView.repaint();
3257
- return;
3258
- } else if (event.getSource() == revertCameraItem)
3259
- {
3260
- cameraView.RevertCamera();
3261
- cameraView.repaint();
3262
- return;
3263
-// } else if (event.getSource() == textureButton)
3264
-// {
3265
-// return; // true;
3266
- } else // combos...
3267
- if (event.getSource() == texresMenu)
3199
+ */ else // combos...
3200
+ if (source == texresMenu)
32683201 {
32693202 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32703203 copy.texres = texresMenu.getSelectedIndex();
....@@ -3276,27 +3209,283 @@
32763209 }
32773210 }
32783211
3279
- void ToggleAnimation()
3212
+ void New()
32803213 {
3281
- if (!CameraPane.ANIMATION)
3214
+ while (copy.Size() > 1)
32823215 {
3283
- 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);
32843439 browser.show();
32853440 String filename = browser.getFile();
32863441 if (filename != null && filename.length() > 0)
32873442 {
3288
- 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;
32893478 //CameraPane.framecount = 0;
3290
- CameraPane.imagecount = 0;
3479
+ Globals.imagecount = 0;
32913480
3292
- CameraPane.ANIMATION ^= true;
3481
+ Globals.ANIMATION ^= true;
32933482
3294
- GrafreeD.wav.cursor = 0;
3295
- GrafreeD.wav.loop = 0;
3483
+ Grafreed.wav.cursor = 0;
3484
+ Grafreed.wav.loop = 0;
32963485 }
32973486 } else
32983487 {
3299
- CameraPane.ANIMATION ^= true;
3488
+ Globals.ANIMATION ^= true;
33003489 }
33013490 }
33023491
....@@ -3342,7 +3531,7 @@
33423531 void CreateMaterial()
33433532 {
33443533 //copy.ClearMaterial(); // PATCH
3345
- copy.CreateMaterialS(multiplyToggle.isSelected());
3534
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33463535 if (copy.selection.size() > 0)
33473536 //SetMaterial(copy);
33483537 {
....@@ -3401,11 +3590,11 @@
34013590 {
34023591 copy.ResetBlockLoop(); // temporary problem
34033592
3404
- boolean random = CameraPane.RANDOM;
3405
- CameraPane.RANDOM = false; // parse everything
3593
+ boolean random = CameraPane.SWITCH;
3594
+ CameraPane.SWITCH = false; // parse everything
34063595 copy.ResetDisplayList();
34073596 copy.HardTouch();
3408
- CameraPane.RANDOM = random;
3597
+ CameraPane.SWITCH = random;
34093598 }
34103599
34113600 // public void applySelf()
....@@ -3475,10 +3664,40 @@
34753664 current.fakedepth = (float) fakedepthField.getFloat();
34763665 current.shadowbias = (float) shadowbiasField.getFloat();
34773666
3478
- if (!NumberSlider.frozen)
3667
+ if (!cNumberSlider.frozen)
34793668 {
34803669 //System.out.println("Propagate = " + propagate);
34813670 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
+
34823701 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34833702 {
34843703 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3523,6 +3742,7 @@
35233742 || e.getSource() == apertureField
35243743 || e.getSource() == shadowblurField)
35253744 {
3745
+ new Exception().printStackTrace();
35263746 System.exit(0);
35273747 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35283748 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3549,7 +3769,13 @@
35493769 //System.out.println("PARENT = " + parent);
35503770 //if (parent != null)
35513771 // parent.applySelf();
3552
- refreshContents();
3772
+ if (e.getSource() == normalpushField)
3773
+ {
3774
+ objEditor.refreshContents();
3775
+ //Refresh();
3776
+ }
3777
+ else
3778
+ refreshContents();
35533779 // ??? client.refreshEditWindow();
35543780 }
35553781 //else
....@@ -3561,7 +3787,7 @@
35613787 //group.name = nameField.getText();
35623788 //objEditor.applySelf();
35633789
3564
- assert (objEditor == this);
3790
+ // OCT2018: assert (objEditor == this);
35653791 if (copy.selection == null || copy.selection.size() == 0)
35663792 //super.applySelf()
35673793 ; else
....@@ -3585,6 +3811,9 @@
35853811 objEditor.copy = keep;
35863812 }
35873813 }
3814
+
3815
+ if (normalpushField != null)
3816
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35883817 }
35893818
35903819 void SnapObject()
....@@ -3839,7 +4068,7 @@
38394068
38404069 radioPanel.revalidate();
38414070 radioPanel.repaint();
3842
- ctrlPanel.revalidate(); // ? new
4071
+ ctrlPanel.validate(); // ? new
38434072 ctrlPanel.repaint();
38444073 }
38454074 }
....@@ -3848,6 +4077,7 @@
38484077
38494078 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38504079 {
4080
+ Save();
38514081 //Tween.set(thing, 0).target(1).start(tweenManager);
38524082 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38534083 // if (thing instanceof GenericJointDemo)
....@@ -4051,6 +4281,7 @@
40514281 }
40524282 }
40534283 }
4284
+
40544285 LoadGFDThread loadGFDThread;
40554286
40564287 void ReadGFD(String fullname, iCallBack cb)
....@@ -4070,8 +4301,10 @@
40704301
40714302 try
40724303 {
4304
+ // Try compressed version first.
40734305 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4074
- 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);
40754308
40764309 readobj = (Object3D) p.readObject();
40774310 istream.close();
....@@ -4079,7 +4312,20 @@
40794312 readobj.ResetDisplayList();
40804313 } catch (Exception e)
40814314 {
4082
- 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
+ }
40834329 }
40844330 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40854331 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4125,6 +4371,12 @@
41254371
41264372 void LoadIt(Object obj)
41274373 {
4374
+ if (obj == null)
4375
+ {
4376
+ // Invalid file
4377
+ return;
4378
+ }
4379
+
41284380 System.out.println("Loaded " + obj);
41294381 //new Exception().printStackTrace();
41304382 Object3D readobj = (Object3D) obj;
....@@ -4134,6 +4386,7 @@
41344386
41354387 if (readobj != null)
41364388 {
4389
+ Save();
41374390 try
41384391 {
41394392 //readobj.deepCopySelf(copy);
....@@ -4196,7 +4449,7 @@
41964449
41974450 void load() // throws ClassNotFoundException
41984451 {
4199
- if (GrafreeD.standAlone)
4452
+ if (Grafreed.standAlone)
42004453 {
42014454 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42024455 browser.show();
....@@ -4283,11 +4536,13 @@
42834536 try
42844537 {
42854538 FileOutputStream ostream = new FileOutputStream(lastname);
4286
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4539
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4540
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42874541
42884542 p.writeObject(copy);
42894543 p.flush();
42904544
4545
+ zstream.close();
42914546 ostream.close();
42924547
42934548 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4297,11 +4552,12 @@
42974552 {
42984553 }
42994554 }
4555
+
43004556 String lastname;
43014557
43024558 void saveAs()
43034559 {
4304
- if (GrafreeD.standAlone)
4560
+ if (Grafreed.standAlone)
43054561 {
43064562 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43074563 browser.setVisible(true);
....@@ -4406,13 +4662,13 @@
44064662 try
44074663 {
44084664 FileOutputStream ostream = new FileOutputStream(filename);
4409
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4410
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4665
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4666
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44114667
44124668 Object3D objectparent = obj.parent;
44134669 obj.parent = null;
44144670
4415
- Object3D object = (Object3D) GrafreeD.clone(obj);
4671
+ Object3D object = (Object3D) Grafreed.clone(obj);
44164672
44174673 obj.parent = objectparent;
44184674
....@@ -4424,8 +4680,8 @@
44244680 p.writeObject(object);
44254681 p.flush();
44264682
4683
+ zstream.close();
44274684 ostream.close();
4428
- // zstream.close();
44294685
44304686 // group.selection.get(0).parent = parent;
44314687 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4446,7 +4702,7 @@
44464702 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44474703 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44484704 copy.generatePOV(buffer);
4449
- if (GrafreeD.standAlone)
4705
+ if (Grafreed.standAlone)
44504706 {
44514707 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44524708 browser.show();
....@@ -4472,7 +4728,8 @@
44724728 Object3D client;
44734729 Object3D copy;
44744730 MenuBar menuBar;
4475
- Menu windowMenu;
4731
+ Menu fileMenu;
4732
+ MenuItem newItem;
44764733 MenuItem loadItem;
44774734 MenuItem saveItem;
44784735 MenuItem saveAsItem;
....@@ -4480,13 +4737,11 @@
44804737 MenuItem reexportItem;
44814738 MenuItem povItem;
44824739 MenuItem closeItem;
4483
- Menu cameraMenu;
4740
+
44844741 CheckboxMenuItem zBufferItem;
44854742 //MenuItem normalLensItem;
4486
- MenuItem editCameraItem;
4487
- MenuItem revertCameraItem;
4488
- CheckboxMenuItem toggleLiveItem;
44894743 MenuItem stepItem;
4744
+ CheckboxMenuItem toggleLiveItem;
44904745 CheckboxMenuItem toggleFullScreenItem;
44914746 CheckboxMenuItem toggleTimelineItem;
44924747 CheckboxMenuItem toggleRenderItem;
....@@ -4495,7 +4750,7 @@
44954750 CheckboxMenuItem toggleFootContactItem;
44964751 CheckboxMenuItem toggleDLItem;
44974752 CheckboxMenuItem toggleTextureItem;
4498
- CheckboxMenuItem toggleRandomItem;
4753
+ CheckboxMenuItem toggleSwitchItem;
44994754 CheckboxMenuItem toggleRootItem;
45004755 CheckboxMenuItem animationItem;
45014756 CheckboxMenuItem toggleHandleItem;
....@@ -4503,20 +4758,21 @@
45034758 JSplitPane mainPanel;
45044759 JScrollPane scrollpane;
45054760 JPanel toolbarPanel;
4506
- JPanel treePanel;
4761
+ cGridBag treePanel;
45074762 JPanel radioPanel;
45084763 ButtonGroup buttonGroup;
4509
- JPanel ctrlPanel;
4510
- JPanel materialPanel;
4764
+ cGridBag ctrlPanel;
4765
+ cGridBag materialPanel;
45114766 JScrollPane infoPanel;
4512
- JPanel optionsPanel;
4767
+ cGridBag optionsPanel;
45134768 JTabbedPane objectPanel;
4514
- JPanel XYZPanel;
4769
+ cGridBag XYZPanel;
45154770 JSplitPane gridPanel;
45164771 JSplitPane bigPanel;
4517
- JPanel bigThree;
4518
- JTabbedPane scenePanel;
4519
- JPanel centralPanel;
4772
+ cGridBag bigThree;
4773
+ cGridBag scenePanel;
4774
+ cGridBag centralPanel;
4775
+ JSplitPane cameraPanel;
45204776 JPanel timelinePanel;
45214777 JMenuBar timelineMenubar;
45224778 JSplitPane framePanel;
....@@ -4568,65 +4824,72 @@
45684824 // MATERIAL
45694825 JLabel materialLabel;
45704826 JLabel colorLabel;
4571
- NumberSlider colorField;
4827
+ cNumberSlider colorField;
45724828 JLabel modulationLabel;
4573
- NumberSlider modulationField;
4829
+ cNumberSlider modulationField;
45744830 JLabel metalnessLabel;
4575
- NumberSlider metalnessField;
4831
+ cNumberSlider metalnessField;
45764832 JLabel diffuseLabel;
4577
- NumberSlider diffuseField;
4833
+ cNumberSlider diffuseField;
45784834 JLabel specularLabel;
4579
- NumberSlider specularField;
4835
+ cNumberSlider specularField;
45804836 JLabel shininessLabel;
4581
- NumberSlider shininessField;
4837
+ cNumberSlider shininessField;
45824838 JLabel shiftLabel;
4583
- NumberSlider shiftField;
4839
+ cNumberSlider shiftField;
45844840 JLabel ambientLabel;
4585
- NumberSlider ambientField;
4841
+ cNumberSlider ambientField;
45864842 JLabel lightareaLabel;
4587
- NumberSlider lightareaField;
4843
+ cNumberSlider lightareaField;
45884844 JLabel diffusenessLabel;
4589
- NumberSlider diffusenessField;
4845
+ cNumberSlider diffusenessField;
45904846 JLabel velvetLabel;
4591
- NumberSlider velvetField;
4847
+ cNumberSlider velvetField;
45924848 JLabel sheenLabel;
4593
- NumberSlider sheenField;
4849
+ cNumberSlider sheenField;
45944850 JLabel subsurfaceLabel;
4595
- NumberSlider subsurfaceField;
4851
+ cNumberSlider subsurfaceField;
45964852 //JLabel bumpLabel;
45974853 //NumberSlider bumpField;
45984854 JLabel backlitLabel;
4599
- NumberSlider backlitField;
4855
+ cNumberSlider backlitField;
46004856 JLabel anisoLabel;
4601
- NumberSlider anisoField;
4857
+ cNumberSlider anisoField;
46024858 JLabel anisoVLabel;
4603
- NumberSlider anisoVField;
4859
+ cNumberSlider anisoVField;
46044860 JLabel cameraLabel;
4605
- NumberSlider cameraField;
4861
+ cNumberSlider cameraField;
46064862 JLabel selfshadowLabel;
4607
- NumberSlider selfshadowField;
4863
+ cNumberSlider selfshadowField;
46084864 JLabel shadowLabel;
4609
- NumberSlider shadowField;
4865
+ cNumberSlider shadowField;
46104866 JLabel textureLabel;
4611
- NumberSlider textureField;
4867
+ cNumberSlider textureField;
46124868 JLabel opacityLabel;
4613
- NumberSlider opacityField;
4869
+ cNumberSlider opacityField;
46144870 JLabel fakedepthLabel;
4615
- NumberSlider fakedepthField;
4871
+ cNumberSlider fakedepthField;
46164872 JLabel shadowbiasLabel;
4617
- NumberSlider shadowbiasField;
4873
+ cNumberSlider shadowbiasField;
46184874 JLabel bumpLabel;
4619
- NumberSlider bumpField;
4875
+ cNumberSlider bumpField;
46204876 JLabel noiseLabel;
4621
- NumberSlider noiseField;
4877
+ cNumberSlider noiseField;
46224878 JLabel powerLabel;
4623
- NumberSlider powerField;
4879
+ cNumberSlider powerField;
46244880 JLabel borderfadeLabel;
4625
- NumberSlider borderfadeField;
4881
+ cNumberSlider borderfadeField;
46264882 JLabel fogLabel;
4627
- NumberSlider fogField;
4883
+ cNumberSlider fogField;
46284884 JLabel opacityPowerLabel;
4629
- NumberSlider opacityPowerField;
4885
+ cNumberSlider opacityPowerField;
46304886 JTree jTree;
46314887 //ObjectUI parent;
4888
+
4889
+ cNumberSlider normalpushField;
4890
+
4891
+ private MenuItem importGFDItem;
4892
+ private MenuItem importVRMLX3DItem;
4893
+ private MenuItem import3DSItem;
4894
+ private MenuItem importOBJItem;
46324895 }