Normand Briere
2019-06-27 1807e7752960ac229cddd34b100e92cadbac9459
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.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -28,7 +34,73 @@
2834 iSendInfo
2935 //KeyListener
3036 {
37
+ boolean timeline;
38
+ boolean wasFullScreen;
3139
40
+ GroupEditor callee;
41
+ JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ try
48
+ {
49
+ ImageIcon icon = GetIcon(name);
50
+ return new cButton(icon, border);
51
+ }
52
+ catch (Exception e)
53
+ {
54
+ return new cButton(name, border);
55
+ }
56
+ }
57
+
58
+ cToggleButton GetToggleButton(String name, boolean border)
59
+ {
60
+ try
61
+ {
62
+ ImageIcon icon = GetIcon(name);
63
+ return new cToggleButton(icon, border);
64
+ }
65
+ catch (Exception e)
66
+ {
67
+ return new cToggleButton(name, border);
68
+ }
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ try
74
+ {
75
+ ImageIcon icon = GetIcon(name);
76
+ return new cCheckBox(icon, border);
77
+ }
78
+ catch (Exception e)
79
+ {
80
+ return new cCheckBox(name, border);
81
+ }
82
+ }
83
+
84
+ private ImageIcon GetIcon(String name) throws IOException
85
+ {
86
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
+
88
+ if (image.getWidth() != 24 && image.getHeight() != 24)
89
+ {
90
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
+ Graphics2D g = resized.createGraphics();
92
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
+ g.dispose();
96
+
97
+ image = resized;
98
+ }
99
+
100
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
+ return icon;
102
+ }
103
+
32104 // SCRIPT
33105
34106 transient JFrame textpanel = null;
....@@ -119,51 +191,62 @@
119191 void keyPressed(int key, int modifiers)
120192 {
121193 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
194
+ Globals.theRenderer.keyPressed(key, modifiers);
123195 }
124196 */
125197
126198 static GridBagConstraints aConstraints;
127199 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
200
+
130201 static int GRIDWIDTH = 100; // 4;
131202
132203 public void closeUI()
133204 {
134205 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
206
+// System.out.println("this = " + this);
207
+// System.out.println("objEditor = " + objEditor);
137208 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
209
+// objEditor.ctrlPanel.remove(nameField);
139210
140
- if (!GroupEditor.allparams)
211
+ objEditor.ctrlPanel.remove(namePanel);
212
+
213
+ if (!allparams)
141214 return;
142215
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);
216
+// objEditor.ctrlPanel.remove(liveCB);
217
+// objEditor.ctrlPanel.remove(hideCB);
218
+// objEditor.ctrlPanel.remove(markCB);
219
+//
220
+// objEditor.ctrlPanel.remove(randomCB);
221
+// objEditor.ctrlPanel.remove(speedupCB);
222
+// objEditor.ctrlPanel.remove(rewindCB);
223
+//
224
+// objEditor.ctrlPanel.remove(resetButton);
225
+// objEditor.ctrlPanel.remove(stepButton);
226
+//// objEditor.ctrlPanel.remove(stepAllButton);
227
+//// objEditor.ctrlPanel.remove(resetAllButton);
228
+// objEditor.ctrlPanel.remove(link2masterCB);
229
+// //objEditor.ctrlPanel.remove(flipVCB);
230
+// //objEditor.ctrlPanel.remove(texresMenu);
231
+// objEditor.ctrlPanel.remove(slowerButton);
232
+// objEditor.ctrlPanel.remove(fasterButton);
233
+// objEditor.ctrlPanel.remove(remarkButton);
234
+
235
+ objEditor.ctrlPanel.remove(setupPanel);
236
+ objEditor.ctrlPanel.remove(setupPanel2);
237
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
238
+ objEditor.ctrlPanel.remove(pushPanel);
239
+ //objEditor.ctrlPanel.remove(fillPanel);
240
+
241
+ //Remove(normalpushField);
161242 }
162243
163244 public ObjEditor GetEditor()
164245 {
165246 return objEditor; //.GetEditor();
166247 }
248
+
249
+ // Sometimes myself, sometimes my callee's.
167250 ObjEditor objEditor;
168251
169252 /*
....@@ -226,6 +309,7 @@
226309 //localCopy.parent = null;
227310
228311 frame = new JFrame();
312
+ frame.setUndecorated(true);
229313 objEditor = this;
230314 this.callee = callee;
231315
....@@ -238,7 +322,7 @@
238322 //if (!isDisplayable())
239323 //setUndecorated(true);
240324
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
325
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242326 client = inClient;
243327 copy = localCopy;
244328 copy.editWindow = this;
....@@ -256,27 +340,48 @@
256340 return frame.action(event, obj);
257341 }
258342
343
+ // Cannot work without static
344
+ static boolean allparams = true;
345
+
346
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
347
+
259348 void SetupMenu()
260349 {
261350 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..."));
351
+ menuBar.add(fileMenu = new Menu("File"));
352
+ fileMenu.add(newItem = new MenuItem("New"));
353
+ fileMenu.add(loadItem = new MenuItem("Open..."));
354
+
355
+ //oe.menuBar.add(menu = new Menu("Include"));
356
+ Menu menu = new Menu("Import");
357
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
358
+ importOBJItem.addActionListener(this);
359
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
360
+ import3DSItem.addActionListener(this);
361
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
362
+ importVRMLX3DItem.addActionListener(this);
363
+ menu.add("-");
364
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
365
+ importGFDItem.addActionListener(this);
366
+ fileMenu.add(menu);
367
+ fileMenu.add("-");
368
+
369
+ fileMenu.add(saveItem = new MenuItem("Save"));
370
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267371 //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("-");
372
+ fileMenu.add("-");
373
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
374
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
375
+ fileMenu.add("-");
272376 if (client.parent != null)
273377 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
378
+ fileMenu.add(closeItem = new MenuItem("Close"));
275379 } else
276380 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
381
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278382 }
279383
384
+ newItem.addActionListener(this);
280385 loadItem.addActionListener(this);
281386 saveItem.addActionListener(this);
282387 saveAsItem.addActionListener(this);
....@@ -285,77 +390,64 @@
285390 //povItem.addActionListener(this);
286391 closeItem.addActionListener(this);
287392
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
-
341393 objectPanel = new JTabbedPane();
394
+
395
+ ChangeListener changeListener = new ChangeListener()
396
+ {
397
+ public void stateChanged(ChangeEvent changeEvent)
398
+ {
399
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
400
+// {
401
+// if (latestObject != null)
402
+// {
403
+// refreshContents(true);
404
+// SetMaterial(latestObject);
405
+// }
406
+//
407
+// materialFlushed = true;
408
+// }
409
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
410
+// {
411
+// if (listUI.size() == 0)
412
+// EditSelection(false);
413
+// }
414
+
415
+ refreshContents(false); // To refresh Info tab
416
+ }
417
+ };
418
+ objectPanel.addChangeListener(changeListener);
419
+
342420 toolbarPanel = new JPanel();
343421 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
422
+ treePanel = new cGridBag();
345423 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
424
+
425
+ editPanel = new cGridBag().setVertical(true);
426
+ editPanel.setName("Edit");
427
+
428
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
429
+
430
+ editCommandsPanel = new cGridBag();
431
+ editPanel.add(editCommandsPanel);
432
+ editPanel.add(ctrlPanel);
433
+
434
+ toolboxPanel = new cGridBag().setVertical(false);
435
+ toolboxPanel.setName("Toolbox");
436
+
437
+ materialPanel = new cGridBag().setVertical(true);
349438 materialPanel.setName("Material");
439
+
350440 /*JTextPane*/
351441 infoarea = createTextPane();
442
+ doc = infoarea.getStyledDocument();
443
+
352444 infoarea.setEditable(true);
353445 SetText();
354446 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355447 // infoarea.setOpaque(false);
356448 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
449
+// TEXTAREA infoarea.setLineWrap(true);
450
+// TEXTAREA infoarea.setWrapStyleWord(true);
359451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360452 infoPanel.setPreferredSize(new Dimension(50, 200));
361453 infoPanel.setName("Info");
....@@ -366,16 +458,23 @@
366458 mainPanel.setName("Main");
367459 mainPanel.setContinuousLayout(true);
368460 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370461 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
372
-
462
+ mainPanel.setDividerLocation(0.5); //1.0);
463
+ mainPanel.setResizeWeight(0.5);
464
+
465
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
466
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
467
+ divider.setDividerSize(15);
468
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
469
+
470
+ mainPanel.setUI(new BasicSplitPaneUI());
471
+
373472 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374473 //mainPanel.setLayout(new GridBagLayout());
375474 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
475
+// treePanel.setLayout(new GridBagLayout());
476
+ //ctrlPanel.setLayout(new GridBagLayout());
477
+ //materialPanel.setLayout(new GridBagLayout());
379478
380479 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381480 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +513,7 @@
414513 static String newline = "\n";
415514 protected static final String buttonString = "JButton";
416515 StyledDocument doc;
417
- JTextArea infoarea;
516
+ JTextPane infoarea;
418517
419518 void ClearInfo()
420519 {
....@@ -437,10 +536,10 @@
437536 e.printStackTrace();
438537 }
439538
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();
539
+// String selection = infoarea.getText();
540
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
541
+// java.awt.datatransfer.Clipboard clipboard =
542
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444543 //clipboard.setContents(data, data);
445544 }
446545
....@@ -463,13 +562,13 @@
463562 //SendInfo("Name:", "bold");
464563 if (sel.GetTextures() != null || debug)
465564 {
466
- si.SendInfo(sel.toString(), "bold");
565
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467566 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468567 if (sel.Size() > 0)
469568 {
470569 si.SendInfo("#children = " + sel.Size(), "regular");
471570 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
571
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473572 if (debug)
474573 {
475574 try
....@@ -481,7 +580,10 @@
481580 }
482581
483582 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
583
+ {
584
+ si.SendInfo(" BBox min: " + minima, "regular");
585
+ si.SendInfo(" BBox max: " + maxima, "regular");
586
+ }
485587
486588 if (sel.bRep != null)
487589 {
....@@ -508,7 +610,7 @@
508610 }
509611 if (sel.support != null)
510612 {
511
- si.SendInfo(" support: " + sel.support, "regular");
613
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512614 }
513615 if (sel.scriptnode != null)
514616 {
....@@ -522,18 +624,18 @@
522624 maxima.y = sel.toParent[3][1];
523625 maxima.z = sel.toParent[3][2];
524626 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");
530627 maxima.x = sel.toParent[0][0];
531628 maxima.y = sel.toParent[1][1];
532629 maxima.z = sel.toParent[2][2];
533630 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];
631
+ maxima.x = sel.globalTransform[3][0];
632
+ maxima.y = sel.globalTransform[3][1];
633
+ maxima.z = sel.globalTransform[3][2];
634
+ if (full)
635
+ si.SendInfo(" Global Orig: " + maxima, "regular");
636
+ maxima.x = sel.globalTransform[0][0];
637
+ maxima.y = sel.globalTransform[1][1];
638
+ maxima.z = sel.globalTransform[2][2];
537639 if (full)
538640 si.SendInfo(" Global Scale: " + maxima, "regular");
539641 }
....@@ -579,6 +681,9 @@
579681 {
580682 CameraPane.pointflow = (PointFlow) sel;
581683 }
684
+
685
+ si.SendInfo("_____________________", "regular");
686
+ si.SendInfo("", "regular");
582687 }
583688 }
584689
....@@ -594,52 +699,140 @@
594699 }
595700 }
596701
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
- };
702
+static GraphicsDevice device = GraphicsEnvironment
703
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
614704
615
- String[] initStyles =
616
- {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
705
+ Rectangle keeprect;
706
+ cRadio radio;
707
+
708
+cButton keepButton;
709
+ cButton twoButton; // Full 3D
710
+ cButton sixButton;
711
+ cButton threeButton;
712
+ cButton sevenButton;
713
+ cButton fourButton; // full panel
714
+ cButton oneButton; // full XYZ
715
+ //cButton currentLayout;
716
+
717
+ boolean maximized;
718
+
719
+ cButton fullscreenLayout;
621720
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
721
+ void Minimize()
628722 {
629
- for (int j = 0; j < 2; j++)
723
+ frame.setState(Frame.ICONIFIED);
724
+ }
725
+
726
+ void Maximize()
727
+ {
728
+ if (maximized)
630729 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
730
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
636731 }
637
- } catch (BadLocationException ble)
732
+ else
733
+ {
734
+ keeprect = frame.getBounds();
735
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
736
+ Dimension rect2 = frame.getToolkit().getScreenSize();
737
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
738
+// frame.setState(Frame.MAXIMIZED_BOTH);
739
+ }
740
+
741
+ maximized ^= true;
742
+ }
743
+
744
+ void ToggleFullScreen()
638745 {
639
- System.err.println("Couldn't insert initial text into text pane.");
746
+ cameraView.ToggleFullScreen();
747
+
748
+ if (!CameraPane.FULLSCREEN)
749
+ {
750
+ device.setFullScreenWindow(null);
751
+ //frame.setVisible(false);
752
+// frame.removeNotify();
753
+// frame.setUndecorated(false);
754
+// frame.addNotify();
755
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
756
+
757
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
758
+// X framePanel.add(bigThree);
759
+// X frame.getContentPane().add(/*"Center",*/framePanel);
760
+ framePanel.setDividerLocation(1);
761
+
762
+ //frame.setVisible(true);
763
+ radio.layout = keepButton;
764
+ //theFrame = null;
765
+ keepButton = null;
766
+ radio.layout.doClick();
767
+
768
+ } else
769
+ {
770
+ keepButton = radio.layout;
771
+ //keeprect = frame.getBounds();
772
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
773
+// frame.getToolkit().getScreenSize().height);
774
+ //frame.setVisible(false);
775
+ device.setFullScreenWindow(frame);
776
+// frame.removeNotify();
777
+// frame.setUndecorated(true);
778
+// frame.addNotify();
779
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
780
+// X framePanel.remove(bigThree);
781
+// X frame.getContentPane().add(/*"Center",*/bigThree);
782
+ framePanel.setDividerLocation(0);
783
+
784
+ radio.layout = fullscreenLayout;
785
+ radio.layout.doClick();
786
+ //frame.setVisible(true);
787
+ }
640788 }
641789
642
- return new JTextArea(); // textPane;
790
+ private JTextPane createTextPane()
791
+ {
792
+// TEXTAREA String[] initString =
793
+// {
794
+// "This is an editable JTextPane, ", //regular
795
+// "another ", //italic
796
+// "styled ", //bold
797
+// "text ", //small
798
+// "component, ", //large
799
+// "which supports embedded components..." + newline,//regular
800
+// " " + newline, //button
801
+// "...and embedded icons..." + newline, //regular
802
+// " ", //icon
803
+// newline + "JTextPane is a subclass of JEditorPane that "
804
+// + "uses a StyledEditorKit and StyledDocument, and provides "
805
+// + "cover methods for interacting with those objects."
806
+// };
807
+//
808
+// String[] initStyles =
809
+// {
810
+// "regular", "italic", "bold", "small", "large",
811
+// "regular", "button", "regular", "icon",
812
+// "regular"
813
+// };
814
+//
815
+// JTextPane textPane = new JTextPane();
816
+// textPane.setEditable(true);
817
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
818
+// addStylesToDocument(doc);
819
+//
820
+// try
821
+// {
822
+// for (int j = 0; j < 2; j++)
823
+// {
824
+// for (int i = 0; i < initString.length; i++)
825
+// {
826
+// doc.insertString(doc.getLength(), initString[i],
827
+// doc.getStyle(initStyles[i]));
828
+// }
829
+// }
830
+// } catch (BadLocationException ble)
831
+// {
832
+// System.err.println("Couldn't insert initial text into text pane.");
833
+// }
834
+
835
+ return new JTextPane(); // textPane;
643836 }
644837
645838 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +885,7 @@
692885 protected static ImageIcon createImageIcon(String path,
693886 String description)
694887 {
695
- java.net.URL imgURL = GraphreeD.class.getResource(path);
888
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696889 if (imgURL != null)
697890 {
698891 return new ImageIcon(imgURL, description);
....@@ -724,6 +917,7 @@
724917 // NumberSlider vDivsField;
725918 // JCheckBox endcaps;
726919 JCheckBox liveCB;
920
+ JCheckBox selectCB;
727921 JCheckBox hideCB;
728922 JCheckBox link2masterCB;
729923 JCheckBox markCB;
....@@ -731,7 +925,12 @@
731925 JCheckBox speedupCB;
732926 JCheckBox rewindCB;
733927 JCheckBox flipVCB;
928
+
929
+ cCheckBox toggleTextureCB;
930
+ cCheckBox toggleSwitchCB;
931
+
734932 JComboBox texresMenu;
933
+
735934 JButton resetButton;
736935 JButton stepButton;
737936 JButton stepAllButton;
....@@ -739,115 +938,87 @@
739938 JButton slowerButton;
740939 JButton fasterButton;
741940 JButton remarkButton;
941
+
942
+ cGridBag editPanel;
943
+ cGridBag editCommandsPanel;
944
+
945
+ cGridBag namePanel;
946
+ cGridBag setupPanel;
947
+ cGridBag setupPanel2;
948
+ cGridBag objectCommandsPanel;
949
+ cGridBag pushPanel;
950
+ cGridBag fillPanel;
742951
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
952
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
744953 {
745954 JCheckBox cb;
746955
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);
956
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
752957 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
756958
757959 return cb;
758960 }
759961
760
- cButton AddButton(ObjEditor oe, String label)
962
+ cButton AddButton(cGridBag panel, String label)
761963 {
762964 cButton cb;
763965
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);
966
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
769967 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
773968
774969 return cb;
775970 }
776971
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
972
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
778973 {
779974 JComboBox combo;
780975
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;
976
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
784977 combo.addActionListener(this);
785978
786979 return combo;
787980 }
788981
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
982
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
790983 {
791
- NumberSlider combo;
984
+ cGridBag control = new cGridBag();
985
+
986
+ cNumberSlider combo;
792987
793988 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
796989 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
-
990
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
991
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
806992 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
993
+
994
+ panel.add(control);
995
+
996
+ return control;
813997 }
814998
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
999
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8161000 {
817
- NumberSlider combo;
1001
+ cGridBag control = new cGridBag();
1002
+
1003
+ cNumberSlider combo;
8181004
8191005 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221006 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
-
1007
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1008
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321009 combo.setInteger(current);
8331010
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1011
+ panel.add(control);
1012
+
1013
+ return control;
8391014 }
8401015
841
- JTextArea AddText(JPanel ctrlPanel, String name)
1016
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8421017 {
8431018 JTextArea text;
8441019
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1020
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8481021 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
8511022
8521023 return text;
8531024 }
....@@ -877,9 +1048,16 @@
8771048 objEditor.ctrlPanel.remove(j);
8781049 }
8791050
1051
+ void Remove(cNumberSlider j)
1052
+ {
1053
+ j.removeChangeListener(this);
1054
+ //objEditor.ctrlPanel.remove(j.label);
1055
+ objEditor.ctrlPanel.remove(j);
1056
+ }
1057
+
8801058 /*
8811059 */
882
- void Return() // ObjEditor oe)
1060
+ void Return0() // ObjEditor oe)
8831061 {
8841062 aConstraints.gridy += 1;
8851063 aConstraints.gridx = 0;
....@@ -934,35 +1112,77 @@
9341112
9351113 void SetupUI2(ObjEditor oe)
9361114 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1115
+ //SetupName(oe);
9421116
943
- if (!GroupEditor.allparams)
1117
+ namePanel = new cGridBag();
1118
+
1119
+ nameField = AddText(namePanel, copy.GetName());
1120
+ namePanel.add(nameField);
1121
+ oe.ctrlPanel.add(namePanel);
1122
+
1123
+ oe.ctrlPanel.Return();
1124
+
1125
+ if (!allparams)
9441126 return;
9451127
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1128
+ setupPanel = new cGridBag().setVertical(false);
1129
+
1130
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1131
+ liveCB.setToolTipText("Animate object");
1132
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1133
+ selectCB.setToolTipText("Make object selectable");
9491134 // 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");
1135
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1136
+ hideCB.setToolTipText("Hide object");
1137
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1138
+ markCB.setToolTipText("As animation target transform");
1139
+
1140
+ setupPanel2 = new cGridBag().setVertical(false);
1141
+
1142
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1143
+ rewindCB.setToolTipText("Rewind animation");
1144
+
1145
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1146
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1147
+
1148
+ if (Globals.ADVANCED)
1149
+ {
1150
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1151
+ link2masterCB.setToolTipText("Attach to support");
1152
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1153
+ speedupCB.setToolTipText("Option motion capture");
1154
+ }
1155
+
1156
+ oe.ctrlPanel.add(setupPanel);
1157
+ oe.ctrlPanel.Return();
1158
+ oe.ctrlPanel.add(setupPanel2);
1159
+ oe.ctrlPanel.Return();
1160
+
1161
+ objectCommandsPanel = new cGridBag().setVertical(false);
1162
+
1163
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1164
+ resetButton.setToolTipText("Jump to frame zero");
1165
+ stepButton = AddButton(objectCommandsPanel, "Step");
1166
+ stepButton.setToolTipText("Step one frame");
9561167 // resetAllButton = AddButton(oe, "Reset All");
9571168 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591169 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1170
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1171
+ slowerButton.setToolTipText("Decrease animation speed");
1172
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1173
+ fasterButton.setToolTipText("Increase animation speed");
1174
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1175
+ remarkButton.setToolTipText("Set the current transform as the target");
9631176
964
- Return();
1177
+ oe.ctrlPanel.add(objectCommandsPanel);
1178
+ oe.ctrlPanel.Return();
9651179
1180
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1181
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1182
+ //Return();
1183
+
1184
+ oe.ctrlPanel.Return();
1185
+
9661186 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671187 // ObjEditor.aConstraints.gridx += 1;
9681188
....@@ -1056,7 +1276,7 @@
10561276 oe.aConstraints.gridwidth = 1;
10571277 /**/
10581278 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1279
+ oe.ctrlPanel.Return();
10601280
10611281 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621282 //textureButton.setEnabled(false);
....@@ -1107,7 +1327,7 @@
11071327 //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------");
11081328 //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------");
11091329
1110
-// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints);
1330
+// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints);
11111331 Camera cam = GetCamera(copy, 0);
11121332
11131333 Composite cams = null;
....@@ -1158,10 +1378,28 @@
11581378 //JPanel worldPanel =
11591379 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601380 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1381
+ centralPanel = new cGridBag();
1382
+ centralPanel.preferredWidth = 20;
1383
+
1384
+ if (Globals.ADVANCED)
1385
+ {
1386
+ timelinePanel = new JPanel(new BorderLayout());
1387
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641388
1389
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1390
+ cameraPanel.setContinuousLayout(true);
1391
+ cameraPanel.setOneTouchExpandable(true);
1392
+// cameraPanel.setDividerLocation(0.9);
1393
+// cameraPanel.setDividerSize(9);
1394
+ cameraPanel.setResizeWeight(1.0);
1395
+
1396
+ }
1397
+
1398
+ centralPanel.add(cameraView);
1399
+ centralPanel.setFocusable(true);
1400
+ //frame.setJMenuBar(timelineMenubar);
1401
+ //centralPanel.add(timelinePanel);
1402
+
11651403 //topView.camera = ;
11661404 //frontView.camera = new Camera(2);
11671405 //sideView.camera = new Camera(3);
....@@ -1177,12 +1415,13 @@
11771415 //frontView.object = copy;
11781416 //sideView.object = copy;
11791417
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1418
+ XYZPanel = new cGridBag().setVertical(true);
1419
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821420
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1421
+ XYZPanel.preferredWidth = 5;
1422
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1423
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1424
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861425
11871426 /*
11881427 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1430,7 @@
11911430 gridPanel.add(cameraView);
11921431 gridPanel.add(XYZPanel);
11931432 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1433
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951434 gridPanel.setContinuousLayout(true);
11961435 gridPanel.setOneTouchExpandable(true);
11971436 gridPanel.setDividerLocation(1.0);
....@@ -1220,11 +1459,13 @@
12201459 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211460 //tmp.setName("Edit");
12221461 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1462
+// JPanel north = new JPanel(new BorderLayout());
1463
+// north.setName("Edit");
1464
+// north.add(ctrlPanel, BorderLayout.NORTH);
1465
+// objectPanel.add(north);
1466
+ objectPanel.add(editPanel);
12271467 objectPanel.add(infoPanel);
1468
+ objectPanel.add(toolboxPanel);
12281469
12291470 /*
12301471 aConstraints.gridx = 0;
....@@ -1233,7 +1474,7 @@
12331474 aConstraints.gridy += 1;
12341475 aConstraints.gridwidth = 1;
12351476 mainPanel.add(objectPanel, aConstraints);
1236
- */
1477
+ */
12371478
12381479 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12391480 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1244,16 +1485,23 @@
12441485 scrollpane.setWheelScrollingEnabled(true);
12451486 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461487
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1488
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1489
+ scenePanel.preferredWidth = 6;
1490
+
1491
+ JTabbedPane tabbedPane = new JTabbedPane();
1492
+ tabbedPane.add(scrollpane);
12491493
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1251
-
1252
- optionsPanel = new JPanel(new GridBagLayout());
1494
+ optionsPanel = new cGridBag().setVertical(false);
12531495
12541496 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1497
+
1498
+ AddOptions(optionsPanel); //, aConstraints);
1499
+
1500
+ tabbedPane.add(optionsPanel);
1501
+
1502
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12561503
1504
+ scenePanel.add(tabbedPane);
12571505
12581506 /*
12591507 cTree jTree = new cTree(null);
....@@ -1275,7 +1523,7 @@
12751523 jtp.add(tree);
12761524 */
12771525
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1526
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791527 bigPanel.setContinuousLayout(true);
12801528 bigPanel.setOneTouchExpandable(true);
12811529 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1535,7 @@
12871535 //bigPanel.setSize(new Dimension(10,10));
12881536 //bigPanel.add(ctrlPanel);
12891537 //bigPanel.add(gridPanel);
1538
+ /**
12901539 bigThree = new JPanel();
12911540 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921541 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1546,26 @@
12971546 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981547 aWindowConstraints.weightx = 0;
12991548 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1549
+ bigThree.add(scenePanel, aWindowConstraints);
13011550 aWindowConstraints.weightx = 1;
13021551 aWindowConstraints.gridwidth = 3;
13031552 // aConstraints.gridheight = 3;
13041553 aWindowConstraints.gridx = 1;
13051554 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1555
+ bigThree.add(centralPanel, aWindowConstraints);
13071556 aWindowConstraints.weightx = 0;
13081557 aWindowConstraints.gridx = 4;
13091558 aWindowConstraints.gridwidth = 1;
13101559 // aConstraints.gridheight = 3;
13111560 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121561 bigThree.add(XYZPanel, aWindowConstraints);
1562
+ /**/
13131563
1564
+ bigThree = new cGridBag();
1565
+ bigThree.addComponent(scenePanel);
1566
+ bigThree.addComponent(centralPanel);
1567
+ bigThree.addComponent(XYZPanel);
1568
+
13141569 // // SIDE EFFECT!!!
13151570 // aConstraints.gridx = 0;
13161571 // aConstraints.gridy = 0;
....@@ -1331,14 +1586,19 @@
13311586 //worldPane.add(bigPanel);
13321587 //worldPane.add(worldPanel);
13331588 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1589
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1590
+ frame.add(/*"Center",*/framePanel);
13351591 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361592
1337
-// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc);
1593
+// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381594
1339
- frame.setSize(1024, 768);
1340
- frame.show();
1595
+ frame.setSize(1280, 860);
1596
+
1597
+ frame.validate();
1598
+ frame.setVisible(true);
13411599
1600
+ cameraView.requestFocusInWindow();
1601
+
13421602 gridPanel.setDividerLocation(1.0);
13431603
13441604 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1352,6 +1612,10 @@
13521612 });
13531613 }
13541614
1615
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1616
+ {
1617
+ }
1618
+
13551619 JTree GetTree()
13561620 {
13571621 return objEditor.jTree;
....@@ -1363,260 +1627,173 @@
13631627 ctrlPanel.removeAll();
13641628 }
13651629
1366
- void SetupMaterial(JPanel ctrlPanel)
1630
+ void SetupMaterial(cGridBag panel)
13671631 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1632
+ /*
13711633 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721634 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751635 */
13761636
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1637
+ cGridBag editBar = new cGridBag().setVertical(false);
1638
+
1639
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1640
+ createMaterialButton.setToolTipText("Create material");
13821641
13831642 /*
13841643 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881644 */
13891645
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1646
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1647
+ clearMaterialButton.setToolTipText("Clear material");
1648
+
1649
+ if (Globals.ADVANCED)
1650
+ {
1651
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1652
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1653
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1654
+ }
13921655
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;
1656
+ editBar.preferredHeight = 15;
1657
+
1658
+ panel.add(editBar);
1659
+
14071660 /**/
14081661 //aConstraints.weighty = 0;
14091662 ////aConstraints.weightx = 1;
14101663 //aConstraints.weighty = 1;
14111664 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121665 //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;
1666
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181667
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;
1668
+ cGridBag colorSection = new cGridBag().setVertical(true);
1669
+
1670
+ cGridBag color = new cGridBag();
1671
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1672
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1673
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1674
+ //colorField.preferredWidth = 200;
1675
+ colorSection.add(color);
14291676
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;
1677
+ cGridBag modulation = new cGridBag();
1678
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1679
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1680
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1681
+ colorSection.add(modulation);
14391682
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;
1683
+ cGridBag texture = new cGridBag();
1684
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1685
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1686
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1687
+ colorSection.add(texture);
14491688
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;
1689
+ cGridBag anisoU = new cGridBag();
1690
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1691
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1693
+ colorSection.add(anisoU);
14591694
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;
1695
+ cGridBag anisoV = new cGridBag();
1696
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1697
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1699
+ colorSection.add(anisoV);
14691700
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;
1701
+ cGridBag shadowbias = new cGridBag();
1702
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1703
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1704
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1705
+ colorSection.add(shadowbias);
14791706
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;
1707
+ panel.add(new JSeparator());
1708
+
1709
+ panel.add(colorSection);
1710
+
1711
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1712
+
1713
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1714
+
1715
+ cGridBag diffuse = new cGridBag();
1716
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1717
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1719
+ diffuseSection.add(diffuse);
14881720
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;
1721
+ cGridBag diffuseness = new cGridBag();
1722
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1723
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1724
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1725
+ diffuseSection.add(diffuseness);
14981726
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;
1727
+ cGridBag selfshadow = new cGridBag();
1728
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1729
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1730
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1731
+ diffuseSection.add(selfshadow);
15081732
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;
1733
+ cGridBag sheen = new cGridBag();
1734
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1735
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1736
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1737
+ diffuseSection.add(sheen);
15181738
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;
1739
+ cGridBag subsurface = new cGridBag();
1740
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1741
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1742
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1743
+ diffuseSection.add(subsurface);
15281744
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;
1745
+ cGridBag shadow = new cGridBag();
1746
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1747
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1748
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1749
+ diffuseSection.add(shadow);
15381750
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;
1751
+ cGridBag fakedepth = new cGridBag();
1752
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1753
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1754
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1755
+ diffuseSection.add(fakedepth);
15481756
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;
1757
+ panel.add(new JSeparator());
1758
+
1759
+ panel.add(diffuseSection);
1760
+
1761
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1762
+
1763
+ cGridBag specularSection = new cGridBag().setVertical(true);
15581764
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;
1765
+ cGridBag specular = new cGridBag();
1766
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1767
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1768
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1769
+ specularSection.add(specular);
15671770
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;
1771
+ cGridBag lightarea = new cGridBag();
1772
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1773
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1774
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1775
+ specularSection.add(lightarea);
15771776
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;
1777
+ cGridBag shininess = new cGridBag();
1778
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1779
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1780
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1781
+ specularSection.add(shininess);
15871782
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;
1783
+ cGridBag metalness = new cGridBag();
1784
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1785
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1786
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1787
+ specularSection.add(metalness);
15971788
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;
1789
+ cGridBag velvet = new cGridBag();
1790
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1791
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1792
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1793
+ specularSection.add(velvet);
16071794
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();
1795
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1796
+ //Return();
16201797 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211798 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221799 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1804,93 @@
16271804 // aConstraints.gridy += 1;
16281805 // aConstraints.gridwidth = 1;
16291806
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;
16381807
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;
1808
+ panel.add(new JSeparator());
1809
+
1810
+ panel.add(specularSection);
1811
+
1812
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1813
+
1814
+ cGridBag globalSection = new cGridBag().setVertical(true);
16481815
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;
1816
+ cGridBag camera = new cGridBag();
1817
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1818
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1819
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1820
+ globalSection.add(camera);
16581821
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;
1822
+ cGridBag ambient = new cGridBag();
1823
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1824
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1825
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1826
+ globalSection.add(ambient);
16681827
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;
1828
+ cGridBag backlit = new cGridBag();
1829
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1830
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1831
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1832
+ globalSection.add(backlit);
16791833
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;
1834
+ cGridBag opacity = new cGridBag();
1835
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1836
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1837
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1838
+ globalSection.add(opacity);
16891839
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;
1840
+ panel.add(new JSeparator());
1841
+
1842
+ panel.add(globalSection);
1843
+
1844
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1845
+
1846
+ cGridBag textureSection = new cGridBag().setVertical(true);
16991847
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;
1848
+ cGridBag bump = new cGridBag();
1849
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1850
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1851
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1852
+ textureSection.add(bump);
17091853
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;
1854
+ cGridBag noise = new cGridBag();
1855
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1856
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1857
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1858
+ textureSection.add(noise);
17191859
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;
1860
+ cGridBag power = new cGridBag();
1861
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1862
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1863
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1864
+ textureSection.add(power);
17291865
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;
1866
+ cGridBag borderfade = new cGridBag();
1867
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1868
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1869
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1870
+ textureSection.add(borderfade);
17391871
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1872
+ cGridBag fog = new cGridBag();
1873
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1874
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1875
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1876
+ textureSection.add(fog);
17451877
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1878
+ cGridBag opacityPower = new cGridBag();
1879
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1880
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1881
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1882
+ textureSection.add(opacityPower);
1883
+
1884
+ panel.add(new JSeparator());
1885
+
1886
+ panel.add(textureSection);
1887
+
1888
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491889
17501890 SetMaterial(copy); // .GetMaterial());
17511891
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1892
+ //colorField.addChangeListener(this);
1893
+// modulationField.addChangeListener(this);
17541894 metalnessField.addChangeListener(this);
17551895 diffuseField.addChangeListener(this);
17561896 specularField.addChangeListener(this);
....@@ -1780,12 +1920,15 @@
17801920 opacityPowerField.addChangeListener(this);
17811921 /**/
17821922
1783
- resetSlidersButton.addActionListener(this);
17841923 clearMaterialButton.addActionListener(this);
17851924 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
1925
+
1926
+ if (Globals.ADVANCED)
1927
+ {
1928
+ resetSlidersButton.addActionListener(this);
1929
+ propagateToggle.addItemListener(this);
1930
+ multiplyToggle.addItemListener(this);
1931
+ }
17891932 }
17901933
17911934 void DropFile(java.io.File[] files, boolean textures)
....@@ -1859,19 +2002,21 @@
18592002 }
18602003
18612004 // 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")))
2005
+ if (filename.toLowerCase().endsWith(".jpg")
2006
+ || filename.toLowerCase().endsWith(".jpeg")
2007
+ || filename.toLowerCase().endsWith(".gif")
2008
+ || filename.toLowerCase().endsWith(".png")
2009
+ || filename.toLowerCase().endsWith(".tre")
2010
+ || filename.toLowerCase().endsWith(".bmp")
2011
+ || filename.toLowerCase().endsWith(".tga")
2012
+ || filename.toLowerCase().endsWith(".sgi")
2013
+ || filename.toLowerCase().endsWith(".tif")
2014
+ || filename.toLowerCase().endsWith(".tiff"))
18732015 {
1874
- DropTexture(filename);
2016
+ if (textures)
2017
+ DropTexture(filename);
2018
+ else
2019
+ CreateBillboard(filename);
18752020 continue;
18762021 }
18772022
....@@ -1880,6 +2025,60 @@
18802025 }
18812026
18822027 ResetModel();
2028
+ }
2029
+
2030
+ void CreateBillboard(String filename)
2031
+ {
2032
+ Object3D source = null;
2033
+ Object3D group = copy;
2034
+
2035
+ if (group.selection.size() > 0)
2036
+ {
2037
+ source = group.selection.get(0);
2038
+ }
2039
+
2040
+ Grid grid = new Grid(1,1);
2041
+ grid.material = null;
2042
+
2043
+ grid.toParent = LA.newMatrix();
2044
+ grid.fromParent = LA.newMatrix();
2045
+ LA.matYRotate(grid.toParent, Math.PI/2);
2046
+ LA.matXRotate(grid.toParent, -Math.PI/2);
2047
+ LA.matXRotate(grid.fromParent, Math.PI/2);
2048
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
2049
+
2050
+ BillboardNode bb = new BillboardNode();
2051
+ bb.addChild(grid);
2052
+
2053
+ Object3D newgroup = new Object3D();
2054
+ newgroup.CreateMaterial();
2055
+
2056
+ File file = new File(filename);
2057
+ newgroup.name = file.getName();
2058
+ newgroup.addChild(bb);
2059
+
2060
+ Object3D main = newgroup;
2061
+
2062
+ main.SetPigmentTexture(filename);
2063
+
2064
+ if (source != null)
2065
+ {
2066
+ main.material = new cMaterial(source.material);
2067
+ if (main.projectedVertices.length < source.projectedVertices.length)
2068
+ {
2069
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
2070
+ }
2071
+
2072
+ for (int i=0; i<source.projectedVertices.length; i++)
2073
+ {
2074
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
2075
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
2076
+ }
2077
+
2078
+ main.texres = source.texres;
2079
+ }
2080
+
2081
+ makeSomething(newgroup, false);
18832082 }
18842083
18852084 Point location;
....@@ -1900,7 +2099,7 @@
19002099
19012100 //? flashIt = false;
19022101 CameraPane pane = (CameraPane) cameraView;
1903
- pane.clickStart(location.x, location.y, 0);
2102
+ pane.clickStart(location.x, location.y, 0, 0);
19042103 pane.clickEnd(location.x, location.y, 0, true);
19052104
19062105 if (group.selection.size() == 1)
....@@ -1949,6 +2148,7 @@
19492148 e2.printStackTrace();
19502149 }
19512150 }
2151
+
19522152 LoadJMEThread loadThread;
19532153
19542154 class LoadJMEThread extends Thread
....@@ -2006,6 +2206,7 @@
20062206 //LoadFile0(filename, converter);
20072207 }
20082208 }
2209
+
20092210 LoadOBJThread loadObjThread;
20102211
20112212 class LoadOBJThread extends Thread
....@@ -2084,19 +2285,19 @@
20842285
20852286 void LoadObjFile(String fullname)
20862287 {
2087
- /*
2288
+ System.out.println("Loading " + fullname);
2289
+ /**/
20882290 //lastFilename = fullname;
20892291 if(loadObjThread == null)
20902292 {
2091
- loadObjThread = new LoadOBJThread();
2092
- loadObjThread.start();
2293
+ loadObjThread = new LoadOBJThread();
2294
+ loadObjThread.start();
20932295 }
20942296
20952297 loadObjThread.add(fullname);
2096
- */
2298
+ /**/
20972299
2098
- System.out.println("Loading " + fullname);
2099
- makeSomething(new FileObject(fullname, true), true);
2300
+ //makeSomething(new FileObject(fullname, true), true);
21002301 }
21012302
21022303 void LoadGFDFile(String fullname)
....@@ -2138,6 +2339,8 @@
21382339 {
21392340 Mocap sel = (Mocap) copy.selection.get(0);
21402341
2342
+ sel.SetCurrentBones(sel.frame);
2343
+
21412344 sel.fullname = fullname;
21422345
21432346 if (changename)
....@@ -2151,14 +2354,18 @@
21512354 sel.smoothed = false;
21522355
21532356 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2357
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2358
+ sel.SetGlobalTransform();
2359
+ sel.LoadData();
2360
+ sel.Rewind();
2361
+ sel.Fade();
21552362 // sel.setPose(0);
21562363 refreshContents();
21572364 } else
21582365 {
21592366 mocap.Reset();
21602367 // new skeleton
2161
- makeSomething(mocap, false); // true);
2368
+ makeSomething(mocap, true); // true);
21622369 }
21632370 } catch (Exception e)
21642371 {
....@@ -2185,6 +2392,8 @@
21852392 {
21862393 Mocap sel = (Mocap) select;
21872394
2395
+ sel.SetCurrentBones(sel.frame);
2396
+
21882397 File file = new File(fullname);
21892398
21902399 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2460,11 @@
22512460
22522461 if (!changename)
22532462 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2463
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2464
+ sel.SetGlobalTransform();
2465
+ sel.LoadData();
2466
+ sel.Rewind();
2467
+ sel.Fade();
22552468 }
22562469
22572470 // sel.setPose(0);
....@@ -2345,11 +2558,11 @@
23452558
23462559 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472560 {
2348
- if (GraphreeD.standAlone)
2561
+ if (Grafreed.standAlone)
23492562 {
23502563 /**/
23512564 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2352
- browser.show();
2565
+ browser.setVisible(true);
23532566 String filename = browser.getFile();
23542567 if (filename != null && filename.length() > 0)
23552568 {
....@@ -2494,6 +2707,7 @@
24942707 }
24952708 if (input == null)
24962709 {
2710
+ new Exception().printStackTrace();
24972711 System.exit(0);
24982712 }
24992713
....@@ -2700,6 +2914,8 @@
27002914
27012915 void SetMaterial(Object3D object)
27022916 {
2917
+ latestObject = object;
2918
+
27032919 cMaterial mat = object.material;
27042920
27052921 if (mat == null)
....@@ -2708,7 +2924,8 @@
27082924 return;
27092925 }
27102926
2711
- multiplyToggle.setSelected(mat.multiply);
2927
+ if (multiplyToggle != null)
2928
+ multiplyToggle.setSelected(mat.multiply);
27122929
27132930 assert (object.projectedVertices != null);
27142931
....@@ -2810,12 +3027,17 @@
28103027 // }
28113028
28123029 /**/
2813
- if (deselect)
3030
+ if (deselect || child == null)
28143031 {
28153032 //group.deselectAll();
28163033 //freeze = true;
28173034 GetTree().clearSelection();
28183035 //freeze = false;
3036
+
3037
+ if (child == null)
3038
+ {
3039
+ return;
3040
+ }
28193041 }
28203042
28213043 //group.addSelectee(child);
....@@ -2884,31 +3106,48 @@
28843106 cameraView.ToggleDL();
28853107 cameraView.repaint();
28863108 return;
2887
- } else if (event.getSource() == toggleTextureItem)
3109
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
28883110 {
28893111 cameraView.ToggleTexture();
28903112 // june 2013 copy.HardTouch();
28913113 cameraView.repaint();
28923114 return;
2893
- } else if (event.getSource() == toggleFullItem)
3115
+ } else if (event.getSource() == toggleTimelineItem)
28943116 {
2895
- if (CameraPane.FULLSCREEN)
3117
+ timeline ^= true;
3118
+
3119
+ if (timeline)
28963120 {
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);
3121
+ centralPanel.remove(cameraView);
3122
+ cameraPanel.add(cameraView);
3123
+ centralPanel.add(cameraPanel);
3124
+ frame.setJMenuBar(timelineMenubar);
3125
+ wasFullScreen = CameraPane.FULLSCREEN;
3126
+ if (!CameraPane.FULLSCREEN)
3127
+ ToggleFullScreen();
3128
+ toggleFullScreenItem.setEnabled(false);
29043129 }
3130
+ else
3131
+ {
3132
+ centralPanel.remove(cameraPanel);
3133
+ centralPanel.add(cameraView);
3134
+ frame.setJMenuBar(null);
3135
+ if (!wasFullScreen)
3136
+ ToggleFullScreen();
3137
+ toggleFullScreenItem.setEnabled(true);
3138
+ }
3139
+
29053140 frame.validate();
2906
- cameraView.ToggleFullScreen();
3141
+ return;
3142
+ } else if (event.getSource() == toggleFullScreenItem)
3143
+ {
3144
+ ToggleFullScreen();
3145
+ frame.validate();
29073146
29083147 return;
2909
- } else if (event.getSource() == toggleRandomItem)
3148
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29103149 {
2911
- cameraView.ToggleRandom();
3150
+ cameraView.ToggleSwitch();
29123151 cameraView.repaint();
29133152 return;
29143153 } else if (event.getSource() == toggleHandleItem)
....@@ -2937,6 +3176,10 @@
29373176 {
29383177 copy.live ^= true;
29393178 return;
3179
+ } else if (event.getSource() == selectCB)
3180
+ {
3181
+ copy.dontselect ^= true;
3182
+ return;
29403183 } else if (event.getSource() == hideCB)
29413184 {
29423185 copy.hide ^= true;
....@@ -2951,6 +3194,7 @@
29513194 if (event.getSource() == randomCB)
29523195 {
29533196 copy.random ^= true;
3197
+ objEditor.refreshContents();
29543198 return;
29553199 }
29563200 if (event.getSource() == speedupCB)
....@@ -2974,8 +3218,9 @@
29743218
29753219 public void actionPerformed(ActionEvent event)
29763220 {
3221
+ Object source = event.getSource();
29773222 // SCRIPT DIALOG
2978
- if (event.getSource() == okbutton)
3223
+ if (source == okbutton)
29793224 {
29803225 textpanel.setVisible(false);
29813226 textpanel.remove(textarea);
....@@ -2987,7 +3232,7 @@
29873232 textarea = null;
29883233 textpanel = null;
29893234 }
2990
- if (event.getSource() == cancelbutton)
3235
+ if (source == cancelbutton)
29913236 {
29923237 textpanel.setVisible(false);
29933238 textpanel.remove(textarea);
....@@ -2999,49 +3244,50 @@
29993244 //applySelf();
30003245 //client.refreshEditWindow();
30013246 //refreshContents();
3002
- if (event.getSource() == nameField)
3247
+ if (source == nameField)
30033248 {
30043249 //System.out.println("ObjEditor " + event);
30053250 applySelf0(true);
30063251 //parent.applySelf();
30073252 objEditor.refreshContents();
3008
- } else if (event.getSource() == resetButton)
3253
+ } else if (source == resetButton)
30093254 {
30103255 CameraPane.fullreset = true;
30113256 copy.Reset(); // ResetMeshes();
30123257 copy.Touch();
30133258 objEditor.refreshContents();
3014
- } else if (event.getSource() == stepItem)
3259
+ } else if (source == stepItem)
30153260 {
3016
- cameraView.ONESTEP = true;
3261
+ //cameraView.ONESTEP = true;
3262
+ Globals.ONESTEP = true;
30173263 cameraView.repaint();
30183264 return;
3019
- } else if (event.getSource() == stepButton)
3265
+ } else if (source == stepButton)
30203266 {
30213267 copy.Step();
30223268 copy.Touch();
30233269 objEditor.refreshContents();
3024
- } else if (event.getSource() == slowerButton)
3270
+ } else if (source == slowerButton)
30253271 {
30263272 copy.Slower();
30273273 copy.Touch();
30283274 objEditor.refreshContents();
3029
- } else if (event.getSource() == fasterButton)
3275
+ } else if (source == fasterButton)
30303276 {
30313277 copy.Faster();
30323278 copy.Touch();
30333279 objEditor.refreshContents();
3034
- } else if (event.getSource() == remarkButton)
3280
+ } else if (source == remarkButton)
30353281 {
30363282 copy.Remark();
30373283 copy.Touch();
30383284 objEditor.refreshContents();
3039
- } else if (event.getSource() == stepAllButton)
3285
+ } else if (source == stepAllButton)
30403286 {
30413287 copy.StepAll();
30423288 copy.Touch();
30433289 objEditor.refreshContents();
3044
- } else if (event.getSource() == resetAllButton)
3290
+ } else if (source == resetAllButton)
30453291 {
30463292 //CameraPane.fullreset = true;
30473293 copy.ResetAll(); // ResetMeshes();
....@@ -3074,53 +3320,75 @@
30743320 // Close();
30753321 // }
30763322 // else
3077
- if (event.getSource() == resetSlidersButton)
3323
+ if (source == resetSlidersButton)
30783324 {
30793325 ResetSliders();
3080
- } else if (event.getSource() == clearMaterialButton)
3326
+ } else if (source == clearMaterialButton)
30813327 {
30823328 ClearMaterial();
3083
- } else if (event.getSource() == createMaterialButton)
3329
+ } else if (source == createMaterialButton)
30843330 {
30853331 CreateMaterial();
3086
- } else if (event.getSource() == clearPanelButton)
3332
+ } else if (source == clearPanelButton)
30873333 {
30883334 copy.ClearUI();
30893335 refreshContents(true);
3090
- } /*
3091
- }
3092
-
3093
- public boolean action(Event event, Object arg)
3094
- {
3095
- */ else if (event.getSource() == closeItem)
3336
+ } else if (source == importGFDItem)
3337
+ {
3338
+ ImportGFD();
3339
+ } else
3340
+ if (source == importVRMLX3DItem)
3341
+ {
3342
+ ImportVRMLX3D();
3343
+ } else
3344
+ if (source == import3DSItem)
3345
+ {
3346
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3347
+ } else
3348
+ if (source == importOBJItem)
3349
+ {
3350
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3351
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3352
+ browser.setVisible(true);
3353
+ String filename = browser.getFile();
3354
+ if (filename != null && filename.length() > 0)
3355
+ {
3356
+ String fullname = browser.getDirectory() + filename;
3357
+ makeSomething(ReadOBJ(fullname), true);
3358
+ }
3359
+ } else
3360
+ if (source == closeItem)
30963361 {
30973362 Close();
30983363 //return true;
3099
- } else if (event.getSource() == loadItem)
3364
+ } else if (source == loadItem)
31003365 {
31013366 load();
31023367 //return true;
3103
- } else if (event.getSource() == saveItem)
3368
+ } else if (source == newItem)
3369
+ {
3370
+ New();
3371
+ } else if (source == saveItem)
31043372 {
31053373 save();
31063374 //return true;
3107
- } else if (event.getSource() == saveAsItem)
3375
+ } else if (source == saveAsItem)
31083376 {
31093377 saveAs();
31103378 //return true;
3111
- } else if (event.getSource() == reexportItem)
3379
+ } else if (source == reexportItem)
31123380 {
31133381 reexport();
31143382 //return true;
3115
- } else if (event.getSource() == exportAsItem)
3383
+ } else if (source == exportAsItem)
31163384 {
31173385 export();
31183386 //return true;
3119
- } else if (event.getSource() == povItem)
3387
+ } else if (source == povItem)
31203388 {
31213389 generatePOV();
31223390 //return true;
3123
- } else if (event.getSource() == zBufferItem)
3391
+ } else if (source == zBufferItem)
31243392 {
31253393 try
31263394 {
....@@ -3142,21 +3410,8 @@
31423410 cameraView.repaint();
31433411 //return true;
31443412 }
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)
3413
+ */ else // combos...
3414
+ if (source == texresMenu)
31603415 {
31613416 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31623417 copy.texres = texresMenu.getSelectedIndex();
....@@ -3168,27 +3423,302 @@
31683423 }
31693424 }
31703425
3171
- void ToggleAnimation()
3426
+ void New()
31723427 {
3173
- if (!CameraPane.ANIMATION)
3428
+ while (copy.Size() > 1)
31743429 {
3175
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3430
+ copy.remove(1);
3431
+ }
3432
+
3433
+ ResetModel();
3434
+ objEditor.refreshContents();
3435
+ }
3436
+
3437
+ static public byte[] Compress(Object3D o)
3438
+ {
3439
+ try
3440
+ {
3441
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3442
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3443
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3444
+
3445
+ Object3D parent = o.parent;
3446
+ o.parent = null;
3447
+
3448
+ out.writeObject(o);
3449
+
3450
+ o.parent = parent;
3451
+
3452
+ out.flush();
3453
+
3454
+ zstream.close();
3455
+ out.close();
3456
+
3457
+ return baos.toByteArray();
3458
+ } catch (Exception e)
3459
+ {
3460
+ System.err.println(e);
3461
+ return null;
3462
+ }
3463
+ }
3464
+
3465
+ static public Object Uncompress(byte[] bytes)
3466
+ {
3467
+ System.out.println("#bytes = " + bytes.length);
3468
+ try
3469
+ {
3470
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3471
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3472
+ ObjectInputStream in = new ObjectInputStream(istream);
3473
+ Object obj = in.readObject();
3474
+ in.close();
3475
+
3476
+ return obj;
3477
+ } catch (Exception e)
3478
+ {
3479
+ System.err.println(e);
3480
+ return null;
3481
+ }
3482
+ }
3483
+
3484
+ static public Object clone(Object o)
3485
+ {
3486
+ try
3487
+ {
3488
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3489
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3490
+
3491
+ out.writeObject(o);
3492
+
3493
+ out.flush();
3494
+ out.close();
3495
+
3496
+ byte[] bytes = baos.toByteArray();
3497
+
3498
+ System.out.println("clone = " + bytes.length);
3499
+
3500
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3501
+ ObjectInputStream in = new ObjectInputStream(bais);
3502
+ Object obj = in.readObject();
3503
+ in.close();
3504
+
3505
+ return obj;
3506
+ } catch (Exception e)
3507
+ {
3508
+ System.err.println(e);
3509
+ return null;
3510
+ }
3511
+ }
3512
+
3513
+ cRadio GetCurrentTab()
3514
+ {
3515
+ cRadio ab;
3516
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3517
+ {
3518
+ ab = (cRadio)e.nextElement();
3519
+ if(ab.GetObject() == copy)
3520
+ {
3521
+ return ab;
3522
+ }
3523
+ }
3524
+
3525
+ return null;
3526
+ }
3527
+
3528
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3529
+
3530
+ public void Save()
3531
+ {
3532
+ System.err.println("Save");
3533
+
3534
+ cRadio tab = GetCurrentTab();
3535
+
3536
+ boolean temp = CameraPane.SWITCH;
3537
+ CameraPane.SWITCH = false;
3538
+
3539
+ copy.ExtractBigData(hashtable);
3540
+
3541
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3542
+ tab.graphs[tab.undoindex++] = Compress(copy);
3543
+
3544
+ copy.RestoreBigData(hashtable);
3545
+
3546
+ CameraPane.SWITCH = temp;
3547
+
3548
+ //assert(hashtable.isEmpty());
3549
+
3550
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3551
+ {
3552
+ tab.graphs[i] = null;
3553
+ }
3554
+
3555
+ SetUndoStates();
3556
+
3557
+ // test save
3558
+ if (false)
3559
+ {
3560
+ try
3561
+ {
3562
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3563
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3564
+
3565
+ p.writeObject(copy);
3566
+
3567
+ p.flush();
3568
+
3569
+ ostream.close();
3570
+ } catch (Exception e)
3571
+ {
3572
+ e.printStackTrace();
3573
+ }
3574
+ }
3575
+ }
3576
+
3577
+ void CopyChanged(Object3D obj)
3578
+ {
3579
+ SetUndoStates();
3580
+
3581
+ boolean temp = CameraPane.SWITCH;
3582
+ CameraPane.SWITCH = false;
3583
+
3584
+ copy.ExtractBigData(hashtable);
3585
+
3586
+ copy.clear();
3587
+
3588
+ for (int i=0; i<obj.Size(); i++)
3589
+ {
3590
+ copy.add(obj.get(i));
3591
+ }
3592
+
3593
+ copy.RestoreBigData(hashtable);
3594
+
3595
+ CameraPane.SWITCH = temp;
3596
+
3597
+ //assert(hashtable.isEmpty());
3598
+
3599
+ copy.Touch();
3600
+
3601
+ ResetModel();
3602
+ copy.HardTouch(); // recompile?
3603
+
3604
+ cRadio ab;
3605
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3606
+ {
3607
+ ab = (cRadio)e.nextElement();
3608
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3609
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3610
+ if (test != null)
3611
+ {
3612
+ test.editWindow = ab.object.editWindow;
3613
+ ab.object = test;
3614
+ }
3615
+ }
3616
+
3617
+ refreshContents();
3618
+ }
3619
+
3620
+ cButton undoButton;
3621
+ cButton redoButton;
3622
+
3623
+ void SetUndoStates()
3624
+ {
3625
+ cRadio tab = GetCurrentTab();
3626
+
3627
+ undoButton.setEnabled(tab.undoindex > 0);
3628
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
3629
+ }
3630
+
3631
+ public void Undo()
3632
+ {
3633
+ System.err.println("Undo");
3634
+
3635
+ cRadio tab = GetCurrentTab();
3636
+
3637
+ if (tab.undoindex == 0)
3638
+ {
3639
+ java.awt.Toolkit.getDefaultToolkit().beep();
3640
+ return;
3641
+ }
3642
+
3643
+ if (tab.graphs[tab.undoindex] == null)
3644
+ {
3645
+ Save();
3646
+ tab.undoindex -= 1;
3647
+ }
3648
+
3649
+ tab.undoindex -= 1;
3650
+
3651
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3652
+ }
3653
+
3654
+ public void Redo()
3655
+ {
3656
+ cRadio tab = GetCurrentTab();
3657
+
3658
+ if (tab.graphs[tab.undoindex + 1] == null)
3659
+ {
3660
+ java.awt.Toolkit.getDefaultToolkit().beep();
3661
+ return;
3662
+ }
3663
+
3664
+ tab.undoindex += 1;
3665
+
3666
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3667
+ }
3668
+
3669
+ void ImportGFD()
3670
+ {
3671
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
31763672 browser.show();
31773673 String filename = browser.getFile();
31783674 if (filename != null && filename.length() > 0)
31793675 {
3180
- CameraPane.filename = browser.getDirectory() + filename;
3676
+ String fullname = browser.getDirectory() + filename;
3677
+
3678
+ //Object3D readobj =
3679
+ objEditor.ReadGFD(fullname, objEditor);
3680
+ //makeSomething(readobj);
3681
+ }
3682
+ }
3683
+
3684
+ void ImportVRMLX3D()
3685
+ {
3686
+ if (Grafreed.standAlone)
3687
+ {
3688
+ /**/
3689
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3690
+ browser.show();
3691
+ String filename = browser.getFile();
3692
+ if (filename != null && filename.length() > 0)
3693
+ {
3694
+ String fullname = browser.getDirectory() + filename;
3695
+ LoadVRMLX3D(fullname);
3696
+ }
3697
+ /**/
3698
+ }
3699
+ }
3700
+
3701
+ void ToggleAnimation()
3702
+ {
3703
+ if (!Globals.ANIMATION)
3704
+ {
3705
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3706
+ browser.setVisible(true);
3707
+ String filename = browser.getFile();
3708
+ if (filename != null && filename.length() > 0)
3709
+ {
3710
+ Globals.filename = browser.getDirectory() + filename;
31813711 //CameraPane.framecount = 0;
3182
- CameraPane.imagecount = 0;
3712
+ Globals.imagecount = 0;
31833713
3184
- CameraPane.ANIMATION ^= true;
3714
+ Globals.ANIMATION ^= true;
31853715
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
3716
+ Grafreed.wav.cursor = 0;
3717
+ Grafreed.wav.loop = 0;
31883718 }
31893719 } else
31903720 {
3191
- CameraPane.ANIMATION ^= true;
3721
+ Globals.ANIMATION ^= true;
31923722 }
31933723 }
31943724
....@@ -3234,7 +3764,7 @@
32343764 void CreateMaterial()
32353765 {
32363766 //copy.ClearMaterial(); // PATCH
3237
- copy.CreateMaterialS(multiplyToggle.isSelected());
3767
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32383768 if (copy.selection.size() > 0)
32393769 //SetMaterial(copy);
32403770 {
....@@ -3285,7 +3815,7 @@
32853815 assert false;
32863816 }
32873817
3288
- void EditSelection()
3818
+ void EditSelection(boolean newWindow)
32893819 {
32903820 }
32913821
....@@ -3293,11 +3823,11 @@
32933823 {
32943824 copy.ResetBlockLoop(); // temporary problem
32953825
3296
- boolean random = CameraPane.RANDOM;
3297
- CameraPane.RANDOM = false; // parse everything
3826
+ boolean random = CameraPane.SWITCH;
3827
+ CameraPane.SWITCH = false; // parse everything
32983828 copy.ResetDisplayList();
32993829 copy.HardTouch();
3300
- CameraPane.RANDOM = random;
3830
+ CameraPane.SWITCH = random;
33013831 }
33023832
33033833 // public void applySelf()
....@@ -3367,10 +3897,40 @@
33673897 current.fakedepth = (float) fakedepthField.getFloat();
33683898 current.shadowbias = (float) shadowbiasField.getFloat();
33693899
3370
- if (!NumberSlider.frozen)
3900
+ if (!cNumberSlider.frozen)
33713901 {
33723902 //System.out.println("Propagate = " + propagate);
33733903 copy.UpdateMaterial(anchor, current, propagate);
3904
+
3905
+ if (copy.material != null)
3906
+ {
3907
+ cMaterial mat = copy.material;
3908
+
3909
+ colorField.SetToolTipValue((mat.color));
3910
+ modulationField.SetToolTipValue((mat.modulation));
3911
+ metalnessField.SetToolTipValue((mat.metalness));
3912
+ diffuseField.SetToolTipValue((mat.diffuse));
3913
+ specularField.SetToolTipValue((mat.specular));
3914
+ shininessField.SetToolTipValue((mat.shininess));
3915
+ shiftField.SetToolTipValue((mat.shift));
3916
+ ambientField.SetToolTipValue((mat.ambient));
3917
+ lightareaField.SetToolTipValue((mat.lightarea));
3918
+ diffusenessField.SetToolTipValue((mat.factor));
3919
+ velvetField.SetToolTipValue((mat.velvet));
3920
+ sheenField.SetToolTipValue((mat.sheen));
3921
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3922
+ backlitField.SetToolTipValue((mat.bump));
3923
+ anisoField.SetToolTipValue((mat.aniso));
3924
+ anisoVField.SetToolTipValue((mat.anisoV));
3925
+ cameraField.SetToolTipValue((mat.cameralight));
3926
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3927
+ shadowField.SetToolTipValue((mat.shadow));
3928
+ textureField.SetToolTipValue((mat.texture));
3929
+ opacityField.SetToolTipValue((mat.opacity));
3930
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3931
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3932
+ }
3933
+
33743934 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33753935 {
33763936 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3415,6 +3975,7 @@
34153975 || e.getSource() == apertureField
34163976 || e.getSource() == shadowblurField)
34173977 {
3978
+ new Exception().printStackTrace();
34183979 System.exit(0);
34193980 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34203981 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3441,7 +4002,13 @@
34414002 //System.out.println("PARENT = " + parent);
34424003 //if (parent != null)
34434004 // parent.applySelf();
3444
- refreshContents();
4005
+ if (e.getSource() == normalpushField)
4006
+ {
4007
+ objEditor.refreshContents();
4008
+ //Refresh();
4009
+ }
4010
+ else
4011
+ refreshContents();
34454012 // ??? client.refreshEditWindow();
34464013 }
34474014 //else
....@@ -3453,7 +4020,7 @@
34534020 //group.name = nameField.getText();
34544021 //objEditor.applySelf();
34554022
3456
- assert (objEditor == this);
4023
+ // OCT2018: assert (objEditor == this);
34574024 if (copy.selection == null || copy.selection.size() == 0)
34584025 //super.applySelf()
34594026 ; else
....@@ -3477,12 +4044,18 @@
34774044 objEditor.copy = keep;
34784045 }
34794046 }
4047
+
4048
+ if (normalpushField != null)
4049
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34804050 }
34814051
34824052 void SnapObject()
34834053 {
3484
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3485
- SnapObject(obj);
4054
+ if (copy.selection.size() > 0)
4055
+ {
4056
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
4057
+ SnapObject(obj);
4058
+ }
34864059 }
34874060
34884061 void SnapObject(Object3D obj)
....@@ -3596,7 +4169,7 @@
35964169
35974170 if (obj.parent != null)
35984171 {
3599
- obj.parent.TransformToWorld(interest);
4172
+// obj.parent.TransformToWorld(interest);
36004173 }
36014174
36024175 if (!CameraPane.TRACK)
....@@ -3728,7 +4301,7 @@
37284301
37294302 radioPanel.revalidate();
37304303 radioPanel.repaint();
3731
- ctrlPanel.revalidate(); // ? new
4304
+ ctrlPanel.validate(); // ? new
37324305 ctrlPanel.repaint();
37334306 }
37344307 }
....@@ -3737,6 +4310,8 @@
37374310
37384311 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37394312 {
4313
+ if (Globals.SAVEONMAKE) // && resetmodel)
4314
+ Save();
37404315 //Tween.set(thing, 0).target(1).start(tweenManager);
37414316 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37424317 // if (thing instanceof GenericJointDemo)
....@@ -3823,6 +4398,12 @@
38234398 {
38244399 ResetModel();
38254400 Select(thing.GetTreePath(), true, false); // unselect... false);
4401
+
4402
+ if (thing.Size() == 0)
4403
+ {
4404
+ //EditSelection(false);
4405
+ }
4406
+
38264407 refreshContents();
38274408 }
38284409
....@@ -3940,6 +4521,7 @@
39404521 }
39414522 }
39424523 }
4524
+
39434525 LoadGFDThread loadGFDThread;
39444526
39454527 void ReadGFD(String fullname, iCallBack cb)
....@@ -3959,8 +4541,10 @@
39594541
39604542 try
39614543 {
4544
+ // Try compressed version first.
39624545 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3963
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4546
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4547
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39644548
39654549 readobj = (Object3D) p.readObject();
39664550 istream.close();
....@@ -3968,7 +4552,20 @@
39684552 readobj.ResetDisplayList();
39694553 } catch (Exception e)
39704554 {
3971
- e.printStackTrace();
4555
+ //e.printStackTrace();
4556
+ try
4557
+ {
4558
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4559
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4560
+
4561
+ readobj = (Object3D) p.readObject();
4562
+ istream.close();
4563
+
4564
+ readobj.ResetDisplayList();
4565
+ } catch (Exception e2)
4566
+ {
4567
+ e2.printStackTrace();
4568
+ }
39724569 }
39734570 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
39744571 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4014,6 +4611,12 @@
40144611
40154612 void LoadIt(Object obj)
40164613 {
4614
+ if (obj == null)
4615
+ {
4616
+ // Invalid file
4617
+ return;
4618
+ }
4619
+
40174620 System.out.println("Loaded " + obj);
40184621 //new Exception().printStackTrace();
40194622 Object3D readobj = (Object3D) obj;
....@@ -4023,6 +4626,8 @@
40234626
40244627 if (readobj != null)
40254628 {
4629
+ if (Globals.SAVEONMAKE)
4630
+ Save();
40264631 try
40274632 {
40284633 //readobj.deepCopySelf(copy);
....@@ -4085,7 +4690,7 @@
40854690
40864691 void load() // throws ClassNotFoundException
40874692 {
4088
- if (GraphreeD.standAlone)
4693
+ if (Grafreed.standAlone)
40894694 {
40904695 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914696 browser.show();
....@@ -4172,11 +4777,13 @@
41724777 try
41734778 {
41744779 FileOutputStream ostream = new FileOutputStream(lastname);
4175
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4780
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4781
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
41764782
41774783 p.writeObject(copy);
41784784 p.flush();
41794785
4786
+ zstream.close();
41804787 ostream.close();
41814788
41824789 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4186,17 +4793,20 @@
41864793 {
41874794 }
41884795 }
4796
+
41894797 String lastname;
41904798
41914799 void saveAs()
41924800 {
4193
- if (GraphreeD.standAlone)
4801
+ if (Grafreed.standAlone)
41944802 {
41954803 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964804 browser.setVisible(true);
41974805 String filename = browser.getFile();
41984806 if (filename != null && filename.length() > 0)
41994807 {
4808
+ if (!filename.endsWith(".gfd"))
4809
+ filename += ".gfd";
42004810 lastname = browser.getDirectory() + filename;
42014811 save();
42024812 }
....@@ -4213,10 +4823,20 @@
42134823
42144824 Object3D object = copy.selection.get(0);
42154825
4826
+ FileObject fileobj = null;
4827
+
4828
+ if (object instanceof FileObject)
4829
+ fileobj = (FileObject)object;
4830
+
42164831 if (object.fileparent != null)
42174832 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
4833
+ assert(fileobj == null);
42194834
4835
+ fileobj = (FileObject) object.fileparent;
4836
+ }
4837
+
4838
+ if (fileobj != null)
4839
+ {
42204840 System.out.println("WriteObject " + object + " : " + fileobj.name);
42214841 WriteObject(object, fileobj.name);
42224842 }
....@@ -4259,7 +4879,7 @@
42594879 }
42604880 }
42614881 else
4262
- //if (GraphreeD.standAlone)
4882
+ //if (GrafreeD.standAlone)
42634883 {
42644884 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42654885 browser.setVisible(true);
....@@ -4285,13 +4905,13 @@
42854905 try
42864906 {
42874907 FileOutputStream ostream = new FileOutputStream(filename);
4288
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4289
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4908
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4909
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42904910
42914911 Object3D objectparent = obj.parent;
42924912 obj.parent = null;
42934913
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
4914
+ Object3D object = (Object3D) Grafreed.clone(obj);
42954915
42964916 obj.parent = objectparent;
42974917
....@@ -4303,8 +4923,8 @@
43034923 p.writeObject(object);
43044924 p.flush();
43054925
4926
+ zstream.close();
43064927 ostream.close();
4307
- // zstream.close();
43084928
43094929 // group.selection.get(0).parent = parent;
43104930 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4325,7 +4945,7 @@
43254945 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43264946 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43274947 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
4948
+ if (Grafreed.standAlone)
43294949 {
43304950 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43314951 browser.show();
....@@ -4351,7 +4971,8 @@
43514971 Object3D client;
43524972 Object3D copy;
43534973 MenuBar menuBar;
4354
- Menu windowMenu;
4974
+ Menu fileMenu;
4975
+ MenuItem newItem;
43554976 MenuItem loadItem;
43564977 MenuItem saveItem;
43574978 MenuItem saveAsItem;
....@@ -4359,45 +4980,60 @@
43594980 MenuItem reexportItem;
43604981 MenuItem povItem;
43614982 MenuItem closeItem;
4362
- Menu cameraMenu;
4983
+
43634984 CheckboxMenuItem zBufferItem;
43644985 //MenuItem normalLensItem;
4365
- MenuItem editCameraItem;
4366
- MenuItem revertCameraItem;
4367
- CheckboxMenuItem toggleLiveItem;
43684986 MenuItem stepItem;
4369
- CheckboxMenuItem toggleFullItem;
4987
+ CheckboxMenuItem toggleLiveItem;
4988
+ CheckboxMenuItem toggleFullScreenItem;
4989
+ CheckboxMenuItem toggleTimelineItem;
43704990 CheckboxMenuItem toggleRenderItem;
43714991 CheckboxMenuItem toggleDebugItem;
43724992 CheckboxMenuItem toggleFrustumItem;
43734993 CheckboxMenuItem toggleFootContactItem;
43744994 CheckboxMenuItem toggleDLItem;
43754995 CheckboxMenuItem toggleTextureItem;
4376
- CheckboxMenuItem toggleRandomItem;
4996
+ CheckboxMenuItem toggleSwitchItem;
43774997 CheckboxMenuItem toggleRootItem;
43784998 CheckboxMenuItem animationItem;
43794999 CheckboxMenuItem toggleHandleItem;
43805000 CheckboxMenuItem togglePaintItem;
43815001 JSplitPane mainPanel;
43825002 JScrollPane scrollpane;
5003
+
43835004 JPanel toolbarPanel;
4384
- JPanel treePanel;
5005
+
5006
+ cGridBag treePanel;
5007
+
43855008 JPanel radioPanel;
43865009 ButtonGroup buttonGroup;
4387
- JPanel ctrlPanel;
4388
- JPanel materialPanel;
5010
+
5011
+ cGridBag toolboxPanel;
5012
+ cGridBag materialPanel;
5013
+ cGridBag ctrlPanel;
5014
+
43895015 JScrollPane infoPanel;
4390
- JPanel optionsPanel;
5016
+
5017
+ cGridBag optionsPanel;
5018
+
43915019 JTabbedPane objectPanel;
4392
- JPanel XYZPanel;
5020
+ boolean materialFlushed;
5021
+ Object3D latestObject;
5022
+
5023
+ cGridBag XYZPanel;
5024
+
43935025 JSplitPane gridPanel;
43945026 JSplitPane bigPanel;
4395
- JPanel bigThree;
4396
- JTabbedPane jtp;
4397
- JPanel cameraPanel;
5027
+
5028
+ cGridBag bigThree;
5029
+ cGridBag scenePanel;
5030
+ cGridBag centralPanel;
5031
+ JSplitPane cameraPanel;
5032
+ JPanel timelinePanel;
5033
+ JMenuBar timelineMenubar;
43985034 JSplitPane framePanel;
43995035 JTextArea/*Field*/ nameField;
4400
- cButton textureButton;
5036
+ //cButton textureButton;
44015037 cButton okButton;
44025038 cButton applyButton;
44035039 cButton cancelButton;
....@@ -4444,65 +5080,72 @@
44445080 // MATERIAL
44455081 JLabel materialLabel;
44465082 JLabel colorLabel;
4447
- NumberSlider colorField;
5083
+ cNumberSlider colorField;
44485084 JLabel modulationLabel;
4449
- NumberSlider modulationField;
5085
+ cNumberSlider modulationField;
44505086 JLabel metalnessLabel;
4451
- NumberSlider metalnessField;
5087
+ cNumberSlider metalnessField;
44525088 JLabel diffuseLabel;
4453
- NumberSlider diffuseField;
5089
+ cNumberSlider diffuseField;
44545090 JLabel specularLabel;
4455
- NumberSlider specularField;
5091
+ cNumberSlider specularField;
44565092 JLabel shininessLabel;
4457
- NumberSlider shininessField;
5093
+ cNumberSlider shininessField;
44585094 JLabel shiftLabel;
4459
- NumberSlider shiftField;
5095
+ cNumberSlider shiftField;
44605096 JLabel ambientLabel;
4461
- NumberSlider ambientField;
5097
+ cNumberSlider ambientField;
44625098 JLabel lightareaLabel;
4463
- NumberSlider lightareaField;
5099
+ cNumberSlider lightareaField;
44645100 JLabel diffusenessLabel;
4465
- NumberSlider diffusenessField;
5101
+ cNumberSlider diffusenessField;
44665102 JLabel velvetLabel;
4467
- NumberSlider velvetField;
5103
+ cNumberSlider velvetField;
44685104 JLabel sheenLabel;
4469
- NumberSlider sheenField;
5105
+ cNumberSlider sheenField;
44705106 JLabel subsurfaceLabel;
4471
- NumberSlider subsurfaceField;
5107
+ cNumberSlider subsurfaceField;
44725108 //JLabel bumpLabel;
44735109 //NumberSlider bumpField;
44745110 JLabel backlitLabel;
4475
- NumberSlider backlitField;
5111
+ cNumberSlider backlitField;
44765112 JLabel anisoLabel;
4477
- NumberSlider anisoField;
5113
+ cNumberSlider anisoField;
44785114 JLabel anisoVLabel;
4479
- NumberSlider anisoVField;
5115
+ cNumberSlider anisoVField;
44805116 JLabel cameraLabel;
4481
- NumberSlider cameraField;
5117
+ cNumberSlider cameraField;
44825118 JLabel selfshadowLabel;
4483
- NumberSlider selfshadowField;
5119
+ cNumberSlider selfshadowField;
44845120 JLabel shadowLabel;
4485
- NumberSlider shadowField;
5121
+ cNumberSlider shadowField;
44865122 JLabel textureLabel;
4487
- NumberSlider textureField;
5123
+ cNumberSlider textureField;
44885124 JLabel opacityLabel;
4489
- NumberSlider opacityField;
5125
+ cNumberSlider opacityField;
44905126 JLabel fakedepthLabel;
4491
- NumberSlider fakedepthField;
5127
+ cNumberSlider fakedepthField;
44925128 JLabel shadowbiasLabel;
4493
- NumberSlider shadowbiasField;
5129
+ cNumberSlider shadowbiasField;
44945130 JLabel bumpLabel;
4495
- NumberSlider bumpField;
5131
+ cNumberSlider bumpField;
44965132 JLabel noiseLabel;
4497
- NumberSlider noiseField;
5133
+ cNumberSlider noiseField;
44985134 JLabel powerLabel;
4499
- NumberSlider powerField;
5135
+ cNumberSlider powerField;
45005136 JLabel borderfadeLabel;
4501
- NumberSlider borderfadeField;
5137
+ cNumberSlider borderfadeField;
45025138 JLabel fogLabel;
4503
- NumberSlider fogField;
5139
+ cNumberSlider fogField;
45045140 JLabel opacityPowerLabel;
4505
- NumberSlider opacityPowerField;
4506
- JTree jTree;
5141
+ cNumberSlider opacityPowerField;
5142
+ cTree jTree;
45075143 //ObjectUI parent;
5144
+
5145
+ cNumberSlider normalpushField;
5146
+
5147
+ private MenuItem importGFDItem;
5148
+ private MenuItem importVRMLX3DItem;
5149
+ private MenuItem import3DSItem;
5150
+ private MenuItem importOBJItem;
45085151 }