Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
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);
139207
140
- if (!GroupEditor.allparams)
208
+ objEditor.ctrlPanel.remove(namePanel);
209
+
210
+ if (!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;
....@@ -256,27 +337,48 @@
256337 return frame.action(event, obj);
257338 }
258339
340
+ // Cannot work without static
341
+ static boolean allparams = true;
342
+
343
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
344
+
259345 void SetupMenu()
260346 {
261347 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..."));
348
+ menuBar.add(fileMenu = new Menu("File"));
349
+ fileMenu.add(newItem = new MenuItem("New"));
350
+ fileMenu.add(loadItem = new MenuItem("Open..."));
351
+
352
+ //oe.menuBar.add(menu = new Menu("Include"));
353
+ Menu menu = new Menu("Import");
354
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
355
+ importOBJItem.addActionListener(this);
356
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
357
+ import3DSItem.addActionListener(this);
358
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
359
+ importVRMLX3DItem.addActionListener(this);
360
+ menu.add("-");
361
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
362
+ importGFDItem.addActionListener(this);
363
+ fileMenu.add(menu);
364
+ fileMenu.add("-");
365
+
366
+ fileMenu.add(saveItem = new MenuItem("Save"));
367
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267368 //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("-");
369
+ fileMenu.add("-");
370
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
371
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
372
+ fileMenu.add("-");
272373 if (client.parent != null)
273374 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
375
+ fileMenu.add(closeItem = new MenuItem("Close"));
275376 } else
276377 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
378
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278379 }
279380
381
+ newItem.addActionListener(this);
280382 loadItem.addActionListener(this);
281383 saveItem.addActionListener(this);
282384 saveAsItem.addActionListener(this);
....@@ -285,77 +387,64 @@
285387 //povItem.addActionListener(this);
286388 closeItem.addActionListener(this);
287389
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
-
341390 objectPanel = new JTabbedPane();
391
+
392
+ ChangeListener changeListener = new ChangeListener()
393
+ {
394
+ public void stateChanged(ChangeEvent changeEvent)
395
+ {
396
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
397
+// {
398
+// if (latestObject != null)
399
+// {
400
+// refreshContents(true);
401
+// SetMaterial(latestObject);
402
+// }
403
+//
404
+// materialFlushed = true;
405
+// }
406
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
407
+// {
408
+// if (listUI.size() == 0)
409
+// EditSelection(false);
410
+// }
411
+
412
+ refreshContents(false); // To refresh Info tab
413
+ }
414
+ };
415
+ objectPanel.addChangeListener(changeListener);
416
+
342417 toolbarPanel = new JPanel();
343418 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
419
+ treePanel = new cGridBag();
345420 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
421
+
422
+ editPanel = new cGridBag().setVertical(true);
423
+ editPanel.setName("Edit");
424
+
425
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
426
+
427
+ editCommandsPanel = new cGridBag();
428
+ editPanel.add(editCommandsPanel);
429
+ editPanel.add(ctrlPanel);
430
+
431
+ toolboxPanel = new cGridBag().setVertical(false);
432
+ toolboxPanel.setName("Toolbox");
433
+
434
+ materialPanel = new cGridBag().setVertical(true);
349435 materialPanel.setName("Material");
436
+
350437 /*JTextPane*/
351438 infoarea = createTextPane();
439
+ doc = infoarea.getStyledDocument();
440
+
352441 infoarea.setEditable(true);
353442 SetText();
354443 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355444 // infoarea.setOpaque(false);
356445 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
446
+// TEXTAREA infoarea.setLineWrap(true);
447
+// TEXTAREA infoarea.setWrapStyleWord(true);
359448 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360449 infoPanel.setPreferredSize(new Dimension(50, 200));
361450 infoPanel.setName("Info");
....@@ -366,16 +455,16 @@
366455 mainPanel.setName("Main");
367456 mainPanel.setContinuousLayout(true);
368457 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370458 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
459
+ mainPanel.setDividerLocation(0.5); //1.0);
460
+ mainPanel.setResizeWeight(0.5);
372461
373462 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374463 //mainPanel.setLayout(new GridBagLayout());
375464 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
465
+// treePanel.setLayout(new GridBagLayout());
466
+ //ctrlPanel.setLayout(new GridBagLayout());
467
+ //materialPanel.setLayout(new GridBagLayout());
379468
380469 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381470 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +503,7 @@
414503 static String newline = "\n";
415504 protected static final String buttonString = "JButton";
416505 StyledDocument doc;
417
- JTextArea infoarea;
506
+ JTextPane infoarea;
418507
419508 void ClearInfo()
420509 {
....@@ -437,10 +526,10 @@
437526 e.printStackTrace();
438527 }
439528
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();
529
+// String selection = infoarea.getText();
530
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
531
+// java.awt.datatransfer.Clipboard clipboard =
532
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444533 //clipboard.setContents(data, data);
445534 }
446535
....@@ -463,13 +552,13 @@
463552 //SendInfo("Name:", "bold");
464553 if (sel.GetTextures() != null || debug)
465554 {
466
- si.SendInfo(sel.toString(), "bold");
555
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467556 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468557 if (sel.Size() > 0)
469558 {
470559 si.SendInfo("#children = " + sel.Size(), "regular");
471560 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
561
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473562 if (debug)
474563 {
475564 try
....@@ -481,7 +570,10 @@
481570 }
482571
483572 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
573
+ {
574
+ si.SendInfo(" BBox min: " + minima, "regular");
575
+ si.SendInfo(" BBox max: " + maxima, "regular");
576
+ }
485577
486578 if (sel.bRep != null)
487579 {
....@@ -508,7 +600,7 @@
508600 }
509601 if (sel.support != null)
510602 {
511
- si.SendInfo(" support: " + sel.support, "regular");
603
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512604 }
513605 if (sel.scriptnode != null)
514606 {
....@@ -522,18 +614,18 @@
522614 maxima.y = sel.toParent[3][1];
523615 maxima.z = sel.toParent[3][2];
524616 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");
530617 maxima.x = sel.toParent[0][0];
531618 maxima.y = sel.toParent[1][1];
532619 maxima.z = sel.toParent[2][2];
533620 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];
621
+ maxima.x = sel.globalTransform[3][0];
622
+ maxima.y = sel.globalTransform[3][1];
623
+ maxima.z = sel.globalTransform[3][2];
624
+ if (full)
625
+ si.SendInfo(" Global Orig: " + maxima, "regular");
626
+ maxima.x = sel.globalTransform[0][0];
627
+ maxima.y = sel.globalTransform[1][1];
628
+ maxima.z = sel.globalTransform[2][2];
537629 if (full)
538630 si.SendInfo(" Global Scale: " + maxima, "regular");
539631 }
....@@ -579,6 +671,9 @@
579671 {
580672 CameraPane.pointflow = (PointFlow) sel;
581673 }
674
+
675
+ si.SendInfo("_____________________", "regular");
676
+ si.SendInfo("", "regular");
582677 }
583678 }
584679
....@@ -594,52 +689,140 @@
594689 }
595690 }
596691
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
- };
692
+static GraphicsDevice device = GraphicsEnvironment
693
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
614694
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
695
+ Rectangle keeprect;
696
+ cRadio radio;
697
+
698
+cButton keepButton;
699
+ cButton twoButton; // Full 3D
700
+ cButton sixButton;
701
+ cButton threeButton;
702
+ cButton sevenButton;
703
+ cButton fourButton; // full panel
704
+ cButton oneButton; // full XYZ
705
+ //cButton currentLayout;
706
+
707
+ boolean maximized;
708
+
709
+ cButton fullscreenLayout;
621710
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
711
+ void Minimize()
628712 {
629
- for (int j = 0; j < 2; j++)
713
+ frame.setState(Frame.ICONIFIED);
714
+ }
715
+
716
+ void Maximize()
717
+ {
718
+ if (maximized)
630719 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
720
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
636721 }
637
- } catch (BadLocationException ble)
722
+ else
723
+ {
724
+ keeprect = frame.getBounds();
725
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
726
+ Dimension rect2 = frame.getToolkit().getScreenSize();
727
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
728
+// frame.setState(Frame.MAXIMIZED_BOTH);
729
+ }
730
+
731
+ maximized ^= true;
732
+ }
733
+
734
+ void ToggleFullScreen()
638735 {
639
- System.err.println("Couldn't insert initial text into text pane.");
736
+ cameraView.ToggleFullScreen();
737
+
738
+ if (!CameraPane.FULLSCREEN)
739
+ {
740
+ device.setFullScreenWindow(null);
741
+ //frame.setVisible(false);
742
+// frame.removeNotify();
743
+// frame.setUndecorated(false);
744
+// frame.addNotify();
745
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
746
+
747
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
748
+// X framePanel.add(bigThree);
749
+// X frame.getContentPane().add(/*"Center",*/framePanel);
750
+ framePanel.setDividerLocation(1);
751
+
752
+ //frame.setVisible(true);
753
+ radio.layout = keepButton;
754
+ //theFrame = null;
755
+ keepButton = null;
756
+ radio.layout.doClick();
757
+
758
+ } else
759
+ {
760
+ keepButton = radio.layout;
761
+ //keeprect = frame.getBounds();
762
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
763
+// frame.getToolkit().getScreenSize().height);
764
+ //frame.setVisible(false);
765
+ device.setFullScreenWindow(frame);
766
+// frame.removeNotify();
767
+// frame.setUndecorated(true);
768
+// frame.addNotify();
769
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
770
+// X framePanel.remove(bigThree);
771
+// X frame.getContentPane().add(/*"Center",*/bigThree);
772
+ framePanel.setDividerLocation(0);
773
+
774
+ radio.layout = fullscreenLayout;
775
+ radio.layout.doClick();
776
+ //frame.setVisible(true);
777
+ }
640778 }
641779
642
- return new JTextArea(); // textPane;
780
+ private JTextPane createTextPane()
781
+ {
782
+// TEXTAREA String[] initString =
783
+// {
784
+// "This is an editable JTextPane, ", //regular
785
+// "another ", //italic
786
+// "styled ", //bold
787
+// "text ", //small
788
+// "component, ", //large
789
+// "which supports embedded components..." + newline,//regular
790
+// " " + newline, //button
791
+// "...and embedded icons..." + newline, //regular
792
+// " ", //icon
793
+// newline + "JTextPane is a subclass of JEditorPane that "
794
+// + "uses a StyledEditorKit and StyledDocument, and provides "
795
+// + "cover methods for interacting with those objects."
796
+// };
797
+//
798
+// String[] initStyles =
799
+// {
800
+// "regular", "italic", "bold", "small", "large",
801
+// "regular", "button", "regular", "icon",
802
+// "regular"
803
+// };
804
+//
805
+// JTextPane textPane = new JTextPane();
806
+// textPane.setEditable(true);
807
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
808
+// addStylesToDocument(doc);
809
+//
810
+// try
811
+// {
812
+// for (int j = 0; j < 2; j++)
813
+// {
814
+// for (int i = 0; i < initString.length; i++)
815
+// {
816
+// doc.insertString(doc.getLength(), initString[i],
817
+// doc.getStyle(initStyles[i]));
818
+// }
819
+// }
820
+// } catch (BadLocationException ble)
821
+// {
822
+// System.err.println("Couldn't insert initial text into text pane.");
823
+// }
824
+
825
+ return new JTextPane(); // textPane;
643826 }
644827
645828 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +875,7 @@
692875 protected static ImageIcon createImageIcon(String path,
693876 String description)
694877 {
695
- java.net.URL imgURL = GrafreeD.class.getResource(path);
878
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696879 if (imgURL != null)
697880 {
698881 return new ImageIcon(imgURL, description);
....@@ -724,6 +907,7 @@
724907 // NumberSlider vDivsField;
725908 // JCheckBox endcaps;
726909 JCheckBox liveCB;
910
+ JCheckBox selectCB;
727911 JCheckBox hideCB;
728912 JCheckBox link2masterCB;
729913 JCheckBox markCB;
....@@ -731,7 +915,12 @@
731915 JCheckBox speedupCB;
732916 JCheckBox rewindCB;
733917 JCheckBox flipVCB;
918
+
919
+ cCheckBox toggleTextureCB;
920
+ cCheckBox toggleSwitchCB;
921
+
734922 JComboBox texresMenu;
923
+
735924 JButton resetButton;
736925 JButton stepButton;
737926 JButton stepAllButton;
....@@ -739,115 +928,87 @@
739928 JButton slowerButton;
740929 JButton fasterButton;
741930 JButton remarkButton;
931
+
932
+ cGridBag editPanel;
933
+ cGridBag editCommandsPanel;
934
+
935
+ cGridBag namePanel;
936
+ cGridBag setupPanel;
937
+ cGridBag setupPanel2;
938
+ cGridBag objectCommandsPanel;
939
+ cGridBag pushPanel;
940
+ cGridBag fillPanel;
742941
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
942
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
744943 {
745944 JCheckBox cb;
746945
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);
946
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
752947 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
756948
757949 return cb;
758950 }
759951
760
- cButton AddButton(ObjEditor oe, String label)
952
+ cButton AddButton(cGridBag panel, String label)
761953 {
762954 cButton cb;
763955
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);
956
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
769957 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
773958
774959 return cb;
775960 }
776961
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
962
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
778963 {
779964 JComboBox combo;
780965
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;
966
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
784967 combo.addActionListener(this);
785968
786969 return combo;
787970 }
788971
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
972
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
790973 {
791
- NumberSlider combo;
974
+ cGridBag control = new cGridBag();
975
+
976
+ cNumberSlider combo;
792977
793978 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
796979 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
-
980
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
981
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
806982 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
983
+
984
+ panel.add(control);
985
+
986
+ return control;
813987 }
814988
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
989
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
816990 {
817
- NumberSlider combo;
991
+ cGridBag control = new cGridBag();
992
+
993
+ cNumberSlider combo;
818994
819995 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822996 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
-
997
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
998
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832999 combo.setInteger(current);
8331000
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1001
+ panel.add(control);
1002
+
1003
+ return control;
8391004 }
8401005
841
- JTextArea AddText(JPanel ctrlPanel, String name)
1006
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8421007 {
8431008 JTextArea text;
8441009
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1010
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8481011 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
8511012
8521013 return text;
8531014 }
....@@ -877,9 +1038,16 @@
8771038 objEditor.ctrlPanel.remove(j);
8781039 }
8791040
1041
+ void Remove(cNumberSlider j)
1042
+ {
1043
+ j.removeChangeListener(this);
1044
+ //objEditor.ctrlPanel.remove(j.label);
1045
+ objEditor.ctrlPanel.remove(j);
1046
+ }
1047
+
8801048 /*
8811049 */
882
- void Return() // ObjEditor oe)
1050
+ void Return0() // ObjEditor oe)
8831051 {
8841052 aConstraints.gridy += 1;
8851053 aConstraints.gridx = 0;
....@@ -934,35 +1102,77 @@
9341102
9351103 void SetupUI2(ObjEditor oe)
9361104 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1105
+ //SetupName(oe);
9421106
943
- if (!GroupEditor.allparams)
1107
+ namePanel = new cGridBag();
1108
+
1109
+ nameField = AddText(namePanel, copy.GetName());
1110
+ namePanel.add(nameField);
1111
+ oe.ctrlPanel.add(namePanel);
1112
+
1113
+ oe.ctrlPanel.Return();
1114
+
1115
+ if (!allparams)
9441116 return;
9451117
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1118
+ setupPanel = new cGridBag().setVertical(false);
1119
+
1120
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1121
+ liveCB.setToolTipText("Animate object");
1122
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1123
+ selectCB.setToolTipText("Make object selectable");
9491124 // 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");
1125
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1126
+ hideCB.setToolTipText("Hide object");
1127
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1128
+ markCB.setToolTipText("Set the animation target transform");
1129
+
1130
+ setupPanel2 = new cGridBag().setVertical(false);
1131
+
1132
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1133
+ rewindCB.setToolTipText("Rewind animation");
1134
+
1135
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1136
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1137
+
1138
+ if (Globals.ADVANCED)
1139
+ {
1140
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1141
+ link2masterCB.setToolTipText("Attach to support");
1142
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1143
+ speedupCB.setToolTipText("Option motion capture");
1144
+ }
1145
+
1146
+ oe.ctrlPanel.add(setupPanel);
1147
+ oe.ctrlPanel.Return();
1148
+ oe.ctrlPanel.add(setupPanel2);
1149
+ oe.ctrlPanel.Return();
1150
+
1151
+ objectCommandsPanel = new cGridBag().setVertical(false);
1152
+
1153
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1154
+ resetButton.setToolTipText("Jump to frame zero");
1155
+ stepButton = AddButton(objectCommandsPanel, "Step");
1156
+ stepButton.setToolTipText("Step one frame");
9561157 // resetAllButton = AddButton(oe, "Reset All");
9571158 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591159 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1160
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1161
+ slowerButton.setToolTipText("Decrease animation speed");
1162
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1163
+ fasterButton.setToolTipText("Increase animation speed");
1164
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1165
+ remarkButton.setToolTipText("Set the current transform as the target");
9631166
964
- Return();
1167
+ oe.ctrlPanel.add(objectCommandsPanel);
1168
+ oe.ctrlPanel.Return();
9651169
1170
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1171
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1172
+ //Return();
1173
+
1174
+ oe.ctrlPanel.Return();
1175
+
9661176 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671177 // ObjEditor.aConstraints.gridx += 1;
9681178
....@@ -1056,7 +1266,7 @@
10561266 oe.aConstraints.gridwidth = 1;
10571267 /**/
10581268 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1269
+ oe.ctrlPanel.Return();
10601270
10611271 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621272 //textureButton.setEnabled(false);
....@@ -1158,10 +1368,28 @@
11581368 //JPanel worldPanel =
11591369 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601370 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1371
+ centralPanel = new cGridBag();
1372
+ centralPanel.preferredWidth = 20;
1373
+
1374
+ if (Globals.ADVANCED)
1375
+ {
1376
+ timelinePanel = new JPanel(new BorderLayout());
1377
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641378
1379
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1380
+ cameraPanel.setContinuousLayout(true);
1381
+ cameraPanel.setOneTouchExpandable(true);
1382
+// cameraPanel.setDividerLocation(0.9);
1383
+// cameraPanel.setDividerSize(9);
1384
+ cameraPanel.setResizeWeight(1.0);
1385
+
1386
+ }
1387
+
1388
+ centralPanel.add(cameraView);
1389
+ centralPanel.setFocusable(true);
1390
+ //frame.setJMenuBar(timelineMenubar);
1391
+ //centralPanel.add(timelinePanel);
1392
+
11651393 //topView.camera = ;
11661394 //frontView.camera = new Camera(2);
11671395 //sideView.camera = new Camera(3);
....@@ -1177,12 +1405,13 @@
11771405 //frontView.object = copy;
11781406 //sideView.object = copy;
11791407
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1408
+ XYZPanel = new cGridBag().setVertical(true);
1409
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821410
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1411
+ XYZPanel.preferredWidth = 5;
1412
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1413
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1414
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861415
11871416 /*
11881417 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1420,7 @@
11911420 gridPanel.add(cameraView);
11921421 gridPanel.add(XYZPanel);
11931422 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1423
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951424 gridPanel.setContinuousLayout(true);
11961425 gridPanel.setOneTouchExpandable(true);
11971426 gridPanel.setDividerLocation(1.0);
....@@ -1220,11 +1449,13 @@
12201449 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211450 //tmp.setName("Edit");
12221451 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1452
+// JPanel north = new JPanel(new BorderLayout());
1453
+// north.setName("Edit");
1454
+// north.add(ctrlPanel, BorderLayout.NORTH);
1455
+// objectPanel.add(north);
1456
+ objectPanel.add(editPanel);
12271457 objectPanel.add(infoPanel);
1458
+ objectPanel.add(toolboxPanel);
12281459
12291460 /*
12301461 aConstraints.gridx = 0;
....@@ -1233,7 +1464,7 @@
12331464 aConstraints.gridy += 1;
12341465 aConstraints.gridwidth = 1;
12351466 mainPanel.add(objectPanel, aConstraints);
1236
- */
1467
+ */
12371468
12381469 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12391470 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1244,16 +1475,23 @@
12441475 scrollpane.setWheelScrollingEnabled(true);
12451476 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461477
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1478
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1479
+ scenePanel.preferredWidth = 6;
1480
+
1481
+ JTabbedPane tabbedPane = new JTabbedPane();
1482
+ tabbedPane.add(scrollpane);
12491483
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1251
-
1252
- optionsPanel = new JPanel(new GridBagLayout());
1484
+ optionsPanel = new cGridBag().setVertical(false);
12531485
12541486 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1487
+
1488
+ AddOptions(optionsPanel); //, aConstraints);
1489
+
1490
+ tabbedPane.add(optionsPanel);
1491
+
1492
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12561493
1494
+ scenePanel.add(tabbedPane);
12571495
12581496 /*
12591497 cTree jTree = new cTree(null);
....@@ -1275,7 +1513,7 @@
12751513 jtp.add(tree);
12761514 */
12771515
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1516
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791517 bigPanel.setContinuousLayout(true);
12801518 bigPanel.setOneTouchExpandable(true);
12811519 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1525,7 @@
12871525 //bigPanel.setSize(new Dimension(10,10));
12881526 //bigPanel.add(ctrlPanel);
12891527 //bigPanel.add(gridPanel);
1528
+ /**
12901529 bigThree = new JPanel();
12911530 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921531 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1536,26 @@
12971536 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981537 aWindowConstraints.weightx = 0;
12991538 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1539
+ bigThree.add(scenePanel, aWindowConstraints);
13011540 aWindowConstraints.weightx = 1;
13021541 aWindowConstraints.gridwidth = 3;
13031542 // aConstraints.gridheight = 3;
13041543 aWindowConstraints.gridx = 1;
13051544 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1545
+ bigThree.add(centralPanel, aWindowConstraints);
13071546 aWindowConstraints.weightx = 0;
13081547 aWindowConstraints.gridx = 4;
13091548 aWindowConstraints.gridwidth = 1;
13101549 // aConstraints.gridheight = 3;
13111550 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121551 bigThree.add(XYZPanel, aWindowConstraints);
1552
+ /**/
13131553
1554
+ bigThree = new cGridBag();
1555
+ bigThree.addComponent(scenePanel);
1556
+ bigThree.addComponent(centralPanel);
1557
+ bigThree.addComponent(XYZPanel);
1558
+
13141559 // // SIDE EFFECT!!!
13151560 // aConstraints.gridx = 0;
13161561 // aConstraints.gridy = 0;
....@@ -1331,14 +1576,19 @@
13311576 //worldPane.add(bigPanel);
13321577 //worldPane.add(worldPanel);
13331578 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1579
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1580
+ frame.add(/*"Center",*/framePanel);
13351581 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361582
13371583 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381584
1339
- frame.setSize(1024, 768);
1340
- frame.show();
1585
+ frame.setSize(1280, 860);
1586
+
1587
+ frame.validate();
1588
+ frame.setVisible(true);
13411589
1590
+ cameraView.requestFocusInWindow();
1591
+
13421592 gridPanel.setDividerLocation(1.0);
13431593
13441594 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1352,6 +1602,10 @@
13521602 });
13531603 }
13541604
1605
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1606
+ {
1607
+ }
1608
+
13551609 JTree GetTree()
13561610 {
13571611 return objEditor.jTree;
....@@ -1363,260 +1617,173 @@
13631617 ctrlPanel.removeAll();
13641618 }
13651619
1366
- void SetupMaterial(JPanel ctrlPanel)
1620
+ void SetupMaterial(cGridBag panel)
13671621 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1622
+ /*
13711623 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721624 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751625 */
13761626
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1627
+ cGridBag editBar = new cGridBag().setVertical(false);
1628
+
1629
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1630
+ createMaterialButton.setToolTipText("Create material");
13821631
13831632 /*
13841633 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881634 */
13891635
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1636
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1637
+ clearMaterialButton.setToolTipText("Clear material");
1638
+
1639
+ if (Globals.ADVANCED)
1640
+ {
1641
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1642
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1643
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1644
+ }
13921645
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;
1646
+ editBar.preferredHeight = 15;
1647
+
1648
+ panel.add(editBar);
1649
+
14071650 /**/
14081651 //aConstraints.weighty = 0;
14091652 ////aConstraints.weightx = 1;
14101653 //aConstraints.weighty = 1;
14111654 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121655 //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;
1656
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181657
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;
1658
+ cGridBag colorSection = new cGridBag().setVertical(true);
1659
+
1660
+ cGridBag color = new cGridBag();
1661
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1662
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1663
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1664
+ //colorField.preferredWidth = 200;
1665
+ colorSection.add(color);
14291666
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;
1667
+ cGridBag modulation = new cGridBag();
1668
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1669
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1670
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1671
+ colorSection.add(modulation);
14391672
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;
1673
+ cGridBag texture = new cGridBag();
1674
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1675
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1676
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1677
+ colorSection.add(texture);
14491678
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;
1679
+ cGridBag anisoU = new cGridBag();
1680
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1681
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1683
+ colorSection.add(anisoU);
14591684
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;
1685
+ cGridBag anisoV = new cGridBag();
1686
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1687
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1689
+ colorSection.add(anisoV);
14691690
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;
1691
+ cGridBag shadowbias = new cGridBag();
1692
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1693
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1694
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1695
+ colorSection.add(shadowbias);
14791696
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;
1697
+ panel.add(new JSeparator());
1698
+
1699
+ panel.add(colorSection);
1700
+
1701
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1702
+
1703
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1704
+
1705
+ cGridBag diffuse = new cGridBag();
1706
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1707
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1709
+ diffuseSection.add(diffuse);
14881710
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;
1711
+ cGridBag diffuseness = new cGridBag();
1712
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1713
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1714
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1715
+ diffuseSection.add(diffuseness);
14981716
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;
1717
+ cGridBag selfshadow = new cGridBag();
1718
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1719
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1720
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1721
+ diffuseSection.add(selfshadow);
15081722
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;
1723
+ cGridBag sheen = new cGridBag();
1724
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1725
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1726
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1727
+ diffuseSection.add(sheen);
15181728
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;
1729
+ cGridBag subsurface = new cGridBag();
1730
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1731
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1733
+ diffuseSection.add(subsurface);
15281734
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;
1735
+ cGridBag shadow = new cGridBag();
1736
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1737
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1738
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1739
+ diffuseSection.add(shadow);
15381740
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;
1741
+ cGridBag fakedepth = new cGridBag();
1742
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1743
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1744
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1745
+ diffuseSection.add(fakedepth);
15481746
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;
1747
+ panel.add(new JSeparator());
1748
+
1749
+ panel.add(diffuseSection);
1750
+
1751
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1752
+
1753
+ cGridBag specularSection = new cGridBag().setVertical(true);
15581754
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;
1755
+ cGridBag specular = new cGridBag();
1756
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1757
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1758
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1759
+ specularSection.add(specular);
15671760
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;
1761
+ cGridBag lightarea = new cGridBag();
1762
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1763
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1764
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1765
+ specularSection.add(lightarea);
15771766
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;
1767
+ cGridBag shininess = new cGridBag();
1768
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1769
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1771
+ specularSection.add(shininess);
15871772
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;
1773
+ cGridBag metalness = new cGridBag();
1774
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1775
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1776
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1777
+ specularSection.add(metalness);
15971778
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;
1779
+ cGridBag velvet = new cGridBag();
1780
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1781
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1782
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1783
+ specularSection.add(velvet);
16071784
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();
1785
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1786
+ //Return();
16201787 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211788 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221789 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1794,93 @@
16271794 // aConstraints.gridy += 1;
16281795 // aConstraints.gridwidth = 1;
16291796
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;
16381797
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;
1798
+ panel.add(new JSeparator());
1799
+
1800
+ panel.add(specularSection);
1801
+
1802
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1803
+
1804
+ cGridBag globalSection = new cGridBag().setVertical(true);
16481805
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;
1806
+ cGridBag camera = new cGridBag();
1807
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1808
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1809
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1810
+ globalSection.add(camera);
16581811
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;
1812
+ cGridBag ambient = new cGridBag();
1813
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1814
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1815
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1816
+ globalSection.add(ambient);
16681817
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;
1818
+ cGridBag backlit = new cGridBag();
1819
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1820
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1821
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1822
+ globalSection.add(backlit);
16791823
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;
1824
+ cGridBag opacity = new cGridBag();
1825
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1826
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1827
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1828
+ globalSection.add(opacity);
16891829
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;
1830
+ panel.add(new JSeparator());
1831
+
1832
+ panel.add(globalSection);
1833
+
1834
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1835
+
1836
+ cGridBag textureSection = new cGridBag().setVertical(true);
16991837
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;
1838
+ cGridBag bump = new cGridBag();
1839
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1840
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1841
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1842
+ textureSection.add(bump);
17091843
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;
1844
+ cGridBag noise = new cGridBag();
1845
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1846
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1847
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1848
+ textureSection.add(noise);
17191849
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;
1850
+ cGridBag power = new cGridBag();
1851
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1852
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1853
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1854
+ textureSection.add(power);
17291855
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;
1856
+ cGridBag borderfade = new cGridBag();
1857
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1858
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1859
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1860
+ textureSection.add(borderfade);
17391861
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1862
+ cGridBag fog = new cGridBag();
1863
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1864
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1865
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1866
+ textureSection.add(fog);
17451867
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1868
+ cGridBag opacityPower = new cGridBag();
1869
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1870
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1871
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1872
+ textureSection.add(opacityPower);
1873
+
1874
+ panel.add(new JSeparator());
1875
+
1876
+ panel.add(textureSection);
1877
+
1878
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491879
17501880 SetMaterial(copy); // .GetMaterial());
17511881
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1882
+ //colorField.addChangeListener(this);
1883
+// modulationField.addChangeListener(this);
17541884 metalnessField.addChangeListener(this);
17551885 diffuseField.addChangeListener(this);
17561886 specularField.addChangeListener(this);
....@@ -1780,12 +1910,15 @@
17801910 opacityPowerField.addChangeListener(this);
17811911 /**/
17821912
1783
- resetSlidersButton.addActionListener(this);
17841913 clearMaterialButton.addActionListener(this);
17851914 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
1915
+
1916
+ if (Globals.ADVANCED)
1917
+ {
1918
+ resetSlidersButton.addActionListener(this);
1919
+ propagateToggle.addItemListener(this);
1920
+ multiplyToggle.addItemListener(this);
1921
+ }
17891922 }
17901923
17911924 void DropFile(java.io.File[] files, boolean textures)
....@@ -1859,19 +1992,21 @@
18591992 }
18601993
18611994 // Images/textures
1862
- if (textures
1863
- && (filename.toLowerCase().endsWith(".jpg")
1864
- || filename.toLowerCase().endsWith(".jpeg")
1865
- || filename.toLowerCase().endsWith(".gif")
1866
- || filename.toLowerCase().endsWith(".png")
1867
- || filename.toLowerCase().endsWith(".tre")
1868
- || filename.toLowerCase().endsWith(".bmp")
1869
- || filename.toLowerCase().endsWith(".tga")
1870
- || filename.toLowerCase().endsWith(".sgi")
1871
- || filename.toLowerCase().endsWith(".tif")
1872
- || filename.toLowerCase().endsWith(".tiff")))
1995
+ if (filename.toLowerCase().endsWith(".jpg")
1996
+ || filename.toLowerCase().endsWith(".jpeg")
1997
+ || filename.toLowerCase().endsWith(".gif")
1998
+ || filename.toLowerCase().endsWith(".png")
1999
+ || filename.toLowerCase().endsWith(".tre")
2000
+ || filename.toLowerCase().endsWith(".bmp")
2001
+ || filename.toLowerCase().endsWith(".tga")
2002
+ || filename.toLowerCase().endsWith(".sgi")
2003
+ || filename.toLowerCase().endsWith(".tif")
2004
+ || filename.toLowerCase().endsWith(".tiff"))
18732005 {
1874
- DropTexture(filename);
2006
+ if (textures)
2007
+ DropTexture(filename);
2008
+ else
2009
+ CreateBillboard(filename);
18752010 continue;
18762011 }
18772012
....@@ -1880,6 +2015,60 @@
18802015 }
18812016
18822017 ResetModel();
2018
+ }
2019
+
2020
+ void CreateBillboard(String filename)
2021
+ {
2022
+ Object3D source = null;
2023
+ Object3D group = copy;
2024
+
2025
+ if (group.selection.size() > 0)
2026
+ {
2027
+ source = group.selection.get(0);
2028
+ }
2029
+
2030
+ Grid grid = new Grid(1,1);
2031
+ grid.material = null;
2032
+
2033
+ grid.toParent = LA.newMatrix();
2034
+ grid.fromParent = LA.newMatrix();
2035
+ LA.matYRotate(grid.toParent, Math.PI/2);
2036
+ LA.matXRotate(grid.toParent, -Math.PI/2);
2037
+ LA.matXRotate(grid.fromParent, Math.PI/2);
2038
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
2039
+
2040
+ BillboardNode bb = new BillboardNode();
2041
+ bb.addChild(grid);
2042
+
2043
+ Object3D newgroup = new Object3D();
2044
+ newgroup.CreateMaterial();
2045
+
2046
+ File file = new File(filename);
2047
+ newgroup.name = file.getName();
2048
+ newgroup.addChild(bb);
2049
+
2050
+ Object3D main = newgroup;
2051
+
2052
+ main.SetPigmentTexture(filename);
2053
+
2054
+ if (source != null)
2055
+ {
2056
+ main.material = new cMaterial(source.material);
2057
+ if (main.projectedVertices.length < source.projectedVertices.length)
2058
+ {
2059
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
2060
+ }
2061
+
2062
+ for (int i=0; i<source.projectedVertices.length; i++)
2063
+ {
2064
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
2065
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
2066
+ }
2067
+
2068
+ main.texres = source.texres;
2069
+ }
2070
+
2071
+ makeSomething(newgroup, false);
18832072 }
18842073
18852074 Point location;
....@@ -1900,7 +2089,7 @@
19002089
19012090 //? flashIt = false;
19022091 CameraPane pane = (CameraPane) cameraView;
1903
- pane.clickStart(location.x, location.y, 0);
2092
+ pane.clickStart(location.x, location.y, 0, 0);
19042093 pane.clickEnd(location.x, location.y, 0, true);
19052094
19062095 if (group.selection.size() == 1)
....@@ -1949,6 +2138,7 @@
19492138 e2.printStackTrace();
19502139 }
19512140 }
2141
+
19522142 LoadJMEThread loadThread;
19532143
19542144 class LoadJMEThread extends Thread
....@@ -2006,6 +2196,7 @@
20062196 //LoadFile0(filename, converter);
20072197 }
20082198 }
2199
+
20092200 LoadOBJThread loadObjThread;
20102201
20112202 class LoadOBJThread extends Thread
....@@ -2084,19 +2275,19 @@
20842275
20852276 void LoadObjFile(String fullname)
20862277 {
2087
- /*
2278
+ System.out.println("Loading " + fullname);
2279
+ /**/
20882280 //lastFilename = fullname;
20892281 if(loadObjThread == null)
20902282 {
2091
- loadObjThread = new LoadOBJThread();
2092
- loadObjThread.start();
2283
+ loadObjThread = new LoadOBJThread();
2284
+ loadObjThread.start();
20932285 }
20942286
20952287 loadObjThread.add(fullname);
2096
- */
2288
+ /**/
20972289
2098
- System.out.println("Loading " + fullname);
2099
- makeSomething(new FileObject(fullname, true), true);
2290
+ //makeSomething(new FileObject(fullname, true), true);
21002291 }
21012292
21022293 void LoadGFDFile(String fullname)
....@@ -2138,6 +2329,8 @@
21382329 {
21392330 Mocap sel = (Mocap) copy.selection.get(0);
21402331
2332
+ sel.SetCurrentBones(sel.frame);
2333
+
21412334 sel.fullname = fullname;
21422335
21432336 if (changename)
....@@ -2151,14 +2344,18 @@
21512344 sel.smoothed = false;
21522345
21532346 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2347
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2348
+ sel.SetGlobalTransform();
2349
+ sel.LoadData();
2350
+ sel.Rewind();
2351
+ sel.Fade();
21552352 // sel.setPose(0);
21562353 refreshContents();
21572354 } else
21582355 {
21592356 mocap.Reset();
21602357 // new skeleton
2161
- makeSomething(mocap, false); // true);
2358
+ makeSomething(mocap, true); // true);
21622359 }
21632360 } catch (Exception e)
21642361 {
....@@ -2185,6 +2382,8 @@
21852382 {
21862383 Mocap sel = (Mocap) select;
21872384
2385
+ sel.SetCurrentBones(sel.frame);
2386
+
21882387 File file = new File(fullname);
21892388
21902389 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2450,11 @@
22512450
22522451 if (!changename)
22532452 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2453
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2454
+ sel.SetGlobalTransform();
2455
+ sel.LoadData();
2456
+ sel.Rewind();
2457
+ sel.Fade();
22552458 }
22562459
22572460 // sel.setPose(0);
....@@ -2345,11 +2548,11 @@
23452548
23462549 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472550 {
2348
- if (GrafreeD.standAlone)
2551
+ if (Grafreed.standAlone)
23492552 {
23502553 /**/
23512554 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2352
- browser.show();
2555
+ browser.setVisible(true);
23532556 String filename = browser.getFile();
23542557 if (filename != null && filename.length() > 0)
23552558 {
....@@ -2494,6 +2697,7 @@
24942697 }
24952698 if (input == null)
24962699 {
2700
+ new Exception().printStackTrace();
24972701 System.exit(0);
24982702 }
24992703
....@@ -2700,6 +2904,8 @@
27002904
27012905 void SetMaterial(Object3D object)
27022906 {
2907
+ latestObject = object;
2908
+
27032909 cMaterial mat = object.material;
27042910
27052911 if (mat == null)
....@@ -2708,7 +2914,8 @@
27082914 return;
27092915 }
27102916
2711
- multiplyToggle.setSelected(mat.multiply);
2917
+ if (multiplyToggle != null)
2918
+ multiplyToggle.setSelected(mat.multiply);
27122919
27132920 assert (object.projectedVertices != null);
27142921
....@@ -2884,31 +3091,48 @@
28843091 cameraView.ToggleDL();
28853092 cameraView.repaint();
28863093 return;
2887
- } else if (event.getSource() == toggleTextureItem)
3094
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
28883095 {
28893096 cameraView.ToggleTexture();
28903097 // june 2013 copy.HardTouch();
28913098 cameraView.repaint();
28923099 return;
2893
- } else if (event.getSource() == toggleFullItem)
3100
+ } else if (event.getSource() == toggleTimelineItem)
28943101 {
2895
- if (CameraPane.FULLSCREEN)
3102
+ timeline ^= true;
3103
+
3104
+ if (timeline)
28963105 {
2897
- frame.getContentPane().remove(/*"Center",*/bigThree);
2898
- framePanel.add(bigThree);
2899
- frame.getContentPane().add(/*"Center",*/framePanel);
2900
- } else
2901
- {
2902
- frame.getContentPane().remove(/*"Center",*/framePanel);
2903
- frame.getContentPane().add(/*"Center",*/bigThree);
3106
+ centralPanel.remove(cameraView);
3107
+ cameraPanel.add(cameraView);
3108
+ centralPanel.add(cameraPanel);
3109
+ frame.setJMenuBar(timelineMenubar);
3110
+ wasFullScreen = CameraPane.FULLSCREEN;
3111
+ if (!CameraPane.FULLSCREEN)
3112
+ ToggleFullScreen();
3113
+ toggleFullScreenItem.setEnabled(false);
29043114 }
3115
+ else
3116
+ {
3117
+ centralPanel.remove(cameraPanel);
3118
+ centralPanel.add(cameraView);
3119
+ frame.setJMenuBar(null);
3120
+ if (!wasFullScreen)
3121
+ ToggleFullScreen();
3122
+ toggleFullScreenItem.setEnabled(true);
3123
+ }
3124
+
29053125 frame.validate();
2906
- cameraView.ToggleFullScreen();
3126
+ return;
3127
+ } else if (event.getSource() == toggleFullScreenItem)
3128
+ {
3129
+ ToggleFullScreen();
3130
+ frame.validate();
29073131
29083132 return;
2909
- } else if (event.getSource() == toggleRandomItem)
3133
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29103134 {
2911
- cameraView.ToggleRandom();
3135
+ cameraView.ToggleSwitch();
29123136 cameraView.repaint();
29133137 return;
29143138 } else if (event.getSource() == toggleHandleItem)
....@@ -2937,6 +3161,10 @@
29373161 {
29383162 copy.live ^= true;
29393163 return;
3164
+ } else if (event.getSource() == selectCB)
3165
+ {
3166
+ copy.dontselect ^= true;
3167
+ return;
29403168 } else if (event.getSource() == hideCB)
29413169 {
29423170 copy.hide ^= true;
....@@ -2951,6 +3179,7 @@
29513179 if (event.getSource() == randomCB)
29523180 {
29533181 copy.random ^= true;
3182
+ objEditor.refreshContents();
29543183 return;
29553184 }
29563185 if (event.getSource() == speedupCB)
....@@ -2974,8 +3203,9 @@
29743203
29753204 public void actionPerformed(ActionEvent event)
29763205 {
3206
+ Object source = event.getSource();
29773207 // SCRIPT DIALOG
2978
- if (event.getSource() == okbutton)
3208
+ if (source == okbutton)
29793209 {
29803210 textpanel.setVisible(false);
29813211 textpanel.remove(textarea);
....@@ -2987,7 +3217,7 @@
29873217 textarea = null;
29883218 textpanel = null;
29893219 }
2990
- if (event.getSource() == cancelbutton)
3220
+ if (source == cancelbutton)
29913221 {
29923222 textpanel.setVisible(false);
29933223 textpanel.remove(textarea);
....@@ -2999,49 +3229,50 @@
29993229 //applySelf();
30003230 //client.refreshEditWindow();
30013231 //refreshContents();
3002
- if (event.getSource() == nameField)
3232
+ if (source == nameField)
30033233 {
30043234 //System.out.println("ObjEditor " + event);
30053235 applySelf0(true);
30063236 //parent.applySelf();
30073237 objEditor.refreshContents();
3008
- } else if (event.getSource() == resetButton)
3238
+ } else if (source == resetButton)
30093239 {
30103240 CameraPane.fullreset = true;
30113241 copy.Reset(); // ResetMeshes();
30123242 copy.Touch();
30133243 objEditor.refreshContents();
3014
- } else if (event.getSource() == stepItem)
3244
+ } else if (source == stepItem)
30153245 {
3016
- cameraView.ONESTEP = true;
3246
+ //cameraView.ONESTEP = true;
3247
+ Globals.ONESTEP = true;
30173248 cameraView.repaint();
30183249 return;
3019
- } else if (event.getSource() == stepButton)
3250
+ } else if (source == stepButton)
30203251 {
30213252 copy.Step();
30223253 copy.Touch();
30233254 objEditor.refreshContents();
3024
- } else if (event.getSource() == slowerButton)
3255
+ } else if (source == slowerButton)
30253256 {
30263257 copy.Slower();
30273258 copy.Touch();
30283259 objEditor.refreshContents();
3029
- } else if (event.getSource() == fasterButton)
3260
+ } else if (source == fasterButton)
30303261 {
30313262 copy.Faster();
30323263 copy.Touch();
30333264 objEditor.refreshContents();
3034
- } else if (event.getSource() == remarkButton)
3265
+ } else if (source == remarkButton)
30353266 {
30363267 copy.Remark();
30373268 copy.Touch();
30383269 objEditor.refreshContents();
3039
- } else if (event.getSource() == stepAllButton)
3270
+ } else if (source == stepAllButton)
30403271 {
30413272 copy.StepAll();
30423273 copy.Touch();
30433274 objEditor.refreshContents();
3044
- } else if (event.getSource() == resetAllButton)
3275
+ } else if (source == resetAllButton)
30453276 {
30463277 //CameraPane.fullreset = true;
30473278 copy.ResetAll(); // ResetMeshes();
....@@ -3074,53 +3305,75 @@
30743305 // Close();
30753306 // }
30763307 // else
3077
- if (event.getSource() == resetSlidersButton)
3308
+ if (source == resetSlidersButton)
30783309 {
30793310 ResetSliders();
3080
- } else if (event.getSource() == clearMaterialButton)
3311
+ } else if (source == clearMaterialButton)
30813312 {
30823313 ClearMaterial();
3083
- } else if (event.getSource() == createMaterialButton)
3314
+ } else if (source == createMaterialButton)
30843315 {
30853316 CreateMaterial();
3086
- } else if (event.getSource() == clearPanelButton)
3317
+ } else if (source == clearPanelButton)
30873318 {
30883319 copy.ClearUI();
30893320 refreshContents(true);
3090
- } /*
3091
- }
3092
-
3093
- public boolean action(Event event, Object arg)
3094
- {
3095
- */ else if (event.getSource() == closeItem)
3321
+ } else if (source == importGFDItem)
3322
+ {
3323
+ ImportGFD();
3324
+ } else
3325
+ if (source == importVRMLX3DItem)
3326
+ {
3327
+ ImportVRMLX3D();
3328
+ } else
3329
+ if (source == import3DSItem)
3330
+ {
3331
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3332
+ } else
3333
+ if (source == importOBJItem)
3334
+ {
3335
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3336
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3337
+ browser.setVisible(true);
3338
+ String filename = browser.getFile();
3339
+ if (filename != null && filename.length() > 0)
3340
+ {
3341
+ String fullname = browser.getDirectory() + filename;
3342
+ makeSomething(ReadOBJ(fullname), true);
3343
+ }
3344
+ } else
3345
+ if (source == closeItem)
30963346 {
30973347 Close();
30983348 //return true;
3099
- } else if (event.getSource() == loadItem)
3349
+ } else if (source == loadItem)
31003350 {
31013351 load();
31023352 //return true;
3103
- } else if (event.getSource() == saveItem)
3353
+ } else if (source == newItem)
3354
+ {
3355
+ New();
3356
+ } else if (source == saveItem)
31043357 {
31053358 save();
31063359 //return true;
3107
- } else if (event.getSource() == saveAsItem)
3360
+ } else if (source == saveAsItem)
31083361 {
31093362 saveAs();
31103363 //return true;
3111
- } else if (event.getSource() == reexportItem)
3364
+ } else if (source == reexportItem)
31123365 {
31133366 reexport();
31143367 //return true;
3115
- } else if (event.getSource() == exportAsItem)
3368
+ } else if (source == exportAsItem)
31163369 {
31173370 export();
31183371 //return true;
3119
- } else if (event.getSource() == povItem)
3372
+ } else if (source == povItem)
31203373 {
31213374 generatePOV();
31223375 //return true;
3123
- } else if (event.getSource() == zBufferItem)
3376
+ } else if (source == zBufferItem)
31243377 {
31253378 try
31263379 {
....@@ -3142,21 +3395,8 @@
31423395 cameraView.repaint();
31433396 //return true;
31443397 }
3145
- */ else if (event.getSource() == editCameraItem)
3146
- {
3147
- cameraView.ProtectCamera();
3148
- cameraView.repaint();
3149
- return;
3150
- } else if (event.getSource() == revertCameraItem)
3151
- {
3152
- cameraView.RevertCamera();
3153
- cameraView.repaint();
3154
- return;
3155
- } else if (event.getSource() == textureButton)
3156
- {
3157
- return; // true;
3158
- } else // combos...
3159
- if (event.getSource() == texresMenu)
3398
+ */ else // combos...
3399
+ if (source == texresMenu)
31603400 {
31613401 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31623402 copy.texres = texresMenu.getSelectedIndex();
....@@ -3168,27 +3408,302 @@
31683408 }
31693409 }
31703410
3171
- void ToggleAnimation()
3411
+ void New()
31723412 {
3173
- if (!CameraPane.ANIMATION)
3413
+ while (copy.Size() > 1)
31743414 {
3175
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3415
+ copy.remove(1);
3416
+ }
3417
+
3418
+ ResetModel();
3419
+ objEditor.refreshContents();
3420
+ }
3421
+
3422
+ static public byte[] Compress(Object3D o)
3423
+ {
3424
+ try
3425
+ {
3426
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3427
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3428
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3429
+
3430
+ Object3D parent = o.parent;
3431
+ o.parent = null;
3432
+
3433
+ out.writeObject(o);
3434
+
3435
+ o.parent = parent;
3436
+
3437
+ out.flush();
3438
+
3439
+ zstream.close();
3440
+ out.close();
3441
+
3442
+ return baos.toByteArray();
3443
+ } catch (Exception e)
3444
+ {
3445
+ System.err.println(e);
3446
+ return null;
3447
+ }
3448
+ }
3449
+
3450
+ static public Object Uncompress(byte[] bytes)
3451
+ {
3452
+ System.out.println("#bytes = " + bytes.length);
3453
+ try
3454
+ {
3455
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3456
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3457
+ ObjectInputStream in = new ObjectInputStream(istream);
3458
+ Object obj = in.readObject();
3459
+ in.close();
3460
+
3461
+ return obj;
3462
+ } catch (Exception e)
3463
+ {
3464
+ System.err.println(e);
3465
+ return null;
3466
+ }
3467
+ }
3468
+
3469
+ static public Object clone(Object o)
3470
+ {
3471
+ try
3472
+ {
3473
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3474
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3475
+
3476
+ out.writeObject(o);
3477
+
3478
+ out.flush();
3479
+ out.close();
3480
+
3481
+ byte[] bytes = baos.toByteArray();
3482
+
3483
+ System.out.println("clone = " + bytes.length);
3484
+
3485
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3486
+ ObjectInputStream in = new ObjectInputStream(bais);
3487
+ Object obj = in.readObject();
3488
+ in.close();
3489
+
3490
+ return obj;
3491
+ } catch (Exception e)
3492
+ {
3493
+ System.err.println(e);
3494
+ return null;
3495
+ }
3496
+ }
3497
+
3498
+ cRadio GetCurrentTab()
3499
+ {
3500
+ cRadio ab;
3501
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3502
+ {
3503
+ ab = (cRadio)e.nextElement();
3504
+ if(ab.GetObject() == copy)
3505
+ {
3506
+ return ab;
3507
+ }
3508
+ }
3509
+
3510
+ return null;
3511
+ }
3512
+
3513
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3514
+
3515
+ public void Save()
3516
+ {
3517
+ System.err.println("Save");
3518
+
3519
+ cRadio tab = GetCurrentTab();
3520
+
3521
+ boolean temp = CameraPane.SWITCH;
3522
+ CameraPane.SWITCH = false;
3523
+
3524
+ copy.ExtractBigData(hashtable);
3525
+
3526
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3527
+ tab.graphs[tab.undoindex++] = Compress(copy);
3528
+
3529
+ copy.RestoreBigData(hashtable);
3530
+
3531
+ CameraPane.SWITCH = temp;
3532
+
3533
+ //assert(hashtable.isEmpty());
3534
+
3535
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3536
+ {
3537
+ tab.graphs[i] = null;
3538
+ }
3539
+
3540
+ SetUndoStates();
3541
+
3542
+ // test save
3543
+ if (false)
3544
+ {
3545
+ try
3546
+ {
3547
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3548
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3549
+
3550
+ p.writeObject(copy);
3551
+
3552
+ p.flush();
3553
+
3554
+ ostream.close();
3555
+ } catch (Exception e)
3556
+ {
3557
+ e.printStackTrace();
3558
+ }
3559
+ }
3560
+ }
3561
+
3562
+ void CopyChanged(Object3D obj)
3563
+ {
3564
+ SetUndoStates();
3565
+
3566
+ boolean temp = CameraPane.SWITCH;
3567
+ CameraPane.SWITCH = false;
3568
+
3569
+ copy.ExtractBigData(hashtable);
3570
+
3571
+ copy.clear();
3572
+
3573
+ for (int i=0; i<obj.Size(); i++)
3574
+ {
3575
+ copy.add(obj.get(i));
3576
+ }
3577
+
3578
+ copy.RestoreBigData(hashtable);
3579
+
3580
+ CameraPane.SWITCH = temp;
3581
+
3582
+ //assert(hashtable.isEmpty());
3583
+
3584
+ copy.Touch();
3585
+
3586
+ ResetModel();
3587
+ copy.HardTouch(); // recompile?
3588
+
3589
+ cRadio ab;
3590
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3591
+ {
3592
+ ab = (cRadio)e.nextElement();
3593
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3594
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3595
+ if (test != null)
3596
+ {
3597
+ test.editWindow = ab.object.editWindow;
3598
+ ab.object = test;
3599
+ }
3600
+ }
3601
+
3602
+ refreshContents();
3603
+ }
3604
+
3605
+ cButton undoButton;
3606
+ cButton redoButton;
3607
+
3608
+ void SetUndoStates()
3609
+ {
3610
+ cRadio tab = GetCurrentTab();
3611
+
3612
+ undoButton.setEnabled(tab.undoindex > 0);
3613
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
3614
+ }
3615
+
3616
+ public void Undo()
3617
+ {
3618
+ System.err.println("Undo");
3619
+
3620
+ cRadio tab = GetCurrentTab();
3621
+
3622
+ if (tab.undoindex == 0)
3623
+ {
3624
+ java.awt.Toolkit.getDefaultToolkit().beep();
3625
+ return;
3626
+ }
3627
+
3628
+ if (tab.graphs[tab.undoindex] == null)
3629
+ {
3630
+ Save();
3631
+ tab.undoindex -= 1;
3632
+ }
3633
+
3634
+ tab.undoindex -= 1;
3635
+
3636
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3637
+ }
3638
+
3639
+ public void Redo()
3640
+ {
3641
+ cRadio tab = GetCurrentTab();
3642
+
3643
+ if (tab.graphs[tab.undoindex + 1] == null)
3644
+ {
3645
+ java.awt.Toolkit.getDefaultToolkit().beep();
3646
+ return;
3647
+ }
3648
+
3649
+ tab.undoindex += 1;
3650
+
3651
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3652
+ }
3653
+
3654
+ void ImportGFD()
3655
+ {
3656
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
31763657 browser.show();
31773658 String filename = browser.getFile();
31783659 if (filename != null && filename.length() > 0)
31793660 {
3180
- CameraPane.filename = browser.getDirectory() + filename;
3661
+ String fullname = browser.getDirectory() + filename;
3662
+
3663
+ //Object3D readobj =
3664
+ objEditor.ReadGFD(fullname, objEditor);
3665
+ //makeSomething(readobj);
3666
+ }
3667
+ }
3668
+
3669
+ void ImportVRMLX3D()
3670
+ {
3671
+ if (Grafreed.standAlone)
3672
+ {
3673
+ /**/
3674
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3675
+ browser.show();
3676
+ String filename = browser.getFile();
3677
+ if (filename != null && filename.length() > 0)
3678
+ {
3679
+ String fullname = browser.getDirectory() + filename;
3680
+ LoadVRMLX3D(fullname);
3681
+ }
3682
+ /**/
3683
+ }
3684
+ }
3685
+
3686
+ void ToggleAnimation()
3687
+ {
3688
+ if (!Globals.ANIMATION)
3689
+ {
3690
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3691
+ browser.setVisible(true);
3692
+ String filename = browser.getFile();
3693
+ if (filename != null && filename.length() > 0)
3694
+ {
3695
+ Globals.filename = browser.getDirectory() + filename;
31813696 //CameraPane.framecount = 0;
3182
- CameraPane.imagecount = 0;
3697
+ Globals.imagecount = 0;
31833698
3184
- CameraPane.ANIMATION ^= true;
3699
+ Globals.ANIMATION ^= true;
31853700
3186
- GrafreeD.wav.cursor = 0;
3187
- GrafreeD.wav.loop = 0;
3701
+ Grafreed.wav.cursor = 0;
3702
+ Grafreed.wav.loop = 0;
31883703 }
31893704 } else
31903705 {
3191
- CameraPane.ANIMATION ^= true;
3706
+ Globals.ANIMATION ^= true;
31923707 }
31933708 }
31943709
....@@ -3234,7 +3749,7 @@
32343749 void CreateMaterial()
32353750 {
32363751 //copy.ClearMaterial(); // PATCH
3237
- copy.CreateMaterialS(multiplyToggle.isSelected());
3752
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32383753 if (copy.selection.size() > 0)
32393754 //SetMaterial(copy);
32403755 {
....@@ -3285,7 +3800,7 @@
32853800 assert false;
32863801 }
32873802
3288
- void EditSelection()
3803
+ void EditSelection(boolean newWindow)
32893804 {
32903805 }
32913806
....@@ -3293,11 +3808,11 @@
32933808 {
32943809 copy.ResetBlockLoop(); // temporary problem
32953810
3296
- boolean random = CameraPane.RANDOM;
3297
- CameraPane.RANDOM = false; // parse everything
3811
+ boolean random = CameraPane.SWITCH;
3812
+ CameraPane.SWITCH = false; // parse everything
32983813 copy.ResetDisplayList();
32993814 copy.HardTouch();
3300
- CameraPane.RANDOM = random;
3815
+ CameraPane.SWITCH = random;
33013816 }
33023817
33033818 // public void applySelf()
....@@ -3367,10 +3882,40 @@
33673882 current.fakedepth = (float) fakedepthField.getFloat();
33683883 current.shadowbias = (float) shadowbiasField.getFloat();
33693884
3370
- if (!NumberSlider.frozen)
3885
+ if (!cNumberSlider.frozen)
33713886 {
33723887 //System.out.println("Propagate = " + propagate);
33733888 copy.UpdateMaterial(anchor, current, propagate);
3889
+
3890
+ if (copy.material != null)
3891
+ {
3892
+ cMaterial mat = copy.material;
3893
+
3894
+ colorField.SetToolTipValue((mat.color));
3895
+ modulationField.SetToolTipValue((mat.modulation));
3896
+ metalnessField.SetToolTipValue((mat.metalness));
3897
+ diffuseField.SetToolTipValue((mat.diffuse));
3898
+ specularField.SetToolTipValue((mat.specular));
3899
+ shininessField.SetToolTipValue((mat.shininess));
3900
+ shiftField.SetToolTipValue((mat.shift));
3901
+ ambientField.SetToolTipValue((mat.ambient));
3902
+ lightareaField.SetToolTipValue((mat.lightarea));
3903
+ diffusenessField.SetToolTipValue((mat.factor));
3904
+ velvetField.SetToolTipValue((mat.velvet));
3905
+ sheenField.SetToolTipValue((mat.sheen));
3906
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3907
+ backlitField.SetToolTipValue((mat.bump));
3908
+ anisoField.SetToolTipValue((mat.aniso));
3909
+ anisoVField.SetToolTipValue((mat.anisoV));
3910
+ cameraField.SetToolTipValue((mat.cameralight));
3911
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3912
+ shadowField.SetToolTipValue((mat.shadow));
3913
+ textureField.SetToolTipValue((mat.texture));
3914
+ opacityField.SetToolTipValue((mat.opacity));
3915
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3916
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3917
+ }
3918
+
33743919 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33753920 {
33763921 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3415,6 +3960,7 @@
34153960 || e.getSource() == apertureField
34163961 || e.getSource() == shadowblurField)
34173962 {
3963
+ new Exception().printStackTrace();
34183964 System.exit(0);
34193965 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34203966 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3441,7 +3987,13 @@
34413987 //System.out.println("PARENT = " + parent);
34423988 //if (parent != null)
34433989 // parent.applySelf();
3444
- refreshContents();
3990
+ if (e.getSource() == normalpushField)
3991
+ {
3992
+ objEditor.refreshContents();
3993
+ //Refresh();
3994
+ }
3995
+ else
3996
+ refreshContents();
34453997 // ??? client.refreshEditWindow();
34463998 }
34473999 //else
....@@ -3453,7 +4005,7 @@
34534005 //group.name = nameField.getText();
34544006 //objEditor.applySelf();
34554007
3456
- assert (objEditor == this);
4008
+ // OCT2018: assert (objEditor == this);
34574009 if (copy.selection == null || copy.selection.size() == 0)
34584010 //super.applySelf()
34594011 ; else
....@@ -3477,12 +4029,18 @@
34774029 objEditor.copy = keep;
34784030 }
34794031 }
4032
+
4033
+ if (normalpushField != null)
4034
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34804035 }
34814036
34824037 void SnapObject()
34834038 {
3484
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3485
- SnapObject(obj);
4039
+ if (copy.selection.size() > 0)
4040
+ {
4041
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4042
+ SnapObject(obj);
4043
+ }
34864044 }
34874045
34884046 void SnapObject(Object3D obj)
....@@ -3596,7 +4154,7 @@
35964154
35974155 if (obj.parent != null)
35984156 {
3599
- obj.parent.TransformToWorld(interest);
4157
+// obj.parent.TransformToWorld(interest);
36004158 }
36014159
36024160 if (!CameraPane.TRACK)
....@@ -3728,7 +4286,7 @@
37284286
37294287 radioPanel.revalidate();
37304288 radioPanel.repaint();
3731
- ctrlPanel.revalidate(); // ? new
4289
+ ctrlPanel.validate(); // ? new
37324290 ctrlPanel.repaint();
37334291 }
37344292 }
....@@ -3737,6 +4295,8 @@
37374295
37384296 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37394297 {
4298
+ if (Globals.SAVEONMAKE) // && resetmodel)
4299
+ Save();
37404300 //Tween.set(thing, 0).target(1).start(tweenManager);
37414301 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37424302 // if (thing instanceof GenericJointDemo)
....@@ -3823,6 +4383,12 @@
38234383 {
38244384 ResetModel();
38254385 Select(thing.GetTreePath(), true, false); // unselect... false);
4386
+
4387
+ if (thing.Size() == 0)
4388
+ {
4389
+ //EditSelection(false);
4390
+ }
4391
+
38264392 refreshContents();
38274393 }
38284394
....@@ -3940,6 +4506,7 @@
39404506 }
39414507 }
39424508 }
4509
+
39434510 LoadGFDThread loadGFDThread;
39444511
39454512 void ReadGFD(String fullname, iCallBack cb)
....@@ -3959,8 +4526,10 @@
39594526
39604527 try
39614528 {
4529
+ // Try compressed version first.
39624530 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3963
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4531
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4532
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39644533
39654534 readobj = (Object3D) p.readObject();
39664535 istream.close();
....@@ -3968,7 +4537,20 @@
39684537 readobj.ResetDisplayList();
39694538 } catch (Exception e)
39704539 {
3971
- e.printStackTrace();
4540
+ //e.printStackTrace();
4541
+ try
4542
+ {
4543
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4544
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4545
+
4546
+ readobj = (Object3D) p.readObject();
4547
+ istream.close();
4548
+
4549
+ readobj.ResetDisplayList();
4550
+ } catch (Exception e2)
4551
+ {
4552
+ e2.printStackTrace();
4553
+ }
39724554 }
39734555 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
39744556 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4014,6 +4596,12 @@
40144596
40154597 void LoadIt(Object obj)
40164598 {
4599
+ if (obj == null)
4600
+ {
4601
+ // Invalid file
4602
+ return;
4603
+ }
4604
+
40174605 System.out.println("Loaded " + obj);
40184606 //new Exception().printStackTrace();
40194607 Object3D readobj = (Object3D) obj;
....@@ -4023,6 +4611,8 @@
40234611
40244612 if (readobj != null)
40254613 {
4614
+ if (Globals.SAVEONMAKE)
4615
+ Save();
40264616 try
40274617 {
40284618 //readobj.deepCopySelf(copy);
....@@ -4085,7 +4675,7 @@
40854675
40864676 void load() // throws ClassNotFoundException
40874677 {
4088
- if (GrafreeD.standAlone)
4678
+ if (Grafreed.standAlone)
40894679 {
40904680 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914681 browser.show();
....@@ -4172,11 +4762,13 @@
41724762 try
41734763 {
41744764 FileOutputStream ostream = new FileOutputStream(lastname);
4175
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4765
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4766
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
41764767
41774768 p.writeObject(copy);
41784769 p.flush();
41794770
4771
+ zstream.close();
41804772 ostream.close();
41814773
41824774 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4186,17 +4778,20 @@
41864778 {
41874779 }
41884780 }
4781
+
41894782 String lastname;
41904783
41914784 void saveAs()
41924785 {
4193
- if (GrafreeD.standAlone)
4786
+ if (Grafreed.standAlone)
41944787 {
41954788 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964789 browser.setVisible(true);
41974790 String filename = browser.getFile();
41984791 if (filename != null && filename.length() > 0)
41994792 {
4793
+ if (!filename.endsWith(".gfd"))
4794
+ filename += ".gfd";
42004795 lastname = browser.getDirectory() + filename;
42014796 save();
42024797 }
....@@ -4295,13 +4890,13 @@
42954890 try
42964891 {
42974892 FileOutputStream ostream = new FileOutputStream(filename);
4298
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4299
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4893
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4894
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43004895
43014896 Object3D objectparent = obj.parent;
43024897 obj.parent = null;
43034898
4304
- Object3D object = (Object3D) GrafreeD.clone(obj);
4899
+ Object3D object = (Object3D) Grafreed.clone(obj);
43054900
43064901 obj.parent = objectparent;
43074902
....@@ -4313,8 +4908,8 @@
43134908 p.writeObject(object);
43144909 p.flush();
43154910
4911
+ zstream.close();
43164912 ostream.close();
4317
- // zstream.close();
43184913
43194914 // group.selection.get(0).parent = parent;
43204915 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4335,7 +4930,7 @@
43354930 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43364931 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43374932 copy.generatePOV(buffer);
4338
- if (GrafreeD.standAlone)
4933
+ if (Grafreed.standAlone)
43394934 {
43404935 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43414936 browser.show();
....@@ -4361,7 +4956,8 @@
43614956 Object3D client;
43624957 Object3D copy;
43634958 MenuBar menuBar;
4364
- Menu windowMenu;
4959
+ Menu fileMenu;
4960
+ MenuItem newItem;
43654961 MenuItem loadItem;
43664962 MenuItem saveItem;
43674963 MenuItem saveAsItem;
....@@ -4369,45 +4965,60 @@
43694965 MenuItem reexportItem;
43704966 MenuItem povItem;
43714967 MenuItem closeItem;
4372
- Menu cameraMenu;
4968
+
43734969 CheckboxMenuItem zBufferItem;
43744970 //MenuItem normalLensItem;
4375
- MenuItem editCameraItem;
4376
- MenuItem revertCameraItem;
4377
- CheckboxMenuItem toggleLiveItem;
43784971 MenuItem stepItem;
4379
- CheckboxMenuItem toggleFullItem;
4972
+ CheckboxMenuItem toggleLiveItem;
4973
+ CheckboxMenuItem toggleFullScreenItem;
4974
+ CheckboxMenuItem toggleTimelineItem;
43804975 CheckboxMenuItem toggleRenderItem;
43814976 CheckboxMenuItem toggleDebugItem;
43824977 CheckboxMenuItem toggleFrustumItem;
43834978 CheckboxMenuItem toggleFootContactItem;
43844979 CheckboxMenuItem toggleDLItem;
43854980 CheckboxMenuItem toggleTextureItem;
4386
- CheckboxMenuItem toggleRandomItem;
4981
+ CheckboxMenuItem toggleSwitchItem;
43874982 CheckboxMenuItem toggleRootItem;
43884983 CheckboxMenuItem animationItem;
43894984 CheckboxMenuItem toggleHandleItem;
43904985 CheckboxMenuItem togglePaintItem;
43914986 JSplitPane mainPanel;
43924987 JScrollPane scrollpane;
4988
+
43934989 JPanel toolbarPanel;
4394
- JPanel treePanel;
4990
+
4991
+ cGridBag treePanel;
4992
+
43954993 JPanel radioPanel;
43964994 ButtonGroup buttonGroup;
4397
- JPanel ctrlPanel;
4398
- JPanel materialPanel;
4995
+
4996
+ cGridBag toolboxPanel;
4997
+ cGridBag materialPanel;
4998
+ cGridBag ctrlPanel;
4999
+
43995000 JScrollPane infoPanel;
4400
- JPanel optionsPanel;
5001
+
5002
+ cGridBag optionsPanel;
5003
+
44015004 JTabbedPane objectPanel;
4402
- JPanel XYZPanel;
5005
+ boolean materialFlushed;
5006
+ Object3D latestObject;
5007
+
5008
+ cGridBag XYZPanel;
5009
+
44035010 JSplitPane gridPanel;
44045011 JSplitPane bigPanel;
4405
- JPanel bigThree;
4406
- JTabbedPane jtp;
4407
- JPanel cameraPanel;
5012
+
5013
+ cGridBag bigThree;
5014
+ cGridBag scenePanel;
5015
+ cGridBag centralPanel;
5016
+ JSplitPane cameraPanel;
5017
+ JPanel timelinePanel;
5018
+ JMenuBar timelineMenubar;
44085019 JSplitPane framePanel;
44095020 JTextArea/*Field*/ nameField;
4410
- cButton textureButton;
5021
+ //cButton textureButton;
44115022 cButton okButton;
44125023 cButton applyButton;
44135024 cButton cancelButton;
....@@ -4454,65 +5065,72 @@
44545065 // MATERIAL
44555066 JLabel materialLabel;
44565067 JLabel colorLabel;
4457
- NumberSlider colorField;
5068
+ cNumberSlider colorField;
44585069 JLabel modulationLabel;
4459
- NumberSlider modulationField;
5070
+ cNumberSlider modulationField;
44605071 JLabel metalnessLabel;
4461
- NumberSlider metalnessField;
5072
+ cNumberSlider metalnessField;
44625073 JLabel diffuseLabel;
4463
- NumberSlider diffuseField;
5074
+ cNumberSlider diffuseField;
44645075 JLabel specularLabel;
4465
- NumberSlider specularField;
5076
+ cNumberSlider specularField;
44665077 JLabel shininessLabel;
4467
- NumberSlider shininessField;
5078
+ cNumberSlider shininessField;
44685079 JLabel shiftLabel;
4469
- NumberSlider shiftField;
5080
+ cNumberSlider shiftField;
44705081 JLabel ambientLabel;
4471
- NumberSlider ambientField;
5082
+ cNumberSlider ambientField;
44725083 JLabel lightareaLabel;
4473
- NumberSlider lightareaField;
5084
+ cNumberSlider lightareaField;
44745085 JLabel diffusenessLabel;
4475
- NumberSlider diffusenessField;
5086
+ cNumberSlider diffusenessField;
44765087 JLabel velvetLabel;
4477
- NumberSlider velvetField;
5088
+ cNumberSlider velvetField;
44785089 JLabel sheenLabel;
4479
- NumberSlider sheenField;
5090
+ cNumberSlider sheenField;
44805091 JLabel subsurfaceLabel;
4481
- NumberSlider subsurfaceField;
5092
+ cNumberSlider subsurfaceField;
44825093 //JLabel bumpLabel;
44835094 //NumberSlider bumpField;
44845095 JLabel backlitLabel;
4485
- NumberSlider backlitField;
5096
+ cNumberSlider backlitField;
44865097 JLabel anisoLabel;
4487
- NumberSlider anisoField;
5098
+ cNumberSlider anisoField;
44885099 JLabel anisoVLabel;
4489
- NumberSlider anisoVField;
5100
+ cNumberSlider anisoVField;
44905101 JLabel cameraLabel;
4491
- NumberSlider cameraField;
5102
+ cNumberSlider cameraField;
44925103 JLabel selfshadowLabel;
4493
- NumberSlider selfshadowField;
5104
+ cNumberSlider selfshadowField;
44945105 JLabel shadowLabel;
4495
- NumberSlider shadowField;
5106
+ cNumberSlider shadowField;
44965107 JLabel textureLabel;
4497
- NumberSlider textureField;
5108
+ cNumberSlider textureField;
44985109 JLabel opacityLabel;
4499
- NumberSlider opacityField;
5110
+ cNumberSlider opacityField;
45005111 JLabel fakedepthLabel;
4501
- NumberSlider fakedepthField;
5112
+ cNumberSlider fakedepthField;
45025113 JLabel shadowbiasLabel;
4503
- NumberSlider shadowbiasField;
5114
+ cNumberSlider shadowbiasField;
45045115 JLabel bumpLabel;
4505
- NumberSlider bumpField;
5116
+ cNumberSlider bumpField;
45065117 JLabel noiseLabel;
4507
- NumberSlider noiseField;
5118
+ cNumberSlider noiseField;
45085119 JLabel powerLabel;
4509
- NumberSlider powerField;
5120
+ cNumberSlider powerField;
45105121 JLabel borderfadeLabel;
4511
- NumberSlider borderfadeField;
5122
+ cNumberSlider borderfadeField;
45125123 JLabel fogLabel;
4513
- NumberSlider fogField;
5124
+ cNumberSlider fogField;
45145125 JLabel opacityPowerLabel;
4515
- NumberSlider opacityPowerField;
4516
- JTree jTree;
5126
+ cNumberSlider opacityPowerField;
5127
+ cTree jTree;
45175128 //ObjectUI parent;
5129
+
5130
+ cNumberSlider normalpushField;
5131
+
5132
+ private MenuItem importGFDItem;
5133
+ private MenuItem importVRMLX3DItem;
5134
+ private MenuItem import3DSItem;
5135
+ private MenuItem importOBJItem;
45185136 }