Normand Briere
2019-06-25 829f93f305ce15893aada126a98d9068b1cdefed
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -35,6 +36,67 @@
3536
3637 GroupEditor callee;
3738 JFrame frame;
39
+
40
+ static ObjEditor theFrame;
41
+
42
+ cButton GetButton(String name, boolean border)
43
+ {
44
+ try
45
+ {
46
+ ImageIcon icon = GetIcon(name);
47
+ return new cButton(icon, border);
48
+ }
49
+ catch (Exception e)
50
+ {
51
+ return new cButton(name, border);
52
+ }
53
+ }
54
+
55
+ cToggleButton GetToggleButton(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cToggleButton(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cToggleButton(name, border);
65
+ }
66
+ }
67
+
68
+ cCheckBox GetCheckBox(String name, boolean border)
69
+ {
70
+ try
71
+ {
72
+ ImageIcon icon = GetIcon(name);
73
+ return new cCheckBox(icon, border);
74
+ }
75
+ catch (Exception e)
76
+ {
77
+ return new cCheckBox(name, border);
78
+ }
79
+ }
80
+
81
+ private ImageIcon GetIcon(String name) throws IOException
82
+ {
83
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
84
+
85
+ if (image.getWidth() != 24 && image.getHeight() != 24)
86
+ {
87
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
88
+ Graphics2D g = resized.createGraphics();
89
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
90
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
91
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
92
+ g.dispose();
93
+
94
+ image = resized;
95
+ }
96
+
97
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
98
+ return icon;
99
+ }
38100
39101 // SCRIPT
40102
....@@ -138,34 +200,42 @@
138200 public void closeUI()
139201 {
140202 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
203
+// System.out.println("this = " + this);
204
+// System.out.println("objEditor = " + objEditor);
143205 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
206
+// objEditor.ctrlPanel.remove(nameField);
207
+
208
+ objEditor.ctrlPanel.remove(namePanel);
145209
146210 if (!GroupEditor.allparams)
147211 return;
148212
149
- objEditor.ctrlPanel.remove(liveCB);
150
- objEditor.ctrlPanel.remove(hideCB);
151
- objEditor.ctrlPanel.remove(markCB);
152
-
153
- objEditor.ctrlPanel.remove(randomCB);
154
- objEditor.ctrlPanel.remove(speedupCB);
155
- objEditor.ctrlPanel.remove(rewindCB);
156
-
157
- objEditor.ctrlPanel.remove(resetButton);
158
- objEditor.ctrlPanel.remove(stepButton);
159
-// objEditor.ctrlPanel.remove(stepAllButton);
160
-// objEditor.ctrlPanel.remove(resetAllButton);
161
- objEditor.ctrlPanel.remove(link2masterCB);
162
- //objEditor.ctrlPanel.remove(flipVCB);
163
- //objEditor.ctrlPanel.remove(texresMenu);
164
- objEditor.ctrlPanel.remove(slowerButton);
165
- objEditor.ctrlPanel.remove(fasterButton);
166
- objEditor.ctrlPanel.remove(remarkButton);
213
+// objEditor.ctrlPanel.remove(liveCB);
214
+// objEditor.ctrlPanel.remove(hideCB);
215
+// objEditor.ctrlPanel.remove(markCB);
216
+//
217
+// objEditor.ctrlPanel.remove(randomCB);
218
+// objEditor.ctrlPanel.remove(speedupCB);
219
+// objEditor.ctrlPanel.remove(rewindCB);
220
+//
221
+// objEditor.ctrlPanel.remove(resetButton);
222
+// objEditor.ctrlPanel.remove(stepButton);
223
+//// objEditor.ctrlPanel.remove(stepAllButton);
224
+//// objEditor.ctrlPanel.remove(resetAllButton);
225
+// objEditor.ctrlPanel.remove(link2masterCB);
226
+// //objEditor.ctrlPanel.remove(flipVCB);
227
+// //objEditor.ctrlPanel.remove(texresMenu);
228
+// objEditor.ctrlPanel.remove(slowerButton);
229
+// objEditor.ctrlPanel.remove(fasterButton);
230
+// objEditor.ctrlPanel.remove(remarkButton);
167231
168
- Remove(normalpushField);
232
+ objEditor.ctrlPanel.remove(setupPanel);
233
+ objEditor.ctrlPanel.remove(setupPanel2);
234
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
235
+ objEditor.ctrlPanel.remove(pushPanel);
236
+ //objEditor.ctrlPanel.remove(fillPanel);
237
+
238
+ //Remove(normalpushField);
169239 }
170240
171241 public ObjEditor GetEditor()
....@@ -236,6 +306,7 @@
236306 //localCopy.parent = null;
237307
238308 frame = new JFrame();
309
+ frame.setUndecorated(true);
239310 objEditor = this;
240311 this.callee = callee;
241312
....@@ -269,24 +340,40 @@
269340 void SetupMenu()
270341 {
271342 frame.setMenuBar(menuBar = new MenuBar());
272
- menuBar.add(windowMenu = new Menu("File"));
273
- windowMenu.add(loadItem = new MenuItem("Load..."));
274
- windowMenu.add("-");
275
- windowMenu.add(saveItem = new MenuItem("Save"));
276
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
343
+ menuBar.add(fileMenu = new Menu("File"));
344
+ fileMenu.add(newItem = new MenuItem("New"));
345
+ fileMenu.add(loadItem = new MenuItem("Open..."));
346
+
347
+ //oe.menuBar.add(menu = new Menu("Include"));
348
+ Menu menu = new Menu("Import");
349
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
350
+ importOBJItem.addActionListener(this);
351
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
352
+ import3DSItem.addActionListener(this);
353
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
354
+ importVRMLX3DItem.addActionListener(this);
355
+ menu.add("-");
356
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
357
+ importGFDItem.addActionListener(this);
358
+ fileMenu.add(menu);
359
+ fileMenu.add("-");
360
+
361
+ fileMenu.add(saveItem = new MenuItem("Save"));
362
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277363 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
278
- windowMenu.add("-");
279
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
280
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
281
- windowMenu.add("-");
364
+ fileMenu.add("-");
365
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
366
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
367
+ fileMenu.add("-");
282368 if (client.parent != null)
283369 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
370
+ fileMenu.add(closeItem = new MenuItem("Close"));
285371 } else
286372 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
373
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288374 }
289375
376
+ newItem.addActionListener(this);
290377 loadItem.addActionListener(this);
291378 saveItem.addActionListener(this);
292379 saveAsItem.addActionListener(this);
....@@ -295,79 +382,59 @@
295382 //povItem.addActionListener(this);
296383 closeItem.addActionListener(this);
297384
298
- menuBar.add(cameraMenu = new Menu("View"));
299
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
300
- //zBufferItem.addActionListener(this);
301
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
302
- //normalLensItem.addActionListener(this);
303
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
304
- revertCameraItem.addActionListener(this);
305
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
- toggleTimelineItem.addItemListener(this);
307
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308
- toggleFullScreenItem.addItemListener(this);
309
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
310
- cameraMenu.add("-");
311
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
312
- toggleTextureItem.addItemListener(this);
313
- toggleTextureItem.setState(CameraPane.textureon);
314
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
315
- toggleLiveItem.addItemListener(this);
316
- toggleLiveItem.setState(Globals.isLIVE());
317
- cameraMenu.add(stepItem = new MenuItem("Step"));
318
- stepItem.addActionListener(this);
319
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
320
-// toggleDLItem.addItemListener(this);
321
-// toggleDLItem.setState(false);
322
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
323
- toggleRenderItem.addItemListener(this);
324
- toggleRenderItem.setState(!CameraPane.frozen);
325
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
326
- toggleDebugItem.addItemListener(this);
327
- toggleDebugItem.setState(CameraPane.DEBUG);
328
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
329
- toggleFrustumItem.addItemListener(this);
330
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
331
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
332
- toggleFootContactItem.addItemListener(this);
333
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
334
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
335
- toggleRandomItem.addItemListener(this);
336
- toggleRandomItem.setState(CameraPane.RANDOM);
337
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
338
- toggleHandleItem.addItemListener(this);
339
- toggleHandleItem.setState(CameraPane.HANDLES);
340
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
341
- togglePaintItem.addItemListener(this);
342
- togglePaintItem.setState(CameraPane.PAINTMODE);
343
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
344
-// toggleRootItem.addItemListener(this);
345
-// toggleRootItem.setState(false);
346
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
347
-// animationItem.addItemListener(this);
348
-// animationItem.setState(CameraPane.ANIMATION);
349
- cameraMenu.add("-");
350
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
351
- editCameraItem.addActionListener(this);
352
-
353385 objectPanel = new JTabbedPane();
386
+
387
+ ChangeListener changeListener = new ChangeListener()
388
+ {
389
+ public void stateChanged(ChangeEvent changeEvent)
390
+ {
391
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
392
+// {
393
+// if (latestObject != null)
394
+// {
395
+// refreshContents(true);
396
+// SetMaterial(latestObject);
397
+// }
398
+//
399
+// materialFlushed = true;
400
+// }
401
+
402
+ refreshContents(false); // To refresh Info tab
403
+ }
404
+ };
405
+ objectPanel.addChangeListener(changeListener);
406
+
354407 toolbarPanel = new JPanel();
355408 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
409
+ treePanel = new cGridBag();
357410 treePanel.setName("Tree");
358
- ctrlPanel = new JPanel(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
411
+
412
+ editPanel = new cGridBag().setVertical(true);
413
+ editPanel.setName("Edit");
414
+
415
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
416
+
417
+ editCommandsPanel = new cGridBag();
418
+ editPanel.add(editCommandsPanel);
419
+ editPanel.add(ctrlPanel);
420
+
421
+ toolboxPanel = new cGridBag().setVertical(false);
422
+ toolboxPanel.setName("Toolbox");
423
+
424
+ materialPanel = new cGridBag().setVertical(true);
361425 materialPanel.setName("Material");
426
+
362427 /*JTextPane*/
363428 infoarea = createTextPane();
429
+ doc = infoarea.getStyledDocument();
430
+
364431 infoarea.setEditable(true);
365432 SetText();
366433 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367434 // infoarea.setOpaque(false);
368435 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
436
+// TEXTAREA infoarea.setLineWrap(true);
437
+// TEXTAREA infoarea.setWrapStyleWord(true);
371438 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372439 infoPanel.setPreferredSize(new Dimension(50, 200));
373440 infoPanel.setName("Info");
....@@ -378,16 +445,16 @@
378445 mainPanel.setName("Main");
379446 mainPanel.setContinuousLayout(true);
380447 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382448 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
449
+ mainPanel.setDividerLocation(0.5); //1.0);
450
+ mainPanel.setResizeWeight(0.5);
384451
385452 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386453 //mainPanel.setLayout(new GridBagLayout());
387454 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
455
+// treePanel.setLayout(new GridBagLayout());
456
+ //ctrlPanel.setLayout(new GridBagLayout());
457
+ //materialPanel.setLayout(new GridBagLayout());
391458
392459 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393460 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +493,7 @@
426493 static String newline = "\n";
427494 protected static final String buttonString = "JButton";
428495 StyledDocument doc;
429
- JTextArea infoarea;
496
+ JTextPane infoarea;
430497
431498 void ClearInfo()
432499 {
....@@ -449,10 +516,10 @@
449516 e.printStackTrace();
450517 }
451518
452
- String selection = infoarea.getText();
453
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
454
- java.awt.datatransfer.Clipboard clipboard =
455
- Toolkit.getDefaultToolkit().getSystemClipboard();
519
+// String selection = infoarea.getText();
520
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
521
+// java.awt.datatransfer.Clipboard clipboard =
522
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456523 //clipboard.setContents(data, data);
457524 }
458525
....@@ -475,13 +542,13 @@
475542 //SendInfo("Name:", "bold");
476543 if (sel.GetTextures() != null || debug)
477544 {
478
- si.SendInfo(sel.toString(), "bold");
545
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479546 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480547 if (sel.Size() > 0)
481548 {
482549 si.SendInfo("#children = " + sel.Size(), "regular");
483550 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
551
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485552 if (debug)
486553 {
487554 try
....@@ -493,7 +560,10 @@
493560 }
494561
495562 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
563
+ {
564
+ si.SendInfo(" BBox min: " + minima, "regular");
565
+ si.SendInfo(" BBox max: " + maxima, "regular");
566
+ }
497567
498568 if (sel.bRep != null)
499569 {
....@@ -520,7 +590,7 @@
520590 }
521591 if (sel.support != null)
522592 {
523
- si.SendInfo(" support: " + sel.support, "regular");
593
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524594 }
525595 if (sel.scriptnode != null)
526596 {
....@@ -591,6 +661,9 @@
591661 {
592662 CameraPane.pointflow = (PointFlow) sel;
593663 }
664
+
665
+ si.SendInfo("_____________________", "regular");
666
+ si.SendInfo("", "regular");
594667 }
595668 }
596669
....@@ -606,68 +679,140 @@
606679 }
607680 }
608681
682
+static GraphicsDevice device = GraphicsEnvironment
683
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
684
+
685
+ Rectangle keeprect;
686
+ cRadio radio;
687
+
688
+cButton keepButton;
689
+ cButton twoButton; // Full 3D
690
+ cButton sixButton;
691
+ cButton threeButton;
692
+ cButton sevenButton;
693
+ cButton fourButton; // full panel
694
+ cButton oneButton; // full XYZ
695
+ //cButton currentLayout;
696
+
697
+ boolean maximized;
698
+
699
+ cButton fullscreenLayout;
700
+
701
+ void Minimize()
702
+ {
703
+ frame.setState(Frame.ICONIFIED);
704
+ }
705
+
706
+ void Maximize()
707
+ {
708
+ if (maximized)
709
+ {
710
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
711
+ }
712
+ else
713
+ {
714
+ keeprect = frame.getBounds();
715
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
716
+ Dimension rect2 = frame.getToolkit().getScreenSize();
717
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
718
+// frame.setState(Frame.MAXIMIZED_BOTH);
719
+ }
720
+
721
+ maximized ^= true;
722
+ }
723
+
609724 void ToggleFullScreen()
610725 {
611
- if (CameraPane.FULLSCREEN)
726
+ cameraView.ToggleFullScreen();
727
+
728
+ if (!CameraPane.FULLSCREEN)
612729 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
730
+ device.setFullScreenWindow(null);
731
+ //frame.setVisible(false);
732
+// frame.removeNotify();
733
+// frame.setUndecorated(false);
734
+// frame.addNotify();
735
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
736
+
737
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
738
+// X framePanel.add(bigThree);
739
+// X frame.getContentPane().add(/*"Center",*/framePanel);
740
+ framePanel.setDividerLocation(1);
741
+
742
+ //frame.setVisible(true);
743
+ radio.layout = keepButton;
744
+ //theFrame = null;
745
+ keepButton = null;
746
+ radio.layout.doClick();
747
+
616748 } else
617749 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
750
+ keepButton = radio.layout;
751
+ //keeprect = frame.getBounds();
752
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
753
+// frame.getToolkit().getScreenSize().height);
754
+ //frame.setVisible(false);
755
+ device.setFullScreenWindow(frame);
756
+// frame.removeNotify();
757
+// frame.setUndecorated(true);
758
+// frame.addNotify();
759
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
760
+// X framePanel.remove(bigThree);
761
+// X frame.getContentPane().add(/*"Center",*/bigThree);
762
+ framePanel.setDividerLocation(0);
763
+
764
+ radio.layout = fullscreenLayout;
765
+ radio.layout.doClick();
766
+ //frame.setVisible(true);
621767 }
622
- cameraView.ToggleFullScreen();
623768 }
624769
625
- private JTextArea createTextPane()
770
+ private JTextPane createTextPane()
626771 {
627
- String[] initString =
628
- {
629
- "This is an editable JTextPane, ", //regular
630
- "another ", //italic
631
- "styled ", //bold
632
- "text ", //small
633
- "component, ", //large
634
- "which supports embedded components..." + newline,//regular
635
- " " + newline, //button
636
- "...and embedded icons..." + newline, //regular
637
- " ", //icon
638
- newline + "JTextPane is a subclass of JEditorPane that "
639
- + "uses a StyledEditorKit and StyledDocument, and provides "
640
- + "cover methods for interacting with those objects."
641
- };
772
+// TEXTAREA String[] initString =
773
+// {
774
+// "This is an editable JTextPane, ", //regular
775
+// "another ", //italic
776
+// "styled ", //bold
777
+// "text ", //small
778
+// "component, ", //large
779
+// "which supports embedded components..." + newline,//regular
780
+// " " + newline, //button
781
+// "...and embedded icons..." + newline, //regular
782
+// " ", //icon
783
+// newline + "JTextPane is a subclass of JEditorPane that "
784
+// + "uses a StyledEditorKit and StyledDocument, and provides "
785
+// + "cover methods for interacting with those objects."
786
+// };
787
+//
788
+// String[] initStyles =
789
+// {
790
+// "regular", "italic", "bold", "small", "large",
791
+// "regular", "button", "regular", "icon",
792
+// "regular"
793
+// };
794
+//
795
+// JTextPane textPane = new JTextPane();
796
+// textPane.setEditable(true);
797
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
798
+// addStylesToDocument(doc);
799
+//
800
+// try
801
+// {
802
+// for (int j = 0; j < 2; j++)
803
+// {
804
+// for (int i = 0; i < initString.length; i++)
805
+// {
806
+// doc.insertString(doc.getLength(), initString[i],
807
+// doc.getStyle(initStyles[i]));
808
+// }
809
+// }
810
+// } catch (BadLocationException ble)
811
+// {
812
+// System.err.println("Couldn't insert initial text into text pane.");
813
+// }
642814
643
- String[] initStyles =
644
- {
645
- "regular", "italic", "bold", "small", "large",
646
- "regular", "button", "regular", "icon",
647
- "regular"
648
- };
649
-
650
- JTextPane textPane = new JTextPane();
651
- textPane.setEditable(true);
652
- /*StyledDocument*/ doc = textPane.getStyledDocument();
653
- addStylesToDocument(doc);
654
-
655
- try
656
- {
657
- for (int j = 0; j < 2; j++)
658
- {
659
- for (int i = 0; i < initString.length; i++)
660
- {
661
- doc.insertString(doc.getLength(), initString[i],
662
- doc.getStyle(initStyles[i]));
663
- }
664
- }
665
- } catch (BadLocationException ble)
666
- {
667
- System.err.println("Couldn't insert initial text into text pane.");
668
- }
669
-
670
- return new JTextArea(); // textPane;
815
+ return new JTextPane(); // textPane;
671816 }
672817
673818 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +865,7 @@
720865 protected static ImageIcon createImageIcon(String path,
721866 String description)
722867 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
868
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724869 if (imgURL != null)
725870 {
726871 return new ImageIcon(imgURL, description);
....@@ -752,6 +897,7 @@
752897 // NumberSlider vDivsField;
753898 // JCheckBox endcaps;
754899 JCheckBox liveCB;
900
+ JCheckBox selectCB;
755901 JCheckBox hideCB;
756902 JCheckBox link2masterCB;
757903 JCheckBox markCB;
....@@ -759,7 +905,12 @@
759905 JCheckBox speedupCB;
760906 JCheckBox rewindCB;
761907 JCheckBox flipVCB;
908
+
909
+ cCheckBox toggleTextureCB;
910
+ cCheckBox toggleSwitchCB;
911
+
762912 JComboBox texresMenu;
913
+
763914 JButton resetButton;
764915 JButton stepButton;
765916 JButton stepAllButton;
....@@ -767,115 +918,87 @@
767918 JButton slowerButton;
768919 JButton fasterButton;
769920 JButton remarkButton;
921
+
922
+ cGridBag editPanel;
923
+ cGridBag editCommandsPanel;
924
+
925
+ cGridBag namePanel;
926
+ cGridBag setupPanel;
927
+ cGridBag setupPanel2;
928
+ cGridBag objectCommandsPanel;
929
+ cGridBag pushPanel;
930
+ cGridBag fillPanel;
770931
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
932
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
772933 {
773934 JCheckBox cb;
774935
775
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
776
- oe.aConstraints.gridwidth = 1; // 3;
777
-// oe.aConstraints.weightx = 1;
778
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
779
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
936
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
780937 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
784938
785939 return cb;
786940 }
787941
788
- cButton AddButton(ObjEditor oe, String label)
942
+ cButton AddButton(cGridBag panel, String label)
789943 {
790944 cButton cb;
791945
792
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
793
- oe.aConstraints.gridwidth = 1;
794
-// oe.aConstraints.weightx = 1;
795
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
796
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
946
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
797947 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
801948
802949 return cb;
803950 }
804951
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
952
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
806953 {
807954 JComboBox combo;
808955
809
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
810
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
811
- oe.aConstraints.gridx += 1;
956
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
812957 combo.addActionListener(this);
813958
814959 return combo;
815960 }
816961
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
962
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
818963 {
819
- NumberSlider combo;
964
+ cGridBag control = new cGridBag();
965
+
966
+ cNumberSlider combo;
820967
821968 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
824969 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 1;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
970
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
971
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
834972 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
973
+
974
+ panel.add(control);
975
+
976
+ return control;
841977 }
842978
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
979
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
844980 {
845
- NumberSlider combo;
981
+ cGridBag control = new cGridBag();
982
+
983
+ cNumberSlider combo;
846984
847985 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
850986 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
851
- aConstraints.gridwidth = 2;
852
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
855
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
856
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
857
- aConstraints.gridx += 1;
858
- aConstraints.gridwidth = 1;
859
-
987
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
988
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
860989 combo.setInteger(current);
861990
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
991
+ panel.add(control);
992
+
993
+ return control;
867994 }
868995
869
- JTextArea AddText(JPanel ctrlPanel, String name)
996
+ JTextArea AddText(cGridBag ctrlPanel, String name)
870997 {
871998 JTextArea text;
872999
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1000
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8761001 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
8791002
8801003 return text;
8811004 }
....@@ -905,9 +1028,16 @@
9051028 objEditor.ctrlPanel.remove(j);
9061029 }
9071030
1031
+ void Remove(cNumberSlider j)
1032
+ {
1033
+ j.removeChangeListener(this);
1034
+ //objEditor.ctrlPanel.remove(j.label);
1035
+ objEditor.ctrlPanel.remove(j);
1036
+ }
1037
+
9081038 /*
9091039 */
910
- void Return() // ObjEditor oe)
1040
+ void Return0() // ObjEditor oe)
9111041 {
9121042 aConstraints.gridy += 1;
9131043 aConstraints.gridx = 0;
....@@ -962,37 +1092,76 @@
9621092
9631093 void SetupUI2(ObjEditor oe)
9641094 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
1095
+ //SetupName(oe);
1096
+
1097
+ namePanel = new cGridBag();
1098
+
1099
+ nameField = AddText(namePanel, copy.GetName());
1100
+ namePanel.add(nameField);
1101
+ oe.ctrlPanel.add(namePanel);
1102
+
1103
+ oe.ctrlPanel.Return();
9701104
9711105 if (!GroupEditor.allparams)
9721106 return;
9731107
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1108
+ setupPanel = new cGridBag().setVertical(false);
1109
+
1110
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1111
+ liveCB.setToolTipText("Animate object");
1112
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1113
+ selectCB.setToolTipText("Make object selectable");
9771114 // Return();
978
- markCB = AddCheckBox(oe, "Mark", copy.marked);
979
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
980
- randomCB = AddCheckBox(oe, "Rand", copy.random);
981
- Return();
982
- resetButton = AddButton(oe, "Reset");
983
- stepButton = AddButton(oe, "Step");
1115
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1116
+ hideCB.setToolTipText("Hide object");
1117
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1118
+ markCB.setToolTipText("Set the animation target transform");
1119
+
1120
+ setupPanel2 = new cGridBag().setVertical(false);
1121
+
1122
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1123
+ rewindCB.setToolTipText("Rewind animation");
1124
+
1125
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1126
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1127
+
1128
+ if (Globals.ADVANCED)
1129
+ {
1130
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1131
+ link2masterCB.setToolTipText("Attach to support");
1132
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1133
+ speedupCB.setToolTipText("Option motion capture");
1134
+ }
1135
+
1136
+ oe.ctrlPanel.add(setupPanel);
1137
+ oe.ctrlPanel.Return();
1138
+ oe.ctrlPanel.add(setupPanel2);
1139
+ oe.ctrlPanel.Return();
1140
+
1141
+ objectCommandsPanel = new cGridBag().setVertical(false);
1142
+
1143
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1144
+ resetButton.setToolTipText("Jump to frame zero");
1145
+ stepButton = AddButton(objectCommandsPanel, "Step");
1146
+ stepButton.setToolTipText("Step one frame");
9841147 // resetAllButton = AddButton(oe, "Reset All");
9851148 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9871149 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
1150
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1151
+ slowerButton.setToolTipText("Decrease animation speed");
1152
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1153
+ fasterButton.setToolTipText("Increase animation speed");
1154
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1155
+ remarkButton.setToolTipText("Set the current transform as the target");
9911156
992
- Return();
1157
+ oe.ctrlPanel.add(objectCommandsPanel);
1158
+ oe.ctrlPanel.Return();
9931159
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
1160
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1161
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1162
+ //Return();
1163
+
1164
+ oe.ctrlPanel.Return();
9961165
9971166 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9981167 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1256,7 @@
10871256 oe.aConstraints.gridwidth = 1;
10881257 /**/
10891258 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1259
+ oe.ctrlPanel.Return();
10911260
10921261 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931262 //textureButton.setEnabled(false);
....@@ -1191,8 +1360,11 @@
11911360 //worldPanel.setName("World");
11921361 centralPanel = new cGridBag();
11931362 centralPanel.preferredWidth = 20;
1194
- timelinePanel = new JPanel(new BorderLayout());
1195
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1363
+
1364
+ if (Globals.ADVANCED)
1365
+ {
1366
+ timelinePanel = new JPanel(new BorderLayout());
1367
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11961368
11971369 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11981370 cameraPanel.setContinuousLayout(true);
....@@ -1201,7 +1373,10 @@
12011373 // cameraPanel.setDividerSize(9);
12021374 cameraPanel.setResizeWeight(1.0);
12031375
1376
+ }
1377
+
12041378 centralPanel.add(cameraView);
1379
+ centralPanel.setFocusable(true);
12051380 //frame.setJMenuBar(timelineMenubar);
12061381 //centralPanel.add(timelinePanel);
12071382
....@@ -1264,10 +1439,12 @@
12641439 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12651440 //tmp.setName("Edit");
12661441 objectPanel.add(materialPanel);
1267
- JPanel north = new JPanel(new BorderLayout());
1268
- north.setName("Edit");
1269
- north.add(ctrlPanel, BorderLayout.NORTH);
1270
- objectPanel.add(north);
1442
+ objectPanel.add(toolboxPanel);
1443
+// JPanel north = new JPanel(new BorderLayout());
1444
+// north.setName("Edit");
1445
+// north.add(ctrlPanel, BorderLayout.NORTH);
1446
+// objectPanel.add(north);
1447
+ objectPanel.add(editPanel);
12711448 objectPanel.add(infoPanel);
12721449
12731450 /*
....@@ -1289,21 +1466,21 @@
12891466 scrollpane.addMouseWheelListener(this); // Default not fast enough
12901467
12911468 /*JTabbedPane*/ scenePanel = new cGridBag();
1292
- scenePanel.preferredWidth = 7;
1469
+ scenePanel.preferredWidth = 6;
12931470
12941471 JTabbedPane tabbedPane = new JTabbedPane();
12951472 tabbedPane.add(scrollpane);
12961473
1297
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1298
-
1299
- optionsPanel = new JPanel(new GridBagLayout());
1474
+ optionsPanel = new cGridBag().setVertical(false);
13001475
13011476 optionsPanel.setName("Options");
13021477
1303
- AddOptions(optionsPanel, aConstraints);
1478
+ AddOptions(optionsPanel); //, aConstraints);
13041479
13051480 tabbedPane.add(optionsPanel);
13061481
1482
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1483
+
13071484 scenePanel.add(tabbedPane);
13081485
13091486 /*
....@@ -1395,9 +1572,13 @@
13951572
13961573 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13971574
1398
- frame.setSize(1024, 768);
1399
- frame.show();
1575
+ frame.setSize(1280, 860);
1576
+
1577
+ frame.validate();
1578
+ frame.setVisible(true);
14001579
1580
+ cameraView.requestFocusInWindow();
1581
+
14011582 gridPanel.setDividerLocation(1.0);
14021583
14031584 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1411,7 +1592,7 @@
14111592 });
14121593 }
14131594
1414
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1595
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14151596 {
14161597 }
14171598
....@@ -1426,260 +1607,173 @@
14261607 ctrlPanel.removeAll();
14271608 }
14281609
1429
- void SetupMaterial(JPanel ctrlPanel)
1610
+ void SetupMaterial(cGridBag panel)
14301611 {
1431
- aConstraints.weighty = 0;
1432
- //aConstraints.weightx = 1;
1433
- /*
1612
+ /*
14341613 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14351614 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1436
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1437
- aConstraints.gridx += 1;
14381615 */
14391616
1440
- aConstraints.gridwidth = 1;
1441
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
1617
+ cGridBag editBar = new cGridBag().setVertical(false);
1618
+
1619
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1620
+ createMaterialButton.setToolTipText("Create material");
14451621
14461622 /*
14471623 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1448
- aConstraints.gridx += 1;
1449
- aConstraints.weighty = 0;
1450
- aConstraints.gridwidth = 1;
14511624 */
14521625
1453
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1454
- aConstraints.gridx += 1;
1626
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1627
+ clearMaterialButton.setToolTipText("Clear material");
1628
+
1629
+ if (Globals.ADVANCED)
1630
+ {
1631
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1632
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1633
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1634
+ }
14551635
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;
1636
+ editBar.preferredHeight = 15;
1637
+
1638
+ panel.add(editBar);
1639
+
14701640 /**/
14711641 //aConstraints.weighty = 0;
14721642 ////aConstraints.weightx = 1;
14731643 //aConstraints.weighty = 1;
14741644 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14751645 //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;
1646
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14811647
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;
1648
+ cGridBag colorSection = new cGridBag().setVertical(true);
1649
+
1650
+ cGridBag color = new cGridBag();
1651
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1652
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1653
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1654
+ //colorField.preferredWidth = 200;
1655
+ colorSection.add(color);
14921656
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;
1657
+ cGridBag modulation = new cGridBag();
1658
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1659
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1660
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1661
+ colorSection.add(modulation);
15021662
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;
1663
+ cGridBag texture = new cGridBag();
1664
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1665
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1666
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1667
+ colorSection.add(texture);
15121668
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;
1669
+ cGridBag anisoU = new cGridBag();
1670
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1671
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1673
+ colorSection.add(anisoU);
15221674
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;
1675
+ cGridBag anisoV = new cGridBag();
1676
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1677
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1678
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1679
+ colorSection.add(anisoV);
15321680
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;
1681
+ cGridBag shadowbias = new cGridBag();
1682
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1683
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1684
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1685
+ colorSection.add(shadowbias);
15421686
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;
1687
+ panel.add(new JSeparator());
1688
+
1689
+ panel.add(colorSection);
1690
+
1691
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1692
+
1693
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1694
+
1695
+ cGridBag diffuse = new cGridBag();
1696
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1697
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1699
+ diffuseSection.add(diffuse);
15511700
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;
1701
+ cGridBag diffuseness = new cGridBag();
1702
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1703
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1704
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1705
+ diffuseSection.add(diffuseness);
15611706
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;
1707
+ cGridBag selfshadow = new cGridBag();
1708
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1709
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1710
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1711
+ diffuseSection.add(selfshadow);
15711712
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;
1713
+ cGridBag sheen = new cGridBag();
1714
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1715
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1716
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1717
+ diffuseSection.add(sheen);
15811718
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;
1719
+ cGridBag subsurface = new cGridBag();
1720
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1721
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1722
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1723
+ diffuseSection.add(subsurface);
15911724
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;
1725
+ cGridBag shadow = new cGridBag();
1726
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1727
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1728
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1729
+ diffuseSection.add(shadow);
16011730
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;
1731
+ cGridBag fakedepth = new cGridBag();
1732
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1733
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1734
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1735
+ diffuseSection.add(fakedepth);
16111736
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;
1737
+ panel.add(new JSeparator());
1738
+
1739
+ panel.add(diffuseSection);
1740
+
1741
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1742
+
1743
+ cGridBag specularSection = new cGridBag().setVertical(true);
16211744
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;
1745
+ cGridBag specular = new cGridBag();
1746
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1747
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1748
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1749
+ specularSection.add(specular);
16301750
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;
1751
+ cGridBag lightarea = new cGridBag();
1752
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1753
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1754
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1755
+ specularSection.add(lightarea);
16401756
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;
1757
+ cGridBag shininess = new cGridBag();
1758
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1759
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1760
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1761
+ specularSection.add(shininess);
16501762
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;
1763
+ cGridBag metalness = new cGridBag();
1764
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1765
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1766
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1767
+ specularSection.add(metalness);
16601768
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;
1769
+ cGridBag velvet = new cGridBag();
1770
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1771
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1772
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1773
+ specularSection.add(velvet);
16701774
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();
1775
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1776
+ //Return();
16831777 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16841778 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16851779 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1690,130 +1784,93 @@
16901784 // aConstraints.gridy += 1;
16911785 // aConstraints.gridwidth = 1;
16921786
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;
17011787
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;
1788
+ panel.add(new JSeparator());
1789
+
1790
+ panel.add(specularSection);
1791
+
1792
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1793
+
1794
+ cGridBag globalSection = new cGridBag().setVertical(true);
17111795
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;
1796
+ cGridBag camera = new cGridBag();
1797
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1798
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1799
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1800
+ globalSection.add(camera);
17211801
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;
1802
+ cGridBag ambient = new cGridBag();
1803
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1804
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1805
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1806
+ globalSection.add(ambient);
17311807
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;
1808
+ cGridBag backlit = new cGridBag();
1809
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1810
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1811
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1812
+ globalSection.add(backlit);
17421813
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;
1814
+ cGridBag opacity = new cGridBag();
1815
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1816
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1817
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1818
+ globalSection.add(opacity);
17521819
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;
1820
+ panel.add(new JSeparator());
1821
+
1822
+ panel.add(globalSection);
1823
+
1824
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1825
+
1826
+ cGridBag textureSection = new cGridBag().setVertical(true);
17621827
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;
1828
+ cGridBag bump = new cGridBag();
1829
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1830
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1831
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1832
+ textureSection.add(bump);
17721833
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;
1834
+ cGridBag noise = new cGridBag();
1835
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1836
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1837
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1838
+ textureSection.add(noise);
17821839
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;
1840
+ cGridBag power = new cGridBag();
1841
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1842
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1843
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1844
+ textureSection.add(power);
17921845
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;
1846
+ cGridBag borderfade = new cGridBag();
1847
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1848
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1849
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1850
+ textureSection.add(borderfade);
18021851
1803
- //aConstraints.weighty = 1;
1804
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1805
- //aConstraints.gridx += 1;
1806
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1807
- aConstraints.weighty = 0;
1852
+ cGridBag fog = new cGridBag();
1853
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1854
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1855
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1856
+ textureSection.add(fog);
18081857
1809
- aConstraints.gridx = 0;
1810
- aConstraints.gridy = 0;
1811
- aConstraints.gridwidth = 1;
1858
+ cGridBag opacityPower = new cGridBag();
1859
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1860
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1861
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1862
+ textureSection.add(opacityPower);
1863
+
1864
+ panel.add(new JSeparator());
1865
+
1866
+ panel.add(textureSection);
1867
+
1868
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18121869
18131870 SetMaterial(copy); // .GetMaterial());
18141871
1815
- colorField.addChangeListener(this);
1816
- modulationField.addChangeListener(this);
1872
+ //colorField.addChangeListener(this);
1873
+// modulationField.addChangeListener(this);
18171874 metalnessField.addChangeListener(this);
18181875 diffuseField.addChangeListener(this);
18191876 specularField.addChangeListener(this);
....@@ -1843,12 +1900,15 @@
18431900 opacityPowerField.addChangeListener(this);
18441901 /**/
18451902
1846
- resetSlidersButton.addActionListener(this);
18471903 clearMaterialButton.addActionListener(this);
18481904 createMaterialButton.addActionListener(this);
1849
-
1850
- propagateToggle.addItemListener(this);
1851
- multiplyToggle.addItemListener(this);
1905
+
1906
+ if (Globals.ADVANCED)
1907
+ {
1908
+ resetSlidersButton.addActionListener(this);
1909
+ propagateToggle.addItemListener(this);
1910
+ multiplyToggle.addItemListener(this);
1911
+ }
18521912 }
18531913
18541914 void DropFile(java.io.File[] files, boolean textures)
....@@ -2019,7 +2079,7 @@
20192079
20202080 //? flashIt = false;
20212081 CameraPane pane = (CameraPane) cameraView;
2022
- pane.clickStart(location.x, location.y, 0);
2082
+ pane.clickStart(location.x, location.y, 0, 0);
20232083 pane.clickEnd(location.x, location.y, 0, true);
20242084
20252085 if (group.selection.size() == 1)
....@@ -2068,6 +2128,7 @@
20682128 e2.printStackTrace();
20692129 }
20702130 }
2131
+
20712132 LoadJMEThread loadThread;
20722133
20732134 class LoadJMEThread extends Thread
....@@ -2125,6 +2186,7 @@
21252186 //LoadFile0(filename, converter);
21262187 }
21272188 }
2189
+
21282190 LoadOBJThread loadObjThread;
21292191
21302192 class LoadOBJThread extends Thread
....@@ -2203,19 +2265,19 @@
22032265
22042266 void LoadObjFile(String fullname)
22052267 {
2206
- /*
2268
+ System.out.println("Loading " + fullname);
2269
+ /**/
22072270 //lastFilename = fullname;
22082271 if(loadObjThread == null)
22092272 {
2210
- loadObjThread = new LoadOBJThread();
2211
- loadObjThread.start();
2273
+ loadObjThread = new LoadOBJThread();
2274
+ loadObjThread.start();
22122275 }
22132276
22142277 loadObjThread.add(fullname);
2215
- */
2278
+ /**/
22162279
2217
- System.out.println("Loading " + fullname);
2218
- makeSomething(new FileObject(fullname, true), true);
2280
+ //makeSomething(new FileObject(fullname, true), true);
22192281 }
22202282
22212283 void LoadGFDFile(String fullname)
....@@ -2476,11 +2538,11 @@
24762538
24772539 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24782540 {
2479
- if (GrafreeD.standAlone)
2541
+ if (Grafreed.standAlone)
24802542 {
24812543 /**/
24822544 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2483
- browser.show();
2545
+ browser.setVisible(true);
24842546 String filename = browser.getFile();
24852547 if (filename != null && filename.length() > 0)
24862548 {
....@@ -2625,6 +2687,7 @@
26252687 }
26262688 if (input == null)
26272689 {
2690
+ new Exception().printStackTrace();
26282691 System.exit(0);
26292692 }
26302693
....@@ -2831,6 +2894,8 @@
28312894
28322895 void SetMaterial(Object3D object)
28332896 {
2897
+ latestObject = object;
2898
+
28342899 cMaterial mat = object.material;
28352900
28362901 if (mat == null)
....@@ -2839,7 +2904,8 @@
28392904 return;
28402905 }
28412906
2842
- multiplyToggle.setSelected(mat.multiply);
2907
+ if (multiplyToggle != null)
2908
+ multiplyToggle.setSelected(mat.multiply);
28432909
28442910 assert (object.projectedVertices != null);
28452911
....@@ -3015,7 +3081,7 @@
30153081 cameraView.ToggleDL();
30163082 cameraView.repaint();
30173083 return;
3018
- } else if (event.getSource() == toggleTextureItem)
3084
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30193085 {
30203086 cameraView.ToggleTexture();
30213087 // june 2013 copy.HardTouch();
....@@ -3054,9 +3120,9 @@
30543120 frame.validate();
30553121
30563122 return;
3057
- } else if (event.getSource() == toggleRandomItem)
3123
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30583124 {
3059
- cameraView.ToggleRandom();
3125
+ cameraView.ToggleSwitch();
30603126 cameraView.repaint();
30613127 return;
30623128 } else if (event.getSource() == toggleHandleItem)
....@@ -3085,6 +3151,10 @@
30853151 {
30863152 copy.live ^= true;
30873153 return;
3154
+ } else if (event.getSource() == selectCB)
3155
+ {
3156
+ copy.dontselect ^= true;
3157
+ return;
30883158 } else if (event.getSource() == hideCB)
30893159 {
30903160 copy.hide ^= true;
....@@ -3099,6 +3169,7 @@
30993169 if (event.getSource() == randomCB)
31003170 {
31013171 copy.random ^= true;
3172
+ objEditor.refreshContents();
31023173 return;
31033174 }
31043175 if (event.getSource() == speedupCB)
....@@ -3122,8 +3193,9 @@
31223193
31233194 public void actionPerformed(ActionEvent event)
31243195 {
3196
+ Object source = event.getSource();
31253197 // SCRIPT DIALOG
3126
- if (event.getSource() == okbutton)
3198
+ if (source == okbutton)
31273199 {
31283200 textpanel.setVisible(false);
31293201 textpanel.remove(textarea);
....@@ -3135,7 +3207,7 @@
31353207 textarea = null;
31363208 textpanel = null;
31373209 }
3138
- if (event.getSource() == cancelbutton)
3210
+ if (source == cancelbutton)
31393211 {
31403212 textpanel.setVisible(false);
31413213 textpanel.remove(textarea);
....@@ -3147,50 +3219,50 @@
31473219 //applySelf();
31483220 //client.refreshEditWindow();
31493221 //refreshContents();
3150
- if (event.getSource() == nameField)
3222
+ if (source == nameField)
31513223 {
31523224 //System.out.println("ObjEditor " + event);
31533225 applySelf0(true);
31543226 //parent.applySelf();
31553227 objEditor.refreshContents();
3156
- } else if (event.getSource() == resetButton)
3228
+ } else if (source == resetButton)
31573229 {
31583230 CameraPane.fullreset = true;
31593231 copy.Reset(); // ResetMeshes();
31603232 copy.Touch();
31613233 objEditor.refreshContents();
3162
- } else if (event.getSource() == stepItem)
3234
+ } else if (source == stepItem)
31633235 {
31643236 //cameraView.ONESTEP = true;
31653237 Globals.ONESTEP = true;
31663238 cameraView.repaint();
31673239 return;
3168
- } else if (event.getSource() == stepButton)
3240
+ } else if (source == stepButton)
31693241 {
31703242 copy.Step();
31713243 copy.Touch();
31723244 objEditor.refreshContents();
3173
- } else if (event.getSource() == slowerButton)
3245
+ } else if (source == slowerButton)
31743246 {
31753247 copy.Slower();
31763248 copy.Touch();
31773249 objEditor.refreshContents();
3178
- } else if (event.getSource() == fasterButton)
3250
+ } else if (source == fasterButton)
31793251 {
31803252 copy.Faster();
31813253 copy.Touch();
31823254 objEditor.refreshContents();
3183
- } else if (event.getSource() == remarkButton)
3255
+ } else if (source == remarkButton)
31843256 {
31853257 copy.Remark();
31863258 copy.Touch();
31873259 objEditor.refreshContents();
3188
- } else if (event.getSource() == stepAllButton)
3260
+ } else if (source == stepAllButton)
31893261 {
31903262 copy.StepAll();
31913263 copy.Touch();
31923264 objEditor.refreshContents();
3193
- } else if (event.getSource() == resetAllButton)
3265
+ } else if (source == resetAllButton)
31943266 {
31953267 //CameraPane.fullreset = true;
31963268 copy.ResetAll(); // ResetMeshes();
....@@ -3223,53 +3295,75 @@
32233295 // Close();
32243296 // }
32253297 // else
3226
- if (event.getSource() == resetSlidersButton)
3298
+ if (source == resetSlidersButton)
32273299 {
32283300 ResetSliders();
3229
- } else if (event.getSource() == clearMaterialButton)
3301
+ } else if (source == clearMaterialButton)
32303302 {
32313303 ClearMaterial();
3232
- } else if (event.getSource() == createMaterialButton)
3304
+ } else if (source == createMaterialButton)
32333305 {
32343306 CreateMaterial();
3235
- } else if (event.getSource() == clearPanelButton)
3307
+ } else if (source == clearPanelButton)
32363308 {
32373309 copy.ClearUI();
32383310 refreshContents(true);
3239
- } /*
3240
- }
3241
-
3242
- public boolean action(Event event, Object arg)
3243
- {
3244
- */ else if (event.getSource() == closeItem)
3311
+ } else if (source == importGFDItem)
3312
+ {
3313
+ ImportGFD();
3314
+ } else
3315
+ if (source == importVRMLX3DItem)
3316
+ {
3317
+ ImportVRMLX3D();
3318
+ } else
3319
+ if (source == import3DSItem)
3320
+ {
3321
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3322
+ } else
3323
+ if (source == importOBJItem)
3324
+ {
3325
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3326
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3327
+ browser.setVisible(true);
3328
+ String filename = browser.getFile();
3329
+ if (filename != null && filename.length() > 0)
3330
+ {
3331
+ String fullname = browser.getDirectory() + filename;
3332
+ makeSomething(ReadOBJ(fullname), true);
3333
+ }
3334
+ } else
3335
+ if (source == closeItem)
32453336 {
32463337 Close();
32473338 //return true;
3248
- } else if (event.getSource() == loadItem)
3339
+ } else if (source == loadItem)
32493340 {
32503341 load();
32513342 //return true;
3252
- } else if (event.getSource() == saveItem)
3343
+ } else if (source == newItem)
3344
+ {
3345
+ New();
3346
+ } else if (source == saveItem)
32533347 {
32543348 save();
32553349 //return true;
3256
- } else if (event.getSource() == saveAsItem)
3350
+ } else if (source == saveAsItem)
32573351 {
32583352 saveAs();
32593353 //return true;
3260
- } else if (event.getSource() == reexportItem)
3354
+ } else if (source == reexportItem)
32613355 {
32623356 reexport();
32633357 //return true;
3264
- } else if (event.getSource() == exportAsItem)
3358
+ } else if (source == exportAsItem)
32653359 {
32663360 export();
32673361 //return true;
3268
- } else if (event.getSource() == povItem)
3362
+ } else if (source == povItem)
32693363 {
32703364 generatePOV();
32713365 //return true;
3272
- } else if (event.getSource() == zBufferItem)
3366
+ } else if (source == zBufferItem)
32733367 {
32743368 try
32753369 {
....@@ -3291,21 +3385,8 @@
32913385 cameraView.repaint();
32923386 //return true;
32933387 }
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)
3388
+ */ else // combos...
3389
+ if (source == texresMenu)
33093390 {
33103391 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33113392 copy.texres = texresMenu.getSelectedIndex();
....@@ -3317,12 +3398,272 @@
33173398 }
33183399 }
33193400
3401
+ void New()
3402
+ {
3403
+ while (copy.Size() > 1)
3404
+ {
3405
+ copy.remove(1);
3406
+ }
3407
+
3408
+ ResetModel();
3409
+ objEditor.refreshContents();
3410
+ }
3411
+
3412
+ static public byte[] Compress(Object3D o)
3413
+ {
3414
+ try
3415
+ {
3416
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3417
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3418
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3419
+
3420
+ Object3D parent = o.parent;
3421
+ o.parent = null;
3422
+
3423
+ out.writeObject(o);
3424
+
3425
+ o.parent = parent;
3426
+
3427
+ out.flush();
3428
+
3429
+ zstream.close();
3430
+ out.close();
3431
+
3432
+ return baos.toByteArray();
3433
+ } catch (Exception e)
3434
+ {
3435
+ System.err.println(e);
3436
+ return null;
3437
+ }
3438
+ }
3439
+
3440
+ static public Object Uncompress(byte[] bytes)
3441
+ {
3442
+ System.out.println("#bytes = " + bytes.length);
3443
+ try
3444
+ {
3445
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3446
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3447
+ ObjectInputStream in = new ObjectInputStream(istream);
3448
+ Object obj = in.readObject();
3449
+ in.close();
3450
+
3451
+ return obj;
3452
+ } catch (Exception e)
3453
+ {
3454
+ System.err.println(e);
3455
+ return null;
3456
+ }
3457
+ }
3458
+
3459
+ static public Object clone(Object o)
3460
+ {
3461
+ try
3462
+ {
3463
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3464
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3465
+
3466
+ out.writeObject(o);
3467
+
3468
+ out.flush();
3469
+ out.close();
3470
+
3471
+ byte[] bytes = baos.toByteArray();
3472
+
3473
+ System.out.println("clone = " + bytes.length);
3474
+
3475
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3476
+ ObjectInputStream in = new ObjectInputStream(bais);
3477
+ Object obj = in.readObject();
3478
+ in.close();
3479
+
3480
+ return obj;
3481
+ } catch (Exception e)
3482
+ {
3483
+ System.err.println(e);
3484
+ return null;
3485
+ }
3486
+ }
3487
+
3488
+ cRadio GetCurrentTab()
3489
+ {
3490
+ cRadio ab;
3491
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3492
+ {
3493
+ ab = (cRadio)e.nextElement();
3494
+ if(ab.GetObject() == copy)
3495
+ {
3496
+ return ab;
3497
+ }
3498
+ }
3499
+
3500
+ return null;
3501
+ }
3502
+
3503
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3504
+
3505
+ public void Save()
3506
+ {
3507
+ System.err.println("Save");
3508
+
3509
+ cRadio tab = GetCurrentTab();
3510
+
3511
+ boolean temp = CameraPane.SWITCH;
3512
+ CameraPane.SWITCH = false;
3513
+
3514
+ copy.ExtractBigData(hashtable);
3515
+
3516
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3517
+ tab.graphs[tab.undoindex++] = Compress(copy);
3518
+
3519
+ copy.RestoreBigData(hashtable);
3520
+
3521
+ CameraPane.SWITCH = temp;
3522
+
3523
+ //assert(hashtable.isEmpty());
3524
+
3525
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3526
+ {
3527
+ tab.graphs[i] = null;
3528
+ }
3529
+
3530
+ // test save
3531
+ if (false)
3532
+ {
3533
+ try
3534
+ {
3535
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3536
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3537
+
3538
+ p.writeObject(copy);
3539
+
3540
+ p.flush();
3541
+
3542
+ ostream.close();
3543
+ } catch (Exception e)
3544
+ {
3545
+ e.printStackTrace();
3546
+ }
3547
+ }
3548
+ }
3549
+
3550
+ void CopyChanged(Object3D obj)
3551
+ {
3552
+ boolean temp = CameraPane.SWITCH;
3553
+ CameraPane.SWITCH = false;
3554
+
3555
+ copy.ExtractBigData(hashtable);
3556
+
3557
+ copy.clear();
3558
+
3559
+ for (int i=0; i<obj.Size(); i++)
3560
+ {
3561
+ copy.add(obj.get(i));
3562
+ }
3563
+
3564
+ copy.RestoreBigData(hashtable);
3565
+
3566
+ CameraPane.SWITCH = temp;
3567
+
3568
+ //assert(hashtable.isEmpty());
3569
+
3570
+ copy.Touch();
3571
+
3572
+ ResetModel();
3573
+ copy.HardTouch(); // recompile?
3574
+
3575
+ cRadio ab;
3576
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3577
+ {
3578
+ ab = (cRadio)e.nextElement();
3579
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3580
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3581
+ if (test != null)
3582
+ {
3583
+ test.editWindow = ab.object.editWindow;
3584
+ ab.object = test;
3585
+ }
3586
+ }
3587
+
3588
+ refreshContents();
3589
+ }
3590
+
3591
+ public void Undo()
3592
+ {
3593
+ System.err.println("Undo");
3594
+
3595
+ cRadio tab = GetCurrentTab();
3596
+
3597
+ if (tab.undoindex == 0)
3598
+ {
3599
+ java.awt.Toolkit.getDefaultToolkit().beep();
3600
+ return;
3601
+ }
3602
+
3603
+ if (tab.graphs[tab.undoindex] == null)
3604
+ {
3605
+ Save();
3606
+ tab.undoindex -= 1;
3607
+ }
3608
+
3609
+ tab.undoindex -= 1;
3610
+
3611
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3612
+ }
3613
+
3614
+ public void Redo()
3615
+ {
3616
+ cRadio tab = GetCurrentTab();
3617
+
3618
+ if (tab.graphs[tab.undoindex + 1] == null)
3619
+ {
3620
+ java.awt.Toolkit.getDefaultToolkit().beep();
3621
+ return;
3622
+ }
3623
+
3624
+ tab.undoindex += 1;
3625
+
3626
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3627
+ }
3628
+
3629
+ void ImportGFD()
3630
+ {
3631
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3632
+ browser.show();
3633
+ String filename = browser.getFile();
3634
+ if (filename != null && filename.length() > 0)
3635
+ {
3636
+ String fullname = browser.getDirectory() + filename;
3637
+
3638
+ //Object3D readobj =
3639
+ objEditor.ReadGFD(fullname, objEditor);
3640
+ //makeSomething(readobj);
3641
+ }
3642
+ }
3643
+
3644
+ void ImportVRMLX3D()
3645
+ {
3646
+ if (Grafreed.standAlone)
3647
+ {
3648
+ /**/
3649
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3650
+ browser.show();
3651
+ String filename = browser.getFile();
3652
+ if (filename != null && filename.length() > 0)
3653
+ {
3654
+ String fullname = browser.getDirectory() + filename;
3655
+ LoadVRMLX3D(fullname);
3656
+ }
3657
+ /**/
3658
+ }
3659
+ }
3660
+
33203661 void ToggleAnimation()
33213662 {
33223663 if (!Globals.ANIMATION)
33233664 {
33243665 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3325
- browser.show();
3666
+ browser.setVisible(true);
33263667 String filename = browser.getFile();
33273668 if (filename != null && filename.length() > 0)
33283669 {
....@@ -3332,8 +3673,8 @@
33323673
33333674 Globals.ANIMATION ^= true;
33343675
3335
- GrafreeD.wav.cursor = 0;
3336
- GrafreeD.wav.loop = 0;
3676
+ Grafreed.wav.cursor = 0;
3677
+ Grafreed.wav.loop = 0;
33373678 }
33383679 } else
33393680 {
....@@ -3383,7 +3724,7 @@
33833724 void CreateMaterial()
33843725 {
33853726 //copy.ClearMaterial(); // PATCH
3386
- copy.CreateMaterialS(multiplyToggle.isSelected());
3727
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33873728 if (copy.selection.size() > 0)
33883729 //SetMaterial(copy);
33893730 {
....@@ -3434,7 +3775,7 @@
34343775 assert false;
34353776 }
34363777
3437
- void EditSelection()
3778
+ void EditSelection(boolean newWindow)
34383779 {
34393780 }
34403781
....@@ -3442,11 +3783,11 @@
34423783 {
34433784 copy.ResetBlockLoop(); // temporary problem
34443785
3445
- boolean random = CameraPane.RANDOM;
3446
- CameraPane.RANDOM = false; // parse everything
3786
+ boolean random = CameraPane.SWITCH;
3787
+ CameraPane.SWITCH = false; // parse everything
34473788 copy.ResetDisplayList();
34483789 copy.HardTouch();
3449
- CameraPane.RANDOM = random;
3790
+ CameraPane.SWITCH = random;
34503791 }
34513792
34523793 // public void applySelf()
....@@ -3516,10 +3857,40 @@
35163857 current.fakedepth = (float) fakedepthField.getFloat();
35173858 current.shadowbias = (float) shadowbiasField.getFloat();
35183859
3519
- if (!NumberSlider.frozen)
3860
+ if (!cNumberSlider.frozen)
35203861 {
35213862 //System.out.println("Propagate = " + propagate);
35223863 copy.UpdateMaterial(anchor, current, propagate);
3864
+
3865
+ if (copy.material != null)
3866
+ {
3867
+ cMaterial mat = copy.material;
3868
+
3869
+ colorField.SetToolTipValue((mat.color));
3870
+ modulationField.SetToolTipValue((mat.modulation));
3871
+ metalnessField.SetToolTipValue((mat.metalness));
3872
+ diffuseField.SetToolTipValue((mat.diffuse));
3873
+ specularField.SetToolTipValue((mat.specular));
3874
+ shininessField.SetToolTipValue((mat.shininess));
3875
+ shiftField.SetToolTipValue((mat.shift));
3876
+ ambientField.SetToolTipValue((mat.ambient));
3877
+ lightareaField.SetToolTipValue((mat.lightarea));
3878
+ diffusenessField.SetToolTipValue((mat.factor));
3879
+ velvetField.SetToolTipValue((mat.velvet));
3880
+ sheenField.SetToolTipValue((mat.sheen));
3881
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3882
+ backlitField.SetToolTipValue((mat.bump));
3883
+ anisoField.SetToolTipValue((mat.aniso));
3884
+ anisoVField.SetToolTipValue((mat.anisoV));
3885
+ cameraField.SetToolTipValue((mat.cameralight));
3886
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3887
+ shadowField.SetToolTipValue((mat.shadow));
3888
+ textureField.SetToolTipValue((mat.texture));
3889
+ opacityField.SetToolTipValue((mat.opacity));
3890
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3891
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3892
+ }
3893
+
35233894 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35243895 {
35253896 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3564,6 +3935,7 @@
35643935 || e.getSource() == apertureField
35653936 || e.getSource() == shadowblurField)
35663937 {
3938
+ new Exception().printStackTrace();
35673939 System.exit(0);
35683940 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35693941 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3634,7 +4006,7 @@
36344006 }
36354007
36364008 if (normalpushField != null)
3637
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4009
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36384010 }
36394011
36404012 void SnapObject()
....@@ -3889,7 +4261,7 @@
38894261
38904262 radioPanel.revalidate();
38914263 radioPanel.repaint();
3892
- ctrlPanel.revalidate(); // ? new
4264
+ ctrlPanel.validate(); // ? new
38934265 ctrlPanel.repaint();
38944266 }
38954267 }
....@@ -3898,6 +4270,8 @@
38984270
38994271 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
39004272 {
4273
+ if (Globals.SAVEONMAKE) // && resetmodel)
4274
+ Save();
39014275 //Tween.set(thing, 0).target(1).start(tweenManager);
39024276 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
39034277 // if (thing instanceof GenericJointDemo)
....@@ -3984,6 +4358,12 @@
39844358 {
39854359 ResetModel();
39864360 Select(thing.GetTreePath(), true, false); // unselect... false);
4361
+
4362
+ if (thing.Size() == 0)
4363
+ {
4364
+ //EditSelection(false);
4365
+ }
4366
+
39874367 refreshContents();
39884368 }
39894369
....@@ -4101,6 +4481,7 @@
41014481 }
41024482 }
41034483 }
4484
+
41044485 LoadGFDThread loadGFDThread;
41054486
41064487 void ReadGFD(String fullname, iCallBack cb)
....@@ -4120,8 +4501,10 @@
41204501
41214502 try
41224503 {
4504
+ // Try compressed version first.
41234505 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4124
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4506
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4507
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41254508
41264509 readobj = (Object3D) p.readObject();
41274510 istream.close();
....@@ -4129,7 +4512,20 @@
41294512 readobj.ResetDisplayList();
41304513 } catch (Exception e)
41314514 {
4132
- e.printStackTrace();
4515
+ //e.printStackTrace();
4516
+ try
4517
+ {
4518
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4519
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4520
+
4521
+ readobj = (Object3D) p.readObject();
4522
+ istream.close();
4523
+
4524
+ readobj.ResetDisplayList();
4525
+ } catch (Exception e2)
4526
+ {
4527
+ e2.printStackTrace();
4528
+ }
41334529 }
41344530 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41354531 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4175,6 +4571,12 @@
41754571
41764572 void LoadIt(Object obj)
41774573 {
4574
+ if (obj == null)
4575
+ {
4576
+ // Invalid file
4577
+ return;
4578
+ }
4579
+
41784580 System.out.println("Loaded " + obj);
41794581 //new Exception().printStackTrace();
41804582 Object3D readobj = (Object3D) obj;
....@@ -4184,6 +4586,8 @@
41844586
41854587 if (readobj != null)
41864588 {
4589
+ if (Globals.SAVEONMAKE)
4590
+ Save();
41874591 try
41884592 {
41894593 //readobj.deepCopySelf(copy);
....@@ -4246,7 +4650,7 @@
42464650
42474651 void load() // throws ClassNotFoundException
42484652 {
4249
- if (GrafreeD.standAlone)
4653
+ if (Grafreed.standAlone)
42504654 {
42514655 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42524656 browser.show();
....@@ -4333,11 +4737,13 @@
43334737 try
43344738 {
43354739 FileOutputStream ostream = new FileOutputStream(lastname);
4336
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4740
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4741
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43374742
43384743 p.writeObject(copy);
43394744 p.flush();
43404745
4746
+ zstream.close();
43414747 ostream.close();
43424748
43434749 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4347,11 +4753,12 @@
43474753 {
43484754 }
43494755 }
4756
+
43504757 String lastname;
43514758
43524759 void saveAs()
43534760 {
4354
- if (GrafreeD.standAlone)
4761
+ if (Grafreed.standAlone)
43554762 {
43564763 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43574764 browser.setVisible(true);
....@@ -4456,13 +4863,13 @@
44564863 try
44574864 {
44584865 FileOutputStream ostream = new FileOutputStream(filename);
4459
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4460
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4866
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4867
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44614868
44624869 Object3D objectparent = obj.parent;
44634870 obj.parent = null;
44644871
4465
- Object3D object = (Object3D) GrafreeD.clone(obj);
4872
+ Object3D object = (Object3D) Grafreed.clone(obj);
44664873
44674874 obj.parent = objectparent;
44684875
....@@ -4474,8 +4881,8 @@
44744881 p.writeObject(object);
44754882 p.flush();
44764883
4884
+ zstream.close();
44774885 ostream.close();
4478
- // zstream.close();
44794886
44804887 // group.selection.get(0).parent = parent;
44814888 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4496,7 +4903,7 @@
44964903 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44974904 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44984905 copy.generatePOV(buffer);
4499
- if (GrafreeD.standAlone)
4906
+ if (Grafreed.standAlone)
45004907 {
45014908 FileDialog browser = new FileDialog(frame, "Export POV", 1);
45024909 browser.show();
....@@ -4522,7 +4929,8 @@
45224929 Object3D client;
45234930 Object3D copy;
45244931 MenuBar menuBar;
4525
- Menu windowMenu;
4932
+ Menu fileMenu;
4933
+ MenuItem newItem;
45264934 MenuItem loadItem;
45274935 MenuItem saveItem;
45284936 MenuItem saveAsItem;
....@@ -4530,13 +4938,11 @@
45304938 MenuItem reexportItem;
45314939 MenuItem povItem;
45324940 MenuItem closeItem;
4533
- Menu cameraMenu;
4941
+
45344942 CheckboxMenuItem zBufferItem;
45354943 //MenuItem normalLensItem;
4536
- MenuItem editCameraItem;
4537
- MenuItem revertCameraItem;
4538
- CheckboxMenuItem toggleLiveItem;
45394944 MenuItem stepItem;
4945
+ CheckboxMenuItem toggleLiveItem;
45404946 CheckboxMenuItem toggleFullScreenItem;
45414947 CheckboxMenuItem toggleTimelineItem;
45424948 CheckboxMenuItem toggleRenderItem;
....@@ -4545,25 +4951,38 @@
45454951 CheckboxMenuItem toggleFootContactItem;
45464952 CheckboxMenuItem toggleDLItem;
45474953 CheckboxMenuItem toggleTextureItem;
4548
- CheckboxMenuItem toggleRandomItem;
4954
+ CheckboxMenuItem toggleSwitchItem;
45494955 CheckboxMenuItem toggleRootItem;
45504956 CheckboxMenuItem animationItem;
45514957 CheckboxMenuItem toggleHandleItem;
45524958 CheckboxMenuItem togglePaintItem;
45534959 JSplitPane mainPanel;
45544960 JScrollPane scrollpane;
4961
+
45554962 JPanel toolbarPanel;
4556
- JPanel treePanel;
4963
+
4964
+ cGridBag treePanel;
4965
+
45574966 JPanel radioPanel;
45584967 ButtonGroup buttonGroup;
4559
- JPanel ctrlPanel;
4560
- JPanel materialPanel;
4968
+
4969
+ cGridBag toolboxPanel;
4970
+ cGridBag materialPanel;
4971
+ cGridBag ctrlPanel;
4972
+
45614973 JScrollPane infoPanel;
4562
- JPanel optionsPanel;
4974
+
4975
+ cGridBag optionsPanel;
4976
+
45634977 JTabbedPane objectPanel;
4978
+ boolean materialFlushed;
4979
+ Object3D latestObject;
4980
+
45644981 cGridBag XYZPanel;
4982
+
45654983 JSplitPane gridPanel;
45664984 JSplitPane bigPanel;
4985
+
45674986 cGridBag bigThree;
45684987 cGridBag scenePanel;
45694988 cGridBag centralPanel;
....@@ -4619,67 +5038,72 @@
46195038 // MATERIAL
46205039 JLabel materialLabel;
46215040 JLabel colorLabel;
4622
- NumberSlider colorField;
5041
+ cNumberSlider colorField;
46235042 JLabel modulationLabel;
4624
- NumberSlider modulationField;
5043
+ cNumberSlider modulationField;
46255044 JLabel metalnessLabel;
4626
- NumberSlider metalnessField;
5045
+ cNumberSlider metalnessField;
46275046 JLabel diffuseLabel;
4628
- NumberSlider diffuseField;
5047
+ cNumberSlider diffuseField;
46295048 JLabel specularLabel;
4630
- NumberSlider specularField;
5049
+ cNumberSlider specularField;
46315050 JLabel shininessLabel;
4632
- NumberSlider shininessField;
5051
+ cNumberSlider shininessField;
46335052 JLabel shiftLabel;
4634
- NumberSlider shiftField;
5053
+ cNumberSlider shiftField;
46355054 JLabel ambientLabel;
4636
- NumberSlider ambientField;
5055
+ cNumberSlider ambientField;
46375056 JLabel lightareaLabel;
4638
- NumberSlider lightareaField;
5057
+ cNumberSlider lightareaField;
46395058 JLabel diffusenessLabel;
4640
- NumberSlider diffusenessField;
5059
+ cNumberSlider diffusenessField;
46415060 JLabel velvetLabel;
4642
- NumberSlider velvetField;
5061
+ cNumberSlider velvetField;
46435062 JLabel sheenLabel;
4644
- NumberSlider sheenField;
5063
+ cNumberSlider sheenField;
46455064 JLabel subsurfaceLabel;
4646
- NumberSlider subsurfaceField;
5065
+ cNumberSlider subsurfaceField;
46475066 //JLabel bumpLabel;
46485067 //NumberSlider bumpField;
46495068 JLabel backlitLabel;
4650
- NumberSlider backlitField;
5069
+ cNumberSlider backlitField;
46515070 JLabel anisoLabel;
4652
- NumberSlider anisoField;
5071
+ cNumberSlider anisoField;
46535072 JLabel anisoVLabel;
4654
- NumberSlider anisoVField;
5073
+ cNumberSlider anisoVField;
46555074 JLabel cameraLabel;
4656
- NumberSlider cameraField;
5075
+ cNumberSlider cameraField;
46575076 JLabel selfshadowLabel;
4658
- NumberSlider selfshadowField;
5077
+ cNumberSlider selfshadowField;
46595078 JLabel shadowLabel;
4660
- NumberSlider shadowField;
5079
+ cNumberSlider shadowField;
46615080 JLabel textureLabel;
4662
- NumberSlider textureField;
5081
+ cNumberSlider textureField;
46635082 JLabel opacityLabel;
4664
- NumberSlider opacityField;
5083
+ cNumberSlider opacityField;
46655084 JLabel fakedepthLabel;
4666
- NumberSlider fakedepthField;
5085
+ cNumberSlider fakedepthField;
46675086 JLabel shadowbiasLabel;
4668
- NumberSlider shadowbiasField;
5087
+ cNumberSlider shadowbiasField;
46695088 JLabel bumpLabel;
4670
- NumberSlider bumpField;
5089
+ cNumberSlider bumpField;
46715090 JLabel noiseLabel;
4672
- NumberSlider noiseField;
5091
+ cNumberSlider noiseField;
46735092 JLabel powerLabel;
4674
- NumberSlider powerField;
5093
+ cNumberSlider powerField;
46755094 JLabel borderfadeLabel;
4676
- NumberSlider borderfadeField;
5095
+ cNumberSlider borderfadeField;
46775096 JLabel fogLabel;
4678
- NumberSlider fogField;
5097
+ cNumberSlider fogField;
46795098 JLabel opacityPowerLabel;
4680
- NumberSlider opacityPowerField;
4681
- JTree jTree;
5099
+ cNumberSlider opacityPowerField;
5100
+ cTree jTree;
46825101 //ObjectUI parent;
46835102
4684
- NumberSlider normalpushField;
5103
+ cNumberSlider normalpushField;
5104
+
5105
+ private MenuItem importGFDItem;
5106
+ private MenuItem importVRMLX3DItem;
5107
+ private MenuItem import3DSItem;
5108
+ private MenuItem importOBJItem;
46855109 }