Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
ObjEditor.java
....@@ -19,6 +19,8 @@
1919 import //weka.core.
2020 matrix.Matrix;
2121
22
+import grafeme.ui.*;
23
+
2224 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2325 ActionListener, ChangeListener,
2426 InputMethodListener,
....@@ -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,62 @@
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(setupPanel2);
172
+ objEditor.ctrlPanel.remove(commandsPanel);
173
+ objEditor.ctrlPanel.remove(pushPanel);
174
+ //objEditor.ctrlPanel.remove(fillPanel);
175
+
176
+ //Remove(normalpushField);
161177 }
162178
163179 public ObjEditor GetEditor()
164180 {
165181 return objEditor; //.GetEditor();
166182 }
183
+
184
+ // Sometimes myself, sometimes my callee's.
167185 ObjEditor objEditor;
168186
169187 /*
....@@ -238,7 +256,7 @@
238256 //if (!isDisplayable())
239257 //setUndecorated(true);
240258
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
259
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242260 client = inClient;
243261 copy = localCopy;
244262 copy.editWindow = this;
....@@ -259,24 +277,40 @@
259277 void SetupMenu()
260278 {
261279 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..."));
280
+ menuBar.add(fileMenu = new Menu("File"));
281
+ fileMenu.add(newItem = new MenuItem("New"));
282
+ fileMenu.add(loadItem = new MenuItem("Open..."));
283
+
284
+ //oe.menuBar.add(menu = new Menu("Include"));
285
+ Menu menu = new Menu("Import");
286
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
287
+ importOBJItem.addActionListener(this);
288
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
289
+ import3DSItem.addActionListener(this);
290
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
291
+ importVRMLX3DItem.addActionListener(this);
292
+ menu.add("-");
293
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
294
+ importGFDItem.addActionListener(this);
295
+ fileMenu.add(menu);
296
+ fileMenu.add("-");
297
+
298
+ fileMenu.add(saveItem = new MenuItem("Save"));
299
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267300 //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("-");
301
+ fileMenu.add("-");
302
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
303
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
304
+ fileMenu.add("-");
272305 if (client.parent != null)
273306 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
307
+ fileMenu.add(closeItem = new MenuItem("Close"));
275308 } else
276309 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
310
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278311 }
279312
313
+ newItem.addActionListener(this);
280314 loadItem.addActionListener(this);
281315 saveItem.addActionListener(this);
282316 saveAsItem.addActionListener(this);
....@@ -285,79 +319,26 @@
285319 //povItem.addActionListener(this);
286320 closeItem.addActionListener(this);
287321
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
-
343322 objectPanel = new JTabbedPane();
344323 toolbarPanel = new JPanel();
345324 toolbarPanel.setName("Toolbar");
346
- treePanel = new JPanel();
325
+ treePanel = new cGridBag();
347326 treePanel.setName("Tree");
348
- ctrlPanel = new JPanel(); // new GridBagLayout());
327
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
349328 ctrlPanel.setName("Edit");
350
- materialPanel = new JPanel();
329
+ materialPanel = new cGridBag().setVertical(true);
351330 materialPanel.setName("Material");
352331 /*JTextPane*/
353332 infoarea = createTextPane();
333
+ doc = infoarea.getStyledDocument();
334
+
354335 infoarea.setEditable(true);
355336 SetText();
356337 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
357338 // infoarea.setOpaque(false);
358339 // //infoarea.setForeground(textcolor);
359
- infoarea.setLineWrap(true);
360
- infoarea.setWrapStyleWord(true);
340
+// TEXTAREA infoarea.setLineWrap(true);
341
+// TEXTAREA infoarea.setWrapStyleWord(true);
361342 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
362343 infoPanel.setPreferredSize(new Dimension(50, 200));
363344 infoPanel.setName("Info");
....@@ -368,16 +349,16 @@
368349 mainPanel.setName("Main");
369350 mainPanel.setContinuousLayout(true);
370351 mainPanel.setOneTouchExpandable(true);
371
- mainPanel.setDividerLocation(1.0);
372352 mainPanel.setDividerSize(9);
373
- mainPanel.setResizeWeight(0);
353
+ mainPanel.setDividerLocation(0.5); //1.0);
354
+ mainPanel.setResizeWeight(0.5);
374355
375356 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
376357 //mainPanel.setLayout(new GridBagLayout());
377358 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
378
- treePanel.setLayout(new GridBagLayout());
379
- ctrlPanel.setLayout(new GridBagLayout());
380
- materialPanel.setLayout(new GridBagLayout());
359
+// treePanel.setLayout(new GridBagLayout());
360
+ //ctrlPanel.setLayout(new GridBagLayout());
361
+ //materialPanel.setLayout(new GridBagLayout());
381362
382363 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
383364 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -416,7 +397,7 @@
416397 static String newline = "\n";
417398 protected static final String buttonString = "JButton";
418399 StyledDocument doc;
419
- JTextArea infoarea;
400
+ JTextPane infoarea;
420401
421402 void ClearInfo()
422403 {
....@@ -439,10 +420,10 @@
439420 e.printStackTrace();
440421 }
441422
442
- String selection = infoarea.getText();
443
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
444
- java.awt.datatransfer.Clipboard clipboard =
445
- Toolkit.getDefaultToolkit().getSystemClipboard();
423
+// String selection = infoarea.getText();
424
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
425
+// java.awt.datatransfer.Clipboard clipboard =
426
+// Toolkit.getDefaultToolkit().getSystemClipboard();
446427 //clipboard.setContents(data, data);
447428 }
448429
....@@ -465,13 +446,13 @@
465446 //SendInfo("Name:", "bold");
466447 if (sel.GetTextures() != null || debug)
467448 {
468
- si.SendInfo(sel.toString(), "bold");
449
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
469450 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
470451 if (sel.Size() > 0)
471452 {
472453 si.SendInfo("#children = " + sel.Size(), "regular");
473454 }
474
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
455
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
475456 if (debug)
476457 {
477458 try
....@@ -483,7 +464,10 @@
483464 }
484465
485466 if (full)
486
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
467
+ {
468
+ si.SendInfo(" BBox min: " + minima, "regular");
469
+ si.SendInfo(" BBox max: " + maxima, "regular");
470
+ }
487471
488472 if (sel.bRep != null)
489473 {
....@@ -510,7 +494,7 @@
510494 }
511495 if (sel.support != null)
512496 {
513
- si.SendInfo(" support: " + sel.support, "regular");
497
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
514498 }
515499 if (sel.scriptnode != null)
516500 {
....@@ -581,6 +565,9 @@
581565 {
582566 CameraPane.pointflow = (PointFlow) sel;
583567 }
568
+
569
+ si.SendInfo("_____________________", "regular");
570
+ si.SendInfo("", "regular");
584571 }
585572 }
586573
....@@ -596,52 +583,68 @@
596583 }
597584 }
598585
599
- private JTextArea createTextPane()
600
- {
601
- String[] initString =
586
+ void ToggleFullScreen()
602587 {
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++)
588
+ if (CameraPane.FULLSCREEN)
634589 {
635
- doc.insertString(doc.getLength(), initString[i],
636
- doc.getStyle(initStyles[i]));
590
+ frame.getContentPane().remove(/*"Center",*/bigThree);
591
+ framePanel.add(bigThree);
592
+ frame.getContentPane().add(/*"Center",*/framePanel);
593
+ } else
594
+ {
595
+ frame.getContentPane().remove(/*"Center",*/framePanel);
596
+ framePanel.remove(bigThree);
597
+ frame.getContentPane().add(/*"Center",*/bigThree);
637598 }
638
- }
639
- } catch (BadLocationException ble)
640
- {
641
- System.err.println("Couldn't insert initial text into text pane.");
599
+ cameraView.ToggleFullScreen();
642600 }
643601
644
- return new JTextArea(); // textPane;
602
+ private JTextPane createTextPane()
603
+ {
604
+// TEXTAREA String[] initString =
605
+// {
606
+// "This is an editable JTextPane, ", //regular
607
+// "another ", //italic
608
+// "styled ", //bold
609
+// "text ", //small
610
+// "component, ", //large
611
+// "which supports embedded components..." + newline,//regular
612
+// " " + newline, //button
613
+// "...and embedded icons..." + newline, //regular
614
+// " ", //icon
615
+// newline + "JTextPane is a subclass of JEditorPane that "
616
+// + "uses a StyledEditorKit and StyledDocument, and provides "
617
+// + "cover methods for interacting with those objects."
618
+// };
619
+//
620
+// String[] initStyles =
621
+// {
622
+// "regular", "italic", "bold", "small", "large",
623
+// "regular", "button", "regular", "icon",
624
+// "regular"
625
+// };
626
+//
627
+// JTextPane textPane = new JTextPane();
628
+// textPane.setEditable(true);
629
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
630
+// addStylesToDocument(doc);
631
+//
632
+// try
633
+// {
634
+// for (int j = 0; j < 2; j++)
635
+// {
636
+// for (int i = 0; i < initString.length; i++)
637
+// {
638
+// doc.insertString(doc.getLength(), initString[i],
639
+// doc.getStyle(initStyles[i]));
640
+// }
641
+// }
642
+// } catch (BadLocationException ble)
643
+// {
644
+// System.err.println("Couldn't insert initial text into text pane.");
645
+// }
646
+
647
+ return new JTextPane(); // textPane;
645648 }
646649
647650 protected void addStylesToDocument(StyledDocument doc)
....@@ -694,7 +697,7 @@
694697 protected static ImageIcon createImageIcon(String path,
695698 String description)
696699 {
697
- java.net.URL imgURL = GrafreeD.class.getResource(path);
700
+ java.net.URL imgURL = Grafreed.class.getResource(path);
698701 if (imgURL != null)
699702 {
700703 return new ImageIcon(imgURL, description);
....@@ -726,6 +729,7 @@
726729 // NumberSlider vDivsField;
727730 // JCheckBox endcaps;
728731 JCheckBox liveCB;
732
+ JCheckBox selectCB;
729733 JCheckBox hideCB;
730734 JCheckBox link2masterCB;
731735 JCheckBox markCB;
....@@ -741,115 +745,84 @@
741745 JButton slowerButton;
742746 JButton fasterButton;
743747 JButton remarkButton;
748
+
749
+ cGridBag namePanel;
750
+ cGridBag setupPanel;
751
+ cGridBag setupPanel2;
752
+ cGridBag commandsPanel;
753
+ cGridBag pushPanel;
754
+ cGridBag fillPanel;
744755
745
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
756
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
746757 {
747758 JCheckBox cb;
748759
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);
760
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
754761 cb.addItemListener(this);
755
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
756
- oe.aConstraints.gridwidth = 1;
757
- oe.aConstraints.gridx += 1;
758762
759763 return cb;
760764 }
761765
762
- cButton AddButton(ObjEditor oe, String label)
766
+ cButton AddButton(cGridBag panel, String label)
763767 {
764768 cButton cb;
765769
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);
770
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
771771 cb.addActionListener(this);
772
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
773
- oe.aConstraints.gridwidth = 1;
774
- oe.aConstraints.gridx += 1;
775772
776773 return cb;
777774 }
778775
779
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
776
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
780777 {
781778 JComboBox combo;
782779
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;
780
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
786781 combo.addActionListener(this);
787782
788783 return combo;
789784 }
790785
791
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
786
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
792787 {
793
- NumberSlider combo;
788
+ cGridBag control = new cGridBag();
789
+
790
+ cNumberSlider combo;
794791
795792 JLabel jlabel = new JLabel(label);
796
-
797
- aConstraints.fill = GridBagConstraints.VERTICAL;
798793 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
-
794
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
795
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
808796 combo.setFloat(current);
809
-
810
- combo.label = jlabel;
811
-
812
- combo.addChangeListener(this);
813
-
814
- return combo;
797
+
798
+ panel.add(control);
799
+
800
+ return control;
815801 }
816802
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
803
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
818804 {
819
- NumberSlider combo;
805
+ cGridBag control = new cGridBag();
806
+
807
+ cNumberSlider combo;
820808
821809 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824810 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
-
811
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834813 combo.setInteger(current);
835814
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
815
+ panel.add(control);
816
+
817
+ return control;
841818 }
842819
843
- JTextArea AddText(JPanel ctrlPanel, String name)
820
+ JTextArea AddText(cGridBag ctrlPanel, String name)
844821 {
845822 JTextArea text;
846823
847
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
848
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
849
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
824
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
850825 text.addCaretListener(this);
851
- aConstraints.gridx += 1;
852
- aConstraints.gridwidth = 1;
853826
854827 return text;
855828 }
....@@ -879,9 +852,16 @@
879852 objEditor.ctrlPanel.remove(j);
880853 }
881854
855
+ void Remove(cNumberSlider j)
856
+ {
857
+ j.removeChangeListener(this);
858
+ //objEditor.ctrlPanel.remove(j.label);
859
+ objEditor.ctrlPanel.remove(j);
860
+ }
861
+
882862 /*
883863 */
884
- void Return() // ObjEditor oe)
864
+ void Return0() // ObjEditor oe)
885865 {
886866 aConstraints.gridy += 1;
887867 aConstraints.gridx = 0;
....@@ -936,35 +916,77 @@
936916
937917 void SetupUI2(ObjEditor oe)
938918 {
939
-// oe.aConstraints.weightx = 0;
940
-// oe.aConstraints.weighty = 0;
941
-// oe.aConstraints.gridx = 0;
942
-// oe.aConstraints.gridy = 0;
943
- SetupName(oe);
919
+ //SetupName(oe);
920
+
921
+ namePanel = new cGridBag();
922
+
923
+ nameField = AddText(namePanel, copy.GetName());
924
+ namePanel.add(nameField);
925
+ oe.ctrlPanel.add(namePanel);
926
+
927
+ oe.ctrlPanel.Return();
944928
945929 if (!GroupEditor.allparams)
946930 return;
947931
948
- liveCB = AddCheckBox(oe, "Live", copy.live);
949
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
950
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
932
+ setupPanel = new cGridBag().setVertical(false);
933
+
934
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
935
+ liveCB.setToolTipText("Animate object");
936
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
937
+ selectCB.setToolTipText("Make object selectable");
951938 // 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");
939
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
940
+ hideCB.setToolTipText("Hide object");
941
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
942
+ markCB.setToolTipText("Set the animation target transform");
943
+
944
+ setupPanel2 = new cGridBag().setVertical(false);
945
+
946
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
947
+ rewindCB.setToolTipText("Rewind animation");
948
+
949
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
950
+ randomCB.setToolTipText("Rewind or Go back and forth randomly");
951
+
952
+ if (Globals.ADVANCED)
953
+ {
954
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
955
+ link2masterCB.setToolTipText("Attach to support");
956
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
957
+ speedupCB.setToolTipText("Option motion capture");
958
+ }
959
+
960
+ oe.ctrlPanel.add(setupPanel);
961
+ oe.ctrlPanel.Return();
962
+ oe.ctrlPanel.add(setupPanel2);
963
+ oe.ctrlPanel.Return();
964
+
965
+ commandsPanel = new cGridBag().setVertical(false);
966
+
967
+ resetButton = AddButton(commandsPanel, "Reset");
968
+ resetButton.setToolTipText("Jump to frame zero");
969
+ stepButton = AddButton(commandsPanel, "Step");
970
+ stepButton.setToolTipText("Step one frame");
958971 // resetAllButton = AddButton(oe, "Reset All");
959972 // stepAllButton = AddButton(oe, "Step All");
960
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
961973 // Return();
962
- slowerButton = AddButton(oe, "Slow");
963
- fasterButton = AddButton(oe, "Fast");
964
- remarkButton = AddButton(oe, "Rem");
974
+ slowerButton = AddButton(commandsPanel, "Slow");
975
+ slowerButton.setToolTipText("Decrease animation speed");
976
+ fasterButton = AddButton(commandsPanel, "Fast");
977
+ fasterButton.setToolTipText("Increase animation speed");
978
+ remarkButton = AddButton(commandsPanel, "Remark");
979
+ remarkButton.setToolTipText("Set the current transform as the target");
965980
966
- Return();
981
+ oe.ctrlPanel.add(commandsPanel);
982
+ oe.ctrlPanel.Return();
967983
984
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
985
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
986
+ //Return();
987
+
988
+ oe.ctrlPanel.Return();
989
+
968990 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
969991 // ObjEditor.aConstraints.gridx += 1;
970992
....@@ -1058,7 +1080,7 @@
10581080 oe.aConstraints.gridwidth = 1;
10591081 /**/
10601082 nameField = AddText(oe.ctrlPanel, copy.GetName());
1061
- Return();
1083
+ oe.ctrlPanel.Return();
10621084
10631085 //ctrlPanel.add(textureButton = new Button("Texture..."));
10641086 //textureButton.setEnabled(false);
....@@ -1160,10 +1182,18 @@
11601182 //JPanel worldPanel =
11611183 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11621184 //worldPanel.setName("World");
1163
- centralPanel = new JPanel(new BorderLayout());
1185
+ centralPanel = new cGridBag();
1186
+ centralPanel.preferredWidth = 20;
11641187 timelinePanel = new JPanel(new BorderLayout());
11651188 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11661189
1190
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1191
+ cameraPanel.setContinuousLayout(true);
1192
+ cameraPanel.setOneTouchExpandable(true);
1193
+// cameraPanel.setDividerLocation(0.9);
1194
+// cameraPanel.setDividerSize(9);
1195
+ cameraPanel.setResizeWeight(1.0);
1196
+
11671197 centralPanel.add(cameraView);
11681198 //frame.setJMenuBar(timelineMenubar);
11691199 //centralPanel.add(timelinePanel);
....@@ -1183,12 +1213,13 @@
11831213 //frontView.object = copy;
11841214 //sideView.object = copy;
11851215
1186
- XYZPanel = new JPanel();
1187
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1216
+ XYZPanel = new cGridBag().setVertical(true);
1217
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11881218
1189
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1190
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1191
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1219
+ XYZPanel.preferredWidth = 5;
1220
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1221
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1222
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11921223
11931224 /*
11941225 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1226,10 +1257,11 @@
12261257 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12271258 //tmp.setName("Edit");
12281259 objectPanel.add(materialPanel);
1229
- JPanel north = new JPanel(new BorderLayout());
1230
- north.setName("Edit");
1231
- north.add(ctrlPanel, BorderLayout.NORTH);
1232
- objectPanel.add(north);
1260
+// JPanel north = new JPanel(new BorderLayout());
1261
+// north.setName("Edit");
1262
+// north.add(ctrlPanel, BorderLayout.NORTH);
1263
+// objectPanel.add(north);
1264
+ objectPanel.add(ctrlPanel);
12331265 objectPanel.add(infoPanel);
12341266
12351267 /*
....@@ -1250,16 +1282,23 @@
12501282 scrollpane.setWheelScrollingEnabled(true);
12511283 scrollpane.addMouseWheelListener(this); // Default not fast enough
12521284
1253
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1254
- scenePanel.add(scrollpane);
1285
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1286
+ scenePanel.preferredWidth = 6;
1287
+
1288
+ JTabbedPane tabbedPane = new JTabbedPane();
1289
+ tabbedPane.add(scrollpane);
12551290
1256
- scenePanel.add(FSPane = new cFileSystemPane(this));
1291
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12571292
1258
- optionsPanel = new JPanel(new GridBagLayout());
1293
+ optionsPanel = new cGridBag().setVertical(true);
12591294
12601295 optionsPanel.setName("Options");
1261
- scenePanel.add(optionsPanel);
1262
-
1296
+
1297
+ AddOptions(optionsPanel); //, aConstraints);
1298
+
1299
+ tabbedPane.add(optionsPanel);
1300
+
1301
+ scenePanel.add(tabbedPane);
12631302
12641303 /*
12651304 cTree jTree = new cTree(null);
....@@ -1293,6 +1332,7 @@
12931332 //bigPanel.setSize(new Dimension(10,10));
12941333 //bigPanel.add(ctrlPanel);
12951334 //bigPanel.add(gridPanel);
1335
+ /**
12961336 bigThree = new JPanel();
12971337 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12981338 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1316,7 +1356,13 @@
13161356 // aConstraints.gridheight = 3;
13171357 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13181358 bigThree.add(XYZPanel, aWindowConstraints);
1359
+ /**/
13191360
1361
+ bigThree = new cGridBag();
1362
+ bigThree.addComponent(scenePanel);
1363
+ bigThree.addComponent(centralPanel);
1364
+ bigThree.addComponent(XYZPanel);
1365
+
13201366 // // SIDE EFFECT!!!
13211367 // aConstraints.gridx = 0;
13221368 // aConstraints.gridy = 0;
....@@ -1337,13 +1383,14 @@
13371383 //worldPane.add(bigPanel);
13381384 //worldPane.add(worldPanel);
13391385 /**/
1340
- frame.getContentPane().add(/*"Center",*/framePanel);
1386
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1387
+ frame.add(/*"Center",*/framePanel);
13411388 //frame.getContentPane().add(/*"Center",*/ worldPane);
13421389
13431390 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13441391
1345
- frame.setSize(1024, 768);
1346
- frame.show();
1392
+ frame.setSize(1280, 860);
1393
+ frame.setVisible(true);
13471394
13481395 gridPanel.setDividerLocation(1.0);
13491396
....@@ -1358,6 +1405,10 @@
13581405 });
13591406 }
13601407
1408
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1409
+ {
1410
+ }
1411
+
13611412 JTree GetTree()
13621413 {
13631414 return objEditor.jTree;
....@@ -1369,260 +1420,173 @@
13691420 ctrlPanel.removeAll();
13701421 }
13711422
1372
- void SetupMaterial(JPanel ctrlPanel)
1423
+ void SetupMaterial(cGridBag panel)
13731424 {
1374
- aConstraints.weighty = 0;
1375
- //aConstraints.weightx = 1;
1376
- /*
1425
+ /*
13771426 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13781427 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1379
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1380
- aConstraints.gridx += 1;
13811428 */
13821429
1383
- aConstraints.gridwidth = 1;
1384
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
1430
+ cGridBag editBar = new cGridBag().setVertical(false);
1431
+
1432
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1433
+ createMaterialButton.setToolTipText("Create material");
13881434
13891435 /*
13901436 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1391
- aConstraints.gridx += 1;
1392
- aConstraints.weighty = 0;
1393
- aConstraints.gridwidth = 1;
13941437 */
13951438
1396
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1397
- aConstraints.gridx += 1;
1439
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1440
+ clearMaterialButton.setToolTipText("Clear material");
1441
+
1442
+ if (Globals.ADVANCED)
1443
+ {
1444
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1445
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1446
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1447
+ }
13981448
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;
1449
+ editBar.preferredHeight = 15;
1450
+
1451
+ panel.add(editBar);
1452
+
14131453 /**/
14141454 //aConstraints.weighty = 0;
14151455 ////aConstraints.weightx = 1;
14161456 //aConstraints.weighty = 1;
14171457 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14181458 //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;
1459
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14241460
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;
1461
+ cGridBag colorSection = new cGridBag().setVertical(true);
1462
+
1463
+ cGridBag color = new cGridBag();
1464
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1465
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1466
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1467
+ //colorField.preferredWidth = 200;
1468
+ colorSection.add(color);
14351469
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;
1470
+ cGridBag modulation = new cGridBag();
1471
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1472
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1474
+ colorSection.add(modulation);
14451475
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;
1476
+ cGridBag texture = new cGridBag();
1477
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1478
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
+ colorSection.add(texture);
14551481
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;
1482
+ cGridBag anisoU = new cGridBag();
1483
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1484
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
+ colorSection.add(anisoU);
14651487
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;
1488
+ cGridBag anisoV = new cGridBag();
1489
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1490
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1492
+ colorSection.add(anisoV);
14751493
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;
1494
+ cGridBag shadowbias = new cGridBag();
1495
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1496
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1498
+ colorSection.add(shadowbias);
14851499
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;
1500
+ panel.add(new JSeparator());
1501
+
1502
+ panel.add(colorSection);
1503
+
1504
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1505
+
1506
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1507
+
1508
+ cGridBag diffuse = new cGridBag();
1509
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1510
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1512
+ diffuseSection.add(diffuse);
14941513
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;
1514
+ cGridBag diffuseness = new cGridBag();
1515
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1516
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1517
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1518
+ diffuseSection.add(diffuseness);
15041519
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;
1520
+ cGridBag selfshadow = new cGridBag();
1521
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1522
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1523
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1524
+ diffuseSection.add(selfshadow);
15141525
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;
1526
+ cGridBag sheen = new cGridBag();
1527
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1528
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1530
+ diffuseSection.add(sheen);
15241531
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;
1532
+ cGridBag subsurface = new cGridBag();
1533
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1534
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1536
+ diffuseSection.add(subsurface);
15341537
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;
1538
+ cGridBag shadow = new cGridBag();
1539
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1540
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1542
+ diffuseSection.add(shadow);
15441543
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;
1544
+ cGridBag fakedepth = new cGridBag();
1545
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1546
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1547
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1548
+ diffuseSection.add(fakedepth);
15541549
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;
1550
+ panel.add(new JSeparator());
1551
+
1552
+ panel.add(diffuseSection);
1553
+
1554
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1555
+
1556
+ cGridBag specularSection = new cGridBag().setVertical(true);
15641557
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;
1558
+ cGridBag specular = new cGridBag();
1559
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1560
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1561
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1562
+ specularSection.add(specular);
15731563
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;
1564
+ cGridBag lightarea = new cGridBag();
1565
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1566
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1567
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1568
+ specularSection.add(lightarea);
15831569
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;
1570
+ cGridBag shininess = new cGridBag();
1571
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1572
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1573
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1574
+ specularSection.add(shininess);
15931575
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;
1576
+ cGridBag metalness = new cGridBag();
1577
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1578
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1580
+ specularSection.add(metalness);
16031581
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;
1582
+ cGridBag velvet = new cGridBag();
1583
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1584
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1585
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1586
+ specularSection.add(velvet);
16131587
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();
1588
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1589
+ //Return();
16261590 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16271591 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16281592 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1633,130 +1597,93 @@
16331597 // aConstraints.gridy += 1;
16341598 // aConstraints.gridwidth = 1;
16351599
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;
16441600
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;
1601
+ panel.add(new JSeparator());
1602
+
1603
+ panel.add(specularSection);
1604
+
1605
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1606
+
1607
+ cGridBag globalSection = new cGridBag().setVertical(true);
16541608
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;
1609
+ cGridBag camera = new cGridBag();
1610
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1611
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1612
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
+ globalSection.add(camera);
16641614
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;
1615
+ cGridBag ambient = new cGridBag();
1616
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1617
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
+ globalSection.add(ambient);
16741620
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;
1621
+ cGridBag backlit = new cGridBag();
1622
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1623
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1624
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1625
+ globalSection.add(backlit);
16851626
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;
1627
+ cGridBag opacity = new cGridBag();
1628
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1629
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1630
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1631
+ globalSection.add(opacity);
16951632
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;
1633
+ panel.add(new JSeparator());
1634
+
1635
+ panel.add(globalSection);
1636
+
1637
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1638
+
1639
+ cGridBag textureSection = new cGridBag().setVertical(true);
17051640
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;
1641
+ cGridBag bump = new cGridBag();
1642
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1643
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1645
+ textureSection.add(bump);
17151646
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;
1647
+ cGridBag noise = new cGridBag();
1648
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1649
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1651
+ textureSection.add(noise);
17251652
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;
1653
+ cGridBag power = new cGridBag();
1654
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1655
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1657
+ textureSection.add(power);
17351658
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;
1659
+ cGridBag borderfade = new cGridBag();
1660
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1661
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1662
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1663
+ textureSection.add(borderfade);
17451664
1746
- //aConstraints.weighty = 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1748
- //aConstraints.gridx += 1;
1749
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1750
- aConstraints.weighty = 0;
1665
+ cGridBag fog = new cGridBag();
1666
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1667
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1668
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1669
+ textureSection.add(fog);
17511670
1752
- aConstraints.gridx = 0;
1753
- aConstraints.gridy = 0;
1754
- aConstraints.gridwidth = 1;
1671
+ cGridBag opacityPower = new cGridBag();
1672
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1673
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1674
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1675
+ textureSection.add(opacityPower);
1676
+
1677
+ panel.add(new JSeparator());
1678
+
1679
+ panel.add(textureSection);
1680
+
1681
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17551682
17561683 SetMaterial(copy); // .GetMaterial());
17571684
1758
- colorField.addChangeListener(this);
1759
- modulationField.addChangeListener(this);
1685
+ //colorField.addChangeListener(this);
1686
+// modulationField.addChangeListener(this);
17601687 metalnessField.addChangeListener(this);
17611688 diffuseField.addChangeListener(this);
17621689 specularField.addChangeListener(this);
....@@ -1786,12 +1713,15 @@
17861713 opacityPowerField.addChangeListener(this);
17871714 /**/
17881715
1789
- resetSlidersButton.addActionListener(this);
17901716 clearMaterialButton.addActionListener(this);
17911717 createMaterialButton.addActionListener(this);
1792
-
1793
- propagateToggle.addItemListener(this);
1794
- multiplyToggle.addItemListener(this);
1718
+
1719
+ if (Globals.ADVANCED)
1720
+ {
1721
+ resetSlidersButton.addActionListener(this);
1722
+ propagateToggle.addItemListener(this);
1723
+ multiplyToggle.addItemListener(this);
1724
+ }
17951725 }
17961726
17971727 void DropFile(java.io.File[] files, boolean textures)
....@@ -1962,7 +1892,7 @@
19621892
19631893 //? flashIt = false;
19641894 CameraPane pane = (CameraPane) cameraView;
1965
- pane.clickStart(location.x, location.y, 0);
1895
+ pane.clickStart(location.x, location.y, 0, 0);
19661896 pane.clickEnd(location.x, location.y, 0, true);
19671897
19681898 if (group.selection.size() == 1)
....@@ -2011,6 +1941,7 @@
20111941 e2.printStackTrace();
20121942 }
20131943 }
1944
+
20141945 LoadJMEThread loadThread;
20151946
20161947 class LoadJMEThread extends Thread
....@@ -2068,6 +1999,7 @@
20681999 //LoadFile0(filename, converter);
20692000 }
20702001 }
2002
+
20712003 LoadOBJThread loadObjThread;
20722004
20732005 class LoadOBJThread extends Thread
....@@ -2146,19 +2078,19 @@
21462078
21472079 void LoadObjFile(String fullname)
21482080 {
2149
- /*
2081
+ System.out.println("Loading " + fullname);
2082
+ /**/
21502083 //lastFilename = fullname;
21512084 if(loadObjThread == null)
21522085 {
2153
- loadObjThread = new LoadOBJThread();
2154
- loadObjThread.start();
2086
+ loadObjThread = new LoadOBJThread();
2087
+ loadObjThread.start();
21552088 }
21562089
21572090 loadObjThread.add(fullname);
2158
- */
2091
+ /**/
21592092
2160
- System.out.println("Loading " + fullname);
2161
- makeSomething(new FileObject(fullname, true), true);
2093
+ //makeSomething(new FileObject(fullname, true), true);
21622094 }
21632095
21642096 void LoadGFDFile(String fullname)
....@@ -2419,11 +2351,11 @@
24192351
24202352 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24212353 {
2422
- if (GrafreeD.standAlone)
2354
+ if (Grafreed.standAlone)
24232355 {
24242356 /**/
24252357 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2426
- browser.show();
2358
+ browser.setVisible(true);
24272359 String filename = browser.getFile();
24282360 if (filename != null && filename.length() > 0)
24292361 {
....@@ -2568,6 +2500,7 @@
25682500 }
25692501 if (input == null)
25702502 {
2503
+ new Exception().printStackTrace();
25712504 System.exit(0);
25722505 }
25732506
....@@ -2782,7 +2715,8 @@
27822715 return;
27832716 }
27842717
2785
- multiplyToggle.setSelected(mat.multiply);
2718
+ if (multiplyToggle != null)
2719
+ multiplyToggle.setSelected(mat.multiply);
27862720
27872721 assert (object.projectedVertices != null);
27882722
....@@ -2966,42 +2900,40 @@
29662900 return;
29672901 } else if (event.getSource() == toggleTimelineItem)
29682902 {
2969
- copy.timeline ^= true;
2903
+ timeline ^= true;
29702904
2971
- if (copy.timeline)
2905
+ if (timeline)
29722906 {
29732907 centralPanel.remove(cameraView);
2974
- centralPanel.add(timelinePanel);
2908
+ cameraPanel.add(cameraView);
2909
+ centralPanel.add(cameraPanel);
29752910 frame.setJMenuBar(timelineMenubar);
2911
+ wasFullScreen = CameraPane.FULLSCREEN;
2912
+ if (!CameraPane.FULLSCREEN)
2913
+ ToggleFullScreen();
2914
+ toggleFullScreenItem.setEnabled(false);
29762915 }
29772916 else
29782917 {
2979
- centralPanel.remove(timelinePanel);
2918
+ centralPanel.remove(cameraPanel);
29802919 centralPanel.add(cameraView);
29812920 frame.setJMenuBar(null);
2921
+ if (!wasFullScreen)
2922
+ ToggleFullScreen();
2923
+ toggleFullScreenItem.setEnabled(true);
29822924 }
29832925
29842926 frame.validate();
29852927 return;
29862928 } else if (event.getSource() == toggleFullScreenItem)
29872929 {
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
- }
2930
+ ToggleFullScreen();
29982931 frame.validate();
2999
- cameraView.ToggleFullScreen();
30002932
30012933 return;
3002
- } else if (event.getSource() == toggleRandomItem)
2934
+ } else if (event.getSource() == toggleSwitchItem)
30032935 {
3004
- cameraView.ToggleRandom();
2936
+ cameraView.ToggleSwitch();
30052937 cameraView.repaint();
30062938 return;
30072939 } else if (event.getSource() == toggleHandleItem)
....@@ -3030,6 +2962,10 @@
30302962 {
30312963 copy.live ^= true;
30322964 return;
2965
+ } else if (event.getSource() == selectCB)
2966
+ {
2967
+ copy.dontselect ^= true;
2968
+ return;
30332969 } else if (event.getSource() == hideCB)
30342970 {
30352971 copy.hide ^= true;
....@@ -3044,6 +2980,7 @@
30442980 if (event.getSource() == randomCB)
30452981 {
30462982 copy.random ^= true;
2983
+ objEditor.refreshContents();
30472984 return;
30482985 }
30492986 if (event.getSource() == speedupCB)
....@@ -3067,8 +3004,9 @@
30673004
30683005 public void actionPerformed(ActionEvent event)
30693006 {
3007
+ Object source = event.getSource();
30703008 // SCRIPT DIALOG
3071
- if (event.getSource() == okbutton)
3009
+ if (source == okbutton)
30723010 {
30733011 textpanel.setVisible(false);
30743012 textpanel.remove(textarea);
....@@ -3080,7 +3018,7 @@
30803018 textarea = null;
30813019 textpanel = null;
30823020 }
3083
- if (event.getSource() == cancelbutton)
3021
+ if (source == cancelbutton)
30843022 {
30853023 textpanel.setVisible(false);
30863024 textpanel.remove(textarea);
....@@ -3092,49 +3030,50 @@
30923030 //applySelf();
30933031 //client.refreshEditWindow();
30943032 //refreshContents();
3095
- if (event.getSource() == nameField)
3033
+ if (source == nameField)
30963034 {
30973035 //System.out.println("ObjEditor " + event);
30983036 applySelf0(true);
30993037 //parent.applySelf();
31003038 objEditor.refreshContents();
3101
- } else if (event.getSource() == resetButton)
3039
+ } else if (source == resetButton)
31023040 {
31033041 CameraPane.fullreset = true;
31043042 copy.Reset(); // ResetMeshes();
31053043 copy.Touch();
31063044 objEditor.refreshContents();
3107
- } else if (event.getSource() == stepItem)
3045
+ } else if (source == stepItem)
31083046 {
3109
- cameraView.ONESTEP = true;
3047
+ //cameraView.ONESTEP = true;
3048
+ Globals.ONESTEP = true;
31103049 cameraView.repaint();
31113050 return;
3112
- } else if (event.getSource() == stepButton)
3051
+ } else if (source == stepButton)
31133052 {
31143053 copy.Step();
31153054 copy.Touch();
31163055 objEditor.refreshContents();
3117
- } else if (event.getSource() == slowerButton)
3056
+ } else if (source == slowerButton)
31183057 {
31193058 copy.Slower();
31203059 copy.Touch();
31213060 objEditor.refreshContents();
3122
- } else if (event.getSource() == fasterButton)
3061
+ } else if (source == fasterButton)
31233062 {
31243063 copy.Faster();
31253064 copy.Touch();
31263065 objEditor.refreshContents();
3127
- } else if (event.getSource() == remarkButton)
3066
+ } else if (source == remarkButton)
31283067 {
31293068 copy.Remark();
31303069 copy.Touch();
31313070 objEditor.refreshContents();
3132
- } else if (event.getSource() == stepAllButton)
3071
+ } else if (source == stepAllButton)
31333072 {
31343073 copy.StepAll();
31353074 copy.Touch();
31363075 objEditor.refreshContents();
3137
- } else if (event.getSource() == resetAllButton)
3076
+ } else if (source == resetAllButton)
31383077 {
31393078 //CameraPane.fullreset = true;
31403079 copy.ResetAll(); // ResetMeshes();
....@@ -3167,53 +3106,75 @@
31673106 // Close();
31683107 // }
31693108 // else
3170
- if (event.getSource() == resetSlidersButton)
3109
+ if (source == resetSlidersButton)
31713110 {
31723111 ResetSliders();
3173
- } else if (event.getSource() == clearMaterialButton)
3112
+ } else if (source == clearMaterialButton)
31743113 {
31753114 ClearMaterial();
3176
- } else if (event.getSource() == createMaterialButton)
3115
+ } else if (source == createMaterialButton)
31773116 {
31783117 CreateMaterial();
3179
- } else if (event.getSource() == clearPanelButton)
3118
+ } else if (source == clearPanelButton)
31803119 {
31813120 copy.ClearUI();
31823121 refreshContents(true);
3183
- } /*
3184
- }
3185
-
3186
- public boolean action(Event event, Object arg)
3187
- {
3188
- */ else if (event.getSource() == closeItem)
3122
+ } else if (source == importGFDItem)
3123
+ {
3124
+ ImportGFD();
3125
+ } else
3126
+ if (source == importVRMLX3DItem)
3127
+ {
3128
+ ImportVRMLX3D();
3129
+ } else
3130
+ if (source == import3DSItem)
3131
+ {
3132
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3133
+ } else
3134
+ if (source == importOBJItem)
3135
+ {
3136
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3137
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3138
+ browser.setVisible(true);
3139
+ String filename = browser.getFile();
3140
+ if (filename != null && filename.length() > 0)
3141
+ {
3142
+ String fullname = browser.getDirectory() + filename;
3143
+ makeSomething(ReadOBJ(fullname), true);
3144
+ }
3145
+ } else
3146
+ if (source == closeItem)
31893147 {
31903148 Close();
31913149 //return true;
3192
- } else if (event.getSource() == loadItem)
3150
+ } else if (source == loadItem)
31933151 {
31943152 load();
31953153 //return true;
3196
- } else if (event.getSource() == saveItem)
3154
+ } else if (source == newItem)
3155
+ {
3156
+ New();
3157
+ } else if (source == saveItem)
31973158 {
31983159 save();
31993160 //return true;
3200
- } else if (event.getSource() == saveAsItem)
3161
+ } else if (source == saveAsItem)
32013162 {
32023163 saveAs();
32033164 //return true;
3204
- } else if (event.getSource() == reexportItem)
3165
+ } else if (source == reexportItem)
32053166 {
32063167 reexport();
32073168 //return true;
3208
- } else if (event.getSource() == exportAsItem)
3169
+ } else if (source == exportAsItem)
32093170 {
32103171 export();
32113172 //return true;
3212
- } else if (event.getSource() == povItem)
3173
+ } else if (source == povItem)
32133174 {
32143175 generatePOV();
32153176 //return true;
3216
- } else if (event.getSource() == zBufferItem)
3177
+ } else if (source == zBufferItem)
32173178 {
32183179 try
32193180 {
....@@ -3235,21 +3196,8 @@
32353196 cameraView.repaint();
32363197 //return true;
32373198 }
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)
3199
+ */ else // combos...
3200
+ if (source == texresMenu)
32533201 {
32543202 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32553203 copy.texres = texresMenu.getSelectedIndex();
....@@ -3261,27 +3209,283 @@
32613209 }
32623210 }
32633211
3264
- void ToggleAnimation()
3212
+ void New()
32653213 {
3266
- if (!CameraPane.ANIMATION)
3214
+ while (copy.Size() > 1)
32673215 {
3268
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3216
+ copy.remove(1);
3217
+ }
3218
+
3219
+ ResetModel();
3220
+ objEditor.refreshContents();
3221
+ }
3222
+
3223
+ static public byte[] Compress(Object3D o)
3224
+ {
3225
+ try
3226
+ {
3227
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3228
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3229
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3230
+
3231
+ Object3D parent = o.parent;
3232
+ o.parent = null;
3233
+
3234
+ out.writeObject(o);
3235
+
3236
+ o.parent = parent;
3237
+
3238
+ out.flush();
3239
+
3240
+ zstream.close();
3241
+ out.close();
3242
+
3243
+ return baos.toByteArray();
3244
+ } catch (Exception e)
3245
+ {
3246
+ System.err.println(e);
3247
+ return null;
3248
+ }
3249
+ }
3250
+
3251
+ static public Object Uncompress(byte[] bytes)
3252
+ {
3253
+ System.out.println("#bytes = " + bytes.length);
3254
+ try
3255
+ {
3256
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3257
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3258
+ ObjectInputStream in = new ObjectInputStream(istream);
3259
+ Object obj = in.readObject();
3260
+ in.close();
3261
+
3262
+ return obj;
3263
+ } catch (Exception e)
3264
+ {
3265
+ System.err.println(e);
3266
+ return null;
3267
+ }
3268
+ }
3269
+
3270
+ static public Object clone(Object o)
3271
+ {
3272
+ try
3273
+ {
3274
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3275
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3276
+
3277
+ out.writeObject(o);
3278
+
3279
+ out.flush();
3280
+ out.close();
3281
+
3282
+ byte[] bytes = baos.toByteArray();
3283
+
3284
+ System.out.println("clone = " + bytes.length);
3285
+
3286
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3287
+ ObjectInputStream in = new ObjectInputStream(bais);
3288
+ Object obj = in.readObject();
3289
+ in.close();
3290
+
3291
+ return obj;
3292
+ } catch (Exception e)
3293
+ {
3294
+ System.err.println(e);
3295
+ return null;
3296
+ }
3297
+ }
3298
+
3299
+ cRadio GetCurrentTab()
3300
+ {
3301
+ cRadio ab;
3302
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3303
+ {
3304
+ ab = (cRadio)e.nextElement();
3305
+ if(ab.GetObject() == copy)
3306
+ {
3307
+ return ab;
3308
+ }
3309
+ }
3310
+
3311
+ return null;
3312
+ }
3313
+
3314
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3315
+
3316
+ public void Save()
3317
+ {
3318
+ cRadio tab = GetCurrentTab();
3319
+
3320
+ boolean temp = CameraPane.SWITCH;
3321
+ CameraPane.SWITCH = false;
3322
+
3323
+ copy.ExtractBigData(hashtable);
3324
+
3325
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3326
+ tab.graphs[tab.undoindex++] = Compress(copy);
3327
+
3328
+ copy.RestoreBigData(hashtable);
3329
+
3330
+ CameraPane.SWITCH = temp;
3331
+
3332
+ //assert(hashtable.isEmpty());
3333
+
3334
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3335
+ {
3336
+ tab.graphs[i] = null;
3337
+ }
3338
+
3339
+ // test save
3340
+ if (false)
3341
+ {
3342
+ try
3343
+ {
3344
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3345
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3346
+
3347
+ p.writeObject(copy);
3348
+
3349
+ p.flush();
3350
+
3351
+ ostream.close();
3352
+ } catch (Exception e)
3353
+ {
3354
+ e.printStackTrace();
3355
+ }
3356
+ }
3357
+ }
3358
+
3359
+ void CopyChanged(Object3D obj)
3360
+ {
3361
+ boolean temp = CameraPane.SWITCH;
3362
+ CameraPane.SWITCH = false;
3363
+
3364
+ copy.ExtractBigData(hashtable);
3365
+
3366
+ copy.clear();
3367
+
3368
+ for (int i=0; i<obj.Size(); i++)
3369
+ {
3370
+ copy.add(obj.get(i));
3371
+ }
3372
+
3373
+ copy.RestoreBigData(hashtable);
3374
+
3375
+ CameraPane.SWITCH = temp;
3376
+
3377
+ //assert(hashtable.isEmpty());
3378
+
3379
+ copy.Touch();
3380
+
3381
+ ResetModel();
3382
+ copy.HardTouch(); // recompile?
3383
+
3384
+ cRadio ab;
3385
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3386
+ {
3387
+ ab = (cRadio)e.nextElement();
3388
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3389
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3390
+ if (test != null)
3391
+ {
3392
+ test.editWindow = ab.object.editWindow;
3393
+ ab.object = test;
3394
+ }
3395
+ }
3396
+
3397
+ refreshContents();
3398
+ }
3399
+
3400
+ public void Undo()
3401
+ {
3402
+ cRadio tab = GetCurrentTab();
3403
+
3404
+ if (tab.undoindex == 0)
3405
+ {
3406
+ java.awt.Toolkit.getDefaultToolkit().beep();
3407
+ return;
3408
+ }
3409
+
3410
+ if (tab.graphs[tab.undoindex] == null)
3411
+ {
3412
+ Save();
3413
+ tab.undoindex -= 1;
3414
+ }
3415
+
3416
+ tab.undoindex -= 1;
3417
+
3418
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3419
+ }
3420
+
3421
+ public void Redo()
3422
+ {
3423
+ cRadio tab = GetCurrentTab();
3424
+
3425
+ if (tab.graphs[tab.undoindex + 1] == null)
3426
+ {
3427
+ java.awt.Toolkit.getDefaultToolkit().beep();
3428
+ return;
3429
+ }
3430
+
3431
+ tab.undoindex += 1;
3432
+
3433
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3434
+ }
3435
+
3436
+ void ImportGFD()
3437
+ {
3438
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32693439 browser.show();
32703440 String filename = browser.getFile();
32713441 if (filename != null && filename.length() > 0)
32723442 {
3273
- CameraPane.filename = browser.getDirectory() + filename;
3443
+ String fullname = browser.getDirectory() + filename;
3444
+
3445
+ //Object3D readobj =
3446
+ objEditor.ReadGFD(fullname, objEditor);
3447
+ //makeSomething(readobj);
3448
+ }
3449
+ }
3450
+
3451
+ void ImportVRMLX3D()
3452
+ {
3453
+ if (Grafreed.standAlone)
3454
+ {
3455
+ /**/
3456
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3457
+ browser.show();
3458
+ String filename = browser.getFile();
3459
+ if (filename != null && filename.length() > 0)
3460
+ {
3461
+ String fullname = browser.getDirectory() + filename;
3462
+ LoadVRMLX3D(fullname);
3463
+ }
3464
+ /**/
3465
+ }
3466
+ }
3467
+
3468
+ void ToggleAnimation()
3469
+ {
3470
+ if (!Globals.ANIMATION)
3471
+ {
3472
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3473
+ browser.setVisible(true);
3474
+ String filename = browser.getFile();
3475
+ if (filename != null && filename.length() > 0)
3476
+ {
3477
+ Globals.filename = browser.getDirectory() + filename;
32743478 //CameraPane.framecount = 0;
3275
- CameraPane.imagecount = 0;
3479
+ Globals.imagecount = 0;
32763480
3277
- CameraPane.ANIMATION ^= true;
3481
+ Globals.ANIMATION ^= true;
32783482
3279
- GrafreeD.wav.cursor = 0;
3280
- GrafreeD.wav.loop = 0;
3483
+ Grafreed.wav.cursor = 0;
3484
+ Grafreed.wav.loop = 0;
32813485 }
32823486 } else
32833487 {
3284
- CameraPane.ANIMATION ^= true;
3488
+ Globals.ANIMATION ^= true;
32853489 }
32863490 }
32873491
....@@ -3327,7 +3531,7 @@
33273531 void CreateMaterial()
33283532 {
33293533 //copy.ClearMaterial(); // PATCH
3330
- copy.CreateMaterialS(multiplyToggle.isSelected());
3534
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33313535 if (copy.selection.size() > 0)
33323536 //SetMaterial(copy);
33333537 {
....@@ -3386,11 +3590,11 @@
33863590 {
33873591 copy.ResetBlockLoop(); // temporary problem
33883592
3389
- boolean random = CameraPane.RANDOM;
3390
- CameraPane.RANDOM = false; // parse everything
3593
+ boolean random = CameraPane.SWITCH;
3594
+ CameraPane.SWITCH = false; // parse everything
33913595 copy.ResetDisplayList();
33923596 copy.HardTouch();
3393
- CameraPane.RANDOM = random;
3597
+ CameraPane.SWITCH = random;
33943598 }
33953599
33963600 // public void applySelf()
....@@ -3460,10 +3664,40 @@
34603664 current.fakedepth = (float) fakedepthField.getFloat();
34613665 current.shadowbias = (float) shadowbiasField.getFloat();
34623666
3463
- if (!NumberSlider.frozen)
3667
+ if (!cNumberSlider.frozen)
34643668 {
34653669 //System.out.println("Propagate = " + propagate);
34663670 copy.UpdateMaterial(anchor, current, propagate);
3671
+
3672
+ if (copy.material != null)
3673
+ {
3674
+ cMaterial mat = copy.material;
3675
+
3676
+ colorField.SetToolTipValue((mat.color));
3677
+ modulationField.SetToolTipValue((mat.modulation));
3678
+ metalnessField.SetToolTipValue((mat.metalness));
3679
+ diffuseField.SetToolTipValue((mat.diffuse));
3680
+ specularField.SetToolTipValue((mat.specular));
3681
+ shininessField.SetToolTipValue((mat.shininess));
3682
+ shiftField.SetToolTipValue((mat.shift));
3683
+ ambientField.SetToolTipValue((mat.ambient));
3684
+ lightareaField.SetToolTipValue((mat.lightarea));
3685
+ diffusenessField.SetToolTipValue((mat.factor));
3686
+ velvetField.SetToolTipValue((mat.velvet));
3687
+ sheenField.SetToolTipValue((mat.sheen));
3688
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3689
+ backlitField.SetToolTipValue((mat.bump));
3690
+ anisoField.SetToolTipValue((mat.aniso));
3691
+ anisoVField.SetToolTipValue((mat.anisoV));
3692
+ cameraField.SetToolTipValue((mat.cameralight));
3693
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3694
+ shadowField.SetToolTipValue((mat.shadow));
3695
+ textureField.SetToolTipValue((mat.texture));
3696
+ opacityField.SetToolTipValue((mat.opacity));
3697
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3698
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3699
+ }
3700
+
34673701 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34683702 {
34693703 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3508,6 +3742,7 @@
35083742 || e.getSource() == apertureField
35093743 || e.getSource() == shadowblurField)
35103744 {
3745
+ new Exception().printStackTrace();
35113746 System.exit(0);
35123747 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35133748 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3534,7 +3769,13 @@
35343769 //System.out.println("PARENT = " + parent);
35353770 //if (parent != null)
35363771 // parent.applySelf();
3537
- refreshContents();
3772
+ if (e.getSource() == normalpushField)
3773
+ {
3774
+ objEditor.refreshContents();
3775
+ //Refresh();
3776
+ }
3777
+ else
3778
+ refreshContents();
35383779 // ??? client.refreshEditWindow();
35393780 }
35403781 //else
....@@ -3546,7 +3787,7 @@
35463787 //group.name = nameField.getText();
35473788 //objEditor.applySelf();
35483789
3549
- assert (objEditor == this);
3790
+ // OCT2018: assert (objEditor == this);
35503791 if (copy.selection == null || copy.selection.size() == 0)
35513792 //super.applySelf()
35523793 ; else
....@@ -3570,12 +3811,18 @@
35703811 objEditor.copy = keep;
35713812 }
35723813 }
3814
+
3815
+ if (normalpushField != null)
3816
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35733817 }
35743818
35753819 void SnapObject()
35763820 {
3577
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3578
- SnapObject(obj);
3821
+ if (copy.selection.size() > 0)
3822
+ {
3823
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3824
+ SnapObject(obj);
3825
+ }
35793826 }
35803827
35813828 void SnapObject(Object3D obj)
....@@ -3821,7 +4068,7 @@
38214068
38224069 radioPanel.revalidate();
38234070 radioPanel.repaint();
3824
- ctrlPanel.revalidate(); // ? new
4071
+ ctrlPanel.validate(); // ? new
38254072 ctrlPanel.repaint();
38264073 }
38274074 }
....@@ -3830,6 +4077,7 @@
38304077
38314078 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38324079 {
4080
+ Save();
38334081 //Tween.set(thing, 0).target(1).start(tweenManager);
38344082 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38354083 // if (thing instanceof GenericJointDemo)
....@@ -4033,6 +4281,7 @@
40334281 }
40344282 }
40354283 }
4284
+
40364285 LoadGFDThread loadGFDThread;
40374286
40384287 void ReadGFD(String fullname, iCallBack cb)
....@@ -4052,8 +4301,10 @@
40524301
40534302 try
40544303 {
4304
+ // Try compressed version first.
40554305 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4056
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4306
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4307
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40574308
40584309 readobj = (Object3D) p.readObject();
40594310 istream.close();
....@@ -4061,7 +4312,20 @@
40614312 readobj.ResetDisplayList();
40624313 } catch (Exception e)
40634314 {
4064
- e.printStackTrace();
4315
+ //e.printStackTrace();
4316
+ try
4317
+ {
4318
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4319
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4320
+
4321
+ readobj = (Object3D) p.readObject();
4322
+ istream.close();
4323
+
4324
+ readobj.ResetDisplayList();
4325
+ } catch (Exception e2)
4326
+ {
4327
+ e2.printStackTrace();
4328
+ }
40654329 }
40664330 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40674331 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4107,6 +4371,12 @@
41074371
41084372 void LoadIt(Object obj)
41094373 {
4374
+ if (obj == null)
4375
+ {
4376
+ // Invalid file
4377
+ return;
4378
+ }
4379
+
41104380 System.out.println("Loaded " + obj);
41114381 //new Exception().printStackTrace();
41124382 Object3D readobj = (Object3D) obj;
....@@ -4116,6 +4386,7 @@
41164386
41174387 if (readobj != null)
41184388 {
4389
+ Save();
41194390 try
41204391 {
41214392 //readobj.deepCopySelf(copy);
....@@ -4178,7 +4449,7 @@
41784449
41794450 void load() // throws ClassNotFoundException
41804451 {
4181
- if (GrafreeD.standAlone)
4452
+ if (Grafreed.standAlone)
41824453 {
41834454 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41844455 browser.show();
....@@ -4265,11 +4536,13 @@
42654536 try
42664537 {
42674538 FileOutputStream ostream = new FileOutputStream(lastname);
4268
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4539
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4540
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42694541
42704542 p.writeObject(copy);
42714543 p.flush();
42724544
4545
+ zstream.close();
42734546 ostream.close();
42744547
42754548 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4279,11 +4552,12 @@
42794552 {
42804553 }
42814554 }
4555
+
42824556 String lastname;
42834557
42844558 void saveAs()
42854559 {
4286
- if (GrafreeD.standAlone)
4560
+ if (Grafreed.standAlone)
42874561 {
42884562 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42894563 browser.setVisible(true);
....@@ -4388,13 +4662,13 @@
43884662 try
43894663 {
43904664 FileOutputStream ostream = new FileOutputStream(filename);
4391
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4392
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4665
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4666
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43934667
43944668 Object3D objectparent = obj.parent;
43954669 obj.parent = null;
43964670
4397
- Object3D object = (Object3D) GrafreeD.clone(obj);
4671
+ Object3D object = (Object3D) Grafreed.clone(obj);
43984672
43994673 obj.parent = objectparent;
44004674
....@@ -4406,8 +4680,8 @@
44064680 p.writeObject(object);
44074681 p.flush();
44084682
4683
+ zstream.close();
44094684 ostream.close();
4410
- // zstream.close();
44114685
44124686 // group.selection.get(0).parent = parent;
44134687 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4428,7 +4702,7 @@
44284702 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44294703 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44304704 copy.generatePOV(buffer);
4431
- if (GrafreeD.standAlone)
4705
+ if (Grafreed.standAlone)
44324706 {
44334707 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44344708 browser.show();
....@@ -4454,7 +4728,8 @@
44544728 Object3D client;
44554729 Object3D copy;
44564730 MenuBar menuBar;
4457
- Menu windowMenu;
4731
+ Menu fileMenu;
4732
+ MenuItem newItem;
44584733 MenuItem loadItem;
44594734 MenuItem saveItem;
44604735 MenuItem saveAsItem;
....@@ -4462,13 +4737,11 @@
44624737 MenuItem reexportItem;
44634738 MenuItem povItem;
44644739 MenuItem closeItem;
4465
- Menu cameraMenu;
4740
+
44664741 CheckboxMenuItem zBufferItem;
44674742 //MenuItem normalLensItem;
4468
- MenuItem editCameraItem;
4469
- MenuItem revertCameraItem;
4470
- CheckboxMenuItem toggleLiveItem;
44714743 MenuItem stepItem;
4744
+ CheckboxMenuItem toggleLiveItem;
44724745 CheckboxMenuItem toggleFullScreenItem;
44734746 CheckboxMenuItem toggleTimelineItem;
44744747 CheckboxMenuItem toggleRenderItem;
....@@ -4477,7 +4750,7 @@
44774750 CheckboxMenuItem toggleFootContactItem;
44784751 CheckboxMenuItem toggleDLItem;
44794752 CheckboxMenuItem toggleTextureItem;
4480
- CheckboxMenuItem toggleRandomItem;
4753
+ CheckboxMenuItem toggleSwitchItem;
44814754 CheckboxMenuItem toggleRootItem;
44824755 CheckboxMenuItem animationItem;
44834756 CheckboxMenuItem toggleHandleItem;
....@@ -4485,20 +4758,21 @@
44854758 JSplitPane mainPanel;
44864759 JScrollPane scrollpane;
44874760 JPanel toolbarPanel;
4488
- JPanel treePanel;
4761
+ cGridBag treePanel;
44894762 JPanel radioPanel;
44904763 ButtonGroup buttonGroup;
4491
- JPanel ctrlPanel;
4492
- JPanel materialPanel;
4764
+ cGridBag ctrlPanel;
4765
+ cGridBag materialPanel;
44934766 JScrollPane infoPanel;
4494
- JPanel optionsPanel;
4767
+ cGridBag optionsPanel;
44954768 JTabbedPane objectPanel;
4496
- JPanel XYZPanel;
4769
+ cGridBag XYZPanel;
44974770 JSplitPane gridPanel;
44984771 JSplitPane bigPanel;
4499
- JPanel bigThree;
4500
- JTabbedPane scenePanel;
4501
- JPanel centralPanel;
4772
+ cGridBag bigThree;
4773
+ cGridBag scenePanel;
4774
+ cGridBag centralPanel;
4775
+ JSplitPane cameraPanel;
45024776 JPanel timelinePanel;
45034777 JMenuBar timelineMenubar;
45044778 JSplitPane framePanel;
....@@ -4550,65 +4824,72 @@
45504824 // MATERIAL
45514825 JLabel materialLabel;
45524826 JLabel colorLabel;
4553
- NumberSlider colorField;
4827
+ cNumberSlider colorField;
45544828 JLabel modulationLabel;
4555
- NumberSlider modulationField;
4829
+ cNumberSlider modulationField;
45564830 JLabel metalnessLabel;
4557
- NumberSlider metalnessField;
4831
+ cNumberSlider metalnessField;
45584832 JLabel diffuseLabel;
4559
- NumberSlider diffuseField;
4833
+ cNumberSlider diffuseField;
45604834 JLabel specularLabel;
4561
- NumberSlider specularField;
4835
+ cNumberSlider specularField;
45624836 JLabel shininessLabel;
4563
- NumberSlider shininessField;
4837
+ cNumberSlider shininessField;
45644838 JLabel shiftLabel;
4565
- NumberSlider shiftField;
4839
+ cNumberSlider shiftField;
45664840 JLabel ambientLabel;
4567
- NumberSlider ambientField;
4841
+ cNumberSlider ambientField;
45684842 JLabel lightareaLabel;
4569
- NumberSlider lightareaField;
4843
+ cNumberSlider lightareaField;
45704844 JLabel diffusenessLabel;
4571
- NumberSlider diffusenessField;
4845
+ cNumberSlider diffusenessField;
45724846 JLabel velvetLabel;
4573
- NumberSlider velvetField;
4847
+ cNumberSlider velvetField;
45744848 JLabel sheenLabel;
4575
- NumberSlider sheenField;
4849
+ cNumberSlider sheenField;
45764850 JLabel subsurfaceLabel;
4577
- NumberSlider subsurfaceField;
4851
+ cNumberSlider subsurfaceField;
45784852 //JLabel bumpLabel;
45794853 //NumberSlider bumpField;
45804854 JLabel backlitLabel;
4581
- NumberSlider backlitField;
4855
+ cNumberSlider backlitField;
45824856 JLabel anisoLabel;
4583
- NumberSlider anisoField;
4857
+ cNumberSlider anisoField;
45844858 JLabel anisoVLabel;
4585
- NumberSlider anisoVField;
4859
+ cNumberSlider anisoVField;
45864860 JLabel cameraLabel;
4587
- NumberSlider cameraField;
4861
+ cNumberSlider cameraField;
45884862 JLabel selfshadowLabel;
4589
- NumberSlider selfshadowField;
4863
+ cNumberSlider selfshadowField;
45904864 JLabel shadowLabel;
4591
- NumberSlider shadowField;
4865
+ cNumberSlider shadowField;
45924866 JLabel textureLabel;
4593
- NumberSlider textureField;
4867
+ cNumberSlider textureField;
45944868 JLabel opacityLabel;
4595
- NumberSlider opacityField;
4869
+ cNumberSlider opacityField;
45964870 JLabel fakedepthLabel;
4597
- NumberSlider fakedepthField;
4871
+ cNumberSlider fakedepthField;
45984872 JLabel shadowbiasLabel;
4599
- NumberSlider shadowbiasField;
4873
+ cNumberSlider shadowbiasField;
46004874 JLabel bumpLabel;
4601
- NumberSlider bumpField;
4875
+ cNumberSlider bumpField;
46024876 JLabel noiseLabel;
4603
- NumberSlider noiseField;
4877
+ cNumberSlider noiseField;
46044878 JLabel powerLabel;
4605
- NumberSlider powerField;
4879
+ cNumberSlider powerField;
46064880 JLabel borderfadeLabel;
4607
- NumberSlider borderfadeField;
4881
+ cNumberSlider borderfadeField;
46084882 JLabel fogLabel;
4609
- NumberSlider fogField;
4883
+ cNumberSlider fogField;
46104884 JLabel opacityPowerLabel;
4611
- NumberSlider opacityPowerField;
4885
+ cNumberSlider opacityPowerField;
46124886 JTree jTree;
46134887 //ObjectUI parent;
4888
+
4889
+ cNumberSlider normalpushField;
4890
+
4891
+ private MenuItem importGFDItem;
4892
+ private MenuItem importVRMLX3DItem;
4893
+ private MenuItem import3DSItem;
4894
+ private MenuItem importOBJItem;
46144895 }