Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
ObjEditor.java
....@@ -19,6 +19,8 @@
1919 import //weka.core.
2020 matrix.Matrix;
2121
22
+import grafeme.ui.*;
23
+
2224 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2325 ActionListener, ChangeListener,
2426 InputMethodListener,
....@@ -28,7 +30,14 @@
2830 iSendInfo
2931 //KeyListener
3032 {
33
+ boolean timeline;
34
+ boolean wasFullScreen;
3135
36
+ GroupEditor callee;
37
+ JFrame frame;
38
+
39
+ static ObjEditor theFrame;
40
+
3241 // SCRIPT
3342
3443 transient JFrame textpanel = null;
....@@ -119,51 +128,62 @@
119128 void keyPressed(int key, int modifiers)
120129 {
121130 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
131
+ Globals.theRenderer.keyPressed(key, modifiers);
123132 }
124133 */
125134
126135 static GridBagConstraints aConstraints;
127136 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
137
+
130138 static int GRIDWIDTH = 100; // 4;
131139
132140 public void closeUI()
133141 {
134142 //new Exception().printStackTrace();
135
- System.out.println("this = " + this);
136
- System.out.println("objEditor = " + objEditor);
143
+// System.out.println("this = " + this);
144
+// System.out.println("objEditor = " + objEditor);
137145 //nameField.removeActionListener(this);
138
- objEditor.ctrlPanel.remove(nameField);
146
+// objEditor.ctrlPanel.remove(nameField);
147
+
148
+ objEditor.ctrlPanel.remove(namePanel);
139149
140150 if (!GroupEditor.allparams)
141151 return;
142152
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);
153
+// objEditor.ctrlPanel.remove(liveCB);
154
+// objEditor.ctrlPanel.remove(hideCB);
155
+// objEditor.ctrlPanel.remove(markCB);
156
+//
157
+// objEditor.ctrlPanel.remove(randomCB);
158
+// objEditor.ctrlPanel.remove(speedupCB);
159
+// objEditor.ctrlPanel.remove(rewindCB);
160
+//
161
+// objEditor.ctrlPanel.remove(resetButton);
162
+// objEditor.ctrlPanel.remove(stepButton);
163
+//// objEditor.ctrlPanel.remove(stepAllButton);
164
+//// objEditor.ctrlPanel.remove(resetAllButton);
165
+// objEditor.ctrlPanel.remove(link2masterCB);
166
+// //objEditor.ctrlPanel.remove(flipVCB);
167
+// //objEditor.ctrlPanel.remove(texresMenu);
168
+// objEditor.ctrlPanel.remove(slowerButton);
169
+// objEditor.ctrlPanel.remove(fasterButton);
170
+// objEditor.ctrlPanel.remove(remarkButton);
171
+
172
+ objEditor.ctrlPanel.remove(setupPanel);
173
+ objEditor.ctrlPanel.remove(setupPanel2);
174
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
175
+ objEditor.ctrlPanel.remove(pushPanel);
176
+ //objEditor.ctrlPanel.remove(fillPanel);
177
+
178
+ //Remove(normalpushField);
161179 }
162180
163181 public ObjEditor GetEditor()
164182 {
165183 return objEditor; //.GetEditor();
166184 }
185
+
186
+ // Sometimes myself, sometimes my callee's.
167187 ObjEditor objEditor;
168188
169189 /*
....@@ -226,6 +246,7 @@
226246 //localCopy.parent = null;
227247
228248 frame = new JFrame();
249
+ frame.setUndecorated(true);
229250 objEditor = this;
230251 this.callee = callee;
231252
....@@ -238,7 +259,7 @@
238259 //if (!isDisplayable())
239260 //setUndecorated(true);
240261
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
262
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242263 client = inClient;
243264 copy = localCopy;
244265 copy.editWindow = this;
....@@ -259,24 +280,40 @@
259280 void SetupMenu()
260281 {
261282 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..."));
283
+ menuBar.add(fileMenu = new Menu("File"));
284
+ fileMenu.add(newItem = new MenuItem("New"));
285
+ fileMenu.add(loadItem = new MenuItem("Open..."));
286
+
287
+ //oe.menuBar.add(menu = new Menu("Include"));
288
+ Menu menu = new Menu("Import");
289
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
290
+ importOBJItem.addActionListener(this);
291
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
292
+ import3DSItem.addActionListener(this);
293
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
294
+ importVRMLX3DItem.addActionListener(this);
295
+ menu.add("-");
296
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
297
+ importGFDItem.addActionListener(this);
298
+ fileMenu.add(menu);
299
+ fileMenu.add("-");
300
+
301
+ fileMenu.add(saveItem = new MenuItem("Save"));
302
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
267303 //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("-");
304
+ fileMenu.add("-");
305
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
306
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
307
+ fileMenu.add("-");
272308 if (client.parent != null)
273309 {
274
- windowMenu.add(closeItem = new MenuItem("Close"));
310
+ fileMenu.add(closeItem = new MenuItem("Close"));
275311 } else
276312 {
277
- windowMenu.add(closeItem = new MenuItem("Exit"));
313
+ fileMenu.add(closeItem = new MenuItem("Exit"));
278314 }
279315
316
+ newItem.addActionListener(this);
280317 loadItem.addActionListener(this);
281318 saveItem.addActionListener(this);
282319 saveAsItem.addActionListener(this);
....@@ -285,77 +322,35 @@
285322 //povItem.addActionListener(this);
286323 closeItem.addActionListener(this);
287324
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
-
341325 objectPanel = new JTabbedPane();
342326 toolbarPanel = new JPanel();
343327 toolbarPanel.setName("Toolbar");
344
- treePanel = new JPanel();
328
+ treePanel = new cGridBag();
345329 treePanel.setName("Tree");
346
- ctrlPanel = new JPanel(); // new GridBagLayout());
347
- ctrlPanel.setName("Edit");
348
- materialPanel = new JPanel();
330
+
331
+ editPanel = new cGridBag().setVertical(true);
332
+ editPanel.setName("Edit");
333
+
334
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
335
+
336
+ editCommandsPanel = new cGridBag();
337
+ editPanel.add(editCommandsPanel);
338
+ editPanel.add(ctrlPanel);
339
+
340
+ materialPanel = new cGridBag().setVertical(true);
341
+
349342 materialPanel.setName("Material");
350343 /*JTextPane*/
351344 infoarea = createTextPane();
345
+ doc = infoarea.getStyledDocument();
346
+
352347 infoarea.setEditable(true);
353348 SetText();
354349 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
355350 // infoarea.setOpaque(false);
356351 // //infoarea.setForeground(textcolor);
357
- infoarea.setLineWrap(true);
358
- infoarea.setWrapStyleWord(true);
352
+// TEXTAREA infoarea.setLineWrap(true);
353
+// TEXTAREA infoarea.setWrapStyleWord(true);
359354 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
360355 infoPanel.setPreferredSize(new Dimension(50, 200));
361356 infoPanel.setName("Info");
....@@ -366,16 +361,16 @@
366361 mainPanel.setName("Main");
367362 mainPanel.setContinuousLayout(true);
368363 mainPanel.setOneTouchExpandable(true);
369
- mainPanel.setDividerLocation(1.0);
370364 mainPanel.setDividerSize(9);
371
- mainPanel.setResizeWeight(0);
365
+ mainPanel.setDividerLocation(0.5); //1.0);
366
+ mainPanel.setResizeWeight(0.5);
372367
373368 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
374369 //mainPanel.setLayout(new GridBagLayout());
375370 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
376
- treePanel.setLayout(new GridBagLayout());
377
- ctrlPanel.setLayout(new GridBagLayout());
378
- materialPanel.setLayout(new GridBagLayout());
371
+// treePanel.setLayout(new GridBagLayout());
372
+ //ctrlPanel.setLayout(new GridBagLayout());
373
+ //materialPanel.setLayout(new GridBagLayout());
379374
380375 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
381376 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -414,7 +409,7 @@
414409 static String newline = "\n";
415410 protected static final String buttonString = "JButton";
416411 StyledDocument doc;
417
- JTextArea infoarea;
412
+ JTextPane infoarea;
418413
419414 void ClearInfo()
420415 {
....@@ -437,10 +432,10 @@
437432 e.printStackTrace();
438433 }
439434
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();
435
+// String selection = infoarea.getText();
436
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
437
+// java.awt.datatransfer.Clipboard clipboard =
438
+// Toolkit.getDefaultToolkit().getSystemClipboard();
444439 //clipboard.setContents(data, data);
445440 }
446441
....@@ -463,13 +458,13 @@
463458 //SendInfo("Name:", "bold");
464459 if (sel.GetTextures() != null || debug)
465460 {
466
- si.SendInfo(sel.toString(), "bold");
461
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
467462 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
468463 if (sel.Size() > 0)
469464 {
470465 si.SendInfo("#children = " + sel.Size(), "regular");
471466 }
472
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
467
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
473468 if (debug)
474469 {
475470 try
....@@ -481,7 +476,10 @@
481476 }
482477
483478 if (full)
484
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
479
+ {
480
+ si.SendInfo(" BBox min: " + minima, "regular");
481
+ si.SendInfo(" BBox max: " + maxima, "regular");
482
+ }
485483
486484 if (sel.bRep != null)
487485 {
....@@ -508,7 +506,7 @@
508506 }
509507 if (sel.support != null)
510508 {
511
- si.SendInfo(" support: " + sel.support, "regular");
509
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
512510 }
513511 if (sel.scriptnode != null)
514512 {
....@@ -522,18 +520,18 @@
522520 maxima.y = sel.toParent[3][1];
523521 maxima.z = sel.toParent[3][2];
524522 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");
530523 maxima.x = sel.toParent[0][0];
531524 maxima.y = sel.toParent[1][1];
532525 maxima.z = sel.toParent[2][2];
533526 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];
527
+ maxima.x = sel.globalTransform[3][0];
528
+ maxima.y = sel.globalTransform[3][1];
529
+ maxima.z = sel.globalTransform[3][2];
530
+ if (full)
531
+ si.SendInfo(" Global Orig: " + maxima, "regular");
532
+ maxima.x = sel.globalTransform[0][0];
533
+ maxima.y = sel.globalTransform[1][1];
534
+ maxima.z = sel.globalTransform[2][2];
537535 if (full)
538536 si.SendInfo(" Global Scale: " + maxima, "regular");
539537 }
....@@ -579,6 +577,9 @@
579577 {
580578 CameraPane.pointflow = (PointFlow) sel;
581579 }
580
+
581
+ si.SendInfo("_____________________", "regular");
582
+ si.SendInfo("", "regular");
582583 }
583584 }
584585
....@@ -594,52 +595,138 @@
594595 }
595596 }
596597
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
- };
598
+static GraphicsDevice device = GraphicsEnvironment
599
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
614600
615
- String[] initStyles =
601
+ Rectangle keeprect;
602
+ cRadio radio;
603
+
604
+cButton keepButton;
605
+ cButton twoButton; // Full 3D
606
+ cButton sixButton;
607
+ cButton threeButton;
608
+ cButton sevenButton;
609
+ cButton fourButton; // full panel
610
+ cButton oneButton; // full XYZ
611
+ //cButton currentLayout;
612
+
613
+ boolean maximized;
614
+
615
+ void Minimize()
616616 {
617
- "regular", "italic", "bold", "small", "large",
618
- "regular", "button", "regular", "icon",
619
- "regular"
620
- };
621
-
622
- JTextPane textPane = new JTextPane();
623
- textPane.setEditable(true);
624
- /*StyledDocument*/ doc = textPane.getStyledDocument();
625
- addStylesToDocument(doc);
626
-
627
- try
617
+ frame.setState(Frame.ICONIFIED);
618
+ }
619
+
620
+ void Maximize()
628621 {
629
- for (int j = 0; j < 2; j++)
622
+ if (maximized)
630623 {
631
- for (int i = 0; i < initString.length; i++)
632
- {
633
- doc.insertString(doc.getLength(), initString[i],
634
- doc.getStyle(initStyles[i]));
635
- }
624
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
636625 }
637
- } catch (BadLocationException ble)
626
+ else
627
+ {
628
+ keeprect = frame.getBounds();
629
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
630
+ Dimension rect2 = frame.getToolkit().getScreenSize();
631
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
632
+// frame.setState(Frame.MAXIMIZED_BOTH);
633
+ }
634
+
635
+ maximized ^= true;
636
+ }
637
+
638
+ void ToggleFullScreen()
638639 {
639
- System.err.println("Couldn't insert initial text into text pane.");
640
+ if (CameraPane.FULLSCREEN)
641
+ {
642
+ device.setFullScreenWindow(null);
643
+ //frame.setVisible(false);
644
+// frame.removeNotify();
645
+// frame.setUndecorated(false);
646
+// frame.addNotify();
647
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
648
+
649
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
650
+// X framePanel.add(bigThree);
651
+// X frame.getContentPane().add(/*"Center",*/framePanel);
652
+ framePanel.setDividerLocation(1);
653
+
654
+ //frame.setVisible(true);
655
+ radio.layout = keepButton;
656
+ //theFrame = null;
657
+ keepButton = null;
658
+ radio.layout.doClick();
659
+
660
+ } else
661
+ {
662
+ keepButton = radio.layout;
663
+ //keeprect = frame.getBounds();
664
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
665
+// frame.getToolkit().getScreenSize().height);
666
+ //frame.setVisible(false);
667
+ device.setFullScreenWindow(frame);
668
+// frame.removeNotify();
669
+// frame.setUndecorated(true);
670
+// frame.addNotify();
671
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
672
+// X framePanel.remove(bigThree);
673
+// X frame.getContentPane().add(/*"Center",*/bigThree);
674
+ framePanel.setDividerLocation(0);
675
+
676
+ radio.layout = twoButton;
677
+ radio.layout.doClick();
678
+ //frame.setVisible(true);
679
+ }
680
+
681
+ cameraView.ToggleFullScreen();
640682 }
641683
642
- return new JTextArea(); // textPane;
684
+ private JTextPane createTextPane()
685
+ {
686
+// TEXTAREA String[] initString =
687
+// {
688
+// "This is an editable JTextPane, ", //regular
689
+// "another ", //italic
690
+// "styled ", //bold
691
+// "text ", //small
692
+// "component, ", //large
693
+// "which supports embedded components..." + newline,//regular
694
+// " " + newline, //button
695
+// "...and embedded icons..." + newline, //regular
696
+// " ", //icon
697
+// newline + "JTextPane is a subclass of JEditorPane that "
698
+// + "uses a StyledEditorKit and StyledDocument, and provides "
699
+// + "cover methods for interacting with those objects."
700
+// };
701
+//
702
+// String[] initStyles =
703
+// {
704
+// "regular", "italic", "bold", "small", "large",
705
+// "regular", "button", "regular", "icon",
706
+// "regular"
707
+// };
708
+//
709
+// JTextPane textPane = new JTextPane();
710
+// textPane.setEditable(true);
711
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
712
+// addStylesToDocument(doc);
713
+//
714
+// try
715
+// {
716
+// for (int j = 0; j < 2; j++)
717
+// {
718
+// for (int i = 0; i < initString.length; i++)
719
+// {
720
+// doc.insertString(doc.getLength(), initString[i],
721
+// doc.getStyle(initStyles[i]));
722
+// }
723
+// }
724
+// } catch (BadLocationException ble)
725
+// {
726
+// System.err.println("Couldn't insert initial text into text pane.");
727
+// }
728
+
729
+ return new JTextPane(); // textPane;
643730 }
644731
645732 protected void addStylesToDocument(StyledDocument doc)
....@@ -692,7 +779,7 @@
692779 protected static ImageIcon createImageIcon(String path,
693780 String description)
694781 {
695
- java.net.URL imgURL = GraphreeD.class.getResource(path);
782
+ java.net.URL imgURL = Grafreed.class.getResource(path);
696783 if (imgURL != null)
697784 {
698785 return new ImageIcon(imgURL, description);
....@@ -724,6 +811,7 @@
724811 // NumberSlider vDivsField;
725812 // JCheckBox endcaps;
726813 JCheckBox liveCB;
814
+ JCheckBox selectCB;
727815 JCheckBox hideCB;
728816 JCheckBox link2masterCB;
729817 JCheckBox markCB;
....@@ -739,115 +827,87 @@
739827 JButton slowerButton;
740828 JButton fasterButton;
741829 JButton remarkButton;
830
+
831
+ cGridBag editPanel;
832
+ cGridBag editCommandsPanel;
833
+
834
+ cGridBag namePanel;
835
+ cGridBag setupPanel;
836
+ cGridBag setupPanel2;
837
+ cGridBag objectCommandsPanel;
838
+ cGridBag pushPanel;
839
+ cGridBag fillPanel;
742840
743
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
841
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
744842 {
745843 JCheckBox cb;
746844
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);
845
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
752846 cb.addItemListener(this);
753
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
754
- oe.aConstraints.gridwidth = 1;
755
- oe.aConstraints.gridx += 1;
756847
757848 return cb;
758849 }
759850
760
- cButton AddButton(ObjEditor oe, String label)
851
+ cButton AddButton(cGridBag panel, String label)
761852 {
762853 cButton cb;
763854
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);
855
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
769856 cb.addActionListener(this);
770
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
771
- oe.aConstraints.gridwidth = 1;
772
- oe.aConstraints.gridx += 1;
773857
774858 return cb;
775859 }
776860
777
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
861
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
778862 {
779863 JComboBox combo;
780864
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;
865
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
784866 combo.addActionListener(this);
785867
786868 return combo;
787869 }
788870
789
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
871
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
790872 {
791
- NumberSlider combo;
873
+ cGridBag control = new cGridBag();
874
+
875
+ cNumberSlider combo;
792876
793877 JLabel jlabel = new JLabel(label);
794
-
795
- aConstraints.fill = GridBagConstraints.VERTICAL;
796878 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
-
879
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
880
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
806881 combo.setFloat(current);
807
-
808
- combo.label = jlabel;
809
-
810
- combo.addChangeListener(this);
811
-
812
- return combo;
882
+
883
+ panel.add(control);
884
+
885
+ return control;
813886 }
814887
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
888
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
816889 {
817
- NumberSlider combo;
890
+ cGridBag control = new cGridBag();
891
+
892
+ cNumberSlider combo;
818893
819894 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
822895 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
-
896
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
897
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
832898 combo.setInteger(current);
833899
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
900
+ panel.add(control);
901
+
902
+ return control;
839903 }
840904
841
- JTextArea AddText(JPanel ctrlPanel, String name)
905
+ JTextArea AddText(cGridBag ctrlPanel, String name)
842906 {
843907 JTextArea text;
844908
845
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
846
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
847
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
909
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
848910 text.addCaretListener(this);
849
- aConstraints.gridx += 1;
850
- aConstraints.gridwidth = 1;
851911
852912 return text;
853913 }
....@@ -877,9 +937,16 @@
877937 objEditor.ctrlPanel.remove(j);
878938 }
879939
940
+ void Remove(cNumberSlider j)
941
+ {
942
+ j.removeChangeListener(this);
943
+ //objEditor.ctrlPanel.remove(j.label);
944
+ objEditor.ctrlPanel.remove(j);
945
+ }
946
+
880947 /*
881948 */
882
- void Return() // ObjEditor oe)
949
+ void Return0() // ObjEditor oe)
883950 {
884951 aConstraints.gridy += 1;
885952 aConstraints.gridx = 0;
....@@ -934,35 +1001,77 @@
9341001
9351002 void SetupUI2(ObjEditor oe)
9361003 {
937
-// oe.aConstraints.weightx = 0;
938
-// oe.aConstraints.weighty = 0;
939
-// oe.aConstraints.gridx = 0;
940
-// oe.aConstraints.gridy = 0;
941
- SetupName(oe);
1004
+ //SetupName(oe);
1005
+
1006
+ namePanel = new cGridBag();
1007
+
1008
+ nameField = AddText(namePanel, copy.GetName());
1009
+ namePanel.add(nameField);
1010
+ oe.ctrlPanel.add(namePanel);
1011
+
1012
+ oe.ctrlPanel.Return();
9421013
9431014 if (!GroupEditor.allparams)
9441015 return;
9451016
946
- liveCB = AddCheckBox(oe, "Live", copy.live);
947
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
948
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1017
+ setupPanel = new cGridBag().setVertical(false);
1018
+
1019
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1020
+ liveCB.setToolTipText("Animate object");
1021
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1022
+ selectCB.setToolTipText("Make object selectable");
9491023 // 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");
1024
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1025
+ hideCB.setToolTipText("Hide object");
1026
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1027
+ markCB.setToolTipText("Set the animation target transform");
1028
+
1029
+ setupPanel2 = new cGridBag().setVertical(false);
1030
+
1031
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1032
+ rewindCB.setToolTipText("Rewind animation");
1033
+
1034
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1035
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1036
+
1037
+ if (Globals.ADVANCED)
1038
+ {
1039
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1040
+ link2masterCB.setToolTipText("Attach to support");
1041
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1042
+ speedupCB.setToolTipText("Option motion capture");
1043
+ }
1044
+
1045
+ oe.ctrlPanel.add(setupPanel);
1046
+ oe.ctrlPanel.Return();
1047
+ oe.ctrlPanel.add(setupPanel2);
1048
+ oe.ctrlPanel.Return();
1049
+
1050
+ objectCommandsPanel = new cGridBag().setVertical(false);
1051
+
1052
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1053
+ resetButton.setToolTipText("Jump to frame zero");
1054
+ stepButton = AddButton(objectCommandsPanel, "Step");
1055
+ stepButton.setToolTipText("Step one frame");
9561056 // resetAllButton = AddButton(oe, "Reset All");
9571057 // stepAllButton = AddButton(oe, "Step All");
958
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9591058 // Return();
960
- slowerButton = AddButton(oe, "Slow");
961
- fasterButton = AddButton(oe, "Fast");
962
- remarkButton = AddButton(oe, "Rem");
1059
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1060
+ slowerButton.setToolTipText("Decrease animation speed");
1061
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1062
+ fasterButton.setToolTipText("Increase animation speed");
1063
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1064
+ remarkButton.setToolTipText("Set the current transform as the target");
9631065
964
- Return();
1066
+ oe.ctrlPanel.add(objectCommandsPanel);
1067
+ oe.ctrlPanel.Return();
9651068
1069
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1070
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1071
+ //Return();
1072
+
1073
+ oe.ctrlPanel.Return();
1074
+
9661075 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9671076 // ObjEditor.aConstraints.gridx += 1;
9681077
....@@ -1056,7 +1165,7 @@
10561165 oe.aConstraints.gridwidth = 1;
10571166 /**/
10581167 nameField = AddText(oe.ctrlPanel, copy.GetName());
1059
- Return();
1168
+ oe.ctrlPanel.Return();
10601169
10611170 //ctrlPanel.add(textureButton = new Button("Texture..."));
10621171 //textureButton.setEnabled(false);
....@@ -1107,7 +1216,7 @@
11071216 //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------");
11081217 //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------");
11091218
1110
-// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints);
1219
+// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints);
11111220 Camera cam = GetCamera(copy, 0);
11121221
11131222 Composite cams = null;
....@@ -1158,10 +1267,28 @@
11581267 //JPanel worldPanel =
11591268 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601269 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1270
+ centralPanel = new cGridBag();
1271
+ centralPanel.preferredWidth = 20;
1272
+
1273
+ if (Globals.ADVANCED)
1274
+ {
1275
+ timelinePanel = new JPanel(new BorderLayout());
1276
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641277
1278
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1279
+ cameraPanel.setContinuousLayout(true);
1280
+ cameraPanel.setOneTouchExpandable(true);
1281
+// cameraPanel.setDividerLocation(0.9);
1282
+// cameraPanel.setDividerSize(9);
1283
+ cameraPanel.setResizeWeight(1.0);
1284
+
1285
+ }
1286
+
1287
+ centralPanel.add(cameraView);
1288
+ centralPanel.setFocusable(true);
1289
+ //frame.setJMenuBar(timelineMenubar);
1290
+ //centralPanel.add(timelinePanel);
1291
+
11651292 //topView.camera = ;
11661293 //frontView.camera = new Camera(2);
11671294 //sideView.camera = new Camera(3);
....@@ -1177,12 +1304,13 @@
11771304 //frontView.object = copy;
11781305 //sideView.object = copy;
11791306
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1307
+ XYZPanel = new cGridBag().setVertical(true);
1308
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821309
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1310
+ XYZPanel.preferredWidth = 5;
1311
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1312
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1313
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861314
11871315 /*
11881316 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1319,7 @@
11911319 gridPanel.add(cameraView);
11921320 gridPanel.add(XYZPanel);
11931321 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1322
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951323 gridPanel.setContinuousLayout(true);
11961324 gridPanel.setOneTouchExpandable(true);
11971325 gridPanel.setDividerLocation(1.0);
....@@ -1220,10 +1348,11 @@
12201348 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12211349 //tmp.setName("Edit");
12221350 objectPanel.add(materialPanel);
1223
- JPanel north = new JPanel(new BorderLayout());
1224
- north.setName("Edit");
1225
- north.add(ctrlPanel, BorderLayout.NORTH);
1226
- objectPanel.add(north);
1351
+// JPanel north = new JPanel(new BorderLayout());
1352
+// north.setName("Edit");
1353
+// north.add(ctrlPanel, BorderLayout.NORTH);
1354
+// objectPanel.add(north);
1355
+ objectPanel.add(editPanel);
12271356 objectPanel.add(infoPanel);
12281357
12291358 /*
....@@ -1244,16 +1373,23 @@
12441373 scrollpane.setWheelScrollingEnabled(true);
12451374 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461375
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1376
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1377
+ scenePanel.preferredWidth = 6;
1378
+
1379
+ JTabbedPane tabbedPane = new JTabbedPane();
1380
+ tabbedPane.add(scrollpane);
12491381
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1382
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12511383
1252
- optionsPanel = new JPanel(new GridBagLayout());
1384
+ optionsPanel = new cGridBag().setVertical(true);
12531385
12541386 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1256
-
1387
+
1388
+ AddOptions(optionsPanel); //, aConstraints);
1389
+
1390
+ tabbedPane.add(optionsPanel);
1391
+
1392
+ scenePanel.add(tabbedPane);
12571393
12581394 /*
12591395 cTree jTree = new cTree(null);
....@@ -1275,7 +1411,7 @@
12751411 jtp.add(tree);
12761412 */
12771413
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1414
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791415 bigPanel.setContinuousLayout(true);
12801416 bigPanel.setOneTouchExpandable(true);
12811417 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1423,7 @@
12871423 //bigPanel.setSize(new Dimension(10,10));
12881424 //bigPanel.add(ctrlPanel);
12891425 //bigPanel.add(gridPanel);
1426
+ /**
12901427 bigThree = new JPanel();
12911428 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921429 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1434,26 @@
12971434 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981435 aWindowConstraints.weightx = 0;
12991436 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1437
+ bigThree.add(scenePanel, aWindowConstraints);
13011438 aWindowConstraints.weightx = 1;
13021439 aWindowConstraints.gridwidth = 3;
13031440 // aConstraints.gridheight = 3;
13041441 aWindowConstraints.gridx = 1;
13051442 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1443
+ bigThree.add(centralPanel, aWindowConstraints);
13071444 aWindowConstraints.weightx = 0;
13081445 aWindowConstraints.gridx = 4;
13091446 aWindowConstraints.gridwidth = 1;
13101447 // aConstraints.gridheight = 3;
13111448 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121449 bigThree.add(XYZPanel, aWindowConstraints);
1450
+ /**/
13131451
1452
+ bigThree = new cGridBag();
1453
+ bigThree.addComponent(scenePanel);
1454
+ bigThree.addComponent(centralPanel);
1455
+ bigThree.addComponent(XYZPanel);
1456
+
13141457 // // SIDE EFFECT!!!
13151458 // aConstraints.gridx = 0;
13161459 // aConstraints.gridy = 0;
....@@ -1331,14 +1474,17 @@
13311474 //worldPane.add(bigPanel);
13321475 //worldPane.add(worldPanel);
13331476 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1477
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1478
+ frame.add(/*"Center",*/framePanel);
13351479 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361480
1337
-// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc);
1481
+// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381482
1339
- frame.setSize(800, 600);
1340
- frame.show();
1483
+ frame.setSize(1280, 860);
1484
+ frame.setVisible(true);
13411485
1486
+ cameraView.requestFocusInWindow();
1487
+
13421488 gridPanel.setDividerLocation(1.0);
13431489
13441490 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1352,6 +1498,10 @@
13521498 });
13531499 }
13541500
1501
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1502
+ {
1503
+ }
1504
+
13551505 JTree GetTree()
13561506 {
13571507 return objEditor.jTree;
....@@ -1363,260 +1513,173 @@
13631513 ctrlPanel.removeAll();
13641514 }
13651515
1366
- void SetupMaterial(JPanel ctrlPanel)
1516
+ void SetupMaterial(cGridBag panel)
13671517 {
1368
- aConstraints.weighty = 0;
1369
- //aConstraints.weightx = 1;
1370
- /*
1518
+ /*
13711519 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
13721520 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1373
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1374
- aConstraints.gridx += 1;
13751521 */
13761522
1377
- aConstraints.gridwidth = 1;
1378
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1379
- aConstraints.gridx += 1;
1380
- aConstraints.weighty = 0;
1381
- aConstraints.gridwidth = 1;
1523
+ cGridBag editBar = new cGridBag().setVertical(false);
1524
+
1525
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1526
+ createMaterialButton.setToolTipText("Create material");
13821527
13831528 /*
13841529 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1385
- aConstraints.gridx += 1;
1386
- aConstraints.weighty = 0;
1387
- aConstraints.gridwidth = 1;
13881530 */
13891531
1390
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1391
- aConstraints.gridx += 1;
1532
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1533
+ clearMaterialButton.setToolTipText("Clear material");
1534
+
1535
+ if (Globals.ADVANCED)
1536
+ {
1537
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1538
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1539
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1540
+ }
13921541
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;
1542
+ editBar.preferredHeight = 15;
1543
+
1544
+ panel.add(editBar);
1545
+
14071546 /**/
14081547 //aConstraints.weighty = 0;
14091548 ////aConstraints.weightx = 1;
14101549 //aConstraints.weighty = 1;
14111550 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14121551 //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;
1552
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14181553
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;
1554
+ cGridBag colorSection = new cGridBag().setVertical(true);
1555
+
1556
+ cGridBag color = new cGridBag();
1557
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1558
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1560
+ //colorField.preferredWidth = 200;
1561
+ colorSection.add(color);
14291562
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;
1563
+ cGridBag modulation = new cGridBag();
1564
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1565
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1567
+ colorSection.add(modulation);
14391568
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;
1569
+ cGridBag texture = new cGridBag();
1570
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1571
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1573
+ colorSection.add(texture);
14491574
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;
1575
+ cGridBag anisoU = new cGridBag();
1576
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1577
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1579
+ colorSection.add(anisoU);
14591580
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;
1581
+ cGridBag anisoV = new cGridBag();
1582
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1583
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1585
+ colorSection.add(anisoV);
14691586
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;
1587
+ cGridBag shadowbias = new cGridBag();
1588
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1589
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1591
+ colorSection.add(shadowbias);
14791592
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;
1593
+ panel.add(new JSeparator());
1594
+
1595
+ panel.add(colorSection);
1596
+
1597
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1598
+
1599
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1600
+
1601
+ cGridBag diffuse = new cGridBag();
1602
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1603
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1605
+ diffuseSection.add(diffuse);
14881606
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;
1607
+ cGridBag diffuseness = new cGridBag();
1608
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1609
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1610
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1611
+ diffuseSection.add(diffuseness);
14981612
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;
1613
+ cGridBag selfshadow = new cGridBag();
1614
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1615
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1616
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1617
+ diffuseSection.add(selfshadow);
15081618
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;
1619
+ cGridBag sheen = new cGridBag();
1620
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1621
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1622
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1623
+ diffuseSection.add(sheen);
15181624
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;
1625
+ cGridBag subsurface = new cGridBag();
1626
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1627
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1629
+ diffuseSection.add(subsurface);
15281630
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;
1631
+ cGridBag shadow = new cGridBag();
1632
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1633
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1635
+ diffuseSection.add(shadow);
15381636
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;
1637
+ cGridBag fakedepth = new cGridBag();
1638
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1639
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1640
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1641
+ diffuseSection.add(fakedepth);
15481642
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;
1643
+ panel.add(new JSeparator());
1644
+
1645
+ panel.add(diffuseSection);
1646
+
1647
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1648
+
1649
+ cGridBag specularSection = new cGridBag().setVertical(true);
15581650
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;
1651
+ cGridBag specular = new cGridBag();
1652
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1653
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1654
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1655
+ specularSection.add(specular);
15671656
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;
1657
+ cGridBag lightarea = new cGridBag();
1658
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1659
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1660
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1661
+ specularSection.add(lightarea);
15771662
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;
1663
+ cGridBag shininess = new cGridBag();
1664
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1665
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1666
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1667
+ specularSection.add(shininess);
15871668
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;
1669
+ cGridBag metalness = new cGridBag();
1670
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1671
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1673
+ specularSection.add(metalness);
15971674
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;
1675
+ cGridBag velvet = new cGridBag();
1676
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1677
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1678
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1679
+ specularSection.add(velvet);
16071680
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();
1681
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1682
+ //Return();
16201683 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16211684 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16221685 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1627,130 +1690,93 @@
16271690 // aConstraints.gridy += 1;
16281691 // aConstraints.gridwidth = 1;
16291692
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;
16381693
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;
1694
+ panel.add(new JSeparator());
1695
+
1696
+ panel.add(specularSection);
1697
+
1698
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1699
+
1700
+ cGridBag globalSection = new cGridBag().setVertical(true);
16481701
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;
1702
+ cGridBag camera = new cGridBag();
1703
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1704
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1705
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
+ globalSection.add(camera);
16581707
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;
1708
+ cGridBag ambient = new cGridBag();
1709
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1710
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1711
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1712
+ globalSection.add(ambient);
16681713
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;
1714
+ cGridBag backlit = new cGridBag();
1715
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1716
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1717
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1718
+ globalSection.add(backlit);
16791719
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;
1720
+ cGridBag opacity = new cGridBag();
1721
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1722
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1724
+ globalSection.add(opacity);
16891725
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;
1726
+ panel.add(new JSeparator());
1727
+
1728
+ panel.add(globalSection);
1729
+
1730
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1731
+
1732
+ cGridBag textureSection = new cGridBag().setVertical(true);
16991733
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;
1734
+ cGridBag bump = new cGridBag();
1735
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1736
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1737
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1738
+ textureSection.add(bump);
17091739
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;
1740
+ cGridBag noise = new cGridBag();
1741
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1742
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1744
+ textureSection.add(noise);
17191745
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;
1746
+ cGridBag power = new cGridBag();
1747
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1748
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1749
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1750
+ textureSection.add(power);
17291751
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;
1752
+ cGridBag borderfade = new cGridBag();
1753
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1754
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1755
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1756
+ textureSection.add(borderfade);
17391757
1740
- //aConstraints.weighty = 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1742
- //aConstraints.gridx += 1;
1743
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1744
- aConstraints.weighty = 0;
1758
+ cGridBag fog = new cGridBag();
1759
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1760
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1761
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1762
+ textureSection.add(fog);
17451763
1746
- aConstraints.gridx = 0;
1747
- aConstraints.gridy = 0;
1748
- aConstraints.gridwidth = 1;
1764
+ cGridBag opacityPower = new cGridBag();
1765
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1766
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1767
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1768
+ textureSection.add(opacityPower);
1769
+
1770
+ panel.add(new JSeparator());
1771
+
1772
+ panel.add(textureSection);
1773
+
1774
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17491775
17501776 SetMaterial(copy); // .GetMaterial());
17511777
1752
- colorField.addChangeListener(this);
1753
- modulationField.addChangeListener(this);
1778
+ //colorField.addChangeListener(this);
1779
+// modulationField.addChangeListener(this);
17541780 metalnessField.addChangeListener(this);
17551781 diffuseField.addChangeListener(this);
17561782 specularField.addChangeListener(this);
....@@ -1780,12 +1806,15 @@
17801806 opacityPowerField.addChangeListener(this);
17811807 /**/
17821808
1783
- resetSlidersButton.addActionListener(this);
17841809 clearMaterialButton.addActionListener(this);
17851810 createMaterialButton.addActionListener(this);
1786
-
1787
- propagateToggle.addItemListener(this);
1788
- multiplyToggle.addItemListener(this);
1811
+
1812
+ if (Globals.ADVANCED)
1813
+ {
1814
+ resetSlidersButton.addActionListener(this);
1815
+ propagateToggle.addItemListener(this);
1816
+ multiplyToggle.addItemListener(this);
1817
+ }
17891818 }
17901819
17911820 void DropFile(java.io.File[] files, boolean textures)
....@@ -1859,19 +1888,21 @@
18591888 }
18601889
18611890 // 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")))
1891
+ if (filename.toLowerCase().endsWith(".jpg")
1892
+ || filename.toLowerCase().endsWith(".jpeg")
1893
+ || filename.toLowerCase().endsWith(".gif")
1894
+ || filename.toLowerCase().endsWith(".png")
1895
+ || filename.toLowerCase().endsWith(".tre")
1896
+ || filename.toLowerCase().endsWith(".bmp")
1897
+ || filename.toLowerCase().endsWith(".tga")
1898
+ || filename.toLowerCase().endsWith(".sgi")
1899
+ || filename.toLowerCase().endsWith(".tif")
1900
+ || filename.toLowerCase().endsWith(".tiff"))
18731901 {
1874
- DropTexture(filename);
1902
+ if (textures)
1903
+ DropTexture(filename);
1904
+ else
1905
+ CreateBillboard(filename);
18751906 continue;
18761907 }
18771908
....@@ -1880,6 +1911,60 @@
18801911 }
18811912
18821913 ResetModel();
1914
+ }
1915
+
1916
+ void CreateBillboard(String filename)
1917
+ {
1918
+ Object3D source = null;
1919
+ Object3D group = copy;
1920
+
1921
+ if (group.selection.size() > 0)
1922
+ {
1923
+ source = group.selection.get(0);
1924
+ }
1925
+
1926
+ Grid grid = new Grid(1,1);
1927
+ grid.material = null;
1928
+
1929
+ grid.toParent = LA.newMatrix();
1930
+ grid.fromParent = LA.newMatrix();
1931
+ LA.matYRotate(grid.toParent, Math.PI/2);
1932
+ LA.matXRotate(grid.toParent, -Math.PI/2);
1933
+ LA.matXRotate(grid.fromParent, Math.PI/2);
1934
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
1935
+
1936
+ BillboardNode bb = new BillboardNode();
1937
+ bb.addChild(grid);
1938
+
1939
+ Object3D newgroup = new Object3D();
1940
+ newgroup.CreateMaterial();
1941
+
1942
+ File file = new File(filename);
1943
+ newgroup.name = file.getName();
1944
+ newgroup.addChild(bb);
1945
+
1946
+ Object3D main = newgroup;
1947
+
1948
+ main.SetPigmentTexture(filename);
1949
+
1950
+ if (source != null)
1951
+ {
1952
+ main.material = new cMaterial(source.material);
1953
+ if (main.projectedVertices.length < source.projectedVertices.length)
1954
+ {
1955
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
1956
+ }
1957
+
1958
+ for (int i=0; i<source.projectedVertices.length; i++)
1959
+ {
1960
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
1961
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
1962
+ }
1963
+
1964
+ main.texres = source.texres;
1965
+ }
1966
+
1967
+ makeSomething(newgroup, false);
18831968 }
18841969
18851970 Point location;
....@@ -1900,7 +1985,7 @@
19001985
19011986 //? flashIt = false;
19021987 CameraPane pane = (CameraPane) cameraView;
1903
- pane.clickStart(location.x, location.y, 0);
1988
+ pane.clickStart(location.x, location.y, 0, 0);
19041989 pane.clickEnd(location.x, location.y, 0, true);
19051990
19061991 if (group.selection.size() == 1)
....@@ -1949,6 +2034,7 @@
19492034 e2.printStackTrace();
19502035 }
19512036 }
2037
+
19522038 LoadJMEThread loadThread;
19532039
19542040 class LoadJMEThread extends Thread
....@@ -2006,6 +2092,7 @@
20062092 //LoadFile0(filename, converter);
20072093 }
20082094 }
2095
+
20092096 LoadOBJThread loadObjThread;
20102097
20112098 class LoadOBJThread extends Thread
....@@ -2084,19 +2171,19 @@
20842171
20852172 void LoadObjFile(String fullname)
20862173 {
2087
- /*
2174
+ System.out.println("Loading " + fullname);
2175
+ /**/
20882176 //lastFilename = fullname;
20892177 if(loadObjThread == null)
20902178 {
2091
- loadObjThread = new LoadOBJThread();
2092
- loadObjThread.start();
2179
+ loadObjThread = new LoadOBJThread();
2180
+ loadObjThread.start();
20932181 }
20942182
20952183 loadObjThread.add(fullname);
2096
- */
2184
+ /**/
20972185
2098
- System.out.println("Loading " + fullname);
2099
- makeSomething(new FileObject(fullname, true), true);
2186
+ //makeSomething(new FileObject(fullname, true), true);
21002187 }
21012188
21022189 void LoadGFDFile(String fullname)
....@@ -2138,6 +2225,8 @@
21382225 {
21392226 Mocap sel = (Mocap) copy.selection.get(0);
21402227
2228
+ sel.SetCurrentBones(sel.frame);
2229
+
21412230 sel.fullname = fullname;
21422231
21432232 if (changename)
....@@ -2151,14 +2240,18 @@
21512240 sel.smoothed = false;
21522241
21532242 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2243
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2244
+ sel.SetGlobalTransform();
2245
+ sel.LoadData();
2246
+ sel.Rewind();
2247
+ sel.Fade();
21552248 // sel.setPose(0);
21562249 refreshContents();
21572250 } else
21582251 {
21592252 mocap.Reset();
21602253 // new skeleton
2161
- makeSomething(mocap, false); // true);
2254
+ makeSomething(mocap, true); // true);
21622255 }
21632256 } catch (Exception e)
21642257 {
....@@ -2185,6 +2278,8 @@
21852278 {
21862279 Mocap sel = (Mocap) select;
21872280
2281
+ sel.SetCurrentBones(sel.frame);
2282
+
21882283 File file = new File(fullname);
21892284
21902285 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2346,11 @@
22512346
22522347 if (!changename)
22532348 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2349
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2350
+ sel.SetGlobalTransform();
2351
+ sel.LoadData();
2352
+ sel.Rewind();
2353
+ sel.Fade();
22552354 }
22562355
22572356 // sel.setPose(0);
....@@ -2345,11 +2444,11 @@
23452444
23462445 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472446 {
2348
- if (GraphreeD.standAlone)
2447
+ if (Grafreed.standAlone)
23492448 {
23502449 /**/
23512450 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2352
- browser.show();
2451
+ browser.setVisible(true);
23532452 String filename = browser.getFile();
23542453 if (filename != null && filename.length() > 0)
23552454 {
....@@ -2494,6 +2593,7 @@
24942593 }
24952594 if (input == null)
24962595 {
2596
+ new Exception().printStackTrace();
24972597 System.exit(0);
24982598 }
24992599
....@@ -2708,7 +2808,8 @@
27082808 return;
27092809 }
27102810
2711
- multiplyToggle.setSelected(mat.multiply);
2811
+ if (multiplyToggle != null)
2812
+ multiplyToggle.setSelected(mat.multiply);
27122813
27132814 assert (object.projectedVertices != null);
27142815
....@@ -2890,25 +2991,42 @@
28902991 // june 2013 copy.HardTouch();
28912992 cameraView.repaint();
28922993 return;
2893
- } else if (event.getSource() == toggleFullItem)
2994
+ } else if (event.getSource() == toggleTimelineItem)
28942995 {
2895
- if (CameraPane.FULLSCREEN)
2996
+ timeline ^= true;
2997
+
2998
+ if (timeline)
28962999 {
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);
3000
+ centralPanel.remove(cameraView);
3001
+ cameraPanel.add(cameraView);
3002
+ centralPanel.add(cameraPanel);
3003
+ frame.setJMenuBar(timelineMenubar);
3004
+ wasFullScreen = CameraPane.FULLSCREEN;
3005
+ if (!CameraPane.FULLSCREEN)
3006
+ ToggleFullScreen();
3007
+ toggleFullScreenItem.setEnabled(false);
29043008 }
3009
+ else
3010
+ {
3011
+ centralPanel.remove(cameraPanel);
3012
+ centralPanel.add(cameraView);
3013
+ frame.setJMenuBar(null);
3014
+ if (!wasFullScreen)
3015
+ ToggleFullScreen();
3016
+ toggleFullScreenItem.setEnabled(true);
3017
+ }
3018
+
29053019 frame.validate();
2906
- cameraView.ToggleFullScreen();
3020
+ return;
3021
+ } else if (event.getSource() == toggleFullScreenItem)
3022
+ {
3023
+ ToggleFullScreen();
3024
+ frame.validate();
29073025
29083026 return;
2909
- } else if (event.getSource() == toggleRandomItem)
3027
+ } else if (event.getSource() == toggleSwitchItem)
29103028 {
2911
- cameraView.ToggleRandom();
3029
+ cameraView.ToggleSwitch();
29123030 cameraView.repaint();
29133031 return;
29143032 } else if (event.getSource() == toggleHandleItem)
....@@ -2937,6 +3055,10 @@
29373055 {
29383056 copy.live ^= true;
29393057 return;
3058
+ } else if (event.getSource() == selectCB)
3059
+ {
3060
+ copy.dontselect ^= true;
3061
+ return;
29403062 } else if (event.getSource() == hideCB)
29413063 {
29423064 copy.hide ^= true;
....@@ -2951,6 +3073,7 @@
29513073 if (event.getSource() == randomCB)
29523074 {
29533075 copy.random ^= true;
3076
+ objEditor.refreshContents();
29543077 return;
29553078 }
29563079 if (event.getSource() == speedupCB)
....@@ -2974,8 +3097,9 @@
29743097
29753098 public void actionPerformed(ActionEvent event)
29763099 {
3100
+ Object source = event.getSource();
29773101 // SCRIPT DIALOG
2978
- if (event.getSource() == okbutton)
3102
+ if (source == okbutton)
29793103 {
29803104 textpanel.setVisible(false);
29813105 textpanel.remove(textarea);
....@@ -2987,7 +3111,7 @@
29873111 textarea = null;
29883112 textpanel = null;
29893113 }
2990
- if (event.getSource() == cancelbutton)
3114
+ if (source == cancelbutton)
29913115 {
29923116 textpanel.setVisible(false);
29933117 textpanel.remove(textarea);
....@@ -2999,49 +3123,50 @@
29993123 //applySelf();
30003124 //client.refreshEditWindow();
30013125 //refreshContents();
3002
- if (event.getSource() == nameField)
3126
+ if (source == nameField)
30033127 {
30043128 //System.out.println("ObjEditor " + event);
30053129 applySelf0(true);
30063130 //parent.applySelf();
30073131 objEditor.refreshContents();
3008
- } else if (event.getSource() == resetButton)
3132
+ } else if (source == resetButton)
30093133 {
30103134 CameraPane.fullreset = true;
30113135 copy.Reset(); // ResetMeshes();
30123136 copy.Touch();
30133137 objEditor.refreshContents();
3014
- } else if (event.getSource() == stepItem)
3138
+ } else if (source == stepItem)
30153139 {
3016
- cameraView.ONESTEP = true;
3140
+ //cameraView.ONESTEP = true;
3141
+ Globals.ONESTEP = true;
30173142 cameraView.repaint();
30183143 return;
3019
- } else if (event.getSource() == stepButton)
3144
+ } else if (source == stepButton)
30203145 {
30213146 copy.Step();
30223147 copy.Touch();
30233148 objEditor.refreshContents();
3024
- } else if (event.getSource() == slowerButton)
3149
+ } else if (source == slowerButton)
30253150 {
30263151 copy.Slower();
30273152 copy.Touch();
30283153 objEditor.refreshContents();
3029
- } else if (event.getSource() == fasterButton)
3154
+ } else if (source == fasterButton)
30303155 {
30313156 copy.Faster();
30323157 copy.Touch();
30333158 objEditor.refreshContents();
3034
- } else if (event.getSource() == remarkButton)
3159
+ } else if (source == remarkButton)
30353160 {
30363161 copy.Remark();
30373162 copy.Touch();
30383163 objEditor.refreshContents();
3039
- } else if (event.getSource() == stepAllButton)
3164
+ } else if (source == stepAllButton)
30403165 {
30413166 copy.StepAll();
30423167 copy.Touch();
30433168 objEditor.refreshContents();
3044
- } else if (event.getSource() == resetAllButton)
3169
+ } else if (source == resetAllButton)
30453170 {
30463171 //CameraPane.fullreset = true;
30473172 copy.ResetAll(); // ResetMeshes();
....@@ -3074,53 +3199,75 @@
30743199 // Close();
30753200 // }
30763201 // else
3077
- if (event.getSource() == resetSlidersButton)
3202
+ if (source == resetSlidersButton)
30783203 {
30793204 ResetSliders();
3080
- } else if (event.getSource() == clearMaterialButton)
3205
+ } else if (source == clearMaterialButton)
30813206 {
30823207 ClearMaterial();
3083
- } else if (event.getSource() == createMaterialButton)
3208
+ } else if (source == createMaterialButton)
30843209 {
30853210 CreateMaterial();
3086
- } else if (event.getSource() == clearPanelButton)
3211
+ } else if (source == clearPanelButton)
30873212 {
30883213 copy.ClearUI();
30893214 refreshContents(true);
3090
- } /*
3091
- }
3092
-
3093
- public boolean action(Event event, Object arg)
3094
- {
3095
- */ else if (event.getSource() == closeItem)
3215
+ } else if (source == importGFDItem)
3216
+ {
3217
+ ImportGFD();
3218
+ } else
3219
+ if (source == importVRMLX3DItem)
3220
+ {
3221
+ ImportVRMLX3D();
3222
+ } else
3223
+ if (source == import3DSItem)
3224
+ {
3225
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3226
+ } else
3227
+ if (source == importOBJItem)
3228
+ {
3229
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3230
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3231
+ browser.setVisible(true);
3232
+ String filename = browser.getFile();
3233
+ if (filename != null && filename.length() > 0)
3234
+ {
3235
+ String fullname = browser.getDirectory() + filename;
3236
+ makeSomething(ReadOBJ(fullname), true);
3237
+ }
3238
+ } else
3239
+ if (source == closeItem)
30963240 {
30973241 Close();
30983242 //return true;
3099
- } else if (event.getSource() == loadItem)
3243
+ } else if (source == loadItem)
31003244 {
31013245 load();
31023246 //return true;
3103
- } else if (event.getSource() == saveItem)
3247
+ } else if (source == newItem)
3248
+ {
3249
+ New();
3250
+ } else if (source == saveItem)
31043251 {
31053252 save();
31063253 //return true;
3107
- } else if (event.getSource() == saveAsItem)
3254
+ } else if (source == saveAsItem)
31083255 {
31093256 saveAs();
31103257 //return true;
3111
- } else if (event.getSource() == reexportItem)
3258
+ } else if (source == reexportItem)
31123259 {
31133260 reexport();
31143261 //return true;
3115
- } else if (event.getSource() == exportAsItem)
3262
+ } else if (source == exportAsItem)
31163263 {
31173264 export();
31183265 //return true;
3119
- } else if (event.getSource() == povItem)
3266
+ } else if (source == povItem)
31203267 {
31213268 generatePOV();
31223269 //return true;
3123
- } else if (event.getSource() == zBufferItem)
3270
+ } else if (source == zBufferItem)
31243271 {
31253272 try
31263273 {
....@@ -3142,21 +3289,8 @@
31423289 cameraView.repaint();
31433290 //return true;
31443291 }
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)
3292
+ */ else // combos...
3293
+ if (source == texresMenu)
31603294 {
31613295 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31623296 copy.texres = texresMenu.getSelectedIndex();
....@@ -3168,27 +3302,283 @@
31683302 }
31693303 }
31703304
3171
- void ToggleAnimation()
3305
+ void New()
31723306 {
3173
- if (!CameraPane.ANIMATION)
3307
+ while (copy.Size() > 1)
31743308 {
3175
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3309
+ copy.remove(1);
3310
+ }
3311
+
3312
+ ResetModel();
3313
+ objEditor.refreshContents();
3314
+ }
3315
+
3316
+ static public byte[] Compress(Object3D o)
3317
+ {
3318
+ try
3319
+ {
3320
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3321
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3322
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3323
+
3324
+ Object3D parent = o.parent;
3325
+ o.parent = null;
3326
+
3327
+ out.writeObject(o);
3328
+
3329
+ o.parent = parent;
3330
+
3331
+ out.flush();
3332
+
3333
+ zstream.close();
3334
+ out.close();
3335
+
3336
+ return baos.toByteArray();
3337
+ } catch (Exception e)
3338
+ {
3339
+ System.err.println(e);
3340
+ return null;
3341
+ }
3342
+ }
3343
+
3344
+ static public Object Uncompress(byte[] bytes)
3345
+ {
3346
+ System.out.println("#bytes = " + bytes.length);
3347
+ try
3348
+ {
3349
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3350
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3351
+ ObjectInputStream in = new ObjectInputStream(istream);
3352
+ Object obj = in.readObject();
3353
+ in.close();
3354
+
3355
+ return obj;
3356
+ } catch (Exception e)
3357
+ {
3358
+ System.err.println(e);
3359
+ return null;
3360
+ }
3361
+ }
3362
+
3363
+ static public Object clone(Object o)
3364
+ {
3365
+ try
3366
+ {
3367
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3369
+
3370
+ out.writeObject(o);
3371
+
3372
+ out.flush();
3373
+ out.close();
3374
+
3375
+ byte[] bytes = baos.toByteArray();
3376
+
3377
+ System.out.println("clone = " + bytes.length);
3378
+
3379
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3380
+ ObjectInputStream in = new ObjectInputStream(bais);
3381
+ Object obj = in.readObject();
3382
+ in.close();
3383
+
3384
+ return obj;
3385
+ } catch (Exception e)
3386
+ {
3387
+ System.err.println(e);
3388
+ return null;
3389
+ }
3390
+ }
3391
+
3392
+ cRadio GetCurrentTab()
3393
+ {
3394
+ cRadio ab;
3395
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3396
+ {
3397
+ ab = (cRadio)e.nextElement();
3398
+ if(ab.GetObject() == copy)
3399
+ {
3400
+ return ab;
3401
+ }
3402
+ }
3403
+
3404
+ return null;
3405
+ }
3406
+
3407
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3408
+
3409
+ public void Save()
3410
+ {
3411
+ cRadio tab = GetCurrentTab();
3412
+
3413
+ boolean temp = CameraPane.SWITCH;
3414
+ CameraPane.SWITCH = false;
3415
+
3416
+ copy.ExtractBigData(hashtable);
3417
+
3418
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3419
+ tab.graphs[tab.undoindex++] = Compress(copy);
3420
+
3421
+ copy.RestoreBigData(hashtable);
3422
+
3423
+ CameraPane.SWITCH = temp;
3424
+
3425
+ //assert(hashtable.isEmpty());
3426
+
3427
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3428
+ {
3429
+ tab.graphs[i] = null;
3430
+ }
3431
+
3432
+ // test save
3433
+ if (false)
3434
+ {
3435
+ try
3436
+ {
3437
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3438
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3439
+
3440
+ p.writeObject(copy);
3441
+
3442
+ p.flush();
3443
+
3444
+ ostream.close();
3445
+ } catch (Exception e)
3446
+ {
3447
+ e.printStackTrace();
3448
+ }
3449
+ }
3450
+ }
3451
+
3452
+ void CopyChanged(Object3D obj)
3453
+ {
3454
+ boolean temp = CameraPane.SWITCH;
3455
+ CameraPane.SWITCH = false;
3456
+
3457
+ copy.ExtractBigData(hashtable);
3458
+
3459
+ copy.clear();
3460
+
3461
+ for (int i=0; i<obj.Size(); i++)
3462
+ {
3463
+ copy.add(obj.get(i));
3464
+ }
3465
+
3466
+ copy.RestoreBigData(hashtable);
3467
+
3468
+ CameraPane.SWITCH = temp;
3469
+
3470
+ //assert(hashtable.isEmpty());
3471
+
3472
+ copy.Touch();
3473
+
3474
+ ResetModel();
3475
+ copy.HardTouch(); // recompile?
3476
+
3477
+ cRadio ab;
3478
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3479
+ {
3480
+ ab = (cRadio)e.nextElement();
3481
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3482
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3483
+ if (test != null)
3484
+ {
3485
+ test.editWindow = ab.object.editWindow;
3486
+ ab.object = test;
3487
+ }
3488
+ }
3489
+
3490
+ refreshContents();
3491
+ }
3492
+
3493
+ public void Undo()
3494
+ {
3495
+ cRadio tab = GetCurrentTab();
3496
+
3497
+ if (tab.undoindex == 0)
3498
+ {
3499
+ java.awt.Toolkit.getDefaultToolkit().beep();
3500
+ return;
3501
+ }
3502
+
3503
+ if (tab.graphs[tab.undoindex] == null)
3504
+ {
3505
+ Save();
3506
+ tab.undoindex -= 1;
3507
+ }
3508
+
3509
+ tab.undoindex -= 1;
3510
+
3511
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3512
+ }
3513
+
3514
+ public void Redo()
3515
+ {
3516
+ cRadio tab = GetCurrentTab();
3517
+
3518
+ if (tab.graphs[tab.undoindex + 1] == null)
3519
+ {
3520
+ java.awt.Toolkit.getDefaultToolkit().beep();
3521
+ return;
3522
+ }
3523
+
3524
+ tab.undoindex += 1;
3525
+
3526
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3527
+ }
3528
+
3529
+ void ImportGFD()
3530
+ {
3531
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
31763532 browser.show();
31773533 String filename = browser.getFile();
31783534 if (filename != null && filename.length() > 0)
31793535 {
3180
- CameraPane.filename = browser.getDirectory() + filename;
3536
+ String fullname = browser.getDirectory() + filename;
3537
+
3538
+ //Object3D readobj =
3539
+ objEditor.ReadGFD(fullname, objEditor);
3540
+ //makeSomething(readobj);
3541
+ }
3542
+ }
3543
+
3544
+ void ImportVRMLX3D()
3545
+ {
3546
+ if (Grafreed.standAlone)
3547
+ {
3548
+ /**/
3549
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3550
+ browser.show();
3551
+ String filename = browser.getFile();
3552
+ if (filename != null && filename.length() > 0)
3553
+ {
3554
+ String fullname = browser.getDirectory() + filename;
3555
+ LoadVRMLX3D(fullname);
3556
+ }
3557
+ /**/
3558
+ }
3559
+ }
3560
+
3561
+ void ToggleAnimation()
3562
+ {
3563
+ if (!Globals.ANIMATION)
3564
+ {
3565
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3566
+ browser.setVisible(true);
3567
+ String filename = browser.getFile();
3568
+ if (filename != null && filename.length() > 0)
3569
+ {
3570
+ Globals.filename = browser.getDirectory() + filename;
31813571 //CameraPane.framecount = 0;
3182
- CameraPane.imagecount = 0;
3572
+ Globals.imagecount = 0;
31833573
3184
- CameraPane.ANIMATION ^= true;
3574
+ Globals.ANIMATION ^= true;
31853575
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
3576
+ Grafreed.wav.cursor = 0;
3577
+ Grafreed.wav.loop = 0;
31883578 }
31893579 } else
31903580 {
3191
- CameraPane.ANIMATION ^= true;
3581
+ Globals.ANIMATION ^= true;
31923582 }
31933583 }
31943584
....@@ -3234,7 +3624,7 @@
32343624 void CreateMaterial()
32353625 {
32363626 //copy.ClearMaterial(); // PATCH
3237
- copy.CreateMaterialS(multiplyToggle.isSelected());
3627
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32383628 if (copy.selection.size() > 0)
32393629 //SetMaterial(copy);
32403630 {
....@@ -3293,11 +3683,11 @@
32933683 {
32943684 copy.ResetBlockLoop(); // temporary problem
32953685
3296
- boolean random = CameraPane.RANDOM;
3297
- CameraPane.RANDOM = false; // parse everything
3686
+ boolean random = CameraPane.SWITCH;
3687
+ CameraPane.SWITCH = false; // parse everything
32983688 copy.ResetDisplayList();
32993689 copy.HardTouch();
3300
- CameraPane.RANDOM = random;
3690
+ CameraPane.SWITCH = random;
33013691 }
33023692
33033693 // public void applySelf()
....@@ -3367,10 +3757,40 @@
33673757 current.fakedepth = (float) fakedepthField.getFloat();
33683758 current.shadowbias = (float) shadowbiasField.getFloat();
33693759
3370
- if (!NumberSlider.frozen)
3760
+ if (!cNumberSlider.frozen)
33713761 {
33723762 //System.out.println("Propagate = " + propagate);
33733763 copy.UpdateMaterial(anchor, current, propagate);
3764
+
3765
+ if (copy.material != null)
3766
+ {
3767
+ cMaterial mat = copy.material;
3768
+
3769
+ colorField.SetToolTipValue((mat.color));
3770
+ modulationField.SetToolTipValue((mat.modulation));
3771
+ metalnessField.SetToolTipValue((mat.metalness));
3772
+ diffuseField.SetToolTipValue((mat.diffuse));
3773
+ specularField.SetToolTipValue((mat.specular));
3774
+ shininessField.SetToolTipValue((mat.shininess));
3775
+ shiftField.SetToolTipValue((mat.shift));
3776
+ ambientField.SetToolTipValue((mat.ambient));
3777
+ lightareaField.SetToolTipValue((mat.lightarea));
3778
+ diffusenessField.SetToolTipValue((mat.factor));
3779
+ velvetField.SetToolTipValue((mat.velvet));
3780
+ sheenField.SetToolTipValue((mat.sheen));
3781
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3782
+ backlitField.SetToolTipValue((mat.bump));
3783
+ anisoField.SetToolTipValue((mat.aniso));
3784
+ anisoVField.SetToolTipValue((mat.anisoV));
3785
+ cameraField.SetToolTipValue((mat.cameralight));
3786
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3787
+ shadowField.SetToolTipValue((mat.shadow));
3788
+ textureField.SetToolTipValue((mat.texture));
3789
+ opacityField.SetToolTipValue((mat.opacity));
3790
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3791
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3792
+ }
3793
+
33743794 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33753795 {
33763796 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3415,6 +3835,7 @@
34153835 || e.getSource() == apertureField
34163836 || e.getSource() == shadowblurField)
34173837 {
3838
+ new Exception().printStackTrace();
34183839 System.exit(0);
34193840 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34203841 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3441,7 +3862,13 @@
34413862 //System.out.println("PARENT = " + parent);
34423863 //if (parent != null)
34433864 // parent.applySelf();
3444
- refreshContents();
3865
+ if (e.getSource() == normalpushField)
3866
+ {
3867
+ objEditor.refreshContents();
3868
+ //Refresh();
3869
+ }
3870
+ else
3871
+ refreshContents();
34453872 // ??? client.refreshEditWindow();
34463873 }
34473874 //else
....@@ -3453,7 +3880,7 @@
34533880 //group.name = nameField.getText();
34543881 //objEditor.applySelf();
34553882
3456
- assert (objEditor == this);
3883
+ // OCT2018: assert (objEditor == this);
34573884 if (copy.selection == null || copy.selection.size() == 0)
34583885 //super.applySelf()
34593886 ; else
....@@ -3477,12 +3904,18 @@
34773904 objEditor.copy = keep;
34783905 }
34793906 }
3907
+
3908
+ if (normalpushField != null)
3909
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
34803910 }
34813911
34823912 void SnapObject()
34833913 {
3484
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3485
- SnapObject(obj);
3914
+ if (copy.selection.size() > 0)
3915
+ {
3916
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3917
+ SnapObject(obj);
3918
+ }
34863919 }
34873920
34883921 void SnapObject(Object3D obj)
....@@ -3596,7 +4029,7 @@
35964029
35974030 if (obj.parent != null)
35984031 {
3599
- obj.parent.TransformToWorld(interest);
4032
+// obj.parent.TransformToWorld(interest);
36004033 }
36014034
36024035 if (!CameraPane.TRACK)
....@@ -3728,7 +4161,7 @@
37284161
37294162 radioPanel.revalidate();
37304163 radioPanel.repaint();
3731
- ctrlPanel.revalidate(); // ? new
4164
+ ctrlPanel.validate(); // ? new
37324165 ctrlPanel.repaint();
37334166 }
37344167 }
....@@ -3737,6 +4170,7 @@
37374170
37384171 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37394172 {
4173
+ Save();
37404174 //Tween.set(thing, 0).target(1).start(tweenManager);
37414175 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37424176 // if (thing instanceof GenericJointDemo)
....@@ -3940,6 +4374,7 @@
39404374 }
39414375 }
39424376 }
4377
+
39434378 LoadGFDThread loadGFDThread;
39444379
39454380 void ReadGFD(String fullname, iCallBack cb)
....@@ -3959,8 +4394,10 @@
39594394
39604395 try
39614396 {
4397
+ // Try compressed version first.
39624398 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3963
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4399
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4400
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39644401
39654402 readobj = (Object3D) p.readObject();
39664403 istream.close();
....@@ -3968,7 +4405,20 @@
39684405 readobj.ResetDisplayList();
39694406 } catch (Exception e)
39704407 {
3971
- e.printStackTrace();
4408
+ //e.printStackTrace();
4409
+ try
4410
+ {
4411
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4412
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4413
+
4414
+ readobj = (Object3D) p.readObject();
4415
+ istream.close();
4416
+
4417
+ readobj.ResetDisplayList();
4418
+ } catch (Exception e2)
4419
+ {
4420
+ e2.printStackTrace();
4421
+ }
39724422 }
39734423 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
39744424 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4014,6 +4464,12 @@
40144464
40154465 void LoadIt(Object obj)
40164466 {
4467
+ if (obj == null)
4468
+ {
4469
+ // Invalid file
4470
+ return;
4471
+ }
4472
+
40174473 System.out.println("Loaded " + obj);
40184474 //new Exception().printStackTrace();
40194475 Object3D readobj = (Object3D) obj;
....@@ -4023,6 +4479,7 @@
40234479
40244480 if (readobj != null)
40254481 {
4482
+ Save();
40264483 try
40274484 {
40284485 //readobj.deepCopySelf(copy);
....@@ -4085,7 +4542,7 @@
40854542
40864543 void load() // throws ClassNotFoundException
40874544 {
4088
- if (GraphreeD.standAlone)
4545
+ if (Grafreed.standAlone)
40894546 {
40904547 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914548 browser.show();
....@@ -4172,11 +4629,13 @@
41724629 try
41734630 {
41744631 FileOutputStream ostream = new FileOutputStream(lastname);
4175
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4632
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4633
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
41764634
41774635 p.writeObject(copy);
41784636 p.flush();
41794637
4638
+ zstream.close();
41804639 ostream.close();
41814640
41824641 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4186,11 +4645,12 @@
41864645 {
41874646 }
41884647 }
4648
+
41894649 String lastname;
41904650
41914651 void saveAs()
41924652 {
4193
- if (GraphreeD.standAlone)
4653
+ if (Grafreed.standAlone)
41944654 {
41954655 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964656 browser.setVisible(true);
....@@ -4213,10 +4673,20 @@
42134673
42144674 Object3D object = copy.selection.get(0);
42154675
4676
+ FileObject fileobj = null;
4677
+
4678
+ if (object instanceof FileObject)
4679
+ fileobj = (FileObject)object;
4680
+
42164681 if (object.fileparent != null)
42174682 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
4683
+ assert(fileobj == null);
42194684
4685
+ fileobj = (FileObject) object.fileparent;
4686
+ }
4687
+
4688
+ if (fileobj != null)
4689
+ {
42204690 System.out.println("WriteObject " + object + " : " + fileobj.name);
42214691 WriteObject(object, fileobj.name);
42224692 }
....@@ -4259,7 +4729,7 @@
42594729 }
42604730 }
42614731 else
4262
- //if (GraphreeD.standAlone)
4732
+ //if (GrafreeD.standAlone)
42634733 {
42644734 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42654735 browser.setVisible(true);
....@@ -4285,13 +4755,13 @@
42854755 try
42864756 {
42874757 FileOutputStream ostream = new FileOutputStream(filename);
4288
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4289
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4758
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4759
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42904760
42914761 Object3D objectparent = obj.parent;
42924762 obj.parent = null;
42934763
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
4764
+ Object3D object = (Object3D) Grafreed.clone(obj);
42954765
42964766 obj.parent = objectparent;
42974767
....@@ -4303,8 +4773,8 @@
43034773 p.writeObject(object);
43044774 p.flush();
43054775
4776
+ zstream.close();
43064777 ostream.close();
4307
- // zstream.close();
43084778
43094779 // group.selection.get(0).parent = parent;
43104780 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4325,7 +4795,7 @@
43254795 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43264796 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43274797 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
4798
+ if (Grafreed.standAlone)
43294799 {
43304800 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43314801 browser.show();
....@@ -4351,7 +4821,8 @@
43514821 Object3D client;
43524822 Object3D copy;
43534823 MenuBar menuBar;
4354
- Menu windowMenu;
4824
+ Menu fileMenu;
4825
+ MenuItem newItem;
43554826 MenuItem loadItem;
43564827 MenuItem saveItem;
43574828 MenuItem saveAsItem;
....@@ -4359,21 +4830,20 @@
43594830 MenuItem reexportItem;
43604831 MenuItem povItem;
43614832 MenuItem closeItem;
4362
- Menu cameraMenu;
4833
+
43634834 CheckboxMenuItem zBufferItem;
43644835 //MenuItem normalLensItem;
4365
- MenuItem editCameraItem;
4366
- MenuItem revertCameraItem;
4367
- CheckboxMenuItem toggleLiveItem;
43684836 MenuItem stepItem;
4369
- CheckboxMenuItem toggleFullItem;
4837
+ CheckboxMenuItem toggleLiveItem;
4838
+ CheckboxMenuItem toggleFullScreenItem;
4839
+ CheckboxMenuItem toggleTimelineItem;
43704840 CheckboxMenuItem toggleRenderItem;
43714841 CheckboxMenuItem toggleDebugItem;
43724842 CheckboxMenuItem toggleFrustumItem;
43734843 CheckboxMenuItem toggleFootContactItem;
43744844 CheckboxMenuItem toggleDLItem;
43754845 CheckboxMenuItem toggleTextureItem;
4376
- CheckboxMenuItem toggleRandomItem;
4846
+ CheckboxMenuItem toggleSwitchItem;
43774847 CheckboxMenuItem toggleRootItem;
43784848 CheckboxMenuItem animationItem;
43794849 CheckboxMenuItem toggleHandleItem;
....@@ -4381,23 +4851,26 @@
43814851 JSplitPane mainPanel;
43824852 JScrollPane scrollpane;
43834853 JPanel toolbarPanel;
4384
- JPanel treePanel;
4854
+ cGridBag treePanel;
43854855 JPanel radioPanel;
43864856 ButtonGroup buttonGroup;
4387
- JPanel ctrlPanel;
4388
- JPanel materialPanel;
4857
+ cGridBag ctrlPanel;
4858
+ cGridBag materialPanel;
43894859 JScrollPane infoPanel;
4390
- JPanel optionsPanel;
4860
+ cGridBag optionsPanel;
43914861 JTabbedPane objectPanel;
4392
- JPanel XYZPanel;
4862
+ cGridBag XYZPanel;
43934863 JSplitPane gridPanel;
43944864 JSplitPane bigPanel;
4395
- JPanel bigThree;
4396
- JTabbedPane jtp;
4397
- JPanel cameraPanel;
4865
+ cGridBag bigThree;
4866
+ cGridBag scenePanel;
4867
+ cGridBag centralPanel;
4868
+ JSplitPane cameraPanel;
4869
+ JPanel timelinePanel;
4870
+ JMenuBar timelineMenubar;
43984871 JSplitPane framePanel;
43994872 JTextArea/*Field*/ nameField;
4400
- cButton textureButton;
4873
+ //cButton textureButton;
44014874 cButton okButton;
44024875 cButton applyButton;
44034876 cButton cancelButton;
....@@ -4444,65 +4917,72 @@
44444917 // MATERIAL
44454918 JLabel materialLabel;
44464919 JLabel colorLabel;
4447
- NumberSlider colorField;
4920
+ cNumberSlider colorField;
44484921 JLabel modulationLabel;
4449
- NumberSlider modulationField;
4922
+ cNumberSlider modulationField;
44504923 JLabel metalnessLabel;
4451
- NumberSlider metalnessField;
4924
+ cNumberSlider metalnessField;
44524925 JLabel diffuseLabel;
4453
- NumberSlider diffuseField;
4926
+ cNumberSlider diffuseField;
44544927 JLabel specularLabel;
4455
- NumberSlider specularField;
4928
+ cNumberSlider specularField;
44564929 JLabel shininessLabel;
4457
- NumberSlider shininessField;
4930
+ cNumberSlider shininessField;
44584931 JLabel shiftLabel;
4459
- NumberSlider shiftField;
4932
+ cNumberSlider shiftField;
44604933 JLabel ambientLabel;
4461
- NumberSlider ambientField;
4934
+ cNumberSlider ambientField;
44624935 JLabel lightareaLabel;
4463
- NumberSlider lightareaField;
4936
+ cNumberSlider lightareaField;
44644937 JLabel diffusenessLabel;
4465
- NumberSlider diffusenessField;
4938
+ cNumberSlider diffusenessField;
44664939 JLabel velvetLabel;
4467
- NumberSlider velvetField;
4940
+ cNumberSlider velvetField;
44684941 JLabel sheenLabel;
4469
- NumberSlider sheenField;
4942
+ cNumberSlider sheenField;
44704943 JLabel subsurfaceLabel;
4471
- NumberSlider subsurfaceField;
4944
+ cNumberSlider subsurfaceField;
44724945 //JLabel bumpLabel;
44734946 //NumberSlider bumpField;
44744947 JLabel backlitLabel;
4475
- NumberSlider backlitField;
4948
+ cNumberSlider backlitField;
44764949 JLabel anisoLabel;
4477
- NumberSlider anisoField;
4950
+ cNumberSlider anisoField;
44784951 JLabel anisoVLabel;
4479
- NumberSlider anisoVField;
4952
+ cNumberSlider anisoVField;
44804953 JLabel cameraLabel;
4481
- NumberSlider cameraField;
4954
+ cNumberSlider cameraField;
44824955 JLabel selfshadowLabel;
4483
- NumberSlider selfshadowField;
4956
+ cNumberSlider selfshadowField;
44844957 JLabel shadowLabel;
4485
- NumberSlider shadowField;
4958
+ cNumberSlider shadowField;
44864959 JLabel textureLabel;
4487
- NumberSlider textureField;
4960
+ cNumberSlider textureField;
44884961 JLabel opacityLabel;
4489
- NumberSlider opacityField;
4962
+ cNumberSlider opacityField;
44904963 JLabel fakedepthLabel;
4491
- NumberSlider fakedepthField;
4964
+ cNumberSlider fakedepthField;
44924965 JLabel shadowbiasLabel;
4493
- NumberSlider shadowbiasField;
4966
+ cNumberSlider shadowbiasField;
44944967 JLabel bumpLabel;
4495
- NumberSlider bumpField;
4968
+ cNumberSlider bumpField;
44964969 JLabel noiseLabel;
4497
- NumberSlider noiseField;
4970
+ cNumberSlider noiseField;
44984971 JLabel powerLabel;
4499
- NumberSlider powerField;
4972
+ cNumberSlider powerField;
45004973 JLabel borderfadeLabel;
4501
- NumberSlider borderfadeField;
4974
+ cNumberSlider borderfadeField;
45024975 JLabel fogLabel;
4503
- NumberSlider fogField;
4976
+ cNumberSlider fogField;
45044977 JLabel opacityPowerLabel;
4505
- NumberSlider opacityPowerField;
4978
+ cNumberSlider opacityPowerField;
45064979 JTree jTree;
45074980 //ObjectUI parent;
4981
+
4982
+ cNumberSlider normalpushField;
4983
+
4984
+ private MenuItem importGFDItem;
4985
+ private MenuItem importVRMLX3DItem;
4986
+ private MenuItem import3DSItem;
4987
+ private MenuItem importOBJItem;
45084988 }