Normand Briere
2019-06-25 26b24f5b623e709a88e91e9bce0864f9d5e8f084
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -35,6 +36,67 @@
3536
3637 GroupEditor callee;
3738 JFrame frame;
39
+
40
+ static ObjEditor theFrame;
41
+
42
+ cButton GetButton(String name, boolean border)
43
+ {
44
+ try
45
+ {
46
+ ImageIcon icon = GetIcon(name);
47
+ return new cButton(icon, border);
48
+ }
49
+ catch (Exception e)
50
+ {
51
+ return new cButton(name, border);
52
+ }
53
+ }
54
+
55
+ cToggleButton GetToggleButton(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cToggleButton(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cToggleButton(name, border);
65
+ }
66
+ }
67
+
68
+ cCheckBox GetCheckBox(String name, boolean border)
69
+ {
70
+ try
71
+ {
72
+ ImageIcon icon = GetIcon(name);
73
+ return new cCheckBox(icon, border);
74
+ }
75
+ catch (Exception e)
76
+ {
77
+ return new cCheckBox(name, border);
78
+ }
79
+ }
80
+
81
+ private ImageIcon GetIcon(String name) throws IOException
82
+ {
83
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
84
+
85
+ if (image.getWidth() != 24 && image.getHeight() != 24)
86
+ {
87
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
88
+ Graphics2D g = resized.createGraphics();
89
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
90
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
91
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
92
+ g.dispose();
93
+
94
+ image = resized;
95
+ }
96
+
97
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
98
+ return icon;
99
+ }
38100
39101 // SCRIPT
40102
....@@ -138,34 +200,42 @@
138200 public void closeUI()
139201 {
140202 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
203
+// System.out.println("this = " + this);
204
+// System.out.println("objEditor = " + objEditor);
143205 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
206
+// objEditor.ctrlPanel.remove(nameField);
207
+
208
+ objEditor.ctrlPanel.remove(namePanel);
145209
146210 if (!GroupEditor.allparams)
147211 return;
148212
149
- objEditor.ctrlPanel.remove(liveCB);
150
- objEditor.ctrlPanel.remove(hideCB);
151
- objEditor.ctrlPanel.remove(markCB);
152
-
153
- objEditor.ctrlPanel.remove(randomCB);
154
- objEditor.ctrlPanel.remove(speedupCB);
155
- objEditor.ctrlPanel.remove(rewindCB);
156
-
157
- objEditor.ctrlPanel.remove(resetButton);
158
- objEditor.ctrlPanel.remove(stepButton);
159
-// objEditor.ctrlPanel.remove(stepAllButton);
160
-// objEditor.ctrlPanel.remove(resetAllButton);
161
- objEditor.ctrlPanel.remove(link2masterCB);
162
- //objEditor.ctrlPanel.remove(flipVCB);
163
- //objEditor.ctrlPanel.remove(texresMenu);
164
- objEditor.ctrlPanel.remove(slowerButton);
165
- objEditor.ctrlPanel.remove(fasterButton);
166
- objEditor.ctrlPanel.remove(remarkButton);
213
+// objEditor.ctrlPanel.remove(liveCB);
214
+// objEditor.ctrlPanel.remove(hideCB);
215
+// objEditor.ctrlPanel.remove(markCB);
216
+//
217
+// objEditor.ctrlPanel.remove(randomCB);
218
+// objEditor.ctrlPanel.remove(speedupCB);
219
+// objEditor.ctrlPanel.remove(rewindCB);
220
+//
221
+// objEditor.ctrlPanel.remove(resetButton);
222
+// objEditor.ctrlPanel.remove(stepButton);
223
+//// objEditor.ctrlPanel.remove(stepAllButton);
224
+//// objEditor.ctrlPanel.remove(resetAllButton);
225
+// objEditor.ctrlPanel.remove(link2masterCB);
226
+// //objEditor.ctrlPanel.remove(flipVCB);
227
+// //objEditor.ctrlPanel.remove(texresMenu);
228
+// objEditor.ctrlPanel.remove(slowerButton);
229
+// objEditor.ctrlPanel.remove(fasterButton);
230
+// objEditor.ctrlPanel.remove(remarkButton);
167231
168
- Remove(normalpushField);
232
+ objEditor.ctrlPanel.remove(setupPanel);
233
+ objEditor.ctrlPanel.remove(setupPanel2);
234
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
235
+ objEditor.ctrlPanel.remove(pushPanel);
236
+ //objEditor.ctrlPanel.remove(fillPanel);
237
+
238
+ //Remove(normalpushField);
169239 }
170240
171241 public ObjEditor GetEditor()
....@@ -236,6 +306,7 @@
236306 //localCopy.parent = null;
237307
238308 frame = new JFrame();
309
+ frame.setUndecorated(true);
239310 objEditor = this;
240311 this.callee = callee;
241312
....@@ -269,24 +340,40 @@
269340 void SetupMenu()
270341 {
271342 frame.setMenuBar(menuBar = new MenuBar());
272
- menuBar.add(windowMenu = new Menu("File"));
273
- windowMenu.add(loadItem = new MenuItem("Load..."));
274
- windowMenu.add("-");
275
- windowMenu.add(saveItem = new MenuItem("Save"));
276
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
343
+ menuBar.add(fileMenu = new Menu("File"));
344
+ fileMenu.add(newItem = new MenuItem("New"));
345
+ fileMenu.add(loadItem = new MenuItem("Open..."));
346
+
347
+ //oe.menuBar.add(menu = new Menu("Include"));
348
+ Menu menu = new Menu("Import");
349
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
350
+ importOBJItem.addActionListener(this);
351
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
352
+ import3DSItem.addActionListener(this);
353
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
354
+ importVRMLX3DItem.addActionListener(this);
355
+ menu.add("-");
356
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
357
+ importGFDItem.addActionListener(this);
358
+ fileMenu.add(menu);
359
+ fileMenu.add("-");
360
+
361
+ fileMenu.add(saveItem = new MenuItem("Save"));
362
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277363 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
278
- windowMenu.add("-");
279
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
280
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
281
- windowMenu.add("-");
364
+ fileMenu.add("-");
365
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
366
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
367
+ fileMenu.add("-");
282368 if (client.parent != null)
283369 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
370
+ fileMenu.add(closeItem = new MenuItem("Close"));
285371 } else
286372 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
373
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288374 }
289375
376
+ newItem.addActionListener(this);
290377 loadItem.addActionListener(this);
291378 saveItem.addActionListener(this);
292379 saveAsItem.addActionListener(this);
....@@ -295,79 +382,59 @@
295382 //povItem.addActionListener(this);
296383 closeItem.addActionListener(this);
297384
298
- menuBar.add(cameraMenu = new Menu("View"));
299
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
300
- //zBufferItem.addActionListener(this);
301
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
302
- //normalLensItem.addActionListener(this);
303
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
304
- revertCameraItem.addActionListener(this);
305
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
- toggleTimelineItem.addItemListener(this);
307
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308
- toggleFullScreenItem.addItemListener(this);
309
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
310
- cameraMenu.add("-");
311
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
312
- toggleTextureItem.addItemListener(this);
313
- toggleTextureItem.setState(CameraPane.textureon);
314
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
315
- toggleLiveItem.addItemListener(this);
316
- toggleLiveItem.setState(Globals.isLIVE());
317
- cameraMenu.add(stepItem = new MenuItem("Step"));
318
- stepItem.addActionListener(this);
319
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
320
-// toggleDLItem.addItemListener(this);
321
-// toggleDLItem.setState(false);
322
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
323
- toggleRenderItem.addItemListener(this);
324
- toggleRenderItem.setState(!CameraPane.frozen);
325
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
326
- toggleDebugItem.addItemListener(this);
327
- toggleDebugItem.setState(CameraPane.DEBUG);
328
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
329
- toggleFrustumItem.addItemListener(this);
330
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
331
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
332
- toggleFootContactItem.addItemListener(this);
333
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
334
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
335
- toggleRandomItem.addItemListener(this);
336
- toggleRandomItem.setState(CameraPane.RANDOM);
337
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
338
- toggleHandleItem.addItemListener(this);
339
- toggleHandleItem.setState(CameraPane.HANDLES);
340
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
341
- togglePaintItem.addItemListener(this);
342
- togglePaintItem.setState(CameraPane.PAINTMODE);
343
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
344
-// toggleRootItem.addItemListener(this);
345
-// toggleRootItem.setState(false);
346
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
347
-// animationItem.addItemListener(this);
348
-// animationItem.setState(CameraPane.ANIMATION);
349
- cameraMenu.add("-");
350
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
351
- editCameraItem.addActionListener(this);
352
-
353385 objectPanel = new JTabbedPane();
386
+
387
+ ChangeListener changeListener = new ChangeListener()
388
+ {
389
+ public void stateChanged(ChangeEvent changeEvent)
390
+ {
391
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
392
+// {
393
+// if (latestObject != null)
394
+// {
395
+// refreshContents(true);
396
+// SetMaterial(latestObject);
397
+// }
398
+//
399
+// materialFlushed = true;
400
+// }
401
+
402
+ refreshContents(false); // To refresh Info tab
403
+ }
404
+ };
405
+ objectPanel.addChangeListener(changeListener);
406
+
354407 toolbarPanel = new JPanel();
355408 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
409
+ treePanel = new cGridBag();
357410 treePanel.setName("Tree");
358
- ctrlPanel = new JPanel(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
411
+
412
+ editPanel = new cGridBag().setVertical(true);
413
+ editPanel.setName("Edit");
414
+
415
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
416
+
417
+ editCommandsPanel = new cGridBag();
418
+ editPanel.add(editCommandsPanel);
419
+ editPanel.add(ctrlPanel);
420
+
421
+ toolboxPanel = new cGridBag().setVertical(false);
422
+ toolboxPanel.setName("Toolbox");
423
+
424
+ materialPanel = new cGridBag().setVertical(true);
361425 materialPanel.setName("Material");
426
+
362427 /*JTextPane*/
363428 infoarea = createTextPane();
429
+ doc = infoarea.getStyledDocument();
430
+
364431 infoarea.setEditable(true);
365432 SetText();
366433 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367434 // infoarea.setOpaque(false);
368435 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
436
+// TEXTAREA infoarea.setLineWrap(true);
437
+// TEXTAREA infoarea.setWrapStyleWord(true);
371438 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372439 infoPanel.setPreferredSize(new Dimension(50, 200));
373440 infoPanel.setName("Info");
....@@ -378,16 +445,16 @@
378445 mainPanel.setName("Main");
379446 mainPanel.setContinuousLayout(true);
380447 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382448 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
449
+ mainPanel.setDividerLocation(0.5); //1.0);
450
+ mainPanel.setResizeWeight(0.5);
384451
385452 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386453 //mainPanel.setLayout(new GridBagLayout());
387454 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
455
+// treePanel.setLayout(new GridBagLayout());
456
+ //ctrlPanel.setLayout(new GridBagLayout());
457
+ //materialPanel.setLayout(new GridBagLayout());
391458
392459 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393460 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +493,7 @@
426493 static String newline = "\n";
427494 protected static final String buttonString = "JButton";
428495 StyledDocument doc;
429
- JTextArea infoarea;
496
+ JTextPane infoarea;
430497
431498 void ClearInfo()
432499 {
....@@ -449,10 +516,10 @@
449516 e.printStackTrace();
450517 }
451518
452
- String selection = infoarea.getText();
453
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
454
- java.awt.datatransfer.Clipboard clipboard =
455
- Toolkit.getDefaultToolkit().getSystemClipboard();
519
+// String selection = infoarea.getText();
520
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
521
+// java.awt.datatransfer.Clipboard clipboard =
522
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456523 //clipboard.setContents(data, data);
457524 }
458525
....@@ -475,13 +542,13 @@
475542 //SendInfo("Name:", "bold");
476543 if (sel.GetTextures() != null || debug)
477544 {
478
- si.SendInfo(sel.toString(), "bold");
545
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479546 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480547 if (sel.Size() > 0)
481548 {
482549 si.SendInfo("#children = " + sel.Size(), "regular");
483550 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
551
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485552 if (debug)
486553 {
487554 try
....@@ -493,7 +560,10 @@
493560 }
494561
495562 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
563
+ {
564
+ si.SendInfo(" BBox min: " + minima, "regular");
565
+ si.SendInfo(" BBox max: " + maxima, "regular");
566
+ }
497567
498568 if (sel.bRep != null)
499569 {
....@@ -520,7 +590,7 @@
520590 }
521591 if (sel.support != null)
522592 {
523
- si.SendInfo(" support: " + sel.support, "regular");
593
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524594 }
525595 if (sel.scriptnode != null)
526596 {
....@@ -591,6 +661,9 @@
591661 {
592662 CameraPane.pointflow = (PointFlow) sel;
593663 }
664
+
665
+ si.SendInfo("_____________________", "regular");
666
+ si.SendInfo("", "regular");
594667 }
595668 }
596669
....@@ -606,68 +679,140 @@
606679 }
607680 }
608681
682
+static GraphicsDevice device = GraphicsEnvironment
683
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
684
+
685
+ Rectangle keeprect;
686
+ cRadio radio;
687
+
688
+cButton keepButton;
689
+ cButton twoButton; // Full 3D
690
+ cButton sixButton;
691
+ cButton threeButton;
692
+ cButton sevenButton;
693
+ cButton fourButton; // full panel
694
+ cButton oneButton; // full XYZ
695
+ //cButton currentLayout;
696
+
697
+ boolean maximized;
698
+
699
+ cButton fullscreenLayout;
700
+
701
+ void Minimize()
702
+ {
703
+ frame.setState(Frame.ICONIFIED);
704
+ }
705
+
706
+ void Maximize()
707
+ {
708
+ if (maximized)
709
+ {
710
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
711
+ }
712
+ else
713
+ {
714
+ keeprect = frame.getBounds();
715
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
716
+ Dimension rect2 = frame.getToolkit().getScreenSize();
717
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
718
+// frame.setState(Frame.MAXIMIZED_BOTH);
719
+ }
720
+
721
+ maximized ^= true;
722
+ }
723
+
609724 void ToggleFullScreen()
610725 {
611
- if (CameraPane.FULLSCREEN)
726
+ cameraView.ToggleFullScreen();
727
+
728
+ if (!CameraPane.FULLSCREEN)
612729 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
730
+ device.setFullScreenWindow(null);
731
+ //frame.setVisible(false);
732
+// frame.removeNotify();
733
+// frame.setUndecorated(false);
734
+// frame.addNotify();
735
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
736
+
737
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
738
+// X framePanel.add(bigThree);
739
+// X frame.getContentPane().add(/*"Center",*/framePanel);
740
+ framePanel.setDividerLocation(1);
741
+
742
+ //frame.setVisible(true);
743
+ radio.layout = keepButton;
744
+ //theFrame = null;
745
+ keepButton = null;
746
+ radio.layout.doClick();
747
+
616748 } else
617749 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
750
+ keepButton = radio.layout;
751
+ //keeprect = frame.getBounds();
752
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
753
+// frame.getToolkit().getScreenSize().height);
754
+ //frame.setVisible(false);
755
+ device.setFullScreenWindow(frame);
756
+// frame.removeNotify();
757
+// frame.setUndecorated(true);
758
+// frame.addNotify();
759
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
760
+// X framePanel.remove(bigThree);
761
+// X frame.getContentPane().add(/*"Center",*/bigThree);
762
+ framePanel.setDividerLocation(0);
763
+
764
+ radio.layout = fullscreenLayout;
765
+ radio.layout.doClick();
766
+ //frame.setVisible(true);
621767 }
622
- cameraView.ToggleFullScreen();
623768 }
624769
625
- private JTextArea createTextPane()
770
+ private JTextPane createTextPane()
626771 {
627
- String[] initString =
628
- {
629
- "This is an editable JTextPane, ", //regular
630
- "another ", //italic
631
- "styled ", //bold
632
- "text ", //small
633
- "component, ", //large
634
- "which supports embedded components..." + newline,//regular
635
- " " + newline, //button
636
- "...and embedded icons..." + newline, //regular
637
- " ", //icon
638
- newline + "JTextPane is a subclass of JEditorPane that "
639
- + "uses a StyledEditorKit and StyledDocument, and provides "
640
- + "cover methods for interacting with those objects."
641
- };
772
+// TEXTAREA String[] initString =
773
+// {
774
+// "This is an editable JTextPane, ", //regular
775
+// "another ", //italic
776
+// "styled ", //bold
777
+// "text ", //small
778
+// "component, ", //large
779
+// "which supports embedded components..." + newline,//regular
780
+// " " + newline, //button
781
+// "...and embedded icons..." + newline, //regular
782
+// " ", //icon
783
+// newline + "JTextPane is a subclass of JEditorPane that "
784
+// + "uses a StyledEditorKit and StyledDocument, and provides "
785
+// + "cover methods for interacting with those objects."
786
+// };
787
+//
788
+// String[] initStyles =
789
+// {
790
+// "regular", "italic", "bold", "small", "large",
791
+// "regular", "button", "regular", "icon",
792
+// "regular"
793
+// };
794
+//
795
+// JTextPane textPane = new JTextPane();
796
+// textPane.setEditable(true);
797
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
798
+// addStylesToDocument(doc);
799
+//
800
+// try
801
+// {
802
+// for (int j = 0; j < 2; j++)
803
+// {
804
+// for (int i = 0; i < initString.length; i++)
805
+// {
806
+// doc.insertString(doc.getLength(), initString[i],
807
+// doc.getStyle(initStyles[i]));
808
+// }
809
+// }
810
+// } catch (BadLocationException ble)
811
+// {
812
+// System.err.println("Couldn't insert initial text into text pane.");
813
+// }
642814
643
- String[] initStyles =
644
- {
645
- "regular", "italic", "bold", "small", "large",
646
- "regular", "button", "regular", "icon",
647
- "regular"
648
- };
649
-
650
- JTextPane textPane = new JTextPane();
651
- textPane.setEditable(true);
652
- /*StyledDocument*/ doc = textPane.getStyledDocument();
653
- addStylesToDocument(doc);
654
-
655
- try
656
- {
657
- for (int j = 0; j < 2; j++)
658
- {
659
- for (int i = 0; i < initString.length; i++)
660
- {
661
- doc.insertString(doc.getLength(), initString[i],
662
- doc.getStyle(initStyles[i]));
663
- }
664
- }
665
- } catch (BadLocationException ble)
666
- {
667
- System.err.println("Couldn't insert initial text into text pane.");
668
- }
669
-
670
- return new JTextArea(); // textPane;
815
+ return new JTextPane(); // textPane;
671816 }
672817
673818 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +865,7 @@
720865 protected static ImageIcon createImageIcon(String path,
721866 String description)
722867 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
868
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724869 if (imgURL != null)
725870 {
726871 return new ImageIcon(imgURL, description);
....@@ -752,6 +897,7 @@
752897 // NumberSlider vDivsField;
753898 // JCheckBox endcaps;
754899 JCheckBox liveCB;
900
+ JCheckBox selectCB;
755901 JCheckBox hideCB;
756902 JCheckBox link2masterCB;
757903 JCheckBox markCB;
....@@ -759,7 +905,12 @@
759905 JCheckBox speedupCB;
760906 JCheckBox rewindCB;
761907 JCheckBox flipVCB;
908
+
909
+ cCheckBox toggleTextureCB;
910
+ cCheckBox toggleSwitchCB;
911
+
762912 JComboBox texresMenu;
913
+
763914 JButton resetButton;
764915 JButton stepButton;
765916 JButton stepAllButton;
....@@ -767,115 +918,87 @@
767918 JButton slowerButton;
768919 JButton fasterButton;
769920 JButton remarkButton;
921
+
922
+ cGridBag editPanel;
923
+ cGridBag editCommandsPanel;
924
+
925
+ cGridBag namePanel;
926
+ cGridBag setupPanel;
927
+ cGridBag setupPanel2;
928
+ cGridBag objectCommandsPanel;
929
+ cGridBag pushPanel;
930
+ cGridBag fillPanel;
770931
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
932
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772933 {
773934 JCheckBox cb;
774935
775
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
776
- oe.aConstraints.gridwidth = 1; // 3;
777
-// oe.aConstraints.weightx = 1;
778
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
779
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
936
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780937 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784938
785939 return cb;
786940 }
787941
788
- cButton AddButton(ObjEditor oe, String label)
942
+ cButton AddButton(cGridBag panel, String label)
789943 {
790944 cButton cb;
791945
792
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
793
- oe.aConstraints.gridwidth = 1;
794
-// oe.aConstraints.weightx = 1;
795
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
796
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
946
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797947 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801948
802949 return cb;
803950 }
804951
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
952
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806953 {
807954 JComboBox combo;
808955
809
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
810
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
811
- oe.aConstraints.gridx += 1;
956
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812957 combo.addActionListener(this);
813958
814959 return combo;
815960 }
816961
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
962
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818963 {
819
- NumberSlider combo;
964
+ cGridBag control = new cGridBag();
965
+
966
+ cNumberSlider combo;
820967
821968 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824969 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 1;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
970
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
971
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834972 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
973
+
974
+ panel.add(control);
975
+
976
+ return control;
841977 }
842978
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
979
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
844980 {
845
- NumberSlider combo;
981
+ cGridBag control = new cGridBag();
982
+
983
+ cNumberSlider combo;
846984
847985 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
850986 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
851
- aConstraints.gridwidth = 2;
852
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
855
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
856
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
857
- aConstraints.gridx += 1;
858
- aConstraints.gridwidth = 1;
859
-
987
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
988
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
860989 combo.setInteger(current);
861990
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
991
+ panel.add(control);
992
+
993
+ return control;
867994 }
868995
869
- JTextArea AddText(JPanel ctrlPanel, String name)
996
+ JTextArea AddText(cGridBag ctrlPanel, String name)
870997 {
871998 JTextArea text;
872999
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1000
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8761001 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
8791002
8801003 return text;
8811004 }
....@@ -905,9 +1028,16 @@
9051028 objEditor.ctrlPanel.remove(j);
9061029 }
9071030
1031
+ void Remove(cNumberSlider j)
1032
+ {
1033
+ j.removeChangeListener(this);
1034
+ //objEditor.ctrlPanel.remove(j.label);
1035
+ objEditor.ctrlPanel.remove(j);
1036
+ }
1037
+
9081038 /*
9091039 */
910
- void Return() // ObjEditor oe)
1040
+ void Return0() // ObjEditor oe)
9111041 {
9121042 aConstraints.gridy += 1;
9131043 aConstraints.gridx = 0;
....@@ -962,37 +1092,76 @@
9621092
9631093 void SetupUI2(ObjEditor oe)
9641094 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
1095
+ //SetupName(oe);
1096
+
1097
+ namePanel = new cGridBag();
1098
+
1099
+ nameField = AddText(namePanel, copy.GetName());
1100
+ namePanel.add(nameField);
1101
+ oe.ctrlPanel.add(namePanel);
1102
+
1103
+ oe.ctrlPanel.Return();
9701104
9711105 if (!GroupEditor.allparams)
9721106 return;
9731107
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1108
+ setupPanel = new cGridBag().setVertical(false);
1109
+
1110
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1111
+ liveCB.setToolTipText("Animate object");
1112
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1113
+ selectCB.setToolTipText("Make object selectable");
9771114 // Return();
978
- markCB = AddCheckBox(oe, "Mark", copy.marked);
979
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
980
- randomCB = AddCheckBox(oe, "Rand", copy.random);
981
- Return();
982
- resetButton = AddButton(oe, "Reset");
983
- stepButton = AddButton(oe, "Step");
1115
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1116
+ hideCB.setToolTipText("Hide object");
1117
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1118
+ markCB.setToolTipText("Set the animation target transform");
1119
+
1120
+ setupPanel2 = new cGridBag().setVertical(false);
1121
+
1122
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1123
+ rewindCB.setToolTipText("Rewind animation");
1124
+
1125
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1126
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1127
+
1128
+ if (Globals.ADVANCED)
1129
+ {
1130
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1131
+ link2masterCB.setToolTipText("Attach to support");
1132
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1133
+ speedupCB.setToolTipText("Option motion capture");
1134
+ }
1135
+
1136
+ oe.ctrlPanel.add(setupPanel);
1137
+ oe.ctrlPanel.Return();
1138
+ oe.ctrlPanel.add(setupPanel2);
1139
+ oe.ctrlPanel.Return();
1140
+
1141
+ objectCommandsPanel = new cGridBag().setVertical(false);
1142
+
1143
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1144
+ resetButton.setToolTipText("Jump to frame zero");
1145
+ stepButton = AddButton(objectCommandsPanel, "Step");
1146
+ stepButton.setToolTipText("Step one frame");
9841147 // resetAllButton = AddButton(oe, "Reset All");
9851148 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9871149 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
1150
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1151
+ slowerButton.setToolTipText("Decrease animation speed");
1152
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1153
+ fasterButton.setToolTipText("Increase animation speed");
1154
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1155
+ remarkButton.setToolTipText("Set the current transform as the target");
9911156
992
- Return();
1157
+ oe.ctrlPanel.add(objectCommandsPanel);
1158
+ oe.ctrlPanel.Return();
9931159
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
1160
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1161
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1162
+ //Return();
1163
+
1164
+ oe.ctrlPanel.Return();
9961165
9971166 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9981167 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1256,7 @@
10871256 oe.aConstraints.gridwidth = 1;
10881257 /**/
10891258 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1259
+ oe.ctrlPanel.Return();
10911260
10921261 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931262 //textureButton.setEnabled(false);
....@@ -1189,9 +1358,13 @@
11891358 //JPanel worldPanel =
11901359 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11911360 //worldPanel.setName("World");
1192
- centralPanel = new JPanel(new BorderLayout());
1193
- timelinePanel = new JPanel(new BorderLayout());
1194
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1361
+ centralPanel = new cGridBag();
1362
+ centralPanel.preferredWidth = 20;
1363
+
1364
+ if (Globals.ADVANCED)
1365
+ {
1366
+ timelinePanel = new JPanel(new BorderLayout());
1367
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11951368
11961369 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11971370 cameraPanel.setContinuousLayout(true);
....@@ -1200,7 +1373,10 @@
12001373 // cameraPanel.setDividerSize(9);
12011374 cameraPanel.setResizeWeight(1.0);
12021375
1376
+ }
1377
+
12031378 centralPanel.add(cameraView);
1379
+ centralPanel.setFocusable(true);
12041380 //frame.setJMenuBar(timelineMenubar);
12051381 //centralPanel.add(timelinePanel);
12061382
....@@ -1222,6 +1398,7 @@
12221398 XYZPanel = new cGridBag().setVertical(true);
12231399 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12241400
1401
+ XYZPanel.preferredWidth = 5;
12251402 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12261403 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12271404 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
....@@ -1262,10 +1439,12 @@
12621439 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12631440 //tmp.setName("Edit");
12641441 objectPanel.add(materialPanel);
1265
- JPanel north = new JPanel(new BorderLayout());
1266
- north.setName("Edit");
1267
- north.add(ctrlPanel, BorderLayout.NORTH);
1268
- objectPanel.add(north);
1442
+ objectPanel.add(toolboxPanel);
1443
+// JPanel north = new JPanel(new BorderLayout());
1444
+// north.setName("Edit");
1445
+// north.add(ctrlPanel, BorderLayout.NORTH);
1446
+// objectPanel.add(north);
1447
+ objectPanel.add(editPanel);
12691448 objectPanel.add(infoPanel);
12701449
12711450 /*
....@@ -1286,19 +1465,23 @@
12861465 scrollpane.setWheelScrollingEnabled(true);
12871466 scrollpane.addMouseWheelListener(this); // Default not fast enough
12881467
1289
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1290
- scenePanel.add(scrollpane);
1468
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1469
+ scenePanel.preferredWidth = 6;
1470
+
1471
+ JTabbedPane tabbedPane = new JTabbedPane();
1472
+ tabbedPane.add(scrollpane);
12911473
1292
- scenePanel.add(FSPane = new cFileSystemPane(this));
1293
-
1294
- optionsPanel = new JPanel(new GridBagLayout());
1474
+ optionsPanel = new cGridBag().setVertical(false);
12951475
12961476 optionsPanel.setName("Options");
12971477
1298
- AddOptions(optionsPanel, aConstraints);
1478
+ AddOptions(optionsPanel); //, aConstraints);
12991479
1300
- scenePanel.add(optionsPanel);
1480
+ tabbedPane.add(optionsPanel);
1481
+
1482
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
13011483
1484
+ scenePanel.add(tabbedPane);
13021485
13031486 /*
13041487 cTree jTree = new cTree(null);
....@@ -1389,9 +1572,13 @@
13891572
13901573 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911574
1392
- frame.setSize(1024, 768);
1393
- frame.show();
1575
+ frame.setSize(1280, 860);
1576
+
1577
+ frame.validate();
1578
+ frame.setVisible(true);
13941579
1580
+ cameraView.requestFocusInWindow();
1581
+
13951582 gridPanel.setDividerLocation(1.0);
13961583
13971584 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1405,7 +1592,7 @@
14051592 });
14061593 }
14071594
1408
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1595
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14091596 {
14101597 }
14111598
....@@ -1420,260 +1607,173 @@
14201607 ctrlPanel.removeAll();
14211608 }
14221609
1423
- void SetupMaterial(JPanel ctrlPanel)
1610
+ void SetupMaterial(cGridBag panel)
14241611 {
1425
- aConstraints.weighty = 0;
1426
- //aConstraints.weightx = 1;
1427
- /*
1612
+ /*
14281613 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14291614 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1430
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1431
- aConstraints.gridx += 1;
14321615 */
14331616
1434
- aConstraints.gridwidth = 1;
1435
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1436
- aConstraints.gridx += 1;
1437
- aConstraints.weighty = 0;
1438
- aConstraints.gridwidth = 1;
1617
+ cGridBag editBar = new cGridBag().setVertical(false);
1618
+
1619
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1620
+ createMaterialButton.setToolTipText("Create material");
14391621
14401622 /*
14411623 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
14451624 */
14461625
1447
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1448
- aConstraints.gridx += 1;
1626
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1627
+ clearMaterialButton.setToolTipText("Clear material");
1628
+
1629
+ if (Globals.ADVANCED)
1630
+ {
1631
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1632
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1633
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1634
+ }
14491635
1450
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1451
-
1452
- aConstraints.gridx += 1;
1453
-
1454
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1455
-
1456
- aConstraints.gridx += 1;
1457
-
1458
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1459
-
1460
- aConstraints.gridx = 0;
1461
- aConstraints.gridy += 1;
1462
- aConstraints.weighty = 0;
1463
- aConstraints.gridwidth = 1;
1636
+ editBar.preferredHeight = 15;
1637
+
1638
+ panel.add(editBar);
1639
+
14641640 /**/
14651641 //aConstraints.weighty = 0;
14661642 ////aConstraints.weightx = 1;
14671643 //aConstraints.weighty = 1;
14681644 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14691645 //aConstraints.gridx += 1;
1470
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1471
- aConstraints.weighty = 0;
1472
- aConstraints.gridx = 0;
1473
- aConstraints.gridy += 1;
1474
- aConstraints.gridwidth = 1;
1646
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14751647
1476
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1477
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1478
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1479
- aConstraints.gridx += 1;
1480
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1481
- //aConstraints.weightx = 0;
1482
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1483
- aConstraints.gridx = 0;
1484
- aConstraints.gridy += 1;
1485
- aConstraints.gridwidth = 1;
1648
+ cGridBag colorSection = new cGridBag().setVertical(true);
1649
+
1650
+ cGridBag color = new cGridBag();
1651
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1652
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1653
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1654
+ //colorField.preferredWidth = 200;
1655
+ colorSection.add(color);
14861656
1487
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1488
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1489
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1490
- aConstraints.gridx += 1;
1491
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1492
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1493
- aConstraints.gridx = 0;
1494
- aConstraints.gridy += 1;
1495
- aConstraints.gridwidth = 1;
1657
+ cGridBag modulation = new cGridBag();
1658
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1659
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1660
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1661
+ colorSection.add(modulation);
14961662
1497
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1498
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1499
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1500
- aConstraints.gridx += 1;
1501
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1502
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1503
- aConstraints.gridx = 0;
1504
- aConstraints.gridy += 1;
1505
- aConstraints.gridwidth = 1;
1663
+ cGridBag texture = new cGridBag();
1664
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1665
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1666
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1667
+ colorSection.add(texture);
15061668
1507
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1508
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1509
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1510
- aConstraints.gridx += 1;
1511
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1512
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1513
- aConstraints.gridx = 0;
1514
- aConstraints.gridy += 1;
1515
- aConstraints.gridwidth = 1;
1669
+ cGridBag anisoU = new cGridBag();
1670
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1671
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1673
+ colorSection.add(anisoU);
15161674
1517
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1518
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1519
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1520
- aConstraints.gridx += 1;
1521
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1522
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1523
- aConstraints.gridx = 0;
1524
- aConstraints.gridy += 1;
1525
- aConstraints.gridwidth = 1;
1675
+ cGridBag anisoV = new cGridBag();
1676
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1677
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1678
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1679
+ colorSection.add(anisoV);
15261680
1527
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1528
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1529
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1530
- aConstraints.gridx += 1;
1531
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1532
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1533
- aConstraints.gridx = 0;
1534
- aConstraints.gridy += 1;
1535
- aConstraints.gridwidth = 1;
1681
+ cGridBag shadowbias = new cGridBag();
1682
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1683
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1684
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1685
+ colorSection.add(shadowbias);
15361686
1537
- //aConstraints.weighty = 1;
1538
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1539
- //aConstraints.gridx += 1;
1540
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1541
- aConstraints.weighty = 0;
1542
- aConstraints.gridx = 0;
1543
- aConstraints.gridy += 1;
1544
- aConstraints.gridwidth = 1;
1687
+ panel.add(new JSeparator());
1688
+
1689
+ panel.add(colorSection);
1690
+
1691
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1692
+
1693
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1694
+
1695
+ cGridBag diffuse = new cGridBag();
1696
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1697
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1699
+ diffuseSection.add(diffuse);
15451700
1546
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1547
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1548
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1549
- aConstraints.gridx += 1;
1550
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1551
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1552
- aConstraints.gridx = 0;
1553
- aConstraints.gridy += 1;
1554
- aConstraints.gridwidth = 1;
1701
+ cGridBag diffuseness = new cGridBag();
1702
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1703
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1704
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1705
+ diffuseSection.add(diffuseness);
15551706
1556
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1557
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1558
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1559
- aConstraints.gridx += 1;
1560
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1561
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1562
- aConstraints.gridx = 0;
1563
- aConstraints.gridy += 1;
1564
- aConstraints.gridwidth = 1;
1707
+ cGridBag selfshadow = new cGridBag();
1708
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1709
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1710
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1711
+ diffuseSection.add(selfshadow);
15651712
1566
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1567
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1568
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1569
- aConstraints.gridx += 1;
1570
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1571
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1572
- aConstraints.gridx = 0;
1573
- aConstraints.gridy += 1;
1574
- aConstraints.gridwidth = 1;
1713
+ cGridBag sheen = new cGridBag();
1714
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1715
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1716
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1717
+ diffuseSection.add(sheen);
15751718
1576
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1577
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1579
- aConstraints.gridx += 1;
1580
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1581
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1582
- aConstraints.gridx = 0;
1583
- aConstraints.gridy += 1;
1584
- aConstraints.gridwidth = 1;
1719
+ cGridBag subsurface = new cGridBag();
1720
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1721
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1723
+ diffuseSection.add(subsurface);
15851724
1586
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1587
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1588
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1589
- aConstraints.gridx += 1;
1590
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1591
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1592
- aConstraints.gridx = 0;
1593
- aConstraints.gridy += 1;
1594
- aConstraints.gridwidth = 1;
1725
+ cGridBag shadow = new cGridBag();
1726
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1727
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1729
+ diffuseSection.add(shadow);
15951730
1596
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1597
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1598
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1599
- aConstraints.gridx += 1;
1600
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1601
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1602
- aConstraints.gridx = 0;
1603
- aConstraints.gridy += 1;
1604
- aConstraints.gridwidth = 1;
1731
+ cGridBag fakedepth = new cGridBag();
1732
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1733
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1734
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1735
+ diffuseSection.add(fakedepth);
16051736
1606
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1607
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1608
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1609
- aConstraints.gridx += 1;
1610
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1611
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1612
- aConstraints.gridx = 0;
1613
- aConstraints.gridy += 1;
1614
- aConstraints.gridwidth = 1;
1737
+ panel.add(new JSeparator());
1738
+
1739
+ panel.add(diffuseSection);
1740
+
1741
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1742
+
1743
+ cGridBag specularSection = new cGridBag().setVertical(true);
16151744
1616
- //aConstraints.weighty = 1;
1617
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1618
- //aConstraints.gridx += 1;
1619
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1620
- aConstraints.weighty = 0;
1621
- aConstraints.gridx = 0;
1622
- aConstraints.gridy += 1;
1623
- aConstraints.gridwidth = 1;
1745
+ cGridBag specular = new cGridBag();
1746
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1747
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1748
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1749
+ specularSection.add(specular);
16241750
1625
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1626
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1627
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1628
- aConstraints.gridx += 1;
1629
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1630
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1631
- aConstraints.gridx = 0;
1632
- aConstraints.gridy += 1;
1633
- aConstraints.gridwidth = 1;
1751
+ cGridBag lightarea = new cGridBag();
1752
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1753
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1754
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1755
+ specularSection.add(lightarea);
16341756
1635
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1636
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1637
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1638
- aConstraints.gridx += 1;
1639
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1640
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1641
- aConstraints.gridx = 0;
1642
- aConstraints.gridy += 1;
1643
- aConstraints.gridwidth = 1;
1757
+ cGridBag shininess = new cGridBag();
1758
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1759
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1760
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1761
+ specularSection.add(shininess);
16441762
1645
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1646
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1647
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1648
- aConstraints.gridx += 1;
1649
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1650
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1651
- aConstraints.gridx = 0;
1652
- aConstraints.gridy += 1;
1653
- aConstraints.gridwidth = 1;
1763
+ cGridBag metalness = new cGridBag();
1764
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1765
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1766
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1767
+ specularSection.add(metalness);
16541768
1655
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1656
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1658
- aConstraints.gridx += 1;
1659
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1660
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1661
- aConstraints.gridx = 0;
1662
- aConstraints.gridy += 1;
1663
- aConstraints.gridwidth = 1;
1769
+ cGridBag velvet = new cGridBag();
1770
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1771
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1772
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1773
+ specularSection.add(velvet);
16641774
1665
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1666
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1667
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1668
- aConstraints.gridx += 1;
1669
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1670
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1671
- aConstraints.gridx = 0;
1672
- aConstraints.gridy += 1;
1673
- aConstraints.gridwidth = 1;
1674
-
1675
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1676
- Return();
1775
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1776
+ //Return();
16771777 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16781778 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16791779 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1684,130 +1784,93 @@
16841784 // aConstraints.gridy += 1;
16851785 // aConstraints.gridwidth = 1;
16861786
1687
- //aConstraints.weighty = 1;
1688
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1689
- //aConstraints.gridx += 1;
1690
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1691
- aConstraints.weighty = 0;
1692
- aConstraints.gridx = 0;
1693
- aConstraints.gridy += 1;
1694
- aConstraints.gridwidth = 1;
16951787
1696
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1697
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1699
- aConstraints.gridx += 1;
1700
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1701
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1702
- aConstraints.gridx = 0;
1703
- aConstraints.gridy += 1;
1704
- aConstraints.gridwidth = 1;
1788
+ panel.add(new JSeparator());
1789
+
1790
+ panel.add(specularSection);
1791
+
1792
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1793
+
1794
+ cGridBag globalSection = new cGridBag().setVertical(true);
17051795
1706
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1707
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1709
- aConstraints.gridx += 1;
1710
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1711
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1712
- aConstraints.gridx = 0;
1713
- aConstraints.gridy += 1;
1714
- aConstraints.gridwidth = 1;
1796
+ cGridBag camera = new cGridBag();
1797
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1798
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1799
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1800
+ globalSection.add(camera);
17151801
1716
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1717
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1718
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1719
- aConstraints.gridx += 1;
1720
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1721
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1722
- aConstraints.gridx = 0;
1723
- aConstraints.gridy += 1;
1724
- aConstraints.gridwidth = 1;
1802
+ cGridBag ambient = new cGridBag();
1803
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1804
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1805
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1806
+ globalSection.add(ambient);
17251807
1726
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1727
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1729
- aConstraints.gridx += 1;
1730
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1731
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1732
- aConstraints.gridx = 0;
1733
- aConstraints.gridy += 1;
1734
- aConstraints.gridwidth = 1;
1735
- aConstraints.weighty = 0;
1808
+ cGridBag backlit = new cGridBag();
1809
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1810
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1811
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1812
+ globalSection.add(backlit);
17361813
1737
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1738
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1739
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1740
- aConstraints.gridx += 1;
1741
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1742
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1743
- aConstraints.gridx = 0;
1744
- aConstraints.gridy += 1;
1745
- aConstraints.gridwidth = 1;
1814
+ cGridBag opacity = new cGridBag();
1815
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1816
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1817
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1818
+ globalSection.add(opacity);
17461819
1747
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1748
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1749
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1750
- aConstraints.gridx += 1;
1751
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1752
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1753
- aConstraints.gridx = 0;
1754
- aConstraints.gridy += 1;
1755
- aConstraints.gridwidth = 1;
1820
+ panel.add(new JSeparator());
1821
+
1822
+ panel.add(globalSection);
1823
+
1824
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1825
+
1826
+ cGridBag textureSection = new cGridBag().setVertical(true);
17561827
1757
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1758
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1759
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1760
- aConstraints.gridx += 1;
1761
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1762
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1763
- aConstraints.gridx = 0;
1764
- aConstraints.gridy += 1;
1765
- aConstraints.gridwidth = 1;
1828
+ cGridBag bump = new cGridBag();
1829
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1830
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1831
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1832
+ textureSection.add(bump);
17661833
1767
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1768
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1769
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1770
- aConstraints.gridx += 1;
1771
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1772
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1773
- aConstraints.gridx = 0;
1774
- aConstraints.gridy += 1;
1775
- aConstraints.gridwidth = 1;
1834
+ cGridBag noise = new cGridBag();
1835
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1836
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1837
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1838
+ textureSection.add(noise);
17761839
1777
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1778
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1779
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1780
- aConstraints.gridx += 1;
1781
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1782
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1783
- aConstraints.gridx = 0;
1784
- aConstraints.gridy += 1;
1785
- aConstraints.gridwidth = 1;
1840
+ cGridBag power = new cGridBag();
1841
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1842
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1843
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1844
+ textureSection.add(power);
17861845
1787
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1788
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1789
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1790
- aConstraints.gridx += 1;
1791
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1792
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1793
- aConstraints.gridx = 0;
1794
- aConstraints.gridy += 1;
1795
- aConstraints.gridwidth = 1;
1846
+ cGridBag borderfade = new cGridBag();
1847
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1848
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1849
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1850
+ textureSection.add(borderfade);
17961851
1797
- //aConstraints.weighty = 1;
1798
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1799
- //aConstraints.gridx += 1;
1800
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1801
- aConstraints.weighty = 0;
1852
+ cGridBag fog = new cGridBag();
1853
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1854
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1855
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1856
+ textureSection.add(fog);
18021857
1803
- aConstraints.gridx = 0;
1804
- aConstraints.gridy = 0;
1805
- aConstraints.gridwidth = 1;
1858
+ cGridBag opacityPower = new cGridBag();
1859
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1860
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1861
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1862
+ textureSection.add(opacityPower);
1863
+
1864
+ panel.add(new JSeparator());
1865
+
1866
+ panel.add(textureSection);
1867
+
1868
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18061869
18071870 SetMaterial(copy); // .GetMaterial());
18081871
1809
- colorField.addChangeListener(this);
1810
- modulationField.addChangeListener(this);
1872
+ //colorField.addChangeListener(this);
1873
+// modulationField.addChangeListener(this);
18111874 metalnessField.addChangeListener(this);
18121875 diffuseField.addChangeListener(this);
18131876 specularField.addChangeListener(this);
....@@ -1837,12 +1900,15 @@
18371900 opacityPowerField.addChangeListener(this);
18381901 /**/
18391902
1840
- resetSlidersButton.addActionListener(this);
18411903 clearMaterialButton.addActionListener(this);
18421904 createMaterialButton.addActionListener(this);
1843
-
1844
- propagateToggle.addItemListener(this);
1845
- multiplyToggle.addItemListener(this);
1905
+
1906
+ if (Globals.ADVANCED)
1907
+ {
1908
+ resetSlidersButton.addActionListener(this);
1909
+ propagateToggle.addItemListener(this);
1910
+ multiplyToggle.addItemListener(this);
1911
+ }
18461912 }
18471913
18481914 void DropFile(java.io.File[] files, boolean textures)
....@@ -2013,7 +2079,7 @@
20132079
20142080 //? flashIt = false;
20152081 CameraPane pane = (CameraPane) cameraView;
2016
- pane.clickStart(location.x, location.y, 0);
2082
+ pane.clickStart(location.x, location.y, 0, 0);
20172083 pane.clickEnd(location.x, location.y, 0, true);
20182084
20192085 if (group.selection.size() == 1)
....@@ -2062,6 +2128,7 @@
20622128 e2.printStackTrace();
20632129 }
20642130 }
2131
+
20652132 LoadJMEThread loadThread;
20662133
20672134 class LoadJMEThread extends Thread
....@@ -2119,6 +2186,7 @@
21192186 //LoadFile0(filename, converter);
21202187 }
21212188 }
2189
+
21222190 LoadOBJThread loadObjThread;
21232191
21242192 class LoadOBJThread extends Thread
....@@ -2197,19 +2265,19 @@
21972265
21982266 void LoadObjFile(String fullname)
21992267 {
2200
- /*
2268
+ System.out.println("Loading " + fullname);
2269
+ /**/
22012270 //lastFilename = fullname;
22022271 if(loadObjThread == null)
22032272 {
2204
- loadObjThread = new LoadOBJThread();
2205
- loadObjThread.start();
2273
+ loadObjThread = new LoadOBJThread();
2274
+ loadObjThread.start();
22062275 }
22072276
22082277 loadObjThread.add(fullname);
2209
- */
2278
+ /**/
22102279
2211
- System.out.println("Loading " + fullname);
2212
- makeSomething(new FileObject(fullname, true), true);
2280
+ //makeSomething(new FileObject(fullname, true), true);
22132281 }
22142282
22152283 void LoadGFDFile(String fullname)
....@@ -2470,11 +2538,11 @@
24702538
24712539 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24722540 {
2473
- if (GrafreeD.standAlone)
2541
+ if (Grafreed.standAlone)
24742542 {
24752543 /**/
24762544 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2477
- browser.show();
2545
+ browser.setVisible(true);
24782546 String filename = browser.getFile();
24792547 if (filename != null && filename.length() > 0)
24802548 {
....@@ -2619,6 +2687,7 @@
26192687 }
26202688 if (input == null)
26212689 {
2690
+ new Exception().printStackTrace();
26222691 System.exit(0);
26232692 }
26242693
....@@ -2825,6 +2894,8 @@
28252894
28262895 void SetMaterial(Object3D object)
28272896 {
2897
+ latestObject = object;
2898
+
28282899 cMaterial mat = object.material;
28292900
28302901 if (mat == null)
....@@ -2833,7 +2904,8 @@
28332904 return;
28342905 }
28352906
2836
- multiplyToggle.setSelected(mat.multiply);
2907
+ if (multiplyToggle != null)
2908
+ multiplyToggle.setSelected(mat.multiply);
28372909
28382910 assert (object.projectedVertices != null);
28392911
....@@ -3009,7 +3081,7 @@
30093081 cameraView.ToggleDL();
30103082 cameraView.repaint();
30113083 return;
3012
- } else if (event.getSource() == toggleTextureItem)
3084
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30133085 {
30143086 cameraView.ToggleTexture();
30153087 // june 2013 copy.HardTouch();
....@@ -3048,9 +3120,9 @@
30483120 frame.validate();
30493121
30503122 return;
3051
- } else if (event.getSource() == toggleRandomItem)
3123
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30523124 {
3053
- cameraView.ToggleRandom();
3125
+ cameraView.ToggleSwitch();
30543126 cameraView.repaint();
30553127 return;
30563128 } else if (event.getSource() == toggleHandleItem)
....@@ -3079,6 +3151,10 @@
30793151 {
30803152 copy.live ^= true;
30813153 return;
3154
+ } else if (event.getSource() == selectCB)
3155
+ {
3156
+ copy.dontselect ^= true;
3157
+ return;
30823158 } else if (event.getSource() == hideCB)
30833159 {
30843160 copy.hide ^= true;
....@@ -3093,6 +3169,7 @@
30933169 if (event.getSource() == randomCB)
30943170 {
30953171 copy.random ^= true;
3172
+ objEditor.refreshContents();
30963173 return;
30973174 }
30983175 if (event.getSource() == speedupCB)
....@@ -3116,8 +3193,9 @@
31163193
31173194 public void actionPerformed(ActionEvent event)
31183195 {
3196
+ Object source = event.getSource();
31193197 // SCRIPT DIALOG
3120
- if (event.getSource() == okbutton)
3198
+ if (source == okbutton)
31213199 {
31223200 textpanel.setVisible(false);
31233201 textpanel.remove(textarea);
....@@ -3129,7 +3207,7 @@
31293207 textarea = null;
31303208 textpanel = null;
31313209 }
3132
- if (event.getSource() == cancelbutton)
3210
+ if (source == cancelbutton)
31333211 {
31343212 textpanel.setVisible(false);
31353213 textpanel.remove(textarea);
....@@ -3141,50 +3219,50 @@
31413219 //applySelf();
31423220 //client.refreshEditWindow();
31433221 //refreshContents();
3144
- if (event.getSource() == nameField)
3222
+ if (source == nameField)
31453223 {
31463224 //System.out.println("ObjEditor " + event);
31473225 applySelf0(true);
31483226 //parent.applySelf();
31493227 objEditor.refreshContents();
3150
- } else if (event.getSource() == resetButton)
3228
+ } else if (source == resetButton)
31513229 {
31523230 CameraPane.fullreset = true;
31533231 copy.Reset(); // ResetMeshes();
31543232 copy.Touch();
31553233 objEditor.refreshContents();
3156
- } else if (event.getSource() == stepItem)
3234
+ } else if (source == stepItem)
31573235 {
31583236 //cameraView.ONESTEP = true;
31593237 Globals.ONESTEP = true;
31603238 cameraView.repaint();
31613239 return;
3162
- } else if (event.getSource() == stepButton)
3240
+ } else if (source == stepButton)
31633241 {
31643242 copy.Step();
31653243 copy.Touch();
31663244 objEditor.refreshContents();
3167
- } else if (event.getSource() == slowerButton)
3245
+ } else if (source == slowerButton)
31683246 {
31693247 copy.Slower();
31703248 copy.Touch();
31713249 objEditor.refreshContents();
3172
- } else if (event.getSource() == fasterButton)
3250
+ } else if (source == fasterButton)
31733251 {
31743252 copy.Faster();
31753253 copy.Touch();
31763254 objEditor.refreshContents();
3177
- } else if (event.getSource() == remarkButton)
3255
+ } else if (source == remarkButton)
31783256 {
31793257 copy.Remark();
31803258 copy.Touch();
31813259 objEditor.refreshContents();
3182
- } else if (event.getSource() == stepAllButton)
3260
+ } else if (source == stepAllButton)
31833261 {
31843262 copy.StepAll();
31853263 copy.Touch();
31863264 objEditor.refreshContents();
3187
- } else if (event.getSource() == resetAllButton)
3265
+ } else if (source == resetAllButton)
31883266 {
31893267 //CameraPane.fullreset = true;
31903268 copy.ResetAll(); // ResetMeshes();
....@@ -3217,53 +3295,75 @@
32173295 // Close();
32183296 // }
32193297 // else
3220
- if (event.getSource() == resetSlidersButton)
3298
+ if (source == resetSlidersButton)
32213299 {
32223300 ResetSliders();
3223
- } else if (event.getSource() == clearMaterialButton)
3301
+ } else if (source == clearMaterialButton)
32243302 {
32253303 ClearMaterial();
3226
- } else if (event.getSource() == createMaterialButton)
3304
+ } else if (source == createMaterialButton)
32273305 {
32283306 CreateMaterial();
3229
- } else if (event.getSource() == clearPanelButton)
3307
+ } else if (source == clearPanelButton)
32303308 {
32313309 copy.ClearUI();
32323310 refreshContents(true);
3233
- } /*
3234
- }
3235
-
3236
- public boolean action(Event event, Object arg)
3237
- {
3238
- */ else if (event.getSource() == closeItem)
3311
+ } else if (source == importGFDItem)
3312
+ {
3313
+ ImportGFD();
3314
+ } else
3315
+ if (source == importVRMLX3DItem)
3316
+ {
3317
+ ImportVRMLX3D();
3318
+ } else
3319
+ if (source == import3DSItem)
3320
+ {
3321
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3322
+ } else
3323
+ if (source == importOBJItem)
3324
+ {
3325
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3326
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3327
+ browser.setVisible(true);
3328
+ String filename = browser.getFile();
3329
+ if (filename != null && filename.length() > 0)
3330
+ {
3331
+ String fullname = browser.getDirectory() + filename;
3332
+ makeSomething(ReadOBJ(fullname), true);
3333
+ }
3334
+ } else
3335
+ if (source == closeItem)
32393336 {
32403337 Close();
32413338 //return true;
3242
- } else if (event.getSource() == loadItem)
3339
+ } else if (source == loadItem)
32433340 {
32443341 load();
32453342 //return true;
3246
- } else if (event.getSource() == saveItem)
3343
+ } else if (source == newItem)
3344
+ {
3345
+ New();
3346
+ } else if (source == saveItem)
32473347 {
32483348 save();
32493349 //return true;
3250
- } else if (event.getSource() == saveAsItem)
3350
+ } else if (source == saveAsItem)
32513351 {
32523352 saveAs();
32533353 //return true;
3254
- } else if (event.getSource() == reexportItem)
3354
+ } else if (source == reexportItem)
32553355 {
32563356 reexport();
32573357 //return true;
3258
- } else if (event.getSource() == exportAsItem)
3358
+ } else if (source == exportAsItem)
32593359 {
32603360 export();
32613361 //return true;
3262
- } else if (event.getSource() == povItem)
3362
+ } else if (source == povItem)
32633363 {
32643364 generatePOV();
32653365 //return true;
3266
- } else if (event.getSource() == zBufferItem)
3366
+ } else if (source == zBufferItem)
32673367 {
32683368 try
32693369 {
....@@ -3285,21 +3385,8 @@
32853385 cameraView.repaint();
32863386 //return true;
32873387 }
3288
- */ else if (event.getSource() == editCameraItem)
3289
- {
3290
- cameraView.ProtectCamera();
3291
- cameraView.repaint();
3292
- return;
3293
- } else if (event.getSource() == revertCameraItem)
3294
- {
3295
- cameraView.RevertCamera();
3296
- cameraView.repaint();
3297
- return;
3298
-// } else if (event.getSource() == textureButton)
3299
-// {
3300
-// return; // true;
3301
- } else // combos...
3302
- if (event.getSource() == texresMenu)
3388
+ */ else // combos...
3389
+ if (source == texresMenu)
33033390 {
33043391 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33053392 copy.texres = texresMenu.getSelectedIndex();
....@@ -3311,12 +3398,272 @@
33113398 }
33123399 }
33133400
3401
+ void New()
3402
+ {
3403
+ while (copy.Size() > 1)
3404
+ {
3405
+ copy.remove(1);
3406
+ }
3407
+
3408
+ ResetModel();
3409
+ objEditor.refreshContents();
3410
+ }
3411
+
3412
+ static public byte[] Compress(Object3D o)
3413
+ {
3414
+ try
3415
+ {
3416
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3417
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3418
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3419
+
3420
+ Object3D parent = o.parent;
3421
+ o.parent = null;
3422
+
3423
+ out.writeObject(o);
3424
+
3425
+ o.parent = parent;
3426
+
3427
+ out.flush();
3428
+
3429
+ zstream.close();
3430
+ out.close();
3431
+
3432
+ return baos.toByteArray();
3433
+ } catch (Exception e)
3434
+ {
3435
+ System.err.println(e);
3436
+ return null;
3437
+ }
3438
+ }
3439
+
3440
+ static public Object Uncompress(byte[] bytes)
3441
+ {
3442
+ System.out.println("#bytes = " + bytes.length);
3443
+ try
3444
+ {
3445
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3446
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3447
+ ObjectInputStream in = new ObjectInputStream(istream);
3448
+ Object obj = in.readObject();
3449
+ in.close();
3450
+
3451
+ return obj;
3452
+ } catch (Exception e)
3453
+ {
3454
+ System.err.println(e);
3455
+ return null;
3456
+ }
3457
+ }
3458
+
3459
+ static public Object clone(Object o)
3460
+ {
3461
+ try
3462
+ {
3463
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3464
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3465
+
3466
+ out.writeObject(o);
3467
+
3468
+ out.flush();
3469
+ out.close();
3470
+
3471
+ byte[] bytes = baos.toByteArray();
3472
+
3473
+ System.out.println("clone = " + bytes.length);
3474
+
3475
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3476
+ ObjectInputStream in = new ObjectInputStream(bais);
3477
+ Object obj = in.readObject();
3478
+ in.close();
3479
+
3480
+ return obj;
3481
+ } catch (Exception e)
3482
+ {
3483
+ System.err.println(e);
3484
+ return null;
3485
+ }
3486
+ }
3487
+
3488
+ cRadio GetCurrentTab()
3489
+ {
3490
+ cRadio ab;
3491
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3492
+ {
3493
+ ab = (cRadio)e.nextElement();
3494
+ if(ab.GetObject() == copy)
3495
+ {
3496
+ return ab;
3497
+ }
3498
+ }
3499
+
3500
+ return null;
3501
+ }
3502
+
3503
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3504
+
3505
+ public void Save()
3506
+ {
3507
+ System.err.println("Save");
3508
+
3509
+ cRadio tab = GetCurrentTab();
3510
+
3511
+ boolean temp = CameraPane.SWITCH;
3512
+ CameraPane.SWITCH = false;
3513
+
3514
+ copy.ExtractBigData(hashtable);
3515
+
3516
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3517
+ tab.graphs[tab.undoindex++] = Compress(copy);
3518
+
3519
+ copy.RestoreBigData(hashtable);
3520
+
3521
+ CameraPane.SWITCH = temp;
3522
+
3523
+ //assert(hashtable.isEmpty());
3524
+
3525
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3526
+ {
3527
+ tab.graphs[i] = null;
3528
+ }
3529
+
3530
+ // test save
3531
+ if (false)
3532
+ {
3533
+ try
3534
+ {
3535
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3536
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3537
+
3538
+ p.writeObject(copy);
3539
+
3540
+ p.flush();
3541
+
3542
+ ostream.close();
3543
+ } catch (Exception e)
3544
+ {
3545
+ e.printStackTrace();
3546
+ }
3547
+ }
3548
+ }
3549
+
3550
+ void CopyChanged(Object3D obj)
3551
+ {
3552
+ boolean temp = CameraPane.SWITCH;
3553
+ CameraPane.SWITCH = false;
3554
+
3555
+ copy.ExtractBigData(hashtable);
3556
+
3557
+ copy.clear();
3558
+
3559
+ for (int i=0; i<obj.Size(); i++)
3560
+ {
3561
+ copy.add(obj.get(i));
3562
+ }
3563
+
3564
+ copy.RestoreBigData(hashtable);
3565
+
3566
+ CameraPane.SWITCH = temp;
3567
+
3568
+ //assert(hashtable.isEmpty());
3569
+
3570
+ copy.Touch();
3571
+
3572
+ ResetModel();
3573
+ copy.HardTouch(); // recompile?
3574
+
3575
+ cRadio ab;
3576
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3577
+ {
3578
+ ab = (cRadio)e.nextElement();
3579
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3580
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3581
+ if (test != null)
3582
+ {
3583
+ test.editWindow = ab.object.editWindow;
3584
+ ab.object = test;
3585
+ }
3586
+ }
3587
+
3588
+ refreshContents();
3589
+ }
3590
+
3591
+ public void Undo()
3592
+ {
3593
+ System.err.println("Undo");
3594
+
3595
+ cRadio tab = GetCurrentTab();
3596
+
3597
+ if (tab.undoindex == 0)
3598
+ {
3599
+ java.awt.Toolkit.getDefaultToolkit().beep();
3600
+ return;
3601
+ }
3602
+
3603
+ if (tab.graphs[tab.undoindex] == null)
3604
+ {
3605
+ Save();
3606
+ tab.undoindex -= 1;
3607
+ }
3608
+
3609
+ tab.undoindex -= 1;
3610
+
3611
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3612
+ }
3613
+
3614
+ public void Redo()
3615
+ {
3616
+ cRadio tab = GetCurrentTab();
3617
+
3618
+ if (tab.graphs[tab.undoindex + 1] == null)
3619
+ {
3620
+ java.awt.Toolkit.getDefaultToolkit().beep();
3621
+ return;
3622
+ }
3623
+
3624
+ tab.undoindex += 1;
3625
+
3626
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3627
+ }
3628
+
3629
+ void ImportGFD()
3630
+ {
3631
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3632
+ browser.show();
3633
+ String filename = browser.getFile();
3634
+ if (filename != null && filename.length() > 0)
3635
+ {
3636
+ String fullname = browser.getDirectory() + filename;
3637
+
3638
+ //Object3D readobj =
3639
+ objEditor.ReadGFD(fullname, objEditor);
3640
+ //makeSomething(readobj);
3641
+ }
3642
+ }
3643
+
3644
+ void ImportVRMLX3D()
3645
+ {
3646
+ if (Grafreed.standAlone)
3647
+ {
3648
+ /**/
3649
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3650
+ browser.show();
3651
+ String filename = browser.getFile();
3652
+ if (filename != null && filename.length() > 0)
3653
+ {
3654
+ String fullname = browser.getDirectory() + filename;
3655
+ LoadVRMLX3D(fullname);
3656
+ }
3657
+ /**/
3658
+ }
3659
+ }
3660
+
33143661 void ToggleAnimation()
33153662 {
33163663 if (!Globals.ANIMATION)
33173664 {
33183665 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3319
- browser.show();
3666
+ browser.setVisible(true);
33203667 String filename = browser.getFile();
33213668 if (filename != null && filename.length() > 0)
33223669 {
....@@ -3326,8 +3673,8 @@
33263673
33273674 Globals.ANIMATION ^= true;
33283675
3329
- GrafreeD.wav.cursor = 0;
3330
- GrafreeD.wav.loop = 0;
3676
+ Grafreed.wav.cursor = 0;
3677
+ Grafreed.wav.loop = 0;
33313678 }
33323679 } else
33333680 {
....@@ -3377,7 +3724,7 @@
33773724 void CreateMaterial()
33783725 {
33793726 //copy.ClearMaterial(); // PATCH
3380
- copy.CreateMaterialS(multiplyToggle.isSelected());
3727
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33813728 if (copy.selection.size() > 0)
33823729 //SetMaterial(copy);
33833730 {
....@@ -3428,7 +3775,7 @@
34283775 assert false;
34293776 }
34303777
3431
- void EditSelection()
3778
+ void EditSelection(boolean newWindow)
34323779 {
34333780 }
34343781
....@@ -3436,11 +3783,11 @@
34363783 {
34373784 copy.ResetBlockLoop(); // temporary problem
34383785
3439
- boolean random = CameraPane.RANDOM;
3440
- CameraPane.RANDOM = false; // parse everything
3786
+ boolean random = CameraPane.SWITCH;
3787
+ CameraPane.SWITCH = false; // parse everything
34413788 copy.ResetDisplayList();
34423789 copy.HardTouch();
3443
- CameraPane.RANDOM = random;
3790
+ CameraPane.SWITCH = random;
34443791 }
34453792
34463793 // public void applySelf()
....@@ -3510,10 +3857,40 @@
35103857 current.fakedepth = (float) fakedepthField.getFloat();
35113858 current.shadowbias = (float) shadowbiasField.getFloat();
35123859
3513
- if (!NumberSlider.frozen)
3860
+ if (!cNumberSlider.frozen)
35143861 {
35153862 //System.out.println("Propagate = " + propagate);
35163863 copy.UpdateMaterial(anchor, current, propagate);
3864
+
3865
+ if (copy.material != null)
3866
+ {
3867
+ cMaterial mat = copy.material;
3868
+
3869
+ colorField.SetToolTipValue((mat.color));
3870
+ modulationField.SetToolTipValue((mat.modulation));
3871
+ metalnessField.SetToolTipValue((mat.metalness));
3872
+ diffuseField.SetToolTipValue((mat.diffuse));
3873
+ specularField.SetToolTipValue((mat.specular));
3874
+ shininessField.SetToolTipValue((mat.shininess));
3875
+ shiftField.SetToolTipValue((mat.shift));
3876
+ ambientField.SetToolTipValue((mat.ambient));
3877
+ lightareaField.SetToolTipValue((mat.lightarea));
3878
+ diffusenessField.SetToolTipValue((mat.factor));
3879
+ velvetField.SetToolTipValue((mat.velvet));
3880
+ sheenField.SetToolTipValue((mat.sheen));
3881
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3882
+ backlitField.SetToolTipValue((mat.bump));
3883
+ anisoField.SetToolTipValue((mat.aniso));
3884
+ anisoVField.SetToolTipValue((mat.anisoV));
3885
+ cameraField.SetToolTipValue((mat.cameralight));
3886
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3887
+ shadowField.SetToolTipValue((mat.shadow));
3888
+ textureField.SetToolTipValue((mat.texture));
3889
+ opacityField.SetToolTipValue((mat.opacity));
3890
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3891
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3892
+ }
3893
+
35173894 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35183895 {
35193896 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3558,6 +3935,7 @@
35583935 || e.getSource() == apertureField
35593936 || e.getSource() == shadowblurField)
35603937 {
3938
+ new Exception().printStackTrace();
35613939 System.exit(0);
35623940 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35633941 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3628,7 +4006,7 @@
36284006 }
36294007
36304008 if (normalpushField != null)
3631
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4009
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36324010 }
36334011
36344012 void SnapObject()
....@@ -3883,7 +4261,7 @@
38834261
38844262 radioPanel.revalidate();
38854263 radioPanel.repaint();
3886
- ctrlPanel.revalidate(); // ? new
4264
+ ctrlPanel.validate(); // ? new
38874265 ctrlPanel.repaint();
38884266 }
38894267 }
....@@ -3892,6 +4270,8 @@
38924270
38934271 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38944272 {
4273
+ if (Globals.SAVEONMAKE) // && resetmodel)
4274
+ Save();
38954275 //Tween.set(thing, 0).target(1).start(tweenManager);
38964276 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38974277 // if (thing instanceof GenericJointDemo)
....@@ -3978,6 +4358,12 @@
39784358 {
39794359 ResetModel();
39804360 Select(thing.GetTreePath(), true, false); // unselect... false);
4361
+
4362
+ if (thing.Size() == 0)
4363
+ {
4364
+ //EditSelection(false);
4365
+ }
4366
+
39814367 refreshContents();
39824368 }
39834369
....@@ -4095,6 +4481,7 @@
40954481 }
40964482 }
40974483 }
4484
+
40984485 LoadGFDThread loadGFDThread;
40994486
41004487 void ReadGFD(String fullname, iCallBack cb)
....@@ -4114,8 +4501,10 @@
41144501
41154502 try
41164503 {
4504
+ // Try compressed version first.
41174505 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4118
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4506
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4507
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41194508
41204509 readobj = (Object3D) p.readObject();
41214510 istream.close();
....@@ -4123,7 +4512,20 @@
41234512 readobj.ResetDisplayList();
41244513 } catch (Exception e)
41254514 {
4126
- e.printStackTrace();
4515
+ //e.printStackTrace();
4516
+ try
4517
+ {
4518
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4519
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4520
+
4521
+ readobj = (Object3D) p.readObject();
4522
+ istream.close();
4523
+
4524
+ readobj.ResetDisplayList();
4525
+ } catch (Exception e2)
4526
+ {
4527
+ e2.printStackTrace();
4528
+ }
41274529 }
41284530 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41294531 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4169,6 +4571,12 @@
41694571
41704572 void LoadIt(Object obj)
41714573 {
4574
+ if (obj == null)
4575
+ {
4576
+ // Invalid file
4577
+ return;
4578
+ }
4579
+
41724580 System.out.println("Loaded " + obj);
41734581 //new Exception().printStackTrace();
41744582 Object3D readobj = (Object3D) obj;
....@@ -4178,6 +4586,8 @@
41784586
41794587 if (readobj != null)
41804588 {
4589
+ if (Globals.SAVEONMAKE)
4590
+ Save();
41814591 try
41824592 {
41834593 //readobj.deepCopySelf(copy);
....@@ -4240,7 +4650,7 @@
42404650
42414651 void load() // throws ClassNotFoundException
42424652 {
4243
- if (GrafreeD.standAlone)
4653
+ if (Grafreed.standAlone)
42444654 {
42454655 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42464656 browser.show();
....@@ -4327,11 +4737,13 @@
43274737 try
43284738 {
43294739 FileOutputStream ostream = new FileOutputStream(lastname);
4330
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4740
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4741
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43314742
43324743 p.writeObject(copy);
43334744 p.flush();
43344745
4746
+ zstream.close();
43354747 ostream.close();
43364748
43374749 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4341,11 +4753,12 @@
43414753 {
43424754 }
43434755 }
4756
+
43444757 String lastname;
43454758
43464759 void saveAs()
43474760 {
4348
- if (GrafreeD.standAlone)
4761
+ if (Grafreed.standAlone)
43494762 {
43504763 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43514764 browser.setVisible(true);
....@@ -4450,13 +4863,13 @@
44504863 try
44514864 {
44524865 FileOutputStream ostream = new FileOutputStream(filename);
4453
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4454
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4866
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4867
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44554868
44564869 Object3D objectparent = obj.parent;
44574870 obj.parent = null;
44584871
4459
- Object3D object = (Object3D) GrafreeD.clone(obj);
4872
+ Object3D object = (Object3D) Grafreed.clone(obj);
44604873
44614874 obj.parent = objectparent;
44624875
....@@ -4468,8 +4881,8 @@
44684881 p.writeObject(object);
44694882 p.flush();
44704883
4884
+ zstream.close();
44714885 ostream.close();
4472
- // zstream.close();
44734886
44744887 // group.selection.get(0).parent = parent;
44754888 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4490,7 +4903,7 @@
44904903 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44914904 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44924905 copy.generatePOV(buffer);
4493
- if (GrafreeD.standAlone)
4906
+ if (Grafreed.standAlone)
44944907 {
44954908 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44964909 browser.show();
....@@ -4516,7 +4929,8 @@
45164929 Object3D client;
45174930 Object3D copy;
45184931 MenuBar menuBar;
4519
- Menu windowMenu;
4932
+ Menu fileMenu;
4933
+ MenuItem newItem;
45204934 MenuItem loadItem;
45214935 MenuItem saveItem;
45224936 MenuItem saveAsItem;
....@@ -4524,13 +4938,11 @@
45244938 MenuItem reexportItem;
45254939 MenuItem povItem;
45264940 MenuItem closeItem;
4527
- Menu cameraMenu;
4941
+
45284942 CheckboxMenuItem zBufferItem;
45294943 //MenuItem normalLensItem;
4530
- MenuItem editCameraItem;
4531
- MenuItem revertCameraItem;
4532
- CheckboxMenuItem toggleLiveItem;
45334944 MenuItem stepItem;
4945
+ CheckboxMenuItem toggleLiveItem;
45344946 CheckboxMenuItem toggleFullScreenItem;
45354947 CheckboxMenuItem toggleTimelineItem;
45364948 CheckboxMenuItem toggleRenderItem;
....@@ -4539,28 +4951,41 @@
45394951 CheckboxMenuItem toggleFootContactItem;
45404952 CheckboxMenuItem toggleDLItem;
45414953 CheckboxMenuItem toggleTextureItem;
4542
- CheckboxMenuItem toggleRandomItem;
4954
+ CheckboxMenuItem toggleSwitchItem;
45434955 CheckboxMenuItem toggleRootItem;
45444956 CheckboxMenuItem animationItem;
45454957 CheckboxMenuItem toggleHandleItem;
45464958 CheckboxMenuItem togglePaintItem;
45474959 JSplitPane mainPanel;
45484960 JScrollPane scrollpane;
4961
+
45494962 JPanel toolbarPanel;
4550
- JPanel treePanel;
4963
+
4964
+ cGridBag treePanel;
4965
+
45514966 JPanel radioPanel;
45524967 ButtonGroup buttonGroup;
4553
- JPanel ctrlPanel;
4554
- JPanel materialPanel;
4968
+
4969
+ cGridBag toolboxPanel;
4970
+ cGridBag materialPanel;
4971
+ cGridBag ctrlPanel;
4972
+
45554973 JScrollPane infoPanel;
4556
- JPanel optionsPanel;
4974
+
4975
+ cGridBag optionsPanel;
4976
+
45574977 JTabbedPane objectPanel;
4978
+ boolean materialFlushed;
4979
+ Object3D latestObject;
4980
+
45584981 cGridBag XYZPanel;
4982
+
45594983 JSplitPane gridPanel;
45604984 JSplitPane bigPanel;
4985
+
45614986 cGridBag bigThree;
4562
- JTabbedPane scenePanel;
4563
- JPanel centralPanel;
4987
+ cGridBag scenePanel;
4988
+ cGridBag centralPanel;
45644989 JSplitPane cameraPanel;
45654990 JPanel timelinePanel;
45664991 JMenuBar timelineMenubar;
....@@ -4613,67 +5038,72 @@
46135038 // MATERIAL
46145039 JLabel materialLabel;
46155040 JLabel colorLabel;
4616
- NumberSlider colorField;
5041
+ cNumberSlider colorField;
46175042 JLabel modulationLabel;
4618
- NumberSlider modulationField;
5043
+ cNumberSlider modulationField;
46195044 JLabel metalnessLabel;
4620
- NumberSlider metalnessField;
5045
+ cNumberSlider metalnessField;
46215046 JLabel diffuseLabel;
4622
- NumberSlider diffuseField;
5047
+ cNumberSlider diffuseField;
46235048 JLabel specularLabel;
4624
- NumberSlider specularField;
5049
+ cNumberSlider specularField;
46255050 JLabel shininessLabel;
4626
- NumberSlider shininessField;
5051
+ cNumberSlider shininessField;
46275052 JLabel shiftLabel;
4628
- NumberSlider shiftField;
5053
+ cNumberSlider shiftField;
46295054 JLabel ambientLabel;
4630
- NumberSlider ambientField;
5055
+ cNumberSlider ambientField;
46315056 JLabel lightareaLabel;
4632
- NumberSlider lightareaField;
5057
+ cNumberSlider lightareaField;
46335058 JLabel diffusenessLabel;
4634
- NumberSlider diffusenessField;
5059
+ cNumberSlider diffusenessField;
46355060 JLabel velvetLabel;
4636
- NumberSlider velvetField;
5061
+ cNumberSlider velvetField;
46375062 JLabel sheenLabel;
4638
- NumberSlider sheenField;
5063
+ cNumberSlider sheenField;
46395064 JLabel subsurfaceLabel;
4640
- NumberSlider subsurfaceField;
5065
+ cNumberSlider subsurfaceField;
46415066 //JLabel bumpLabel;
46425067 //NumberSlider bumpField;
46435068 JLabel backlitLabel;
4644
- NumberSlider backlitField;
5069
+ cNumberSlider backlitField;
46455070 JLabel anisoLabel;
4646
- NumberSlider anisoField;
5071
+ cNumberSlider anisoField;
46475072 JLabel anisoVLabel;
4648
- NumberSlider anisoVField;
5073
+ cNumberSlider anisoVField;
46495074 JLabel cameraLabel;
4650
- NumberSlider cameraField;
5075
+ cNumberSlider cameraField;
46515076 JLabel selfshadowLabel;
4652
- NumberSlider selfshadowField;
5077
+ cNumberSlider selfshadowField;
46535078 JLabel shadowLabel;
4654
- NumberSlider shadowField;
5079
+ cNumberSlider shadowField;
46555080 JLabel textureLabel;
4656
- NumberSlider textureField;
5081
+ cNumberSlider textureField;
46575082 JLabel opacityLabel;
4658
- NumberSlider opacityField;
5083
+ cNumberSlider opacityField;
46595084 JLabel fakedepthLabel;
4660
- NumberSlider fakedepthField;
5085
+ cNumberSlider fakedepthField;
46615086 JLabel shadowbiasLabel;
4662
- NumberSlider shadowbiasField;
5087
+ cNumberSlider shadowbiasField;
46635088 JLabel bumpLabel;
4664
- NumberSlider bumpField;
5089
+ cNumberSlider bumpField;
46655090 JLabel noiseLabel;
4666
- NumberSlider noiseField;
5091
+ cNumberSlider noiseField;
46675092 JLabel powerLabel;
4668
- NumberSlider powerField;
5093
+ cNumberSlider powerField;
46695094 JLabel borderfadeLabel;
4670
- NumberSlider borderfadeField;
5095
+ cNumberSlider borderfadeField;
46715096 JLabel fogLabel;
4672
- NumberSlider fogField;
5097
+ cNumberSlider fogField;
46735098 JLabel opacityPowerLabel;
4674
- NumberSlider opacityPowerField;
4675
- JTree jTree;
5099
+ cNumberSlider opacityPowerField;
5100
+ cTree jTree;
46765101 //ObjectUI parent;
46775102
4678
- NumberSlider normalpushField;
5103
+ cNumberSlider normalpushField;
5104
+
5105
+ private MenuItem importGFDItem;
5106
+ private MenuItem importVRMLX3DItem;
5107
+ private MenuItem import3DSItem;
5108
+ private MenuItem importOBJItem;
46795109 }