Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
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,73 @@
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
+ cToggleButton GetToggleButton(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cToggleButton(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cToggleButton(name, border);
65
+ }
66
+ }
67
+
68
+ cCheckBox GetCheckBox(String name, boolean border)
69
+ {
70
+ try
71
+ {
72
+ ImageIcon icon = GetIcon(name);
73
+ return new cCheckBox(icon, border);
74
+ }
75
+ catch (Exception e)
76
+ {
77
+ return new cCheckBox(name, border);
78
+ }
79
+ }
80
+
81
+ private ImageIcon GetIcon(String name) throws IOException
82
+ {
83
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
84
+
85
+ if (image.getWidth() != 24 && image.getHeight() != 24)
86
+ {
87
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
88
+ Graphics2D g = resized.createGraphics();
89
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
90
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
91
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
92
+ g.dispose();
93
+
94
+ image = resized;
95
+ }
96
+
97
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
98
+ return icon;
99
+ }
100
+
32101 // SCRIPT
33102
34103 transient JFrame textpanel = null;
....@@ -119,51 +188,62 @@
119188 void keyPressed(int key, int modifiers)
120189 {
121190 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
191
+ Globals.theRenderer.keyPressed(key, modifiers);
123192 }
124193 */
125194
126195 static GridBagConstraints aConstraints;
127196 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
197
+
130198 static int GRIDWIDTH = 100; // 4;
131199
132200 public void closeUI()
133201 {
134202 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
203
+// System.out.println("this = " + this);
204
+// System.out.println("objEditor = " + objEditor);
137205 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
206
+// objEditor.ctrlPanel.remove(nameField);
207
+
208
+ objEditor.ctrlPanel.remove(namePanel);
139209
140210 if (!GroupEditor.allparams)
141211 return;
142212
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);
213
+// objEditor.ctrlPanel.remove(liveCB);
214
+// objEditor.ctrlPanel.remove(hideCB);
215
+// objEditor.ctrlPanel.remove(markCB);
216
+//
217
+// objEditor.ctrlPanel.remove(randomCB);
218
+// objEditor.ctrlPanel.remove(speedupCB);
219
+// objEditor.ctrlPanel.remove(rewindCB);
220
+//
221
+// objEditor.ctrlPanel.remove(resetButton);
222
+// objEditor.ctrlPanel.remove(stepButton);
223
+//// objEditor.ctrlPanel.remove(stepAllButton);
224
+//// objEditor.ctrlPanel.remove(resetAllButton);
225
+// objEditor.ctrlPanel.remove(link2masterCB);
226
+// //objEditor.ctrlPanel.remove(flipVCB);
227
+// //objEditor.ctrlPanel.remove(texresMenu);
228
+// objEditor.ctrlPanel.remove(slowerButton);
229
+// objEditor.ctrlPanel.remove(fasterButton);
230
+// objEditor.ctrlPanel.remove(remarkButton);
231
+
232
+ objEditor.ctrlPanel.remove(setupPanel);
233
+ objEditor.ctrlPanel.remove(setupPanel2);
234
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
235
+ objEditor.ctrlPanel.remove(pushPanel);
236
+ //objEditor.ctrlPanel.remove(fillPanel);
237
+
238
+ //Remove(normalpushField);
161239 }
162240
163241 public ObjEditor GetEditor()
164242 {
165243 return objEditor; //.GetEditor();
166244 }
245
+
246
+ // Sometimes myself, sometimes my callee's.
167247 ObjEditor objEditor;
168248
169249 /*
....@@ -226,6 +306,7 @@
226306 //localCopy.parent = null;
227307
228308 frame = new JFrame();
309
+ frame.setUndecorated(true);
229310 objEditor = this;
230311 this.callee = callee;
231312
....@@ -238,7 +319,7 @@
238319 //if (!isDisplayable())
239320 //setUndecorated(true);
240321
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
322
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242323 client = inClient;
243324 copy = localCopy;
244325 copy.editWindow = this;
....@@ -259,24 +340,40 @@
259340 void SetupMenu()
260341 {
261342 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..."));
343
+ menuBar.add(fileMenu = new Menu("File"));
344
+ fileMenu.add(newItem = new MenuItem("New"));
345
+ fileMenu.add(loadItem = new MenuItem("Open..."));
346
+
347
+ //oe.menuBar.add(menu = new Menu("Include"));
348
+ Menu menu = new Menu("Import");
349
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
350
+ importOBJItem.addActionListener(this);
351
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
352
+ import3DSItem.addActionListener(this);
353
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
354
+ importVRMLX3DItem.addActionListener(this);
355
+ menu.add("-");
356
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
357
+ importGFDItem.addActionListener(this);
358
+ fileMenu.add(menu);
359
+ fileMenu.add("-");
360
+
361
+ fileMenu.add(saveItem = new MenuItem("Save"));
362
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267363 //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("-");
364
+ fileMenu.add("-");
365
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
366
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
367
+ fileMenu.add("-");
272368 if (client.parent != null)
273369 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
370
+ fileMenu.add(closeItem = new MenuItem("Close"));
275371 } else
276372 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
373
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278374 }
279375
376
+ newItem.addActionListener(this);
280377 loadItem.addActionListener(this);
281378 saveItem.addActionListener(this);
282379 saveAsItem.addActionListener(this);
....@@ -285,77 +382,38 @@
285382 //povItem.addActionListener(this);
286383 closeItem.addActionListener(this);
287384
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
-
341385 objectPanel = new JTabbedPane();
342386 toolbarPanel = new JPanel();
343387 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
388
+ treePanel = new cGridBag();
345389 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
390
+
391
+ editPanel = new cGridBag().setVertical(true);
392
+ editPanel.setName("Edit");
393
+
394
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
395
+
396
+ editCommandsPanel = new cGridBag();
397
+ editPanel.add(editCommandsPanel);
398
+ editPanel.add(ctrlPanel);
399
+
400
+ toolboxPanel = new cGridBag().setVertical(false);
401
+ toolboxPanel.setName("Toolbox");
402
+
403
+ materialPanel = new cGridBag().setVertical(true);
349404 materialPanel.setName("Material");
405
+
350406 /*JTextPane*/
351407 infoarea = createTextPane();
408
+ doc = infoarea.getStyledDocument();
409
+
352410 infoarea.setEditable(true);
353411 SetText();
354412 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355413 // infoarea.setOpaque(false);
356414 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
415
+// TEXTAREA infoarea.setLineWrap(true);
416
+// TEXTAREA infoarea.setWrapStyleWord(true);
359417 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360418 infoPanel.setPreferredSize(new Dimension(50, 200));
361419 infoPanel.setName("Info");
....@@ -366,16 +424,16 @@
366424 mainPanel.setName("Main");
367425 mainPanel.setContinuousLayout(true);
368426 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370427 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
428
+ mainPanel.setDividerLocation(0.5); //1.0);
429
+ mainPanel.setResizeWeight(0.5);
372430
373431 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374432 //mainPanel.setLayout(new GridBagLayout());
375433 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
434
+// treePanel.setLayout(new GridBagLayout());
435
+ //ctrlPanel.setLayout(new GridBagLayout());
436
+ //materialPanel.setLayout(new GridBagLayout());
379437
380438 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381439 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +472,7 @@
414472 static String newline = "\n";
415473 protected static final String buttonString = "JButton";
416474 StyledDocument doc;
417
- JTextArea infoarea;
475
+ JTextPane infoarea;
418476
419477 void ClearInfo()
420478 {
....@@ -437,10 +495,10 @@
437495 e.printStackTrace();
438496 }
439497
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();
498
+// String selection = infoarea.getText();
499
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
500
+// java.awt.datatransfer.Clipboard clipboard =
501
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444502 //clipboard.setContents(data, data);
445503 }
446504
....@@ -463,13 +521,13 @@
463521 //SendInfo("Name:", "bold");
464522 if (sel.GetTextures() != null || debug)
465523 {
466
- si.SendInfo(sel.toString(), "bold");
524
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467525 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468526 if (sel.Size() > 0)
469527 {
470528 si.SendInfo("#children = " + sel.Size(), "regular");
471529 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
530
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473531 if (debug)
474532 {
475533 try
....@@ -481,7 +539,10 @@
481539 }
482540
483541 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
542
+ {
543
+ si.SendInfo(" BBox min: " + minima, "regular");
544
+ si.SendInfo(" BBox max: " + maxima, "regular");
545
+ }
485546
486547 if (sel.bRep != null)
487548 {
....@@ -508,7 +569,7 @@
508569 }
509570 if (sel.support != null)
510571 {
511
- si.SendInfo(" support: " + sel.support, "regular");
572
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512573 }
513574 if (sel.scriptnode != null)
514575 {
....@@ -522,18 +583,18 @@
522583 maxima.y = sel.toParent[3][1];
523584 maxima.z = sel.toParent[3][2];
524585 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");
530586 maxima.x = sel.toParent[0][0];
531587 maxima.y = sel.toParent[1][1];
532588 maxima.z = sel.toParent[2][2];
533589 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];
590
+ maxima.x = sel.globalTransform[3][0];
591
+ maxima.y = sel.globalTransform[3][1];
592
+ maxima.z = sel.globalTransform[3][2];
593
+ if (full)
594
+ si.SendInfo(" Global Orig: " + maxima, "regular");
595
+ maxima.x = sel.globalTransform[0][0];
596
+ maxima.y = sel.globalTransform[1][1];
597
+ maxima.z = sel.globalTransform[2][2];
537598 if (full)
538599 si.SendInfo(" Global Scale: " + maxima, "regular");
539600 }
....@@ -579,6 +640,9 @@
579640 {
580641 CameraPane.pointflow = (PointFlow) sel;
581642 }
643
+
644
+ si.SendInfo("_____________________", "regular");
645
+ si.SendInfo("", "regular");
582646 }
583647 }
584648
....@@ -594,52 +658,140 @@
594658 }
595659 }
596660
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
- };
661
+static GraphicsDevice device = GraphicsEnvironment
662
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
614663
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
664
+ Rectangle keeprect;
665
+ cRadio radio;
666
+
667
+cButton keepButton;
668
+ cButton twoButton; // Full 3D
669
+ cButton sixButton;
670
+ cButton threeButton;
671
+ cButton sevenButton;
672
+ cButton fourButton; // full panel
673
+ cButton oneButton; // full XYZ
674
+ //cButton currentLayout;
675
+
676
+ boolean maximized;
677
+
678
+ cButton fullscreenLayout;
621679
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
680
+ void Minimize()
628681 {
629
- for (int j = 0; j < 2; j++)
682
+ frame.setState(Frame.ICONIFIED);
683
+ }
684
+
685
+ void Maximize()
686
+ {
687
+ if (maximized)
630688 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
689
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
636690 }
637
- } catch (BadLocationException ble)
691
+ else
692
+ {
693
+ keeprect = frame.getBounds();
694
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
695
+ Dimension rect2 = frame.getToolkit().getScreenSize();
696
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
697
+// frame.setState(Frame.MAXIMIZED_BOTH);
698
+ }
699
+
700
+ maximized ^= true;
701
+ }
702
+
703
+ void ToggleFullScreen()
638704 {
639
- System.err.println("Couldn't insert initial text into text pane.");
705
+ if (CameraPane.FULLSCREEN)
706
+ {
707
+ device.setFullScreenWindow(null);
708
+ //frame.setVisible(false);
709
+// frame.removeNotify();
710
+// frame.setUndecorated(false);
711
+// frame.addNotify();
712
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
713
+
714
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
715
+// X framePanel.add(bigThree);
716
+// X frame.getContentPane().add(/*"Center",*/framePanel);
717
+ framePanel.setDividerLocation(1);
718
+
719
+ //frame.setVisible(true);
720
+ radio.layout = keepButton;
721
+ //theFrame = null;
722
+ keepButton = null;
723
+ radio.layout.doClick();
724
+
725
+ } else
726
+ {
727
+ keepButton = radio.layout;
728
+ //keeprect = frame.getBounds();
729
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
730
+// frame.getToolkit().getScreenSize().height);
731
+ //frame.setVisible(false);
732
+ device.setFullScreenWindow(frame);
733
+// frame.removeNotify();
734
+// frame.setUndecorated(true);
735
+// frame.addNotify();
736
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
737
+// X framePanel.remove(bigThree);
738
+// X frame.getContentPane().add(/*"Center",*/bigThree);
739
+ framePanel.setDividerLocation(0);
740
+
741
+ radio.layout = fullscreenLayout;
742
+ radio.layout.doClick();
743
+ //frame.setVisible(true);
744
+ }
745
+
746
+ cameraView.ToggleFullScreen();
640747 }
641748
642
- return new JTextArea(); // textPane;
749
+ private JTextPane createTextPane()
750
+ {
751
+// TEXTAREA String[] initString =
752
+// {
753
+// "This is an editable JTextPane, ", //regular
754
+// "another ", //italic
755
+// "styled ", //bold
756
+// "text ", //small
757
+// "component, ", //large
758
+// "which supports embedded components..." + newline,//regular
759
+// " " + newline, //button
760
+// "...and embedded icons..." + newline, //regular
761
+// " ", //icon
762
+// newline + "JTextPane is a subclass of JEditorPane that "
763
+// + "uses a StyledEditorKit and StyledDocument, and provides "
764
+// + "cover methods for interacting with those objects."
765
+// };
766
+//
767
+// String[] initStyles =
768
+// {
769
+// "regular", "italic", "bold", "small", "large",
770
+// "regular", "button", "regular", "icon",
771
+// "regular"
772
+// };
773
+//
774
+// JTextPane textPane = new JTextPane();
775
+// textPane.setEditable(true);
776
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
777
+// addStylesToDocument(doc);
778
+//
779
+// try
780
+// {
781
+// for (int j = 0; j < 2; j++)
782
+// {
783
+// for (int i = 0; i < initString.length; i++)
784
+// {
785
+// doc.insertString(doc.getLength(), initString[i],
786
+// doc.getStyle(initStyles[i]));
787
+// }
788
+// }
789
+// } catch (BadLocationException ble)
790
+// {
791
+// System.err.println("Couldn't insert initial text into text pane.");
792
+// }
793
+
794
+ return new JTextPane(); // textPane;
643795 }
644796
645797 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +844,7 @@
692844 protected static ImageIcon createImageIcon(String path,
693845 String description)
694846 {
695
- java.net.URL imgURL = GrafreeD.class.getResource(path);
847
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696848 if (imgURL != null)
697849 {
698850 return new ImageIcon(imgURL, description);
....@@ -724,6 +876,7 @@
724876 // NumberSlider vDivsField;
725877 // JCheckBox endcaps;
726878 JCheckBox liveCB;
879
+ JCheckBox selectCB;
727880 JCheckBox hideCB;
728881 JCheckBox link2masterCB;
729882 JCheckBox markCB;
....@@ -739,115 +892,87 @@
739892 JButton slowerButton;
740893 JButton fasterButton;
741894 JButton remarkButton;
895
+
896
+ cGridBag editPanel;
897
+ cGridBag editCommandsPanel;
898
+
899
+ cGridBag namePanel;
900
+ cGridBag setupPanel;
901
+ cGridBag setupPanel2;
902
+ cGridBag objectCommandsPanel;
903
+ cGridBag pushPanel;
904
+ cGridBag fillPanel;
742905
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
906
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
744907 {
745908 JCheckBox cb;
746909
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);
910
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
752911 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
756912
757913 return cb;
758914 }
759915
760
- cButton AddButton(ObjEditor oe, String label)
916
+ cButton AddButton(cGridBag panel, String label)
761917 {
762918 cButton cb;
763919
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);
920
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
769921 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
773922
774923 return cb;
775924 }
776925
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
926
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
778927 {
779928 JComboBox combo;
780929
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;
930
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
784931 combo.addActionListener(this);
785932
786933 return combo;
787934 }
788935
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
936
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
790937 {
791
- NumberSlider combo;
938
+ cGridBag control = new cGridBag();
939
+
940
+ cNumberSlider combo;
792941
793942 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
796943 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
-
944
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
945
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
806946 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
947
+
948
+ panel.add(control);
949
+
950
+ return control;
813951 }
814952
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
953
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
816954 {
817
- NumberSlider combo;
955
+ cGridBag control = new cGridBag();
956
+
957
+ cNumberSlider combo;
818958
819959 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822960 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
-
961
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
962
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832963 combo.setInteger(current);
833964
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
965
+ panel.add(control);
966
+
967
+ return control;
839968 }
840969
841
- JTextArea AddText(JPanel ctrlPanel, String name)
970
+ JTextArea AddText(cGridBag ctrlPanel, String name)
842971 {
843972 JTextArea text;
844973
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
974
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
848975 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851976
852977 return text;
853978 }
....@@ -877,9 +1002,16 @@
8771002 objEditor.ctrlPanel.remove(j);
8781003 }
8791004
1005
+ void Remove(cNumberSlider j)
1006
+ {
1007
+ j.removeChangeListener(this);
1008
+ //objEditor.ctrlPanel.remove(j.label);
1009
+ objEditor.ctrlPanel.remove(j);
1010
+ }
1011
+
8801012 /*
8811013 */
882
- void Return() // ObjEditor oe)
1014
+ void Return0() // ObjEditor oe)
8831015 {
8841016 aConstraints.gridy += 1;
8851017 aConstraints.gridx = 0;
....@@ -934,35 +1066,77 @@
9341066
9351067 void SetupUI2(ObjEditor oe)
9361068 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1069
+ //SetupName(oe);
1070
+
1071
+ namePanel = new cGridBag();
1072
+
1073
+ nameField = AddText(namePanel, copy.GetName());
1074
+ namePanel.add(nameField);
1075
+ oe.ctrlPanel.add(namePanel);
1076
+
1077
+ oe.ctrlPanel.Return();
9421078
9431079 if (!GroupEditor.allparams)
9441080 return;
9451081
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1082
+ setupPanel = new cGridBag().setVertical(false);
1083
+
1084
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1085
+ liveCB.setToolTipText("Animate object");
1086
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1087
+ selectCB.setToolTipText("Make object selectable");
9491088 // 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");
1089
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1090
+ hideCB.setToolTipText("Hide object");
1091
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1092
+ markCB.setToolTipText("Set the animation target transform");
1093
+
1094
+ setupPanel2 = new cGridBag().setVertical(false);
1095
+
1096
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1097
+ rewindCB.setToolTipText("Rewind animation");
1098
+
1099
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1100
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1101
+
1102
+ if (Globals.ADVANCED)
1103
+ {
1104
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1105
+ link2masterCB.setToolTipText("Attach to support");
1106
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1107
+ speedupCB.setToolTipText("Option motion capture");
1108
+ }
1109
+
1110
+ oe.ctrlPanel.add(setupPanel);
1111
+ oe.ctrlPanel.Return();
1112
+ oe.ctrlPanel.add(setupPanel2);
1113
+ oe.ctrlPanel.Return();
1114
+
1115
+ objectCommandsPanel = new cGridBag().setVertical(false);
1116
+
1117
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1118
+ resetButton.setToolTipText("Jump to frame zero");
1119
+ stepButton = AddButton(objectCommandsPanel, "Step");
1120
+ stepButton.setToolTipText("Step one frame");
9561121 // resetAllButton = AddButton(oe, "Reset All");
9571122 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591123 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1124
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1125
+ slowerButton.setToolTipText("Decrease animation speed");
1126
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1127
+ fasterButton.setToolTipText("Increase animation speed");
1128
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1129
+ remarkButton.setToolTipText("Set the current transform as the target");
9631130
964
- Return();
1131
+ oe.ctrlPanel.add(objectCommandsPanel);
1132
+ oe.ctrlPanel.Return();
9651133
1134
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1135
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1136
+ //Return();
1137
+
1138
+ oe.ctrlPanel.Return();
1139
+
9661140 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671141 // ObjEditor.aConstraints.gridx += 1;
9681142
....@@ -1056,7 +1230,7 @@
10561230 oe.aConstraints.gridwidth = 1;
10571231 /**/
10581232 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1233
+ oe.ctrlPanel.Return();
10601234
10611235 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621236 //textureButton.setEnabled(false);
....@@ -1158,10 +1332,28 @@
11581332 //JPanel worldPanel =
11591333 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601334 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1335
+ centralPanel = new cGridBag();
1336
+ centralPanel.preferredWidth = 20;
1337
+
1338
+ if (Globals.ADVANCED)
1339
+ {
1340
+ timelinePanel = new JPanel(new BorderLayout());
1341
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641342
1343
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1344
+ cameraPanel.setContinuousLayout(true);
1345
+ cameraPanel.setOneTouchExpandable(true);
1346
+// cameraPanel.setDividerLocation(0.9);
1347
+// cameraPanel.setDividerSize(9);
1348
+ cameraPanel.setResizeWeight(1.0);
1349
+
1350
+ }
1351
+
1352
+ centralPanel.add(cameraView);
1353
+ centralPanel.setFocusable(true);
1354
+ //frame.setJMenuBar(timelineMenubar);
1355
+ //centralPanel.add(timelinePanel);
1356
+
11651357 //topView.camera = ;
11661358 //frontView.camera = new Camera(2);
11671359 //sideView.camera = new Camera(3);
....@@ -1177,12 +1369,13 @@
11771369 //frontView.object = copy;
11781370 //sideView.object = copy;
11791371
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1372
+ XYZPanel = new cGridBag().setVertical(true);
1373
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821374
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1375
+ XYZPanel.preferredWidth = 5;
1376
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1377
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1378
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861379
11871380 /*
11881381 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1384,7 @@
11911384 gridPanel.add(cameraView);
11921385 gridPanel.add(XYZPanel);
11931386 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1387
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951388 gridPanel.setContinuousLayout(true);
11961389 gridPanel.setOneTouchExpandable(true);
11971390 gridPanel.setDividerLocation(1.0);
....@@ -1219,11 +1412,13 @@
12191412
12201413 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211414 //tmp.setName("Edit");
1415
+ objectPanel.add(toolboxPanel);
12221416 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1417
+// JPanel north = new JPanel(new BorderLayout());
1418
+// north.setName("Edit");
1419
+// north.add(ctrlPanel, BorderLayout.NORTH);
1420
+// objectPanel.add(north);
1421
+ objectPanel.add(editPanel);
12271422 objectPanel.add(infoPanel);
12281423
12291424 /*
....@@ -1244,16 +1439,23 @@
12441439 scrollpane.setWheelScrollingEnabled(true);
12451440 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461441
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1442
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1443
+ scenePanel.preferredWidth = 6;
1444
+
1445
+ JTabbedPane tabbedPane = new JTabbedPane();
1446
+ tabbedPane.add(scrollpane);
12491447
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1448
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12511449
1252
- optionsPanel = new JPanel(new GridBagLayout());
1450
+ optionsPanel = new cGridBag().setVertical(true);
12531451
12541452 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1256
-
1453
+
1454
+ AddOptions(optionsPanel); //, aConstraints);
1455
+
1456
+ tabbedPane.add(optionsPanel);
1457
+
1458
+ scenePanel.add(tabbedPane);
12571459
12581460 /*
12591461 cTree jTree = new cTree(null);
....@@ -1275,7 +1477,7 @@
12751477 jtp.add(tree);
12761478 */
12771479
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1480
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791481 bigPanel.setContinuousLayout(true);
12801482 bigPanel.setOneTouchExpandable(true);
12811483 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1489,7 @@
12871489 //bigPanel.setSize(new Dimension(10,10));
12881490 //bigPanel.add(ctrlPanel);
12891491 //bigPanel.add(gridPanel);
1492
+ /**
12901493 bigThree = new JPanel();
12911494 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921495 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1500,26 @@
12971500 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981501 aWindowConstraints.weightx = 0;
12991502 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1503
+ bigThree.add(scenePanel, aWindowConstraints);
13011504 aWindowConstraints.weightx = 1;
13021505 aWindowConstraints.gridwidth = 3;
13031506 // aConstraints.gridheight = 3;
13041507 aWindowConstraints.gridx = 1;
13051508 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1509
+ bigThree.add(centralPanel, aWindowConstraints);
13071510 aWindowConstraints.weightx = 0;
13081511 aWindowConstraints.gridx = 4;
13091512 aWindowConstraints.gridwidth = 1;
13101513 // aConstraints.gridheight = 3;
13111514 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121515 bigThree.add(XYZPanel, aWindowConstraints);
1516
+ /**/
13131517
1518
+ bigThree = new cGridBag();
1519
+ bigThree.addComponent(scenePanel);
1520
+ bigThree.addComponent(centralPanel);
1521
+ bigThree.addComponent(XYZPanel);
1522
+
13141523 // // SIDE EFFECT!!!
13151524 // aConstraints.gridx = 0;
13161525 // aConstraints.gridy = 0;
....@@ -1331,14 +1540,17 @@
13311540 //worldPane.add(bigPanel);
13321541 //worldPane.add(worldPanel);
13331542 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1543
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1544
+ frame.add(/*"Center",*/framePanel);
13351545 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361546
13371547 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381548
1339
- frame.setSize(1024, 768);
1340
- frame.show();
1549
+ frame.setSize(1280, 860);
1550
+ frame.setVisible(true);
13411551
1552
+ cameraView.requestFocusInWindow();
1553
+
13421554 gridPanel.setDividerLocation(1.0);
13431555
13441556 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1352,6 +1564,10 @@
13521564 });
13531565 }
13541566
1567
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1568
+ {
1569
+ }
1570
+
13551571 JTree GetTree()
13561572 {
13571573 return objEditor.jTree;
....@@ -1363,260 +1579,173 @@
13631579 ctrlPanel.removeAll();
13641580 }
13651581
1366
- void SetupMaterial(JPanel ctrlPanel)
1582
+ void SetupMaterial(cGridBag panel)
13671583 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1584
+ /*
13711585 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721586 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751587 */
13761588
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1589
+ cGridBag editBar = new cGridBag().setVertical(false);
1590
+
1591
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1592
+ createMaterialButton.setToolTipText("Create material");
13821593
13831594 /*
13841595 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881596 */
13891597
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1598
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1599
+ clearMaterialButton.setToolTipText("Clear material");
1600
+
1601
+ if (Globals.ADVANCED)
1602
+ {
1603
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1604
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1605
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1606
+ }
13921607
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;
1608
+ editBar.preferredHeight = 15;
1609
+
1610
+ panel.add(editBar);
1611
+
14071612 /**/
14081613 //aConstraints.weighty = 0;
14091614 ////aConstraints.weightx = 1;
14101615 //aConstraints.weighty = 1;
14111616 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121617 //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;
1618
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181619
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;
1620
+ cGridBag colorSection = new cGridBag().setVertical(true);
1621
+
1622
+ cGridBag color = new cGridBag();
1623
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1624
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1625
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1626
+ //colorField.preferredWidth = 200;
1627
+ colorSection.add(color);
14291628
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;
1629
+ cGridBag modulation = new cGridBag();
1630
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1631
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1632
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1633
+ colorSection.add(modulation);
14391634
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;
1635
+ cGridBag texture = new cGridBag();
1636
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1637
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1639
+ colorSection.add(texture);
14491640
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;
1641
+ cGridBag anisoU = new cGridBag();
1642
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1643
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1645
+ colorSection.add(anisoU);
14591646
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;
1647
+ cGridBag anisoV = new cGridBag();
1648
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1649
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1651
+ colorSection.add(anisoV);
14691652
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;
1653
+ cGridBag shadowbias = new cGridBag();
1654
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1655
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1657
+ colorSection.add(shadowbias);
14791658
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;
1659
+ panel.add(new JSeparator());
1660
+
1661
+ panel.add(colorSection);
1662
+
1663
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1664
+
1665
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1666
+
1667
+ cGridBag diffuse = new cGridBag();
1668
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1669
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1670
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1671
+ diffuseSection.add(diffuse);
14881672
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;
1673
+ cGridBag diffuseness = new cGridBag();
1674
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1675
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1676
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1677
+ diffuseSection.add(diffuseness);
14981678
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;
1679
+ cGridBag selfshadow = new cGridBag();
1680
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1681
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1683
+ diffuseSection.add(selfshadow);
15081684
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;
1685
+ cGridBag sheen = new cGridBag();
1686
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1687
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1689
+ diffuseSection.add(sheen);
15181690
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;
1691
+ cGridBag subsurface = new cGridBag();
1692
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1693
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1694
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1695
+ diffuseSection.add(subsurface);
15281696
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;
1697
+ cGridBag shadow = new cGridBag();
1698
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1699
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1700
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1701
+ diffuseSection.add(shadow);
15381702
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;
1703
+ cGridBag fakedepth = new cGridBag();
1704
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1705
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1706
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1707
+ diffuseSection.add(fakedepth);
15481708
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;
1709
+ panel.add(new JSeparator());
1710
+
1711
+ panel.add(diffuseSection);
1712
+
1713
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1714
+
1715
+ cGridBag specularSection = new cGridBag().setVertical(true);
15581716
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;
1717
+ cGridBag specular = new cGridBag();
1718
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1719
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1720
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1721
+ specularSection.add(specular);
15671722
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;
1723
+ cGridBag lightarea = new cGridBag();
1724
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1725
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1726
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1727
+ specularSection.add(lightarea);
15771728
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;
1729
+ cGridBag shininess = new cGridBag();
1730
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1731
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1733
+ specularSection.add(shininess);
15871734
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;
1735
+ cGridBag metalness = new cGridBag();
1736
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1737
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1738
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1739
+ specularSection.add(metalness);
15971740
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;
1741
+ cGridBag velvet = new cGridBag();
1742
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1743
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1744
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1745
+ specularSection.add(velvet);
16071746
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();
1747
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1748
+ //Return();
16201749 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211750 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221751 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1756,93 @@
16271756 // aConstraints.gridy += 1;
16281757 // aConstraints.gridwidth = 1;
16291758
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;
16381759
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;
1760
+ panel.add(new JSeparator());
1761
+
1762
+ panel.add(specularSection);
1763
+
1764
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1765
+
1766
+ cGridBag globalSection = new cGridBag().setVertical(true);
16481767
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;
1768
+ cGridBag camera = new cGridBag();
1769
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1770
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1771
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1772
+ globalSection.add(camera);
16581773
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;
1774
+ cGridBag ambient = new cGridBag();
1775
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1776
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1777
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1778
+ globalSection.add(ambient);
16681779
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;
1780
+ cGridBag backlit = new cGridBag();
1781
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1782
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1783
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1784
+ globalSection.add(backlit);
16791785
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;
1786
+ cGridBag opacity = new cGridBag();
1787
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1788
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1789
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1790
+ globalSection.add(opacity);
16891791
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;
1792
+ panel.add(new JSeparator());
1793
+
1794
+ panel.add(globalSection);
1795
+
1796
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1797
+
1798
+ cGridBag textureSection = new cGridBag().setVertical(true);
16991799
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;
1800
+ cGridBag bump = new cGridBag();
1801
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1802
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1803
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1804
+ textureSection.add(bump);
17091805
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;
1806
+ cGridBag noise = new cGridBag();
1807
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1808
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1809
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1810
+ textureSection.add(noise);
17191811
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;
1812
+ cGridBag power = new cGridBag();
1813
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1814
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1815
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1816
+ textureSection.add(power);
17291817
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;
1818
+ cGridBag borderfade = new cGridBag();
1819
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1820
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1821
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1822
+ textureSection.add(borderfade);
17391823
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1824
+ cGridBag fog = new cGridBag();
1825
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1826
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1827
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1828
+ textureSection.add(fog);
17451829
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1830
+ cGridBag opacityPower = new cGridBag();
1831
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1832
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1833
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1834
+ textureSection.add(opacityPower);
1835
+
1836
+ panel.add(new JSeparator());
1837
+
1838
+ panel.add(textureSection);
1839
+
1840
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491841
17501842 SetMaterial(copy); // .GetMaterial());
17511843
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1844
+ //colorField.addChangeListener(this);
1845
+// modulationField.addChangeListener(this);
17541846 metalnessField.addChangeListener(this);
17551847 diffuseField.addChangeListener(this);
17561848 specularField.addChangeListener(this);
....@@ -1780,12 +1872,15 @@
17801872 opacityPowerField.addChangeListener(this);
17811873 /**/
17821874
1783
- resetSlidersButton.addActionListener(this);
17841875 clearMaterialButton.addActionListener(this);
17851876 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
1877
+
1878
+ if (Globals.ADVANCED)
1879
+ {
1880
+ resetSlidersButton.addActionListener(this);
1881
+ propagateToggle.addItemListener(this);
1882
+ multiplyToggle.addItemListener(this);
1883
+ }
17891884 }
17901885
17911886 void DropFile(java.io.File[] files, boolean textures)
....@@ -1956,7 +2051,7 @@
19562051
19572052 //? flashIt = false;
19582053 CameraPane pane = (CameraPane) cameraView;
1959
- pane.clickStart(location.x, location.y, 0);
2054
+ pane.clickStart(location.x, location.y, 0, 0);
19602055 pane.clickEnd(location.x, location.y, 0, true);
19612056
19622057 if (group.selection.size() == 1)
....@@ -2005,6 +2100,7 @@
20052100 e2.printStackTrace();
20062101 }
20072102 }
2103
+
20082104 LoadJMEThread loadThread;
20092105
20102106 class LoadJMEThread extends Thread
....@@ -2062,6 +2158,7 @@
20622158 //LoadFile0(filename, converter);
20632159 }
20642160 }
2161
+
20652162 LoadOBJThread loadObjThread;
20662163
20672164 class LoadOBJThread extends Thread
....@@ -2140,19 +2237,19 @@
21402237
21412238 void LoadObjFile(String fullname)
21422239 {
2143
- /*
2240
+ System.out.println("Loading " + fullname);
2241
+ /**/
21442242 //lastFilename = fullname;
21452243 if(loadObjThread == null)
21462244 {
2147
- loadObjThread = new LoadOBJThread();
2148
- loadObjThread.start();
2245
+ loadObjThread = new LoadOBJThread();
2246
+ loadObjThread.start();
21492247 }
21502248
21512249 loadObjThread.add(fullname);
2152
- */
2250
+ /**/
21532251
2154
- System.out.println("Loading " + fullname);
2155
- makeSomething(new FileObject(fullname, true), true);
2252
+ //makeSomething(new FileObject(fullname, true), true);
21562253 }
21572254
21582255 void LoadGFDFile(String fullname)
....@@ -2194,6 +2291,8 @@
21942291 {
21952292 Mocap sel = (Mocap) copy.selection.get(0);
21962293
2294
+ sel.SetCurrentBones(sel.frame);
2295
+
21972296 sel.fullname = fullname;
21982297
21992298 if (changename)
....@@ -2207,14 +2306,18 @@
22072306 sel.smoothed = false;
22082307
22092308 // if (!changename)
2210
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2309
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2310
+ sel.SetGlobalTransform();
2311
+ sel.LoadData();
2312
+ sel.Rewind();
2313
+ sel.Fade();
22112314 // sel.setPose(0);
22122315 refreshContents();
22132316 } else
22142317 {
22152318 mocap.Reset();
22162319 // new skeleton
2217
- makeSomething(mocap, false); // true);
2320
+ makeSomething(mocap, true); // true);
22182321 }
22192322 } catch (Exception e)
22202323 {
....@@ -2241,6 +2344,8 @@
22412344 {
22422345 Mocap sel = (Mocap) select;
22432346
2347
+ sel.SetCurrentBones(sel.frame);
2348
+
22442349 File file = new File(fullname);
22452350
22462351 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2307,7 +2412,11 @@
23072412
23082413 if (!changename)
23092414 {
2310
- sel.SetPositionDelta(false, true, true, true/*?*/);
2415
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2416
+ sel.SetGlobalTransform();
2417
+ sel.LoadData();
2418
+ sel.Rewind();
2419
+ sel.Fade();
23112420 }
23122421
23132422 // sel.setPose(0);
....@@ -2401,11 +2510,11 @@
24012510
24022511 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24032512 {
2404
- if (GrafreeD.standAlone)
2513
+ if (Grafreed.standAlone)
24052514 {
24062515 /**/
24072516 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2408
- browser.show();
2517
+ browser.setVisible(true);
24092518 String filename = browser.getFile();
24102519 if (filename != null && filename.length() > 0)
24112520 {
....@@ -2550,6 +2659,7 @@
25502659 }
25512660 if (input == null)
25522661 {
2662
+ new Exception().printStackTrace();
25532663 System.exit(0);
25542664 }
25552665
....@@ -2764,7 +2874,8 @@
27642874 return;
27652875 }
27662876
2767
- multiplyToggle.setSelected(mat.multiply);
2877
+ if (multiplyToggle != null)
2878
+ multiplyToggle.setSelected(mat.multiply);
27682879
27692880 assert (object.projectedVertices != null);
27702881
....@@ -2946,25 +3057,42 @@
29463057 // june 2013 copy.HardTouch();
29473058 cameraView.repaint();
29483059 return;
2949
- } else if (event.getSource() == toggleFullItem)
3060
+ } else if (event.getSource() == toggleTimelineItem)
29503061 {
2951
- if (CameraPane.FULLSCREEN)
3062
+ timeline ^= true;
3063
+
3064
+ if (timeline)
29523065 {
2953
- frame.getContentPane().remove(/*"Center",*/bigThree);
2954
- framePanel.add(bigThree);
2955
- frame.getContentPane().add(/*"Center",*/framePanel);
2956
- } else
2957
- {
2958
- frame.getContentPane().remove(/*"Center",*/framePanel);
2959
- frame.getContentPane().add(/*"Center",*/bigThree);
3066
+ centralPanel.remove(cameraView);
3067
+ cameraPanel.add(cameraView);
3068
+ centralPanel.add(cameraPanel);
3069
+ frame.setJMenuBar(timelineMenubar);
3070
+ wasFullScreen = CameraPane.FULLSCREEN;
3071
+ if (!CameraPane.FULLSCREEN)
3072
+ ToggleFullScreen();
3073
+ toggleFullScreenItem.setEnabled(false);
29603074 }
3075
+ else
3076
+ {
3077
+ centralPanel.remove(cameraPanel);
3078
+ centralPanel.add(cameraView);
3079
+ frame.setJMenuBar(null);
3080
+ if (!wasFullScreen)
3081
+ ToggleFullScreen();
3082
+ toggleFullScreenItem.setEnabled(true);
3083
+ }
3084
+
29613085 frame.validate();
2962
- cameraView.ToggleFullScreen();
3086
+ return;
3087
+ } else if (event.getSource() == toggleFullScreenItem)
3088
+ {
3089
+ ToggleFullScreen();
3090
+ frame.validate();
29633091
29643092 return;
2965
- } else if (event.getSource() == toggleRandomItem)
3093
+ } else if (event.getSource() == toggleSwitchItem)
29663094 {
2967
- cameraView.ToggleRandom();
3095
+ cameraView.ToggleSwitch();
29683096 cameraView.repaint();
29693097 return;
29703098 } else if (event.getSource() == toggleHandleItem)
....@@ -2993,6 +3121,10 @@
29933121 {
29943122 copy.live ^= true;
29953123 return;
3124
+ } else if (event.getSource() == selectCB)
3125
+ {
3126
+ copy.dontselect ^= true;
3127
+ return;
29963128 } else if (event.getSource() == hideCB)
29973129 {
29983130 copy.hide ^= true;
....@@ -3007,6 +3139,7 @@
30073139 if (event.getSource() == randomCB)
30083140 {
30093141 copy.random ^= true;
3142
+ objEditor.refreshContents();
30103143 return;
30113144 }
30123145 if (event.getSource() == speedupCB)
....@@ -3030,8 +3163,9 @@
30303163
30313164 public void actionPerformed(ActionEvent event)
30323165 {
3166
+ Object source = event.getSource();
30333167 // SCRIPT DIALOG
3034
- if (event.getSource() == okbutton)
3168
+ if (source == okbutton)
30353169 {
30363170 textpanel.setVisible(false);
30373171 textpanel.remove(textarea);
....@@ -3043,7 +3177,7 @@
30433177 textarea = null;
30443178 textpanel = null;
30453179 }
3046
- if (event.getSource() == cancelbutton)
3180
+ if (source == cancelbutton)
30473181 {
30483182 textpanel.setVisible(false);
30493183 textpanel.remove(textarea);
....@@ -3055,49 +3189,50 @@
30553189 //applySelf();
30563190 //client.refreshEditWindow();
30573191 //refreshContents();
3058
- if (event.getSource() == nameField)
3192
+ if (source == nameField)
30593193 {
30603194 //System.out.println("ObjEditor " + event);
30613195 applySelf0(true);
30623196 //parent.applySelf();
30633197 objEditor.refreshContents();
3064
- } else if (event.getSource() == resetButton)
3198
+ } else if (source == resetButton)
30653199 {
30663200 CameraPane.fullreset = true;
30673201 copy.Reset(); // ResetMeshes();
30683202 copy.Touch();
30693203 objEditor.refreshContents();
3070
- } else if (event.getSource() == stepItem)
3204
+ } else if (source == stepItem)
30713205 {
3072
- cameraView.ONESTEP = true;
3206
+ //cameraView.ONESTEP = true;
3207
+ Globals.ONESTEP = true;
30733208 cameraView.repaint();
30743209 return;
3075
- } else if (event.getSource() == stepButton)
3210
+ } else if (source == stepButton)
30763211 {
30773212 copy.Step();
30783213 copy.Touch();
30793214 objEditor.refreshContents();
3080
- } else if (event.getSource() == slowerButton)
3215
+ } else if (source == slowerButton)
30813216 {
30823217 copy.Slower();
30833218 copy.Touch();
30843219 objEditor.refreshContents();
3085
- } else if (event.getSource() == fasterButton)
3220
+ } else if (source == fasterButton)
30863221 {
30873222 copy.Faster();
30883223 copy.Touch();
30893224 objEditor.refreshContents();
3090
- } else if (event.getSource() == remarkButton)
3225
+ } else if (source == remarkButton)
30913226 {
30923227 copy.Remark();
30933228 copy.Touch();
30943229 objEditor.refreshContents();
3095
- } else if (event.getSource() == stepAllButton)
3230
+ } else if (source == stepAllButton)
30963231 {
30973232 copy.StepAll();
30983233 copy.Touch();
30993234 objEditor.refreshContents();
3100
- } else if (event.getSource() == resetAllButton)
3235
+ } else if (source == resetAllButton)
31013236 {
31023237 //CameraPane.fullreset = true;
31033238 copy.ResetAll(); // ResetMeshes();
....@@ -3130,53 +3265,75 @@
31303265 // Close();
31313266 // }
31323267 // else
3133
- if (event.getSource() == resetSlidersButton)
3268
+ if (source == resetSlidersButton)
31343269 {
31353270 ResetSliders();
3136
- } else if (event.getSource() == clearMaterialButton)
3271
+ } else if (source == clearMaterialButton)
31373272 {
31383273 ClearMaterial();
3139
- } else if (event.getSource() == createMaterialButton)
3274
+ } else if (source == createMaterialButton)
31403275 {
31413276 CreateMaterial();
3142
- } else if (event.getSource() == clearPanelButton)
3277
+ } else if (source == clearPanelButton)
31433278 {
31443279 copy.ClearUI();
31453280 refreshContents(true);
3146
- } /*
3147
- }
3148
-
3149
- public boolean action(Event event, Object arg)
3150
- {
3151
- */ else if (event.getSource() == closeItem)
3281
+ } else if (source == importGFDItem)
3282
+ {
3283
+ ImportGFD();
3284
+ } else
3285
+ if (source == importVRMLX3DItem)
3286
+ {
3287
+ ImportVRMLX3D();
3288
+ } else
3289
+ if (source == import3DSItem)
3290
+ {
3291
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3292
+ } else
3293
+ if (source == importOBJItem)
3294
+ {
3295
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3296
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3297
+ browser.setVisible(true);
3298
+ String filename = browser.getFile();
3299
+ if (filename != null && filename.length() > 0)
3300
+ {
3301
+ String fullname = browser.getDirectory() + filename;
3302
+ makeSomething(ReadOBJ(fullname), true);
3303
+ }
3304
+ } else
3305
+ if (source == closeItem)
31523306 {
31533307 Close();
31543308 //return true;
3155
- } else if (event.getSource() == loadItem)
3309
+ } else if (source == loadItem)
31563310 {
31573311 load();
31583312 //return true;
3159
- } else if (event.getSource() == saveItem)
3313
+ } else if (source == newItem)
3314
+ {
3315
+ New();
3316
+ } else if (source == saveItem)
31603317 {
31613318 save();
31623319 //return true;
3163
- } else if (event.getSource() == saveAsItem)
3320
+ } else if (source == saveAsItem)
31643321 {
31653322 saveAs();
31663323 //return true;
3167
- } else if (event.getSource() == reexportItem)
3324
+ } else if (source == reexportItem)
31683325 {
31693326 reexport();
31703327 //return true;
3171
- } else if (event.getSource() == exportAsItem)
3328
+ } else if (source == exportAsItem)
31723329 {
31733330 export();
31743331 //return true;
3175
- } else if (event.getSource() == povItem)
3332
+ } else if (source == povItem)
31763333 {
31773334 generatePOV();
31783335 //return true;
3179
- } else if (event.getSource() == zBufferItem)
3336
+ } else if (source == zBufferItem)
31803337 {
31813338 try
31823339 {
....@@ -3198,21 +3355,8 @@
31983355 cameraView.repaint();
31993356 //return true;
32003357 }
3201
- */ else if (event.getSource() == editCameraItem)
3202
- {
3203
- cameraView.ProtectCamera();
3204
- cameraView.repaint();
3205
- return;
3206
- } else if (event.getSource() == revertCameraItem)
3207
- {
3208
- cameraView.RevertCamera();
3209
- cameraView.repaint();
3210
- return;
3211
- } else if (event.getSource() == textureButton)
3212
- {
3213
- return; // true;
3214
- } else // combos...
3215
- if (event.getSource() == texresMenu)
3358
+ */ else // combos...
3359
+ if (source == texresMenu)
32163360 {
32173361 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32183362 copy.texres = texresMenu.getSelectedIndex();
....@@ -3224,27 +3368,287 @@
32243368 }
32253369 }
32263370
3227
- void ToggleAnimation()
3371
+ void New()
32283372 {
3229
- if (!CameraPane.ANIMATION)
3373
+ while (copy.Size() > 1)
32303374 {
3231
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3375
+ copy.remove(1);
3376
+ }
3377
+
3378
+ ResetModel();
3379
+ objEditor.refreshContents();
3380
+ }
3381
+
3382
+ static public byte[] Compress(Object3D o)
3383
+ {
3384
+ try
3385
+ {
3386
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3387
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3388
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3389
+
3390
+ Object3D parent = o.parent;
3391
+ o.parent = null;
3392
+
3393
+ out.writeObject(o);
3394
+
3395
+ o.parent = parent;
3396
+
3397
+ out.flush();
3398
+
3399
+ zstream.close();
3400
+ out.close();
3401
+
3402
+ return baos.toByteArray();
3403
+ } catch (Exception e)
3404
+ {
3405
+ System.err.println(e);
3406
+ return null;
3407
+ }
3408
+ }
3409
+
3410
+ static public Object Uncompress(byte[] bytes)
3411
+ {
3412
+ System.out.println("#bytes = " + bytes.length);
3413
+ try
3414
+ {
3415
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3416
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3417
+ ObjectInputStream in = new ObjectInputStream(istream);
3418
+ Object obj = in.readObject();
3419
+ in.close();
3420
+
3421
+ return obj;
3422
+ } catch (Exception e)
3423
+ {
3424
+ System.err.println(e);
3425
+ return null;
3426
+ }
3427
+ }
3428
+
3429
+ static public Object clone(Object o)
3430
+ {
3431
+ try
3432
+ {
3433
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3434
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3435
+
3436
+ out.writeObject(o);
3437
+
3438
+ out.flush();
3439
+ out.close();
3440
+
3441
+ byte[] bytes = baos.toByteArray();
3442
+
3443
+ System.out.println("clone = " + bytes.length);
3444
+
3445
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3446
+ ObjectInputStream in = new ObjectInputStream(bais);
3447
+ Object obj = in.readObject();
3448
+ in.close();
3449
+
3450
+ return obj;
3451
+ } catch (Exception e)
3452
+ {
3453
+ System.err.println(e);
3454
+ return null;
3455
+ }
3456
+ }
3457
+
3458
+ cRadio GetCurrentTab()
3459
+ {
3460
+ cRadio ab;
3461
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3462
+ {
3463
+ ab = (cRadio)e.nextElement();
3464
+ if(ab.GetObject() == copy)
3465
+ {
3466
+ return ab;
3467
+ }
3468
+ }
3469
+
3470
+ return null;
3471
+ }
3472
+
3473
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3474
+
3475
+ public void Save()
3476
+ {
3477
+ System.err.println("Save");
3478
+
3479
+ cRadio tab = GetCurrentTab();
3480
+
3481
+ boolean temp = CameraPane.SWITCH;
3482
+ CameraPane.SWITCH = false;
3483
+
3484
+ copy.ExtractBigData(hashtable);
3485
+
3486
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3487
+ tab.graphs[tab.undoindex++] = Compress(copy);
3488
+
3489
+ copy.RestoreBigData(hashtable);
3490
+
3491
+ CameraPane.SWITCH = temp;
3492
+
3493
+ //assert(hashtable.isEmpty());
3494
+
3495
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3496
+ {
3497
+ tab.graphs[i] = null;
3498
+ }
3499
+
3500
+ // test save
3501
+ if (false)
3502
+ {
3503
+ try
3504
+ {
3505
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3506
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3507
+
3508
+ p.writeObject(copy);
3509
+
3510
+ p.flush();
3511
+
3512
+ ostream.close();
3513
+ } catch (Exception e)
3514
+ {
3515
+ e.printStackTrace();
3516
+ }
3517
+ }
3518
+ }
3519
+
3520
+ void CopyChanged(Object3D obj)
3521
+ {
3522
+ boolean temp = CameraPane.SWITCH;
3523
+ CameraPane.SWITCH = false;
3524
+
3525
+ copy.ExtractBigData(hashtable);
3526
+
3527
+ copy.clear();
3528
+
3529
+ for (int i=0; i<obj.Size(); i++)
3530
+ {
3531
+ copy.add(obj.get(i));
3532
+ }
3533
+
3534
+ copy.RestoreBigData(hashtable);
3535
+
3536
+ CameraPane.SWITCH = temp;
3537
+
3538
+ //assert(hashtable.isEmpty());
3539
+
3540
+ copy.Touch();
3541
+
3542
+ ResetModel();
3543
+ copy.HardTouch(); // recompile?
3544
+
3545
+ cRadio ab;
3546
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3547
+ {
3548
+ ab = (cRadio)e.nextElement();
3549
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3550
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3551
+ if (test != null)
3552
+ {
3553
+ test.editWindow = ab.object.editWindow;
3554
+ ab.object = test;
3555
+ }
3556
+ }
3557
+
3558
+ refreshContents();
3559
+ }
3560
+
3561
+ public void Undo()
3562
+ {
3563
+ System.err.println("Undo");
3564
+
3565
+ cRadio tab = GetCurrentTab();
3566
+
3567
+ if (tab.undoindex == 0)
3568
+ {
3569
+ java.awt.Toolkit.getDefaultToolkit().beep();
3570
+ return;
3571
+ }
3572
+
3573
+ if (tab.graphs[tab.undoindex] == null)
3574
+ {
3575
+ Save();
3576
+ tab.undoindex -= 1;
3577
+ }
3578
+
3579
+ tab.undoindex -= 1;
3580
+
3581
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3582
+ }
3583
+
3584
+ public void Redo()
3585
+ {
3586
+ cRadio tab = GetCurrentTab();
3587
+
3588
+ if (tab.graphs[tab.undoindex + 1] == null)
3589
+ {
3590
+ java.awt.Toolkit.getDefaultToolkit().beep();
3591
+ return;
3592
+ }
3593
+
3594
+ tab.undoindex += 1;
3595
+
3596
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3597
+ }
3598
+
3599
+ void ImportGFD()
3600
+ {
3601
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
32323602 browser.show();
32333603 String filename = browser.getFile();
32343604 if (filename != null && filename.length() > 0)
32353605 {
3236
- CameraPane.filename = browser.getDirectory() + filename;
3606
+ String fullname = browser.getDirectory() + filename;
3607
+
3608
+ //Object3D readobj =
3609
+ objEditor.ReadGFD(fullname, objEditor);
3610
+ //makeSomething(readobj);
3611
+ }
3612
+ }
3613
+
3614
+ void ImportVRMLX3D()
3615
+ {
3616
+ if (Grafreed.standAlone)
3617
+ {
3618
+ /**/
3619
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3620
+ browser.show();
3621
+ String filename = browser.getFile();
3622
+ if (filename != null && filename.length() > 0)
3623
+ {
3624
+ String fullname = browser.getDirectory() + filename;
3625
+ LoadVRMLX3D(fullname);
3626
+ }
3627
+ /**/
3628
+ }
3629
+ }
3630
+
3631
+ void ToggleAnimation()
3632
+ {
3633
+ if (!Globals.ANIMATION)
3634
+ {
3635
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3636
+ browser.setVisible(true);
3637
+ String filename = browser.getFile();
3638
+ if (filename != null && filename.length() > 0)
3639
+ {
3640
+ Globals.filename = browser.getDirectory() + filename;
32373641 //CameraPane.framecount = 0;
3238
- CameraPane.imagecount = 0;
3642
+ Globals.imagecount = 0;
32393643
3240
- CameraPane.ANIMATION ^= true;
3644
+ Globals.ANIMATION ^= true;
32413645
3242
- GrafreeD.wav.cursor = 0;
3243
- GrafreeD.wav.loop = 0;
3646
+ Grafreed.wav.cursor = 0;
3647
+ Grafreed.wav.loop = 0;
32443648 }
32453649 } else
32463650 {
3247
- CameraPane.ANIMATION ^= true;
3651
+ Globals.ANIMATION ^= true;
32483652 }
32493653 }
32503654
....@@ -3290,7 +3694,7 @@
32903694 void CreateMaterial()
32913695 {
32923696 //copy.ClearMaterial(); // PATCH
3293
- copy.CreateMaterialS(multiplyToggle.isSelected());
3697
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32943698 if (copy.selection.size() > 0)
32953699 //SetMaterial(copy);
32963700 {
....@@ -3341,7 +3745,7 @@
33413745 assert false;
33423746 }
33433747
3344
- void EditSelection()
3748
+ void EditSelection(boolean newWindow)
33453749 {
33463750 }
33473751
....@@ -3349,11 +3753,11 @@
33493753 {
33503754 copy.ResetBlockLoop(); // temporary problem
33513755
3352
- boolean random = CameraPane.RANDOM;
3353
- CameraPane.RANDOM = false; // parse everything
3756
+ boolean random = CameraPane.SWITCH;
3757
+ CameraPane.SWITCH = false; // parse everything
33543758 copy.ResetDisplayList();
33553759 copy.HardTouch();
3356
- CameraPane.RANDOM = random;
3760
+ CameraPane.SWITCH = random;
33573761 }
33583762
33593763 // public void applySelf()
....@@ -3423,10 +3827,40 @@
34233827 current.fakedepth = (float) fakedepthField.getFloat();
34243828 current.shadowbias = (float) shadowbiasField.getFloat();
34253829
3426
- if (!NumberSlider.frozen)
3830
+ if (!cNumberSlider.frozen)
34273831 {
34283832 //System.out.println("Propagate = " + propagate);
34293833 copy.UpdateMaterial(anchor, current, propagate);
3834
+
3835
+ if (copy.material != null)
3836
+ {
3837
+ cMaterial mat = copy.material;
3838
+
3839
+ colorField.SetToolTipValue((mat.color));
3840
+ modulationField.SetToolTipValue((mat.modulation));
3841
+ metalnessField.SetToolTipValue((mat.metalness));
3842
+ diffuseField.SetToolTipValue((mat.diffuse));
3843
+ specularField.SetToolTipValue((mat.specular));
3844
+ shininessField.SetToolTipValue((mat.shininess));
3845
+ shiftField.SetToolTipValue((mat.shift));
3846
+ ambientField.SetToolTipValue((mat.ambient));
3847
+ lightareaField.SetToolTipValue((mat.lightarea));
3848
+ diffusenessField.SetToolTipValue((mat.factor));
3849
+ velvetField.SetToolTipValue((mat.velvet));
3850
+ sheenField.SetToolTipValue((mat.sheen));
3851
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3852
+ backlitField.SetToolTipValue((mat.bump));
3853
+ anisoField.SetToolTipValue((mat.aniso));
3854
+ anisoVField.SetToolTipValue((mat.anisoV));
3855
+ cameraField.SetToolTipValue((mat.cameralight));
3856
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3857
+ shadowField.SetToolTipValue((mat.shadow));
3858
+ textureField.SetToolTipValue((mat.texture));
3859
+ opacityField.SetToolTipValue((mat.opacity));
3860
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3861
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3862
+ }
3863
+
34303864 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34313865 {
34323866 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3471,6 +3905,7 @@
34713905 || e.getSource() == apertureField
34723906 || e.getSource() == shadowblurField)
34733907 {
3908
+ new Exception().printStackTrace();
34743909 System.exit(0);
34753910 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34763911 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3497,7 +3932,13 @@
34973932 //System.out.println("PARENT = " + parent);
34983933 //if (parent != null)
34993934 // parent.applySelf();
3500
- refreshContents();
3935
+ if (e.getSource() == normalpushField)
3936
+ {
3937
+ objEditor.refreshContents();
3938
+ //Refresh();
3939
+ }
3940
+ else
3941
+ refreshContents();
35013942 // ??? client.refreshEditWindow();
35023943 }
35033944 //else
....@@ -3509,7 +3950,7 @@
35093950 //group.name = nameField.getText();
35103951 //objEditor.applySelf();
35113952
3512
- assert (objEditor == this);
3953
+ // OCT2018: assert (objEditor == this);
35133954 if (copy.selection == null || copy.selection.size() == 0)
35143955 //super.applySelf()
35153956 ; else
....@@ -3533,12 +3974,18 @@
35333974 objEditor.copy = keep;
35343975 }
35353976 }
3977
+
3978
+ if (normalpushField != null)
3979
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35363980 }
35373981
35383982 void SnapObject()
35393983 {
3540
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3541
- SnapObject(obj);
3984
+ if (copy.selection.size() > 0)
3985
+ {
3986
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3987
+ SnapObject(obj);
3988
+ }
35423989 }
35433990
35443991 void SnapObject(Object3D obj)
....@@ -3652,7 +4099,7 @@
36524099
36534100 if (obj.parent != null)
36544101 {
3655
- obj.parent.TransformToWorld(interest);
4102
+// obj.parent.TransformToWorld(interest);
36564103 }
36574104
36584105 if (!CameraPane.TRACK)
....@@ -3784,7 +4231,7 @@
37844231
37854232 radioPanel.revalidate();
37864233 radioPanel.repaint();
3787
- ctrlPanel.revalidate(); // ? new
4234
+ ctrlPanel.validate(); // ? new
37884235 ctrlPanel.repaint();
37894236 }
37904237 }
....@@ -3793,6 +4240,8 @@
37934240
37944241 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37954242 {
4243
+ if (Globals.SAVEONMAKE) // && resetmodel)
4244
+ Save();
37964245 //Tween.set(thing, 0).target(1).start(tweenManager);
37974246 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37984247 // if (thing instanceof GenericJointDemo)
....@@ -3879,6 +4328,12 @@
38794328 {
38804329 ResetModel();
38814330 Select(thing.GetTreePath(), true, false); // unselect... false);
4331
+
4332
+ if (thing.Size() == 0)
4333
+ {
4334
+ //EditSelection(false);
4335
+ }
4336
+
38824337 refreshContents();
38834338 }
38844339
....@@ -3996,6 +4451,7 @@
39964451 }
39974452 }
39984453 }
4454
+
39994455 LoadGFDThread loadGFDThread;
40004456
40014457 void ReadGFD(String fullname, iCallBack cb)
....@@ -4015,8 +4471,10 @@
40154471
40164472 try
40174473 {
4474
+ // Try compressed version first.
40184475 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4019
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4476
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4477
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40204478
40214479 readobj = (Object3D) p.readObject();
40224480 istream.close();
....@@ -4024,7 +4482,20 @@
40244482 readobj.ResetDisplayList();
40254483 } catch (Exception e)
40264484 {
4027
- e.printStackTrace();
4485
+ //e.printStackTrace();
4486
+ try
4487
+ {
4488
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4489
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4490
+
4491
+ readobj = (Object3D) p.readObject();
4492
+ istream.close();
4493
+
4494
+ readobj.ResetDisplayList();
4495
+ } catch (Exception e2)
4496
+ {
4497
+ e2.printStackTrace();
4498
+ }
40284499 }
40294500 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40304501 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4070,6 +4541,12 @@
40704541
40714542 void LoadIt(Object obj)
40724543 {
4544
+ if (obj == null)
4545
+ {
4546
+ // Invalid file
4547
+ return;
4548
+ }
4549
+
40734550 System.out.println("Loaded " + obj);
40744551 //new Exception().printStackTrace();
40754552 Object3D readobj = (Object3D) obj;
....@@ -4079,6 +4556,8 @@
40794556
40804557 if (readobj != null)
40814558 {
4559
+ if (Globals.SAVEONMAKE)
4560
+ Save();
40824561 try
40834562 {
40844563 //readobj.deepCopySelf(copy);
....@@ -4141,7 +4620,7 @@
41414620
41424621 void load() // throws ClassNotFoundException
41434622 {
4144
- if (GrafreeD.standAlone)
4623
+ if (Grafreed.standAlone)
41454624 {
41464625 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41474626 browser.show();
....@@ -4228,11 +4707,13 @@
42284707 try
42294708 {
42304709 FileOutputStream ostream = new FileOutputStream(lastname);
4231
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4710
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4711
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42324712
42334713 p.writeObject(copy);
42344714 p.flush();
42354715
4716
+ zstream.close();
42364717 ostream.close();
42374718
42384719 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4242,11 +4723,12 @@
42424723 {
42434724 }
42444725 }
4726
+
42454727 String lastname;
42464728
42474729 void saveAs()
42484730 {
4249
- if (GrafreeD.standAlone)
4731
+ if (Grafreed.standAlone)
42504732 {
42514733 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42524734 browser.setVisible(true);
....@@ -4351,13 +4833,13 @@
43514833 try
43524834 {
43534835 FileOutputStream ostream = new FileOutputStream(filename);
4354
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4355
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4836
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4837
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43564838
43574839 Object3D objectparent = obj.parent;
43584840 obj.parent = null;
43594841
4360
- Object3D object = (Object3D) GrafreeD.clone(obj);
4842
+ Object3D object = (Object3D) Grafreed.clone(obj);
43614843
43624844 obj.parent = objectparent;
43634845
....@@ -4369,8 +4851,8 @@
43694851 p.writeObject(object);
43704852 p.flush();
43714853
4854
+ zstream.close();
43724855 ostream.close();
4373
- // zstream.close();
43744856
43754857 // group.selection.get(0).parent = parent;
43764858 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4391,7 +4873,7 @@
43914873 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43924874 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43934875 copy.generatePOV(buffer);
4394
- if (GrafreeD.standAlone)
4876
+ if (Grafreed.standAlone)
43954877 {
43964878 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43974879 browser.show();
....@@ -4417,7 +4899,8 @@
44174899 Object3D client;
44184900 Object3D copy;
44194901 MenuBar menuBar;
4420
- Menu windowMenu;
4902
+ Menu fileMenu;
4903
+ MenuItem newItem;
44214904 MenuItem loadItem;
44224905 MenuItem saveItem;
44234906 MenuItem saveAsItem;
....@@ -4425,45 +4908,58 @@
44254908 MenuItem reexportItem;
44264909 MenuItem povItem;
44274910 MenuItem closeItem;
4428
- Menu cameraMenu;
4911
+
44294912 CheckboxMenuItem zBufferItem;
44304913 //MenuItem normalLensItem;
4431
- MenuItem editCameraItem;
4432
- MenuItem revertCameraItem;
4433
- CheckboxMenuItem toggleLiveItem;
44344914 MenuItem stepItem;
4435
- CheckboxMenuItem toggleFullItem;
4915
+ CheckboxMenuItem toggleLiveItem;
4916
+ CheckboxMenuItem toggleFullScreenItem;
4917
+ CheckboxMenuItem toggleTimelineItem;
44364918 CheckboxMenuItem toggleRenderItem;
44374919 CheckboxMenuItem toggleDebugItem;
44384920 CheckboxMenuItem toggleFrustumItem;
44394921 CheckboxMenuItem toggleFootContactItem;
44404922 CheckboxMenuItem toggleDLItem;
44414923 CheckboxMenuItem toggleTextureItem;
4442
- CheckboxMenuItem toggleRandomItem;
4924
+ CheckboxMenuItem toggleSwitchItem;
44434925 CheckboxMenuItem toggleRootItem;
44444926 CheckboxMenuItem animationItem;
44454927 CheckboxMenuItem toggleHandleItem;
44464928 CheckboxMenuItem togglePaintItem;
44474929 JSplitPane mainPanel;
44484930 JScrollPane scrollpane;
4931
+
44494932 JPanel toolbarPanel;
4450
- JPanel treePanel;
4933
+
4934
+ cGridBag treePanel;
4935
+
44514936 JPanel radioPanel;
44524937 ButtonGroup buttonGroup;
4453
- JPanel ctrlPanel;
4454
- JPanel materialPanel;
4938
+
4939
+ cGridBag toolboxPanel;
4940
+ cGridBag materialPanel;
4941
+ cGridBag ctrlPanel;
4942
+
44554943 JScrollPane infoPanel;
4456
- JPanel optionsPanel;
4944
+
4945
+ cGridBag optionsPanel;
4946
+
44574947 JTabbedPane objectPanel;
4458
- JPanel XYZPanel;
4948
+
4949
+ cGridBag XYZPanel;
4950
+
44594951 JSplitPane gridPanel;
44604952 JSplitPane bigPanel;
4461
- JPanel bigThree;
4462
- JTabbedPane jtp;
4463
- JPanel cameraPanel;
4953
+
4954
+ cGridBag bigThree;
4955
+ cGridBag scenePanel;
4956
+ cGridBag centralPanel;
4957
+ JSplitPane cameraPanel;
4958
+ JPanel timelinePanel;
4959
+ JMenuBar timelineMenubar;
44644960 JSplitPane framePanel;
44654961 JTextArea/*Field*/ nameField;
4466
- cButton textureButton;
4962
+ //cButton textureButton;
44674963 cButton okButton;
44684964 cButton applyButton;
44694965 cButton cancelButton;
....@@ -4510,65 +5006,72 @@
45105006 // MATERIAL
45115007 JLabel materialLabel;
45125008 JLabel colorLabel;
4513
- NumberSlider colorField;
5009
+ cNumberSlider colorField;
45145010 JLabel modulationLabel;
4515
- NumberSlider modulationField;
5011
+ cNumberSlider modulationField;
45165012 JLabel metalnessLabel;
4517
- NumberSlider metalnessField;
5013
+ cNumberSlider metalnessField;
45185014 JLabel diffuseLabel;
4519
- NumberSlider diffuseField;
5015
+ cNumberSlider diffuseField;
45205016 JLabel specularLabel;
4521
- NumberSlider specularField;
5017
+ cNumberSlider specularField;
45225018 JLabel shininessLabel;
4523
- NumberSlider shininessField;
5019
+ cNumberSlider shininessField;
45245020 JLabel shiftLabel;
4525
- NumberSlider shiftField;
5021
+ cNumberSlider shiftField;
45265022 JLabel ambientLabel;
4527
- NumberSlider ambientField;
5023
+ cNumberSlider ambientField;
45285024 JLabel lightareaLabel;
4529
- NumberSlider lightareaField;
5025
+ cNumberSlider lightareaField;
45305026 JLabel diffusenessLabel;
4531
- NumberSlider diffusenessField;
5027
+ cNumberSlider diffusenessField;
45325028 JLabel velvetLabel;
4533
- NumberSlider velvetField;
5029
+ cNumberSlider velvetField;
45345030 JLabel sheenLabel;
4535
- NumberSlider sheenField;
5031
+ cNumberSlider sheenField;
45365032 JLabel subsurfaceLabel;
4537
- NumberSlider subsurfaceField;
5033
+ cNumberSlider subsurfaceField;
45385034 //JLabel bumpLabel;
45395035 //NumberSlider bumpField;
45405036 JLabel backlitLabel;
4541
- NumberSlider backlitField;
5037
+ cNumberSlider backlitField;
45425038 JLabel anisoLabel;
4543
- NumberSlider anisoField;
5039
+ cNumberSlider anisoField;
45445040 JLabel anisoVLabel;
4545
- NumberSlider anisoVField;
5041
+ cNumberSlider anisoVField;
45465042 JLabel cameraLabel;
4547
- NumberSlider cameraField;
5043
+ cNumberSlider cameraField;
45485044 JLabel selfshadowLabel;
4549
- NumberSlider selfshadowField;
5045
+ cNumberSlider selfshadowField;
45505046 JLabel shadowLabel;
4551
- NumberSlider shadowField;
5047
+ cNumberSlider shadowField;
45525048 JLabel textureLabel;
4553
- NumberSlider textureField;
5049
+ cNumberSlider textureField;
45545050 JLabel opacityLabel;
4555
- NumberSlider opacityField;
5051
+ cNumberSlider opacityField;
45565052 JLabel fakedepthLabel;
4557
- NumberSlider fakedepthField;
5053
+ cNumberSlider fakedepthField;
45585054 JLabel shadowbiasLabel;
4559
- NumberSlider shadowbiasField;
5055
+ cNumberSlider shadowbiasField;
45605056 JLabel bumpLabel;
4561
- NumberSlider bumpField;
5057
+ cNumberSlider bumpField;
45625058 JLabel noiseLabel;
4563
- NumberSlider noiseField;
5059
+ cNumberSlider noiseField;
45645060 JLabel powerLabel;
4565
- NumberSlider powerField;
5061
+ cNumberSlider powerField;
45665062 JLabel borderfadeLabel;
4567
- NumberSlider borderfadeField;
5063
+ cNumberSlider borderfadeField;
45685064 JLabel fogLabel;
4569
- NumberSlider fogField;
5065
+ cNumberSlider fogField;
45705066 JLabel opacityPowerLabel;
4571
- NumberSlider opacityPowerField;
4572
- JTree jTree;
5067
+ cNumberSlider opacityPowerField;
5068
+ cTree jTree;
45735069 //ObjectUI parent;
5070
+
5071
+ cNumberSlider normalpushField;
5072
+
5073
+ private MenuItem importGFDItem;
5074
+ private MenuItem importVRMLX3DItem;
5075
+ private MenuItem import3DSItem;
5076
+ private MenuItem importOBJItem;
45745077 }