Normand Briere
2019-06-11 5e6a6f3319f0c4c687fe71952ac9ecc17792b83a
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,61 @@
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(commandsPanel);
172
+ objEditor.ctrlPanel.remove(pushPanel);
173
+ //objEditor.ctrlPanel.remove(fillPanel);
174
+
175
+ //Remove(normalpushField);
163176 }
164177
165178 public ObjEditor GetEditor()
166179 {
167180 return objEditor; //.GetEditor();
168181 }
182
+
183
+ // Sometimes myself, sometimes my callee's.
169184 ObjEditor objEditor;
170185
171186 /*
....@@ -261,24 +276,40 @@
261276 void SetupMenu()
262277 {
263278 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..."));
279
+ menuBar.add(fileMenu = new Menu("File"));
280
+ fileMenu.add(newItem = new MenuItem("New"));
281
+ fileMenu.add(loadItem = new MenuItem("Load..."));
282
+
283
+ //oe.menuBar.add(menu = new Menu("Include"));
284
+ Menu menu = new Menu("Import");
285
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
286
+ importOBJItem.addActionListener(this);
287
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
288
+ import3DSItem.addActionListener(this);
289
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
290
+ importVRMLX3DItem.addActionListener(this);
291
+ menu.add("-");
292
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
293
+ importGFDItem.addActionListener(this);
294
+ fileMenu.add(menu);
295
+ fileMenu.add("-");
296
+
297
+ fileMenu.add(saveItem = new MenuItem("Save"));
298
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
269299 //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("-");
300
+ fileMenu.add("-");
301
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
302
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
303
+ fileMenu.add("-");
274304 if (client.parent != null)
275305 {
276
- windowMenu.add(closeItem = new MenuItem("Close"));
306
+ fileMenu.add(closeItem = new MenuItem("Close"));
277307 } else
278308 {
279
- windowMenu.add(closeItem = new MenuItem("Exit"));
309
+ fileMenu.add(closeItem = new MenuItem("Exit"));
280310 }
281311
312
+ newItem.addActionListener(this);
282313 loadItem.addActionListener(this);
283314 saveItem.addActionListener(this);
284315 saveAsItem.addActionListener(this);
....@@ -287,79 +318,26 @@
287318 //povItem.addActionListener(this);
288319 closeItem.addActionListener(this);
289320
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
-
345321 objectPanel = new JTabbedPane();
346322 toolbarPanel = new JPanel();
347323 toolbarPanel.setName("Toolbar");
348
- treePanel = new JPanel();
324
+ treePanel = new cGridBag();
349325 treePanel.setName("Tree");
350
- ctrlPanel = new JPanel(); // new GridBagLayout());
326
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
351327 ctrlPanel.setName("Edit");
352
- materialPanel = new JPanel();
328
+ materialPanel = new cGridBag().setVertical(true);
353329 materialPanel.setName("Material");
354330 /*JTextPane*/
355331 infoarea = createTextPane();
332
+ doc = infoarea.getStyledDocument();
333
+
356334 infoarea.setEditable(true);
357335 SetText();
358336 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
359337 // infoarea.setOpaque(false);
360338 // //infoarea.setForeground(textcolor);
361
- infoarea.setLineWrap(true);
362
- infoarea.setWrapStyleWord(true);
339
+// TEXTAREA infoarea.setLineWrap(true);
340
+// TEXTAREA infoarea.setWrapStyleWord(true);
363341 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
364342 infoPanel.setPreferredSize(new Dimension(50, 200));
365343 infoPanel.setName("Info");
....@@ -370,16 +348,16 @@
370348 mainPanel.setName("Main");
371349 mainPanel.setContinuousLayout(true);
372350 mainPanel.setOneTouchExpandable(true);
373
- mainPanel.setDividerLocation(1.0);
374351 mainPanel.setDividerSize(9);
375
- mainPanel.setResizeWeight(0);
352
+ mainPanel.setDividerLocation(0.5); //1.0);
353
+ mainPanel.setResizeWeight(0.5);
376354
377355 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
378356 //mainPanel.setLayout(new GridBagLayout());
379357 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
380
- treePanel.setLayout(new GridBagLayout());
381
- ctrlPanel.setLayout(new GridBagLayout());
382
- materialPanel.setLayout(new GridBagLayout());
358
+// treePanel.setLayout(new GridBagLayout());
359
+ //ctrlPanel.setLayout(new GridBagLayout());
360
+ //materialPanel.setLayout(new GridBagLayout());
383361
384362 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
385363 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -418,7 +396,7 @@
418396 static String newline = "\n";
419397 protected static final String buttonString = "JButton";
420398 StyledDocument doc;
421
- JTextArea infoarea;
399
+ JTextPane infoarea;
422400
423401 void ClearInfo()
424402 {
....@@ -467,13 +445,13 @@
467445 //SendInfo("Name:", "bold");
468446 if (sel.GetTextures() != null || debug)
469447 {
470
- si.SendInfo(sel.toString(), "bold");
448
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
471449 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
472450 if (sel.Size() > 0)
473451 {
474452 si.SendInfo("#children = " + sel.Size(), "regular");
475453 }
476
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
454
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
477455 if (debug)
478456 {
479457 try
....@@ -485,7 +463,10 @@
485463 }
486464
487465 if (full)
488
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
466
+ {
467
+ si.SendInfo(" BBox min: " + minima, "regular");
468
+ si.SendInfo(" BBox max: " + maxima, "regular");
469
+ }
489470
490471 if (sel.bRep != null)
491472 {
....@@ -512,7 +493,7 @@
512493 }
513494 if (sel.support != null)
514495 {
515
- si.SendInfo(" support: " + sel.support, "regular");
496
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
516497 }
517498 if (sel.scriptnode != null)
518499 {
....@@ -583,6 +564,9 @@
583564 {
584565 CameraPane.pointflow = (PointFlow) sel;
585566 }
567
+
568
+ si.SendInfo("_____________________", "regular");
569
+ si.SendInfo("", "regular");
586570 }
587571 }
588572
....@@ -614,52 +598,52 @@
614598 cameraView.ToggleFullScreen();
615599 }
616600
617
- private JTextArea createTextPane()
601
+ private JTextPane createTextPane()
618602 {
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
- };
603
+// TEXTAREA String[] initString =
604
+// {
605
+// "This is an editable JTextPane, ", //regular
606
+// "another ", //italic
607
+// "styled ", //bold
608
+// "text ", //small
609
+// "component, ", //large
610
+// "which supports embedded components..." + newline,//regular
611
+// " " + newline, //button
612
+// "...and embedded icons..." + newline, //regular
613
+// " ", //icon
614
+// newline + "JTextPane is a subclass of JEditorPane that "
615
+// + "uses a StyledEditorKit and StyledDocument, and provides "
616
+// + "cover methods for interacting with those objects."
617
+// };
618
+//
619
+// String[] initStyles =
620
+// {
621
+// "regular", "italic", "bold", "small", "large",
622
+// "regular", "button", "regular", "icon",
623
+// "regular"
624
+// };
625
+//
626
+// JTextPane textPane = new JTextPane();
627
+// textPane.setEditable(true);
628
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
629
+// addStylesToDocument(doc);
630
+//
631
+// try
632
+// {
633
+// for (int j = 0; j < 2; j++)
634
+// {
635
+// for (int i = 0; i < initString.length; i++)
636
+// {
637
+// doc.insertString(doc.getLength(), initString[i],
638
+// doc.getStyle(initStyles[i]));
639
+// }
640
+// }
641
+// } catch (BadLocationException ble)
642
+// {
643
+// System.err.println("Couldn't insert initial text into text pane.");
644
+// }
634645
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;
646
+ return new JTextPane(); // textPane;
663647 }
664648
665649 protected void addStylesToDocument(StyledDocument doc)
....@@ -712,7 +696,7 @@
712696 protected static ImageIcon createImageIcon(String path,
713697 String description)
714698 {
715
- java.net.URL imgURL = GrafreeD.class.getResource(path);
699
+ java.net.URL imgURL = Grafreed.class.getResource(path);
716700 if (imgURL != null)
717701 {
718702 return new ImageIcon(imgURL, description);
....@@ -744,6 +728,7 @@
744728 // NumberSlider vDivsField;
745729 // JCheckBox endcaps;
746730 JCheckBox liveCB;
731
+ JCheckBox selectCB;
747732 JCheckBox hideCB;
748733 JCheckBox link2masterCB;
749734 JCheckBox markCB;
....@@ -759,115 +744,83 @@
759744 JButton slowerButton;
760745 JButton fasterButton;
761746 JButton remarkButton;
747
+
748
+ cGridBag namePanel;
749
+ cGridBag setupPanel;
750
+ cGridBag commandsPanel;
751
+ cGridBag pushPanel;
752
+ cGridBag fillPanel;
762753
763
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
754
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
764755 {
765756 JCheckBox cb;
766757
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);
758
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
772759 cb.addItemListener(this);
773
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
774
- oe.aConstraints.gridwidth = 1;
775
- oe.aConstraints.gridx += 1;
776760
777761 return cb;
778762 }
779763
780
- cButton AddButton(ObjEditor oe, String label)
764
+ cButton AddButton(cGridBag panel, String label)
781765 {
782766 cButton cb;
783767
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);
768
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
789769 cb.addActionListener(this);
790
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
791
- oe.aConstraints.gridwidth = 1;
792
- oe.aConstraints.gridx += 1;
793770
794771 return cb;
795772 }
796773
797
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
774
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
798775 {
799776 JComboBox combo;
800777
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;
778
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
804779 combo.addActionListener(this);
805780
806781 return combo;
807782 }
808783
809
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
784
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
810785 {
811
- NumberSlider combo;
786
+ cGridBag control = new cGridBag();
787
+
788
+ cNumberSlider combo;
812789
813790 JLabel jlabel = new JLabel(label);
814
-
815
- aConstraints.fill = GridBagConstraints.VERTICAL;
816791 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
-
792
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
793
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
826794 combo.setFloat(current);
827
-
828
- combo.label = jlabel;
829
-
830
- combo.addChangeListener(this);
831
-
832
- return combo;
795
+
796
+ panel.add(control);
797
+
798
+ return control;
833799 }
834800
835
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
801
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
836802 {
837
- NumberSlider combo;
803
+ cGridBag control = new cGridBag();
804
+
805
+ cNumberSlider combo;
838806
839807 JLabel jlabel = new JLabel(label);
840
-
841
- aConstraints.fill = GridBagConstraints.VERTICAL;
842808 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
-
809
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
852811 combo.setInteger(current);
853812
854
- combo.label = jlabel;
855
-
856
- combo.addChangeListener(this);
857
-
858
- return combo;
813
+ panel.add(control);
814
+
815
+ return control;
859816 }
860817
861
- JTextArea AddText(JPanel ctrlPanel, String name)
818
+ JTextArea AddText(cGridBag ctrlPanel, String name)
862819 {
863820 JTextArea text;
864821
865
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
866
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
867
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
822
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
868823 text.addCaretListener(this);
869
- aConstraints.gridx += 1;
870
- aConstraints.gridwidth = 1;
871824
872825 return text;
873826 }
....@@ -897,9 +850,16 @@
897850 objEditor.ctrlPanel.remove(j);
898851 }
899852
853
+ void Remove(cNumberSlider j)
854
+ {
855
+ j.removeChangeListener(this);
856
+ //objEditor.ctrlPanel.remove(j.label);
857
+ objEditor.ctrlPanel.remove(j);
858
+ }
859
+
900860 /*
901861 */
902
- void Return() // ObjEditor oe)
862
+ void Return0() // ObjEditor oe)
903863 {
904864 aConstraints.gridy += 1;
905865 aConstraints.gridx = 0;
....@@ -954,35 +914,73 @@
954914
955915 void SetupUI2(ObjEditor oe)
956916 {
957
-// oe.aConstraints.weightx = 0;
958
-// oe.aConstraints.weighty = 0;
959
-// oe.aConstraints.gridx = 0;
960
-// oe.aConstraints.gridy = 0;
961
- SetupName(oe);
917
+ //SetupName(oe);
918
+
919
+ namePanel = new cGridBag();
920
+
921
+ nameField = AddText(namePanel, copy.GetName());
922
+ namePanel.add(nameField);
923
+ oe.ctrlPanel.add(namePanel);
924
+
925
+ oe.ctrlPanel.Return();
962926
963927 if (!GroupEditor.allparams)
964928 return;
965929
966
- liveCB = AddCheckBox(oe, "Live", copy.live);
967
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
968
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
930
+ setupPanel = new cGridBag().setVertical(false);
931
+
932
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
933
+ liveCB.setToolTipText("Animate object");
934
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
935
+ selectCB.setToolTipText("Make object selectable");
969936 // 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");
937
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
938
+ hideCB.setToolTipText("Hide object");
939
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
940
+ markCB.setToolTipText("Set the animation target transform");
941
+
942
+ rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
943
+ rewindCB.setToolTipText("Rewind animation");
944
+
945
+ randomCB = AddCheckBox(setupPanel, "Random", copy.random);
946
+ randomCB.setToolTipText("Option for switch node");
947
+
948
+ if (Globals.ADVANCED)
949
+ {
950
+ link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
951
+ link2masterCB.setToolTipText("Attach to support");
952
+ speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
953
+ speedupCB.setToolTipText("Option motion capture");
954
+ }
955
+
956
+ oe.ctrlPanel.add(setupPanel);
957
+ oe.ctrlPanel.Return();
958
+
959
+ commandsPanel = new cGridBag().setVertical(false);
960
+
961
+ resetButton = AddButton(commandsPanel, "Reset");
962
+ resetButton.setToolTipText("Jump to frame zero");
963
+ stepButton = AddButton(commandsPanel, "Step");
964
+ stepButton.setToolTipText("Step one frame");
976965 // resetAllButton = AddButton(oe, "Reset All");
977966 // stepAllButton = AddButton(oe, "Step All");
978
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
979967 // Return();
980
- slowerButton = AddButton(oe, "Slow");
981
- fasterButton = AddButton(oe, "Fast");
982
- remarkButton = AddButton(oe, "Rem");
968
+ slowerButton = AddButton(commandsPanel, "Slow");
969
+ slowerButton.setToolTipText("Decrease animation speed");
970
+ fasterButton = AddButton(commandsPanel, "Fast");
971
+ fasterButton.setToolTipText("Increase animation speed");
972
+ remarkButton = AddButton(commandsPanel, "Remark");
973
+ remarkButton.setToolTipText("Set the current transform as the target");
983974
984
- Return();
975
+ oe.ctrlPanel.add(commandsPanel);
976
+ oe.ctrlPanel.Return();
985977
978
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
979
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
980
+ //Return();
981
+
982
+ oe.ctrlPanel.Return();
983
+
986984 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
987985 // ObjEditor.aConstraints.gridx += 1;
988986
....@@ -1076,7 +1074,7 @@
10761074 oe.aConstraints.gridwidth = 1;
10771075 /**/
10781076 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1077
+ oe.ctrlPanel.Return();
10801078
10811079 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821080 //textureButton.setEnabled(false);
....@@ -1178,10 +1176,18 @@
11781176 //JPanel worldPanel =
11791177 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11801178 //worldPanel.setName("World");
1181
- centralPanel = new JPanel(new BorderLayout());
1179
+ centralPanel = new cGridBag();
1180
+ centralPanel.preferredWidth = 20;
11821181 timelinePanel = new JPanel(new BorderLayout());
11831182 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11841183
1184
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1185
+ cameraPanel.setContinuousLayout(true);
1186
+ cameraPanel.setOneTouchExpandable(true);
1187
+// cameraPanel.setDividerLocation(0.9);
1188
+// cameraPanel.setDividerSize(9);
1189
+ cameraPanel.setResizeWeight(1.0);
1190
+
11851191 centralPanel.add(cameraView);
11861192 //frame.setJMenuBar(timelineMenubar);
11871193 //centralPanel.add(timelinePanel);
....@@ -1201,12 +1207,13 @@
12011207 //frontView.object = copy;
12021208 //sideView.object = copy;
12031209
1204
- XYZPanel = new JPanel();
1205
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1210
+ XYZPanel = new cGridBag().setVertical(true);
1211
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12061212
1207
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1208
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1209
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1213
+ XYZPanel.preferredWidth = 5;
1214
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1215
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1216
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
12101217
12111218 /*
12121219 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1244,10 +1251,11 @@
12441251 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12451252 //tmp.setName("Edit");
12461253 objectPanel.add(materialPanel);
1247
- JPanel north = new JPanel(new BorderLayout());
1248
- north.setName("Edit");
1249
- north.add(ctrlPanel, BorderLayout.NORTH);
1250
- objectPanel.add(north);
1254
+// JPanel north = new JPanel(new BorderLayout());
1255
+// north.setName("Edit");
1256
+// north.add(ctrlPanel, BorderLayout.NORTH);
1257
+// objectPanel.add(north);
1258
+ objectPanel.add(ctrlPanel);
12511259 objectPanel.add(infoPanel);
12521260
12531261 /*
....@@ -1268,16 +1276,23 @@
12681276 scrollpane.setWheelScrollingEnabled(true);
12691277 scrollpane.addMouseWheelListener(this); // Default not fast enough
12701278
1271
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1272
- scenePanel.add(scrollpane);
1279
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1280
+ scenePanel.preferredWidth = 6;
1281
+
1282
+ JTabbedPane tabbedPane = new JTabbedPane();
1283
+ tabbedPane.add(scrollpane);
12731284
1274
- scenePanel.add(FSPane = new cFileSystemPane(this));
1285
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12751286
1276
- optionsPanel = new JPanel(new GridBagLayout());
1287
+ optionsPanel = new cGridBag().setVertical(true);
12771288
12781289 optionsPanel.setName("Options");
1279
- scenePanel.add(optionsPanel);
1280
-
1290
+
1291
+ AddOptions(optionsPanel); //, aConstraints);
1292
+
1293
+ tabbedPane.add(optionsPanel);
1294
+
1295
+ scenePanel.add(tabbedPane);
12811296
12821297 /*
12831298 cTree jTree = new cTree(null);
....@@ -1311,6 +1326,7 @@
13111326 //bigPanel.setSize(new Dimension(10,10));
13121327 //bigPanel.add(ctrlPanel);
13131328 //bigPanel.add(gridPanel);
1329
+ /**
13141330 bigThree = new JPanel();
13151331 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13161332 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1334,7 +1350,13 @@
13341350 // aConstraints.gridheight = 3;
13351351 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13361352 bigThree.add(XYZPanel, aWindowConstraints);
1353
+ /**/
13371354
1355
+ bigThree = new cGridBag();
1356
+ bigThree.addComponent(scenePanel);
1357
+ bigThree.addComponent(centralPanel);
1358
+ bigThree.addComponent(XYZPanel);
1359
+
13381360 // // SIDE EFFECT!!!
13391361 // aConstraints.gridx = 0;
13401362 // aConstraints.gridy = 0;
....@@ -1355,13 +1377,14 @@
13551377 //worldPane.add(bigPanel);
13561378 //worldPane.add(worldPanel);
13571379 /**/
1358
- frame.getContentPane().add(/*"Center",*/framePanel);
1380
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1381
+ frame.add(/*"Center",*/framePanel);
13591382 //frame.getContentPane().add(/*"Center",*/ worldPane);
13601383
13611384 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13621385
1363
- frame.setSize(1024, 768);
1364
- frame.show();
1386
+ frame.setSize(1280, 860);
1387
+ frame.setVisible(true);
13651388
13661389 gridPanel.setDividerLocation(1.0);
13671390
....@@ -1376,6 +1399,10 @@
13761399 });
13771400 }
13781401
1402
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1403
+ {
1404
+ }
1405
+
13791406 JTree GetTree()
13801407 {
13811408 return objEditor.jTree;
....@@ -1387,260 +1414,173 @@
13871414 ctrlPanel.removeAll();
13881415 }
13891416
1390
- void SetupMaterial(JPanel ctrlPanel)
1417
+ void SetupMaterial(cGridBag panel)
13911418 {
1392
- aConstraints.weighty = 0;
1393
- //aConstraints.weightx = 1;
1394
- /*
1419
+ /*
13951420 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13961421 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1397
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1398
- aConstraints.gridx += 1;
13991422 */
14001423
1401
- aConstraints.gridwidth = 1;
1402
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1403
- aConstraints.gridx += 1;
1404
- aConstraints.weighty = 0;
1405
- aConstraints.gridwidth = 1;
1424
+ cGridBag editBar = new cGridBag().setVertical(false);
1425
+
1426
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1427
+ createMaterialButton.setToolTipText("Create material");
14061428
14071429 /*
14081430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1409
- aConstraints.gridx += 1;
1410
- aConstraints.weighty = 0;
1411
- aConstraints.gridwidth = 1;
14121431 */
14131432
1414
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1415
- aConstraints.gridx += 1;
1433
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1434
+ clearMaterialButton.setToolTipText("Clear material");
1435
+
1436
+ if (Globals.ADVANCED)
1437
+ {
1438
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1439
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1440
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1441
+ }
14161442
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;
1443
+ editBar.preferredHeight = 15;
1444
+
1445
+ panel.add(editBar);
1446
+
14311447 /**/
14321448 //aConstraints.weighty = 0;
14331449 ////aConstraints.weightx = 1;
14341450 //aConstraints.weighty = 1;
14351451 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14361452 //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;
1453
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14421454
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;
1455
+ cGridBag colorSection = new cGridBag().setVertical(true);
1456
+
1457
+ cGridBag color = new cGridBag();
1458
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1459
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1460
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1461
+ //colorField.preferredWidth = 200;
1462
+ colorSection.add(color);
14531463
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;
1464
+ cGridBag modulation = new cGridBag();
1465
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1466
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1467
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1468
+ colorSection.add(modulation);
14631469
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;
1470
+ cGridBag texture = new cGridBag();
1471
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1472
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1474
+ colorSection.add(texture);
14731475
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;
1476
+ cGridBag anisoU = new cGridBag();
1477
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1478
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
+ colorSection.add(anisoU);
14831481
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;
1482
+ cGridBag anisoV = new cGridBag();
1483
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1484
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
+ colorSection.add(anisoV);
14931487
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;
1488
+ cGridBag shadowbias = new cGridBag();
1489
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1490
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1492
+ colorSection.add(shadowbias);
15031493
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;
1494
+ panel.add(new JSeparator());
1495
+
1496
+ panel.add(colorSection);
1497
+
1498
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1499
+
1500
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1501
+
1502
+ cGridBag diffuse = new cGridBag();
1503
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1504
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1505
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1506
+ diffuseSection.add(diffuse);
15121507
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;
1508
+ cGridBag diffuseness = new cGridBag();
1509
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1510
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1512
+ diffuseSection.add(diffuseness);
15221513
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;
1514
+ cGridBag selfshadow = new cGridBag();
1515
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1516
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1518
+ diffuseSection.add(selfshadow);
15321519
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;
1520
+ cGridBag sheen = new cGridBag();
1521
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1522
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1523
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1524
+ diffuseSection.add(sheen);
15421525
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;
1526
+ cGridBag subsurface = new cGridBag();
1527
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1528
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1530
+ diffuseSection.add(subsurface);
15521531
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;
1532
+ cGridBag shadow = new cGridBag();
1533
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1534
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1536
+ diffuseSection.add(shadow);
15621537
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;
1538
+ cGridBag fakedepth = new cGridBag();
1539
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1540
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1542
+ diffuseSection.add(fakedepth);
15721543
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;
1544
+ panel.add(new JSeparator());
1545
+
1546
+ panel.add(diffuseSection);
1547
+
1548
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1549
+
1550
+ cGridBag specularSection = new cGridBag().setVertical(true);
15821551
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;
1552
+ cGridBag specular = new cGridBag();
1553
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1554
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1555
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1556
+ specularSection.add(specular);
15911557
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;
1558
+ cGridBag lightarea = new cGridBag();
1559
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1560
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1561
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1562
+ specularSection.add(lightarea);
16011563
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;
1564
+ cGridBag shininess = new cGridBag();
1565
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1566
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1567
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1568
+ specularSection.add(shininess);
16111569
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;
1570
+ cGridBag metalness = new cGridBag();
1571
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1572
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1573
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1574
+ specularSection.add(metalness);
16211575
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;
1576
+ cGridBag velvet = new cGridBag();
1577
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1578
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1580
+ specularSection.add(velvet);
16311581
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();
1582
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1583
+ //Return();
16441584 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16451585 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16461586 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1651,130 +1591,93 @@
16511591 // aConstraints.gridy += 1;
16521592 // aConstraints.gridwidth = 1;
16531593
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;
16621594
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;
1595
+ panel.add(new JSeparator());
1596
+
1597
+ panel.add(specularSection);
1598
+
1599
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1600
+
1601
+ cGridBag globalSection = new cGridBag().setVertical(true);
16721602
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;
1603
+ cGridBag camera = new cGridBag();
1604
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1605
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1607
+ globalSection.add(camera);
16821608
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;
1609
+ cGridBag ambient = new cGridBag();
1610
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1611
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1612
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
+ globalSection.add(ambient);
16921614
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;
1615
+ cGridBag backlit = new cGridBag();
1616
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1617
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
+ globalSection.add(backlit);
17031620
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;
1621
+ cGridBag opacity = new cGridBag();
1622
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1623
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1625
+ globalSection.add(opacity);
17131626
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;
1627
+ panel.add(new JSeparator());
1628
+
1629
+ panel.add(globalSection);
1630
+
1631
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1632
+
1633
+ cGridBag textureSection = new cGridBag().setVertical(true);
17231634
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;
1635
+ cGridBag bump = new cGridBag();
1636
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1637
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1639
+ textureSection.add(bump);
17331640
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;
1641
+ cGridBag noise = new cGridBag();
1642
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1643
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1645
+ textureSection.add(noise);
17431646
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;
1647
+ cGridBag power = new cGridBag();
1648
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1649
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1651
+ textureSection.add(power);
17531652
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;
1653
+ cGridBag borderfade = new cGridBag();
1654
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1655
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1657
+ textureSection.add(borderfade);
17631658
1764
- //aConstraints.weighty = 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1766
- //aConstraints.gridx += 1;
1767
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1768
- aConstraints.weighty = 0;
1659
+ cGridBag fog = new cGridBag();
1660
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1661
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1663
+ textureSection.add(fog);
17691664
1770
- aConstraints.gridx = 0;
1771
- aConstraints.gridy = 0;
1772
- aConstraints.gridwidth = 1;
1665
+ cGridBag opacityPower = new cGridBag();
1666
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1667
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1668
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1669
+ textureSection.add(opacityPower);
1670
+
1671
+ panel.add(new JSeparator());
1672
+
1673
+ panel.add(textureSection);
1674
+
1675
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17731676
17741677 SetMaterial(copy); // .GetMaterial());
17751678
1776
- colorField.addChangeListener(this);
1777
- modulationField.addChangeListener(this);
1679
+ //colorField.addChangeListener(this);
1680
+// modulationField.addChangeListener(this);
17781681 metalnessField.addChangeListener(this);
17791682 diffuseField.addChangeListener(this);
17801683 specularField.addChangeListener(this);
....@@ -1804,12 +1707,15 @@
18041707 opacityPowerField.addChangeListener(this);
18051708 /**/
18061709
1807
- resetSlidersButton.addActionListener(this);
18081710 clearMaterialButton.addActionListener(this);
18091711 createMaterialButton.addActionListener(this);
1810
-
1811
- propagateToggle.addItemListener(this);
1812
- multiplyToggle.addItemListener(this);
1712
+
1713
+ if (Globals.ADVANCED)
1714
+ {
1715
+ resetSlidersButton.addActionListener(this);
1716
+ propagateToggle.addItemListener(this);
1717
+ multiplyToggle.addItemListener(this);
1718
+ }
18131719 }
18141720
18151721 void DropFile(java.io.File[] files, boolean textures)
....@@ -1980,7 +1886,7 @@
19801886
19811887 //? flashIt = false;
19821888 CameraPane pane = (CameraPane) cameraView;
1983
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
19841890 pane.clickEnd(location.x, location.y, 0, true);
19851891
19861892 if (group.selection.size() == 1)
....@@ -2029,6 +1935,7 @@
20291935 e2.printStackTrace();
20301936 }
20311937 }
1938
+
20321939 LoadJMEThread loadThread;
20331940
20341941 class LoadJMEThread extends Thread
....@@ -2086,6 +1993,7 @@
20861993 //LoadFile0(filename, converter);
20871994 }
20881995 }
1996
+
20891997 LoadOBJThread loadObjThread;
20901998
20911999 class LoadOBJThread extends Thread
....@@ -2437,11 +2345,11 @@
24372345
24382346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24392347 {
2440
- if (GrafreeD.standAlone)
2348
+ if (Grafreed.standAlone)
24412349 {
24422350 /**/
24432351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2444
- browser.show();
2352
+ browser.setVisible(true);
24452353 String filename = browser.getFile();
24462354 if (filename != null && filename.length() > 0)
24472355 {
....@@ -2586,6 +2494,7 @@
25862494 }
25872495 if (input == null)
25882496 {
2497
+ new Exception().printStackTrace();
25892498 System.exit(0);
25902499 }
25912500
....@@ -2800,7 +2709,8 @@
28002709 return;
28012710 }
28022711
2803
- multiplyToggle.setSelected(mat.multiply);
2712
+ if (multiplyToggle != null)
2713
+ multiplyToggle.setSelected(mat.multiply);
28042714
28052715 assert (object.projectedVertices != null);
28062716
....@@ -2989,7 +2899,8 @@
29892899 if (timeline)
29902900 {
29912901 centralPanel.remove(cameraView);
2992
- centralPanel.add(timelinePanel);
2902
+ cameraPanel.add(cameraView);
2903
+ centralPanel.add(cameraPanel);
29932904 frame.setJMenuBar(timelineMenubar);
29942905 wasFullScreen = CameraPane.FULLSCREEN;
29952906 if (!CameraPane.FULLSCREEN)
....@@ -2998,7 +2909,7 @@
29982909 }
29992910 else
30002911 {
3001
- centralPanel.remove(timelinePanel);
2912
+ centralPanel.remove(cameraPanel);
30022913 centralPanel.add(cameraView);
30032914 frame.setJMenuBar(null);
30042915 if (!wasFullScreen)
....@@ -3014,7 +2925,7 @@
30142925 frame.validate();
30152926
30162927 return;
3017
- } else if (event.getSource() == toggleRandomItem)
2928
+ } else if (event.getSource() == toggleSwitchItem)
30182929 {
30192930 cameraView.ToggleRandom();
30202931 cameraView.repaint();
....@@ -3045,6 +2956,10 @@
30452956 {
30462957 copy.live ^= true;
30472958 return;
2959
+ } else if (event.getSource() == selectCB)
2960
+ {
2961
+ copy.dontselect ^= true;
2962
+ return;
30482963 } else if (event.getSource() == hideCB)
30492964 {
30502965 copy.hide ^= true;
....@@ -3059,6 +2974,7 @@
30592974 if (event.getSource() == randomCB)
30602975 {
30612976 copy.random ^= true;
2977
+ objEditor.refreshContents();
30622978 return;
30632979 }
30642980 if (event.getSource() == speedupCB)
....@@ -3082,8 +2998,9 @@
30822998
30832999 public void actionPerformed(ActionEvent event)
30843000 {
3001
+ Object source = event.getSource();
30853002 // SCRIPT DIALOG
3086
- if (event.getSource() == okbutton)
3003
+ if (source == okbutton)
30873004 {
30883005 textpanel.setVisible(false);
30893006 textpanel.remove(textarea);
....@@ -3095,7 +3012,7 @@
30953012 textarea = null;
30963013 textpanel = null;
30973014 }
3098
- if (event.getSource() == cancelbutton)
3015
+ if (source == cancelbutton)
30993016 {
31003017 textpanel.setVisible(false);
31013018 textpanel.remove(textarea);
....@@ -3107,49 +3024,50 @@
31073024 //applySelf();
31083025 //client.refreshEditWindow();
31093026 //refreshContents();
3110
- if (event.getSource() == nameField)
3027
+ if (source == nameField)
31113028 {
31123029 //System.out.println("ObjEditor " + event);
31133030 applySelf0(true);
31143031 //parent.applySelf();
31153032 objEditor.refreshContents();
3116
- } else if (event.getSource() == resetButton)
3033
+ } else if (source == resetButton)
31173034 {
31183035 CameraPane.fullreset = true;
31193036 copy.Reset(); // ResetMeshes();
31203037 copy.Touch();
31213038 objEditor.refreshContents();
3122
- } else if (event.getSource() == stepItem)
3039
+ } else if (source == stepItem)
31233040 {
3124
- cameraView.ONESTEP = true;
3041
+ //cameraView.ONESTEP = true;
3042
+ Globals.ONESTEP = true;
31253043 cameraView.repaint();
31263044 return;
3127
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
31283046 {
31293047 copy.Step();
31303048 copy.Touch();
31313049 objEditor.refreshContents();
3132
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
31333051 {
31343052 copy.Slower();
31353053 copy.Touch();
31363054 objEditor.refreshContents();
3137
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
31383056 {
31393057 copy.Faster();
31403058 copy.Touch();
31413059 objEditor.refreshContents();
3142
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
31433061 {
31443062 copy.Remark();
31453063 copy.Touch();
31463064 objEditor.refreshContents();
3147
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
31483066 {
31493067 copy.StepAll();
31503068 copy.Touch();
31513069 objEditor.refreshContents();
3152
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
31533071 {
31543072 //CameraPane.fullreset = true;
31553073 copy.ResetAll(); // ResetMeshes();
....@@ -3182,53 +3100,75 @@
31823100 // Close();
31833101 // }
31843102 // else
3185
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
31863104 {
31873105 ResetSliders();
3188
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
31893107 {
31903108 ClearMaterial();
3191
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
31923110 {
31933111 CreateMaterial();
3194
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
31953113 {
31963114 copy.ClearUI();
31973115 refreshContents(true);
3198
- } /*
3199
- }
3200
-
3201
- public boolean action(Event event, Object arg)
3202
- {
3203
- */ else if (event.getSource() == closeItem)
3116
+ } else if (source == importGFDItem)
3117
+ {
3118
+ ImportGFD();
3119
+ } else
3120
+ if (source == importVRMLX3DItem)
3121
+ {
3122
+ ImportVRMLX3D();
3123
+ } else
3124
+ if (source == import3DSItem)
3125
+ {
3126
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3127
+ } else
3128
+ if (source == importOBJItem)
3129
+ {
3130
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3131
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3132
+ browser.setVisible(true);
3133
+ String filename = browser.getFile();
3134
+ if (filename != null && filename.length() > 0)
3135
+ {
3136
+ String fullname = browser.getDirectory() + filename;
3137
+ makeSomething(ReadOBJ(fullname), true);
3138
+ }
3139
+ } else
3140
+ if (source == closeItem)
32043141 {
32053142 Close();
32063143 //return true;
3207
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
32083145 {
32093146 load();
32103147 //return true;
3211
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
32123152 {
32133153 save();
32143154 //return true;
3215
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
32163156 {
32173157 saveAs();
32183158 //return true;
3219
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
32203160 {
32213161 reexport();
32223162 //return true;
3223
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
32243164 {
32253165 export();
32263166 //return true;
3227
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
32283168 {
32293169 generatePOV();
32303170 //return true;
3231
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
32323172 {
32333173 try
32343174 {
....@@ -3250,21 +3190,8 @@
32503190 cameraView.repaint();
32513191 //return true;
32523192 }
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)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
32683195 {
32693196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32703197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3276,27 +3203,205 @@
32763203 }
32773204 }
32783205
3279
- void ToggleAnimation()
3206
+ void New()
32803207 {
3281
- if (!CameraPane.ANIMATION)
3208
+ while (copy.Size() > 1)
32823209 {
3283
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3210
+ copy.remove(1);
3211
+ }
3212
+
3213
+ ResetModel();
3214
+ objEditor.refreshContents();
3215
+ }
3216
+
3217
+ static public Object clone(Object o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3223
+
3224
+ out.writeObject(o);
3225
+
3226
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
3227
+ ObjectInputStream in = new ObjectInputStream(bais);
3228
+ Object obj = in.readObject();
3229
+ in.close();
3230
+ out.close();
3231
+ return obj;
3232
+ } catch (Exception e)
3233
+ {
3234
+ System.err.println(e);
3235
+ return null;
3236
+ }
3237
+ }
3238
+
3239
+ cRadio GetCurrentTab()
3240
+ {
3241
+ cRadio ab;
3242
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3243
+ {
3244
+ ab = (cRadio)e.nextElement();
3245
+ if(ab.GetObject() == client)
3246
+ {
3247
+ return ab;
3248
+ }
3249
+ }
3250
+
3251
+ return null;
3252
+ }
3253
+
3254
+ public void Save()
3255
+ {
3256
+ cRadio tab = GetCurrentTab();
3257
+
3258
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3259
+ tab.graphs[tab.undoindex++] = (Object3D)clone(copy);
3260
+
3261
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3262
+ {
3263
+ tab.graphs[i] = null;
3264
+ }
3265
+
3266
+ // test save
3267
+ if (false)
3268
+ {
3269
+ try
3270
+ {
3271
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3272
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3273
+
3274
+ p.writeObject(copy);
3275
+
3276
+ p.flush();
3277
+
3278
+ ostream.close();
3279
+ } catch (Exception e)
3280
+ {
3281
+ e.printStackTrace();
3282
+ }
3283
+ }
3284
+ }
3285
+
3286
+ void CopyChanged(Object3D obj)
3287
+ {
3288
+ copy.clear();
3289
+
3290
+ for (int i=0; i<obj.Size(); i++)
3291
+ {
3292
+ copy.add(obj.get(i));
3293
+ }
3294
+
3295
+ copy.Touch();
3296
+
3297
+ ResetModel();
3298
+ copy.HardTouch(); // recompile?
3299
+
3300
+ cRadio ab;
3301
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3302
+ {
3303
+ ab = (cRadio)e.nextElement();
3304
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3305
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3306
+ if (test != null)
3307
+ {
3308
+ test.editWindow = ab.object.editWindow;
3309
+ ab.object = test;
3310
+ }
3311
+ }
3312
+
3313
+ refreshContents();
3314
+ }
3315
+
3316
+ public void Undo()
3317
+ {
3318
+ cRadio tab = GetCurrentTab();
3319
+
3320
+ if (tab.undoindex == 0)
3321
+ {
3322
+ java.awt.Toolkit.getDefaultToolkit().beep();
3323
+ return;
3324
+ }
3325
+
3326
+ if (tab.graphs[tab.undoindex] == null)
3327
+ {
3328
+ Save();
3329
+ tab.undoindex -= 1;
3330
+ }
3331
+
3332
+ tab.undoindex -= 1;
3333
+
3334
+ CopyChanged(tab.graphs[tab.undoindex]);
3335
+ }
3336
+
3337
+ public void Redo()
3338
+ {
3339
+ cRadio tab = GetCurrentTab();
3340
+
3341
+ if (tab.graphs[tab.undoindex + 1] == null)
3342
+ {
3343
+ java.awt.Toolkit.getDefaultToolkit().beep();
3344
+ return;
3345
+ }
3346
+
3347
+ tab.undoindex += 1;
3348
+
3349
+ CopyChanged(tab.graphs[tab.undoindex]);
3350
+ }
3351
+
3352
+ void ImportGFD()
3353
+ {
3354
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32843355 browser.show();
32853356 String filename = browser.getFile();
32863357 if (filename != null && filename.length() > 0)
32873358 {
3288
- CameraPane.filename = browser.getDirectory() + filename;
3359
+ String fullname = browser.getDirectory() + filename;
3360
+
3361
+ //Object3D readobj =
3362
+ objEditor.ReadGFD(fullname, objEditor);
3363
+ //makeSomething(readobj);
3364
+ }
3365
+ }
3366
+
3367
+ void ImportVRMLX3D()
3368
+ {
3369
+ if (Grafreed.standAlone)
3370
+ {
3371
+ /**/
3372
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3373
+ browser.show();
3374
+ String filename = browser.getFile();
3375
+ if (filename != null && filename.length() > 0)
3376
+ {
3377
+ String fullname = browser.getDirectory() + filename;
3378
+ LoadVRMLX3D(fullname);
3379
+ }
3380
+ /**/
3381
+ }
3382
+ }
3383
+
3384
+ void ToggleAnimation()
3385
+ {
3386
+ if (!Globals.ANIMATION)
3387
+ {
3388
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3389
+ browser.setVisible(true);
3390
+ String filename = browser.getFile();
3391
+ if (filename != null && filename.length() > 0)
3392
+ {
3393
+ Globals.filename = browser.getDirectory() + filename;
32893394 //CameraPane.framecount = 0;
3290
- CameraPane.imagecount = 0;
3395
+ Globals.imagecount = 0;
32913396
3292
- CameraPane.ANIMATION ^= true;
3397
+ Globals.ANIMATION ^= true;
32933398
3294
- GrafreeD.wav.cursor = 0;
3295
- GrafreeD.wav.loop = 0;
3399
+ Grafreed.wav.cursor = 0;
3400
+ Grafreed.wav.loop = 0;
32963401 }
32973402 } else
32983403 {
3299
- CameraPane.ANIMATION ^= true;
3404
+ Globals.ANIMATION ^= true;
33003405 }
33013406 }
33023407
....@@ -3342,7 +3447,7 @@
33423447 void CreateMaterial()
33433448 {
33443449 //copy.ClearMaterial(); // PATCH
3345
- copy.CreateMaterialS(multiplyToggle.isSelected());
3450
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33463451 if (copy.selection.size() > 0)
33473452 //SetMaterial(copy);
33483453 {
....@@ -3401,11 +3506,11 @@
34013506 {
34023507 copy.ResetBlockLoop(); // temporary problem
34033508
3404
- boolean random = CameraPane.RANDOM;
3405
- CameraPane.RANDOM = false; // parse everything
3509
+ boolean random = CameraPane.SWITCH;
3510
+ CameraPane.SWITCH = false; // parse everything
34063511 copy.ResetDisplayList();
34073512 copy.HardTouch();
3408
- CameraPane.RANDOM = random;
3513
+ CameraPane.SWITCH = random;
34093514 }
34103515
34113516 // public void applySelf()
....@@ -3475,10 +3580,40 @@
34753580 current.fakedepth = (float) fakedepthField.getFloat();
34763581 current.shadowbias = (float) shadowbiasField.getFloat();
34773582
3478
- if (!NumberSlider.frozen)
3583
+ if (!cNumberSlider.frozen)
34793584 {
34803585 //System.out.println("Propagate = " + propagate);
34813586 copy.UpdateMaterial(anchor, current, propagate);
3587
+
3588
+ if (copy.material != null)
3589
+ {
3590
+ cMaterial mat = copy.material;
3591
+
3592
+ colorField.SetToolTipValue((mat.color));
3593
+ modulationField.SetToolTipValue((mat.modulation));
3594
+ metalnessField.SetToolTipValue((mat.metalness));
3595
+ diffuseField.SetToolTipValue((mat.diffuse));
3596
+ specularField.SetToolTipValue((mat.specular));
3597
+ shininessField.SetToolTipValue((mat.shininess));
3598
+ shiftField.SetToolTipValue((mat.shift));
3599
+ ambientField.SetToolTipValue((mat.ambient));
3600
+ lightareaField.SetToolTipValue((mat.lightarea));
3601
+ diffusenessField.SetToolTipValue((mat.factor));
3602
+ velvetField.SetToolTipValue((mat.velvet));
3603
+ sheenField.SetToolTipValue((mat.sheen));
3604
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3605
+ backlitField.SetToolTipValue((mat.bump));
3606
+ anisoField.SetToolTipValue((mat.aniso));
3607
+ anisoVField.SetToolTipValue((mat.anisoV));
3608
+ cameraField.SetToolTipValue((mat.cameralight));
3609
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3610
+ shadowField.SetToolTipValue((mat.shadow));
3611
+ textureField.SetToolTipValue((mat.texture));
3612
+ opacityField.SetToolTipValue((mat.opacity));
3613
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3614
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3615
+ }
3616
+
34823617 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34833618 {
34843619 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3523,6 +3658,7 @@
35233658 || e.getSource() == apertureField
35243659 || e.getSource() == shadowblurField)
35253660 {
3661
+ new Exception().printStackTrace();
35263662 System.exit(0);
35273663 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35283664 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3549,7 +3685,13 @@
35493685 //System.out.println("PARENT = " + parent);
35503686 //if (parent != null)
35513687 // parent.applySelf();
3552
- refreshContents();
3688
+ if (e.getSource() == normalpushField)
3689
+ {
3690
+ objEditor.refreshContents();
3691
+ //Refresh();
3692
+ }
3693
+ else
3694
+ refreshContents();
35533695 // ??? client.refreshEditWindow();
35543696 }
35553697 //else
....@@ -3561,7 +3703,7 @@
35613703 //group.name = nameField.getText();
35623704 //objEditor.applySelf();
35633705
3564
- assert (objEditor == this);
3706
+ // OCT2018: assert (objEditor == this);
35653707 if (copy.selection == null || copy.selection.size() == 0)
35663708 //super.applySelf()
35673709 ; else
....@@ -3585,6 +3727,9 @@
35853727 objEditor.copy = keep;
35863728 }
35873729 }
3730
+
3731
+ if (normalpushField != null)
3732
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35883733 }
35893734
35903735 void SnapObject()
....@@ -3839,7 +3984,7 @@
38393984
38403985 radioPanel.revalidate();
38413986 radioPanel.repaint();
3842
- ctrlPanel.revalidate(); // ? new
3987
+ ctrlPanel.validate(); // ? new
38433988 ctrlPanel.repaint();
38443989 }
38453990 }
....@@ -3848,6 +3993,7 @@
38483993
38493994 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38503995 {
3996
+ Save();
38513997 //Tween.set(thing, 0).target(1).start(tweenManager);
38523998 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38533999 // if (thing instanceof GenericJointDemo)
....@@ -4051,6 +4197,7 @@
40514197 }
40524198 }
40534199 }
4200
+
40544201 LoadGFDThread loadGFDThread;
40554202
40564203 void ReadGFD(String fullname, iCallBack cb)
....@@ -4071,7 +4218,8 @@
40714218 try
40724219 {
40734220 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4074
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4221
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4222
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40754223
40764224 readobj = (Object3D) p.readObject();
40774225 istream.close();
....@@ -4079,7 +4227,20 @@
40794227 readobj.ResetDisplayList();
40804228 } catch (Exception e)
40814229 {
4082
- e.printStackTrace();
4230
+ //e.printStackTrace();
4231
+ try
4232
+ {
4233
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4234
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4235
+
4236
+ readobj = (Object3D) p.readObject();
4237
+ istream.close();
4238
+
4239
+ readobj.ResetDisplayList();
4240
+ } catch (Exception e2)
4241
+ {
4242
+ e2.printStackTrace();
4243
+ }
40834244 }
40844245 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40854246 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4196,7 +4357,7 @@
41964357
41974358 void load() // throws ClassNotFoundException
41984359 {
4199
- if (GrafreeD.standAlone)
4360
+ if (Grafreed.standAlone)
42004361 {
42014362 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42024363 browser.show();
....@@ -4283,11 +4444,13 @@
42834444 try
42844445 {
42854446 FileOutputStream ostream = new FileOutputStream(lastname);
4286
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4447
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4448
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42874449
42884450 p.writeObject(copy);
42894451 p.flush();
42904452
4453
+ zstream.close();
42914454 ostream.close();
42924455
42934456 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4297,11 +4460,12 @@
42974460 {
42984461 }
42994462 }
4463
+
43004464 String lastname;
43014465
43024466 void saveAs()
43034467 {
4304
- if (GrafreeD.standAlone)
4468
+ if (Grafreed.standAlone)
43054469 {
43064470 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43074471 browser.setVisible(true);
....@@ -4406,13 +4570,13 @@
44064570 try
44074571 {
44084572 FileOutputStream ostream = new FileOutputStream(filename);
4409
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4410
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4573
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4574
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44114575
44124576 Object3D objectparent = obj.parent;
44134577 obj.parent = null;
44144578
4415
- Object3D object = (Object3D) GrafreeD.clone(obj);
4579
+ Object3D object = (Object3D) Grafreed.clone(obj);
44164580
44174581 obj.parent = objectparent;
44184582
....@@ -4424,8 +4588,8 @@
44244588 p.writeObject(object);
44254589 p.flush();
44264590
4591
+ zstream.close();
44274592 ostream.close();
4428
- // zstream.close();
44294593
44304594 // group.selection.get(0).parent = parent;
44314595 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4446,7 +4610,7 @@
44464610 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44474611 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44484612 copy.generatePOV(buffer);
4449
- if (GrafreeD.standAlone)
4613
+ if (Grafreed.standAlone)
44504614 {
44514615 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44524616 browser.show();
....@@ -4472,7 +4636,8 @@
44724636 Object3D client;
44734637 Object3D copy;
44744638 MenuBar menuBar;
4475
- Menu windowMenu;
4639
+ Menu fileMenu;
4640
+ MenuItem newItem;
44764641 MenuItem loadItem;
44774642 MenuItem saveItem;
44784643 MenuItem saveAsItem;
....@@ -4480,13 +4645,11 @@
44804645 MenuItem reexportItem;
44814646 MenuItem povItem;
44824647 MenuItem closeItem;
4483
- Menu cameraMenu;
4648
+
44844649 CheckboxMenuItem zBufferItem;
44854650 //MenuItem normalLensItem;
4486
- MenuItem editCameraItem;
4487
- MenuItem revertCameraItem;
4488
- CheckboxMenuItem toggleLiveItem;
44894651 MenuItem stepItem;
4652
+ CheckboxMenuItem toggleLiveItem;
44904653 CheckboxMenuItem toggleFullScreenItem;
44914654 CheckboxMenuItem toggleTimelineItem;
44924655 CheckboxMenuItem toggleRenderItem;
....@@ -4495,7 +4658,7 @@
44954658 CheckboxMenuItem toggleFootContactItem;
44964659 CheckboxMenuItem toggleDLItem;
44974660 CheckboxMenuItem toggleTextureItem;
4498
- CheckboxMenuItem toggleRandomItem;
4661
+ CheckboxMenuItem toggleSwitchItem;
44994662 CheckboxMenuItem toggleRootItem;
45004663 CheckboxMenuItem animationItem;
45014664 CheckboxMenuItem toggleHandleItem;
....@@ -4503,20 +4666,21 @@
45034666 JSplitPane mainPanel;
45044667 JScrollPane scrollpane;
45054668 JPanel toolbarPanel;
4506
- JPanel treePanel;
4669
+ cGridBag treePanel;
45074670 JPanel radioPanel;
45084671 ButtonGroup buttonGroup;
4509
- JPanel ctrlPanel;
4510
- JPanel materialPanel;
4672
+ cGridBag ctrlPanel;
4673
+ cGridBag materialPanel;
45114674 JScrollPane infoPanel;
4512
- JPanel optionsPanel;
4675
+ cGridBag optionsPanel;
45134676 JTabbedPane objectPanel;
4514
- JPanel XYZPanel;
4677
+ cGridBag XYZPanel;
45154678 JSplitPane gridPanel;
45164679 JSplitPane bigPanel;
4517
- JPanel bigThree;
4518
- JTabbedPane scenePanel;
4519
- JPanel centralPanel;
4680
+ cGridBag bigThree;
4681
+ cGridBag scenePanel;
4682
+ cGridBag centralPanel;
4683
+ JSplitPane cameraPanel;
45204684 JPanel timelinePanel;
45214685 JMenuBar timelineMenubar;
45224686 JSplitPane framePanel;
....@@ -4568,65 +4732,72 @@
45684732 // MATERIAL
45694733 JLabel materialLabel;
45704734 JLabel colorLabel;
4571
- NumberSlider colorField;
4735
+ cNumberSlider colorField;
45724736 JLabel modulationLabel;
4573
- NumberSlider modulationField;
4737
+ cNumberSlider modulationField;
45744738 JLabel metalnessLabel;
4575
- NumberSlider metalnessField;
4739
+ cNumberSlider metalnessField;
45764740 JLabel diffuseLabel;
4577
- NumberSlider diffuseField;
4741
+ cNumberSlider diffuseField;
45784742 JLabel specularLabel;
4579
- NumberSlider specularField;
4743
+ cNumberSlider specularField;
45804744 JLabel shininessLabel;
4581
- NumberSlider shininessField;
4745
+ cNumberSlider shininessField;
45824746 JLabel shiftLabel;
4583
- NumberSlider shiftField;
4747
+ cNumberSlider shiftField;
45844748 JLabel ambientLabel;
4585
- NumberSlider ambientField;
4749
+ cNumberSlider ambientField;
45864750 JLabel lightareaLabel;
4587
- NumberSlider lightareaField;
4751
+ cNumberSlider lightareaField;
45884752 JLabel diffusenessLabel;
4589
- NumberSlider diffusenessField;
4753
+ cNumberSlider diffusenessField;
45904754 JLabel velvetLabel;
4591
- NumberSlider velvetField;
4755
+ cNumberSlider velvetField;
45924756 JLabel sheenLabel;
4593
- NumberSlider sheenField;
4757
+ cNumberSlider sheenField;
45944758 JLabel subsurfaceLabel;
4595
- NumberSlider subsurfaceField;
4759
+ cNumberSlider subsurfaceField;
45964760 //JLabel bumpLabel;
45974761 //NumberSlider bumpField;
45984762 JLabel backlitLabel;
4599
- NumberSlider backlitField;
4763
+ cNumberSlider backlitField;
46004764 JLabel anisoLabel;
4601
- NumberSlider anisoField;
4765
+ cNumberSlider anisoField;
46024766 JLabel anisoVLabel;
4603
- NumberSlider anisoVField;
4767
+ cNumberSlider anisoVField;
46044768 JLabel cameraLabel;
4605
- NumberSlider cameraField;
4769
+ cNumberSlider cameraField;
46064770 JLabel selfshadowLabel;
4607
- NumberSlider selfshadowField;
4771
+ cNumberSlider selfshadowField;
46084772 JLabel shadowLabel;
4609
- NumberSlider shadowField;
4773
+ cNumberSlider shadowField;
46104774 JLabel textureLabel;
4611
- NumberSlider textureField;
4775
+ cNumberSlider textureField;
46124776 JLabel opacityLabel;
4613
- NumberSlider opacityField;
4777
+ cNumberSlider opacityField;
46144778 JLabel fakedepthLabel;
4615
- NumberSlider fakedepthField;
4779
+ cNumberSlider fakedepthField;
46164780 JLabel shadowbiasLabel;
4617
- NumberSlider shadowbiasField;
4781
+ cNumberSlider shadowbiasField;
46184782 JLabel bumpLabel;
4619
- NumberSlider bumpField;
4783
+ cNumberSlider bumpField;
46204784 JLabel noiseLabel;
4621
- NumberSlider noiseField;
4785
+ cNumberSlider noiseField;
46224786 JLabel powerLabel;
4623
- NumberSlider powerField;
4787
+ cNumberSlider powerField;
46244788 JLabel borderfadeLabel;
4625
- NumberSlider borderfadeField;
4789
+ cNumberSlider borderfadeField;
46264790 JLabel fogLabel;
4627
- NumberSlider fogField;
4791
+ cNumberSlider fogField;
46284792 JLabel opacityPowerLabel;
4629
- NumberSlider opacityPowerField;
4793
+ cNumberSlider opacityPowerField;
46304794 JTree jTree;
46314795 //ObjectUI parent;
4796
+
4797
+ cNumberSlider normalpushField;
4798
+
4799
+ private MenuItem importGFDItem;
4800
+ private MenuItem importVRMLX3DItem;
4801
+ private MenuItem import3DSItem;
4802
+ private MenuItem importOBJItem;
46324803 }