Normand Briere
2019-06-16 b33ef80d78f01a6a61f4248b1bb7deaade42d503
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,
....@@ -28,7 +30,12 @@
2830 iSendInfo
2931 //KeyListener
3032 {
33
+ boolean timeline;
34
+ boolean wasFullScreen;
3135
36
+ GroupEditor callee;
37
+ JFrame frame;
38
+
3239 // SCRIPT
3340
3441 transient JFrame textpanel = null;
....@@ -119,51 +126,61 @@
119126 void keyPressed(int key, int modifiers)
120127 {
121128 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
129
+ Globals.theRenderer.keyPressed(key, modifiers);
123130 }
124131 */
125132
126133 static GridBagConstraints aConstraints;
127134 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
135
+
130136 static int GRIDWIDTH = 100; // 4;
131137
132138 public void closeUI()
133139 {
134140 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
141
+// System.out.println("this = " + this);
142
+// System.out.println("objEditor = " + objEditor);
137143 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
144
+// objEditor.ctrlPanel.remove(nameField);
145
+
146
+ objEditor.ctrlPanel.remove(namePanel);
139147
140148 if (!GroupEditor.allparams)
141149 return;
142150
143
- objEditor.ctrlPanel.remove(liveCB);
144
- objEditor.ctrlPanel.remove(hideCB);
145
- objEditor.ctrlPanel.remove(markCB);
146
-
147
- objEditor.ctrlPanel.remove(randomCB);
148
- objEditor.ctrlPanel.remove(speedupCB);
149
- objEditor.ctrlPanel.remove(rewindCB);
150
-
151
- objEditor.ctrlPanel.remove(resetButton);
152
- objEditor.ctrlPanel.remove(stepButton);
153
-// objEditor.ctrlPanel.remove(stepAllButton);
154
-// objEditor.ctrlPanel.remove(resetAllButton);
155
- objEditor.ctrlPanel.remove(link2masterCB);
156
- //objEditor.ctrlPanel.remove(flipVCB);
157
- //objEditor.ctrlPanel.remove(texresMenu);
158
- objEditor.ctrlPanel.remove(slowerButton);
159
- objEditor.ctrlPanel.remove(fasterButton);
160
- 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);
161176 }
162177
163178 public ObjEditor GetEditor()
164179 {
165180 return objEditor; //.GetEditor();
166181 }
182
+
183
+ // Sometimes myself, sometimes my callee's.
167184 ObjEditor objEditor;
168185
169186 /*
....@@ -238,7 +255,7 @@
238255 //if (!isDisplayable())
239256 //setUndecorated(true);
240257
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
258
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242259 client = inClient;
243260 copy = localCopy;
244261 copy.editWindow = this;
....@@ -259,24 +276,40 @@
259276 void SetupMenu()
260277 {
261278 frame.setMenuBar(menuBar = new MenuBar());
262
- menuBar.add(windowMenu = new Menu("File"));
263
- windowMenu.add(loadItem = new MenuItem("Load..."));
264
- windowMenu.add("-");
265
- windowMenu.add(saveItem = new MenuItem("Save"));
266
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
279
+ menuBar.add(fileMenu = new Menu("File"));
280
+ fileMenu.add(newItem = new MenuItem("New"));
281
+ fileMenu.add(loadItem = new MenuItem("Open..."));
282
+
283
+ //oe.menuBar.add(menu = new Menu("Include"));
284
+ Menu menu = new Menu("Import");
285
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
286
+ importOBJItem.addActionListener(this);
287
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
288
+ import3DSItem.addActionListener(this);
289
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
290
+ importVRMLX3DItem.addActionListener(this);
291
+ menu.add("-");
292
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
293
+ importGFDItem.addActionListener(this);
294
+ fileMenu.add(menu);
295
+ fileMenu.add("-");
296
+
297
+ fileMenu.add(saveItem = new MenuItem("Save"));
298
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267299 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
268
- windowMenu.add("-");
269
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
270
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
271
- windowMenu.add("-");
300
+ fileMenu.add("-");
301
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
302
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
303
+ fileMenu.add("-");
272304 if (client.parent != null)
273305 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
306
+ fileMenu.add(closeItem = new MenuItem("Close"));
275307 } else
276308 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
309
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278310 }
279311
312
+ newItem.addActionListener(this);
280313 loadItem.addActionListener(this);
281314 saveItem.addActionListener(this);
282315 saveAsItem.addActionListener(this);
....@@ -285,79 +318,26 @@
285318 //povItem.addActionListener(this);
286319 closeItem.addActionListener(this);
287320
288
- menuBar.add(cameraMenu = new Menu("View"));
289
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
290
- //zBufferItem.addActionListener(this);
291
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
292
- //normalLensItem.addActionListener(this);
293
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294
- revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullScreenItem.addItemListener(this);
297
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
299
- toggleTimelineItem.addItemListener(this);
300
- cameraMenu.add("-");
301
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
302
- toggleTextureItem.addItemListener(this);
303
- toggleTextureItem.setState(CameraPane.textureon);
304
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
305
- toggleLiveItem.addItemListener(this);
306
- toggleLiveItem.setState(CameraPane.isLIVE());
307
- cameraMenu.add(stepItem = new MenuItem("Step"));
308
- stepItem.addActionListener(this);
309
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
310
-// toggleDLItem.addItemListener(this);
311
-// toggleDLItem.setState(false);
312
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
313
- toggleRenderItem.addItemListener(this);
314
- toggleRenderItem.setState(!CameraPane.frozen);
315
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
316
- toggleDebugItem.addItemListener(this);
317
- toggleDebugItem.setState(CameraPane.DEBUG);
318
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
319
- toggleFrustumItem.addItemListener(this);
320
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
321
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
322
- toggleFootContactItem.addItemListener(this);
323
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
324
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
325
- toggleRandomItem.addItemListener(this);
326
- toggleRandomItem.setState(CameraPane.RANDOM);
327
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
328
- toggleHandleItem.addItemListener(this);
329
- toggleHandleItem.setState(CameraPane.HANDLES);
330
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
331
- togglePaintItem.addItemListener(this);
332
- togglePaintItem.setState(CameraPane.PAINTMODE);
333
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
334
-// toggleRootItem.addItemListener(this);
335
-// toggleRootItem.setState(false);
336
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
337
-// animationItem.addItemListener(this);
338
-// animationItem.setState(CameraPane.ANIMATION);
339
- cameraMenu.add("-");
340
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
341
- editCameraItem.addActionListener(this);
342
-
343321 objectPanel = new JTabbedPane();
344322 toolbarPanel = new JPanel();
345323 toolbarPanel.setName("Toolbar");
346
- treePanel = new JPanel();
324
+ treePanel = new cGridBag();
347325 treePanel.setName("Tree");
348
- ctrlPanel = new JPanel(); // new GridBagLayout());
326
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
349327 ctrlPanel.setName("Edit");
350
- materialPanel = new JPanel();
328
+ materialPanel = new cGridBag().setVertical(true);
351329 materialPanel.setName("Material");
352330 /*JTextPane*/
353331 infoarea = createTextPane();
332
+ doc = infoarea.getStyledDocument();
333
+
354334 infoarea.setEditable(true);
355335 SetText();
356336 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
357337 // infoarea.setOpaque(false);
358338 // //infoarea.setForeground(textcolor);
359
- infoarea.setLineWrap(true);
360
- infoarea.setWrapStyleWord(true);
339
+// TEXTAREA infoarea.setLineWrap(true);
340
+// TEXTAREA infoarea.setWrapStyleWord(true);
361341 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
362342 infoPanel.setPreferredSize(new Dimension(50, 200));
363343 infoPanel.setName("Info");
....@@ -368,16 +348,16 @@
368348 mainPanel.setName("Main");
369349 mainPanel.setContinuousLayout(true);
370350 mainPanel.setOneTouchExpandable(true);
371
- mainPanel.setDividerLocation(1.0);
372351 mainPanel.setDividerSize(9);
373
- mainPanel.setResizeWeight(0);
352
+ mainPanel.setDividerLocation(0.5); //1.0);
353
+ mainPanel.setResizeWeight(0.5);
374354
375355 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
376356 //mainPanel.setLayout(new GridBagLayout());
377357 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
378
- treePanel.setLayout(new GridBagLayout());
379
- ctrlPanel.setLayout(new GridBagLayout());
380
- materialPanel.setLayout(new GridBagLayout());
358
+// treePanel.setLayout(new GridBagLayout());
359
+ //ctrlPanel.setLayout(new GridBagLayout());
360
+ //materialPanel.setLayout(new GridBagLayout());
381361
382362 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
383363 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -416,7 +396,7 @@
416396 static String newline = "\n";
417397 protected static final String buttonString = "JButton";
418398 StyledDocument doc;
419
- JTextArea infoarea;
399
+ JTextPane infoarea;
420400
421401 void ClearInfo()
422402 {
....@@ -465,13 +445,13 @@
465445 //SendInfo("Name:", "bold");
466446 if (sel.GetTextures() != null || debug)
467447 {
468
- si.SendInfo(sel.toString(), "bold");
448
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
469449 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
470450 if (sel.Size() > 0)
471451 {
472452 si.SendInfo("#children = " + sel.Size(), "regular");
473453 }
474
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
454
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
475455 if (debug)
476456 {
477457 try
....@@ -483,7 +463,10 @@
483463 }
484464
485465 if (full)
486
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
466
+ {
467
+ si.SendInfo(" BBox min: " + minima, "regular");
468
+ si.SendInfo(" BBox max: " + maxima, "regular");
469
+ }
487470
488471 if (sel.bRep != null)
489472 {
....@@ -510,7 +493,7 @@
510493 }
511494 if (sel.support != null)
512495 {
513
- si.SendInfo(" support: " + sel.support, "regular");
496
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
514497 }
515498 if (sel.scriptnode != null)
516499 {
....@@ -581,6 +564,9 @@
581564 {
582565 CameraPane.pointflow = (PointFlow) sel;
583566 }
567
+
568
+ si.SendInfo("_____________________", "regular");
569
+ si.SendInfo("", "regular");
584570 }
585571 }
586572
....@@ -596,52 +582,68 @@
596582 }
597583 }
598584
599
- private JTextArea createTextPane()
600
- {
601
- String[] initString =
585
+ void ToggleFullScreen()
602586 {
603
- "This is an editable JTextPane, ", //regular
604
- "another ", //italic
605
- "styled ", //bold
606
- "text ", //small
607
- "component, ", //large
608
- "which supports embedded components..." + newline,//regular
609
- " " + newline, //button
610
- "...and embedded icons..." + newline, //regular
611
- " ", //icon
612
- newline + "JTextPane is a subclass of JEditorPane that "
613
- + "uses a StyledEditorKit and StyledDocument, and provides "
614
- + "cover methods for interacting with those objects."
615
- };
616
-
617
- String[] initStyles =
618
- {
619
- "regular", "italic", "bold", "small", "large",
620
- "regular", "button", "regular", "icon",
621
- "regular"
622
- };
623
-
624
- JTextPane textPane = new JTextPane();
625
- textPane.setEditable(true);
626
- /*StyledDocument*/ doc = textPane.getStyledDocument();
627
- addStylesToDocument(doc);
628
-
629
- try
630
- {
631
- for (int j = 0; j < 2; j++)
632
- {
633
- for (int i = 0; i < initString.length; i++)
587
+ if (CameraPane.FULLSCREEN)
634588 {
635
- doc.insertString(doc.getLength(), initString[i],
636
- doc.getStyle(initStyles[i]));
589
+ frame.getContentPane().remove(/*"Center",*/bigThree);
590
+ framePanel.add(bigThree);
591
+ frame.getContentPane().add(/*"Center",*/framePanel);
592
+ } else
593
+ {
594
+ frame.getContentPane().remove(/*"Center",*/framePanel);
595
+ framePanel.remove(bigThree);
596
+ frame.getContentPane().add(/*"Center",*/bigThree);
637597 }
638
- }
639
- } catch (BadLocationException ble)
640
- {
641
- System.err.println("Couldn't insert initial text into text pane.");
598
+ cameraView.ToggleFullScreen();
642599 }
643600
644
- return new JTextArea(); // textPane;
601
+ private JTextPane createTextPane()
602
+ {
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
+// }
645
+
646
+ return new JTextPane(); // textPane;
645647 }
646648
647649 protected void addStylesToDocument(StyledDocument doc)
....@@ -694,7 +696,7 @@
694696 protected static ImageIcon createImageIcon(String path,
695697 String description)
696698 {
697
- java.net.URL imgURL = GrafreeD.class.getResource(path);
699
+ java.net.URL imgURL = Grafreed.class.getResource(path);
698700 if (imgURL != null)
699701 {
700702 return new ImageIcon(imgURL, description);
....@@ -726,6 +728,7 @@
726728 // NumberSlider vDivsField;
727729 // JCheckBox endcaps;
728730 JCheckBox liveCB;
731
+ JCheckBox selectCB;
729732 JCheckBox hideCB;
730733 JCheckBox link2masterCB;
731734 JCheckBox markCB;
....@@ -741,115 +744,83 @@
741744 JButton slowerButton;
742745 JButton fasterButton;
743746 JButton remarkButton;
747
+
748
+ cGridBag namePanel;
749
+ cGridBag setupPanel;
750
+ cGridBag commandsPanel;
751
+ cGridBag pushPanel;
752
+ cGridBag fillPanel;
744753
745
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
754
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
746755 {
747756 JCheckBox cb;
748757
749
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
750
- oe.aConstraints.gridwidth = 1; // 3;
751
-// oe.aConstraints.weightx = 1;
752
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
753
- 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);
754759 cb.addItemListener(this);
755
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
756
- oe.aConstraints.gridwidth = 1;
757
- oe.aConstraints.gridx += 1;
758760
759761 return cb;
760762 }
761763
762
- cButton AddButton(ObjEditor oe, String label)
764
+ cButton AddButton(cGridBag panel, String label)
763765 {
764766 cButton cb;
765767
766
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
767
- oe.aConstraints.gridwidth = 1;
768
-// oe.aConstraints.weightx = 1;
769
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
770
- 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);
771769 cb.addActionListener(this);
772
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
773
- oe.aConstraints.gridwidth = 1;
774
- oe.aConstraints.gridx += 1;
775770
776771 return cb;
777772 }
778773
779
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
774
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
780775 {
781776 JComboBox combo;
782777
783
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
784
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
785
- oe.aConstraints.gridx += 1;
778
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
786779 combo.addActionListener(this);
787780
788781 return combo;
789782 }
790783
791
- 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)
792785 {
793
- NumberSlider combo;
786
+ cGridBag control = new cGridBag();
787
+
788
+ cNumberSlider combo;
794789
795790 JLabel jlabel = new JLabel(label);
796
-
797
- aConstraints.fill = GridBagConstraints.VERTICAL;
798791 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
799
- aConstraints.gridwidth = 2;
800
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
801
- aConstraints.gridx += 1;
802
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
803
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
804
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
805
- aConstraints.gridx += 1;
806
- aConstraints.gridwidth = 1;
807
-
792
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
793
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
808794 combo.setFloat(current);
809
-
810
- combo.label = jlabel;
811
-
812
- combo.addChangeListener(this);
813
-
814
- return combo;
795
+
796
+ panel.add(control);
797
+
798
+ return control;
815799 }
816800
817
- 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)
818802 {
819
- NumberSlider combo;
803
+ cGridBag control = new cGridBag();
804
+
805
+ cNumberSlider combo;
820806
821807 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824808 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 2;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
809
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
810
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834811 combo.setInteger(current);
835812
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
813
+ panel.add(control);
814
+
815
+ return control;
841816 }
842817
843
- JTextArea AddText(JPanel ctrlPanel, String name)
818
+ JTextArea AddText(cGridBag ctrlPanel, String name)
844819 {
845820 JTextArea text;
846821
847
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
848
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
849
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
822
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
850823 text.addCaretListener(this);
851
- aConstraints.gridx += 1;
852
- aConstraints.gridwidth = 1;
853824
854825 return text;
855826 }
....@@ -879,9 +850,16 @@
879850 objEditor.ctrlPanel.remove(j);
880851 }
881852
853
+ void Remove(cNumberSlider j)
854
+ {
855
+ j.removeChangeListener(this);
856
+ //objEditor.ctrlPanel.remove(j.label);
857
+ objEditor.ctrlPanel.remove(j);
858
+ }
859
+
882860 /*
883861 */
884
- void Return() // ObjEditor oe)
862
+ void Return0() // ObjEditor oe)
885863 {
886864 aConstraints.gridy += 1;
887865 aConstraints.gridx = 0;
....@@ -936,35 +914,73 @@
936914
937915 void SetupUI2(ObjEditor oe)
938916 {
939
-// oe.aConstraints.weightx = 0;
940
-// oe.aConstraints.weighty = 0;
941
-// oe.aConstraints.gridx = 0;
942
-// oe.aConstraints.gridy = 0;
943
- 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();
944926
945927 if (!GroupEditor.allparams)
946928 return;
947929
948
- liveCB = AddCheckBox(oe, "Live", copy.live);
949
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
950
- 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");
951936 // Return();
952
- markCB = AddCheckBox(oe, "Mark", copy.marked);
953
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
954
- randomCB = AddCheckBox(oe, "Rand", copy.random);
955
- Return();
956
- resetButton = AddButton(oe, "Reset");
957
- 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");
958965 // resetAllButton = AddButton(oe, "Reset All");
959966 // stepAllButton = AddButton(oe, "Step All");
960
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
961967 // Return();
962
- slowerButton = AddButton(oe, "Slow");
963
- fasterButton = AddButton(oe, "Fast");
964
- 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");
965974
966
- Return();
975
+ oe.ctrlPanel.add(commandsPanel);
976
+ oe.ctrlPanel.Return();
967977
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
+
968984 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
969985 // ObjEditor.aConstraints.gridx += 1;
970986
....@@ -1058,7 +1074,7 @@
10581074 oe.aConstraints.gridwidth = 1;
10591075 /**/
10601076 nameField = AddText(oe.ctrlPanel, copy.GetName());
1061
- Return();
1077
+ oe.ctrlPanel.Return();
10621078
10631079 //ctrlPanel.add(textureButton = new Button("Texture..."));
10641080 //textureButton.setEnabled(false);
....@@ -1160,10 +1176,18 @@
11601176 //JPanel worldPanel =
11611177 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11621178 //worldPanel.setName("World");
1163
- centralPanel = new JPanel(new BorderLayout());
1179
+ centralPanel = new cGridBag();
1180
+ centralPanel.preferredWidth = 20;
11641181 timelinePanel = new JPanel(new BorderLayout());
11651182 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11661183
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
+
11671191 centralPanel.add(cameraView);
11681192 //frame.setJMenuBar(timelineMenubar);
11691193 //centralPanel.add(timelinePanel);
....@@ -1183,12 +1207,13 @@
11831207 //frontView.object = copy;
11841208 //sideView.object = copy;
11851209
1186
- XYZPanel = new JPanel();
1187
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1210
+ XYZPanel = new cGridBag().setVertical(true);
1211
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11881212
1189
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1190
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1191
- 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);
11921217
11931218 /*
11941219 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1226,10 +1251,11 @@
12261251 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12271252 //tmp.setName("Edit");
12281253 objectPanel.add(materialPanel);
1229
- JPanel north = new JPanel(new BorderLayout());
1230
- north.setName("Edit");
1231
- north.add(ctrlPanel, BorderLayout.NORTH);
1232
- 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);
12331259 objectPanel.add(infoPanel);
12341260
12351261 /*
....@@ -1250,16 +1276,23 @@
12501276 scrollpane.setWheelScrollingEnabled(true);
12511277 scrollpane.addMouseWheelListener(this); // Default not fast enough
12521278
1253
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1254
- scenePanel.add(scrollpane);
1279
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1280
+ scenePanel.preferredWidth = 6;
1281
+
1282
+ JTabbedPane tabbedPane = new JTabbedPane();
1283
+ tabbedPane.add(scrollpane);
12551284
1256
- scenePanel.add(FSPane = new cFileSystemPane(this));
1285
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12571286
1258
- optionsPanel = new JPanel(new GridBagLayout());
1287
+ optionsPanel = new cGridBag().setVertical(true);
12591288
12601289 optionsPanel.setName("Options");
1261
- scenePanel.add(optionsPanel);
1262
-
1290
+
1291
+ AddOptions(optionsPanel); //, aConstraints);
1292
+
1293
+ tabbedPane.add(optionsPanel);
1294
+
1295
+ scenePanel.add(tabbedPane);
12631296
12641297 /*
12651298 cTree jTree = new cTree(null);
....@@ -1293,6 +1326,7 @@
12931326 //bigPanel.setSize(new Dimension(10,10));
12941327 //bigPanel.add(ctrlPanel);
12951328 //bigPanel.add(gridPanel);
1329
+ /**
12961330 bigThree = new JPanel();
12971331 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12981332 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1316,7 +1350,13 @@
13161350 // aConstraints.gridheight = 3;
13171351 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13181352 bigThree.add(XYZPanel, aWindowConstraints);
1353
+ /**/
13191354
1355
+ bigThree = new cGridBag();
1356
+ bigThree.addComponent(scenePanel);
1357
+ bigThree.addComponent(centralPanel);
1358
+ bigThree.addComponent(XYZPanel);
1359
+
13201360 // // SIDE EFFECT!!!
13211361 // aConstraints.gridx = 0;
13221362 // aConstraints.gridy = 0;
....@@ -1337,13 +1377,14 @@
13371377 //worldPane.add(bigPanel);
13381378 //worldPane.add(worldPanel);
13391379 /**/
1340
- frame.getContentPane().add(/*"Center",*/framePanel);
1380
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1381
+ frame.add(/*"Center",*/framePanel);
13411382 //frame.getContentPane().add(/*"Center",*/ worldPane);
13421383
13431384 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13441385
1345
- frame.setSize(1024, 768);
1346
- frame.show();
1386
+ frame.setSize(1280, 860);
1387
+ frame.setVisible(true);
13471388
13481389 gridPanel.setDividerLocation(1.0);
13491390
....@@ -1358,6 +1399,10 @@
13581399 });
13591400 }
13601401
1402
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1403
+ {
1404
+ }
1405
+
13611406 JTree GetTree()
13621407 {
13631408 return objEditor.jTree;
....@@ -1369,260 +1414,173 @@
13691414 ctrlPanel.removeAll();
13701415 }
13711416
1372
- void SetupMaterial(JPanel ctrlPanel)
1417
+ void SetupMaterial(cGridBag panel)
13731418 {
1374
- aConstraints.weighty = 0;
1375
- //aConstraints.weightx = 1;
1376
- /*
1419
+ /*
13771420 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13781421 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1379
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1380
- aConstraints.gridx += 1;
13811422 */
13821423
1383
- aConstraints.gridwidth = 1;
1384
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- 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");
13881428
13891429 /*
13901430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1391
- aConstraints.gridx += 1;
1392
- aConstraints.weighty = 0;
1393
- aConstraints.gridwidth = 1;
13941431 */
13951432
1396
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1397
- 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
+ }
13981442
1399
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1400
-
1401
- aConstraints.gridx += 1;
1402
-
1403
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1404
-
1405
- aConstraints.gridx += 1;
1406
-
1407
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1408
-
1409
- aConstraints.gridx = 0;
1410
- aConstraints.gridy += 1;
1411
- aConstraints.weighty = 0;
1412
- aConstraints.gridwidth = 1;
1443
+ editBar.preferredHeight = 15;
1444
+
1445
+ panel.add(editBar);
1446
+
14131447 /**/
14141448 //aConstraints.weighty = 0;
14151449 ////aConstraints.weightx = 1;
14161450 //aConstraints.weighty = 1;
14171451 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14181452 //aConstraints.gridx += 1;
1419
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1420
- aConstraints.weighty = 0;
1421
- aConstraints.gridx = 0;
1422
- aConstraints.gridy += 1;
1423
- aConstraints.gridwidth = 1;
1453
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14241454
1425
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1426
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1427
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1428
- aConstraints.gridx += 1;
1429
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1430
- //aConstraints.weightx = 0;
1431
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1432
- aConstraints.gridx = 0;
1433
- aConstraints.gridy += 1;
1434
- 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);
14351463
1436
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1437
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1438
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1439
- aConstraints.gridx += 1;
1440
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1441
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1442
- aConstraints.gridx = 0;
1443
- aConstraints.gridy += 1;
1444
- 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);
14451469
1446
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1447
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1448
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1449
- aConstraints.gridx += 1;
1450
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1451
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1452
- aConstraints.gridx = 0;
1453
- aConstraints.gridy += 1;
1454
- 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);
14551475
1456
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1457
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1458
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1459
- aConstraints.gridx += 1;
1460
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1461
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1462
- aConstraints.gridx = 0;
1463
- aConstraints.gridy += 1;
1464
- 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);
14651481
1466
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1467
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1468
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1469
- aConstraints.gridx += 1;
1470
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1471
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1472
- aConstraints.gridx = 0;
1473
- aConstraints.gridy += 1;
1474
- 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);
14751487
1476
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1477
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1479
- aConstraints.gridx += 1;
1480
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1481
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1482
- aConstraints.gridx = 0;
1483
- aConstraints.gridy += 1;
1484
- 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);
14851493
1486
- //aConstraints.weighty = 1;
1487
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1488
- //aConstraints.gridx += 1;
1489
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1490
- aConstraints.weighty = 0;
1491
- aConstraints.gridx = 0;
1492
- aConstraints.gridy += 1;
1493
- 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);
14941507
1495
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1496
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1498
- aConstraints.gridx += 1;
1499
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1500
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1501
- aConstraints.gridx = 0;
1502
- aConstraints.gridy += 1;
1503
- 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);
15041513
1505
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1506
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1507
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1508
- aConstraints.gridx += 1;
1509
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1510
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1511
- aConstraints.gridx = 0;
1512
- aConstraints.gridy += 1;
1513
- 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);
15141519
1515
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1516
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1518
- aConstraints.gridx += 1;
1519
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1520
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1521
- aConstraints.gridx = 0;
1522
- aConstraints.gridy += 1;
1523
- 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);
15241525
1525
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1526
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1527
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1528
- aConstraints.gridx += 1;
1529
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1530
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1531
- aConstraints.gridx = 0;
1532
- aConstraints.gridy += 1;
1533
- 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);
15341531
1535
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1536
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1537
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1538
- aConstraints.gridx += 1;
1539
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1540
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1541
- aConstraints.gridx = 0;
1542
- aConstraints.gridy += 1;
1543
- 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);
15441537
1545
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1546
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1548
- aConstraints.gridx += 1;
1549
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1550
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1551
- aConstraints.gridx = 0;
1552
- aConstraints.gridy += 1;
1553
- 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);
15541543
1555
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1556
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1557
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1558
- aConstraints.gridx += 1;
1559
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1560
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1561
- aConstraints.gridx = 0;
1562
- aConstraints.gridy += 1;
1563
- 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);
15641551
1565
- //aConstraints.weighty = 1;
1566
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1567
- //aConstraints.gridx += 1;
1568
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1569
- aConstraints.weighty = 0;
1570
- aConstraints.gridx = 0;
1571
- aConstraints.gridy += 1;
1572
- 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);
15731557
1574
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1575
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1576
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1577
- aConstraints.gridx += 1;
1578
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1579
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1580
- aConstraints.gridx = 0;
1581
- aConstraints.gridy += 1;
1582
- 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);
15831563
1584
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1585
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1586
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1587
- aConstraints.gridx += 1;
1588
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1589
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1590
- aConstraints.gridx = 0;
1591
- aConstraints.gridy += 1;
1592
- 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);
15931569
1594
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1595
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1596
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1597
- aConstraints.gridx += 1;
1598
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1599
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1600
- aConstraints.gridx = 0;
1601
- aConstraints.gridy += 1;
1602
- 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);
16031575
1604
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1605
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1607
- aConstraints.gridx += 1;
1608
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1609
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1610
- aConstraints.gridx = 0;
1611
- aConstraints.gridy += 1;
1612
- 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);
16131581
1614
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1615
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1617
- aConstraints.gridx += 1;
1618
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1619
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1620
- aConstraints.gridx = 0;
1621
- aConstraints.gridy += 1;
1622
- aConstraints.gridwidth = 1;
1623
-
1624
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1625
- Return();
1582
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1583
+ //Return();
16261584 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16271585 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16281586 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1633,130 +1591,93 @@
16331591 // aConstraints.gridy += 1;
16341592 // aConstraints.gridwidth = 1;
16351593
1636
- //aConstraints.weighty = 1;
1637
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1638
- //aConstraints.gridx += 1;
1639
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1640
- aConstraints.weighty = 0;
1641
- aConstraints.gridx = 0;
1642
- aConstraints.gridy += 1;
1643
- aConstraints.gridwidth = 1;
16441594
1645
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1646
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1647
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1648
- aConstraints.gridx += 1;
1649
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1650
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1651
- aConstraints.gridx = 0;
1652
- aConstraints.gridy += 1;
1653
- 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);
16541602
1655
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1656
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1658
- aConstraints.gridx += 1;
1659
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1660
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1661
- aConstraints.gridx = 0;
1662
- aConstraints.gridy += 1;
1663
- 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);
16641608
1665
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1666
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1668
- aConstraints.gridx += 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1670
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1671
- aConstraints.gridx = 0;
1672
- aConstraints.gridy += 1;
1673
- 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);
16741614
1675
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1676
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1677
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1678
- aConstraints.gridx += 1;
1679
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1680
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1681
- aConstraints.gridx = 0;
1682
- aConstraints.gridy += 1;
1683
- aConstraints.gridwidth = 1;
1684
- 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);
16851620
1686
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1687
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1689
- aConstraints.gridx += 1;
1690
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1691
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1692
- aConstraints.gridx = 0;
1693
- aConstraints.gridy += 1;
1694
- 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);
16951626
1696
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1697
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1699
- aConstraints.gridx += 1;
1700
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1701
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1702
- aConstraints.gridx = 0;
1703
- aConstraints.gridy += 1;
1704
- 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);
17051634
1706
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1707
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1709
- aConstraints.gridx += 1;
1710
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1711
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1712
- aConstraints.gridx = 0;
1713
- aConstraints.gridy += 1;
1714
- 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);
17151640
1716
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1717
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1719
- aConstraints.gridx += 1;
1720
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1721
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1722
- aConstraints.gridx = 0;
1723
- aConstraints.gridy += 1;
1724
- 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);
17251646
1726
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1727
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1729
- aConstraints.gridx += 1;
1730
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1731
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1732
- aConstraints.gridx = 0;
1733
- aConstraints.gridy += 1;
1734
- 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);
17351652
1736
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1737
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1738
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1739
- aConstraints.gridx += 1;
1740
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1741
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1742
- aConstraints.gridx = 0;
1743
- aConstraints.gridy += 1;
1744
- 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);
17451658
1746
- //aConstraints.weighty = 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1748
- //aConstraints.gridx += 1;
1749
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1750
- 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);
17511664
1752
- aConstraints.gridx = 0;
1753
- aConstraints.gridy = 0;
1754
- 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);
17551676
17561677 SetMaterial(copy); // .GetMaterial());
17571678
1758
- colorField.addChangeListener(this);
1759
- modulationField.addChangeListener(this);
1679
+ //colorField.addChangeListener(this);
1680
+// modulationField.addChangeListener(this);
17601681 metalnessField.addChangeListener(this);
17611682 diffuseField.addChangeListener(this);
17621683 specularField.addChangeListener(this);
....@@ -1786,12 +1707,15 @@
17861707 opacityPowerField.addChangeListener(this);
17871708 /**/
17881709
1789
- resetSlidersButton.addActionListener(this);
17901710 clearMaterialButton.addActionListener(this);
17911711 createMaterialButton.addActionListener(this);
1792
-
1793
- propagateToggle.addItemListener(this);
1794
- multiplyToggle.addItemListener(this);
1712
+
1713
+ if (Globals.ADVANCED)
1714
+ {
1715
+ resetSlidersButton.addActionListener(this);
1716
+ propagateToggle.addItemListener(this);
1717
+ multiplyToggle.addItemListener(this);
1718
+ }
17951719 }
17961720
17971721 void DropFile(java.io.File[] files, boolean textures)
....@@ -1962,7 +1886,7 @@
19621886
19631887 //? flashIt = false;
19641888 CameraPane pane = (CameraPane) cameraView;
1965
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
19661890 pane.clickEnd(location.x, location.y, 0, true);
19671891
19681892 if (group.selection.size() == 1)
....@@ -2011,6 +1935,7 @@
20111935 e2.printStackTrace();
20121936 }
20131937 }
1938
+
20141939 LoadJMEThread loadThread;
20151940
20161941 class LoadJMEThread extends Thread
....@@ -2068,6 +1993,7 @@
20681993 //LoadFile0(filename, converter);
20691994 }
20701995 }
1996
+
20711997 LoadOBJThread loadObjThread;
20721998
20731999 class LoadOBJThread extends Thread
....@@ -2146,19 +2072,19 @@
21462072
21472073 void LoadObjFile(String fullname)
21482074 {
2149
- /*
2075
+ System.out.println("Loading " + fullname);
2076
+ /**/
21502077 //lastFilename = fullname;
21512078 if(loadObjThread == null)
21522079 {
2153
- loadObjThread = new LoadOBJThread();
2154
- loadObjThread.start();
2080
+ loadObjThread = new LoadOBJThread();
2081
+ loadObjThread.start();
21552082 }
21562083
21572084 loadObjThread.add(fullname);
2158
- */
2085
+ /**/
21592086
2160
- System.out.println("Loading " + fullname);
2161
- makeSomething(new FileObject(fullname, true), true);
2087
+ //makeSomething(new FileObject(fullname, true), true);
21622088 }
21632089
21642090 void LoadGFDFile(String fullname)
....@@ -2419,11 +2345,11 @@
24192345
24202346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24212347 {
2422
- if (GrafreeD.standAlone)
2348
+ if (Grafreed.standAlone)
24232349 {
24242350 /**/
24252351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2426
- browser.show();
2352
+ browser.setVisible(true);
24272353 String filename = browser.getFile();
24282354 if (filename != null && filename.length() > 0)
24292355 {
....@@ -2568,6 +2494,7 @@
25682494 }
25692495 if (input == null)
25702496 {
2497
+ new Exception().printStackTrace();
25712498 System.exit(0);
25722499 }
25732500
....@@ -2782,7 +2709,8 @@
27822709 return;
27832710 }
27842711
2785
- multiplyToggle.setSelected(mat.multiply);
2712
+ if (multiplyToggle != null)
2713
+ multiplyToggle.setSelected(mat.multiply);
27862714
27872715 assert (object.projectedVertices != null);
27882716
....@@ -2966,42 +2894,40 @@
29662894 return;
29672895 } else if (event.getSource() == toggleTimelineItem)
29682896 {
2969
- copy.timeline ^= true;
2897
+ timeline ^= true;
29702898
2971
- if (copy.timeline)
2899
+ if (timeline)
29722900 {
29732901 centralPanel.remove(cameraView);
2974
- centralPanel.add(timelinePanel);
2902
+ cameraPanel.add(cameraView);
2903
+ centralPanel.add(cameraPanel);
29752904 frame.setJMenuBar(timelineMenubar);
2905
+ wasFullScreen = CameraPane.FULLSCREEN;
2906
+ if (!CameraPane.FULLSCREEN)
2907
+ ToggleFullScreen();
2908
+ toggleFullScreenItem.setEnabled(false);
29762909 }
29772910 else
29782911 {
2979
- centralPanel.remove(timelinePanel);
2912
+ centralPanel.remove(cameraPanel);
29802913 centralPanel.add(cameraView);
29812914 frame.setJMenuBar(null);
2915
+ if (!wasFullScreen)
2916
+ ToggleFullScreen();
2917
+ toggleFullScreenItem.setEnabled(true);
29822918 }
29832919
29842920 frame.validate();
29852921 return;
29862922 } else if (event.getSource() == toggleFullScreenItem)
29872923 {
2988
- if (CameraPane.FULLSCREEN)
2989
- {
2990
- frame.getContentPane().remove(/*"Center",*/bigThree);
2991
- framePanel.add(bigThree);
2992
- frame.getContentPane().add(/*"Center",*/framePanel);
2993
- } else
2994
- {
2995
- frame.getContentPane().remove(/*"Center",*/framePanel);
2996
- frame.getContentPane().add(/*"Center",*/bigThree);
2997
- }
2924
+ ToggleFullScreen();
29982925 frame.validate();
2999
- cameraView.ToggleFullScreen();
30002926
30012927 return;
3002
- } else if (event.getSource() == toggleRandomItem)
2928
+ } else if (event.getSource() == toggleSwitchItem)
30032929 {
3004
- cameraView.ToggleRandom();
2930
+ cameraView.ToggleSwitch();
30052931 cameraView.repaint();
30062932 return;
30072933 } else if (event.getSource() == toggleHandleItem)
....@@ -3030,6 +2956,10 @@
30302956 {
30312957 copy.live ^= true;
30322958 return;
2959
+ } else if (event.getSource() == selectCB)
2960
+ {
2961
+ copy.dontselect ^= true;
2962
+ return;
30332963 } else if (event.getSource() == hideCB)
30342964 {
30352965 copy.hide ^= true;
....@@ -3044,6 +2974,7 @@
30442974 if (event.getSource() == randomCB)
30452975 {
30462976 copy.random ^= true;
2977
+ objEditor.refreshContents();
30472978 return;
30482979 }
30492980 if (event.getSource() == speedupCB)
....@@ -3067,8 +2998,9 @@
30672998
30682999 public void actionPerformed(ActionEvent event)
30693000 {
3001
+ Object source = event.getSource();
30703002 // SCRIPT DIALOG
3071
- if (event.getSource() == okbutton)
3003
+ if (source == okbutton)
30723004 {
30733005 textpanel.setVisible(false);
30743006 textpanel.remove(textarea);
....@@ -3080,7 +3012,7 @@
30803012 textarea = null;
30813013 textpanel = null;
30823014 }
3083
- if (event.getSource() == cancelbutton)
3015
+ if (source == cancelbutton)
30843016 {
30853017 textpanel.setVisible(false);
30863018 textpanel.remove(textarea);
....@@ -3092,49 +3024,50 @@
30923024 //applySelf();
30933025 //client.refreshEditWindow();
30943026 //refreshContents();
3095
- if (event.getSource() == nameField)
3027
+ if (source == nameField)
30963028 {
30973029 //System.out.println("ObjEditor " + event);
30983030 applySelf0(true);
30993031 //parent.applySelf();
31003032 objEditor.refreshContents();
3101
- } else if (event.getSource() == resetButton)
3033
+ } else if (source == resetButton)
31023034 {
31033035 CameraPane.fullreset = true;
31043036 copy.Reset(); // ResetMeshes();
31053037 copy.Touch();
31063038 objEditor.refreshContents();
3107
- } else if (event.getSource() == stepItem)
3039
+ } else if (source == stepItem)
31083040 {
3109
- cameraView.ONESTEP = true;
3041
+ //cameraView.ONESTEP = true;
3042
+ Globals.ONESTEP = true;
31103043 cameraView.repaint();
31113044 return;
3112
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
31133046 {
31143047 copy.Step();
31153048 copy.Touch();
31163049 objEditor.refreshContents();
3117
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
31183051 {
31193052 copy.Slower();
31203053 copy.Touch();
31213054 objEditor.refreshContents();
3122
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
31233056 {
31243057 copy.Faster();
31253058 copy.Touch();
31263059 objEditor.refreshContents();
3127
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
31283061 {
31293062 copy.Remark();
31303063 copy.Touch();
31313064 objEditor.refreshContents();
3132
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
31333066 {
31343067 copy.StepAll();
31353068 copy.Touch();
31363069 objEditor.refreshContents();
3137
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
31383071 {
31393072 //CameraPane.fullreset = true;
31403073 copy.ResetAll(); // ResetMeshes();
....@@ -3167,53 +3100,75 @@
31673100 // Close();
31683101 // }
31693102 // else
3170
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
31713104 {
31723105 ResetSliders();
3173
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
31743107 {
31753108 ClearMaterial();
3176
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
31773110 {
31783111 CreateMaterial();
3179
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
31803113 {
31813114 copy.ClearUI();
31823115 refreshContents(true);
3183
- } /*
3184
- }
3185
-
3186
- public boolean action(Event event, Object arg)
3187
- {
3188
- */ 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)
31893141 {
31903142 Close();
31913143 //return true;
3192
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
31933145 {
31943146 load();
31953147 //return true;
3196
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
31973152 {
31983153 save();
31993154 //return true;
3200
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
32013156 {
32023157 saveAs();
32033158 //return true;
3204
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
32053160 {
32063161 reexport();
32073162 //return true;
3208
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
32093164 {
32103165 export();
32113166 //return true;
3212
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
32133168 {
32143169 generatePOV();
32153170 //return true;
3216
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
32173172 {
32183173 try
32193174 {
....@@ -3235,21 +3190,8 @@
32353190 cameraView.repaint();
32363191 //return true;
32373192 }
3238
- */ else if (event.getSource() == editCameraItem)
3239
- {
3240
- cameraView.ProtectCamera();
3241
- cameraView.repaint();
3242
- return;
3243
- } else if (event.getSource() == revertCameraItem)
3244
- {
3245
- cameraView.RevertCamera();
3246
- cameraView.repaint();
3247
- return;
3248
-// } else if (event.getSource() == textureButton)
3249
-// {
3250
-// return; // true;
3251
- } else // combos...
3252
- if (event.getSource() == texresMenu)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
32533195 {
32543196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32553197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3261,27 +3203,283 @@
32613203 }
32623204 }
32633205
3264
- void ToggleAnimation()
3206
+ void New()
32653207 {
3266
- if (!CameraPane.ANIMATION)
3208
+ while (copy.Size() > 1)
32673209 {
3268
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3210
+ copy.remove(1);
3211
+ }
3212
+
3213
+ ResetModel();
3214
+ objEditor.refreshContents();
3215
+ }
3216
+
3217
+ static public byte[] Compress(Object3D o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3223
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3224
+
3225
+ Object3D parent = o.parent;
3226
+ o.parent = null;
3227
+
3228
+ out.writeObject(o);
3229
+
3230
+ o.parent = parent;
3231
+
3232
+ out.flush();
3233
+
3234
+ zstream.close();
3235
+ out.close();
3236
+
3237
+ return baos.toByteArray();
3238
+ } catch (Exception e)
3239
+ {
3240
+ System.err.println(e);
3241
+ return null;
3242
+ }
3243
+ }
3244
+
3245
+ static public Object Uncompress(byte[] bytes)
3246
+ {
3247
+ System.out.println("#bytes = " + bytes.length);
3248
+ try
3249
+ {
3250
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3251
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3252
+ ObjectInputStream in = new ObjectInputStream(istream);
3253
+ Object obj = in.readObject();
3254
+ in.close();
3255
+
3256
+ return obj;
3257
+ } catch (Exception e)
3258
+ {
3259
+ System.err.println(e);
3260
+ return null;
3261
+ }
3262
+ }
3263
+
3264
+ static public Object clone(Object o)
3265
+ {
3266
+ try
3267
+ {
3268
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3269
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3270
+
3271
+ out.writeObject(o);
3272
+
3273
+ out.flush();
3274
+ out.close();
3275
+
3276
+ byte[] bytes = baos.toByteArray();
3277
+
3278
+ System.out.println("clone = " + bytes.length);
3279
+
3280
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3281
+ ObjectInputStream in = new ObjectInputStream(bais);
3282
+ Object obj = in.readObject();
3283
+ in.close();
3284
+
3285
+ return obj;
3286
+ } catch (Exception e)
3287
+ {
3288
+ System.err.println(e);
3289
+ return null;
3290
+ }
3291
+ }
3292
+
3293
+ cRadio GetCurrentTab()
3294
+ {
3295
+ cRadio ab;
3296
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3297
+ {
3298
+ ab = (cRadio)e.nextElement();
3299
+ if(ab.GetObject() == copy)
3300
+ {
3301
+ return ab;
3302
+ }
3303
+ }
3304
+
3305
+ return null;
3306
+ }
3307
+
3308
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3309
+
3310
+ public void Save()
3311
+ {
3312
+ cRadio tab = GetCurrentTab();
3313
+
3314
+ boolean temp = CameraPane.SWITCH;
3315
+ CameraPane.SWITCH = false;
3316
+
3317
+ copy.ExtractBigData(hashtable);
3318
+
3319
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3320
+ tab.graphs[tab.undoindex++] = Compress(copy);
3321
+
3322
+ copy.RestoreBigData(hashtable);
3323
+
3324
+ CameraPane.SWITCH = temp;
3325
+
3326
+ //assert(hashtable.isEmpty());
3327
+
3328
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3329
+ {
3330
+ tab.graphs[i] = null;
3331
+ }
3332
+
3333
+ // test save
3334
+ if (false)
3335
+ {
3336
+ try
3337
+ {
3338
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3339
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3340
+
3341
+ p.writeObject(copy);
3342
+
3343
+ p.flush();
3344
+
3345
+ ostream.close();
3346
+ } catch (Exception e)
3347
+ {
3348
+ e.printStackTrace();
3349
+ }
3350
+ }
3351
+ }
3352
+
3353
+ void CopyChanged(Object3D obj)
3354
+ {
3355
+ boolean temp = CameraPane.SWITCH;
3356
+ CameraPane.SWITCH = false;
3357
+
3358
+ copy.ExtractBigData(hashtable);
3359
+
3360
+ copy.clear();
3361
+
3362
+ for (int i=0; i<obj.Size(); i++)
3363
+ {
3364
+ copy.add(obj.get(i));
3365
+ }
3366
+
3367
+ copy.RestoreBigData(hashtable);
3368
+
3369
+ CameraPane.SWITCH = temp;
3370
+
3371
+ //assert(hashtable.isEmpty());
3372
+
3373
+ copy.Touch();
3374
+
3375
+ ResetModel();
3376
+ copy.HardTouch(); // recompile?
3377
+
3378
+ cRadio ab;
3379
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3380
+ {
3381
+ ab = (cRadio)e.nextElement();
3382
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3383
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3384
+ if (test != null)
3385
+ {
3386
+ test.editWindow = ab.object.editWindow;
3387
+ ab.object = test;
3388
+ }
3389
+ }
3390
+
3391
+ refreshContents();
3392
+ }
3393
+
3394
+ public void Undo()
3395
+ {
3396
+ cRadio tab = GetCurrentTab();
3397
+
3398
+ if (tab.undoindex == 0)
3399
+ {
3400
+ java.awt.Toolkit.getDefaultToolkit().beep();
3401
+ return;
3402
+ }
3403
+
3404
+ if (tab.graphs[tab.undoindex] == null)
3405
+ {
3406
+ Save();
3407
+ tab.undoindex -= 1;
3408
+ }
3409
+
3410
+ tab.undoindex -= 1;
3411
+
3412
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3413
+ }
3414
+
3415
+ public void Redo()
3416
+ {
3417
+ cRadio tab = GetCurrentTab();
3418
+
3419
+ if (tab.graphs[tab.undoindex + 1] == null)
3420
+ {
3421
+ java.awt.Toolkit.getDefaultToolkit().beep();
3422
+ return;
3423
+ }
3424
+
3425
+ tab.undoindex += 1;
3426
+
3427
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3428
+ }
3429
+
3430
+ void ImportGFD()
3431
+ {
3432
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32693433 browser.show();
32703434 String filename = browser.getFile();
32713435 if (filename != null && filename.length() > 0)
32723436 {
3273
- CameraPane.filename = browser.getDirectory() + filename;
3437
+ String fullname = browser.getDirectory() + filename;
3438
+
3439
+ //Object3D readobj =
3440
+ objEditor.ReadGFD(fullname, objEditor);
3441
+ //makeSomething(readobj);
3442
+ }
3443
+ }
3444
+
3445
+ void ImportVRMLX3D()
3446
+ {
3447
+ if (Grafreed.standAlone)
3448
+ {
3449
+ /**/
3450
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3451
+ browser.show();
3452
+ String filename = browser.getFile();
3453
+ if (filename != null && filename.length() > 0)
3454
+ {
3455
+ String fullname = browser.getDirectory() + filename;
3456
+ LoadVRMLX3D(fullname);
3457
+ }
3458
+ /**/
3459
+ }
3460
+ }
3461
+
3462
+ void ToggleAnimation()
3463
+ {
3464
+ if (!Globals.ANIMATION)
3465
+ {
3466
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3467
+ browser.setVisible(true);
3468
+ String filename = browser.getFile();
3469
+ if (filename != null && filename.length() > 0)
3470
+ {
3471
+ Globals.filename = browser.getDirectory() + filename;
32743472 //CameraPane.framecount = 0;
3275
- CameraPane.imagecount = 0;
3473
+ Globals.imagecount = 0;
32763474
3277
- CameraPane.ANIMATION ^= true;
3475
+ Globals.ANIMATION ^= true;
32783476
3279
- GrafreeD.wav.cursor = 0;
3280
- GrafreeD.wav.loop = 0;
3477
+ Grafreed.wav.cursor = 0;
3478
+ Grafreed.wav.loop = 0;
32813479 }
32823480 } else
32833481 {
3284
- CameraPane.ANIMATION ^= true;
3482
+ Globals.ANIMATION ^= true;
32853483 }
32863484 }
32873485
....@@ -3327,7 +3525,7 @@
33273525 void CreateMaterial()
33283526 {
33293527 //copy.ClearMaterial(); // PATCH
3330
- copy.CreateMaterialS(multiplyToggle.isSelected());
3528
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33313529 if (copy.selection.size() > 0)
33323530 //SetMaterial(copy);
33333531 {
....@@ -3386,11 +3584,11 @@
33863584 {
33873585 copy.ResetBlockLoop(); // temporary problem
33883586
3389
- boolean random = CameraPane.RANDOM;
3390
- CameraPane.RANDOM = false; // parse everything
3587
+ boolean random = CameraPane.SWITCH;
3588
+ CameraPane.SWITCH = false; // parse everything
33913589 copy.ResetDisplayList();
33923590 copy.HardTouch();
3393
- CameraPane.RANDOM = random;
3591
+ CameraPane.SWITCH = random;
33943592 }
33953593
33963594 // public void applySelf()
....@@ -3460,10 +3658,40 @@
34603658 current.fakedepth = (float) fakedepthField.getFloat();
34613659 current.shadowbias = (float) shadowbiasField.getFloat();
34623660
3463
- if (!NumberSlider.frozen)
3661
+ if (!cNumberSlider.frozen)
34643662 {
34653663 //System.out.println("Propagate = " + propagate);
34663664 copy.UpdateMaterial(anchor, current, propagate);
3665
+
3666
+ if (copy.material != null)
3667
+ {
3668
+ cMaterial mat = copy.material;
3669
+
3670
+ colorField.SetToolTipValue((mat.color));
3671
+ modulationField.SetToolTipValue((mat.modulation));
3672
+ metalnessField.SetToolTipValue((mat.metalness));
3673
+ diffuseField.SetToolTipValue((mat.diffuse));
3674
+ specularField.SetToolTipValue((mat.specular));
3675
+ shininessField.SetToolTipValue((mat.shininess));
3676
+ shiftField.SetToolTipValue((mat.shift));
3677
+ ambientField.SetToolTipValue((mat.ambient));
3678
+ lightareaField.SetToolTipValue((mat.lightarea));
3679
+ diffusenessField.SetToolTipValue((mat.factor));
3680
+ velvetField.SetToolTipValue((mat.velvet));
3681
+ sheenField.SetToolTipValue((mat.sheen));
3682
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3683
+ backlitField.SetToolTipValue((mat.bump));
3684
+ anisoField.SetToolTipValue((mat.aniso));
3685
+ anisoVField.SetToolTipValue((mat.anisoV));
3686
+ cameraField.SetToolTipValue((mat.cameralight));
3687
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3688
+ shadowField.SetToolTipValue((mat.shadow));
3689
+ textureField.SetToolTipValue((mat.texture));
3690
+ opacityField.SetToolTipValue((mat.opacity));
3691
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3692
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3693
+ }
3694
+
34673695 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34683696 {
34693697 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3508,6 +3736,7 @@
35083736 || e.getSource() == apertureField
35093737 || e.getSource() == shadowblurField)
35103738 {
3739
+ new Exception().printStackTrace();
35113740 System.exit(0);
35123741 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35133742 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3534,7 +3763,13 @@
35343763 //System.out.println("PARENT = " + parent);
35353764 //if (parent != null)
35363765 // parent.applySelf();
3537
- refreshContents();
3766
+ if (e.getSource() == normalpushField)
3767
+ {
3768
+ objEditor.refreshContents();
3769
+ //Refresh();
3770
+ }
3771
+ else
3772
+ refreshContents();
35383773 // ??? client.refreshEditWindow();
35393774 }
35403775 //else
....@@ -3546,7 +3781,7 @@
35463781 //group.name = nameField.getText();
35473782 //objEditor.applySelf();
35483783
3549
- assert (objEditor == this);
3784
+ // OCT2018: assert (objEditor == this);
35503785 if (copy.selection == null || copy.selection.size() == 0)
35513786 //super.applySelf()
35523787 ; else
....@@ -3570,12 +3805,18 @@
35703805 objEditor.copy = keep;
35713806 }
35723807 }
3808
+
3809
+ if (normalpushField != null)
3810
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35733811 }
35743812
35753813 void SnapObject()
35763814 {
3577
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3578
- SnapObject(obj);
3815
+ if (copy.selection.size() > 0)
3816
+ {
3817
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3818
+ SnapObject(obj);
3819
+ }
35793820 }
35803821
35813822 void SnapObject(Object3D obj)
....@@ -3821,7 +4062,7 @@
38214062
38224063 radioPanel.revalidate();
38234064 radioPanel.repaint();
3824
- ctrlPanel.revalidate(); // ? new
4065
+ ctrlPanel.validate(); // ? new
38254066 ctrlPanel.repaint();
38264067 }
38274068 }
....@@ -3830,6 +4071,7 @@
38304071
38314072 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38324073 {
4074
+ Save();
38334075 //Tween.set(thing, 0).target(1).start(tweenManager);
38344076 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38354077 // if (thing instanceof GenericJointDemo)
....@@ -4033,6 +4275,7 @@
40334275 }
40344276 }
40354277 }
4278
+
40364279 LoadGFDThread loadGFDThread;
40374280
40384281 void ReadGFD(String fullname, iCallBack cb)
....@@ -4053,7 +4296,8 @@
40534296 try
40544297 {
40554298 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4056
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4299
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4300
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40574301
40584302 readobj = (Object3D) p.readObject();
40594303 istream.close();
....@@ -4061,7 +4305,20 @@
40614305 readobj.ResetDisplayList();
40624306 } catch (Exception e)
40634307 {
4064
- e.printStackTrace();
4308
+ //e.printStackTrace();
4309
+ try
4310
+ {
4311
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4312
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4313
+
4314
+ readobj = (Object3D) p.readObject();
4315
+ istream.close();
4316
+
4317
+ readobj.ResetDisplayList();
4318
+ } catch (Exception e2)
4319
+ {
4320
+ e2.printStackTrace();
4321
+ }
40654322 }
40664323 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40674324 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4116,6 +4373,7 @@
41164373
41174374 if (readobj != null)
41184375 {
4376
+ Save();
41194377 try
41204378 {
41214379 //readobj.deepCopySelf(copy);
....@@ -4178,7 +4436,7 @@
41784436
41794437 void load() // throws ClassNotFoundException
41804438 {
4181
- if (GrafreeD.standAlone)
4439
+ if (Grafreed.standAlone)
41824440 {
41834441 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41844442 browser.show();
....@@ -4265,11 +4523,13 @@
42654523 try
42664524 {
42674525 FileOutputStream ostream = new FileOutputStream(lastname);
4268
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4526
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4527
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42694528
42704529 p.writeObject(copy);
42714530 p.flush();
42724531
4532
+ zstream.close();
42734533 ostream.close();
42744534
42754535 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4279,11 +4539,12 @@
42794539 {
42804540 }
42814541 }
4542
+
42824543 String lastname;
42834544
42844545 void saveAs()
42854546 {
4286
- if (GrafreeD.standAlone)
4547
+ if (Grafreed.standAlone)
42874548 {
42884549 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42894550 browser.setVisible(true);
....@@ -4388,13 +4649,13 @@
43884649 try
43894650 {
43904651 FileOutputStream ostream = new FileOutputStream(filename);
4391
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4392
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4652
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4653
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43934654
43944655 Object3D objectparent = obj.parent;
43954656 obj.parent = null;
43964657
4397
- Object3D object = (Object3D) GrafreeD.clone(obj);
4658
+ Object3D object = (Object3D) Grafreed.clone(obj);
43984659
43994660 obj.parent = objectparent;
44004661
....@@ -4406,8 +4667,8 @@
44064667 p.writeObject(object);
44074668 p.flush();
44084669
4670
+ zstream.close();
44094671 ostream.close();
4410
- // zstream.close();
44114672
44124673 // group.selection.get(0).parent = parent;
44134674 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4428,7 +4689,7 @@
44284689 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44294690 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44304691 copy.generatePOV(buffer);
4431
- if (GrafreeD.standAlone)
4692
+ if (Grafreed.standAlone)
44324693 {
44334694 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44344695 browser.show();
....@@ -4454,7 +4715,8 @@
44544715 Object3D client;
44554716 Object3D copy;
44564717 MenuBar menuBar;
4457
- Menu windowMenu;
4718
+ Menu fileMenu;
4719
+ MenuItem newItem;
44584720 MenuItem loadItem;
44594721 MenuItem saveItem;
44604722 MenuItem saveAsItem;
....@@ -4462,13 +4724,11 @@
44624724 MenuItem reexportItem;
44634725 MenuItem povItem;
44644726 MenuItem closeItem;
4465
- Menu cameraMenu;
4727
+
44664728 CheckboxMenuItem zBufferItem;
44674729 //MenuItem normalLensItem;
4468
- MenuItem editCameraItem;
4469
- MenuItem revertCameraItem;
4470
- CheckboxMenuItem toggleLiveItem;
44714730 MenuItem stepItem;
4731
+ CheckboxMenuItem toggleLiveItem;
44724732 CheckboxMenuItem toggleFullScreenItem;
44734733 CheckboxMenuItem toggleTimelineItem;
44744734 CheckboxMenuItem toggleRenderItem;
....@@ -4477,7 +4737,7 @@
44774737 CheckboxMenuItem toggleFootContactItem;
44784738 CheckboxMenuItem toggleDLItem;
44794739 CheckboxMenuItem toggleTextureItem;
4480
- CheckboxMenuItem toggleRandomItem;
4740
+ CheckboxMenuItem toggleSwitchItem;
44814741 CheckboxMenuItem toggleRootItem;
44824742 CheckboxMenuItem animationItem;
44834743 CheckboxMenuItem toggleHandleItem;
....@@ -4485,20 +4745,21 @@
44854745 JSplitPane mainPanel;
44864746 JScrollPane scrollpane;
44874747 JPanel toolbarPanel;
4488
- JPanel treePanel;
4748
+ cGridBag treePanel;
44894749 JPanel radioPanel;
44904750 ButtonGroup buttonGroup;
4491
- JPanel ctrlPanel;
4492
- JPanel materialPanel;
4751
+ cGridBag ctrlPanel;
4752
+ cGridBag materialPanel;
44934753 JScrollPane infoPanel;
4494
- JPanel optionsPanel;
4754
+ cGridBag optionsPanel;
44954755 JTabbedPane objectPanel;
4496
- JPanel XYZPanel;
4756
+ cGridBag XYZPanel;
44974757 JSplitPane gridPanel;
44984758 JSplitPane bigPanel;
4499
- JPanel bigThree;
4500
- JTabbedPane scenePanel;
4501
- JPanel centralPanel;
4759
+ cGridBag bigThree;
4760
+ cGridBag scenePanel;
4761
+ cGridBag centralPanel;
4762
+ JSplitPane cameraPanel;
45024763 JPanel timelinePanel;
45034764 JMenuBar timelineMenubar;
45044765 JSplitPane framePanel;
....@@ -4550,65 +4811,72 @@
45504811 // MATERIAL
45514812 JLabel materialLabel;
45524813 JLabel colorLabel;
4553
- NumberSlider colorField;
4814
+ cNumberSlider colorField;
45544815 JLabel modulationLabel;
4555
- NumberSlider modulationField;
4816
+ cNumberSlider modulationField;
45564817 JLabel metalnessLabel;
4557
- NumberSlider metalnessField;
4818
+ cNumberSlider metalnessField;
45584819 JLabel diffuseLabel;
4559
- NumberSlider diffuseField;
4820
+ cNumberSlider diffuseField;
45604821 JLabel specularLabel;
4561
- NumberSlider specularField;
4822
+ cNumberSlider specularField;
45624823 JLabel shininessLabel;
4563
- NumberSlider shininessField;
4824
+ cNumberSlider shininessField;
45644825 JLabel shiftLabel;
4565
- NumberSlider shiftField;
4826
+ cNumberSlider shiftField;
45664827 JLabel ambientLabel;
4567
- NumberSlider ambientField;
4828
+ cNumberSlider ambientField;
45684829 JLabel lightareaLabel;
4569
- NumberSlider lightareaField;
4830
+ cNumberSlider lightareaField;
45704831 JLabel diffusenessLabel;
4571
- NumberSlider diffusenessField;
4832
+ cNumberSlider diffusenessField;
45724833 JLabel velvetLabel;
4573
- NumberSlider velvetField;
4834
+ cNumberSlider velvetField;
45744835 JLabel sheenLabel;
4575
- NumberSlider sheenField;
4836
+ cNumberSlider sheenField;
45764837 JLabel subsurfaceLabel;
4577
- NumberSlider subsurfaceField;
4838
+ cNumberSlider subsurfaceField;
45784839 //JLabel bumpLabel;
45794840 //NumberSlider bumpField;
45804841 JLabel backlitLabel;
4581
- NumberSlider backlitField;
4842
+ cNumberSlider backlitField;
45824843 JLabel anisoLabel;
4583
- NumberSlider anisoField;
4844
+ cNumberSlider anisoField;
45844845 JLabel anisoVLabel;
4585
- NumberSlider anisoVField;
4846
+ cNumberSlider anisoVField;
45864847 JLabel cameraLabel;
4587
- NumberSlider cameraField;
4848
+ cNumberSlider cameraField;
45884849 JLabel selfshadowLabel;
4589
- NumberSlider selfshadowField;
4850
+ cNumberSlider selfshadowField;
45904851 JLabel shadowLabel;
4591
- NumberSlider shadowField;
4852
+ cNumberSlider shadowField;
45924853 JLabel textureLabel;
4593
- NumberSlider textureField;
4854
+ cNumberSlider textureField;
45944855 JLabel opacityLabel;
4595
- NumberSlider opacityField;
4856
+ cNumberSlider opacityField;
45964857 JLabel fakedepthLabel;
4597
- NumberSlider fakedepthField;
4858
+ cNumberSlider fakedepthField;
45984859 JLabel shadowbiasLabel;
4599
- NumberSlider shadowbiasField;
4860
+ cNumberSlider shadowbiasField;
46004861 JLabel bumpLabel;
4601
- NumberSlider bumpField;
4862
+ cNumberSlider bumpField;
46024863 JLabel noiseLabel;
4603
- NumberSlider noiseField;
4864
+ cNumberSlider noiseField;
46044865 JLabel powerLabel;
4605
- NumberSlider powerField;
4866
+ cNumberSlider powerField;
46064867 JLabel borderfadeLabel;
4607
- NumberSlider borderfadeField;
4868
+ cNumberSlider borderfadeField;
46084869 JLabel fogLabel;
4609
- NumberSlider fogField;
4870
+ cNumberSlider fogField;
46104871 JLabel opacityPowerLabel;
4611
- NumberSlider opacityPowerField;
4872
+ cNumberSlider opacityPowerField;
46124873 JTree jTree;
46134874 //ObjectUI parent;
4875
+
4876
+ cNumberSlider normalpushField;
4877
+
4878
+ private MenuItem importGFDItem;
4879
+ private MenuItem importVRMLX3DItem;
4880
+ private MenuItem import3DSItem;
4881
+ private MenuItem importOBJItem;
46144882 }