Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -19,6 +20,8 @@
1920 import //weka.core.
2021 matrix.Matrix;
2122
23
+import grafeme.ui.*;
24
+
2225 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2326 ActionListener, ChangeListener,
2427 InputMethodListener,
....@@ -28,7 +31,60 @@
2831 iSendInfo
2932 //KeyListener
3033 {
34
+ boolean timeline;
35
+ boolean wasFullScreen;
3136
37
+ GroupEditor callee;
38
+ JFrame frame;
39
+
40
+ static ObjEditor theFrame;
41
+
42
+ cButton GetButton(String name, boolean border)
43
+ {
44
+ try
45
+ {
46
+ ImageIcon icon = GetIcon(name);
47
+ return new cButton(icon, border);
48
+ }
49
+ catch (Exception e)
50
+ {
51
+ return new cButton(name, border);
52
+ }
53
+ }
54
+
55
+ cCheckBox GetCheckBox(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cCheckBox(name, border);
65
+ }
66
+ }
67
+
68
+ private ImageIcon GetIcon(String name) throws IOException
69
+ {
70
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
71
+
72
+ if (image.getWidth() != 24 && image.getHeight() != 24)
73
+ {
74
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
75
+ Graphics2D g = resized.createGraphics();
76
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
77
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
78
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
79
+ g.dispose();
80
+
81
+ image = resized;
82
+ }
83
+
84
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
85
+ return icon;
86
+ }
87
+
3288 // SCRIPT
3389
3490 transient JFrame textpanel = null;
....@@ -119,51 +175,62 @@
119175 void keyPressed(int key, int modifiers)
120176 {
121177 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
178
+ Globals.theRenderer.keyPressed(key, modifiers);
123179 }
124180 */
125181
126182 static GridBagConstraints aConstraints;
127183 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
184
+
130185 static int GRIDWIDTH = 100; // 4;
131186
132187 public void closeUI()
133188 {
134189 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
190
+// System.out.println("this = " + this);
191
+// System.out.println("objEditor = " + objEditor);
137192 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
193
+// objEditor.ctrlPanel.remove(nameField);
194
+
195
+ objEditor.ctrlPanel.remove(namePanel);
139196
140197 if (!GroupEditor.allparams)
141198 return;
142199
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);
200
+// objEditor.ctrlPanel.remove(liveCB);
201
+// objEditor.ctrlPanel.remove(hideCB);
202
+// objEditor.ctrlPanel.remove(markCB);
203
+//
204
+// objEditor.ctrlPanel.remove(randomCB);
205
+// objEditor.ctrlPanel.remove(speedupCB);
206
+// objEditor.ctrlPanel.remove(rewindCB);
207
+//
208
+// objEditor.ctrlPanel.remove(resetButton);
209
+// objEditor.ctrlPanel.remove(stepButton);
210
+//// objEditor.ctrlPanel.remove(stepAllButton);
211
+//// objEditor.ctrlPanel.remove(resetAllButton);
212
+// objEditor.ctrlPanel.remove(link2masterCB);
213
+// //objEditor.ctrlPanel.remove(flipVCB);
214
+// //objEditor.ctrlPanel.remove(texresMenu);
215
+// objEditor.ctrlPanel.remove(slowerButton);
216
+// objEditor.ctrlPanel.remove(fasterButton);
217
+// objEditor.ctrlPanel.remove(remarkButton);
218
+
219
+ objEditor.ctrlPanel.remove(setupPanel);
220
+ objEditor.ctrlPanel.remove(setupPanel2);
221
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
222
+ objEditor.ctrlPanel.remove(pushPanel);
223
+ //objEditor.ctrlPanel.remove(fillPanel);
224
+
225
+ //Remove(normalpushField);
161226 }
162227
163228 public ObjEditor GetEditor()
164229 {
165230 return objEditor; //.GetEditor();
166231 }
232
+
233
+ // Sometimes myself, sometimes my callee's.
167234 ObjEditor objEditor;
168235
169236 /*
....@@ -226,6 +293,7 @@
226293 //localCopy.parent = null;
227294
228295 frame = new JFrame();
296
+ frame.setUndecorated(true);
229297 objEditor = this;
230298 this.callee = callee;
231299
....@@ -238,7 +306,7 @@
238306 //if (!isDisplayable())
239307 //setUndecorated(true);
240308
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
309
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242310 client = inClient;
243311 copy = localCopy;
244312 copy.editWindow = this;
....@@ -259,24 +327,40 @@
259327 void SetupMenu()
260328 {
261329 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..."));
330
+ menuBar.add(fileMenu = new Menu("File"));
331
+ fileMenu.add(newItem = new MenuItem("New"));
332
+ fileMenu.add(loadItem = new MenuItem("Open..."));
333
+
334
+ //oe.menuBar.add(menu = new Menu("Include"));
335
+ Menu menu = new Menu("Import");
336
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
337
+ importOBJItem.addActionListener(this);
338
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
339
+ import3DSItem.addActionListener(this);
340
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
341
+ importVRMLX3DItem.addActionListener(this);
342
+ menu.add("-");
343
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
344
+ importGFDItem.addActionListener(this);
345
+ fileMenu.add(menu);
346
+ fileMenu.add("-");
347
+
348
+ fileMenu.add(saveItem = new MenuItem("Save"));
349
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267350 //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("-");
351
+ fileMenu.add("-");
352
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
353
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
354
+ fileMenu.add("-");
272355 if (client.parent != null)
273356 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
357
+ fileMenu.add(closeItem = new MenuItem("Close"));
275358 } else
276359 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
360
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278361 }
279362
363
+ newItem.addActionListener(this);
280364 loadItem.addActionListener(this);
281365 saveItem.addActionListener(this);
282366 saveAsItem.addActionListener(this);
....@@ -285,77 +369,35 @@
285369 //povItem.addActionListener(this);
286370 closeItem.addActionListener(this);
287371
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(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add("-");
299
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300
- toggleTextureItem.addItemListener(this);
301
- toggleTextureItem.setState(CameraPane.textureon);
302
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303
- toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
305
- cameraMenu.add(stepItem = new MenuItem("Step"));
306
- stepItem.addActionListener(this);
307
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
308
-// toggleDLItem.addItemListener(this);
309
-// toggleDLItem.setState(false);
310
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
311
- toggleRenderItem.addItemListener(this);
312
- toggleRenderItem.setState(!CameraPane.frozen);
313
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
314
- toggleDebugItem.addItemListener(this);
315
- toggleDebugItem.setState(CameraPane.DEBUG);
316
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
317
- toggleFrustumItem.addItemListener(this);
318
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
319
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
320
- toggleFootContactItem.addItemListener(this);
321
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
322
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
323
- toggleRandomItem.addItemListener(this);
324
- toggleRandomItem.setState(CameraPane.RANDOM);
325
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
326
- toggleHandleItem.addItemListener(this);
327
- toggleHandleItem.setState(CameraPane.HANDLES);
328
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
329
- togglePaintItem.addItemListener(this);
330
- togglePaintItem.setState(CameraPane.PAINTMODE);
331
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
332
-// toggleRootItem.addItemListener(this);
333
-// toggleRootItem.setState(false);
334
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
335
-// animationItem.addItemListener(this);
336
-// animationItem.setState(CameraPane.ANIMATION);
337
- cameraMenu.add("-");
338
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
339
- editCameraItem.addActionListener(this);
340
-
341372 objectPanel = new JTabbedPane();
342373 toolbarPanel = new JPanel();
343374 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
375
+ treePanel = new cGridBag();
345376 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
377
+
378
+ editPanel = new cGridBag().setVertical(true);
379
+ editPanel.setName("Edit");
380
+
381
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
382
+
383
+ editCommandsPanel = new cGridBag();
384
+ editPanel.add(editCommandsPanel);
385
+ editPanel.add(ctrlPanel);
386
+
387
+ materialPanel = new cGridBag().setVertical(true);
388
+
349389 materialPanel.setName("Material");
350390 /*JTextPane*/
351391 infoarea = createTextPane();
392
+ doc = infoarea.getStyledDocument();
393
+
352394 infoarea.setEditable(true);
353395 SetText();
354396 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355397 // infoarea.setOpaque(false);
356398 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
399
+// TEXTAREA infoarea.setLineWrap(true);
400
+// TEXTAREA infoarea.setWrapStyleWord(true);
359401 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360402 infoPanel.setPreferredSize(new Dimension(50, 200));
361403 infoPanel.setName("Info");
....@@ -366,16 +408,16 @@
366408 mainPanel.setName("Main");
367409 mainPanel.setContinuousLayout(true);
368410 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370411 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
412
+ mainPanel.setDividerLocation(0.5); //1.0);
413
+ mainPanel.setResizeWeight(0.5);
372414
373415 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374416 //mainPanel.setLayout(new GridBagLayout());
375417 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
418
+// treePanel.setLayout(new GridBagLayout());
419
+ //ctrlPanel.setLayout(new GridBagLayout());
420
+ //materialPanel.setLayout(new GridBagLayout());
379421
380422 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381423 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +456,7 @@
414456 static String newline = "\n";
415457 protected static final String buttonString = "JButton";
416458 StyledDocument doc;
417
- JTextArea infoarea;
459
+ JTextPane infoarea;
418460
419461 void ClearInfo()
420462 {
....@@ -437,10 +479,10 @@
437479 e.printStackTrace();
438480 }
439481
440
- String selection = infoarea.getText();
441
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
442
- java.awt.datatransfer.Clipboard clipboard =
443
- Toolkit.getDefaultToolkit().getSystemClipboard();
482
+// String selection = infoarea.getText();
483
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
484
+// java.awt.datatransfer.Clipboard clipboard =
485
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444486 //clipboard.setContents(data, data);
445487 }
446488
....@@ -463,13 +505,13 @@
463505 //SendInfo("Name:", "bold");
464506 if (sel.GetTextures() != null || debug)
465507 {
466
- si.SendInfo(sel.toString(), "bold");
508
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467509 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468510 if (sel.Size() > 0)
469511 {
470512 si.SendInfo("#children = " + sel.Size(), "regular");
471513 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
514
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473515 if (debug)
474516 {
475517 try
....@@ -481,7 +523,10 @@
481523 }
482524
483525 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
526
+ {
527
+ si.SendInfo(" BBox min: " + minima, "regular");
528
+ si.SendInfo(" BBox max: " + maxima, "regular");
529
+ }
485530
486531 if (sel.bRep != null)
487532 {
....@@ -508,7 +553,7 @@
508553 }
509554 if (sel.support != null)
510555 {
511
- si.SendInfo(" support: " + sel.support, "regular");
556
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512557 }
513558 if (sel.scriptnode != null)
514559 {
....@@ -522,18 +567,18 @@
522567 maxima.y = sel.toParent[3][1];
523568 maxima.z = sel.toParent[3][2];
524569 si.SendInfo(" Orig: " + maxima, "regular");
525
- maxima.x = sel.globalTransform[3][0];
526
- maxima.y = sel.globalTransform[3][1];
527
- maxima.z = sel.globalTransform[3][2];
528
- if (full)
529
- si.SendInfo(" Global Orig: " + maxima, "regular");
530570 maxima.x = sel.toParent[0][0];
531571 maxima.y = sel.toParent[1][1];
532572 maxima.z = sel.toParent[2][2];
533573 si.SendInfo(" Scale: " + maxima, "regular");
534
- maxima.x = sel.globalTransform[0][0];
535
- maxima.y = sel.globalTransform[1][1];
536
- maxima.z = sel.globalTransform[2][2];
574
+ maxima.x = sel.globalTransform[3][0];
575
+ maxima.y = sel.globalTransform[3][1];
576
+ maxima.z = sel.globalTransform[3][2];
577
+ if (full)
578
+ si.SendInfo(" Global Orig: " + maxima, "regular");
579
+ maxima.x = sel.globalTransform[0][0];
580
+ maxima.y = sel.globalTransform[1][1];
581
+ maxima.z = sel.globalTransform[2][2];
537582 if (full)
538583 si.SendInfo(" Global Scale: " + maxima, "regular");
539584 }
....@@ -579,6 +624,9 @@
579624 {
580625 CameraPane.pointflow = (PointFlow) sel;
581626 }
627
+
628
+ si.SendInfo("_____________________", "regular");
629
+ si.SendInfo("", "regular");
582630 }
583631 }
584632
....@@ -594,52 +642,138 @@
594642 }
595643 }
596644
597
- private JTextArea createTextPane()
598
- {
599
- String[] initString =
600
- {
601
- "This is an editable JTextPane, ", //regular
602
- "another ", //italic
603
- "styled ", //bold
604
- "text ", //small
605
- "component, ", //large
606
- "which supports embedded components..." + newline,//regular
607
- " " + newline, //button
608
- "...and embedded icons..." + newline, //regular
609
- " ", //icon
610
- newline + "JTextPane is a subclass of JEditorPane that "
611
- + "uses a StyledEditorKit and StyledDocument, and provides "
612
- + "cover methods for interacting with those objects."
613
- };
645
+static GraphicsDevice device = GraphicsEnvironment
646
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
614647
615
- String[] initStyles =
648
+ Rectangle keeprect;
649
+ cRadio radio;
650
+
651
+cButton keepButton;
652
+ cButton twoButton; // Full 3D
653
+ cButton sixButton;
654
+ cButton threeButton;
655
+ cButton sevenButton;
656
+ cButton fourButton; // full panel
657
+ cButton oneButton; // full XYZ
658
+ //cButton currentLayout;
659
+
660
+ boolean maximized;
661
+
662
+ void Minimize()
616663 {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
621
-
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
664
+ frame.setState(Frame.ICONIFIED);
665
+ }
666
+
667
+ void Maximize()
628668 {
629
- for (int j = 0; j < 2; j++)
669
+ if (maximized)
630670 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
671
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
636672 }
637
- } catch (BadLocationException ble)
673
+ else
674
+ {
675
+ keeprect = frame.getBounds();
676
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
677
+ Dimension rect2 = frame.getToolkit().getScreenSize();
678
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
679
+// frame.setState(Frame.MAXIMIZED_BOTH);
680
+ }
681
+
682
+ maximized ^= true;
683
+ }
684
+
685
+ void ToggleFullScreen()
638686 {
639
- System.err.println("Couldn't insert initial text into text pane.");
687
+ if (CameraPane.FULLSCREEN)
688
+ {
689
+ device.setFullScreenWindow(null);
690
+ //frame.setVisible(false);
691
+// frame.removeNotify();
692
+// frame.setUndecorated(false);
693
+// frame.addNotify();
694
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
695
+
696
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
697
+// X framePanel.add(bigThree);
698
+// X frame.getContentPane().add(/*"Center",*/framePanel);
699
+ framePanel.setDividerLocation(1);
700
+
701
+ //frame.setVisible(true);
702
+ radio.layout = keepButton;
703
+ //theFrame = null;
704
+ keepButton = null;
705
+ radio.layout.doClick();
706
+
707
+ } else
708
+ {
709
+ keepButton = radio.layout;
710
+ //keeprect = frame.getBounds();
711
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
712
+// frame.getToolkit().getScreenSize().height);
713
+ //frame.setVisible(false);
714
+ device.setFullScreenWindow(frame);
715
+// frame.removeNotify();
716
+// frame.setUndecorated(true);
717
+// frame.addNotify();
718
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
719
+// X framePanel.remove(bigThree);
720
+// X frame.getContentPane().add(/*"Center",*/bigThree);
721
+ framePanel.setDividerLocation(0);
722
+
723
+ radio.layout = twoButton;
724
+ radio.layout.doClick();
725
+ //frame.setVisible(true);
726
+ }
727
+
728
+ cameraView.ToggleFullScreen();
640729 }
641730
642
- return new JTextArea(); // textPane;
731
+ private JTextPane createTextPane()
732
+ {
733
+// TEXTAREA String[] initString =
734
+// {
735
+// "This is an editable JTextPane, ", //regular
736
+// "another ", //italic
737
+// "styled ", //bold
738
+// "text ", //small
739
+// "component, ", //large
740
+// "which supports embedded components..." + newline,//regular
741
+// " " + newline, //button
742
+// "...and embedded icons..." + newline, //regular
743
+// " ", //icon
744
+// newline + "JTextPane is a subclass of JEditorPane that "
745
+// + "uses a StyledEditorKit and StyledDocument, and provides "
746
+// + "cover methods for interacting with those objects."
747
+// };
748
+//
749
+// String[] initStyles =
750
+// {
751
+// "regular", "italic", "bold", "small", "large",
752
+// "regular", "button", "regular", "icon",
753
+// "regular"
754
+// };
755
+//
756
+// JTextPane textPane = new JTextPane();
757
+// textPane.setEditable(true);
758
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
759
+// addStylesToDocument(doc);
760
+//
761
+// try
762
+// {
763
+// for (int j = 0; j < 2; j++)
764
+// {
765
+// for (int i = 0; i < initString.length; i++)
766
+// {
767
+// doc.insertString(doc.getLength(), initString[i],
768
+// doc.getStyle(initStyles[i]));
769
+// }
770
+// }
771
+// } catch (BadLocationException ble)
772
+// {
773
+// System.err.println("Couldn't insert initial text into text pane.");
774
+// }
775
+
776
+ return new JTextPane(); // textPane;
643777 }
644778
645779 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +826,7 @@
692826 protected static ImageIcon createImageIcon(String path,
693827 String description)
694828 {
695
- java.net.URL imgURL = GraphreeD.class.getResource(path);
829
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696830 if (imgURL != null)
697831 {
698832 return new ImageIcon(imgURL, description);
....@@ -724,6 +858,7 @@
724858 // NumberSlider vDivsField;
725859 // JCheckBox endcaps;
726860 JCheckBox liveCB;
861
+ JCheckBox selectCB;
727862 JCheckBox hideCB;
728863 JCheckBox link2masterCB;
729864 JCheckBox markCB;
....@@ -739,115 +874,87 @@
739874 JButton slowerButton;
740875 JButton fasterButton;
741876 JButton remarkButton;
877
+
878
+ cGridBag editPanel;
879
+ cGridBag editCommandsPanel;
880
+
881
+ cGridBag namePanel;
882
+ cGridBag setupPanel;
883
+ cGridBag setupPanel2;
884
+ cGridBag objectCommandsPanel;
885
+ cGridBag pushPanel;
886
+ cGridBag fillPanel;
742887
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
888
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
744889 {
745890 JCheckBox cb;
746891
747
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
748
- oe.aConstraints.gridwidth = 1; // 3;
749
-// oe.aConstraints.weightx = 1;
750
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
751
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
892
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
752893 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
756894
757895 return cb;
758896 }
759897
760
- cButton AddButton(ObjEditor oe, String label)
898
+ cButton AddButton(cGridBag panel, String label)
761899 {
762900 cButton cb;
763901
764
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
765
- oe.aConstraints.gridwidth = 1;
766
-// oe.aConstraints.weightx = 1;
767
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
768
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
902
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
769903 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
773904
774905 return cb;
775906 }
776907
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
908
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
778909 {
779910 JComboBox combo;
780911
781
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
782
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
783
- oe.aConstraints.gridx += 1;
912
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
784913 combo.addActionListener(this);
785914
786915 return combo;
787916 }
788917
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
918
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
790919 {
791
- NumberSlider combo;
920
+ cGridBag control = new cGridBag();
921
+
922
+ cNumberSlider combo;
792923
793924 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
796925 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
798
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799
- aConstraints.gridx += 1;
800
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
801
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
802
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
803
- aConstraints.gridx += 1;
804
- aConstraints.gridwidth = 1;
805
-
926
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
927
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
806928 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
929
+
930
+ panel.add(control);
931
+
932
+ return control;
813933 }
814934
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
935
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
816936 {
817
- NumberSlider combo;
937
+ cGridBag control = new cGridBag();
938
+
939
+ cNumberSlider combo;
818940
819941 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822942 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 2;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
943
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
944
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832945 combo.setInteger(current);
833946
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
947
+ panel.add(control);
948
+
949
+ return control;
839950 }
840951
841
- JTextArea AddText(JPanel ctrlPanel, String name)
952
+ JTextArea AddText(cGridBag ctrlPanel, String name)
842953 {
843954 JTextArea text;
844955
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
956
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
848957 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851958
852959 return text;
853960 }
....@@ -877,9 +984,16 @@
877984 objEditor.ctrlPanel.remove(j);
878985 }
879986
987
+ void Remove(cNumberSlider j)
988
+ {
989
+ j.removeChangeListener(this);
990
+ //objEditor.ctrlPanel.remove(j.label);
991
+ objEditor.ctrlPanel.remove(j);
992
+ }
993
+
880994 /*
881995 */
882
- void Return() // ObjEditor oe)
996
+ void Return0() // ObjEditor oe)
883997 {
884998 aConstraints.gridy += 1;
885999 aConstraints.gridx = 0;
....@@ -934,35 +1048,77 @@
9341048
9351049 void SetupUI2(ObjEditor oe)
9361050 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1051
+ //SetupName(oe);
1052
+
1053
+ namePanel = new cGridBag();
1054
+
1055
+ nameField = AddText(namePanel, copy.GetName());
1056
+ namePanel.add(nameField);
1057
+ oe.ctrlPanel.add(namePanel);
1058
+
1059
+ oe.ctrlPanel.Return();
9421060
9431061 if (!GroupEditor.allparams)
9441062 return;
9451063
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1064
+ setupPanel = new cGridBag().setVertical(false);
1065
+
1066
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1067
+ liveCB.setToolTipText("Animate object");
1068
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1069
+ selectCB.setToolTipText("Make object selectable");
9491070 // Return();
950
- markCB = AddCheckBox(oe, "Mark", copy.marked);
951
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
952
- randomCB = AddCheckBox(oe, "Rand", copy.random);
953
- Return();
954
- resetButton = AddButton(oe, "Reset");
955
- stepButton = AddButton(oe, "Step");
1071
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1072
+ hideCB.setToolTipText("Hide object");
1073
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1074
+ markCB.setToolTipText("Set the animation target transform");
1075
+
1076
+ setupPanel2 = new cGridBag().setVertical(false);
1077
+
1078
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1079
+ rewindCB.setToolTipText("Rewind animation");
1080
+
1081
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1082
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1083
+
1084
+ if (Globals.ADVANCED)
1085
+ {
1086
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1087
+ link2masterCB.setToolTipText("Attach to support");
1088
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1089
+ speedupCB.setToolTipText("Option motion capture");
1090
+ }
1091
+
1092
+ oe.ctrlPanel.add(setupPanel);
1093
+ oe.ctrlPanel.Return();
1094
+ oe.ctrlPanel.add(setupPanel2);
1095
+ oe.ctrlPanel.Return();
1096
+
1097
+ objectCommandsPanel = new cGridBag().setVertical(false);
1098
+
1099
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1100
+ resetButton.setToolTipText("Jump to frame zero");
1101
+ stepButton = AddButton(objectCommandsPanel, "Step");
1102
+ stepButton.setToolTipText("Step one frame");
9561103 // resetAllButton = AddButton(oe, "Reset All");
9571104 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591105 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1106
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1107
+ slowerButton.setToolTipText("Decrease animation speed");
1108
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1109
+ fasterButton.setToolTipText("Increase animation speed");
1110
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1111
+ remarkButton.setToolTipText("Set the current transform as the target");
9631112
964
- Return();
1113
+ oe.ctrlPanel.add(objectCommandsPanel);
1114
+ oe.ctrlPanel.Return();
9651115
1116
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1117
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1118
+ //Return();
1119
+
1120
+ oe.ctrlPanel.Return();
1121
+
9661122 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671123 // ObjEditor.aConstraints.gridx += 1;
9681124
....@@ -1056,7 +1212,7 @@
10561212 oe.aConstraints.gridwidth = 1;
10571213 /**/
10581214 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1215
+ oe.ctrlPanel.Return();
10601216
10611217 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621218 //textureButton.setEnabled(false);
....@@ -1107,7 +1263,7 @@
11071263 //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------");
11081264 //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------");
11091265
1110
-// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints);
1266
+// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints);
11111267 Camera cam = GetCamera(copy, 0);
11121268
11131269 Composite cams = null;
....@@ -1158,10 +1314,28 @@
11581314 //JPanel worldPanel =
11591315 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601316 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1317
+ centralPanel = new cGridBag();
1318
+ centralPanel.preferredWidth = 20;
1319
+
1320
+ if (Globals.ADVANCED)
1321
+ {
1322
+ timelinePanel = new JPanel(new BorderLayout());
1323
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641324
1325
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1326
+ cameraPanel.setContinuousLayout(true);
1327
+ cameraPanel.setOneTouchExpandable(true);
1328
+// cameraPanel.setDividerLocation(0.9);
1329
+// cameraPanel.setDividerSize(9);
1330
+ cameraPanel.setResizeWeight(1.0);
1331
+
1332
+ }
1333
+
1334
+ centralPanel.add(cameraView);
1335
+ centralPanel.setFocusable(true);
1336
+ //frame.setJMenuBar(timelineMenubar);
1337
+ //centralPanel.add(timelinePanel);
1338
+
11651339 //topView.camera = ;
11661340 //frontView.camera = new Camera(2);
11671341 //sideView.camera = new Camera(3);
....@@ -1177,12 +1351,13 @@
11771351 //frontView.object = copy;
11781352 //sideView.object = copy;
11791353
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1354
+ XYZPanel = new cGridBag().setVertical(true);
1355
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821356
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1357
+ XYZPanel.preferredWidth = 5;
1358
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1359
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1360
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861361
11871362 /*
11881363 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1366,7 @@
11911366 gridPanel.add(cameraView);
11921367 gridPanel.add(XYZPanel);
11931368 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1369
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951370 gridPanel.setContinuousLayout(true);
11961371 gridPanel.setOneTouchExpandable(true);
11971372 gridPanel.setDividerLocation(1.0);
....@@ -1220,10 +1395,11 @@
12201395 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211396 //tmp.setName("Edit");
12221397 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1398
+// JPanel north = new JPanel(new BorderLayout());
1399
+// north.setName("Edit");
1400
+// north.add(ctrlPanel, BorderLayout.NORTH);
1401
+// objectPanel.add(north);
1402
+ objectPanel.add(editPanel);
12271403 objectPanel.add(infoPanel);
12281404
12291405 /*
....@@ -1244,16 +1420,23 @@
12441420 scrollpane.setWheelScrollingEnabled(true);
12451421 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461422
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1423
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1424
+ scenePanel.preferredWidth = 6;
1425
+
1426
+ JTabbedPane tabbedPane = new JTabbedPane();
1427
+ tabbedPane.add(scrollpane);
12491428
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1429
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12511430
1252
- optionsPanel = new JPanel(new GridBagLayout());
1431
+ optionsPanel = new cGridBag().setVertical(true);
12531432
12541433 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1256
-
1434
+
1435
+ AddOptions(optionsPanel); //, aConstraints);
1436
+
1437
+ tabbedPane.add(optionsPanel);
1438
+
1439
+ scenePanel.add(tabbedPane);
12571440
12581441 /*
12591442 cTree jTree = new cTree(null);
....@@ -1275,7 +1458,7 @@
12751458 jtp.add(tree);
12761459 */
12771460
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1461
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791462 bigPanel.setContinuousLayout(true);
12801463 bigPanel.setOneTouchExpandable(true);
12811464 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1470,7 @@
12871470 //bigPanel.setSize(new Dimension(10,10));
12881471 //bigPanel.add(ctrlPanel);
12891472 //bigPanel.add(gridPanel);
1473
+ /**
12901474 bigThree = new JPanel();
12911475 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921476 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1481,26 @@
12971481 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981482 aWindowConstraints.weightx = 0;
12991483 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1484
+ bigThree.add(scenePanel, aWindowConstraints);
13011485 aWindowConstraints.weightx = 1;
13021486 aWindowConstraints.gridwidth = 3;
13031487 // aConstraints.gridheight = 3;
13041488 aWindowConstraints.gridx = 1;
13051489 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1490
+ bigThree.add(centralPanel, aWindowConstraints);
13071491 aWindowConstraints.weightx = 0;
13081492 aWindowConstraints.gridx = 4;
13091493 aWindowConstraints.gridwidth = 1;
13101494 // aConstraints.gridheight = 3;
13111495 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121496 bigThree.add(XYZPanel, aWindowConstraints);
1497
+ /**/
13131498
1499
+ bigThree = new cGridBag();
1500
+ bigThree.addComponent(scenePanel);
1501
+ bigThree.addComponent(centralPanel);
1502
+ bigThree.addComponent(XYZPanel);
1503
+
13141504 // // SIDE EFFECT!!!
13151505 // aConstraints.gridx = 0;
13161506 // aConstraints.gridy = 0;
....@@ -1331,14 +1521,17 @@
13311521 //worldPane.add(bigPanel);
13321522 //worldPane.add(worldPanel);
13331523 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1524
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1525
+ frame.add(/*"Center",*/framePanel);
13351526 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361527
1337
-// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc);
1528
+// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381529
1339
- frame.setSize(1024, 768);
1340
- frame.show();
1530
+ frame.setSize(1280, 860);
1531
+ frame.setVisible(true);
13411532
1533
+ cameraView.requestFocusInWindow();
1534
+
13421535 gridPanel.setDividerLocation(1.0);
13431536
13441537 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1352,6 +1545,10 @@
13521545 });
13531546 }
13541547
1548
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1549
+ {
1550
+ }
1551
+
13551552 JTree GetTree()
13561553 {
13571554 return objEditor.jTree;
....@@ -1363,260 +1560,173 @@
13631560 ctrlPanel.removeAll();
13641561 }
13651562
1366
- void SetupMaterial(JPanel ctrlPanel)
1563
+ void SetupMaterial(cGridBag panel)
13671564 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1565
+ /*
13711566 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721567 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751568 */
13761569
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1570
+ cGridBag editBar = new cGridBag().setVertical(false);
1571
+
1572
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1573
+ createMaterialButton.setToolTipText("Create material");
13821574
13831575 /*
13841576 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881577 */
13891578
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1579
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1580
+ clearMaterialButton.setToolTipText("Clear material");
1581
+
1582
+ if (Globals.ADVANCED)
1583
+ {
1584
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1585
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1586
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1587
+ }
13921588
1393
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1394
-
1395
- aConstraints.gridx += 1;
1396
-
1397
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1398
-
1399
- aConstraints.gridx += 1;
1400
-
1401
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1402
-
1403
- aConstraints.gridx = 0;
1404
- aConstraints.gridy += 1;
1405
- aConstraints.weighty = 0;
1406
- aConstraints.gridwidth = 1;
1589
+ editBar.preferredHeight = 15;
1590
+
1591
+ panel.add(editBar);
1592
+
14071593 /**/
14081594 //aConstraints.weighty = 0;
14091595 ////aConstraints.weightx = 1;
14101596 //aConstraints.weighty = 1;
14111597 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121598 //aConstraints.gridx += 1;
1413
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1414
- aConstraints.weighty = 0;
1415
- aConstraints.gridx = 0;
1416
- aConstraints.gridy += 1;
1417
- aConstraints.gridwidth = 1;
1599
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181600
1419
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1420
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
1423
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1424
- //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1426
- aConstraints.gridx = 0;
1427
- aConstraints.gridy += 1;
1428
- aConstraints.gridwidth = 1;
1601
+ cGridBag colorSection = new cGridBag().setVertical(true);
1602
+
1603
+ cGridBag color = new cGridBag();
1604
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1605
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1607
+ //colorField.preferredWidth = 200;
1608
+ colorSection.add(color);
14291609
1430
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1431
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1432
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1433
- aConstraints.gridx += 1;
1434
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1436
- aConstraints.gridx = 0;
1437
- aConstraints.gridy += 1;
1438
- aConstraints.gridwidth = 1;
1610
+ cGridBag modulation = new cGridBag();
1611
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1612
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1613
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1614
+ colorSection.add(modulation);
14391615
1440
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1441
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1442
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1443
- aConstraints.gridx += 1;
1444
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1446
- aConstraints.gridx = 0;
1447
- aConstraints.gridy += 1;
1448
- aConstraints.gridwidth = 1;
1616
+ cGridBag texture = new cGridBag();
1617
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1618
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1619
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1620
+ colorSection.add(texture);
14491621
1450
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1451
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1452
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1453
- aConstraints.gridx += 1;
1454
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
1622
+ cGridBag anisoU = new cGridBag();
1623
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1624
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1625
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1626
+ colorSection.add(anisoU);
14591627
1460
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1461
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.gridwidth = 1;
1628
+ cGridBag anisoV = new cGridBag();
1629
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1630
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1632
+ colorSection.add(anisoV);
14691633
1470
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1471
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1472
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1473
- aConstraints.gridx += 1;
1474
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1475
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1476
- aConstraints.gridx = 0;
1477
- aConstraints.gridy += 1;
1478
- aConstraints.gridwidth = 1;
1634
+ cGridBag shadowbias = new cGridBag();
1635
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1636
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1637
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1638
+ colorSection.add(shadowbias);
14791639
1480
- //aConstraints.weighty = 1;
1481
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1482
- //aConstraints.gridx += 1;
1483
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1484
- aConstraints.weighty = 0;
1485
- aConstraints.gridx = 0;
1486
- aConstraints.gridy += 1;
1487
- aConstraints.gridwidth = 1;
1640
+ panel.add(new JSeparator());
1641
+
1642
+ panel.add(colorSection);
1643
+
1644
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1645
+
1646
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1647
+
1648
+ cGridBag diffuse = new cGridBag();
1649
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1650
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1652
+ diffuseSection.add(diffuse);
14881653
1489
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1490
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1492
- aConstraints.gridx += 1;
1493
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1494
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1495
- aConstraints.gridx = 0;
1496
- aConstraints.gridy += 1;
1497
- aConstraints.gridwidth = 1;
1654
+ cGridBag diffuseness = new cGridBag();
1655
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1656
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1658
+ diffuseSection.add(diffuseness);
14981659
1499
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1500
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1501
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1502
- aConstraints.gridx += 1;
1503
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1504
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1505
- aConstraints.gridx = 0;
1506
- aConstraints.gridy += 1;
1507
- aConstraints.gridwidth = 1;
1660
+ cGridBag selfshadow = new cGridBag();
1661
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1662
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1663
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1664
+ diffuseSection.add(selfshadow);
15081665
1509
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1510
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1511
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1512
- aConstraints.gridx += 1;
1513
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1514
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1515
- aConstraints.gridx = 0;
1516
- aConstraints.gridy += 1;
1517
- aConstraints.gridwidth = 1;
1666
+ cGridBag sheen = new cGridBag();
1667
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1668
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1669
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1670
+ diffuseSection.add(sheen);
15181671
1519
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1520
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1521
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1522
- aConstraints.gridx += 1;
1523
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1524
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1525
- aConstraints.gridx = 0;
1526
- aConstraints.gridy += 1;
1527
- aConstraints.gridwidth = 1;
1672
+ cGridBag subsurface = new cGridBag();
1673
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1674
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1675
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1676
+ diffuseSection.add(subsurface);
15281677
1529
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1530
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1531
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1532
- aConstraints.gridx += 1;
1533
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1535
- aConstraints.gridx = 0;
1536
- aConstraints.gridy += 1;
1537
- aConstraints.gridwidth = 1;
1678
+ cGridBag shadow = new cGridBag();
1679
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1680
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1681
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1682
+ diffuseSection.add(shadow);
15381683
1539
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1540
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1541
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1542
- aConstraints.gridx += 1;
1543
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1544
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1545
- aConstraints.gridx = 0;
1546
- aConstraints.gridy += 1;
1547
- aConstraints.gridwidth = 1;
1684
+ cGridBag fakedepth = new cGridBag();
1685
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1686
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1687
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1688
+ diffuseSection.add(fakedepth);
15481689
1549
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1550
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1551
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1552
- aConstraints.gridx += 1;
1553
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1554
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1555
- aConstraints.gridx = 0;
1556
- aConstraints.gridy += 1;
1557
- aConstraints.gridwidth = 1;
1690
+ panel.add(new JSeparator());
1691
+
1692
+ panel.add(diffuseSection);
1693
+
1694
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1695
+
1696
+ cGridBag specularSection = new cGridBag().setVertical(true);
15581697
1559
- //aConstraints.weighty = 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1561
- //aConstraints.gridx += 1;
1562
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1563
- aConstraints.weighty = 0;
1564
- aConstraints.gridx = 0;
1565
- aConstraints.gridy += 1;
1566
- aConstraints.gridwidth = 1;
1698
+ cGridBag specular = new cGridBag();
1699
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1700
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1701
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1702
+ specularSection.add(specular);
15671703
1568
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1569
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1570
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1571
- aConstraints.gridx += 1;
1572
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1573
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1574
- aConstraints.gridx = 0;
1575
- aConstraints.gridy += 1;
1576
- aConstraints.gridwidth = 1;
1704
+ cGridBag lightarea = new cGridBag();
1705
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1706
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1707
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1708
+ specularSection.add(lightarea);
15771709
1578
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1579
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1580
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1581
- aConstraints.gridx += 1;
1582
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1583
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1584
- aConstraints.gridx = 0;
1585
- aConstraints.gridy += 1;
1586
- aConstraints.gridwidth = 1;
1710
+ cGridBag shininess = new cGridBag();
1711
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1712
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1713
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1714
+ specularSection.add(shininess);
15871715
1588
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1589
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1591
- aConstraints.gridx += 1;
1592
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1593
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1594
- aConstraints.gridx = 0;
1595
- aConstraints.gridy += 1;
1596
- aConstraints.gridwidth = 1;
1716
+ cGridBag metalness = new cGridBag();
1717
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1718
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1719
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1720
+ specularSection.add(metalness);
15971721
1598
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1599
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1600
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1601
- aConstraints.gridx += 1;
1602
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1604
- aConstraints.gridx = 0;
1605
- aConstraints.gridy += 1;
1606
- aConstraints.gridwidth = 1;
1722
+ cGridBag velvet = new cGridBag();
1723
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1724
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1725
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1726
+ specularSection.add(velvet);
16071727
1608
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1609
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1611
- aConstraints.gridx += 1;
1612
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1613
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1614
- aConstraints.gridx = 0;
1615
- aConstraints.gridy += 1;
1616
- aConstraints.gridwidth = 1;
1617
-
1618
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1619
- Return();
1728
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1729
+ //Return();
16201730 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211731 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221732 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1737,93 @@
16271737 // aConstraints.gridy += 1;
16281738 // aConstraints.gridwidth = 1;
16291739
1630
- //aConstraints.weighty = 1;
1631
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1632
- //aConstraints.gridx += 1;
1633
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1634
- aConstraints.weighty = 0;
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
16381740
1639
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1640
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1741
+ panel.add(new JSeparator());
1742
+
1743
+ panel.add(specularSection);
1744
+
1745
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1746
+
1747
+ cGridBag globalSection = new cGridBag().setVertical(true);
16481748
1649
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1650
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
1749
+ cGridBag camera = new cGridBag();
1750
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1751
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1752
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1753
+ globalSection.add(camera);
16581754
1659
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1660
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1661
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1662
- aConstraints.gridx += 1;
1663
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1664
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1665
- aConstraints.gridx = 0;
1666
- aConstraints.gridy += 1;
1667
- aConstraints.gridwidth = 1;
1755
+ cGridBag ambient = new cGridBag();
1756
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1757
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1758
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1759
+ globalSection.add(ambient);
16681760
1669
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1670
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1671
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1672
- aConstraints.gridx += 1;
1673
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1675
- aConstraints.gridx = 0;
1676
- aConstraints.gridy += 1;
1677
- aConstraints.gridwidth = 1;
1678
- aConstraints.weighty = 0;
1761
+ cGridBag backlit = new cGridBag();
1762
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1763
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1764
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1765
+ globalSection.add(backlit);
16791766
1680
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1681
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- aConstraints.gridwidth = 1;
1767
+ cGridBag opacity = new cGridBag();
1768
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1769
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1771
+ globalSection.add(opacity);
16891772
1690
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1691
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
1773
+ panel.add(new JSeparator());
1774
+
1775
+ panel.add(globalSection);
1776
+
1777
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1778
+
1779
+ cGridBag textureSection = new cGridBag().setVertical(true);
16991780
1700
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1701
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- aConstraints.gridwidth = 1;
1781
+ cGridBag bump = new cGridBag();
1782
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1783
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1784
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1785
+ textureSection.add(bump);
17091786
1710
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1711
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
1787
+ cGridBag noise = new cGridBag();
1788
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1789
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1790
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1791
+ textureSection.add(noise);
17191792
1720
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1721
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1723
- aConstraints.gridx += 1;
1724
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1725
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1726
- aConstraints.gridx = 0;
1727
- aConstraints.gridy += 1;
1728
- aConstraints.gridwidth = 1;
1793
+ cGridBag power = new cGridBag();
1794
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1795
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1796
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1797
+ textureSection.add(power);
17291798
1730
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1731
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1733
- aConstraints.gridx += 1;
1734
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1735
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1736
- aConstraints.gridx = 0;
1737
- aConstraints.gridy += 1;
1738
- aConstraints.gridwidth = 1;
1799
+ cGridBag borderfade = new cGridBag();
1800
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1801
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1802
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1803
+ textureSection.add(borderfade);
17391804
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1805
+ cGridBag fog = new cGridBag();
1806
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1807
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1808
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1809
+ textureSection.add(fog);
17451810
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1811
+ cGridBag opacityPower = new cGridBag();
1812
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1813
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1814
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1815
+ textureSection.add(opacityPower);
1816
+
1817
+ panel.add(new JSeparator());
1818
+
1819
+ panel.add(textureSection);
1820
+
1821
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491822
17501823 SetMaterial(copy); // .GetMaterial());
17511824
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1825
+ //colorField.addChangeListener(this);
1826
+// modulationField.addChangeListener(this);
17541827 metalnessField.addChangeListener(this);
17551828 diffuseField.addChangeListener(this);
17561829 specularField.addChangeListener(this);
....@@ -1780,12 +1853,15 @@
17801853 opacityPowerField.addChangeListener(this);
17811854 /**/
17821855
1783
- resetSlidersButton.addActionListener(this);
17841856 clearMaterialButton.addActionListener(this);
17851857 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
1858
+
1859
+ if (Globals.ADVANCED)
1860
+ {
1861
+ resetSlidersButton.addActionListener(this);
1862
+ propagateToggle.addItemListener(this);
1863
+ multiplyToggle.addItemListener(this);
1864
+ }
17891865 }
17901866
17911867 void DropFile(java.io.File[] files, boolean textures)
....@@ -1859,19 +1935,21 @@
18591935 }
18601936
18611937 // Images/textures
1862
- if (textures
1863
- && (filename.toLowerCase().endsWith(".jpg")
1864
- || filename.toLowerCase().endsWith(".jpeg")
1865
- || filename.toLowerCase().endsWith(".gif")
1866
- || filename.toLowerCase().endsWith(".png")
1867
- || filename.toLowerCase().endsWith(".tre")
1868
- || filename.toLowerCase().endsWith(".bmp")
1869
- || filename.toLowerCase().endsWith(".tga")
1870
- || filename.toLowerCase().endsWith(".sgi")
1871
- || filename.toLowerCase().endsWith(".tif")
1872
- || filename.toLowerCase().endsWith(".tiff")))
1938
+ if (filename.toLowerCase().endsWith(".jpg")
1939
+ || filename.toLowerCase().endsWith(".jpeg")
1940
+ || filename.toLowerCase().endsWith(".gif")
1941
+ || filename.toLowerCase().endsWith(".png")
1942
+ || filename.toLowerCase().endsWith(".tre")
1943
+ || filename.toLowerCase().endsWith(".bmp")
1944
+ || filename.toLowerCase().endsWith(".tga")
1945
+ || filename.toLowerCase().endsWith(".sgi")
1946
+ || filename.toLowerCase().endsWith(".tif")
1947
+ || filename.toLowerCase().endsWith(".tiff"))
18731948 {
1874
- DropTexture(filename);
1949
+ if (textures)
1950
+ DropTexture(filename);
1951
+ else
1952
+ CreateBillboard(filename);
18751953 continue;
18761954 }
18771955
....@@ -1880,6 +1958,60 @@
18801958 }
18811959
18821960 ResetModel();
1961
+ }
1962
+
1963
+ void CreateBillboard(String filename)
1964
+ {
1965
+ Object3D source = null;
1966
+ Object3D group = copy;
1967
+
1968
+ if (group.selection.size() > 0)
1969
+ {
1970
+ source = group.selection.get(0);
1971
+ }
1972
+
1973
+ Grid grid = new Grid(1,1);
1974
+ grid.material = null;
1975
+
1976
+ grid.toParent = LA.newMatrix();
1977
+ grid.fromParent = LA.newMatrix();
1978
+ LA.matYRotate(grid.toParent, Math.PI/2);
1979
+ LA.matXRotate(grid.toParent, -Math.PI/2);
1980
+ LA.matXRotate(grid.fromParent, Math.PI/2);
1981
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
1982
+
1983
+ BillboardNode bb = new BillboardNode();
1984
+ bb.addChild(grid);
1985
+
1986
+ Object3D newgroup = new Object3D();
1987
+ newgroup.CreateMaterial();
1988
+
1989
+ File file = new File(filename);
1990
+ newgroup.name = file.getName();
1991
+ newgroup.addChild(bb);
1992
+
1993
+ Object3D main = newgroup;
1994
+
1995
+ main.SetPigmentTexture(filename);
1996
+
1997
+ if (source != null)
1998
+ {
1999
+ main.material = new cMaterial(source.material);
2000
+ if (main.projectedVertices.length < source.projectedVertices.length)
2001
+ {
2002
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
2003
+ }
2004
+
2005
+ for (int i=0; i<source.projectedVertices.length; i++)
2006
+ {
2007
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
2008
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
2009
+ }
2010
+
2011
+ main.texres = source.texres;
2012
+ }
2013
+
2014
+ makeSomething(newgroup, false);
18832015 }
18842016
18852017 Point location;
....@@ -1900,7 +2032,7 @@
19002032
19012033 //? flashIt = false;
19022034 CameraPane pane = (CameraPane) cameraView;
1903
- pane.clickStart(location.x, location.y, 0);
2035
+ pane.clickStart(location.x, location.y, 0, 0);
19042036 pane.clickEnd(location.x, location.y, 0, true);
19052037
19062038 if (group.selection.size() == 1)
....@@ -1949,6 +2081,7 @@
19492081 e2.printStackTrace();
19502082 }
19512083 }
2084
+
19522085 LoadJMEThread loadThread;
19532086
19542087 class LoadJMEThread extends Thread
....@@ -2006,6 +2139,7 @@
20062139 //LoadFile0(filename, converter);
20072140 }
20082141 }
2142
+
20092143 LoadOBJThread loadObjThread;
20102144
20112145 class LoadOBJThread extends Thread
....@@ -2084,19 +2218,19 @@
20842218
20852219 void LoadObjFile(String fullname)
20862220 {
2087
- /*
2221
+ System.out.println("Loading " + fullname);
2222
+ /**/
20882223 //lastFilename = fullname;
20892224 if(loadObjThread == null)
20902225 {
2091
- loadObjThread = new LoadOBJThread();
2092
- loadObjThread.start();
2226
+ loadObjThread = new LoadOBJThread();
2227
+ loadObjThread.start();
20932228 }
20942229
20952230 loadObjThread.add(fullname);
2096
- */
2231
+ /**/
20972232
2098
- System.out.println("Loading " + fullname);
2099
- makeSomething(new FileObject(fullname, true), true);
2233
+ //makeSomething(new FileObject(fullname, true), true);
21002234 }
21012235
21022236 void LoadGFDFile(String fullname)
....@@ -2138,6 +2272,8 @@
21382272 {
21392273 Mocap sel = (Mocap) copy.selection.get(0);
21402274
2275
+ sel.SetCurrentBones(sel.frame);
2276
+
21412277 sel.fullname = fullname;
21422278
21432279 if (changename)
....@@ -2151,14 +2287,18 @@
21512287 sel.smoothed = false;
21522288
21532289 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2290
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2291
+ sel.SetGlobalTransform();
2292
+ sel.LoadData();
2293
+ sel.Rewind();
2294
+ sel.Fade();
21552295 // sel.setPose(0);
21562296 refreshContents();
21572297 } else
21582298 {
21592299 mocap.Reset();
21602300 // new skeleton
2161
- makeSomething(mocap, false); // true);
2301
+ makeSomething(mocap, true); // true);
21622302 }
21632303 } catch (Exception e)
21642304 {
....@@ -2185,6 +2325,8 @@
21852325 {
21862326 Mocap sel = (Mocap) select;
21872327
2328
+ sel.SetCurrentBones(sel.frame);
2329
+
21882330 File file = new File(fullname);
21892331
21902332 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2393,11 @@
22512393
22522394 if (!changename)
22532395 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2396
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2397
+ sel.SetGlobalTransform();
2398
+ sel.LoadData();
2399
+ sel.Rewind();
2400
+ sel.Fade();
22552401 }
22562402
22572403 // sel.setPose(0);
....@@ -2345,11 +2491,11 @@
23452491
23462492 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472493 {
2348
- if (GraphreeD.standAlone)
2494
+ if (Grafreed.standAlone)
23492495 {
23502496 /**/
23512497 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2352
- browser.show();
2498
+ browser.setVisible(true);
23532499 String filename = browser.getFile();
23542500 if (filename != null && filename.length() > 0)
23552501 {
....@@ -2494,6 +2640,7 @@
24942640 }
24952641 if (input == null)
24962642 {
2643
+ new Exception().printStackTrace();
24972644 System.exit(0);
24982645 }
24992646
....@@ -2708,7 +2855,8 @@
27082855 return;
27092856 }
27102857
2711
- multiplyToggle.setSelected(mat.multiply);
2858
+ if (multiplyToggle != null)
2859
+ multiplyToggle.setSelected(mat.multiply);
27122860
27132861 assert (object.projectedVertices != null);
27142862
....@@ -2890,25 +3038,42 @@
28903038 // june 2013 copy.HardTouch();
28913039 cameraView.repaint();
28923040 return;
2893
- } else if (event.getSource() == toggleFullItem)
3041
+ } else if (event.getSource() == toggleTimelineItem)
28943042 {
2895
- if (CameraPane.FULLSCREEN)
3043
+ timeline ^= true;
3044
+
3045
+ if (timeline)
28963046 {
2897
- frame.getContentPane().remove(/*"Center",*/bigThree);
2898
- framePanel.add(bigThree);
2899
- frame.getContentPane().add(/*"Center",*/framePanel);
2900
- } else
2901
- {
2902
- frame.getContentPane().remove(/*"Center",*/framePanel);
2903
- frame.getContentPane().add(/*"Center",*/bigThree);
3047
+ centralPanel.remove(cameraView);
3048
+ cameraPanel.add(cameraView);
3049
+ centralPanel.add(cameraPanel);
3050
+ frame.setJMenuBar(timelineMenubar);
3051
+ wasFullScreen = CameraPane.FULLSCREEN;
3052
+ if (!CameraPane.FULLSCREEN)
3053
+ ToggleFullScreen();
3054
+ toggleFullScreenItem.setEnabled(false);
29043055 }
3056
+ else
3057
+ {
3058
+ centralPanel.remove(cameraPanel);
3059
+ centralPanel.add(cameraView);
3060
+ frame.setJMenuBar(null);
3061
+ if (!wasFullScreen)
3062
+ ToggleFullScreen();
3063
+ toggleFullScreenItem.setEnabled(true);
3064
+ }
3065
+
29053066 frame.validate();
2906
- cameraView.ToggleFullScreen();
3067
+ return;
3068
+ } else if (event.getSource() == toggleFullScreenItem)
3069
+ {
3070
+ ToggleFullScreen();
3071
+ frame.validate();
29073072
29083073 return;
2909
- } else if (event.getSource() == toggleRandomItem)
3074
+ } else if (event.getSource() == toggleSwitchItem)
29103075 {
2911
- cameraView.ToggleRandom();
3076
+ cameraView.ToggleSwitch();
29123077 cameraView.repaint();
29133078 return;
29143079 } else if (event.getSource() == toggleHandleItem)
....@@ -2937,6 +3102,10 @@
29373102 {
29383103 copy.live ^= true;
29393104 return;
3105
+ } else if (event.getSource() == selectCB)
3106
+ {
3107
+ copy.dontselect ^= true;
3108
+ return;
29403109 } else if (event.getSource() == hideCB)
29413110 {
29423111 copy.hide ^= true;
....@@ -2951,6 +3120,7 @@
29513120 if (event.getSource() == randomCB)
29523121 {
29533122 copy.random ^= true;
3123
+ objEditor.refreshContents();
29543124 return;
29553125 }
29563126 if (event.getSource() == speedupCB)
....@@ -2974,8 +3144,9 @@
29743144
29753145 public void actionPerformed(ActionEvent event)
29763146 {
3147
+ Object source = event.getSource();
29773148 // SCRIPT DIALOG
2978
- if (event.getSource() == okbutton)
3149
+ if (source == okbutton)
29793150 {
29803151 textpanel.setVisible(false);
29813152 textpanel.remove(textarea);
....@@ -2987,7 +3158,7 @@
29873158 textarea = null;
29883159 textpanel = null;
29893160 }
2990
- if (event.getSource() == cancelbutton)
3161
+ if (source == cancelbutton)
29913162 {
29923163 textpanel.setVisible(false);
29933164 textpanel.remove(textarea);
....@@ -2999,49 +3170,50 @@
29993170 //applySelf();
30003171 //client.refreshEditWindow();
30013172 //refreshContents();
3002
- if (event.getSource() == nameField)
3173
+ if (source == nameField)
30033174 {
30043175 //System.out.println("ObjEditor " + event);
30053176 applySelf0(true);
30063177 //parent.applySelf();
30073178 objEditor.refreshContents();
3008
- } else if (event.getSource() == resetButton)
3179
+ } else if (source == resetButton)
30093180 {
30103181 CameraPane.fullreset = true;
30113182 copy.Reset(); // ResetMeshes();
30123183 copy.Touch();
30133184 objEditor.refreshContents();
3014
- } else if (event.getSource() == stepItem)
3185
+ } else if (source == stepItem)
30153186 {
3016
- cameraView.ONESTEP = true;
3187
+ //cameraView.ONESTEP = true;
3188
+ Globals.ONESTEP = true;
30173189 cameraView.repaint();
30183190 return;
3019
- } else if (event.getSource() == stepButton)
3191
+ } else if (source == stepButton)
30203192 {
30213193 copy.Step();
30223194 copy.Touch();
30233195 objEditor.refreshContents();
3024
- } else if (event.getSource() == slowerButton)
3196
+ } else if (source == slowerButton)
30253197 {
30263198 copy.Slower();
30273199 copy.Touch();
30283200 objEditor.refreshContents();
3029
- } else if (event.getSource() == fasterButton)
3201
+ } else if (source == fasterButton)
30303202 {
30313203 copy.Faster();
30323204 copy.Touch();
30333205 objEditor.refreshContents();
3034
- } else if (event.getSource() == remarkButton)
3206
+ } else if (source == remarkButton)
30353207 {
30363208 copy.Remark();
30373209 copy.Touch();
30383210 objEditor.refreshContents();
3039
- } else if (event.getSource() == stepAllButton)
3211
+ } else if (source == stepAllButton)
30403212 {
30413213 copy.StepAll();
30423214 copy.Touch();
30433215 objEditor.refreshContents();
3044
- } else if (event.getSource() == resetAllButton)
3216
+ } else if (source == resetAllButton)
30453217 {
30463218 //CameraPane.fullreset = true;
30473219 copy.ResetAll(); // ResetMeshes();
....@@ -3074,53 +3246,75 @@
30743246 // Close();
30753247 // }
30763248 // else
3077
- if (event.getSource() == resetSlidersButton)
3249
+ if (source == resetSlidersButton)
30783250 {
30793251 ResetSliders();
3080
- } else if (event.getSource() == clearMaterialButton)
3252
+ } else if (source == clearMaterialButton)
30813253 {
30823254 ClearMaterial();
3083
- } else if (event.getSource() == createMaterialButton)
3255
+ } else if (source == createMaterialButton)
30843256 {
30853257 CreateMaterial();
3086
- } else if (event.getSource() == clearPanelButton)
3258
+ } else if (source == clearPanelButton)
30873259 {
30883260 copy.ClearUI();
30893261 refreshContents(true);
3090
- } /*
3091
- }
3092
-
3093
- public boolean action(Event event, Object arg)
3094
- {
3095
- */ else if (event.getSource() == closeItem)
3262
+ } else if (source == importGFDItem)
3263
+ {
3264
+ ImportGFD();
3265
+ } else
3266
+ if (source == importVRMLX3DItem)
3267
+ {
3268
+ ImportVRMLX3D();
3269
+ } else
3270
+ if (source == import3DSItem)
3271
+ {
3272
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3273
+ } else
3274
+ if (source == importOBJItem)
3275
+ {
3276
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3277
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3278
+ browser.setVisible(true);
3279
+ String filename = browser.getFile();
3280
+ if (filename != null && filename.length() > 0)
3281
+ {
3282
+ String fullname = browser.getDirectory() + filename;
3283
+ makeSomething(ReadOBJ(fullname), true);
3284
+ }
3285
+ } else
3286
+ if (source == closeItem)
30963287 {
30973288 Close();
30983289 //return true;
3099
- } else if (event.getSource() == loadItem)
3290
+ } else if (source == loadItem)
31003291 {
31013292 load();
31023293 //return true;
3103
- } else if (event.getSource() == saveItem)
3294
+ } else if (source == newItem)
3295
+ {
3296
+ New();
3297
+ } else if (source == saveItem)
31043298 {
31053299 save();
31063300 //return true;
3107
- } else if (event.getSource() == saveAsItem)
3301
+ } else if (source == saveAsItem)
31083302 {
31093303 saveAs();
31103304 //return true;
3111
- } else if (event.getSource() == reexportItem)
3305
+ } else if (source == reexportItem)
31123306 {
31133307 reexport();
31143308 //return true;
3115
- } else if (event.getSource() == exportAsItem)
3309
+ } else if (source == exportAsItem)
31163310 {
31173311 export();
31183312 //return true;
3119
- } else if (event.getSource() == povItem)
3313
+ } else if (source == povItem)
31203314 {
31213315 generatePOV();
31223316 //return true;
3123
- } else if (event.getSource() == zBufferItem)
3317
+ } else if (source == zBufferItem)
31243318 {
31253319 try
31263320 {
....@@ -3142,21 +3336,8 @@
31423336 cameraView.repaint();
31433337 //return true;
31443338 }
3145
- */ else if (event.getSource() == editCameraItem)
3146
- {
3147
- cameraView.ProtectCamera();
3148
- cameraView.repaint();
3149
- return;
3150
- } else if (event.getSource() == revertCameraItem)
3151
- {
3152
- cameraView.RevertCamera();
3153
- cameraView.repaint();
3154
- return;
3155
- } else if (event.getSource() == textureButton)
3156
- {
3157
- return; // true;
3158
- } else // combos...
3159
- if (event.getSource() == texresMenu)
3339
+ */ else // combos...
3340
+ if (source == texresMenu)
31603341 {
31613342 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31623343 copy.texres = texresMenu.getSelectedIndex();
....@@ -3168,27 +3349,287 @@
31683349 }
31693350 }
31703351
3171
- void ToggleAnimation()
3352
+ void New()
31723353 {
3173
- if (!CameraPane.ANIMATION)
3354
+ while (copy.Size() > 1)
31743355 {
3175
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3356
+ copy.remove(1);
3357
+ }
3358
+
3359
+ ResetModel();
3360
+ objEditor.refreshContents();
3361
+ }
3362
+
3363
+ static public byte[] Compress(Object3D o)
3364
+ {
3365
+ try
3366
+ {
3367
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3369
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3370
+
3371
+ Object3D parent = o.parent;
3372
+ o.parent = null;
3373
+
3374
+ out.writeObject(o);
3375
+
3376
+ o.parent = parent;
3377
+
3378
+ out.flush();
3379
+
3380
+ zstream.close();
3381
+ out.close();
3382
+
3383
+ return baos.toByteArray();
3384
+ } catch (Exception e)
3385
+ {
3386
+ System.err.println(e);
3387
+ return null;
3388
+ }
3389
+ }
3390
+
3391
+ static public Object Uncompress(byte[] bytes)
3392
+ {
3393
+ System.out.println("#bytes = " + bytes.length);
3394
+ try
3395
+ {
3396
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3397
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3398
+ ObjectInputStream in = new ObjectInputStream(istream);
3399
+ Object obj = in.readObject();
3400
+ in.close();
3401
+
3402
+ return obj;
3403
+ } catch (Exception e)
3404
+ {
3405
+ System.err.println(e);
3406
+ return null;
3407
+ }
3408
+ }
3409
+
3410
+ static public Object clone(Object o)
3411
+ {
3412
+ try
3413
+ {
3414
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3415
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3416
+
3417
+ out.writeObject(o);
3418
+
3419
+ out.flush();
3420
+ out.close();
3421
+
3422
+ byte[] bytes = baos.toByteArray();
3423
+
3424
+ System.out.println("clone = " + bytes.length);
3425
+
3426
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3427
+ ObjectInputStream in = new ObjectInputStream(bais);
3428
+ Object obj = in.readObject();
3429
+ in.close();
3430
+
3431
+ return obj;
3432
+ } catch (Exception e)
3433
+ {
3434
+ System.err.println(e);
3435
+ return null;
3436
+ }
3437
+ }
3438
+
3439
+ cRadio GetCurrentTab()
3440
+ {
3441
+ cRadio ab;
3442
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3443
+ {
3444
+ ab = (cRadio)e.nextElement();
3445
+ if(ab.GetObject() == copy)
3446
+ {
3447
+ return ab;
3448
+ }
3449
+ }
3450
+
3451
+ return null;
3452
+ }
3453
+
3454
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3455
+
3456
+ public void Save()
3457
+ {
3458
+ System.err.println("Save");
3459
+
3460
+ cRadio tab = GetCurrentTab();
3461
+
3462
+ boolean temp = CameraPane.SWITCH;
3463
+ CameraPane.SWITCH = false;
3464
+
3465
+ copy.ExtractBigData(hashtable);
3466
+
3467
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3468
+ tab.graphs[tab.undoindex++] = Compress(copy);
3469
+
3470
+ copy.RestoreBigData(hashtable);
3471
+
3472
+ CameraPane.SWITCH = temp;
3473
+
3474
+ //assert(hashtable.isEmpty());
3475
+
3476
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3477
+ {
3478
+ tab.graphs[i] = null;
3479
+ }
3480
+
3481
+ // test save
3482
+ if (false)
3483
+ {
3484
+ try
3485
+ {
3486
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3487
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3488
+
3489
+ p.writeObject(copy);
3490
+
3491
+ p.flush();
3492
+
3493
+ ostream.close();
3494
+ } catch (Exception e)
3495
+ {
3496
+ e.printStackTrace();
3497
+ }
3498
+ }
3499
+ }
3500
+
3501
+ void CopyChanged(Object3D obj)
3502
+ {
3503
+ boolean temp = CameraPane.SWITCH;
3504
+ CameraPane.SWITCH = false;
3505
+
3506
+ copy.ExtractBigData(hashtable);
3507
+
3508
+ copy.clear();
3509
+
3510
+ for (int i=0; i<obj.Size(); i++)
3511
+ {
3512
+ copy.add(obj.get(i));
3513
+ }
3514
+
3515
+ copy.RestoreBigData(hashtable);
3516
+
3517
+ CameraPane.SWITCH = temp;
3518
+
3519
+ //assert(hashtable.isEmpty());
3520
+
3521
+ copy.Touch();
3522
+
3523
+ ResetModel();
3524
+ copy.HardTouch(); // recompile?
3525
+
3526
+ cRadio ab;
3527
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3528
+ {
3529
+ ab = (cRadio)e.nextElement();
3530
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3531
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3532
+ if (test != null)
3533
+ {
3534
+ test.editWindow = ab.object.editWindow;
3535
+ ab.object = test;
3536
+ }
3537
+ }
3538
+
3539
+ refreshContents();
3540
+ }
3541
+
3542
+ public void Undo()
3543
+ {
3544
+ System.err.println("Undo");
3545
+
3546
+ cRadio tab = GetCurrentTab();
3547
+
3548
+ if (tab.undoindex == 0)
3549
+ {
3550
+ java.awt.Toolkit.getDefaultToolkit().beep();
3551
+ return;
3552
+ }
3553
+
3554
+ if (tab.graphs[tab.undoindex] == null)
3555
+ {
3556
+ Save();
3557
+ tab.undoindex -= 1;
3558
+ }
3559
+
3560
+ tab.undoindex -= 1;
3561
+
3562
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3563
+ }
3564
+
3565
+ public void Redo()
3566
+ {
3567
+ cRadio tab = GetCurrentTab();
3568
+
3569
+ if (tab.graphs[tab.undoindex + 1] == null)
3570
+ {
3571
+ java.awt.Toolkit.getDefaultToolkit().beep();
3572
+ return;
3573
+ }
3574
+
3575
+ tab.undoindex += 1;
3576
+
3577
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3578
+ }
3579
+
3580
+ void ImportGFD()
3581
+ {
3582
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
31763583 browser.show();
31773584 String filename = browser.getFile();
31783585 if (filename != null && filename.length() > 0)
31793586 {
3180
- CameraPane.filename = browser.getDirectory() + filename;
3587
+ String fullname = browser.getDirectory() + filename;
3588
+
3589
+ //Object3D readobj =
3590
+ objEditor.ReadGFD(fullname, objEditor);
3591
+ //makeSomething(readobj);
3592
+ }
3593
+ }
3594
+
3595
+ void ImportVRMLX3D()
3596
+ {
3597
+ if (Grafreed.standAlone)
3598
+ {
3599
+ /**/
3600
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3601
+ browser.show();
3602
+ String filename = browser.getFile();
3603
+ if (filename != null && filename.length() > 0)
3604
+ {
3605
+ String fullname = browser.getDirectory() + filename;
3606
+ LoadVRMLX3D(fullname);
3607
+ }
3608
+ /**/
3609
+ }
3610
+ }
3611
+
3612
+ void ToggleAnimation()
3613
+ {
3614
+ if (!Globals.ANIMATION)
3615
+ {
3616
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3617
+ browser.setVisible(true);
3618
+ String filename = browser.getFile();
3619
+ if (filename != null && filename.length() > 0)
3620
+ {
3621
+ Globals.filename = browser.getDirectory() + filename;
31813622 //CameraPane.framecount = 0;
3182
- CameraPane.imagecount = 0;
3623
+ Globals.imagecount = 0;
31833624
3184
- CameraPane.ANIMATION ^= true;
3625
+ Globals.ANIMATION ^= true;
31853626
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
3627
+ Grafreed.wav.cursor = 0;
3628
+ Grafreed.wav.loop = 0;
31883629 }
31893630 } else
31903631 {
3191
- CameraPane.ANIMATION ^= true;
3632
+ Globals.ANIMATION ^= true;
31923633 }
31933634 }
31943635
....@@ -3234,7 +3675,7 @@
32343675 void CreateMaterial()
32353676 {
32363677 //copy.ClearMaterial(); // PATCH
3237
- copy.CreateMaterialS(multiplyToggle.isSelected());
3678
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32383679 if (copy.selection.size() > 0)
32393680 //SetMaterial(copy);
32403681 {
....@@ -3293,11 +3734,11 @@
32933734 {
32943735 copy.ResetBlockLoop(); // temporary problem
32953736
3296
- boolean random = CameraPane.RANDOM;
3297
- CameraPane.RANDOM = false; // parse everything
3737
+ boolean random = CameraPane.SWITCH;
3738
+ CameraPane.SWITCH = false; // parse everything
32983739 copy.ResetDisplayList();
32993740 copy.HardTouch();
3300
- CameraPane.RANDOM = random;
3741
+ CameraPane.SWITCH = random;
33013742 }
33023743
33033744 // public void applySelf()
....@@ -3367,10 +3808,40 @@
33673808 current.fakedepth = (float) fakedepthField.getFloat();
33683809 current.shadowbias = (float) shadowbiasField.getFloat();
33693810
3370
- if (!NumberSlider.frozen)
3811
+ if (!cNumberSlider.frozen)
33713812 {
33723813 //System.out.println("Propagate = " + propagate);
33733814 copy.UpdateMaterial(anchor, current, propagate);
3815
+
3816
+ if (copy.material != null)
3817
+ {
3818
+ cMaterial mat = copy.material;
3819
+
3820
+ colorField.SetToolTipValue((mat.color));
3821
+ modulationField.SetToolTipValue((mat.modulation));
3822
+ metalnessField.SetToolTipValue((mat.metalness));
3823
+ diffuseField.SetToolTipValue((mat.diffuse));
3824
+ specularField.SetToolTipValue((mat.specular));
3825
+ shininessField.SetToolTipValue((mat.shininess));
3826
+ shiftField.SetToolTipValue((mat.shift));
3827
+ ambientField.SetToolTipValue((mat.ambient));
3828
+ lightareaField.SetToolTipValue((mat.lightarea));
3829
+ diffusenessField.SetToolTipValue((mat.factor));
3830
+ velvetField.SetToolTipValue((mat.velvet));
3831
+ sheenField.SetToolTipValue((mat.sheen));
3832
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3833
+ backlitField.SetToolTipValue((mat.bump));
3834
+ anisoField.SetToolTipValue((mat.aniso));
3835
+ anisoVField.SetToolTipValue((mat.anisoV));
3836
+ cameraField.SetToolTipValue((mat.cameralight));
3837
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3838
+ shadowField.SetToolTipValue((mat.shadow));
3839
+ textureField.SetToolTipValue((mat.texture));
3840
+ opacityField.SetToolTipValue((mat.opacity));
3841
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3842
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3843
+ }
3844
+
33743845 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33753846 {
33763847 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3415,6 +3886,7 @@
34153886 || e.getSource() == apertureField
34163887 || e.getSource() == shadowblurField)
34173888 {
3889
+ new Exception().printStackTrace();
34183890 System.exit(0);
34193891 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34203892 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3441,7 +3913,13 @@
34413913 //System.out.println("PARENT = " + parent);
34423914 //if (parent != null)
34433915 // parent.applySelf();
3444
- refreshContents();
3916
+ if (e.getSource() == normalpushField)
3917
+ {
3918
+ objEditor.refreshContents();
3919
+ //Refresh();
3920
+ }
3921
+ else
3922
+ refreshContents();
34453923 // ??? client.refreshEditWindow();
34463924 }
34473925 //else
....@@ -3453,7 +3931,7 @@
34533931 //group.name = nameField.getText();
34543932 //objEditor.applySelf();
34553933
3456
- assert (objEditor == this);
3934
+ // OCT2018: assert (objEditor == this);
34573935 if (copy.selection == null || copy.selection.size() == 0)
34583936 //super.applySelf()
34593937 ; else
....@@ -3477,12 +3955,18 @@
34773955 objEditor.copy = keep;
34783956 }
34793957 }
3958
+
3959
+ if (normalpushField != null)
3960
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34803961 }
34813962
34823963 void SnapObject()
34833964 {
3484
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3485
- SnapObject(obj);
3965
+ if (copy.selection.size() > 0)
3966
+ {
3967
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3968
+ SnapObject(obj);
3969
+ }
34863970 }
34873971
34883972 void SnapObject(Object3D obj)
....@@ -3596,7 +4080,7 @@
35964080
35974081 if (obj.parent != null)
35984082 {
3599
- obj.parent.TransformToWorld(interest);
4083
+// obj.parent.TransformToWorld(interest);
36004084 }
36014085
36024086 if (!CameraPane.TRACK)
....@@ -3728,7 +4212,7 @@
37284212
37294213 radioPanel.revalidate();
37304214 radioPanel.repaint();
3731
- ctrlPanel.revalidate(); // ? new
4215
+ ctrlPanel.validate(); // ? new
37324216 ctrlPanel.repaint();
37334217 }
37344218 }
....@@ -3737,6 +4221,8 @@
37374221
37384222 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37394223 {
4224
+ if (Globals.SAVEONMAKE)
4225
+ Save();
37404226 //Tween.set(thing, 0).target(1).start(tweenManager);
37414227 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37424228 // if (thing instanceof GenericJointDemo)
....@@ -3940,6 +4426,7 @@
39404426 }
39414427 }
39424428 }
4429
+
39434430 LoadGFDThread loadGFDThread;
39444431
39454432 void ReadGFD(String fullname, iCallBack cb)
....@@ -3959,8 +4446,10 @@
39594446
39604447 try
39614448 {
4449
+ // Try compressed version first.
39624450 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3963
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4451
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4452
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39644453
39654454 readobj = (Object3D) p.readObject();
39664455 istream.close();
....@@ -3968,7 +4457,20 @@
39684457 readobj.ResetDisplayList();
39694458 } catch (Exception e)
39704459 {
3971
- e.printStackTrace();
4460
+ //e.printStackTrace();
4461
+ try
4462
+ {
4463
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4464
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4465
+
4466
+ readobj = (Object3D) p.readObject();
4467
+ istream.close();
4468
+
4469
+ readobj.ResetDisplayList();
4470
+ } catch (Exception e2)
4471
+ {
4472
+ e2.printStackTrace();
4473
+ }
39724474 }
39734475 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
39744476 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4014,6 +4516,12 @@
40144516
40154517 void LoadIt(Object obj)
40164518 {
4519
+ if (obj == null)
4520
+ {
4521
+ // Invalid file
4522
+ return;
4523
+ }
4524
+
40174525 System.out.println("Loaded " + obj);
40184526 //new Exception().printStackTrace();
40194527 Object3D readobj = (Object3D) obj;
....@@ -4023,6 +4531,8 @@
40234531
40244532 if (readobj != null)
40254533 {
4534
+ if (Globals.SAVEONMAKE)
4535
+ Save();
40264536 try
40274537 {
40284538 //readobj.deepCopySelf(copy);
....@@ -4085,7 +4595,7 @@
40854595
40864596 void load() // throws ClassNotFoundException
40874597 {
4088
- if (GraphreeD.standAlone)
4598
+ if (Grafreed.standAlone)
40894599 {
40904600 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914601 browser.show();
....@@ -4172,11 +4682,13 @@
41724682 try
41734683 {
41744684 FileOutputStream ostream = new FileOutputStream(lastname);
4175
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4685
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4686
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
41764687
41774688 p.writeObject(copy);
41784689 p.flush();
41794690
4691
+ zstream.close();
41804692 ostream.close();
41814693
41824694 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4186,11 +4698,12 @@
41864698 {
41874699 }
41884700 }
4701
+
41894702 String lastname;
41904703
41914704 void saveAs()
41924705 {
4193
- if (GraphreeD.standAlone)
4706
+ if (Grafreed.standAlone)
41944707 {
41954708 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964709 browser.setVisible(true);
....@@ -4213,10 +4726,20 @@
42134726
42144727 Object3D object = copy.selection.get(0);
42154728
4729
+ FileObject fileobj = null;
4730
+
4731
+ if (object instanceof FileObject)
4732
+ fileobj = (FileObject)object;
4733
+
42164734 if (object.fileparent != null)
42174735 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
4736
+ assert(fileobj == null);
42194737
4738
+ fileobj = (FileObject) object.fileparent;
4739
+ }
4740
+
4741
+ if (fileobj != null)
4742
+ {
42204743 System.out.println("WriteObject " + object + " : " + fileobj.name);
42214744 WriteObject(object, fileobj.name);
42224745 }
....@@ -4259,7 +4782,7 @@
42594782 }
42604783 }
42614784 else
4262
- //if (GraphreeD.standAlone)
4785
+ //if (GrafreeD.standAlone)
42634786 {
42644787 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42654788 browser.setVisible(true);
....@@ -4285,13 +4808,13 @@
42854808 try
42864809 {
42874810 FileOutputStream ostream = new FileOutputStream(filename);
4288
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4289
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4811
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4812
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42904813
42914814 Object3D objectparent = obj.parent;
42924815 obj.parent = null;
42934816
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
4817
+ Object3D object = (Object3D) Grafreed.clone(obj);
42954818
42964819 obj.parent = objectparent;
42974820
....@@ -4303,8 +4826,8 @@
43034826 p.writeObject(object);
43044827 p.flush();
43054828
4829
+ zstream.close();
43064830 ostream.close();
4307
- // zstream.close();
43084831
43094832 // group.selection.get(0).parent = parent;
43104833 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4325,7 +4848,7 @@
43254848 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43264849 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43274850 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
4851
+ if (Grafreed.standAlone)
43294852 {
43304853 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43314854 browser.show();
....@@ -4351,7 +4874,8 @@
43514874 Object3D client;
43524875 Object3D copy;
43534876 MenuBar menuBar;
4354
- Menu windowMenu;
4877
+ Menu fileMenu;
4878
+ MenuItem newItem;
43554879 MenuItem loadItem;
43564880 MenuItem saveItem;
43574881 MenuItem saveAsItem;
....@@ -4359,21 +4883,20 @@
43594883 MenuItem reexportItem;
43604884 MenuItem povItem;
43614885 MenuItem closeItem;
4362
- Menu cameraMenu;
4886
+
43634887 CheckboxMenuItem zBufferItem;
43644888 //MenuItem normalLensItem;
4365
- MenuItem editCameraItem;
4366
- MenuItem revertCameraItem;
4367
- CheckboxMenuItem toggleLiveItem;
43684889 MenuItem stepItem;
4369
- CheckboxMenuItem toggleFullItem;
4890
+ CheckboxMenuItem toggleLiveItem;
4891
+ CheckboxMenuItem toggleFullScreenItem;
4892
+ CheckboxMenuItem toggleTimelineItem;
43704893 CheckboxMenuItem toggleRenderItem;
43714894 CheckboxMenuItem toggleDebugItem;
43724895 CheckboxMenuItem toggleFrustumItem;
43734896 CheckboxMenuItem toggleFootContactItem;
43744897 CheckboxMenuItem toggleDLItem;
43754898 CheckboxMenuItem toggleTextureItem;
4376
- CheckboxMenuItem toggleRandomItem;
4899
+ CheckboxMenuItem toggleSwitchItem;
43774900 CheckboxMenuItem toggleRootItem;
43784901 CheckboxMenuItem animationItem;
43794902 CheckboxMenuItem toggleHandleItem;
....@@ -4381,23 +4904,26 @@
43814904 JSplitPane mainPanel;
43824905 JScrollPane scrollpane;
43834906 JPanel toolbarPanel;
4384
- JPanel treePanel;
4907
+ cGridBag treePanel;
43854908 JPanel radioPanel;
43864909 ButtonGroup buttonGroup;
4387
- JPanel ctrlPanel;
4388
- JPanel materialPanel;
4910
+ cGridBag ctrlPanel;
4911
+ cGridBag materialPanel;
43894912 JScrollPane infoPanel;
4390
- JPanel optionsPanel;
4913
+ cGridBag optionsPanel;
43914914 JTabbedPane objectPanel;
4392
- JPanel XYZPanel;
4915
+ cGridBag XYZPanel;
43934916 JSplitPane gridPanel;
43944917 JSplitPane bigPanel;
4395
- JPanel bigThree;
4396
- JTabbedPane jtp;
4397
- JPanel cameraPanel;
4918
+ cGridBag bigThree;
4919
+ cGridBag scenePanel;
4920
+ cGridBag centralPanel;
4921
+ JSplitPane cameraPanel;
4922
+ JPanel timelinePanel;
4923
+ JMenuBar timelineMenubar;
43984924 JSplitPane framePanel;
43994925 JTextArea/*Field*/ nameField;
4400
- cButton textureButton;
4926
+ //cButton textureButton;
44014927 cButton okButton;
44024928 cButton applyButton;
44034929 cButton cancelButton;
....@@ -4444,65 +4970,72 @@
44444970 // MATERIAL
44454971 JLabel materialLabel;
44464972 JLabel colorLabel;
4447
- NumberSlider colorField;
4973
+ cNumberSlider colorField;
44484974 JLabel modulationLabel;
4449
- NumberSlider modulationField;
4975
+ cNumberSlider modulationField;
44504976 JLabel metalnessLabel;
4451
- NumberSlider metalnessField;
4977
+ cNumberSlider metalnessField;
44524978 JLabel diffuseLabel;
4453
- NumberSlider diffuseField;
4979
+ cNumberSlider diffuseField;
44544980 JLabel specularLabel;
4455
- NumberSlider specularField;
4981
+ cNumberSlider specularField;
44564982 JLabel shininessLabel;
4457
- NumberSlider shininessField;
4983
+ cNumberSlider shininessField;
44584984 JLabel shiftLabel;
4459
- NumberSlider shiftField;
4985
+ cNumberSlider shiftField;
44604986 JLabel ambientLabel;
4461
- NumberSlider ambientField;
4987
+ cNumberSlider ambientField;
44624988 JLabel lightareaLabel;
4463
- NumberSlider lightareaField;
4989
+ cNumberSlider lightareaField;
44644990 JLabel diffusenessLabel;
4465
- NumberSlider diffusenessField;
4991
+ cNumberSlider diffusenessField;
44664992 JLabel velvetLabel;
4467
- NumberSlider velvetField;
4993
+ cNumberSlider velvetField;
44684994 JLabel sheenLabel;
4469
- NumberSlider sheenField;
4995
+ cNumberSlider sheenField;
44704996 JLabel subsurfaceLabel;
4471
- NumberSlider subsurfaceField;
4997
+ cNumberSlider subsurfaceField;
44724998 //JLabel bumpLabel;
44734999 //NumberSlider bumpField;
44745000 JLabel backlitLabel;
4475
- NumberSlider backlitField;
5001
+ cNumberSlider backlitField;
44765002 JLabel anisoLabel;
4477
- NumberSlider anisoField;
5003
+ cNumberSlider anisoField;
44785004 JLabel anisoVLabel;
4479
- NumberSlider anisoVField;
5005
+ cNumberSlider anisoVField;
44805006 JLabel cameraLabel;
4481
- NumberSlider cameraField;
5007
+ cNumberSlider cameraField;
44825008 JLabel selfshadowLabel;
4483
- NumberSlider selfshadowField;
5009
+ cNumberSlider selfshadowField;
44845010 JLabel shadowLabel;
4485
- NumberSlider shadowField;
5011
+ cNumberSlider shadowField;
44865012 JLabel textureLabel;
4487
- NumberSlider textureField;
5013
+ cNumberSlider textureField;
44885014 JLabel opacityLabel;
4489
- NumberSlider opacityField;
5015
+ cNumberSlider opacityField;
44905016 JLabel fakedepthLabel;
4491
- NumberSlider fakedepthField;
5017
+ cNumberSlider fakedepthField;
44925018 JLabel shadowbiasLabel;
4493
- NumberSlider shadowbiasField;
5019
+ cNumberSlider shadowbiasField;
44945020 JLabel bumpLabel;
4495
- NumberSlider bumpField;
5021
+ cNumberSlider bumpField;
44965022 JLabel noiseLabel;
4497
- NumberSlider noiseField;
5023
+ cNumberSlider noiseField;
44985024 JLabel powerLabel;
4499
- NumberSlider powerField;
5025
+ cNumberSlider powerField;
45005026 JLabel borderfadeLabel;
4501
- NumberSlider borderfadeField;
5027
+ cNumberSlider borderfadeField;
45025028 JLabel fogLabel;
4503
- NumberSlider fogField;
5029
+ cNumberSlider fogField;
45045030 JLabel opacityPowerLabel;
4505
- NumberSlider opacityPowerField;
5031
+ cNumberSlider opacityPowerField;
45065032 JTree jTree;
45075033 //ObjectUI parent;
5034
+
5035
+ cNumberSlider normalpushField;
5036
+
5037
+ private MenuItem importGFDItem;
5038
+ private MenuItem importVRMLX3DItem;
5039
+ private MenuItem import3DSItem;
5040
+ private MenuItem importOBJItem;
45085041 }