Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -35,6 +36,67 @@
3536
3637 GroupEditor callee;
3738 JFrame frame;
39
+
40
+ static ObjEditor theFrame;
41
+
42
+ cButton GetButton(String name, boolean border)
43
+ {
44
+ try
45
+ {
46
+ ImageIcon icon = GetIcon(name);
47
+ return new cButton(icon, border);
48
+ }
49
+ catch (Exception e)
50
+ {
51
+ return new cButton(name, border);
52
+ }
53
+ }
54
+
55
+ cToggleButton GetToggleButton(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cToggleButton(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cToggleButton(name, border);
65
+ }
66
+ }
67
+
68
+ cCheckBox GetCheckBox(String name, boolean border)
69
+ {
70
+ try
71
+ {
72
+ ImageIcon icon = GetIcon(name);
73
+ return new cCheckBox(icon, border);
74
+ }
75
+ catch (Exception e)
76
+ {
77
+ return new cCheckBox(name, border);
78
+ }
79
+ }
80
+
81
+ private ImageIcon GetIcon(String name) throws IOException
82
+ {
83
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
84
+
85
+ if (image.getWidth() != 24 && image.getHeight() != 24)
86
+ {
87
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
88
+ Graphics2D g = resized.createGraphics();
89
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
90
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
91
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
92
+ g.dispose();
93
+
94
+ image = resized;
95
+ }
96
+
97
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
98
+ return icon;
99
+ }
38100
39101 // SCRIPT
40102
....@@ -138,34 +200,42 @@
138200 public void closeUI()
139201 {
140202 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
203
+// System.out.println("this = " + this);
204
+// System.out.println("objEditor = " + objEditor);
143205 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
206
+// objEditor.ctrlPanel.remove(nameField);
207
+
208
+ objEditor.ctrlPanel.remove(namePanel);
145209
146210 if (!GroupEditor.allparams)
147211 return;
148212
149
- objEditor.ctrlPanel.remove(liveCB);
150
- objEditor.ctrlPanel.remove(hideCB);
151
- objEditor.ctrlPanel.remove(markCB);
152
-
153
- objEditor.ctrlPanel.remove(randomCB);
154
- objEditor.ctrlPanel.remove(speedupCB);
155
- objEditor.ctrlPanel.remove(rewindCB);
156
-
157
- objEditor.ctrlPanel.remove(resetButton);
158
- objEditor.ctrlPanel.remove(stepButton);
159
-// objEditor.ctrlPanel.remove(stepAllButton);
160
-// objEditor.ctrlPanel.remove(resetAllButton);
161
- objEditor.ctrlPanel.remove(link2masterCB);
162
- //objEditor.ctrlPanel.remove(flipVCB);
163
- //objEditor.ctrlPanel.remove(texresMenu);
164
- objEditor.ctrlPanel.remove(slowerButton);
165
- objEditor.ctrlPanel.remove(fasterButton);
166
- objEditor.ctrlPanel.remove(remarkButton);
213
+// objEditor.ctrlPanel.remove(liveCB);
214
+// objEditor.ctrlPanel.remove(hideCB);
215
+// objEditor.ctrlPanel.remove(markCB);
216
+//
217
+// objEditor.ctrlPanel.remove(randomCB);
218
+// objEditor.ctrlPanel.remove(speedupCB);
219
+// objEditor.ctrlPanel.remove(rewindCB);
220
+//
221
+// objEditor.ctrlPanel.remove(resetButton);
222
+// objEditor.ctrlPanel.remove(stepButton);
223
+//// objEditor.ctrlPanel.remove(stepAllButton);
224
+//// objEditor.ctrlPanel.remove(resetAllButton);
225
+// objEditor.ctrlPanel.remove(link2masterCB);
226
+// //objEditor.ctrlPanel.remove(flipVCB);
227
+// //objEditor.ctrlPanel.remove(texresMenu);
228
+// objEditor.ctrlPanel.remove(slowerButton);
229
+// objEditor.ctrlPanel.remove(fasterButton);
230
+// objEditor.ctrlPanel.remove(remarkButton);
167231
168
- Remove(normalpushField);
232
+ objEditor.ctrlPanel.remove(setupPanel);
233
+ objEditor.ctrlPanel.remove(setupPanel2);
234
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
235
+ objEditor.ctrlPanel.remove(pushPanel);
236
+ //objEditor.ctrlPanel.remove(fillPanel);
237
+
238
+ //Remove(normalpushField);
169239 }
170240
171241 public ObjEditor GetEditor()
....@@ -236,6 +306,7 @@
236306 //localCopy.parent = null;
237307
238308 frame = new JFrame();
309
+ frame.setUndecorated(true);
239310 objEditor = this;
240311 this.callee = callee;
241312
....@@ -269,24 +340,40 @@
269340 void SetupMenu()
270341 {
271342 frame.setMenuBar(menuBar = new MenuBar());
272
- menuBar.add(windowMenu = new Menu("File"));
273
- windowMenu.add(loadItem = new MenuItem("Load..."));
274
- windowMenu.add("-");
275
- windowMenu.add(saveItem = new MenuItem("Save"));
276
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
343
+ menuBar.add(fileMenu = new Menu("File"));
344
+ fileMenu.add(newItem = new MenuItem("New"));
345
+ fileMenu.add(loadItem = new MenuItem("Open..."));
346
+
347
+ //oe.menuBar.add(menu = new Menu("Include"));
348
+ Menu menu = new Menu("Import");
349
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
350
+ importOBJItem.addActionListener(this);
351
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
352
+ import3DSItem.addActionListener(this);
353
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
354
+ importVRMLX3DItem.addActionListener(this);
355
+ menu.add("-");
356
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
357
+ importGFDItem.addActionListener(this);
358
+ fileMenu.add(menu);
359
+ fileMenu.add("-");
360
+
361
+ fileMenu.add(saveItem = new MenuItem("Save"));
362
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277363 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
278
- windowMenu.add("-");
279
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
280
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
281
- windowMenu.add("-");
364
+ fileMenu.add("-");
365
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
366
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
367
+ fileMenu.add("-");
282368 if (client.parent != null)
283369 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
370
+ fileMenu.add(closeItem = new MenuItem("Close"));
285371 } else
286372 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
373
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288374 }
289375
376
+ newItem.addActionListener(this);
290377 loadItem.addActionListener(this);
291378 saveItem.addActionListener(this);
292379 saveAsItem.addActionListener(this);
....@@ -295,79 +382,38 @@
295382 //povItem.addActionListener(this);
296383 closeItem.addActionListener(this);
297384
298
- menuBar.add(cameraMenu = new Menu("View"));
299
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
300
- //zBufferItem.addActionListener(this);
301
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
302
- //normalLensItem.addActionListener(this);
303
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
304
- revertCameraItem.addActionListener(this);
305
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
- toggleTimelineItem.addItemListener(this);
307
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308
- toggleFullScreenItem.addItemListener(this);
309
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
310
- cameraMenu.add("-");
311
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
312
- toggleTextureItem.addItemListener(this);
313
- toggleTextureItem.setState(CameraPane.textureon);
314
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
315
- toggleLiveItem.addItemListener(this);
316
- toggleLiveItem.setState(Globals.isLIVE());
317
- cameraMenu.add(stepItem = new MenuItem("Step"));
318
- stepItem.addActionListener(this);
319
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
320
-// toggleDLItem.addItemListener(this);
321
-// toggleDLItem.setState(false);
322
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
323
- toggleRenderItem.addItemListener(this);
324
- toggleRenderItem.setState(!CameraPane.frozen);
325
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
326
- toggleDebugItem.addItemListener(this);
327
- toggleDebugItem.setState(CameraPane.DEBUG);
328
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
329
- toggleFrustumItem.addItemListener(this);
330
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
331
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
332
- toggleFootContactItem.addItemListener(this);
333
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
334
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
335
- toggleRandomItem.addItemListener(this);
336
- toggleRandomItem.setState(CameraPane.RANDOM);
337
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
338
- toggleHandleItem.addItemListener(this);
339
- toggleHandleItem.setState(CameraPane.HANDLES);
340
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
341
- togglePaintItem.addItemListener(this);
342
- togglePaintItem.setState(CameraPane.PAINTMODE);
343
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
344
-// toggleRootItem.addItemListener(this);
345
-// toggleRootItem.setState(false);
346
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
347
-// animationItem.addItemListener(this);
348
-// animationItem.setState(CameraPane.ANIMATION);
349
- cameraMenu.add("-");
350
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
351
- editCameraItem.addActionListener(this);
352
-
353385 objectPanel = new JTabbedPane();
354386 toolbarPanel = new JPanel();
355387 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
388
+ treePanel = new cGridBag();
357389 treePanel.setName("Tree");
358
- ctrlPanel = new JPanel(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
390
+
391
+ editPanel = new cGridBag().setVertical(true);
392
+ editPanel.setName("Edit");
393
+
394
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
395
+
396
+ editCommandsPanel = new cGridBag();
397
+ editPanel.add(editCommandsPanel);
398
+ editPanel.add(ctrlPanel);
399
+
400
+ toolboxPanel = new cGridBag().setVertical(false);
401
+ toolboxPanel.setName("Toolbox");
402
+
403
+ materialPanel = new cGridBag().setVertical(true);
361404 materialPanel.setName("Material");
405
+
362406 /*JTextPane*/
363407 infoarea = createTextPane();
408
+ doc = infoarea.getStyledDocument();
409
+
364410 infoarea.setEditable(true);
365411 SetText();
366412 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367413 // infoarea.setOpaque(false);
368414 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
415
+// TEXTAREA infoarea.setLineWrap(true);
416
+// TEXTAREA infoarea.setWrapStyleWord(true);
371417 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372418 infoPanel.setPreferredSize(new Dimension(50, 200));
373419 infoPanel.setName("Info");
....@@ -378,16 +424,16 @@
378424 mainPanel.setName("Main");
379425 mainPanel.setContinuousLayout(true);
380426 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382427 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
428
+ mainPanel.setDividerLocation(0.5); //1.0);
429
+ mainPanel.setResizeWeight(0.5);
384430
385431 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386432 //mainPanel.setLayout(new GridBagLayout());
387433 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
434
+// treePanel.setLayout(new GridBagLayout());
435
+ //ctrlPanel.setLayout(new GridBagLayout());
436
+ //materialPanel.setLayout(new GridBagLayout());
391437
392438 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393439 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +472,7 @@
426472 static String newline = "\n";
427473 protected static final String buttonString = "JButton";
428474 StyledDocument doc;
429
- JTextArea infoarea;
475
+ JTextPane infoarea;
430476
431477 void ClearInfo()
432478 {
....@@ -449,10 +495,10 @@
449495 e.printStackTrace();
450496 }
451497
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();
498
+// String selection = infoarea.getText();
499
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
500
+// java.awt.datatransfer.Clipboard clipboard =
501
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456502 //clipboard.setContents(data, data);
457503 }
458504
....@@ -475,13 +521,13 @@
475521 //SendInfo("Name:", "bold");
476522 if (sel.GetTextures() != null || debug)
477523 {
478
- si.SendInfo(sel.toString(), "bold");
524
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479525 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480526 if (sel.Size() > 0)
481527 {
482528 si.SendInfo("#children = " + sel.Size(), "regular");
483529 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
530
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485531 if (debug)
486532 {
487533 try
....@@ -493,7 +539,10 @@
493539 }
494540
495541 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
542
+ {
543
+ si.SendInfo(" BBox min: " + minima, "regular");
544
+ si.SendInfo(" BBox max: " + maxima, "regular");
545
+ }
497546
498547 if (sel.bRep != null)
499548 {
....@@ -520,7 +569,7 @@
520569 }
521570 if (sel.support != null)
522571 {
523
- si.SendInfo(" support: " + sel.support, "regular");
572
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524573 }
525574 if (sel.scriptnode != null)
526575 {
....@@ -591,6 +640,9 @@
591640 {
592641 CameraPane.pointflow = (PointFlow) sel;
593642 }
643
+
644
+ si.SendInfo("_____________________", "regular");
645
+ si.SendInfo("", "regular");
594646 }
595647 }
596648
....@@ -606,68 +658,140 @@
606658 }
607659 }
608660
661
+static GraphicsDevice device = GraphicsEnvironment
662
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
663
+
664
+ Rectangle keeprect;
665
+ cRadio radio;
666
+
667
+cButton keepButton;
668
+ cButton twoButton; // Full 3D
669
+ cButton sixButton;
670
+ cButton threeButton;
671
+ cButton sevenButton;
672
+ cButton fourButton; // full panel
673
+ cButton oneButton; // full XYZ
674
+ //cButton currentLayout;
675
+
676
+ boolean maximized;
677
+
678
+ cButton fullscreenLayout;
679
+
680
+ void Minimize()
681
+ {
682
+ frame.setState(Frame.ICONIFIED);
683
+ }
684
+
685
+ void Maximize()
686
+ {
687
+ if (maximized)
688
+ {
689
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
690
+ }
691
+ else
692
+ {
693
+ keeprect = frame.getBounds();
694
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
695
+ Dimension rect2 = frame.getToolkit().getScreenSize();
696
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
697
+// frame.setState(Frame.MAXIMIZED_BOTH);
698
+ }
699
+
700
+ maximized ^= true;
701
+ }
702
+
609703 void ToggleFullScreen()
610704 {
611705 if (CameraPane.FULLSCREEN)
612706 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
707
+ device.setFullScreenWindow(null);
708
+ //frame.setVisible(false);
709
+// frame.removeNotify();
710
+// frame.setUndecorated(false);
711
+// frame.addNotify();
712
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
713
+
714
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
715
+// X framePanel.add(bigThree);
716
+// X frame.getContentPane().add(/*"Center",*/framePanel);
717
+ framePanel.setDividerLocation(1);
718
+
719
+ //frame.setVisible(true);
720
+ radio.layout = keepButton;
721
+ //theFrame = null;
722
+ keepButton = null;
723
+ radio.layout.doClick();
724
+
616725 } else
617726 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
727
+ keepButton = radio.layout;
728
+ //keeprect = frame.getBounds();
729
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
730
+// frame.getToolkit().getScreenSize().height);
731
+ //frame.setVisible(false);
732
+ device.setFullScreenWindow(frame);
733
+// frame.removeNotify();
734
+// frame.setUndecorated(true);
735
+// frame.addNotify();
736
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
737
+// X framePanel.remove(bigThree);
738
+// X frame.getContentPane().add(/*"Center",*/bigThree);
739
+ framePanel.setDividerLocation(0);
740
+
741
+ radio.layout = fullscreenLayout;
742
+ radio.layout.doClick();
743
+ //frame.setVisible(true);
621744 }
745
+
622746 cameraView.ToggleFullScreen();
623747 }
624748
625
- private JTextArea createTextPane()
749
+ private JTextPane createTextPane()
626750 {
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
- };
751
+// TEXTAREA String[] initString =
752
+// {
753
+// "This is an editable JTextPane, ", //regular
754
+// "another ", //italic
755
+// "styled ", //bold
756
+// "text ", //small
757
+// "component, ", //large
758
+// "which supports embedded components..." + newline,//regular
759
+// " " + newline, //button
760
+// "...and embedded icons..." + newline, //regular
761
+// " ", //icon
762
+// newline + "JTextPane is a subclass of JEditorPane that "
763
+// + "uses a StyledEditorKit and StyledDocument, and provides "
764
+// + "cover methods for interacting with those objects."
765
+// };
766
+//
767
+// String[] initStyles =
768
+// {
769
+// "regular", "italic", "bold", "small", "large",
770
+// "regular", "button", "regular", "icon",
771
+// "regular"
772
+// };
773
+//
774
+// JTextPane textPane = new JTextPane();
775
+// textPane.setEditable(true);
776
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
777
+// addStylesToDocument(doc);
778
+//
779
+// try
780
+// {
781
+// for (int j = 0; j < 2; j++)
782
+// {
783
+// for (int i = 0; i < initString.length; i++)
784
+// {
785
+// doc.insertString(doc.getLength(), initString[i],
786
+// doc.getStyle(initStyles[i]));
787
+// }
788
+// }
789
+// } catch (BadLocationException ble)
790
+// {
791
+// System.err.println("Couldn't insert initial text into text pane.");
792
+// }
642793
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;
794
+ return new JTextPane(); // textPane;
671795 }
672796
673797 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +844,7 @@
720844 protected static ImageIcon createImageIcon(String path,
721845 String description)
722846 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
847
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724848 if (imgURL != null)
725849 {
726850 return new ImageIcon(imgURL, description);
....@@ -752,6 +876,7 @@
752876 // NumberSlider vDivsField;
753877 // JCheckBox endcaps;
754878 JCheckBox liveCB;
879
+ JCheckBox selectCB;
755880 JCheckBox hideCB;
756881 JCheckBox link2masterCB;
757882 JCheckBox markCB;
....@@ -767,115 +892,87 @@
767892 JButton slowerButton;
768893 JButton fasterButton;
769894 JButton remarkButton;
895
+
896
+ cGridBag editPanel;
897
+ cGridBag editCommandsPanel;
898
+
899
+ cGridBag namePanel;
900
+ cGridBag setupPanel;
901
+ cGridBag setupPanel2;
902
+ cGridBag objectCommandsPanel;
903
+ cGridBag pushPanel;
904
+ cGridBag fillPanel;
770905
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
906
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772907 {
773908 JCheckBox cb;
774909
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);
910
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780911 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784912
785913 return cb;
786914 }
787915
788
- cButton AddButton(ObjEditor oe, String label)
916
+ cButton AddButton(cGridBag panel, String label)
789917 {
790918 cButton cb;
791919
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);
920
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797921 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801922
802923 return cb;
803924 }
804925
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
926
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806927 {
807928 JComboBox combo;
808929
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;
930
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812931 combo.addActionListener(this);
813932
814933 return combo;
815934 }
816935
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
936
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818937 {
819
- NumberSlider combo;
938
+ cGridBag control = new cGridBag();
939
+
940
+ cNumberSlider combo;
820941
821942 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824943 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
-
944
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
945
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834946 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
947
+
948
+ panel.add(control);
949
+
950
+ return control;
841951 }
842952
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
953
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
844954 {
845
- NumberSlider combo;
955
+ cGridBag control = new cGridBag();
956
+
957
+ cNumberSlider combo;
846958
847959 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
850960 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
-
961
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
962
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
860963 combo.setInteger(current);
861964
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
965
+ panel.add(control);
966
+
967
+ return control;
867968 }
868969
869
- JTextArea AddText(JPanel ctrlPanel, String name)
970
+ JTextArea AddText(cGridBag ctrlPanel, String name)
870971 {
871972 JTextArea text;
872973
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
974
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
876975 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
879976
880977 return text;
881978 }
....@@ -905,9 +1002,16 @@
9051002 objEditor.ctrlPanel.remove(j);
9061003 }
9071004
1005
+ void Remove(cNumberSlider j)
1006
+ {
1007
+ j.removeChangeListener(this);
1008
+ //objEditor.ctrlPanel.remove(j.label);
1009
+ objEditor.ctrlPanel.remove(j);
1010
+ }
1011
+
9081012 /*
9091013 */
910
- void Return() // ObjEditor oe)
1014
+ void Return0() // ObjEditor oe)
9111015 {
9121016 aConstraints.gridy += 1;
9131017 aConstraints.gridx = 0;
....@@ -962,37 +1066,76 @@
9621066
9631067 void SetupUI2(ObjEditor oe)
9641068 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
1069
+ //SetupName(oe);
1070
+
1071
+ namePanel = new cGridBag();
1072
+
1073
+ nameField = AddText(namePanel, copy.GetName());
1074
+ namePanel.add(nameField);
1075
+ oe.ctrlPanel.add(namePanel);
1076
+
1077
+ oe.ctrlPanel.Return();
9701078
9711079 if (!GroupEditor.allparams)
9721080 return;
9731081
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1082
+ setupPanel = new cGridBag().setVertical(false);
1083
+
1084
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1085
+ liveCB.setToolTipText("Animate object");
1086
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1087
+ selectCB.setToolTipText("Make object selectable");
9771088 // 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");
1089
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1090
+ hideCB.setToolTipText("Hide object");
1091
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1092
+ markCB.setToolTipText("Set the animation target transform");
1093
+
1094
+ setupPanel2 = new cGridBag().setVertical(false);
1095
+
1096
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1097
+ rewindCB.setToolTipText("Rewind animation");
1098
+
1099
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1100
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1101
+
1102
+ if (Globals.ADVANCED)
1103
+ {
1104
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1105
+ link2masterCB.setToolTipText("Attach to support");
1106
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1107
+ speedupCB.setToolTipText("Option motion capture");
1108
+ }
1109
+
1110
+ oe.ctrlPanel.add(setupPanel);
1111
+ oe.ctrlPanel.Return();
1112
+ oe.ctrlPanel.add(setupPanel2);
1113
+ oe.ctrlPanel.Return();
1114
+
1115
+ objectCommandsPanel = new cGridBag().setVertical(false);
1116
+
1117
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1118
+ resetButton.setToolTipText("Jump to frame zero");
1119
+ stepButton = AddButton(objectCommandsPanel, "Step");
1120
+ stepButton.setToolTipText("Step one frame");
9841121 // resetAllButton = AddButton(oe, "Reset All");
9851122 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9871123 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
1124
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1125
+ slowerButton.setToolTipText("Decrease animation speed");
1126
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1127
+ fasterButton.setToolTipText("Increase animation speed");
1128
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1129
+ remarkButton.setToolTipText("Set the current transform as the target");
9911130
992
- Return();
1131
+ oe.ctrlPanel.add(objectCommandsPanel);
1132
+ oe.ctrlPanel.Return();
9931133
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
1134
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1135
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1136
+ //Return();
1137
+
1138
+ oe.ctrlPanel.Return();
9961139
9971140 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9981141 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1230,7 @@
10871230 oe.aConstraints.gridwidth = 1;
10881231 /**/
10891232 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1233
+ oe.ctrlPanel.Return();
10911234
10921235 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931236 //textureButton.setEnabled(false);
....@@ -1191,8 +1334,11 @@
11911334 //worldPanel.setName("World");
11921335 centralPanel = new cGridBag();
11931336 centralPanel.preferredWidth = 20;
1194
- timelinePanel = new JPanel(new BorderLayout());
1195
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1337
+
1338
+ if (Globals.ADVANCED)
1339
+ {
1340
+ timelinePanel = new JPanel(new BorderLayout());
1341
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11961342
11971343 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11981344 cameraPanel.setContinuousLayout(true);
....@@ -1201,7 +1347,10 @@
12011347 // cameraPanel.setDividerSize(9);
12021348 cameraPanel.setResizeWeight(1.0);
12031349
1350
+ }
1351
+
12041352 centralPanel.add(cameraView);
1353
+ centralPanel.setFocusable(true);
12051354 //frame.setJMenuBar(timelineMenubar);
12061355 //centralPanel.add(timelinePanel);
12071356
....@@ -1263,11 +1412,13 @@
12631412
12641413 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12651414 //tmp.setName("Edit");
1415
+ objectPanel.add(toolboxPanel);
12661416 objectPanel.add(materialPanel);
1267
- JPanel north = new JPanel(new BorderLayout());
1268
- north.setName("Edit");
1269
- north.add(ctrlPanel, BorderLayout.NORTH);
1270
- objectPanel.add(north);
1417
+// JPanel north = new JPanel(new BorderLayout());
1418
+// north.setName("Edit");
1419
+// north.add(ctrlPanel, BorderLayout.NORTH);
1420
+// objectPanel.add(north);
1421
+ objectPanel.add(editPanel);
12711422 objectPanel.add(infoPanel);
12721423
12731424 /*
....@@ -1289,18 +1440,18 @@
12891440 scrollpane.addMouseWheelListener(this); // Default not fast enough
12901441
12911442 /*JTabbedPane*/ scenePanel = new cGridBag();
1292
- scenePanel.preferredWidth = 7;
1443
+ scenePanel.preferredWidth = 6;
12931444
12941445 JTabbedPane tabbedPane = new JTabbedPane();
12951446 tabbedPane.add(scrollpane);
12961447
12971448 tabbedPane.add(FSPane = new cFileSystemPane(this));
12981449
1299
- optionsPanel = new JPanel(new GridBagLayout());
1450
+ optionsPanel = new cGridBag().setVertical(true);
13001451
13011452 optionsPanel.setName("Options");
13021453
1303
- AddOptions(optionsPanel, aConstraints);
1454
+ AddOptions(optionsPanel); //, aConstraints);
13041455
13051456 tabbedPane.add(optionsPanel);
13061457
....@@ -1395,9 +1546,11 @@
13951546
13961547 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13971548
1398
- frame.setSize(1024, 768);
1399
- frame.show();
1549
+ frame.setSize(1280, 860);
1550
+ frame.setVisible(true);
14001551
1552
+ cameraView.requestFocusInWindow();
1553
+
14011554 gridPanel.setDividerLocation(1.0);
14021555
14031556 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1411,7 +1564,7 @@
14111564 });
14121565 }
14131566
1414
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1567
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14151568 {
14161569 }
14171570
....@@ -1426,260 +1579,173 @@
14261579 ctrlPanel.removeAll();
14271580 }
14281581
1429
- void SetupMaterial(JPanel ctrlPanel)
1582
+ void SetupMaterial(cGridBag panel)
14301583 {
1431
- aConstraints.weighty = 0;
1432
- //aConstraints.weightx = 1;
1433
- /*
1584
+ /*
14341585 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14351586 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1436
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1437
- aConstraints.gridx += 1;
14381587 */
14391588
1440
- aConstraints.gridwidth = 1;
1441
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
1589
+ cGridBag editBar = new cGridBag().setVertical(false);
1590
+
1591
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1592
+ createMaterialButton.setToolTipText("Create material");
14451593
14461594 /*
14471595 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1448
- aConstraints.gridx += 1;
1449
- aConstraints.weighty = 0;
1450
- aConstraints.gridwidth = 1;
14511596 */
14521597
1453
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1454
- aConstraints.gridx += 1;
1598
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1599
+ clearMaterialButton.setToolTipText("Clear material");
1600
+
1601
+ if (Globals.ADVANCED)
1602
+ {
1603
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1604
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1605
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1606
+ }
14551607
1456
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1457
-
1458
- aConstraints.gridx += 1;
1459
-
1460
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1461
-
1462
- aConstraints.gridx += 1;
1463
-
1464
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1465
-
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.weighty = 0;
1469
- aConstraints.gridwidth = 1;
1608
+ editBar.preferredHeight = 15;
1609
+
1610
+ panel.add(editBar);
1611
+
14701612 /**/
14711613 //aConstraints.weighty = 0;
14721614 ////aConstraints.weightx = 1;
14731615 //aConstraints.weighty = 1;
14741616 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14751617 //aConstraints.gridx += 1;
1476
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1477
- aConstraints.weighty = 0;
1478
- aConstraints.gridx = 0;
1479
- aConstraints.gridy += 1;
1480
- aConstraints.gridwidth = 1;
1618
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14811619
1482
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1483
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1484
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1485
- aConstraints.gridx += 1;
1486
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1487
- //aConstraints.weightx = 0;
1488
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1489
- aConstraints.gridx = 0;
1490
- aConstraints.gridy += 1;
1491
- aConstraints.gridwidth = 1;
1620
+ cGridBag colorSection = new cGridBag().setVertical(true);
1621
+
1622
+ cGridBag color = new cGridBag();
1623
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1624
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1625
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1626
+ //colorField.preferredWidth = 200;
1627
+ colorSection.add(color);
14921628
1493
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1494
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1495
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1496
- aConstraints.gridx += 1;
1497
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1498
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1499
- aConstraints.gridx = 0;
1500
- aConstraints.gridy += 1;
1501
- aConstraints.gridwidth = 1;
1629
+ cGridBag modulation = new cGridBag();
1630
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1631
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1632
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1633
+ colorSection.add(modulation);
15021634
1503
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1504
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1505
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1506
- aConstraints.gridx += 1;
1507
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1508
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1509
- aConstraints.gridx = 0;
1510
- aConstraints.gridy += 1;
1511
- aConstraints.gridwidth = 1;
1635
+ cGridBag texture = new cGridBag();
1636
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1637
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1639
+ colorSection.add(texture);
15121640
1513
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1514
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1515
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1516
- aConstraints.gridx += 1;
1517
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1518
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1519
- aConstraints.gridx = 0;
1520
- aConstraints.gridy += 1;
1521
- aConstraints.gridwidth = 1;
1641
+ cGridBag anisoU = new cGridBag();
1642
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1643
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1644
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1645
+ colorSection.add(anisoU);
15221646
1523
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1524
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1525
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1526
- aConstraints.gridx += 1;
1527
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1528
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1529
- aConstraints.gridx = 0;
1530
- aConstraints.gridy += 1;
1531
- aConstraints.gridwidth = 1;
1647
+ cGridBag anisoV = new cGridBag();
1648
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1649
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1650
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1651
+ colorSection.add(anisoV);
15321652
1533
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1534
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1536
- aConstraints.gridx += 1;
1537
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1538
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1539
- aConstraints.gridx = 0;
1540
- aConstraints.gridy += 1;
1541
- aConstraints.gridwidth = 1;
1653
+ cGridBag shadowbias = new cGridBag();
1654
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1655
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1656
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1657
+ colorSection.add(shadowbias);
15421658
1543
- //aConstraints.weighty = 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1545
- //aConstraints.gridx += 1;
1546
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1547
- aConstraints.weighty = 0;
1548
- aConstraints.gridx = 0;
1549
- aConstraints.gridy += 1;
1550
- aConstraints.gridwidth = 1;
1659
+ panel.add(new JSeparator());
1660
+
1661
+ panel.add(colorSection);
1662
+
1663
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1664
+
1665
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1666
+
1667
+ cGridBag diffuse = new cGridBag();
1668
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1669
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1670
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1671
+ diffuseSection.add(diffuse);
15511672
1552
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1553
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1554
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1555
- aConstraints.gridx += 1;
1556
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1557
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1558
- aConstraints.gridx = 0;
1559
- aConstraints.gridy += 1;
1560
- aConstraints.gridwidth = 1;
1673
+ cGridBag diffuseness = new cGridBag();
1674
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1675
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1676
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1677
+ diffuseSection.add(diffuseness);
15611678
1562
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1563
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1564
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1565
- aConstraints.gridx += 1;
1566
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1567
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1568
- aConstraints.gridx = 0;
1569
- aConstraints.gridy += 1;
1570
- aConstraints.gridwidth = 1;
1679
+ cGridBag selfshadow = new cGridBag();
1680
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1681
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1683
+ diffuseSection.add(selfshadow);
15711684
1572
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1573
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1574
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1575
- aConstraints.gridx += 1;
1576
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1577
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1578
- aConstraints.gridx = 0;
1579
- aConstraints.gridy += 1;
1580
- aConstraints.gridwidth = 1;
1685
+ cGridBag sheen = new cGridBag();
1686
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1687
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1689
+ diffuseSection.add(sheen);
15811690
1582
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1583
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1585
- aConstraints.gridx += 1;
1586
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1587
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1588
- aConstraints.gridx = 0;
1589
- aConstraints.gridy += 1;
1590
- aConstraints.gridwidth = 1;
1691
+ cGridBag subsurface = new cGridBag();
1692
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1693
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1694
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1695
+ diffuseSection.add(subsurface);
15911696
1592
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1593
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1594
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1595
- aConstraints.gridx += 1;
1596
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1597
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1598
- aConstraints.gridx = 0;
1599
- aConstraints.gridy += 1;
1600
- aConstraints.gridwidth = 1;
1697
+ cGridBag shadow = new cGridBag();
1698
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1699
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1700
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1701
+ diffuseSection.add(shadow);
16011702
1602
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1603
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1605
- aConstraints.gridx += 1;
1606
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1607
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1608
- aConstraints.gridx = 0;
1609
- aConstraints.gridy += 1;
1610
- aConstraints.gridwidth = 1;
1703
+ cGridBag fakedepth = new cGridBag();
1704
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1705
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1706
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1707
+ diffuseSection.add(fakedepth);
16111708
1612
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1613
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1614
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1615
- aConstraints.gridx += 1;
1616
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1617
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1618
- aConstraints.gridx = 0;
1619
- aConstraints.gridy += 1;
1620
- aConstraints.gridwidth = 1;
1709
+ panel.add(new JSeparator());
1710
+
1711
+ panel.add(diffuseSection);
1712
+
1713
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1714
+
1715
+ cGridBag specularSection = new cGridBag().setVertical(true);
16211716
1622
- //aConstraints.weighty = 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1624
- //aConstraints.gridx += 1;
1625
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1626
- aConstraints.weighty = 0;
1627
- aConstraints.gridx = 0;
1628
- aConstraints.gridy += 1;
1629
- aConstraints.gridwidth = 1;
1717
+ cGridBag specular = new cGridBag();
1718
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1719
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1720
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1721
+ specularSection.add(specular);
16301722
1631
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1632
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1633
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1634
- aConstraints.gridx += 1;
1635
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1636
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1637
- aConstraints.gridx = 0;
1638
- aConstraints.gridy += 1;
1639
- aConstraints.gridwidth = 1;
1723
+ cGridBag lightarea = new cGridBag();
1724
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1725
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1726
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1727
+ specularSection.add(lightarea);
16401728
1641
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1642
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1643
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1644
- aConstraints.gridx += 1;
1645
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1646
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1647
- aConstraints.gridx = 0;
1648
- aConstraints.gridy += 1;
1649
- aConstraints.gridwidth = 1;
1729
+ cGridBag shininess = new cGridBag();
1730
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1731
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1732
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1733
+ specularSection.add(shininess);
16501734
1651
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1652
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1653
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1654
- aConstraints.gridx += 1;
1655
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1656
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1657
- aConstraints.gridx = 0;
1658
- aConstraints.gridy += 1;
1659
- aConstraints.gridwidth = 1;
1735
+ cGridBag metalness = new cGridBag();
1736
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1737
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1738
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1739
+ specularSection.add(metalness);
16601740
1661
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1662
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1663
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1664
- aConstraints.gridx += 1;
1665
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1666
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1667
- aConstraints.gridx = 0;
1668
- aConstraints.gridy += 1;
1669
- aConstraints.gridwidth = 1;
1741
+ cGridBag velvet = new cGridBag();
1742
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1743
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1744
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1745
+ specularSection.add(velvet);
16701746
1671
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1672
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1673
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1674
- aConstraints.gridx += 1;
1675
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1676
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1677
- aConstraints.gridx = 0;
1678
- aConstraints.gridy += 1;
1679
- aConstraints.gridwidth = 1;
1680
-
1681
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1682
- Return();
1747
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1748
+ //Return();
16831749 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16841750 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16851751 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1690,130 +1756,93 @@
16901756 // aConstraints.gridy += 1;
16911757 // aConstraints.gridwidth = 1;
16921758
1693
- //aConstraints.weighty = 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1695
- //aConstraints.gridx += 1;
1696
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1697
- aConstraints.weighty = 0;
1698
- aConstraints.gridx = 0;
1699
- aConstraints.gridy += 1;
1700
- aConstraints.gridwidth = 1;
17011759
1702
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1703
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1704
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1705
- aConstraints.gridx += 1;
1706
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1707
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1708
- aConstraints.gridx = 0;
1709
- aConstraints.gridy += 1;
1710
- aConstraints.gridwidth = 1;
1760
+ panel.add(new JSeparator());
1761
+
1762
+ panel.add(specularSection);
1763
+
1764
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1765
+
1766
+ cGridBag globalSection = new cGridBag().setVertical(true);
17111767
1712
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1713
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1714
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1715
- aConstraints.gridx += 1;
1716
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1717
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1718
- aConstraints.gridx = 0;
1719
- aConstraints.gridy += 1;
1720
- aConstraints.gridwidth = 1;
1768
+ cGridBag camera = new cGridBag();
1769
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1770
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1771
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1772
+ globalSection.add(camera);
17211773
1722
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1723
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1724
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1725
- aConstraints.gridx += 1;
1726
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1727
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1728
- aConstraints.gridx = 0;
1729
- aConstraints.gridy += 1;
1730
- aConstraints.gridwidth = 1;
1774
+ cGridBag ambient = new cGridBag();
1775
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1776
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1777
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1778
+ globalSection.add(ambient);
17311779
1732
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1733
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1734
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1735
- aConstraints.gridx += 1;
1736
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1737
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1738
- aConstraints.gridx = 0;
1739
- aConstraints.gridy += 1;
1740
- aConstraints.gridwidth = 1;
1741
- aConstraints.weighty = 0;
1780
+ cGridBag backlit = new cGridBag();
1781
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1782
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1783
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1784
+ globalSection.add(backlit);
17421785
1743
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1744
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1745
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1746
- aConstraints.gridx += 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1748
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1749
- aConstraints.gridx = 0;
1750
- aConstraints.gridy += 1;
1751
- aConstraints.gridwidth = 1;
1786
+ cGridBag opacity = new cGridBag();
1787
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1788
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1789
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1790
+ globalSection.add(opacity);
17521791
1753
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1754
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1755
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1756
- aConstraints.gridx += 1;
1757
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1758
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1759
- aConstraints.gridx = 0;
1760
- aConstraints.gridy += 1;
1761
- aConstraints.gridwidth = 1;
1792
+ panel.add(new JSeparator());
1793
+
1794
+ panel.add(globalSection);
1795
+
1796
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1797
+
1798
+ cGridBag textureSection = new cGridBag().setVertical(true);
17621799
1763
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1764
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1765
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1766
- aConstraints.gridx += 1;
1767
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1768
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1769
- aConstraints.gridx = 0;
1770
- aConstraints.gridy += 1;
1771
- aConstraints.gridwidth = 1;
1800
+ cGridBag bump = new cGridBag();
1801
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1802
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1803
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1804
+ textureSection.add(bump);
17721805
1773
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1774
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1775
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1776
- aConstraints.gridx += 1;
1777
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1778
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1779
- aConstraints.gridx = 0;
1780
- aConstraints.gridy += 1;
1781
- aConstraints.gridwidth = 1;
1806
+ cGridBag noise = new cGridBag();
1807
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1808
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1809
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1810
+ textureSection.add(noise);
17821811
1783
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1784
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1785
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1786
- aConstraints.gridx += 1;
1787
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1788
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1789
- aConstraints.gridx = 0;
1790
- aConstraints.gridy += 1;
1791
- aConstraints.gridwidth = 1;
1812
+ cGridBag power = new cGridBag();
1813
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1814
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1815
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1816
+ textureSection.add(power);
17921817
1793
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1794
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1795
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1796
- aConstraints.gridx += 1;
1797
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1798
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1799
- aConstraints.gridx = 0;
1800
- aConstraints.gridy += 1;
1801
- aConstraints.gridwidth = 1;
1818
+ cGridBag borderfade = new cGridBag();
1819
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1820
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1821
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1822
+ textureSection.add(borderfade);
18021823
1803
- //aConstraints.weighty = 1;
1804
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1805
- //aConstraints.gridx += 1;
1806
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1807
- aConstraints.weighty = 0;
1824
+ cGridBag fog = new cGridBag();
1825
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1826
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1827
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1828
+ textureSection.add(fog);
18081829
1809
- aConstraints.gridx = 0;
1810
- aConstraints.gridy = 0;
1811
- aConstraints.gridwidth = 1;
1830
+ cGridBag opacityPower = new cGridBag();
1831
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1832
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1833
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1834
+ textureSection.add(opacityPower);
1835
+
1836
+ panel.add(new JSeparator());
1837
+
1838
+ panel.add(textureSection);
1839
+
1840
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18121841
18131842 SetMaterial(copy); // .GetMaterial());
18141843
1815
- colorField.addChangeListener(this);
1816
- modulationField.addChangeListener(this);
1844
+ //colorField.addChangeListener(this);
1845
+// modulationField.addChangeListener(this);
18171846 metalnessField.addChangeListener(this);
18181847 diffuseField.addChangeListener(this);
18191848 specularField.addChangeListener(this);
....@@ -1843,12 +1872,15 @@
18431872 opacityPowerField.addChangeListener(this);
18441873 /**/
18451874
1846
- resetSlidersButton.addActionListener(this);
18471875 clearMaterialButton.addActionListener(this);
18481876 createMaterialButton.addActionListener(this);
1849
-
1850
- propagateToggle.addItemListener(this);
1851
- multiplyToggle.addItemListener(this);
1877
+
1878
+ if (Globals.ADVANCED)
1879
+ {
1880
+ resetSlidersButton.addActionListener(this);
1881
+ propagateToggle.addItemListener(this);
1882
+ multiplyToggle.addItemListener(this);
1883
+ }
18521884 }
18531885
18541886 void DropFile(java.io.File[] files, boolean textures)
....@@ -2019,7 +2051,7 @@
20192051
20202052 //? flashIt = false;
20212053 CameraPane pane = (CameraPane) cameraView;
2022
- pane.clickStart(location.x, location.y, 0);
2054
+ pane.clickStart(location.x, location.y, 0, 0);
20232055 pane.clickEnd(location.x, location.y, 0, true);
20242056
20252057 if (group.selection.size() == 1)
....@@ -2068,6 +2100,7 @@
20682100 e2.printStackTrace();
20692101 }
20702102 }
2103
+
20712104 LoadJMEThread loadThread;
20722105
20732106 class LoadJMEThread extends Thread
....@@ -2125,6 +2158,7 @@
21252158 //LoadFile0(filename, converter);
21262159 }
21272160 }
2161
+
21282162 LoadOBJThread loadObjThread;
21292163
21302164 class LoadOBJThread extends Thread
....@@ -2203,19 +2237,19 @@
22032237
22042238 void LoadObjFile(String fullname)
22052239 {
2206
- /*
2240
+ System.out.println("Loading " + fullname);
2241
+ /**/
22072242 //lastFilename = fullname;
22082243 if(loadObjThread == null)
22092244 {
2210
- loadObjThread = new LoadOBJThread();
2211
- loadObjThread.start();
2245
+ loadObjThread = new LoadOBJThread();
2246
+ loadObjThread.start();
22122247 }
22132248
22142249 loadObjThread.add(fullname);
2215
- */
2250
+ /**/
22162251
2217
- System.out.println("Loading " + fullname);
2218
- makeSomething(new FileObject(fullname, true), true);
2252
+ //makeSomething(new FileObject(fullname, true), true);
22192253 }
22202254
22212255 void LoadGFDFile(String fullname)
....@@ -2476,11 +2510,11 @@
24762510
24772511 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24782512 {
2479
- if (GrafreeD.standAlone)
2513
+ if (Grafreed.standAlone)
24802514 {
24812515 /**/
24822516 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2483
- browser.show();
2517
+ browser.setVisible(true);
24842518 String filename = browser.getFile();
24852519 if (filename != null && filename.length() > 0)
24862520 {
....@@ -2625,6 +2659,7 @@
26252659 }
26262660 if (input == null)
26272661 {
2662
+ new Exception().printStackTrace();
26282663 System.exit(0);
26292664 }
26302665
....@@ -2839,7 +2874,8 @@
28392874 return;
28402875 }
28412876
2842
- multiplyToggle.setSelected(mat.multiply);
2877
+ if (multiplyToggle != null)
2878
+ multiplyToggle.setSelected(mat.multiply);
28432879
28442880 assert (object.projectedVertices != null);
28452881
....@@ -3054,9 +3090,9 @@
30543090 frame.validate();
30553091
30563092 return;
3057
- } else if (event.getSource() == toggleRandomItem)
3093
+ } else if (event.getSource() == toggleSwitchItem)
30583094 {
3059
- cameraView.ToggleRandom();
3095
+ cameraView.ToggleSwitch();
30603096 cameraView.repaint();
30613097 return;
30623098 } else if (event.getSource() == toggleHandleItem)
....@@ -3085,6 +3121,10 @@
30853121 {
30863122 copy.live ^= true;
30873123 return;
3124
+ } else if (event.getSource() == selectCB)
3125
+ {
3126
+ copy.dontselect ^= true;
3127
+ return;
30883128 } else if (event.getSource() == hideCB)
30893129 {
30903130 copy.hide ^= true;
....@@ -3099,6 +3139,7 @@
30993139 if (event.getSource() == randomCB)
31003140 {
31013141 copy.random ^= true;
3142
+ objEditor.refreshContents();
31023143 return;
31033144 }
31043145 if (event.getSource() == speedupCB)
....@@ -3122,8 +3163,9 @@
31223163
31233164 public void actionPerformed(ActionEvent event)
31243165 {
3166
+ Object source = event.getSource();
31253167 // SCRIPT DIALOG
3126
- if (event.getSource() == okbutton)
3168
+ if (source == okbutton)
31273169 {
31283170 textpanel.setVisible(false);
31293171 textpanel.remove(textarea);
....@@ -3135,7 +3177,7 @@
31353177 textarea = null;
31363178 textpanel = null;
31373179 }
3138
- if (event.getSource() == cancelbutton)
3180
+ if (source == cancelbutton)
31393181 {
31403182 textpanel.setVisible(false);
31413183 textpanel.remove(textarea);
....@@ -3147,50 +3189,50 @@
31473189 //applySelf();
31483190 //client.refreshEditWindow();
31493191 //refreshContents();
3150
- if (event.getSource() == nameField)
3192
+ if (source == nameField)
31513193 {
31523194 //System.out.println("ObjEditor " + event);
31533195 applySelf0(true);
31543196 //parent.applySelf();
31553197 objEditor.refreshContents();
3156
- } else if (event.getSource() == resetButton)
3198
+ } else if (source == resetButton)
31573199 {
31583200 CameraPane.fullreset = true;
31593201 copy.Reset(); // ResetMeshes();
31603202 copy.Touch();
31613203 objEditor.refreshContents();
3162
- } else if (event.getSource() == stepItem)
3204
+ } else if (source == stepItem)
31633205 {
31643206 //cameraView.ONESTEP = true;
31653207 Globals.ONESTEP = true;
31663208 cameraView.repaint();
31673209 return;
3168
- } else if (event.getSource() == stepButton)
3210
+ } else if (source == stepButton)
31693211 {
31703212 copy.Step();
31713213 copy.Touch();
31723214 objEditor.refreshContents();
3173
- } else if (event.getSource() == slowerButton)
3215
+ } else if (source == slowerButton)
31743216 {
31753217 copy.Slower();
31763218 copy.Touch();
31773219 objEditor.refreshContents();
3178
- } else if (event.getSource() == fasterButton)
3220
+ } else if (source == fasterButton)
31793221 {
31803222 copy.Faster();
31813223 copy.Touch();
31823224 objEditor.refreshContents();
3183
- } else if (event.getSource() == remarkButton)
3225
+ } else if (source == remarkButton)
31843226 {
31853227 copy.Remark();
31863228 copy.Touch();
31873229 objEditor.refreshContents();
3188
- } else if (event.getSource() == stepAllButton)
3230
+ } else if (source == stepAllButton)
31893231 {
31903232 copy.StepAll();
31913233 copy.Touch();
31923234 objEditor.refreshContents();
3193
- } else if (event.getSource() == resetAllButton)
3235
+ } else if (source == resetAllButton)
31943236 {
31953237 //CameraPane.fullreset = true;
31963238 copy.ResetAll(); // ResetMeshes();
....@@ -3223,53 +3265,75 @@
32233265 // Close();
32243266 // }
32253267 // else
3226
- if (event.getSource() == resetSlidersButton)
3268
+ if (source == resetSlidersButton)
32273269 {
32283270 ResetSliders();
3229
- } else if (event.getSource() == clearMaterialButton)
3271
+ } else if (source == clearMaterialButton)
32303272 {
32313273 ClearMaterial();
3232
- } else if (event.getSource() == createMaterialButton)
3274
+ } else if (source == createMaterialButton)
32333275 {
32343276 CreateMaterial();
3235
- } else if (event.getSource() == clearPanelButton)
3277
+ } else if (source == clearPanelButton)
32363278 {
32373279 copy.ClearUI();
32383280 refreshContents(true);
3239
- } /*
3240
- }
3241
-
3242
- public boolean action(Event event, Object arg)
3243
- {
3244
- */ else if (event.getSource() == closeItem)
3281
+ } else if (source == importGFDItem)
3282
+ {
3283
+ ImportGFD();
3284
+ } else
3285
+ if (source == importVRMLX3DItem)
3286
+ {
3287
+ ImportVRMLX3D();
3288
+ } else
3289
+ if (source == import3DSItem)
3290
+ {
3291
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3292
+ } else
3293
+ if (source == importOBJItem)
3294
+ {
3295
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3296
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3297
+ browser.setVisible(true);
3298
+ String filename = browser.getFile();
3299
+ if (filename != null && filename.length() > 0)
3300
+ {
3301
+ String fullname = browser.getDirectory() + filename;
3302
+ makeSomething(ReadOBJ(fullname), true);
3303
+ }
3304
+ } else
3305
+ if (source == closeItem)
32453306 {
32463307 Close();
32473308 //return true;
3248
- } else if (event.getSource() == loadItem)
3309
+ } else if (source == loadItem)
32493310 {
32503311 load();
32513312 //return true;
3252
- } else if (event.getSource() == saveItem)
3313
+ } else if (source == newItem)
3314
+ {
3315
+ New();
3316
+ } else if (source == saveItem)
32533317 {
32543318 save();
32553319 //return true;
3256
- } else if (event.getSource() == saveAsItem)
3320
+ } else if (source == saveAsItem)
32573321 {
32583322 saveAs();
32593323 //return true;
3260
- } else if (event.getSource() == reexportItem)
3324
+ } else if (source == reexportItem)
32613325 {
32623326 reexport();
32633327 //return true;
3264
- } else if (event.getSource() == exportAsItem)
3328
+ } else if (source == exportAsItem)
32653329 {
32663330 export();
32673331 //return true;
3268
- } else if (event.getSource() == povItem)
3332
+ } else if (source == povItem)
32693333 {
32703334 generatePOV();
32713335 //return true;
3272
- } else if (event.getSource() == zBufferItem)
3336
+ } else if (source == zBufferItem)
32733337 {
32743338 try
32753339 {
....@@ -3291,21 +3355,8 @@
32913355 cameraView.repaint();
32923356 //return true;
32933357 }
3294
- */ else if (event.getSource() == editCameraItem)
3295
- {
3296
- cameraView.ProtectCamera();
3297
- cameraView.repaint();
3298
- return;
3299
- } else if (event.getSource() == revertCameraItem)
3300
- {
3301
- cameraView.RevertCamera();
3302
- cameraView.repaint();
3303
- return;
3304
-// } else if (event.getSource() == textureButton)
3305
-// {
3306
-// return; // true;
3307
- } else // combos...
3308
- if (event.getSource() == texresMenu)
3358
+ */ else // combos...
3359
+ if (source == texresMenu)
33093360 {
33103361 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33113362 copy.texres = texresMenu.getSelectedIndex();
....@@ -3317,12 +3368,272 @@
33173368 }
33183369 }
33193370
3371
+ void New()
3372
+ {
3373
+ while (copy.Size() > 1)
3374
+ {
3375
+ copy.remove(1);
3376
+ }
3377
+
3378
+ ResetModel();
3379
+ objEditor.refreshContents();
3380
+ }
3381
+
3382
+ static public byte[] Compress(Object3D o)
3383
+ {
3384
+ try
3385
+ {
3386
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3387
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3388
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3389
+
3390
+ Object3D parent = o.parent;
3391
+ o.parent = null;
3392
+
3393
+ out.writeObject(o);
3394
+
3395
+ o.parent = parent;
3396
+
3397
+ out.flush();
3398
+
3399
+ zstream.close();
3400
+ out.close();
3401
+
3402
+ return baos.toByteArray();
3403
+ } catch (Exception e)
3404
+ {
3405
+ System.err.println(e);
3406
+ return null;
3407
+ }
3408
+ }
3409
+
3410
+ static public Object Uncompress(byte[] bytes)
3411
+ {
3412
+ System.out.println("#bytes = " + bytes.length);
3413
+ try
3414
+ {
3415
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3416
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3417
+ ObjectInputStream in = new ObjectInputStream(istream);
3418
+ Object obj = in.readObject();
3419
+ in.close();
3420
+
3421
+ return obj;
3422
+ } catch (Exception e)
3423
+ {
3424
+ System.err.println(e);
3425
+ return null;
3426
+ }
3427
+ }
3428
+
3429
+ static public Object clone(Object o)
3430
+ {
3431
+ try
3432
+ {
3433
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3434
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3435
+
3436
+ out.writeObject(o);
3437
+
3438
+ out.flush();
3439
+ out.close();
3440
+
3441
+ byte[] bytes = baos.toByteArray();
3442
+
3443
+ System.out.println("clone = " + bytes.length);
3444
+
3445
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3446
+ ObjectInputStream in = new ObjectInputStream(bais);
3447
+ Object obj = in.readObject();
3448
+ in.close();
3449
+
3450
+ return obj;
3451
+ } catch (Exception e)
3452
+ {
3453
+ System.err.println(e);
3454
+ return null;
3455
+ }
3456
+ }
3457
+
3458
+ cRadio GetCurrentTab()
3459
+ {
3460
+ cRadio ab;
3461
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3462
+ {
3463
+ ab = (cRadio)e.nextElement();
3464
+ if(ab.GetObject() == copy)
3465
+ {
3466
+ return ab;
3467
+ }
3468
+ }
3469
+
3470
+ return null;
3471
+ }
3472
+
3473
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3474
+
3475
+ public void Save()
3476
+ {
3477
+ System.err.println("Save");
3478
+
3479
+ cRadio tab = GetCurrentTab();
3480
+
3481
+ boolean temp = CameraPane.SWITCH;
3482
+ CameraPane.SWITCH = false;
3483
+
3484
+ copy.ExtractBigData(hashtable);
3485
+
3486
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3487
+ tab.graphs[tab.undoindex++] = Compress(copy);
3488
+
3489
+ copy.RestoreBigData(hashtable);
3490
+
3491
+ CameraPane.SWITCH = temp;
3492
+
3493
+ //assert(hashtable.isEmpty());
3494
+
3495
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3496
+ {
3497
+ tab.graphs[i] = null;
3498
+ }
3499
+
3500
+ // test save
3501
+ if (false)
3502
+ {
3503
+ try
3504
+ {
3505
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3506
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3507
+
3508
+ p.writeObject(copy);
3509
+
3510
+ p.flush();
3511
+
3512
+ ostream.close();
3513
+ } catch (Exception e)
3514
+ {
3515
+ e.printStackTrace();
3516
+ }
3517
+ }
3518
+ }
3519
+
3520
+ void CopyChanged(Object3D obj)
3521
+ {
3522
+ boolean temp = CameraPane.SWITCH;
3523
+ CameraPane.SWITCH = false;
3524
+
3525
+ copy.ExtractBigData(hashtable);
3526
+
3527
+ copy.clear();
3528
+
3529
+ for (int i=0; i<obj.Size(); i++)
3530
+ {
3531
+ copy.add(obj.get(i));
3532
+ }
3533
+
3534
+ copy.RestoreBigData(hashtable);
3535
+
3536
+ CameraPane.SWITCH = temp;
3537
+
3538
+ //assert(hashtable.isEmpty());
3539
+
3540
+ copy.Touch();
3541
+
3542
+ ResetModel();
3543
+ copy.HardTouch(); // recompile?
3544
+
3545
+ cRadio ab;
3546
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3547
+ {
3548
+ ab = (cRadio)e.nextElement();
3549
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3550
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3551
+ if (test != null)
3552
+ {
3553
+ test.editWindow = ab.object.editWindow;
3554
+ ab.object = test;
3555
+ }
3556
+ }
3557
+
3558
+ refreshContents();
3559
+ }
3560
+
3561
+ public void Undo()
3562
+ {
3563
+ System.err.println("Undo");
3564
+
3565
+ cRadio tab = GetCurrentTab();
3566
+
3567
+ if (tab.undoindex == 0)
3568
+ {
3569
+ java.awt.Toolkit.getDefaultToolkit().beep();
3570
+ return;
3571
+ }
3572
+
3573
+ if (tab.graphs[tab.undoindex] == null)
3574
+ {
3575
+ Save();
3576
+ tab.undoindex -= 1;
3577
+ }
3578
+
3579
+ tab.undoindex -= 1;
3580
+
3581
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3582
+ }
3583
+
3584
+ public void Redo()
3585
+ {
3586
+ cRadio tab = GetCurrentTab();
3587
+
3588
+ if (tab.graphs[tab.undoindex + 1] == null)
3589
+ {
3590
+ java.awt.Toolkit.getDefaultToolkit().beep();
3591
+ return;
3592
+ }
3593
+
3594
+ tab.undoindex += 1;
3595
+
3596
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3597
+ }
3598
+
3599
+ void ImportGFD()
3600
+ {
3601
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3602
+ browser.show();
3603
+ String filename = browser.getFile();
3604
+ if (filename != null && filename.length() > 0)
3605
+ {
3606
+ String fullname = browser.getDirectory() + filename;
3607
+
3608
+ //Object3D readobj =
3609
+ objEditor.ReadGFD(fullname, objEditor);
3610
+ //makeSomething(readobj);
3611
+ }
3612
+ }
3613
+
3614
+ void ImportVRMLX3D()
3615
+ {
3616
+ if (Grafreed.standAlone)
3617
+ {
3618
+ /**/
3619
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3620
+ browser.show();
3621
+ String filename = browser.getFile();
3622
+ if (filename != null && filename.length() > 0)
3623
+ {
3624
+ String fullname = browser.getDirectory() + filename;
3625
+ LoadVRMLX3D(fullname);
3626
+ }
3627
+ /**/
3628
+ }
3629
+ }
3630
+
33203631 void ToggleAnimation()
33213632 {
33223633 if (!Globals.ANIMATION)
33233634 {
33243635 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3325
- browser.show();
3636
+ browser.setVisible(true);
33263637 String filename = browser.getFile();
33273638 if (filename != null && filename.length() > 0)
33283639 {
....@@ -3332,8 +3643,8 @@
33323643
33333644 Globals.ANIMATION ^= true;
33343645
3335
- GrafreeD.wav.cursor = 0;
3336
- GrafreeD.wav.loop = 0;
3646
+ Grafreed.wav.cursor = 0;
3647
+ Grafreed.wav.loop = 0;
33373648 }
33383649 } else
33393650 {
....@@ -3383,7 +3694,7 @@
33833694 void CreateMaterial()
33843695 {
33853696 //copy.ClearMaterial(); // PATCH
3386
- copy.CreateMaterialS(multiplyToggle.isSelected());
3697
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33873698 if (copy.selection.size() > 0)
33883699 //SetMaterial(copy);
33893700 {
....@@ -3434,7 +3745,7 @@
34343745 assert false;
34353746 }
34363747
3437
- void EditSelection()
3748
+ void EditSelection(boolean newWindow)
34383749 {
34393750 }
34403751
....@@ -3442,11 +3753,11 @@
34423753 {
34433754 copy.ResetBlockLoop(); // temporary problem
34443755
3445
- boolean random = CameraPane.RANDOM;
3446
- CameraPane.RANDOM = false; // parse everything
3756
+ boolean random = CameraPane.SWITCH;
3757
+ CameraPane.SWITCH = false; // parse everything
34473758 copy.ResetDisplayList();
34483759 copy.HardTouch();
3449
- CameraPane.RANDOM = random;
3760
+ CameraPane.SWITCH = random;
34503761 }
34513762
34523763 // public void applySelf()
....@@ -3516,10 +3827,40 @@
35163827 current.fakedepth = (float) fakedepthField.getFloat();
35173828 current.shadowbias = (float) shadowbiasField.getFloat();
35183829
3519
- if (!NumberSlider.frozen)
3830
+ if (!cNumberSlider.frozen)
35203831 {
35213832 //System.out.println("Propagate = " + propagate);
35223833 copy.UpdateMaterial(anchor, current, propagate);
3834
+
3835
+ if (copy.material != null)
3836
+ {
3837
+ cMaterial mat = copy.material;
3838
+
3839
+ colorField.SetToolTipValue((mat.color));
3840
+ modulationField.SetToolTipValue((mat.modulation));
3841
+ metalnessField.SetToolTipValue((mat.metalness));
3842
+ diffuseField.SetToolTipValue((mat.diffuse));
3843
+ specularField.SetToolTipValue((mat.specular));
3844
+ shininessField.SetToolTipValue((mat.shininess));
3845
+ shiftField.SetToolTipValue((mat.shift));
3846
+ ambientField.SetToolTipValue((mat.ambient));
3847
+ lightareaField.SetToolTipValue((mat.lightarea));
3848
+ diffusenessField.SetToolTipValue((mat.factor));
3849
+ velvetField.SetToolTipValue((mat.velvet));
3850
+ sheenField.SetToolTipValue((mat.sheen));
3851
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3852
+ backlitField.SetToolTipValue((mat.bump));
3853
+ anisoField.SetToolTipValue((mat.aniso));
3854
+ anisoVField.SetToolTipValue((mat.anisoV));
3855
+ cameraField.SetToolTipValue((mat.cameralight));
3856
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3857
+ shadowField.SetToolTipValue((mat.shadow));
3858
+ textureField.SetToolTipValue((mat.texture));
3859
+ opacityField.SetToolTipValue((mat.opacity));
3860
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3861
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3862
+ }
3863
+
35233864 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35243865 {
35253866 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3564,6 +3905,7 @@
35643905 || e.getSource() == apertureField
35653906 || e.getSource() == shadowblurField)
35663907 {
3908
+ new Exception().printStackTrace();
35673909 System.exit(0);
35683910 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35693911 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3634,7 +3976,7 @@
36343976 }
36353977
36363978 if (normalpushField != null)
3637
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3979
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36383980 }
36393981
36403982 void SnapObject()
....@@ -3889,7 +4231,7 @@
38894231
38904232 radioPanel.revalidate();
38914233 radioPanel.repaint();
3892
- ctrlPanel.revalidate(); // ? new
4234
+ ctrlPanel.validate(); // ? new
38934235 ctrlPanel.repaint();
38944236 }
38954237 }
....@@ -3898,6 +4240,8 @@
38984240
38994241 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
39004242 {
4243
+ if (Globals.SAVEONMAKE) // && resetmodel)
4244
+ Save();
39014245 //Tween.set(thing, 0).target(1).start(tweenManager);
39024246 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
39034247 // if (thing instanceof GenericJointDemo)
....@@ -3984,6 +4328,12 @@
39844328 {
39854329 ResetModel();
39864330 Select(thing.GetTreePath(), true, false); // unselect... false);
4331
+
4332
+ if (thing.Size() == 0)
4333
+ {
4334
+ //EditSelection(false);
4335
+ }
4336
+
39874337 refreshContents();
39884338 }
39894339
....@@ -4101,6 +4451,7 @@
41014451 }
41024452 }
41034453 }
4454
+
41044455 LoadGFDThread loadGFDThread;
41054456
41064457 void ReadGFD(String fullname, iCallBack cb)
....@@ -4120,8 +4471,10 @@
41204471
41214472 try
41224473 {
4474
+ // Try compressed version first.
41234475 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4124
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4476
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4477
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41254478
41264479 readobj = (Object3D) p.readObject();
41274480 istream.close();
....@@ -4129,7 +4482,20 @@
41294482 readobj.ResetDisplayList();
41304483 } catch (Exception e)
41314484 {
4132
- e.printStackTrace();
4485
+ //e.printStackTrace();
4486
+ try
4487
+ {
4488
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4489
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4490
+
4491
+ readobj = (Object3D) p.readObject();
4492
+ istream.close();
4493
+
4494
+ readobj.ResetDisplayList();
4495
+ } catch (Exception e2)
4496
+ {
4497
+ e2.printStackTrace();
4498
+ }
41334499 }
41344500 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41354501 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4175,6 +4541,12 @@
41754541
41764542 void LoadIt(Object obj)
41774543 {
4544
+ if (obj == null)
4545
+ {
4546
+ // Invalid file
4547
+ return;
4548
+ }
4549
+
41784550 System.out.println("Loaded " + obj);
41794551 //new Exception().printStackTrace();
41804552 Object3D readobj = (Object3D) obj;
....@@ -4184,6 +4556,8 @@
41844556
41854557 if (readobj != null)
41864558 {
4559
+ if (Globals.SAVEONMAKE)
4560
+ Save();
41874561 try
41884562 {
41894563 //readobj.deepCopySelf(copy);
....@@ -4246,7 +4620,7 @@
42464620
42474621 void load() // throws ClassNotFoundException
42484622 {
4249
- if (GrafreeD.standAlone)
4623
+ if (Grafreed.standAlone)
42504624 {
42514625 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42524626 browser.show();
....@@ -4333,11 +4707,13 @@
43334707 try
43344708 {
43354709 FileOutputStream ostream = new FileOutputStream(lastname);
4336
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4710
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4711
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43374712
43384713 p.writeObject(copy);
43394714 p.flush();
43404715
4716
+ zstream.close();
43414717 ostream.close();
43424718
43434719 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4347,11 +4723,12 @@
43474723 {
43484724 }
43494725 }
4726
+
43504727 String lastname;
43514728
43524729 void saveAs()
43534730 {
4354
- if (GrafreeD.standAlone)
4731
+ if (Grafreed.standAlone)
43554732 {
43564733 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43574734 browser.setVisible(true);
....@@ -4456,13 +4833,13 @@
44564833 try
44574834 {
44584835 FileOutputStream ostream = new FileOutputStream(filename);
4459
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4460
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4836
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4837
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44614838
44624839 Object3D objectparent = obj.parent;
44634840 obj.parent = null;
44644841
4465
- Object3D object = (Object3D) GrafreeD.clone(obj);
4842
+ Object3D object = (Object3D) Grafreed.clone(obj);
44664843
44674844 obj.parent = objectparent;
44684845
....@@ -4474,8 +4851,8 @@
44744851 p.writeObject(object);
44754852 p.flush();
44764853
4854
+ zstream.close();
44774855 ostream.close();
4478
- // zstream.close();
44794856
44804857 // group.selection.get(0).parent = parent;
44814858 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4496,7 +4873,7 @@
44964873 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44974874 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44984875 copy.generatePOV(buffer);
4499
- if (GrafreeD.standAlone)
4876
+ if (Grafreed.standAlone)
45004877 {
45014878 FileDialog browser = new FileDialog(frame, "Export POV", 1);
45024879 browser.show();
....@@ -4522,7 +4899,8 @@
45224899 Object3D client;
45234900 Object3D copy;
45244901 MenuBar menuBar;
4525
- Menu windowMenu;
4902
+ Menu fileMenu;
4903
+ MenuItem newItem;
45264904 MenuItem loadItem;
45274905 MenuItem saveItem;
45284906 MenuItem saveAsItem;
....@@ -4530,13 +4908,11 @@
45304908 MenuItem reexportItem;
45314909 MenuItem povItem;
45324910 MenuItem closeItem;
4533
- Menu cameraMenu;
4911
+
45344912 CheckboxMenuItem zBufferItem;
45354913 //MenuItem normalLensItem;
4536
- MenuItem editCameraItem;
4537
- MenuItem revertCameraItem;
4538
- CheckboxMenuItem toggleLiveItem;
45394914 MenuItem stepItem;
4915
+ CheckboxMenuItem toggleLiveItem;
45404916 CheckboxMenuItem toggleFullScreenItem;
45414917 CheckboxMenuItem toggleTimelineItem;
45424918 CheckboxMenuItem toggleRenderItem;
....@@ -4545,25 +4921,36 @@
45454921 CheckboxMenuItem toggleFootContactItem;
45464922 CheckboxMenuItem toggleDLItem;
45474923 CheckboxMenuItem toggleTextureItem;
4548
- CheckboxMenuItem toggleRandomItem;
4924
+ CheckboxMenuItem toggleSwitchItem;
45494925 CheckboxMenuItem toggleRootItem;
45504926 CheckboxMenuItem animationItem;
45514927 CheckboxMenuItem toggleHandleItem;
45524928 CheckboxMenuItem togglePaintItem;
45534929 JSplitPane mainPanel;
45544930 JScrollPane scrollpane;
4931
+
45554932 JPanel toolbarPanel;
4556
- JPanel treePanel;
4933
+
4934
+ cGridBag treePanel;
4935
+
45574936 JPanel radioPanel;
45584937 ButtonGroup buttonGroup;
4559
- JPanel ctrlPanel;
4560
- JPanel materialPanel;
4938
+
4939
+ cGridBag toolboxPanel;
4940
+ cGridBag materialPanel;
4941
+ cGridBag ctrlPanel;
4942
+
45614943 JScrollPane infoPanel;
4562
- JPanel optionsPanel;
4944
+
4945
+ cGridBag optionsPanel;
4946
+
45634947 JTabbedPane objectPanel;
4948
+
45644949 cGridBag XYZPanel;
4950
+
45654951 JSplitPane gridPanel;
45664952 JSplitPane bigPanel;
4953
+
45674954 cGridBag bigThree;
45684955 cGridBag scenePanel;
45694956 cGridBag centralPanel;
....@@ -4619,67 +5006,72 @@
46195006 // MATERIAL
46205007 JLabel materialLabel;
46215008 JLabel colorLabel;
4622
- NumberSlider colorField;
5009
+ cNumberSlider colorField;
46235010 JLabel modulationLabel;
4624
- NumberSlider modulationField;
5011
+ cNumberSlider modulationField;
46255012 JLabel metalnessLabel;
4626
- NumberSlider metalnessField;
5013
+ cNumberSlider metalnessField;
46275014 JLabel diffuseLabel;
4628
- NumberSlider diffuseField;
5015
+ cNumberSlider diffuseField;
46295016 JLabel specularLabel;
4630
- NumberSlider specularField;
5017
+ cNumberSlider specularField;
46315018 JLabel shininessLabel;
4632
- NumberSlider shininessField;
5019
+ cNumberSlider shininessField;
46335020 JLabel shiftLabel;
4634
- NumberSlider shiftField;
5021
+ cNumberSlider shiftField;
46355022 JLabel ambientLabel;
4636
- NumberSlider ambientField;
5023
+ cNumberSlider ambientField;
46375024 JLabel lightareaLabel;
4638
- NumberSlider lightareaField;
5025
+ cNumberSlider lightareaField;
46395026 JLabel diffusenessLabel;
4640
- NumberSlider diffusenessField;
5027
+ cNumberSlider diffusenessField;
46415028 JLabel velvetLabel;
4642
- NumberSlider velvetField;
5029
+ cNumberSlider velvetField;
46435030 JLabel sheenLabel;
4644
- NumberSlider sheenField;
5031
+ cNumberSlider sheenField;
46455032 JLabel subsurfaceLabel;
4646
- NumberSlider subsurfaceField;
5033
+ cNumberSlider subsurfaceField;
46475034 //JLabel bumpLabel;
46485035 //NumberSlider bumpField;
46495036 JLabel backlitLabel;
4650
- NumberSlider backlitField;
5037
+ cNumberSlider backlitField;
46515038 JLabel anisoLabel;
4652
- NumberSlider anisoField;
5039
+ cNumberSlider anisoField;
46535040 JLabel anisoVLabel;
4654
- NumberSlider anisoVField;
5041
+ cNumberSlider anisoVField;
46555042 JLabel cameraLabel;
4656
- NumberSlider cameraField;
5043
+ cNumberSlider cameraField;
46575044 JLabel selfshadowLabel;
4658
- NumberSlider selfshadowField;
5045
+ cNumberSlider selfshadowField;
46595046 JLabel shadowLabel;
4660
- NumberSlider shadowField;
5047
+ cNumberSlider shadowField;
46615048 JLabel textureLabel;
4662
- NumberSlider textureField;
5049
+ cNumberSlider textureField;
46635050 JLabel opacityLabel;
4664
- NumberSlider opacityField;
5051
+ cNumberSlider opacityField;
46655052 JLabel fakedepthLabel;
4666
- NumberSlider fakedepthField;
5053
+ cNumberSlider fakedepthField;
46675054 JLabel shadowbiasLabel;
4668
- NumberSlider shadowbiasField;
5055
+ cNumberSlider shadowbiasField;
46695056 JLabel bumpLabel;
4670
- NumberSlider bumpField;
5057
+ cNumberSlider bumpField;
46715058 JLabel noiseLabel;
4672
- NumberSlider noiseField;
5059
+ cNumberSlider noiseField;
46735060 JLabel powerLabel;
4674
- NumberSlider powerField;
5061
+ cNumberSlider powerField;
46755062 JLabel borderfadeLabel;
4676
- NumberSlider borderfadeField;
5063
+ cNumberSlider borderfadeField;
46775064 JLabel fogLabel;
4678
- NumberSlider fogField;
5065
+ cNumberSlider fogField;
46795066 JLabel opacityPowerLabel;
4680
- NumberSlider opacityPowerField;
4681
- JTree jTree;
5067
+ cNumberSlider opacityPowerField;
5068
+ cTree jTree;
46825069 //ObjectUI parent;
46835070
4684
- NumberSlider normalpushField;
5071
+ cNumberSlider normalpushField;
5072
+
5073
+ private MenuItem importGFDItem;
5074
+ private MenuItem importVRMLX3DItem;
5075
+ private MenuItem import3DSItem;
5076
+ private MenuItem importOBJItem;
46855077 }