Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
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,54 @@
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
+ cCheckBox GetCheckBox(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cCheckBox(name, border);
65
+ }
66
+ }
67
+
68
+ private ImageIcon GetIcon(String name) throws IOException
69
+ {
70
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
71
+
72
+ if (image.getWidth() != 24 && image.getHeight() != 24)
73
+ {
74
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
75
+ Graphics2D g = resized.createGraphics();
76
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
77
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
78
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
79
+ g.dispose();
80
+
81
+ image = resized;
82
+ }
83
+
84
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
85
+ return icon;
86
+ }
3887
3988 // SCRIPT
4089
....@@ -138,34 +187,42 @@
138187 public void closeUI()
139188 {
140189 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
190
+// System.out.println("this = " + this);
191
+// System.out.println("objEditor = " + objEditor);
143192 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
193
+// objEditor.ctrlPanel.remove(nameField);
194
+
195
+ objEditor.ctrlPanel.remove(namePanel);
145196
146197 if (!GroupEditor.allparams)
147198 return;
148199
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);
200
+// objEditor.ctrlPanel.remove(liveCB);
201
+// objEditor.ctrlPanel.remove(hideCB);
202
+// objEditor.ctrlPanel.remove(markCB);
203
+//
204
+// objEditor.ctrlPanel.remove(randomCB);
205
+// objEditor.ctrlPanel.remove(speedupCB);
206
+// objEditor.ctrlPanel.remove(rewindCB);
207
+//
208
+// objEditor.ctrlPanel.remove(resetButton);
209
+// objEditor.ctrlPanel.remove(stepButton);
210
+//// objEditor.ctrlPanel.remove(stepAllButton);
211
+//// objEditor.ctrlPanel.remove(resetAllButton);
212
+// objEditor.ctrlPanel.remove(link2masterCB);
213
+// //objEditor.ctrlPanel.remove(flipVCB);
214
+// //objEditor.ctrlPanel.remove(texresMenu);
215
+// objEditor.ctrlPanel.remove(slowerButton);
216
+// objEditor.ctrlPanel.remove(fasterButton);
217
+// objEditor.ctrlPanel.remove(remarkButton);
167218
168
- Remove(normalpushField);
219
+ objEditor.ctrlPanel.remove(setupPanel);
220
+ objEditor.ctrlPanel.remove(setupPanel2);
221
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
222
+ objEditor.ctrlPanel.remove(pushPanel);
223
+ //objEditor.ctrlPanel.remove(fillPanel);
224
+
225
+ //Remove(normalpushField);
169226 }
170227
171228 public ObjEditor GetEditor()
....@@ -236,6 +293,7 @@
236293 //localCopy.parent = null;
237294
238295 frame = new JFrame();
296
+ frame.setUndecorated(true);
239297 objEditor = this;
240298 this.callee = callee;
241299
....@@ -269,24 +327,40 @@
269327 void SetupMenu()
270328 {
271329 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..."));
330
+ menuBar.add(fileMenu = new Menu("File"));
331
+ fileMenu.add(newItem = new MenuItem("New"));
332
+ fileMenu.add(loadItem = new MenuItem("Open..."));
333
+
334
+ //oe.menuBar.add(menu = new Menu("Include"));
335
+ Menu menu = new Menu("Import");
336
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
337
+ importOBJItem.addActionListener(this);
338
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
339
+ import3DSItem.addActionListener(this);
340
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
341
+ importVRMLX3DItem.addActionListener(this);
342
+ menu.add("-");
343
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
344
+ importGFDItem.addActionListener(this);
345
+ fileMenu.add(menu);
346
+ fileMenu.add("-");
347
+
348
+ fileMenu.add(saveItem = new MenuItem("Save"));
349
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277350 //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("-");
351
+ fileMenu.add("-");
352
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
353
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
354
+ fileMenu.add("-");
282355 if (client.parent != null)
283356 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
357
+ fileMenu.add(closeItem = new MenuItem("Close"));
285358 } else
286359 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
360
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288361 }
289362
363
+ newItem.addActionListener(this);
290364 loadItem.addActionListener(this);
291365 saveItem.addActionListener(this);
292366 saveAsItem.addActionListener(this);
....@@ -295,79 +369,35 @@
295369 //povItem.addActionListener(this);
296370 closeItem.addActionListener(this);
297371
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
-
353372 objectPanel = new JTabbedPane();
354373 toolbarPanel = new JPanel();
355374 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
375
+ treePanel = new cGridBag();
357376 treePanel.setName("Tree");
358
- ctrlPanel = new JPanel(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
377
+
378
+ editPanel = new cGridBag().setVertical(true);
379
+ editPanel.setName("Edit");
380
+
381
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
382
+
383
+ editCommandsPanel = new cGridBag();
384
+ editPanel.add(editCommandsPanel);
385
+ editPanel.add(ctrlPanel);
386
+
387
+ materialPanel = new cGridBag().setVertical(true);
388
+
361389 materialPanel.setName("Material");
362390 /*JTextPane*/
363391 infoarea = createTextPane();
392
+ doc = infoarea.getStyledDocument();
393
+
364394 infoarea.setEditable(true);
365395 SetText();
366396 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367397 // infoarea.setOpaque(false);
368398 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
399
+// TEXTAREA infoarea.setLineWrap(true);
400
+// TEXTAREA infoarea.setWrapStyleWord(true);
371401 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372402 infoPanel.setPreferredSize(new Dimension(50, 200));
373403 infoPanel.setName("Info");
....@@ -378,16 +408,16 @@
378408 mainPanel.setName("Main");
379409 mainPanel.setContinuousLayout(true);
380410 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382411 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
412
+ mainPanel.setDividerLocation(0.5); //1.0);
413
+ mainPanel.setResizeWeight(0.5);
384414
385415 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386416 //mainPanel.setLayout(new GridBagLayout());
387417 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
418
+// treePanel.setLayout(new GridBagLayout());
419
+ //ctrlPanel.setLayout(new GridBagLayout());
420
+ //materialPanel.setLayout(new GridBagLayout());
391421
392422 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393423 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +456,7 @@
426456 static String newline = "\n";
427457 protected static final String buttonString = "JButton";
428458 StyledDocument doc;
429
- JTextArea infoarea;
459
+ JTextPane infoarea;
430460
431461 void ClearInfo()
432462 {
....@@ -449,10 +479,10 @@
449479 e.printStackTrace();
450480 }
451481
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();
482
+// String selection = infoarea.getText();
483
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
484
+// java.awt.datatransfer.Clipboard clipboard =
485
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456486 //clipboard.setContents(data, data);
457487 }
458488
....@@ -475,13 +505,13 @@
475505 //SendInfo("Name:", "bold");
476506 if (sel.GetTextures() != null || debug)
477507 {
478
- si.SendInfo(sel.toString(), "bold");
508
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479509 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480510 if (sel.Size() > 0)
481511 {
482512 si.SendInfo("#children = " + sel.Size(), "regular");
483513 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
514
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485515 if (debug)
486516 {
487517 try
....@@ -493,7 +523,10 @@
493523 }
494524
495525 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
526
+ {
527
+ si.SendInfo(" BBox min: " + minima, "regular");
528
+ si.SendInfo(" BBox max: " + maxima, "regular");
529
+ }
497530
498531 if (sel.bRep != null)
499532 {
....@@ -520,7 +553,7 @@
520553 }
521554 if (sel.support != null)
522555 {
523
- si.SendInfo(" support: " + sel.support, "regular");
556
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524557 }
525558 if (sel.scriptnode != null)
526559 {
....@@ -591,6 +624,9 @@
591624 {
592625 CameraPane.pointflow = (PointFlow) sel;
593626 }
627
+
628
+ si.SendInfo("_____________________", "regular");
629
+ si.SendInfo("", "regular");
594630 }
595631 }
596632
....@@ -606,68 +642,138 @@
606642 }
607643 }
608644
645
+static GraphicsDevice device = GraphicsEnvironment
646
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
647
+
648
+ Rectangle keeprect;
649
+ cRadio radio;
650
+
651
+cButton keepButton;
652
+ cButton twoButton; // Full 3D
653
+ cButton sixButton;
654
+ cButton threeButton;
655
+ cButton sevenButton;
656
+ cButton fourButton; // full panel
657
+ cButton oneButton; // full XYZ
658
+ //cButton currentLayout;
659
+
660
+ boolean maximized;
661
+
662
+ void Minimize()
663
+ {
664
+ frame.setState(Frame.ICONIFIED);
665
+ }
666
+
667
+ void Maximize()
668
+ {
669
+ if (maximized)
670
+ {
671
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
672
+ }
673
+ else
674
+ {
675
+ keeprect = frame.getBounds();
676
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
677
+ Dimension rect2 = frame.getToolkit().getScreenSize();
678
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
679
+// frame.setState(Frame.MAXIMIZED_BOTH);
680
+ }
681
+
682
+ maximized ^= true;
683
+ }
684
+
609685 void ToggleFullScreen()
610686 {
611687 if (CameraPane.FULLSCREEN)
612688 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
689
+ device.setFullScreenWindow(null);
690
+ //frame.setVisible(false);
691
+// frame.removeNotify();
692
+// frame.setUndecorated(false);
693
+// frame.addNotify();
694
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
695
+
696
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
697
+// X framePanel.add(bigThree);
698
+// X frame.getContentPane().add(/*"Center",*/framePanel);
699
+ framePanel.setDividerLocation(1);
700
+
701
+ //frame.setVisible(true);
702
+ radio.layout = keepButton;
703
+ //theFrame = null;
704
+ keepButton = null;
705
+ radio.layout.doClick();
706
+
616707 } else
617708 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
709
+ keepButton = radio.layout;
710
+ //keeprect = frame.getBounds();
711
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
712
+// frame.getToolkit().getScreenSize().height);
713
+ //frame.setVisible(false);
714
+ device.setFullScreenWindow(frame);
715
+// frame.removeNotify();
716
+// frame.setUndecorated(true);
717
+// frame.addNotify();
718
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
719
+// X framePanel.remove(bigThree);
720
+// X frame.getContentPane().add(/*"Center",*/bigThree);
721
+ framePanel.setDividerLocation(0);
722
+
723
+ radio.layout = twoButton;
724
+ radio.layout.doClick();
725
+ //frame.setVisible(true);
621726 }
727
+
622728 cameraView.ToggleFullScreen();
623729 }
624730
625
- private JTextArea createTextPane()
731
+ private JTextPane createTextPane()
626732 {
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
- };
733
+// TEXTAREA String[] initString =
734
+// {
735
+// "This is an editable JTextPane, ", //regular
736
+// "another ", //italic
737
+// "styled ", //bold
738
+// "text ", //small
739
+// "component, ", //large
740
+// "which supports embedded components..." + newline,//regular
741
+// " " + newline, //button
742
+// "...and embedded icons..." + newline, //regular
743
+// " ", //icon
744
+// newline + "JTextPane is a subclass of JEditorPane that "
745
+// + "uses a StyledEditorKit and StyledDocument, and provides "
746
+// + "cover methods for interacting with those objects."
747
+// };
748
+//
749
+// String[] initStyles =
750
+// {
751
+// "regular", "italic", "bold", "small", "large",
752
+// "regular", "button", "regular", "icon",
753
+// "regular"
754
+// };
755
+//
756
+// JTextPane textPane = new JTextPane();
757
+// textPane.setEditable(true);
758
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
759
+// addStylesToDocument(doc);
760
+//
761
+// try
762
+// {
763
+// for (int j = 0; j < 2; j++)
764
+// {
765
+// for (int i = 0; i < initString.length; i++)
766
+// {
767
+// doc.insertString(doc.getLength(), initString[i],
768
+// doc.getStyle(initStyles[i]));
769
+// }
770
+// }
771
+// } catch (BadLocationException ble)
772
+// {
773
+// System.err.println("Couldn't insert initial text into text pane.");
774
+// }
642775
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;
776
+ return new JTextPane(); // textPane;
671777 }
672778
673779 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +826,7 @@
720826 protected static ImageIcon createImageIcon(String path,
721827 String description)
722828 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
829
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724830 if (imgURL != null)
725831 {
726832 return new ImageIcon(imgURL, description);
....@@ -752,6 +858,7 @@
752858 // NumberSlider vDivsField;
753859 // JCheckBox endcaps;
754860 JCheckBox liveCB;
861
+ JCheckBox selectCB;
755862 JCheckBox hideCB;
756863 JCheckBox link2masterCB;
757864 JCheckBox markCB;
....@@ -767,115 +874,87 @@
767874 JButton slowerButton;
768875 JButton fasterButton;
769876 JButton remarkButton;
877
+
878
+ cGridBag editPanel;
879
+ cGridBag editCommandsPanel;
880
+
881
+ cGridBag namePanel;
882
+ cGridBag setupPanel;
883
+ cGridBag setupPanel2;
884
+ cGridBag objectCommandsPanel;
885
+ cGridBag pushPanel;
886
+ cGridBag fillPanel;
770887
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
888
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772889 {
773890 JCheckBox cb;
774891
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);
892
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780893 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784894
785895 return cb;
786896 }
787897
788
- cButton AddButton(ObjEditor oe, String label)
898
+ cButton AddButton(cGridBag panel, String label)
789899 {
790900 cButton cb;
791901
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);
902
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797903 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801904
802905 return cb;
803906 }
804907
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
908
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806909 {
807910 JComboBox combo;
808911
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;
912
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812913 combo.addActionListener(this);
813914
814915 return combo;
815916 }
816917
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
918
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818919 {
819
- NumberSlider combo;
920
+ cGridBag control = new cGridBag();
921
+
922
+ cNumberSlider combo;
820923
821924 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824925 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
-
926
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
927
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834928 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
929
+
930
+ panel.add(control);
931
+
932
+ return control;
841933 }
842934
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
935
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
844936 {
845
- NumberSlider combo;
937
+ cGridBag control = new cGridBag();
938
+
939
+ cNumberSlider combo;
846940
847941 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
850942 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
-
943
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
944
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
860945 combo.setInteger(current);
861946
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
947
+ panel.add(control);
948
+
949
+ return control;
867950 }
868951
869
- JTextArea AddText(JPanel ctrlPanel, String name)
952
+ JTextArea AddText(cGridBag ctrlPanel, String name)
870953 {
871954 JTextArea text;
872955
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
956
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
876957 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
879958
880959 return text;
881960 }
....@@ -905,9 +984,16 @@
905984 objEditor.ctrlPanel.remove(j);
906985 }
907986
987
+ void Remove(cNumberSlider j)
988
+ {
989
+ j.removeChangeListener(this);
990
+ //objEditor.ctrlPanel.remove(j.label);
991
+ objEditor.ctrlPanel.remove(j);
992
+ }
993
+
908994 /*
909995 */
910
- void Return() // ObjEditor oe)
996
+ void Return0() // ObjEditor oe)
911997 {
912998 aConstraints.gridy += 1;
913999 aConstraints.gridx = 0;
....@@ -962,37 +1048,76 @@
9621048
9631049 void SetupUI2(ObjEditor oe)
9641050 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
1051
+ //SetupName(oe);
1052
+
1053
+ namePanel = new cGridBag();
1054
+
1055
+ nameField = AddText(namePanel, copy.GetName());
1056
+ namePanel.add(nameField);
1057
+ oe.ctrlPanel.add(namePanel);
1058
+
1059
+ oe.ctrlPanel.Return();
9701060
9711061 if (!GroupEditor.allparams)
9721062 return;
9731063
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1064
+ setupPanel = new cGridBag().setVertical(false);
1065
+
1066
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1067
+ liveCB.setToolTipText("Animate object");
1068
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1069
+ selectCB.setToolTipText("Make object selectable");
9771070 // 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");
1071
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1072
+ hideCB.setToolTipText("Hide object");
1073
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1074
+ markCB.setToolTipText("Set the animation target transform");
1075
+
1076
+ setupPanel2 = new cGridBag().setVertical(false);
1077
+
1078
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1079
+ rewindCB.setToolTipText("Rewind animation");
1080
+
1081
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1082
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1083
+
1084
+ if (Globals.ADVANCED)
1085
+ {
1086
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1087
+ link2masterCB.setToolTipText("Attach to support");
1088
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1089
+ speedupCB.setToolTipText("Option motion capture");
1090
+ }
1091
+
1092
+ oe.ctrlPanel.add(setupPanel);
1093
+ oe.ctrlPanel.Return();
1094
+ oe.ctrlPanel.add(setupPanel2);
1095
+ oe.ctrlPanel.Return();
1096
+
1097
+ objectCommandsPanel = new cGridBag().setVertical(false);
1098
+
1099
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1100
+ resetButton.setToolTipText("Jump to frame zero");
1101
+ stepButton = AddButton(objectCommandsPanel, "Step");
1102
+ stepButton.setToolTipText("Step one frame");
9841103 // resetAllButton = AddButton(oe, "Reset All");
9851104 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9871105 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
1106
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1107
+ slowerButton.setToolTipText("Decrease animation speed");
1108
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1109
+ fasterButton.setToolTipText("Increase animation speed");
1110
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1111
+ remarkButton.setToolTipText("Set the current transform as the target");
9911112
992
- Return();
1113
+ oe.ctrlPanel.add(objectCommandsPanel);
1114
+ oe.ctrlPanel.Return();
9931115
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
1116
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1117
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1118
+ //Return();
1119
+
1120
+ oe.ctrlPanel.Return();
9961121
9971122 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9981123 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1212,7 @@
10871212 oe.aConstraints.gridwidth = 1;
10881213 /**/
10891214 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1215
+ oe.ctrlPanel.Return();
10911216
10921217 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931218 //textureButton.setEnabled(false);
....@@ -1189,9 +1314,13 @@
11891314 //JPanel worldPanel =
11901315 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11911316 //worldPanel.setName("World");
1192
- centralPanel = new JPanel(new BorderLayout());
1193
- timelinePanel = new JPanel(new BorderLayout());
1194
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1317
+ centralPanel = new cGridBag();
1318
+ centralPanel.preferredWidth = 20;
1319
+
1320
+ if (Globals.ADVANCED)
1321
+ {
1322
+ timelinePanel = new JPanel(new BorderLayout());
1323
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11951324
11961325 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11971326 cameraPanel.setContinuousLayout(true);
....@@ -1200,7 +1329,10 @@
12001329 // cameraPanel.setDividerSize(9);
12011330 cameraPanel.setResizeWeight(1.0);
12021331
1332
+ }
1333
+
12031334 centralPanel.add(cameraView);
1335
+ centralPanel.setFocusable(true);
12041336 //frame.setJMenuBar(timelineMenubar);
12051337 //centralPanel.add(timelinePanel);
12061338
....@@ -1222,6 +1354,7 @@
12221354 XYZPanel = new cGridBag().setVertical(true);
12231355 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12241356
1357
+ XYZPanel.preferredWidth = 5;
12251358 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12261359 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12271360 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
....@@ -1262,10 +1395,11 @@
12621395 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12631396 //tmp.setName("Edit");
12641397 objectPanel.add(materialPanel);
1265
- JPanel north = new JPanel(new BorderLayout());
1266
- north.setName("Edit");
1267
- north.add(ctrlPanel, BorderLayout.NORTH);
1268
- objectPanel.add(north);
1398
+// JPanel north = new JPanel(new BorderLayout());
1399
+// north.setName("Edit");
1400
+// north.add(ctrlPanel, BorderLayout.NORTH);
1401
+// objectPanel.add(north);
1402
+ objectPanel.add(editPanel);
12691403 objectPanel.add(infoPanel);
12701404
12711405 /*
....@@ -1286,19 +1420,23 @@
12861420 scrollpane.setWheelScrollingEnabled(true);
12871421 scrollpane.addMouseWheelListener(this); // Default not fast enough
12881422
1289
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1290
- scenePanel.add(scrollpane);
1423
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1424
+ scenePanel.preferredWidth = 6;
1425
+
1426
+ JTabbedPane tabbedPane = new JTabbedPane();
1427
+ tabbedPane.add(scrollpane);
12911428
1292
- scenePanel.add(FSPane = new cFileSystemPane(this));
1429
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12931430
1294
- optionsPanel = new JPanel(new GridBagLayout());
1431
+ optionsPanel = new cGridBag().setVertical(true);
12951432
12961433 optionsPanel.setName("Options");
12971434
1298
- AddOptions(optionsPanel, aConstraints);
1435
+ AddOptions(optionsPanel); //, aConstraints);
12991436
1300
- scenePanel.add(optionsPanel);
1301
-
1437
+ tabbedPane.add(optionsPanel);
1438
+
1439
+ scenePanel.add(tabbedPane);
13021440
13031441 /*
13041442 cTree jTree = new cTree(null);
....@@ -1389,9 +1527,11 @@
13891527
13901528 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911529
1392
- frame.setSize(1024, 768);
1393
- frame.show();
1530
+ frame.setSize(1280, 860);
1531
+ frame.setVisible(true);
13941532
1533
+ cameraView.requestFocusInWindow();
1534
+
13951535 gridPanel.setDividerLocation(1.0);
13961536
13971537 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1405,7 +1545,7 @@
14051545 });
14061546 }
14071547
1408
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1548
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14091549 {
14101550 }
14111551
....@@ -1420,260 +1560,173 @@
14201560 ctrlPanel.removeAll();
14211561 }
14221562
1423
- void SetupMaterial(JPanel ctrlPanel)
1563
+ void SetupMaterial(cGridBag panel)
14241564 {
1425
- aConstraints.weighty = 0;
1426
- //aConstraints.weightx = 1;
1427
- /*
1565
+ /*
14281566 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14291567 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1430
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1431
- aConstraints.gridx += 1;
14321568 */
14331569
1434
- aConstraints.gridwidth = 1;
1435
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1436
- aConstraints.gridx += 1;
1437
- aConstraints.weighty = 0;
1438
- aConstraints.gridwidth = 1;
1570
+ cGridBag editBar = new cGridBag().setVertical(false);
1571
+
1572
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1573
+ createMaterialButton.setToolTipText("Create material");
14391574
14401575 /*
14411576 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
14451577 */
14461578
1447
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1448
- aConstraints.gridx += 1;
1579
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1580
+ clearMaterialButton.setToolTipText("Clear material");
1581
+
1582
+ if (Globals.ADVANCED)
1583
+ {
1584
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1585
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1586
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1587
+ }
14491588
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;
1589
+ editBar.preferredHeight = 15;
1590
+
1591
+ panel.add(editBar);
1592
+
14641593 /**/
14651594 //aConstraints.weighty = 0;
14661595 ////aConstraints.weightx = 1;
14671596 //aConstraints.weighty = 1;
14681597 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14691598 //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;
1599
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14751600
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;
1601
+ cGridBag colorSection = new cGridBag().setVertical(true);
1602
+
1603
+ cGridBag color = new cGridBag();
1604
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1605
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1607
+ //colorField.preferredWidth = 200;
1608
+ colorSection.add(color);
14861609
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;
1610
+ cGridBag modulation = new cGridBag();
1611
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1612
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1613
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1614
+ colorSection.add(modulation);
14961615
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;
1616
+ cGridBag texture = new cGridBag();
1617
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1618
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1619
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1620
+ colorSection.add(texture);
15061621
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;
1622
+ cGridBag anisoU = new cGridBag();
1623
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1624
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1625
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1626
+ colorSection.add(anisoU);
15161627
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;
1628
+ cGridBag anisoV = new cGridBag();
1629
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1630
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1632
+ colorSection.add(anisoV);
15261633
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;
1634
+ cGridBag shadowbias = new cGridBag();
1635
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1636
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1637
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1638
+ colorSection.add(shadowbias);
15361639
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;
1640
+ panel.add(new JSeparator());
1641
+
1642
+ panel.add(colorSection);
1643
+
1644
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1645
+
1646
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1647
+
1648
+ cGridBag diffuse = new cGridBag();
1649
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1650
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1652
+ diffuseSection.add(diffuse);
15451653
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;
1654
+ cGridBag diffuseness = new cGridBag();
1655
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1656
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1657
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1658
+ diffuseSection.add(diffuseness);
15551659
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;
1660
+ cGridBag selfshadow = new cGridBag();
1661
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1662
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1663
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1664
+ diffuseSection.add(selfshadow);
15651665
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;
1666
+ cGridBag sheen = new cGridBag();
1667
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1668
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1669
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1670
+ diffuseSection.add(sheen);
15751671
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;
1672
+ cGridBag subsurface = new cGridBag();
1673
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1674
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1675
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1676
+ diffuseSection.add(subsurface);
15851677
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;
1678
+ cGridBag shadow = new cGridBag();
1679
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1680
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1681
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1682
+ diffuseSection.add(shadow);
15951683
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;
1684
+ cGridBag fakedepth = new cGridBag();
1685
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1686
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1687
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1688
+ diffuseSection.add(fakedepth);
16051689
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;
1690
+ panel.add(new JSeparator());
1691
+
1692
+ panel.add(diffuseSection);
1693
+
1694
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1695
+
1696
+ cGridBag specularSection = new cGridBag().setVertical(true);
16151697
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;
1698
+ cGridBag specular = new cGridBag();
1699
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1700
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1701
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1702
+ specularSection.add(specular);
16241703
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;
1704
+ cGridBag lightarea = new cGridBag();
1705
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1706
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1707
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1708
+ specularSection.add(lightarea);
16341709
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;
1710
+ cGridBag shininess = new cGridBag();
1711
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1712
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1713
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1714
+ specularSection.add(shininess);
16441715
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;
1716
+ cGridBag metalness = new cGridBag();
1717
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1718
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1719
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1720
+ specularSection.add(metalness);
16541721
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;
1722
+ cGridBag velvet = new cGridBag();
1723
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1724
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1725
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1726
+ specularSection.add(velvet);
16641727
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();
1728
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1729
+ //Return();
16771730 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16781731 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16791732 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1684,130 +1737,93 @@
16841737 // aConstraints.gridy += 1;
16851738 // aConstraints.gridwidth = 1;
16861739
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;
16951740
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;
1741
+ panel.add(new JSeparator());
1742
+
1743
+ panel.add(specularSection);
1744
+
1745
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1746
+
1747
+ cGridBag globalSection = new cGridBag().setVertical(true);
17051748
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;
1749
+ cGridBag camera = new cGridBag();
1750
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1751
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1752
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1753
+ globalSection.add(camera);
17151754
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;
1755
+ cGridBag ambient = new cGridBag();
1756
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1757
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1758
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1759
+ globalSection.add(ambient);
17251760
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;
1761
+ cGridBag backlit = new cGridBag();
1762
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1763
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1764
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1765
+ globalSection.add(backlit);
17361766
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;
1767
+ cGridBag opacity = new cGridBag();
1768
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1769
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1771
+ globalSection.add(opacity);
17461772
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;
1773
+ panel.add(new JSeparator());
1774
+
1775
+ panel.add(globalSection);
1776
+
1777
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1778
+
1779
+ cGridBag textureSection = new cGridBag().setVertical(true);
17561780
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;
1781
+ cGridBag bump = new cGridBag();
1782
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1783
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1784
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1785
+ textureSection.add(bump);
17661786
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;
1787
+ cGridBag noise = new cGridBag();
1788
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1789
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1790
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1791
+ textureSection.add(noise);
17761792
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;
1793
+ cGridBag power = new cGridBag();
1794
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1795
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1796
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1797
+ textureSection.add(power);
17861798
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;
1799
+ cGridBag borderfade = new cGridBag();
1800
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1801
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1802
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1803
+ textureSection.add(borderfade);
17961804
1797
- //aConstraints.weighty = 1;
1798
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1799
- //aConstraints.gridx += 1;
1800
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1801
- aConstraints.weighty = 0;
1805
+ cGridBag fog = new cGridBag();
1806
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1807
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1808
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1809
+ textureSection.add(fog);
18021810
1803
- aConstraints.gridx = 0;
1804
- aConstraints.gridy = 0;
1805
- aConstraints.gridwidth = 1;
1811
+ cGridBag opacityPower = new cGridBag();
1812
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1813
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1814
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1815
+ textureSection.add(opacityPower);
1816
+
1817
+ panel.add(new JSeparator());
1818
+
1819
+ panel.add(textureSection);
1820
+
1821
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18061822
18071823 SetMaterial(copy); // .GetMaterial());
18081824
1809
- colorField.addChangeListener(this);
1810
- modulationField.addChangeListener(this);
1825
+ //colorField.addChangeListener(this);
1826
+// modulationField.addChangeListener(this);
18111827 metalnessField.addChangeListener(this);
18121828 diffuseField.addChangeListener(this);
18131829 specularField.addChangeListener(this);
....@@ -1837,12 +1853,15 @@
18371853 opacityPowerField.addChangeListener(this);
18381854 /**/
18391855
1840
- resetSlidersButton.addActionListener(this);
18411856 clearMaterialButton.addActionListener(this);
18421857 createMaterialButton.addActionListener(this);
1843
-
1844
- propagateToggle.addItemListener(this);
1845
- multiplyToggle.addItemListener(this);
1858
+
1859
+ if (Globals.ADVANCED)
1860
+ {
1861
+ resetSlidersButton.addActionListener(this);
1862
+ propagateToggle.addItemListener(this);
1863
+ multiplyToggle.addItemListener(this);
1864
+ }
18461865 }
18471866
18481867 void DropFile(java.io.File[] files, boolean textures)
....@@ -2013,7 +2032,7 @@
20132032
20142033 //? flashIt = false;
20152034 CameraPane pane = (CameraPane) cameraView;
2016
- pane.clickStart(location.x, location.y, 0);
2035
+ pane.clickStart(location.x, location.y, 0, 0);
20172036 pane.clickEnd(location.x, location.y, 0, true);
20182037
20192038 if (group.selection.size() == 1)
....@@ -2062,6 +2081,7 @@
20622081 e2.printStackTrace();
20632082 }
20642083 }
2084
+
20652085 LoadJMEThread loadThread;
20662086
20672087 class LoadJMEThread extends Thread
....@@ -2119,6 +2139,7 @@
21192139 //LoadFile0(filename, converter);
21202140 }
21212141 }
2142
+
21222143 LoadOBJThread loadObjThread;
21232144
21242145 class LoadOBJThread extends Thread
....@@ -2197,19 +2218,19 @@
21972218
21982219 void LoadObjFile(String fullname)
21992220 {
2200
- /*
2221
+ System.out.println("Loading " + fullname);
2222
+ /**/
22012223 //lastFilename = fullname;
22022224 if(loadObjThread == null)
22032225 {
2204
- loadObjThread = new LoadOBJThread();
2205
- loadObjThread.start();
2226
+ loadObjThread = new LoadOBJThread();
2227
+ loadObjThread.start();
22062228 }
22072229
22082230 loadObjThread.add(fullname);
2209
- */
2231
+ /**/
22102232
2211
- System.out.println("Loading " + fullname);
2212
- makeSomething(new FileObject(fullname, true), true);
2233
+ //makeSomething(new FileObject(fullname, true), true);
22132234 }
22142235
22152236 void LoadGFDFile(String fullname)
....@@ -2470,11 +2491,11 @@
24702491
24712492 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24722493 {
2473
- if (GrafreeD.standAlone)
2494
+ if (Grafreed.standAlone)
24742495 {
24752496 /**/
24762497 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2477
- browser.show();
2498
+ browser.setVisible(true);
24782499 String filename = browser.getFile();
24792500 if (filename != null && filename.length() > 0)
24802501 {
....@@ -2619,6 +2640,7 @@
26192640 }
26202641 if (input == null)
26212642 {
2643
+ new Exception().printStackTrace();
26222644 System.exit(0);
26232645 }
26242646
....@@ -2833,7 +2855,8 @@
28332855 return;
28342856 }
28352857
2836
- multiplyToggle.setSelected(mat.multiply);
2858
+ if (multiplyToggle != null)
2859
+ multiplyToggle.setSelected(mat.multiply);
28372860
28382861 assert (object.projectedVertices != null);
28392862
....@@ -3048,9 +3071,9 @@
30483071 frame.validate();
30493072
30503073 return;
3051
- } else if (event.getSource() == toggleRandomItem)
3074
+ } else if (event.getSource() == toggleSwitchItem)
30523075 {
3053
- cameraView.ToggleRandom();
3076
+ cameraView.ToggleSwitch();
30543077 cameraView.repaint();
30553078 return;
30563079 } else if (event.getSource() == toggleHandleItem)
....@@ -3079,6 +3102,10 @@
30793102 {
30803103 copy.live ^= true;
30813104 return;
3105
+ } else if (event.getSource() == selectCB)
3106
+ {
3107
+ copy.dontselect ^= true;
3108
+ return;
30823109 } else if (event.getSource() == hideCB)
30833110 {
30843111 copy.hide ^= true;
....@@ -3093,6 +3120,7 @@
30933120 if (event.getSource() == randomCB)
30943121 {
30953122 copy.random ^= true;
3123
+ objEditor.refreshContents();
30963124 return;
30973125 }
30983126 if (event.getSource() == speedupCB)
....@@ -3116,8 +3144,9 @@
31163144
31173145 public void actionPerformed(ActionEvent event)
31183146 {
3147
+ Object source = event.getSource();
31193148 // SCRIPT DIALOG
3120
- if (event.getSource() == okbutton)
3149
+ if (source == okbutton)
31213150 {
31223151 textpanel.setVisible(false);
31233152 textpanel.remove(textarea);
....@@ -3129,7 +3158,7 @@
31293158 textarea = null;
31303159 textpanel = null;
31313160 }
3132
- if (event.getSource() == cancelbutton)
3161
+ if (source == cancelbutton)
31333162 {
31343163 textpanel.setVisible(false);
31353164 textpanel.remove(textarea);
....@@ -3141,50 +3170,50 @@
31413170 //applySelf();
31423171 //client.refreshEditWindow();
31433172 //refreshContents();
3144
- if (event.getSource() == nameField)
3173
+ if (source == nameField)
31453174 {
31463175 //System.out.println("ObjEditor " + event);
31473176 applySelf0(true);
31483177 //parent.applySelf();
31493178 objEditor.refreshContents();
3150
- } else if (event.getSource() == resetButton)
3179
+ } else if (source == resetButton)
31513180 {
31523181 CameraPane.fullreset = true;
31533182 copy.Reset(); // ResetMeshes();
31543183 copy.Touch();
31553184 objEditor.refreshContents();
3156
- } else if (event.getSource() == stepItem)
3185
+ } else if (source == stepItem)
31573186 {
31583187 //cameraView.ONESTEP = true;
31593188 Globals.ONESTEP = true;
31603189 cameraView.repaint();
31613190 return;
3162
- } else if (event.getSource() == stepButton)
3191
+ } else if (source == stepButton)
31633192 {
31643193 copy.Step();
31653194 copy.Touch();
31663195 objEditor.refreshContents();
3167
- } else if (event.getSource() == slowerButton)
3196
+ } else if (source == slowerButton)
31683197 {
31693198 copy.Slower();
31703199 copy.Touch();
31713200 objEditor.refreshContents();
3172
- } else if (event.getSource() == fasterButton)
3201
+ } else if (source == fasterButton)
31733202 {
31743203 copy.Faster();
31753204 copy.Touch();
31763205 objEditor.refreshContents();
3177
- } else if (event.getSource() == remarkButton)
3206
+ } else if (source == remarkButton)
31783207 {
31793208 copy.Remark();
31803209 copy.Touch();
31813210 objEditor.refreshContents();
3182
- } else if (event.getSource() == stepAllButton)
3211
+ } else if (source == stepAllButton)
31833212 {
31843213 copy.StepAll();
31853214 copy.Touch();
31863215 objEditor.refreshContents();
3187
- } else if (event.getSource() == resetAllButton)
3216
+ } else if (source == resetAllButton)
31883217 {
31893218 //CameraPane.fullreset = true;
31903219 copy.ResetAll(); // ResetMeshes();
....@@ -3217,53 +3246,75 @@
32173246 // Close();
32183247 // }
32193248 // else
3220
- if (event.getSource() == resetSlidersButton)
3249
+ if (source == resetSlidersButton)
32213250 {
32223251 ResetSliders();
3223
- } else if (event.getSource() == clearMaterialButton)
3252
+ } else if (source == clearMaterialButton)
32243253 {
32253254 ClearMaterial();
3226
- } else if (event.getSource() == createMaterialButton)
3255
+ } else if (source == createMaterialButton)
32273256 {
32283257 CreateMaterial();
3229
- } else if (event.getSource() == clearPanelButton)
3258
+ } else if (source == clearPanelButton)
32303259 {
32313260 copy.ClearUI();
32323261 refreshContents(true);
3233
- } /*
3234
- }
3235
-
3236
- public boolean action(Event event, Object arg)
3237
- {
3238
- */ else if (event.getSource() == closeItem)
3262
+ } else if (source == importGFDItem)
3263
+ {
3264
+ ImportGFD();
3265
+ } else
3266
+ if (source == importVRMLX3DItem)
3267
+ {
3268
+ ImportVRMLX3D();
3269
+ } else
3270
+ if (source == import3DSItem)
3271
+ {
3272
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3273
+ } else
3274
+ if (source == importOBJItem)
3275
+ {
3276
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3277
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3278
+ browser.setVisible(true);
3279
+ String filename = browser.getFile();
3280
+ if (filename != null && filename.length() > 0)
3281
+ {
3282
+ String fullname = browser.getDirectory() + filename;
3283
+ makeSomething(ReadOBJ(fullname), true);
3284
+ }
3285
+ } else
3286
+ if (source == closeItem)
32393287 {
32403288 Close();
32413289 //return true;
3242
- } else if (event.getSource() == loadItem)
3290
+ } else if (source == loadItem)
32433291 {
32443292 load();
32453293 //return true;
3246
- } else if (event.getSource() == saveItem)
3294
+ } else if (source == newItem)
3295
+ {
3296
+ New();
3297
+ } else if (source == saveItem)
32473298 {
32483299 save();
32493300 //return true;
3250
- } else if (event.getSource() == saveAsItem)
3301
+ } else if (source == saveAsItem)
32513302 {
32523303 saveAs();
32533304 //return true;
3254
- } else if (event.getSource() == reexportItem)
3305
+ } else if (source == reexportItem)
32553306 {
32563307 reexport();
32573308 //return true;
3258
- } else if (event.getSource() == exportAsItem)
3309
+ } else if (source == exportAsItem)
32593310 {
32603311 export();
32613312 //return true;
3262
- } else if (event.getSource() == povItem)
3313
+ } else if (source == povItem)
32633314 {
32643315 generatePOV();
32653316 //return true;
3266
- } else if (event.getSource() == zBufferItem)
3317
+ } else if (source == zBufferItem)
32673318 {
32683319 try
32693320 {
....@@ -3285,21 +3336,8 @@
32853336 cameraView.repaint();
32863337 //return true;
32873338 }
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)
3339
+ */ else // combos...
3340
+ if (source == texresMenu)
33033341 {
33043342 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33053343 copy.texres = texresMenu.getSelectedIndex();
....@@ -3311,12 +3349,272 @@
33113349 }
33123350 }
33133351
3352
+ void New()
3353
+ {
3354
+ while (copy.Size() > 1)
3355
+ {
3356
+ copy.remove(1);
3357
+ }
3358
+
3359
+ ResetModel();
3360
+ objEditor.refreshContents();
3361
+ }
3362
+
3363
+ static public byte[] Compress(Object3D o)
3364
+ {
3365
+ try
3366
+ {
3367
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3369
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3370
+
3371
+ Object3D parent = o.parent;
3372
+ o.parent = null;
3373
+
3374
+ out.writeObject(o);
3375
+
3376
+ o.parent = parent;
3377
+
3378
+ out.flush();
3379
+
3380
+ zstream.close();
3381
+ out.close();
3382
+
3383
+ return baos.toByteArray();
3384
+ } catch (Exception e)
3385
+ {
3386
+ System.err.println(e);
3387
+ return null;
3388
+ }
3389
+ }
3390
+
3391
+ static public Object Uncompress(byte[] bytes)
3392
+ {
3393
+ System.out.println("#bytes = " + bytes.length);
3394
+ try
3395
+ {
3396
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3397
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3398
+ ObjectInputStream in = new ObjectInputStream(istream);
3399
+ Object obj = in.readObject();
3400
+ in.close();
3401
+
3402
+ return obj;
3403
+ } catch (Exception e)
3404
+ {
3405
+ System.err.println(e);
3406
+ return null;
3407
+ }
3408
+ }
3409
+
3410
+ static public Object clone(Object o)
3411
+ {
3412
+ try
3413
+ {
3414
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3415
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3416
+
3417
+ out.writeObject(o);
3418
+
3419
+ out.flush();
3420
+ out.close();
3421
+
3422
+ byte[] bytes = baos.toByteArray();
3423
+
3424
+ System.out.println("clone = " + bytes.length);
3425
+
3426
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3427
+ ObjectInputStream in = new ObjectInputStream(bais);
3428
+ Object obj = in.readObject();
3429
+ in.close();
3430
+
3431
+ return obj;
3432
+ } catch (Exception e)
3433
+ {
3434
+ System.err.println(e);
3435
+ return null;
3436
+ }
3437
+ }
3438
+
3439
+ cRadio GetCurrentTab()
3440
+ {
3441
+ cRadio ab;
3442
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3443
+ {
3444
+ ab = (cRadio)e.nextElement();
3445
+ if(ab.GetObject() == copy)
3446
+ {
3447
+ return ab;
3448
+ }
3449
+ }
3450
+
3451
+ return null;
3452
+ }
3453
+
3454
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3455
+
3456
+ public void Save()
3457
+ {
3458
+ System.err.println("Save");
3459
+
3460
+ cRadio tab = GetCurrentTab();
3461
+
3462
+ boolean temp = CameraPane.SWITCH;
3463
+ CameraPane.SWITCH = false;
3464
+
3465
+ copy.ExtractBigData(hashtable);
3466
+
3467
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3468
+ tab.graphs[tab.undoindex++] = Compress(copy);
3469
+
3470
+ copy.RestoreBigData(hashtable);
3471
+
3472
+ CameraPane.SWITCH = temp;
3473
+
3474
+ //assert(hashtable.isEmpty());
3475
+
3476
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3477
+ {
3478
+ tab.graphs[i] = null;
3479
+ }
3480
+
3481
+ // test save
3482
+ if (false)
3483
+ {
3484
+ try
3485
+ {
3486
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3487
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3488
+
3489
+ p.writeObject(copy);
3490
+
3491
+ p.flush();
3492
+
3493
+ ostream.close();
3494
+ } catch (Exception e)
3495
+ {
3496
+ e.printStackTrace();
3497
+ }
3498
+ }
3499
+ }
3500
+
3501
+ void CopyChanged(Object3D obj)
3502
+ {
3503
+ boolean temp = CameraPane.SWITCH;
3504
+ CameraPane.SWITCH = false;
3505
+
3506
+ copy.ExtractBigData(hashtable);
3507
+
3508
+ copy.clear();
3509
+
3510
+ for (int i=0; i<obj.Size(); i++)
3511
+ {
3512
+ copy.add(obj.get(i));
3513
+ }
3514
+
3515
+ copy.RestoreBigData(hashtable);
3516
+
3517
+ CameraPane.SWITCH = temp;
3518
+
3519
+ //assert(hashtable.isEmpty());
3520
+
3521
+ copy.Touch();
3522
+
3523
+ ResetModel();
3524
+ copy.HardTouch(); // recompile?
3525
+
3526
+ cRadio ab;
3527
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3528
+ {
3529
+ ab = (cRadio)e.nextElement();
3530
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3531
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3532
+ if (test != null)
3533
+ {
3534
+ test.editWindow = ab.object.editWindow;
3535
+ ab.object = test;
3536
+ }
3537
+ }
3538
+
3539
+ refreshContents();
3540
+ }
3541
+
3542
+ public void Undo()
3543
+ {
3544
+ System.err.println("Undo");
3545
+
3546
+ cRadio tab = GetCurrentTab();
3547
+
3548
+ if (tab.undoindex == 0)
3549
+ {
3550
+ java.awt.Toolkit.getDefaultToolkit().beep();
3551
+ return;
3552
+ }
3553
+
3554
+ if (tab.graphs[tab.undoindex] == null)
3555
+ {
3556
+ Save();
3557
+ tab.undoindex -= 1;
3558
+ }
3559
+
3560
+ tab.undoindex -= 1;
3561
+
3562
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3563
+ }
3564
+
3565
+ public void Redo()
3566
+ {
3567
+ cRadio tab = GetCurrentTab();
3568
+
3569
+ if (tab.graphs[tab.undoindex + 1] == null)
3570
+ {
3571
+ java.awt.Toolkit.getDefaultToolkit().beep();
3572
+ return;
3573
+ }
3574
+
3575
+ tab.undoindex += 1;
3576
+
3577
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3578
+ }
3579
+
3580
+ void ImportGFD()
3581
+ {
3582
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3583
+ browser.show();
3584
+ String filename = browser.getFile();
3585
+ if (filename != null && filename.length() > 0)
3586
+ {
3587
+ String fullname = browser.getDirectory() + filename;
3588
+
3589
+ //Object3D readobj =
3590
+ objEditor.ReadGFD(fullname, objEditor);
3591
+ //makeSomething(readobj);
3592
+ }
3593
+ }
3594
+
3595
+ void ImportVRMLX3D()
3596
+ {
3597
+ if (Grafreed.standAlone)
3598
+ {
3599
+ /**/
3600
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3601
+ browser.show();
3602
+ String filename = browser.getFile();
3603
+ if (filename != null && filename.length() > 0)
3604
+ {
3605
+ String fullname = browser.getDirectory() + filename;
3606
+ LoadVRMLX3D(fullname);
3607
+ }
3608
+ /**/
3609
+ }
3610
+ }
3611
+
33143612 void ToggleAnimation()
33153613 {
33163614 if (!Globals.ANIMATION)
33173615 {
33183616 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3319
- browser.show();
3617
+ browser.setVisible(true);
33203618 String filename = browser.getFile();
33213619 if (filename != null && filename.length() > 0)
33223620 {
....@@ -3326,8 +3624,8 @@
33263624
33273625 Globals.ANIMATION ^= true;
33283626
3329
- GrafreeD.wav.cursor = 0;
3330
- GrafreeD.wav.loop = 0;
3627
+ Grafreed.wav.cursor = 0;
3628
+ Grafreed.wav.loop = 0;
33313629 }
33323630 } else
33333631 {
....@@ -3377,7 +3675,7 @@
33773675 void CreateMaterial()
33783676 {
33793677 //copy.ClearMaterial(); // PATCH
3380
- copy.CreateMaterialS(multiplyToggle.isSelected());
3678
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33813679 if (copy.selection.size() > 0)
33823680 //SetMaterial(copy);
33833681 {
....@@ -3436,11 +3734,11 @@
34363734 {
34373735 copy.ResetBlockLoop(); // temporary problem
34383736
3439
- boolean random = CameraPane.RANDOM;
3440
- CameraPane.RANDOM = false; // parse everything
3737
+ boolean random = CameraPane.SWITCH;
3738
+ CameraPane.SWITCH = false; // parse everything
34413739 copy.ResetDisplayList();
34423740 copy.HardTouch();
3443
- CameraPane.RANDOM = random;
3741
+ CameraPane.SWITCH = random;
34443742 }
34453743
34463744 // public void applySelf()
....@@ -3510,10 +3808,40 @@
35103808 current.fakedepth = (float) fakedepthField.getFloat();
35113809 current.shadowbias = (float) shadowbiasField.getFloat();
35123810
3513
- if (!NumberSlider.frozen)
3811
+ if (!cNumberSlider.frozen)
35143812 {
35153813 //System.out.println("Propagate = " + propagate);
35163814 copy.UpdateMaterial(anchor, current, propagate);
3815
+
3816
+ if (copy.material != null)
3817
+ {
3818
+ cMaterial mat = copy.material;
3819
+
3820
+ colorField.SetToolTipValue((mat.color));
3821
+ modulationField.SetToolTipValue((mat.modulation));
3822
+ metalnessField.SetToolTipValue((mat.metalness));
3823
+ diffuseField.SetToolTipValue((mat.diffuse));
3824
+ specularField.SetToolTipValue((mat.specular));
3825
+ shininessField.SetToolTipValue((mat.shininess));
3826
+ shiftField.SetToolTipValue((mat.shift));
3827
+ ambientField.SetToolTipValue((mat.ambient));
3828
+ lightareaField.SetToolTipValue((mat.lightarea));
3829
+ diffusenessField.SetToolTipValue((mat.factor));
3830
+ velvetField.SetToolTipValue((mat.velvet));
3831
+ sheenField.SetToolTipValue((mat.sheen));
3832
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3833
+ backlitField.SetToolTipValue((mat.bump));
3834
+ anisoField.SetToolTipValue((mat.aniso));
3835
+ anisoVField.SetToolTipValue((mat.anisoV));
3836
+ cameraField.SetToolTipValue((mat.cameralight));
3837
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3838
+ shadowField.SetToolTipValue((mat.shadow));
3839
+ textureField.SetToolTipValue((mat.texture));
3840
+ opacityField.SetToolTipValue((mat.opacity));
3841
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3842
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3843
+ }
3844
+
35173845 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35183846 {
35193847 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3558,6 +3886,7 @@
35583886 || e.getSource() == apertureField
35593887 || e.getSource() == shadowblurField)
35603888 {
3889
+ new Exception().printStackTrace();
35613890 System.exit(0);
35623891 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35633892 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3628,7 +3957,7 @@
36283957 }
36293958
36303959 if (normalpushField != null)
3631
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3960
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36323961 }
36333962
36343963 void SnapObject()
....@@ -3883,7 +4212,7 @@
38834212
38844213 radioPanel.revalidate();
38854214 radioPanel.repaint();
3886
- ctrlPanel.revalidate(); // ? new
4215
+ ctrlPanel.validate(); // ? new
38874216 ctrlPanel.repaint();
38884217 }
38894218 }
....@@ -3892,6 +4221,8 @@
38924221
38934222 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38944223 {
4224
+ if (Globals.SAVEONMAKE)
4225
+ Save();
38954226 //Tween.set(thing, 0).target(1).start(tweenManager);
38964227 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38974228 // if (thing instanceof GenericJointDemo)
....@@ -4095,6 +4426,7 @@
40954426 }
40964427 }
40974428 }
4429
+
40984430 LoadGFDThread loadGFDThread;
40994431
41004432 void ReadGFD(String fullname, iCallBack cb)
....@@ -4114,8 +4446,10 @@
41144446
41154447 try
41164448 {
4449
+ // Try compressed version first.
41174450 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4118
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4451
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4452
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41194453
41204454 readobj = (Object3D) p.readObject();
41214455 istream.close();
....@@ -4123,7 +4457,20 @@
41234457 readobj.ResetDisplayList();
41244458 } catch (Exception e)
41254459 {
4126
- e.printStackTrace();
4460
+ //e.printStackTrace();
4461
+ try
4462
+ {
4463
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4464
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4465
+
4466
+ readobj = (Object3D) p.readObject();
4467
+ istream.close();
4468
+
4469
+ readobj.ResetDisplayList();
4470
+ } catch (Exception e2)
4471
+ {
4472
+ e2.printStackTrace();
4473
+ }
41274474 }
41284475 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41294476 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4169,6 +4516,12 @@
41694516
41704517 void LoadIt(Object obj)
41714518 {
4519
+ if (obj == null)
4520
+ {
4521
+ // Invalid file
4522
+ return;
4523
+ }
4524
+
41724525 System.out.println("Loaded " + obj);
41734526 //new Exception().printStackTrace();
41744527 Object3D readobj = (Object3D) obj;
....@@ -4178,6 +4531,8 @@
41784531
41794532 if (readobj != null)
41804533 {
4534
+ if (Globals.SAVEONMAKE)
4535
+ Save();
41814536 try
41824537 {
41834538 //readobj.deepCopySelf(copy);
....@@ -4240,7 +4595,7 @@
42404595
42414596 void load() // throws ClassNotFoundException
42424597 {
4243
- if (GrafreeD.standAlone)
4598
+ if (Grafreed.standAlone)
42444599 {
42454600 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42464601 browser.show();
....@@ -4327,11 +4682,13 @@
43274682 try
43284683 {
43294684 FileOutputStream ostream = new FileOutputStream(lastname);
4330
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4685
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4686
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43314687
43324688 p.writeObject(copy);
43334689 p.flush();
43344690
4691
+ zstream.close();
43354692 ostream.close();
43364693
43374694 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4341,11 +4698,12 @@
43414698 {
43424699 }
43434700 }
4701
+
43444702 String lastname;
43454703
43464704 void saveAs()
43474705 {
4348
- if (GrafreeD.standAlone)
4706
+ if (Grafreed.standAlone)
43494707 {
43504708 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43514709 browser.setVisible(true);
....@@ -4450,13 +4808,13 @@
44504808 try
44514809 {
44524810 FileOutputStream ostream = new FileOutputStream(filename);
4453
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4454
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4811
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4812
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44554813
44564814 Object3D objectparent = obj.parent;
44574815 obj.parent = null;
44584816
4459
- Object3D object = (Object3D) GrafreeD.clone(obj);
4817
+ Object3D object = (Object3D) Grafreed.clone(obj);
44604818
44614819 obj.parent = objectparent;
44624820
....@@ -4468,8 +4826,8 @@
44684826 p.writeObject(object);
44694827 p.flush();
44704828
4829
+ zstream.close();
44714830 ostream.close();
4472
- // zstream.close();
44734831
44744832 // group.selection.get(0).parent = parent;
44754833 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4490,7 +4848,7 @@
44904848 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44914849 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44924850 copy.generatePOV(buffer);
4493
- if (GrafreeD.standAlone)
4851
+ if (Grafreed.standAlone)
44944852 {
44954853 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44964854 browser.show();
....@@ -4516,7 +4874,8 @@
45164874 Object3D client;
45174875 Object3D copy;
45184876 MenuBar menuBar;
4519
- Menu windowMenu;
4877
+ Menu fileMenu;
4878
+ MenuItem newItem;
45204879 MenuItem loadItem;
45214880 MenuItem saveItem;
45224881 MenuItem saveAsItem;
....@@ -4524,13 +4883,11 @@
45244883 MenuItem reexportItem;
45254884 MenuItem povItem;
45264885 MenuItem closeItem;
4527
- Menu cameraMenu;
4886
+
45284887 CheckboxMenuItem zBufferItem;
45294888 //MenuItem normalLensItem;
4530
- MenuItem editCameraItem;
4531
- MenuItem revertCameraItem;
4532
- CheckboxMenuItem toggleLiveItem;
45334889 MenuItem stepItem;
4890
+ CheckboxMenuItem toggleLiveItem;
45344891 CheckboxMenuItem toggleFullScreenItem;
45354892 CheckboxMenuItem toggleTimelineItem;
45364893 CheckboxMenuItem toggleRenderItem;
....@@ -4539,7 +4896,7 @@
45394896 CheckboxMenuItem toggleFootContactItem;
45404897 CheckboxMenuItem toggleDLItem;
45414898 CheckboxMenuItem toggleTextureItem;
4542
- CheckboxMenuItem toggleRandomItem;
4899
+ CheckboxMenuItem toggleSwitchItem;
45434900 CheckboxMenuItem toggleRootItem;
45444901 CheckboxMenuItem animationItem;
45454902 CheckboxMenuItem toggleHandleItem;
....@@ -4547,20 +4904,20 @@
45474904 JSplitPane mainPanel;
45484905 JScrollPane scrollpane;
45494906 JPanel toolbarPanel;
4550
- JPanel treePanel;
4907
+ cGridBag treePanel;
45514908 JPanel radioPanel;
45524909 ButtonGroup buttonGroup;
4553
- JPanel ctrlPanel;
4554
- JPanel materialPanel;
4910
+ cGridBag ctrlPanel;
4911
+ cGridBag materialPanel;
45554912 JScrollPane infoPanel;
4556
- JPanel optionsPanel;
4913
+ cGridBag optionsPanel;
45574914 JTabbedPane objectPanel;
45584915 cGridBag XYZPanel;
45594916 JSplitPane gridPanel;
45604917 JSplitPane bigPanel;
45614918 cGridBag bigThree;
4562
- JTabbedPane scenePanel;
4563
- JPanel centralPanel;
4919
+ cGridBag scenePanel;
4920
+ cGridBag centralPanel;
45644921 JSplitPane cameraPanel;
45654922 JPanel timelinePanel;
45664923 JMenuBar timelineMenubar;
....@@ -4613,67 +4970,72 @@
46134970 // MATERIAL
46144971 JLabel materialLabel;
46154972 JLabel colorLabel;
4616
- NumberSlider colorField;
4973
+ cNumberSlider colorField;
46174974 JLabel modulationLabel;
4618
- NumberSlider modulationField;
4975
+ cNumberSlider modulationField;
46194976 JLabel metalnessLabel;
4620
- NumberSlider metalnessField;
4977
+ cNumberSlider metalnessField;
46214978 JLabel diffuseLabel;
4622
- NumberSlider diffuseField;
4979
+ cNumberSlider diffuseField;
46234980 JLabel specularLabel;
4624
- NumberSlider specularField;
4981
+ cNumberSlider specularField;
46254982 JLabel shininessLabel;
4626
- NumberSlider shininessField;
4983
+ cNumberSlider shininessField;
46274984 JLabel shiftLabel;
4628
- NumberSlider shiftField;
4985
+ cNumberSlider shiftField;
46294986 JLabel ambientLabel;
4630
- NumberSlider ambientField;
4987
+ cNumberSlider ambientField;
46314988 JLabel lightareaLabel;
4632
- NumberSlider lightareaField;
4989
+ cNumberSlider lightareaField;
46334990 JLabel diffusenessLabel;
4634
- NumberSlider diffusenessField;
4991
+ cNumberSlider diffusenessField;
46354992 JLabel velvetLabel;
4636
- NumberSlider velvetField;
4993
+ cNumberSlider velvetField;
46374994 JLabel sheenLabel;
4638
- NumberSlider sheenField;
4995
+ cNumberSlider sheenField;
46394996 JLabel subsurfaceLabel;
4640
- NumberSlider subsurfaceField;
4997
+ cNumberSlider subsurfaceField;
46414998 //JLabel bumpLabel;
46424999 //NumberSlider bumpField;
46435000 JLabel backlitLabel;
4644
- NumberSlider backlitField;
5001
+ cNumberSlider backlitField;
46455002 JLabel anisoLabel;
4646
- NumberSlider anisoField;
5003
+ cNumberSlider anisoField;
46475004 JLabel anisoVLabel;
4648
- NumberSlider anisoVField;
5005
+ cNumberSlider anisoVField;
46495006 JLabel cameraLabel;
4650
- NumberSlider cameraField;
5007
+ cNumberSlider cameraField;
46515008 JLabel selfshadowLabel;
4652
- NumberSlider selfshadowField;
5009
+ cNumberSlider selfshadowField;
46535010 JLabel shadowLabel;
4654
- NumberSlider shadowField;
5011
+ cNumberSlider shadowField;
46555012 JLabel textureLabel;
4656
- NumberSlider textureField;
5013
+ cNumberSlider textureField;
46575014 JLabel opacityLabel;
4658
- NumberSlider opacityField;
5015
+ cNumberSlider opacityField;
46595016 JLabel fakedepthLabel;
4660
- NumberSlider fakedepthField;
5017
+ cNumberSlider fakedepthField;
46615018 JLabel shadowbiasLabel;
4662
- NumberSlider shadowbiasField;
5019
+ cNumberSlider shadowbiasField;
46635020 JLabel bumpLabel;
4664
- NumberSlider bumpField;
5021
+ cNumberSlider bumpField;
46655022 JLabel noiseLabel;
4666
- NumberSlider noiseField;
5023
+ cNumberSlider noiseField;
46675024 JLabel powerLabel;
4668
- NumberSlider powerField;
5025
+ cNumberSlider powerField;
46695026 JLabel borderfadeLabel;
4670
- NumberSlider borderfadeField;
5027
+ cNumberSlider borderfadeField;
46715028 JLabel fogLabel;
4672
- NumberSlider fogField;
5029
+ cNumberSlider fogField;
46735030 JLabel opacityPowerLabel;
4674
- NumberSlider opacityPowerField;
5031
+ cNumberSlider opacityPowerField;
46755032 JTree jTree;
46765033 //ObjectUI parent;
46775034
4678
- NumberSlider normalpushField;
5035
+ cNumberSlider normalpushField;
5036
+
5037
+ private MenuItem importGFDItem;
5038
+ private MenuItem importVRMLX3DItem;
5039
+ private MenuItem import3DSItem;
5040
+ private MenuItem importOBJItem;
46795041 }