Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
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.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -33,6 +39,67 @@
3339
3440 GroupEditor callee;
3541 JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ try
48
+ {
49
+ ImageIcon icon = GetIcon(name);
50
+ return new cButton(icon, border);
51
+ }
52
+ catch (Exception e)
53
+ {
54
+ return new cButton(name, border);
55
+ }
56
+ }
57
+
58
+ cToggleButton GetToggleButton(String name, boolean border)
59
+ {
60
+ try
61
+ {
62
+ ImageIcon icon = GetIcon(name);
63
+ return new cToggleButton(icon, border);
64
+ }
65
+ catch (Exception e)
66
+ {
67
+ return new cToggleButton(name, border);
68
+ }
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ try
74
+ {
75
+ ImageIcon icon = GetIcon(name);
76
+ return new cCheckBox(icon, border);
77
+ }
78
+ catch (Exception e)
79
+ {
80
+ return new cCheckBox(name, border);
81
+ }
82
+ }
83
+
84
+ private ImageIcon GetIcon(String name) throws IOException
85
+ {
86
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
+
88
+ if (image.getWidth() != 24 && image.getHeight() != 24)
89
+ {
90
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
+ Graphics2D g = resized.createGraphics();
92
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
+ g.dispose();
96
+
97
+ image = resized;
98
+ }
99
+
100
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
+ return icon;
102
+ }
36103
37104 // SCRIPT
38105
....@@ -136,34 +203,42 @@
136203 public void closeUI()
137204 {
138205 //new Exception().printStackTrace();
139
- System.out.println("this = " + this);
140
- System.out.println("objEditor = " + objEditor);
206
+// System.out.println("this = " + this);
207
+// System.out.println("objEditor = " + objEditor);
141208 //nameField.removeActionListener(this);
142
- objEditor.ctrlPanel.remove(nameField);
209
+// objEditor.ctrlPanel.remove(nameField);
143210
144
- if (!GroupEditor.allparams)
211
+ objEditor.ctrlPanel.remove(namePanel);
212
+
213
+ if (!allparams)
145214 return;
146215
147
- objEditor.ctrlPanel.remove(liveCB);
148
- objEditor.ctrlPanel.remove(hideCB);
149
- objEditor.ctrlPanel.remove(markCB);
150
-
151
- objEditor.ctrlPanel.remove(randomCB);
152
- objEditor.ctrlPanel.remove(speedupCB);
153
- objEditor.ctrlPanel.remove(rewindCB);
154
-
155
- objEditor.ctrlPanel.remove(resetButton);
156
- objEditor.ctrlPanel.remove(stepButton);
157
-// objEditor.ctrlPanel.remove(stepAllButton);
158
-// objEditor.ctrlPanel.remove(resetAllButton);
159
- objEditor.ctrlPanel.remove(link2masterCB);
160
- //objEditor.ctrlPanel.remove(flipVCB);
161
- //objEditor.ctrlPanel.remove(texresMenu);
162
- objEditor.ctrlPanel.remove(slowerButton);
163
- objEditor.ctrlPanel.remove(fasterButton);
164
- objEditor.ctrlPanel.remove(remarkButton);
216
+// objEditor.ctrlPanel.remove(liveCB);
217
+// objEditor.ctrlPanel.remove(hideCB);
218
+// objEditor.ctrlPanel.remove(markCB);
219
+//
220
+// objEditor.ctrlPanel.remove(randomCB);
221
+// objEditor.ctrlPanel.remove(speedupCB);
222
+// objEditor.ctrlPanel.remove(rewindCB);
223
+//
224
+// objEditor.ctrlPanel.remove(resetButton);
225
+// objEditor.ctrlPanel.remove(stepButton);
226
+//// objEditor.ctrlPanel.remove(stepAllButton);
227
+//// objEditor.ctrlPanel.remove(resetAllButton);
228
+// objEditor.ctrlPanel.remove(link2masterCB);
229
+// //objEditor.ctrlPanel.remove(flipVCB);
230
+// //objEditor.ctrlPanel.remove(texresMenu);
231
+// objEditor.ctrlPanel.remove(slowerButton);
232
+// objEditor.ctrlPanel.remove(fasterButton);
233
+// objEditor.ctrlPanel.remove(remarkButton);
165234
166
- Remove(normalpushField);
235
+ objEditor.ctrlPanel.remove(setupPanel);
236
+ objEditor.ctrlPanel.remove(setupPanel2);
237
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
238
+ objEditor.ctrlPanel.remove(pushPanel);
239
+ //objEditor.ctrlPanel.remove(fillPanel);
240
+
241
+ //Remove(normalpushField);
167242 }
168243
169244 public ObjEditor GetEditor()
....@@ -234,6 +309,7 @@
234309 //localCopy.parent = null;
235310
236311 frame = new JFrame();
312
+ frame.setUndecorated(false);
237313 objEditor = this;
238314 this.callee = callee;
239315
....@@ -264,28 +340,49 @@
264340 return frame.action(event, obj);
265341 }
266342
343
+ // Cannot work without static
344
+ static boolean allparams = true;
345
+
346
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
347
+
267348 void SetupMenu()
268349 {
269350 frame.setMenuBar(menuBar = new MenuBar());
270
- menuBar.add(windowMenu = new Menu("File"));
271
- windowMenu.add(loadItem = new MenuItem("Load..."));
272
- windowMenu.add("-");
273
- windowMenu.add(saveItem = new MenuItem("Save"));
274
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
351
+ menuBar.add(fileMenu = new Menu("File"));
352
+ fileMenu.add(newItem = new MenuItem("New"));
353
+ fileMenu.add(openItem = new MenuItem("Open..."));
354
+
355
+ //oe.menuBar.add(menu = new Menu("Include"));
356
+ Menu menu = new Menu("Import");
357
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
358
+ importOBJItem.addActionListener(this);
359
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
360
+ import3DSItem.addActionListener(this);
361
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
362
+ importVRMLX3DItem.addActionListener(this);
363
+ menu.add("-");
364
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
365
+ importGFDItem.addActionListener(this);
366
+ fileMenu.add(menu);
367
+ fileMenu.add("-");
368
+
369
+ fileMenu.add(saveItem = new MenuItem("Save"));
370
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
275371 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
276
- windowMenu.add("-");
277
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
278
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
279
- windowMenu.add("-");
372
+ fileMenu.add("-");
373
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
374
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
375
+ fileMenu.add("-");
280376 if (client.parent != null)
281377 {
282
- windowMenu.add(closeItem = new MenuItem("Close"));
378
+ fileMenu.add(closeItem = new MenuItem("Close"));
283379 } else
284380 {
285
- windowMenu.add(closeItem = new MenuItem("Exit"));
381
+ fileMenu.add(closeItem = new MenuItem("Exit"));
286382 }
287383
288
- loadItem.addActionListener(this);
384
+ newItem.addActionListener(this);
385
+ openItem.addActionListener(this);
289386 saveItem.addActionListener(this);
290387 saveAsItem.addActionListener(this);
291388 exportAsItem.addActionListener(this);
....@@ -293,81 +390,66 @@
293390 //povItem.addActionListener(this);
294391 closeItem.addActionListener(this);
295392
296
- menuBar.add(cameraMenu = new Menu("View"));
297
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
298
- //zBufferItem.addActionListener(this);
299
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
300
- //normalLensItem.addActionListener(this);
301
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
302
- revertCameraItem.addActionListener(this);
303
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
304
- toggleTimelineItem.addItemListener(this);
305
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
306
- toggleFullScreenItem.addItemListener(this);
307
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
308
- cameraMenu.add("-");
309
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
310
- toggleTextureItem.addItemListener(this);
311
- toggleTextureItem.setState(CameraPane.textureon);
312
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
313
- toggleLiveItem.addItemListener(this);
314
- toggleLiveItem.setState(Globals.isLIVE());
315
- cameraMenu.add(stepItem = new MenuItem("Step"));
316
- stepItem.addActionListener(this);
317
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
318
-// toggleDLItem.addItemListener(this);
319
-// toggleDLItem.setState(false);
320
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
321
- toggleRenderItem.addItemListener(this);
322
- toggleRenderItem.setState(!CameraPane.frozen);
323
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
324
- toggleDebugItem.addItemListener(this);
325
- toggleDebugItem.setState(CameraPane.DEBUG);
326
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
327
- toggleFrustumItem.addItemListener(this);
328
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
329
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
330
- toggleFootContactItem.addItemListener(this);
331
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
332
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
333
- toggleRandomItem.addItemListener(this);
334
- toggleRandomItem.setState(CameraPane.RANDOM);
335
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
336
- toggleHandleItem.addItemListener(this);
337
- toggleHandleItem.setState(CameraPane.HANDLES);
338
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
339
- togglePaintItem.addItemListener(this);
340
- togglePaintItem.setState(CameraPane.PAINTMODE);
341
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
342
-// toggleRootItem.addItemListener(this);
343
-// toggleRootItem.setState(false);
344
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
345
-// animationItem.addItemListener(this);
346
-// animationItem.setState(CameraPane.ANIMATION);
347
- cameraMenu.add("-");
348
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
349
- editCameraItem.addActionListener(this);
350
-
351393 objectPanel = new JTabbedPane();
394
+
395
+ ChangeListener changeListener = new ChangeListener()
396
+ {
397
+ public void stateChanged(ChangeEvent changeEvent)
398
+ {
399
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
400
+// {
401
+// if (latestObject != null)
402
+// {
403
+// refreshContents(true);
404
+// SetMaterial(latestObject);
405
+// }
406
+//
407
+// materialFlushed = true;
408
+// }
409
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
410
+// {
411
+// if (listUI.size() == 0)
412
+// EditSelection(false);
413
+// }
414
+
415
+ refreshContents(false); // To refresh Info tab
416
+ }
417
+ };
418
+ objectPanel.addChangeListener(changeListener);
419
+
352420 toolbarPanel = new JPanel();
353421 toolbarPanel.setName("Toolbar");
354
- treePanel = new JPanel();
422
+ treePanel = new cGridBag();
355423 treePanel.setName("Tree");
356
- ctrlPanel = new JPanel(); // new GridBagLayout());
357
- ctrlPanel.setName("Edit");
358
- materialPanel = new JPanel();
424
+
425
+ editPanel = new cGridBag().setVertical(true);
426
+ editPanel.setName("Edit");
427
+
428
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
429
+
430
+ editCommandsPanel = new cGridBag();
431
+ editPanel.add(editCommandsPanel);
432
+ editPanel.add(ctrlPanel);
433
+
434
+ toolboxPanel = new cGridBag().setVertical(false);
435
+ toolboxPanel.setName("Toolbox");
436
+
437
+ materialPanel = new cGridBag().setVertical(true);
359438 materialPanel.setName("Material");
439
+
360440 /*JTextPane*/
361441 infoarea = createTextPane();
442
+ doc = infoarea.getStyledDocument();
443
+
362444 infoarea.setEditable(true);
363445 SetText();
364446 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
365447 // infoarea.setOpaque(false);
366448 // //infoarea.setForeground(textcolor);
367
- infoarea.setLineWrap(true);
368
- infoarea.setWrapStyleWord(true);
449
+// TEXTAREA infoarea.setLineWrap(true);
450
+// TEXTAREA infoarea.setWrapStyleWord(true);
369451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
370
- infoPanel.setPreferredSize(new Dimension(50, 200));
452
+ infoPanel.setPreferredSize(new Dimension(1, 1));
371453 infoPanel.setName("Info");
372454 //infoPanel.setLayout(new BorderLayout());
373455 //infoPanel.add(createTextPane());
....@@ -376,16 +458,23 @@
376458 mainPanel.setName("Main");
377459 mainPanel.setContinuousLayout(true);
378460 mainPanel.setOneTouchExpandable(true);
379
- mainPanel.setDividerLocation(1.0);
380461 mainPanel.setDividerSize(9);
381
- mainPanel.setResizeWeight(0);
382
-
462
+ mainPanel.setDividerLocation(0.5); //1.0);
463
+ mainPanel.setResizeWeight(0.5);
464
+
465
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
466
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
467
+ divider.setDividerSize(15);
468
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
469
+
470
+ mainPanel.setUI(new BasicSplitPaneUI());
471
+
383472 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
384473 //mainPanel.setLayout(new GridBagLayout());
385474 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
386
- treePanel.setLayout(new GridBagLayout());
387
- ctrlPanel.setLayout(new GridBagLayout());
388
- materialPanel.setLayout(new GridBagLayout());
475
+// treePanel.setLayout(new GridBagLayout());
476
+ //ctrlPanel.setLayout(new GridBagLayout());
477
+ //materialPanel.setLayout(new GridBagLayout());
389478
390479 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
391480 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -424,7 +513,7 @@
424513 static String newline = "\n";
425514 protected static final String buttonString = "JButton";
426515 StyledDocument doc;
427
- JTextArea infoarea;
516
+ JTextPane infoarea;
428517
429518 void ClearInfo()
430519 {
....@@ -447,10 +536,10 @@
447536 e.printStackTrace();
448537 }
449538
450
- String selection = infoarea.getText();
451
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
452
- java.awt.datatransfer.Clipboard clipboard =
453
- Toolkit.getDefaultToolkit().getSystemClipboard();
539
+// String selection = infoarea.getText();
540
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
541
+// java.awt.datatransfer.Clipboard clipboard =
542
+// Toolkit.getDefaultToolkit().getSystemClipboard();
454543 //clipboard.setContents(data, data);
455544 }
456545
....@@ -473,13 +562,13 @@
473562 //SendInfo("Name:", "bold");
474563 if (sel.GetTextures() != null || debug)
475564 {
476
- si.SendInfo(sel.toString(), "bold");
565
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
477566 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
478567 if (sel.Size() > 0)
479568 {
480569 si.SendInfo("#children = " + sel.Size(), "regular");
481570 }
482
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
571
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
483572 if (debug)
484573 {
485574 try
....@@ -491,7 +580,10 @@
491580 }
492581
493582 if (full)
494
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
583
+ {
584
+ si.SendInfo(" BBox min: " + minima, "regular");
585
+ si.SendInfo(" BBox max: " + maxima, "regular");
586
+ }
495587
496588 if (sel.bRep != null)
497589 {
....@@ -518,7 +610,7 @@
518610 }
519611 if (sel.support != null)
520612 {
521
- si.SendInfo(" support: " + sel.support, "regular");
613
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
522614 }
523615 if (sel.scriptnode != null)
524616 {
....@@ -589,6 +681,9 @@
589681 {
590682 CameraPane.pointflow = (PointFlow) sel;
591683 }
684
+
685
+ si.SendInfo("_____________________", "regular");
686
+ si.SendInfo("", "regular");
592687 }
593688 }
594689
....@@ -604,68 +699,191 @@
604699 }
605700 }
606701
702
+//static GraphicsDevice device = GraphicsEnvironment
703
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
704
+
705
+ Rectangle keeprect;
706
+ cRadio radio;
707
+
708
+cButton keepButton;
709
+ cButton twoButton; // Full 3D
710
+ cButton sixButton;
711
+ cButton threeButton;
712
+ cButton sevenButton;
713
+ cButton fourButton; // full panel
714
+ cButton oneButton; // full XYZ
715
+ //cButton currentLayout;
716
+
717
+ boolean maximized;
718
+
719
+ cButton fullscreenLayout;
720
+
721
+ void Minimize()
722
+ {
723
+ frame.setState(Frame.ICONIFIED);
724
+ frame.validate();
725
+ }
726
+
727
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
728
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
729
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
730
+ void Maximize()
731
+ {
732
+ if (CameraPane.FULLSCREEN)
733
+ {
734
+ ToggleFullScreen();
735
+ }
736
+
737
+ if (maximized)
738
+ {
739
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
740
+ }
741
+ else
742
+ {
743
+ keeprect = frame.getBounds();
744
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
745
+// Dimension rect2 = frame.getToolkit().getScreenSize();
746
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
747
+// frame.setState(Frame.MAXIMIZED_BOTH);
748
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
749
+ }
750
+
751
+ maximized ^= true;
752
+
753
+ frame.validate();
754
+ }
755
+
756
+ cButton minButton;
757
+ cButton maxButton;
758
+ cButton fullButton;
759
+
607760 void ToggleFullScreen()
608761 {
609
- if (CameraPane.FULLSCREEN)
762
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
763
+
764
+ cameraView.ToggleFullScreen();
765
+
766
+ if (!CameraPane.FULLSCREEN)
610767 {
611
- frame.getContentPane().remove(/*"Center",*/bigThree);
612
- framePanel.add(bigThree);
613
- frame.getContentPane().add(/*"Center",*/framePanel);
768
+ device.setFullScreenWindow(null);
769
+ frame.dispose();
770
+ frame.setUndecorated(false);
771
+ frame.validate();
772
+ frame.setVisible(true);
773
+
774
+ //frame.setVisible(false);
775
+// frame.removeNotify();
776
+// frame.setUndecorated(false);
777
+// frame.addNotify();
778
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
779
+
780
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
781
+// X framePanel.add(bigThree);
782
+// X frame.getContentPane().add(/*"Center",*/framePanel);
783
+ framePanel.setDividerLocation(46);
784
+
785
+ //frame.setVisible(true);
786
+ radio.layout = keepButton;
787
+ //theFrame = null;
788
+ keepButton = null;
789
+ radio.layout.doClick();
790
+
614791 } else
615792 {
616
- frame.getContentPane().remove(/*"Center",*/framePanel);
617
- framePanel.remove(bigThree);
618
- frame.getContentPane().add(/*"Center",*/bigThree);
793
+ keepButton = radio.layout;
794
+ //keeprect = frame.getBounds();
795
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
796
+// frame.getToolkit().getScreenSize().height);
797
+ //frame.setVisible(false);
798
+
799
+ frame.dispose();
800
+ frame.setUndecorated(true);
801
+ device.setFullScreenWindow(frame);
802
+ frame.validate();
803
+ frame.setVisible(true);
804
+// frame.removeNotify();
805
+// frame.setUndecorated(true);
806
+// frame.addNotify();
807
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
808
+// X framePanel.remove(bigThree);
809
+// X frame.getContentPane().add(/*"Center",*/bigThree);
810
+ framePanel.setDividerLocation(0);
811
+
812
+ radio.layout = fullscreenLayout;
813
+ radio.layout.doClick();
814
+ //frame.setVisible(true);
619815 }
620
- cameraView.ToggleFullScreen();
816
+ frame.validate();
621817 }
622818
623
- private JTextArea createTextPane()
819
+ private byte[] CompressCopy()
624820 {
625
- String[] initString =
626
- {
627
- "This is an editable JTextPane, ", //regular
628
- "another ", //italic
629
- "styled ", //bold
630
- "text ", //small
631
- "component, ", //large
632
- "which supports embedded components..." + newline,//regular
633
- " " + newline, //button
634
- "...and embedded icons..." + newline, //regular
635
- " ", //icon
636
- newline + "JTextPane is a subclass of JEditorPane that "
637
- + "uses a StyledEditorKit and StyledDocument, and provides "
638
- + "cover methods for interacting with those objects."
639
- };
821
+ boolean temp = CameraPane.SWITCH;
822
+ CameraPane.SWITCH = false;
823
+
824
+ copy.ExtractBigData(versiontable);
825
+ // if (copy == client)
826
+
827
+ byte[] versions[] = copy.versions;
828
+ copy.versions = null;
829
+
830
+ byte[] compress = Compress(copy);
831
+
832
+ copy.versions = versions;
833
+
834
+ copy.RestoreBigData(versiontable);
835
+
836
+ CameraPane.SWITCH = temp;
837
+
838
+ return compress;
839
+ }
640840
641
- String[] initStyles =
642
- {
643
- "regular", "italic", "bold", "small", "large",
644
- "regular", "button", "regular", "icon",
645
- "regular"
646
- };
841
+ private JTextPane createTextPane()
842
+ {
843
+// TEXTAREA String[] initString =
844
+// {
845
+// "This is an editable JTextPane, ", //regular
846
+// "another ", //italic
847
+// "styled ", //bold
848
+// "text ", //small
849
+// "component, ", //large
850
+// "which supports embedded components..." + newline,//regular
851
+// " " + newline, //button
852
+// "...and embedded icons..." + newline, //regular
853
+// " ", //icon
854
+// newline + "JTextPane is a subclass of JEditorPane that "
855
+// + "uses a StyledEditorKit and StyledDocument, and provides "
856
+// + "cover methods for interacting with those objects."
857
+// };
858
+//
859
+// String[] initStyles =
860
+// {
861
+// "regular", "italic", "bold", "small", "large",
862
+// "regular", "button", "regular", "icon",
863
+// "regular"
864
+// };
865
+//
866
+// JTextPane textPane = new JTextPane();
867
+// textPane.setEditable(true);
868
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
869
+// addStylesToDocument(doc);
870
+//
871
+// try
872
+// {
873
+// for (int j = 0; j < 2; j++)
874
+// {
875
+// for (int i = 0; i < initString.length; i++)
876
+// {
877
+// doc.insertString(doc.getLength(), initString[i],
878
+// doc.getStyle(initStyles[i]));
879
+// }
880
+// }
881
+// } catch (BadLocationException ble)
882
+// {
883
+// System.err.println("Couldn't insert initial text into text pane.");
884
+// }
647885
648
- JTextPane textPane = new JTextPane();
649
- textPane.setEditable(true);
650
- /*StyledDocument*/ doc = textPane.getStyledDocument();
651
- addStylesToDocument(doc);
652
-
653
- try
654
- {
655
- for (int j = 0; j < 2; j++)
656
- {
657
- for (int i = 0; i < initString.length; i++)
658
- {
659
- doc.insertString(doc.getLength(), initString[i],
660
- doc.getStyle(initStyles[i]));
661
- }
662
- }
663
- } catch (BadLocationException ble)
664
- {
665
- System.err.println("Couldn't insert initial text into text pane.");
666
- }
667
-
668
- return new JTextArea(); // textPane;
886
+ return new JTextPane(); // textPane;
669887 }
670888
671889 protected void addStylesToDocument(StyledDocument doc)
....@@ -718,7 +936,7 @@
718936 protected static ImageIcon createImageIcon(String path,
719937 String description)
720938 {
721
- java.net.URL imgURL = GrafreeD.class.getResource(path);
939
+ java.net.URL imgURL = Grafreed.class.getResource(path);
722940 if (imgURL != null)
723941 {
724942 return new ImageIcon(imgURL, description);
....@@ -750,6 +968,7 @@
750968 // NumberSlider vDivsField;
751969 // JCheckBox endcaps;
752970 JCheckBox liveCB;
971
+ JCheckBox selectCB;
753972 JCheckBox hideCB;
754973 JCheckBox link2masterCB;
755974 JCheckBox markCB;
....@@ -757,7 +976,12 @@
757976 JCheckBox speedupCB;
758977 JCheckBox rewindCB;
759978 JCheckBox flipVCB;
979
+
980
+ cCheckBox toggleTextureCB;
981
+ cCheckBox toggleSwitchCB;
982
+
760983 JComboBox texresMenu;
984
+
761985 JButton resetButton;
762986 JButton stepButton;
763987 JButton stepAllButton;
....@@ -765,115 +989,87 @@
765989 JButton slowerButton;
766990 JButton fasterButton;
767991 JButton remarkButton;
992
+
993
+ cGridBag editPanel;
994
+ cGridBag editCommandsPanel;
995
+
996
+ cGridBag namePanel;
997
+ cGridBag setupPanel;
998
+ cGridBag setupPanel2;
999
+ cGridBag objectCommandsPanel;
1000
+ cGridBag pushPanel;
1001
+ cGridBag fillPanel;
7681002
769
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1003
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7701004 {
7711005 JCheckBox cb;
7721006
773
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
774
- oe.aConstraints.gridwidth = 1; // 3;
775
-// oe.aConstraints.weightx = 1;
776
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
777
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1007
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7781008 cb.addItemListener(this);
779
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
780
- oe.aConstraints.gridwidth = 1;
781
- oe.aConstraints.gridx += 1;
7821009
7831010 return cb;
7841011 }
7851012
786
- cButton AddButton(ObjEditor oe, String label)
1013
+ cButton AddButton(cGridBag panel, String label)
7871014 {
7881015 cButton cb;
7891016
790
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
791
- oe.aConstraints.gridwidth = 1;
792
-// oe.aConstraints.weightx = 1;
793
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
794
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1017
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7951018 cb.addActionListener(this);
796
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
797
- oe.aConstraints.gridwidth = 1;
798
- oe.aConstraints.gridx += 1;
7991019
8001020 return cb;
8011021 }
8021022
803
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1023
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
8041024 {
8051025 JComboBox combo;
8061026
807
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
808
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
809
- oe.aConstraints.gridx += 1;
1027
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8101028 combo.addActionListener(this);
8111029
8121030 return combo;
8131031 }
8141032
815
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1033
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
8161034 {
817
- NumberSlider combo;
1035
+ cGridBag control = new cGridBag();
1036
+
1037
+ cNumberSlider combo;
8181038
8191039 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221040 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 1;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
1041
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1042
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321043 combo.setFloat(current);
833
-
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1044
+
1045
+ panel.add(control);
1046
+
1047
+ return control;
8391048 }
8401049
841
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1050
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8421051 {
843
- NumberSlider combo;
1052
+ cGridBag control = new cGridBag();
1053
+
1054
+ cNumberSlider combo;
8441055
8451056 JLabel jlabel = new JLabel(label);
846
-
847
- aConstraints.fill = GridBagConstraints.VERTICAL;
8481057 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
849
- aConstraints.gridwidth = 2;
850
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
851
- aConstraints.gridx += 1;
852
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
853
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
854
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
855
- aConstraints.gridx += 1;
856
- aConstraints.gridwidth = 1;
857
-
1058
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1059
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8581060 combo.setInteger(current);
8591061
860
- combo.label = jlabel;
861
-
862
- combo.addChangeListener(this);
863
-
864
- return combo;
1062
+ panel.add(control);
1063
+
1064
+ return control;
8651065 }
8661066
867
- JTextArea AddText(JPanel ctrlPanel, String name)
1067
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8681068 {
8691069 JTextArea text;
8701070
871
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
872
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
873
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1071
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8741072 text.addCaretListener(this);
875
- aConstraints.gridx += 1;
876
- aConstraints.gridwidth = 1;
8771073
8781074 return text;
8791075 }
....@@ -903,9 +1099,16 @@
9031099 objEditor.ctrlPanel.remove(j);
9041100 }
9051101
1102
+ void Remove(cNumberSlider j)
1103
+ {
1104
+ j.removeChangeListener(this);
1105
+ //objEditor.ctrlPanel.remove(j.label);
1106
+ objEditor.ctrlPanel.remove(j);
1107
+ }
1108
+
9061109 /*
9071110 */
908
- void Return() // ObjEditor oe)
1111
+ void Return0() // ObjEditor oe)
9091112 {
9101113 aConstraints.gridy += 1;
9111114 aConstraints.gridx = 0;
....@@ -960,37 +1163,77 @@
9601163
9611164 void SetupUI2(ObjEditor oe)
9621165 {
963
-// oe.aConstraints.weightx = 0;
964
-// oe.aConstraints.weighty = 0;
965
-// oe.aConstraints.gridx = 0;
966
-// oe.aConstraints.gridy = 0;
967
- SetupName(oe);
1166
+ //SetupName(oe);
9681167
969
- if (!GroupEditor.allparams)
1168
+ namePanel = new cGridBag();
1169
+
1170
+ nameField = AddText(namePanel, copy.GetName());
1171
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1172
+ oe.ctrlPanel.add(namePanel);
1173
+
1174
+ oe.ctrlPanel.Return();
1175
+
1176
+ if (!allparams)
9701177 return;
9711178
972
- liveCB = AddCheckBox(oe, "Live", copy.live);
973
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
974
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1179
+ setupPanel = new cGridBag().setVertical(false);
1180
+
1181
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1182
+ liveCB.setToolTipText("Animate object");
1183
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1184
+ selectCB.setToolTipText("Make object selectable");
9751185 // Return();
976
- markCB = AddCheckBox(oe, "Mark", copy.marked);
977
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
978
- randomCB = AddCheckBox(oe, "Rand", copy.random);
979
- Return();
980
- resetButton = AddButton(oe, "Reset");
981
- stepButton = AddButton(oe, "Step");
1186
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1187
+ hideCB.setToolTipText("Hide object");
1188
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1189
+ markCB.setToolTipText("As animation target transform");
1190
+
1191
+ setupPanel2 = new cGridBag().setVertical(false);
1192
+
1193
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1194
+ rewindCB.setToolTipText("Rewind animation");
1195
+
1196
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1197
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1198
+
1199
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1200
+ link2masterCB.setToolTipText("Attach to support");
1201
+
1202
+ if (Globals.ADVANCED)
1203
+ {
1204
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1205
+ speedupCB.setToolTipText("Option motion capture");
1206
+ }
1207
+
1208
+ oe.ctrlPanel.add(setupPanel);
1209
+ oe.ctrlPanel.Return();
1210
+ oe.ctrlPanel.add(setupPanel2);
1211
+ oe.ctrlPanel.Return();
1212
+
1213
+ objectCommandsPanel = new cGridBag().setVertical(false);
1214
+
1215
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1216
+ resetButton.setToolTipText("Jump to frame zero");
1217
+ stepButton = AddButton(objectCommandsPanel, "Step");
1218
+ stepButton.setToolTipText("Step one frame");
9821219 // resetAllButton = AddButton(oe, "Reset All");
9831220 // stepAllButton = AddButton(oe, "Step All");
984
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9851221 // Return();
986
- slowerButton = AddButton(oe, "Slow");
987
- fasterButton = AddButton(oe, "Fast");
988
- remarkButton = AddButton(oe, "Rem");
1222
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1223
+ slowerButton.setToolTipText("Decrease animation speed");
1224
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1225
+ fasterButton.setToolTipText("Increase animation speed");
1226
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1227
+ remarkButton.setToolTipText("Set the current transform as the target");
9891228
990
- Return();
1229
+ oe.ctrlPanel.add(objectCommandsPanel);
1230
+ oe.ctrlPanel.Return();
9911231
992
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
993
- Return();
1232
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1233
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1234
+ //Return();
1235
+
1236
+ oe.ctrlPanel.Return();
9941237
9951238 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9961239 // ObjEditor.aConstraints.gridx += 1;
....@@ -1085,7 +1328,7 @@
10851328 oe.aConstraints.gridwidth = 1;
10861329 /**/
10871330 nameField = AddText(oe.ctrlPanel, copy.GetName());
1088
- Return();
1331
+ oe.ctrlPanel.Return();
10891332
10901333 //ctrlPanel.add(textureButton = new Button("Texture..."));
10911334 //textureButton.setEnabled(false);
....@@ -1187,9 +1430,13 @@
11871430 //JPanel worldPanel =
11881431 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11891432 //worldPanel.setName("World");
1190
- centralPanel = new JPanel(new BorderLayout());
1191
- timelinePanel = new JPanel(new BorderLayout());
1192
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1433
+ centralPanel = new cGridBag();
1434
+ centralPanel.preferredWidth = 20;
1435
+
1436
+ if (Globals.ADVANCED)
1437
+ {
1438
+ timelinePanel = new JPanel(new BorderLayout());
1439
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11931440
11941441 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11951442 cameraPanel.setContinuousLayout(true);
....@@ -1198,7 +1445,10 @@
11981445 // cameraPanel.setDividerSize(9);
11991446 cameraPanel.setResizeWeight(1.0);
12001447
1448
+ }
1449
+
12011450 centralPanel.add(cameraView);
1451
+ centralPanel.setFocusable(true);
12021452 //frame.setJMenuBar(timelineMenubar);
12031453 //centralPanel.add(timelinePanel);
12041454
....@@ -1217,12 +1467,13 @@
12171467 //frontView.object = copy;
12181468 //sideView.object = copy;
12191469
1220
- XYZPanel = new JPanel();
1221
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1470
+ XYZPanel = new cGridBag().setVertical(true);
1471
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12221472
1223
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1224
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1225
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1473
+ XYZPanel.preferredWidth = 5;
1474
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1475
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1476
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
12261477
12271478 /*
12281479 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1260,11 +1511,16 @@
12601511 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12611512 //tmp.setName("Edit");
12621513 objectPanel.add(materialPanel);
1263
- JPanel north = new JPanel(new BorderLayout());
1264
- north.setName("Edit");
1265
- north.add(ctrlPanel, BorderLayout.NORTH);
1266
- objectPanel.add(north);
1267
- objectPanel.add(infoPanel);
1514
+// JPanel north = new JPanel(new BorderLayout());
1515
+// north.setName("Edit");
1516
+// north.add(ctrlPanel, BorderLayout.NORTH);
1517
+// objectPanel.add(north);
1518
+ objectPanel.add(editPanel);
1519
+
1520
+ //if (Globals.ADVANCED)
1521
+ objectPanel.add(infoPanel);
1522
+
1523
+ objectPanel.add(toolboxPanel);
12681524
12691525 /*
12701526 aConstraints.gridx = 0;
....@@ -1273,7 +1529,7 @@
12731529 aConstraints.gridy += 1;
12741530 aConstraints.gridwidth = 1;
12751531 mainPanel.add(objectPanel, aConstraints);
1276
- */
1532
+ */
12771533
12781534 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12791535 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1284,19 +1540,23 @@
12841540 scrollpane.setWheelScrollingEnabled(true);
12851541 scrollpane.addMouseWheelListener(this); // Default not fast enough
12861542
1287
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1288
- scenePanel.add(scrollpane);
1543
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1544
+ scenePanel.preferredWidth = 6;
1545
+
1546
+ JTabbedPane tabbedPane = new JTabbedPane();
1547
+ tabbedPane.add(scrollpane);
12891548
1290
- scenePanel.add(FSPane = new cFileSystemPane(this));
1291
-
1292
- optionsPanel = new JPanel(new GridBagLayout());
1549
+ optionsPanel = new cGridBag().setVertical(false);
12931550
12941551 optionsPanel.setName("Options");
12951552
1296
- AddOptions(optionsPanel, aConstraints);
1553
+ AddOptions(optionsPanel); //, aConstraints);
12971554
1298
- scenePanel.add(optionsPanel);
1555
+ tabbedPane.add(optionsPanel);
1556
+
1557
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12991558
1559
+ scenePanel.add(tabbedPane);
13001560
13011561 /*
13021562 cTree jTree = new cTree(null);
....@@ -1330,6 +1590,7 @@
13301590 //bigPanel.setSize(new Dimension(10,10));
13311591 //bigPanel.add(ctrlPanel);
13321592 //bigPanel.add(gridPanel);
1593
+ /**
13331594 bigThree = new JPanel();
13341595 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13351596 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1353,7 +1614,13 @@
13531614 // aConstraints.gridheight = 3;
13541615 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13551616 bigThree.add(XYZPanel, aWindowConstraints);
1617
+ /**/
13561618
1619
+ bigThree = new cGridBag();
1620
+ bigThree.addComponent(scenePanel);
1621
+ bigThree.addComponent(centralPanel);
1622
+ bigThree.addComponent(XYZPanel);
1623
+
13571624 // // SIDE EFFECT!!!
13581625 // aConstraints.gridx = 0;
13591626 // aConstraints.gridy = 0;
....@@ -1361,9 +1628,9 @@
13611628 // aConstraints.gridheight = 1;
13621629
13631630 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1364
- framePanel.setContinuousLayout(true);
1365
- framePanel.setOneTouchExpandable(true);
1366
- framePanel.setDividerLocation(0.8);
1631
+ framePanel.setContinuousLayout(false);
1632
+ framePanel.setOneTouchExpandable(false);
1633
+ //.setDividerLocation(0.8);
13671634 //framePanel.setDividerSize(15);
13681635 //framePanel.setResizeWeight(0.15);
13691636 framePanel.setName("Frame");
....@@ -1380,10 +1647,15 @@
13801647
13811648 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13821649
1383
- frame.setSize(1024, 768);
1384
- frame.show();
1385
-
1650
+ frame.setSize(1280, 860);
1651
+
1652
+ cameraView.requestFocusInWindow();
1653
+
13861654 gridPanel.setDividerLocation(1.0);
1655
+
1656
+ frame.validate();
1657
+
1658
+ frame.setVisible(true);
13871659
13881660 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13891661 frame.addWindowListener(new WindowAdapter()
....@@ -1396,7 +1668,7 @@
13961668 });
13971669 }
13981670
1399
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1671
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14001672 {
14011673 }
14021674
....@@ -1411,260 +1683,161 @@
14111683 ctrlPanel.removeAll();
14121684 }
14131685
1414
- void SetupMaterial(JPanel ctrlPanel)
1686
+ void SetupMaterial(cGridBag panel)
14151687 {
1416
- aConstraints.weighty = 0;
1417
- //aConstraints.weightx = 1;
1418
- /*
1688
+ /*
14191689 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14201690 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1421
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1422
- aConstraints.gridx += 1;
14231691 */
14241692
1425
- aConstraints.gridwidth = 1;
1426
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1427
- aConstraints.gridx += 1;
1428
- aConstraints.weighty = 0;
1429
- aConstraints.gridwidth = 1;
1693
+ cGridBag editBar = new cGridBag().setVertical(false);
1694
+
1695
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1696
+ createMaterialButton.setToolTipText("Create material");
14301697
14311698 /*
14321699 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1433
- aConstraints.gridx += 1;
1434
- aConstraints.weighty = 0;
1435
- aConstraints.gridwidth = 1;
14361700 */
14371701
1438
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1439
- aConstraints.gridx += 1;
1702
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1703
+ clearMaterialButton.setToolTipText("Clear material");
1704
+
1705
+ if (Globals.ADVANCED)
1706
+ {
1707
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1708
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1709
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1710
+ }
14401711
1441
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1442
-
1443
- aConstraints.gridx += 1;
1444
-
1445
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1446
-
1447
- aConstraints.gridx += 1;
1448
-
1449
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1450
-
1451
- aConstraints.gridx = 0;
1452
- aConstraints.gridy += 1;
1453
- aConstraints.weighty = 0;
1454
- aConstraints.gridwidth = 1;
1712
+ editBar.preferredHeight = 15;
1713
+
1714
+ panel.add(editBar);
1715
+
14551716 /**/
14561717 //aConstraints.weighty = 0;
14571718 ////aConstraints.weightx = 1;
14581719 //aConstraints.weighty = 1;
14591720 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14601721 //aConstraints.gridx += 1;
1461
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1462
- aConstraints.weighty = 0;
1463
- aConstraints.gridx = 0;
1464
- aConstraints.gridy += 1;
1465
- aConstraints.gridwidth = 1;
1722
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14661723
1467
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1468
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1469
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1470
- aConstraints.gridx += 1;
1471
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1472
- //aConstraints.weightx = 0;
1473
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1474
- aConstraints.gridx = 0;
1475
- aConstraints.gridy += 1;
1476
- aConstraints.gridwidth = 1;
1724
+ cGridBag colorSection = new cGridBag().setVertical(true);
1725
+
1726
+ cGridBag color = new cGridBag();
1727
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1728
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1729
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1730
+ //colorField.preferredWidth = 200;
1731
+ colorSection.add(color);
14771732
1478
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1479
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1480
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1481
- aConstraints.gridx += 1;
1482
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1483
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1484
- aConstraints.gridx = 0;
1485
- aConstraints.gridy += 1;
1486
- aConstraints.gridwidth = 1;
1733
+ cGridBag modulation = new cGridBag();
1734
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1735
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1736
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1737
+ colorSection.add(modulation);
14871738
1488
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1489
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1490
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1491
- aConstraints.gridx += 1;
1492
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1493
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1494
- aConstraints.gridx = 0;
1495
- aConstraints.gridy += 1;
1496
- aConstraints.gridwidth = 1;
1739
+ cGridBag texture = new cGridBag();
1740
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1741
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1742
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1743
+ colorSection.add(texture);
14971744
1498
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1499
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1500
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1501
- aConstraints.gridx += 1;
1502
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1503
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1504
- aConstraints.gridx = 0;
1505
- aConstraints.gridy += 1;
1506
- aConstraints.gridwidth = 1;
1745
+ panel.add(new JSeparator());
1746
+
1747
+ panel.add(colorSection);
1748
+
1749
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1750
+
1751
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1752
+
1753
+ cGridBag diffuse = new cGridBag();
1754
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1755
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1756
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1757
+ diffuseSection.add(diffuse);
15071758
1508
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1509
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1510
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1511
- aConstraints.gridx += 1;
1512
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1513
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1514
- aConstraints.gridx = 0;
1515
- aConstraints.gridy += 1;
1516
- aConstraints.gridwidth = 1;
1759
+ cGridBag diffuseness = new cGridBag();
1760
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1761
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1762
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1763
+ diffuseSection.add(diffuseness);
15171764
1518
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1519
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1520
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1521
- aConstraints.gridx += 1;
1522
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1523
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1524
- aConstraints.gridx = 0;
1525
- aConstraints.gridy += 1;
1526
- aConstraints.gridwidth = 1;
1765
+ cGridBag selfshadow = new cGridBag();
1766
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1767
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1768
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1769
+ diffuseSection.add(selfshadow);
15271770
1528
- //aConstraints.weighty = 1;
1529
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1530
- //aConstraints.gridx += 1;
1531
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1532
- aConstraints.weighty = 0;
1533
- aConstraints.gridx = 0;
1534
- aConstraints.gridy += 1;
1535
- aConstraints.gridwidth = 1;
1771
+ cGridBag sheen = new cGridBag();
1772
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1773
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1774
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1775
+ diffuseSection.add(sheen);
15361776
1537
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1538
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1539
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1540
- aConstraints.gridx += 1;
1541
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1542
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1543
- aConstraints.gridx = 0;
1544
- aConstraints.gridy += 1;
1545
- aConstraints.gridwidth = 1;
1777
+ cGridBag subsurface = new cGridBag();
1778
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1779
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1780
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1781
+ diffuseSection.add(subsurface);
15461782
1547
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1548
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1549
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1550
- aConstraints.gridx += 1;
1551
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1552
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1553
- aConstraints.gridx = 0;
1554
- aConstraints.gridy += 1;
1555
- aConstraints.gridwidth = 1;
1783
+ cGridBag shadow = new cGridBag();
1784
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1785
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1786
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1787
+ diffuseSection.add(shadow);
15561788
1557
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1558
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1560
- aConstraints.gridx += 1;
1561
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1562
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1563
- aConstraints.gridx = 0;
1564
- aConstraints.gridy += 1;
1565
- aConstraints.gridwidth = 1;
1789
+ cGridBag fakedepth = new cGridBag();
1790
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1791
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1792
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1793
+ diffuseSection.add(fakedepth);
15661794
1567
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1568
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1569
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1570
- aConstraints.gridx += 1;
1571
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1572
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1573
- aConstraints.gridx = 0;
1574
- aConstraints.gridy += 1;
1575
- aConstraints.gridwidth = 1;
1795
+ cGridBag shadowbias = new cGridBag();
1796
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1797
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1798
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1799
+ diffuseSection.add(shadowbias);
15761800
1577
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1578
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1579
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1580
- aConstraints.gridx += 1;
1581
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1582
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1583
- aConstraints.gridx = 0;
1584
- aConstraints.gridy += 1;
1585
- aConstraints.gridwidth = 1;
1801
+ panel.add(new JSeparator());
1802
+
1803
+ panel.add(diffuseSection);
1804
+
1805
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1806
+
1807
+ cGridBag specularSection = new cGridBag().setVertical(true);
15861808
1587
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1588
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1589
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1590
- aConstraints.gridx += 1;
1591
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1592
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1593
- aConstraints.gridx = 0;
1594
- aConstraints.gridy += 1;
1595
- aConstraints.gridwidth = 1;
1809
+ cGridBag specular = new cGridBag();
1810
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1811
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1812
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1813
+ specularSection.add(specular);
15961814
1597
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1598
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1599
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1600
- aConstraints.gridx += 1;
1601
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1602
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1603
- aConstraints.gridx = 0;
1604
- aConstraints.gridy += 1;
1605
- aConstraints.gridwidth = 1;
1815
+ cGridBag lightarea = new cGridBag();
1816
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1817
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1818
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1819
+ specularSection.add(lightarea);
16061820
1607
- //aConstraints.weighty = 1;
1608
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1609
- //aConstraints.gridx += 1;
1610
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1611
- aConstraints.weighty = 0;
1612
- aConstraints.gridx = 0;
1613
- aConstraints.gridy += 1;
1614
- aConstraints.gridwidth = 1;
1821
+ cGridBag shininess = new cGridBag();
1822
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1823
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1824
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1825
+ specularSection.add(shininess);
16151826
1616
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1617
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1618
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1619
- aConstraints.gridx += 1;
1620
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1621
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1622
- aConstraints.gridx = 0;
1623
- aConstraints.gridy += 1;
1624
- aConstraints.gridwidth = 1;
1827
+ cGridBag metalness = new cGridBag();
1828
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1829
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1830
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1831
+ specularSection.add(metalness);
16251832
1626
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1627
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1628
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1629
- aConstraints.gridx += 1;
1630
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1631
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1632
- aConstraints.gridx = 0;
1633
- aConstraints.gridy += 1;
1634
- aConstraints.gridwidth = 1;
1833
+ cGridBag velvet = new cGridBag();
1834
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1835
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1836
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1837
+ specularSection.add(velvet);
16351838
1636
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1637
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1638
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1639
- aConstraints.gridx += 1;
1640
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1641
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1642
- aConstraints.gridx = 0;
1643
- aConstraints.gridy += 1;
1644
- aConstraints.gridwidth = 1;
1645
-
1646
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1647
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1648
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1649
- aConstraints.gridx += 1;
1650
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1651
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1652
- aConstraints.gridx = 0;
1653
- aConstraints.gridy += 1;
1654
- aConstraints.gridwidth = 1;
1655
-
1656
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1657
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1658
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1659
- aConstraints.gridx += 1;
1660
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1661
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1662
- aConstraints.gridx = 0;
1663
- aConstraints.gridy += 1;
1664
- aConstraints.gridwidth = 1;
1665
-
1666
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1667
- Return();
1839
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1840
+ //Return();
16681841 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16691842 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16701843 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1675,130 +1848,105 @@
16751848 // aConstraints.gridy += 1;
16761849 // aConstraints.gridwidth = 1;
16771850
1678
- //aConstraints.weighty = 1;
1679
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1680
- //aConstraints.gridx += 1;
1681
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1682
- aConstraints.weighty = 0;
1683
- aConstraints.gridx = 0;
1684
- aConstraints.gridy += 1;
1685
- aConstraints.gridwidth = 1;
1851
+ cGridBag anisoU = new cGridBag();
1852
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1853
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1854
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1855
+ specularSection.add(anisoU);
16861856
1687
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1688
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1689
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1690
- aConstraints.gridx += 1;
1691
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1692
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1693
- aConstraints.gridx = 0;
1694
- aConstraints.gridy += 1;
1695
- aConstraints.gridwidth = 1;
1857
+ cGridBag anisoV = new cGridBag();
1858
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1859
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1860
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1861
+ specularSection.add(anisoV);
16961862
1697
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1698
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1699
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1700
- aConstraints.gridx += 1;
1701
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1702
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1703
- aConstraints.gridx = 0;
1704
- aConstraints.gridy += 1;
1705
- aConstraints.gridwidth = 1;
17061863
1707
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1708
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1709
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1710
- aConstraints.gridx += 1;
1711
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1712
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1713
- aConstraints.gridx = 0;
1714
- aConstraints.gridy += 1;
1715
- aConstraints.gridwidth = 1;
1864
+ panel.add(new JSeparator());
1865
+
1866
+ panel.add(specularSection);
1867
+
1868
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1869
+
1870
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17161871
1717
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1718
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1719
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1720
- aConstraints.gridx += 1;
1721
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1722
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1723
- aConstraints.gridx = 0;
1724
- aConstraints.gridy += 1;
1725
- aConstraints.gridwidth = 1;
1726
- aConstraints.weighty = 0;
1872
+ cGridBag camera = new cGridBag();
1873
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1874
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1875
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1876
+ colorSection.add(camera);
17271877
1728
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1729
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1730
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1731
- aConstraints.gridx += 1;
1732
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1733
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1734
- aConstraints.gridx = 0;
1735
- aConstraints.gridy += 1;
1736
- aConstraints.gridwidth = 1;
1878
+ cGridBag ambient = new cGridBag();
1879
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1880
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1881
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1882
+ colorSection.add(ambient);
17371883
1738
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1739
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1740
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1741
- aConstraints.gridx += 1;
1742
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1743
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1744
- aConstraints.gridx = 0;
1745
- aConstraints.gridy += 1;
1746
- aConstraints.gridwidth = 1;
1884
+ cGridBag backlit = new cGridBag();
1885
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1886
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1887
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1888
+ colorSection.add(backlit);
17471889
1748
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1749
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1750
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1751
- aConstraints.gridx += 1;
1752
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1753
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1754
- aConstraints.gridx = 0;
1755
- aConstraints.gridy += 1;
1756
- aConstraints.gridwidth = 1;
1890
+ cGridBag opacity = new cGridBag();
1891
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1892
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1893
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1894
+ colorSection.add(opacity);
17571895
1758
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1759
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1760
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1761
- aConstraints.gridx += 1;
1762
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1763
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1764
- aConstraints.gridx = 0;
1765
- aConstraints.gridy += 1;
1766
- aConstraints.gridwidth = 1;
1896
+ //panel.add(new JSeparator());
1897
+
1898
+ //panel.add(globalSection);
1899
+
1900
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1901
+
1902
+ cGridBag textureSection = new cGridBag().setVertical(true);
17671903
1768
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1769
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1771
- aConstraints.gridx += 1;
1772
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1773
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1774
- aConstraints.gridx = 0;
1775
- aConstraints.gridy += 1;
1776
- aConstraints.gridwidth = 1;
1904
+ cGridBag bump = new cGridBag();
1905
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1906
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1907
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1908
+ textureSection.add(bump);
17771909
1778
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1779
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1780
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1781
- aConstraints.gridx += 1;
1782
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1783
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1784
- aConstraints.gridx = 0;
1785
- aConstraints.gridy += 1;
1786
- aConstraints.gridwidth = 1;
1910
+ cGridBag noise = new cGridBag();
1911
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1912
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1913
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1914
+ textureSection.add(noise);
17871915
1788
- //aConstraints.weighty = 1;
1789
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1790
- //aConstraints.gridx += 1;
1791
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1792
- aConstraints.weighty = 0;
1916
+ cGridBag power = new cGridBag();
1917
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1918
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1919
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1920
+ textureSection.add(power);
17931921
1794
- aConstraints.gridx = 0;
1795
- aConstraints.gridy = 0;
1796
- aConstraints.gridwidth = 1;
1922
+ cGridBag borderfade = new cGridBag();
1923
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1924
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1925
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1926
+ textureSection.add(borderfade);
1927
+
1928
+ cGridBag fog = new cGridBag();
1929
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1930
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1931
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1932
+ textureSection.add(fog);
1933
+
1934
+ cGridBag opacityPower = new cGridBag();
1935
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1936
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1937
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1938
+ textureSection.add(opacityPower);
1939
+
1940
+ panel.add(new JSeparator());
1941
+
1942
+ panel.add(textureSection);
1943
+
1944
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17971945
17981946 SetMaterial(copy); // .GetMaterial());
17991947
1800
- colorField.addChangeListener(this);
1801
- modulationField.addChangeListener(this);
1948
+ //colorField.addChangeListener(this);
1949
+// modulationField.addChangeListener(this);
18021950 metalnessField.addChangeListener(this);
18031951 diffuseField.addChangeListener(this);
18041952 specularField.addChangeListener(this);
....@@ -1828,12 +1976,15 @@
18281976 opacityPowerField.addChangeListener(this);
18291977 /**/
18301978
1831
- resetSlidersButton.addActionListener(this);
18321979 clearMaterialButton.addActionListener(this);
18331980 createMaterialButton.addActionListener(this);
1834
-
1835
- propagateToggle.addItemListener(this);
1836
- multiplyToggle.addItemListener(this);
1981
+
1982
+ if (Globals.ADVANCED)
1983
+ {
1984
+ resetSlidersButton.addActionListener(this);
1985
+ propagateToggle.addItemListener(this);
1986
+ multiplyToggle.addItemListener(this);
1987
+ }
18371988 }
18381989
18391990 void DropFile(java.io.File[] files, boolean textures)
....@@ -1851,8 +2002,9 @@
18512002 // 3D models
18522003 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18532004 {
1854
- lastConverter = new com.jmex.model.converters.MaxToJme();
1855
- LoadFile(filename, lastConverter);
2005
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2006
+ //LoadFile(filename, lastConverter);
2007
+ LoadObjFile(filename); // New 3ds loader
18562008 continue;
18572009 }
18582010 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2004,7 +2156,7 @@
20042156
20052157 //? flashIt = false;
20062158 CameraPane pane = (CameraPane) cameraView;
2007
- pane.clickStart(location.x, location.y, 0);
2159
+ pane.clickStart(location.x, location.y, 0, 0);
20082160 pane.clickEnd(location.x, location.y, 0, true);
20092161
20102162 if (group.selection.size() == 1)
....@@ -2053,6 +2205,7 @@
20532205 e2.printStackTrace();
20542206 }
20552207 }
2208
+
20562209 LoadJMEThread loadThread;
20572210
20582211 class LoadJMEThread extends Thread
....@@ -2110,6 +2263,7 @@
21102263 //LoadFile0(filename, converter);
21112264 }
21122265 }
2266
+
21132267 LoadOBJThread loadObjThread;
21142268
21152269 class LoadOBJThread extends Thread
....@@ -2188,19 +2342,19 @@
21882342
21892343 void LoadObjFile(String fullname)
21902344 {
2191
- /*
2345
+ System.out.println("Loading " + fullname);
2346
+ /**/
21922347 //lastFilename = fullname;
21932348 if(loadObjThread == null)
21942349 {
2195
- loadObjThread = new LoadOBJThread();
2196
- loadObjThread.start();
2350
+ loadObjThread = new LoadOBJThread();
2351
+ loadObjThread.start();
21972352 }
21982353
21992354 loadObjThread.add(fullname);
2200
- */
2355
+ /**/
22012356
2202
- System.out.println("Loading " + fullname);
2203
- makeSomething(new FileObject(fullname, true), true);
2357
+ //makeSomething(new FileObject(fullname, true), true);
22042358 }
22052359
22062360 void LoadGFDFile(String fullname)
....@@ -2461,11 +2615,11 @@
24612615
24622616 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24632617 {
2464
- if (GrafreeD.standAlone)
2618
+ if (Grafreed.standAlone)
24652619 {
24662620 /**/
24672621 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2468
- browser.show();
2622
+ browser.setVisible(true);
24692623 String filename = browser.getFile();
24702624 if (filename != null && filename.length() > 0)
24712625 {
....@@ -2576,6 +2730,7 @@
25762730 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25772731 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25782732 }
2733
+
25792734 //cJME.count++;
25802735 //cJME.count %= 12;
25812736 if (gc)
....@@ -2610,6 +2765,7 @@
26102765 }
26112766 if (input == null)
26122767 {
2768
+ new Exception().printStackTrace();
26132769 System.exit(0);
26142770 }
26152771
....@@ -2758,6 +2914,7 @@
27582914 }
27592915 }
27602916 }
2917
+
27612918 cFileSystemPane FSPane;
27622919
27632920 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2811,11 +2968,14 @@
28112968 }
28122969 }
28132970 }
2971
+
28142972 freezematerial = false;
28152973 }
28162974
28172975 void SetMaterial(Object3D object)
28182976 {
2977
+ latestObject = object;
2978
+
28192979 cMaterial mat = object.material;
28202980
28212981 if (mat == null)
....@@ -2824,7 +2984,8 @@
28242984 return;
28252985 }
28262986
2827
- multiplyToggle.setSelected(mat.multiply);
2987
+ if (multiplyToggle != null)
2988
+ multiplyToggle.setSelected(mat.multiply);
28282989
28292990 assert (object.projectedVertices != null);
28302991
....@@ -2926,12 +3087,17 @@
29263087 // }
29273088
29283089 /**/
2929
- if (deselect)
3090
+ if (deselect || child == null)
29303091 {
29313092 //group.deselectAll();
29323093 //freeze = true;
29333094 GetTree().clearSelection();
29343095 //freeze = false;
3096
+
3097
+ if (child == null)
3098
+ {
3099
+ return;
3100
+ }
29353101 }
29363102
29373103 //group.addSelectee(child);
....@@ -3000,7 +3166,7 @@
30003166 cameraView.ToggleDL();
30013167 cameraView.repaint();
30023168 return;
3003
- } else if (event.getSource() == toggleTextureItem)
3169
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30043170 {
30053171 cameraView.ToggleTexture();
30063172 // june 2013 copy.HardTouch();
....@@ -3039,9 +3205,9 @@
30393205 frame.validate();
30403206
30413207 return;
3042
- } else if (event.getSource() == toggleRandomItem)
3208
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30433209 {
3044
- cameraView.ToggleRandom();
3210
+ cameraView.ToggleSwitch();
30453211 cameraView.repaint();
30463212 return;
30473213 } else if (event.getSource() == toggleHandleItem)
....@@ -3070,6 +3236,10 @@
30703236 {
30713237 copy.live ^= true;
30723238 return;
3239
+ } else if (event.getSource() == selectCB)
3240
+ {
3241
+ copy.dontselect ^= true;
3242
+ return;
30733243 } else if (event.getSource() == hideCB)
30743244 {
30753245 copy.hide ^= true;
....@@ -3084,6 +3254,7 @@
30843254 if (event.getSource() == randomCB)
30853255 {
30863256 copy.random ^= true;
3257
+ objEditor.refreshContents();
30873258 return;
30883259 }
30893260 if (event.getSource() == speedupCB)
....@@ -3107,8 +3278,9 @@
31073278
31083279 public void actionPerformed(ActionEvent event)
31093280 {
3281
+ Object source = event.getSource();
31103282 // SCRIPT DIALOG
3111
- if (event.getSource() == okbutton)
3283
+ if (source == okbutton)
31123284 {
31133285 textpanel.setVisible(false);
31143286 textpanel.remove(textarea);
....@@ -3120,7 +3292,7 @@
31203292 textarea = null;
31213293 textpanel = null;
31223294 }
3123
- if (event.getSource() == cancelbutton)
3295
+ if (source == cancelbutton)
31243296 {
31253297 textpanel.setVisible(false);
31263298 textpanel.remove(textarea);
....@@ -3132,50 +3304,50 @@
31323304 //applySelf();
31333305 //client.refreshEditWindow();
31343306 //refreshContents();
3135
- if (event.getSource() == nameField)
3307
+ if (source == nameField)
31363308 {
31373309 //System.out.println("ObjEditor " + event);
31383310 applySelf0(true);
31393311 //parent.applySelf();
31403312 objEditor.refreshContents();
3141
- } else if (event.getSource() == resetButton)
3313
+ } else if (source == resetButton)
31423314 {
31433315 CameraPane.fullreset = true;
31443316 copy.Reset(); // ResetMeshes();
31453317 copy.Touch();
31463318 objEditor.refreshContents();
3147
- } else if (event.getSource() == stepItem)
3319
+ } else if (source == stepItem)
31483320 {
31493321 //cameraView.ONESTEP = true;
31503322 Globals.ONESTEP = true;
31513323 cameraView.repaint();
31523324 return;
3153
- } else if (event.getSource() == stepButton)
3325
+ } else if (source == stepButton)
31543326 {
31553327 copy.Step();
31563328 copy.Touch();
31573329 objEditor.refreshContents();
3158
- } else if (event.getSource() == slowerButton)
3330
+ } else if (source == slowerButton)
31593331 {
31603332 copy.Slower();
31613333 copy.Touch();
31623334 objEditor.refreshContents();
3163
- } else if (event.getSource() == fasterButton)
3335
+ } else if (source == fasterButton)
31643336 {
31653337 copy.Faster();
31663338 copy.Touch();
31673339 objEditor.refreshContents();
3168
- } else if (event.getSource() == remarkButton)
3340
+ } else if (source == remarkButton)
31693341 {
31703342 copy.Remark();
31713343 copy.Touch();
31723344 objEditor.refreshContents();
3173
- } else if (event.getSource() == stepAllButton)
3345
+ } else if (source == stepAllButton)
31743346 {
31753347 copy.StepAll();
31763348 copy.Touch();
31773349 objEditor.refreshContents();
3178
- } else if (event.getSource() == resetAllButton)
3350
+ } else if (source == resetAllButton)
31793351 {
31803352 //CameraPane.fullreset = true;
31813353 copy.ResetAll(); // ResetMeshes();
....@@ -3208,53 +3380,79 @@
32083380 // Close();
32093381 // }
32103382 // else
3211
- if (event.getSource() == resetSlidersButton)
3383
+ if (source == resetSlidersButton)
32123384 {
32133385 ResetSliders();
3214
- } else if (event.getSource() == clearMaterialButton)
3386
+ } else if (source == clearMaterialButton)
32153387 {
32163388 ClearMaterial();
3217
- } else if (event.getSource() == createMaterialButton)
3389
+ } else if (source == createMaterialButton)
32183390 {
32193391 CreateMaterial();
3220
- } else if (event.getSource() == clearPanelButton)
3392
+ } else if (source == clearPanelButton)
32213393 {
32223394 copy.ClearUI();
32233395 refreshContents(true);
3224
- } /*
3225
- }
3226
-
3227
- public boolean action(Event event, Object arg)
3228
- {
3229
- */ else if (event.getSource() == closeItem)
3396
+ } else if (source == importGFDItem)
3397
+ {
3398
+ ImportGFD();
3399
+ } else
3400
+ if (source == importVRMLX3DItem)
3401
+ {
3402
+ ImportVRMLX3D();
3403
+ } else
3404
+ if (source == import3DSItem)
3405
+ {
3406
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3407
+ } else
3408
+ if (source == importOBJItem)
3409
+ {
3410
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3411
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3412
+ browser.setVisible(true);
3413
+ String filename = browser.getFile();
3414
+ if (filename != null && filename.length() > 0)
3415
+ {
3416
+ String fullname = browser.getDirectory() + filename;
3417
+ makeSomething(ReadOBJ(fullname), true);
3418
+ }
3419
+ } else
3420
+ if (source == closeItem)
32303421 {
32313422 Close();
32323423 //return true;
3233
- } else if (event.getSource() == loadItem)
3424
+ } else if (source == openItem)
32343425 {
3235
- load();
3426
+ Open();
32363427 //return true;
3237
- } else if (event.getSource() == saveItem)
3428
+ } else if (source == newItem)
3429
+ {
3430
+ New();
3431
+ } else if (source == saveItem)
32383432 {
32393433 save();
32403434 //return true;
3241
- } else if (event.getSource() == saveAsItem)
3435
+ } else if (source == saveAsItem)
32423436 {
32433437 saveAs();
32443438 //return true;
3245
- } else if (event.getSource() == reexportItem)
3439
+ } else if (source == reexportItem)
32463440 {
32473441 reexport();
32483442 //return true;
3249
- } else if (event.getSource() == exportAsItem)
3443
+ } else if (source == exportAsItem)
32503444 {
32513445 export();
32523446 //return true;
3253
- } else if (event.getSource() == povItem)
3447
+ } else if (source == povItem)
32543448 {
32553449 generatePOV();
32563450 //return true;
3257
- } else if (event.getSource() == zBufferItem)
3451
+ } else if (event.getSource() == archiveItem)
3452
+ {
3453
+ cTools.Archive(frame);
3454
+ return;
3455
+ } else if (source == zBufferItem)
32583456 {
32593457 try
32603458 {
....@@ -3276,21 +3474,8 @@
32763474 cameraView.repaint();
32773475 //return true;
32783476 }
3279
- */ else if (event.getSource() == editCameraItem)
3280
- {
3281
- cameraView.ProtectCamera();
3282
- cameraView.repaint();
3283
- return;
3284
- } else if (event.getSource() == revertCameraItem)
3285
- {
3286
- cameraView.RevertCamera();
3287
- cameraView.repaint();
3288
- return;
3289
-// } else if (event.getSource() == textureButton)
3290
-// {
3291
-// return; // true;
3292
- } else // combos...
3293
- if (event.getSource() == texresMenu)
3477
+ */ else // combos...
3478
+ if (source == texresMenu)
32943479 {
32953480 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32963481 copy.texres = texresMenu.getSelectedIndex();
....@@ -3302,12 +3487,382 @@
33023487 }
33033488 }
33043489
3490
+ void New()
3491
+ {
3492
+ while (copy.Size() > 1)
3493
+ {
3494
+ copy.remove(1);
3495
+ }
3496
+
3497
+ ResetModel();
3498
+ objEditor.refreshContents();
3499
+ }
3500
+
3501
+ static public byte[] Compress(Object3D o)
3502
+ {
3503
+ try
3504
+ {
3505
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3506
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3507
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3508
+
3509
+ Object3D parent = o.parent;
3510
+ o.parent = null;
3511
+
3512
+ out.writeObject(o);
3513
+
3514
+ o.parent = parent;
3515
+
3516
+ out.flush();
3517
+
3518
+ baos //zstream
3519
+ .close();
3520
+ out.close();
3521
+
3522
+ byte[] bytes = baos.toByteArray();
3523
+
3524
+ System.out.println("save #bytes = " + bytes.length);
3525
+ return bytes;
3526
+ } catch (Exception e)
3527
+ {
3528
+ System.err.println(e);
3529
+ return null;
3530
+ }
3531
+ }
3532
+
3533
+ static public Object Uncompress(byte[] bytes)
3534
+ {
3535
+ System.out.println("restore #bytes = " + bytes.length);
3536
+ try
3537
+ {
3538
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3539
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3540
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3541
+ Object obj = in.readObject();
3542
+
3543
+ bais //istream
3544
+ .close();
3545
+ in.close();
3546
+
3547
+ return obj;
3548
+ } catch (Exception e)
3549
+ {
3550
+ System.err.println(e);
3551
+ return null;
3552
+ }
3553
+ }
3554
+
3555
+ static public Object clone(Object o)
3556
+ {
3557
+ try
3558
+ {
3559
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3560
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3561
+
3562
+ out.writeObject(o);
3563
+
3564
+ out.flush();
3565
+ out.close();
3566
+
3567
+ byte[] bytes = baos.toByteArray();
3568
+
3569
+ System.out.println("clone = " + bytes.length);
3570
+
3571
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3572
+ ObjectInputStream in = new ObjectInputStream(bais);
3573
+ Object obj = in.readObject();
3574
+ in.close();
3575
+
3576
+ return obj;
3577
+ } catch (Exception e)
3578
+ {
3579
+ System.err.println(e);
3580
+ return null;
3581
+ }
3582
+ }
3583
+
3584
+ cRadio GetCurrentTab()
3585
+ {
3586
+ cRadio ab;
3587
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3588
+ {
3589
+ ab = (cRadio)e.nextElement();
3590
+ if(ab.GetObject() == copy)
3591
+ {
3592
+ return ab;
3593
+ }
3594
+ }
3595
+
3596
+ return null;
3597
+ }
3598
+
3599
+
3600
+ public void Save()
3601
+ {
3602
+ //Save(true);
3603
+ Replace();
3604
+ }
3605
+
3606
+ private boolean Equal(byte[] compress, byte[] name)
3607
+ {
3608
+ if (compress.length != name.length)
3609
+ {
3610
+ return false;
3611
+ }
3612
+
3613
+ for (int i=compress.length; --i>=0;)
3614
+ {
3615
+ if (compress[i] != name[i])
3616
+ return false;
3617
+ }
3618
+
3619
+ return true;
3620
+ }
3621
+
3622
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3623
+
3624
+ public boolean Save(boolean user)
3625
+ {
3626
+ System.err.println("Save");
3627
+
3628
+ cRadio tab = GetCurrentTab();
3629
+
3630
+ byte[] compress = CompressCopy();
3631
+
3632
+ boolean thesame = false;
3633
+
3634
+ // Quick heuristic using length. Works only when stream is compressed.
3635
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3636
+ {
3637
+ thesame = true;
3638
+ }
3639
+
3640
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3641
+ if (!thesame)
3642
+ {
3643
+ //tab.user[tab.versionindex] = user;
3644
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3645
+
3646
+ copy.versions[++copy.versionindex] = compress;
3647
+
3648
+ // if (increment)
3649
+ // tab.versionindex++;
3650
+ }
3651
+
3652
+ //copy.RestoreBigData(versiontable);
3653
+
3654
+ //assert(hashtable.isEmpty());
3655
+
3656
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3657
+ {
3658
+ //tab.user[i] = false;
3659
+ copy.versions[i] = null;
3660
+ }
3661
+
3662
+ SetUndoStates();
3663
+
3664
+ // test save
3665
+ if (false)
3666
+ {
3667
+ try
3668
+ {
3669
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3670
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3671
+
3672
+ p.writeObject(copy);
3673
+
3674
+ p.flush();
3675
+
3676
+ ostream.close();
3677
+ } catch (Exception e)
3678
+ {
3679
+ e.printStackTrace();
3680
+ }
3681
+ }
3682
+
3683
+ return !thesame;
3684
+ }
3685
+
3686
+ void CopyChanged(Object3D obj)
3687
+ {
3688
+ SetUndoStates();
3689
+
3690
+ boolean temp = CameraPane.SWITCH;
3691
+ CameraPane.SWITCH = false;
3692
+
3693
+ copy.ExtractBigData(versiontable);
3694
+
3695
+ copy.clear();
3696
+
3697
+ for (int i=0; i<obj.Size(); i++)
3698
+ {
3699
+ copy.add(obj.get(i));
3700
+ }
3701
+
3702
+ copy.RestoreBigData(versiontable);
3703
+
3704
+ CameraPane.SWITCH = temp;
3705
+
3706
+ //assert(hashtable.isEmpty());
3707
+
3708
+ copy.Touch();
3709
+
3710
+ ResetModel();
3711
+ copy.HardTouch(); // recompile?
3712
+
3713
+ cRadio ab;
3714
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3715
+ {
3716
+ ab = (cRadio)e.nextElement();
3717
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3718
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3719
+ if (test != null)
3720
+ {
3721
+ test.editWindow = ab.object.editWindow;
3722
+ ab.object = test;
3723
+ }
3724
+ }
3725
+
3726
+ refreshContents();
3727
+ }
3728
+
3729
+ cButton undoButton;
3730
+ cButton restoreButton;
3731
+ cButton replaceButton;
3732
+ cButton redoButton;
3733
+
3734
+ void SetUndoStates()
3735
+ {
3736
+ cRadio tab = GetCurrentTab();
3737
+
3738
+ restoreButton.setEnabled(copy.versionindex != -1);
3739
+ replaceButton.setEnabled(copy.versionindex != -1);
3740
+ undoButton.setEnabled(copy.versionindex > 0);
3741
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3742
+ }
3743
+
3744
+ public boolean Undo()
3745
+ {
3746
+ System.err.println("Undo");
3747
+
3748
+ cRadio tab = GetCurrentTab();
3749
+
3750
+ if (copy.versionindex == 0)
3751
+ {
3752
+ java.awt.Toolkit.getDefaultToolkit().beep();
3753
+ return false;
3754
+ }
3755
+
3756
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3757
+// {
3758
+// if (Save(false))
3759
+// tab.versionindex -= 1;
3760
+// else
3761
+// {
3762
+// if (tab.versionindex <= 0)
3763
+// return false;
3764
+// else
3765
+// tab.versionindex -= 1;
3766
+// }
3767
+// }
3768
+
3769
+ copy.versionindex -= 1;
3770
+
3771
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3772
+
3773
+ return true;
3774
+ }
3775
+
3776
+ public boolean Restore()
3777
+ {
3778
+ System.err.println("Restore");
3779
+
3780
+ cRadio tab = GetCurrentTab();
3781
+
3782
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3783
+ {
3784
+ java.awt.Toolkit.getDefaultToolkit().beep();
3785
+ return false;
3786
+ }
3787
+
3788
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3789
+
3790
+ return true;
3791
+ }
3792
+
3793
+ public boolean Replace()
3794
+ {
3795
+ System.err.println("Replace");
3796
+
3797
+ cRadio tab = GetCurrentTab();
3798
+
3799
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3800
+ {
3801
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3802
+ return false;
3803
+ }
3804
+
3805
+ copy.versions[copy.versionindex] = CompressCopy();
3806
+
3807
+ return true;
3808
+ }
3809
+
3810
+ public void Redo()
3811
+ {
3812
+ cRadio tab = GetCurrentTab();
3813
+
3814
+ if (copy.versions[copy.versionindex + 1] == null)
3815
+ {
3816
+ java.awt.Toolkit.getDefaultToolkit().beep();
3817
+ return;
3818
+ }
3819
+
3820
+ copy.versionindex += 1;
3821
+
3822
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3823
+
3824
+ //if (!tab.user[tab.versionindex])
3825
+ // tab.graphs[tab.versionindex] = null;
3826
+ }
3827
+
3828
+ void ImportGFD()
3829
+ {
3830
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3831
+ browser.show();
3832
+ String filename = browser.getFile();
3833
+ if (filename != null && filename.length() > 0)
3834
+ {
3835
+ String fullname = browser.getDirectory() + filename;
3836
+
3837
+ //Object3D readobj =
3838
+ objEditor.ReadGFD(fullname, objEditor);
3839
+ //makeSomething(readobj);
3840
+ }
3841
+ }
3842
+
3843
+ void ImportVRMLX3D()
3844
+ {
3845
+ if (Grafreed.standAlone)
3846
+ {
3847
+ /**/
3848
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3849
+ browser.show();
3850
+ String filename = browser.getFile();
3851
+ if (filename != null && filename.length() > 0)
3852
+ {
3853
+ String fullname = browser.getDirectory() + filename;
3854
+ LoadVRMLX3D(fullname);
3855
+ }
3856
+ /**/
3857
+ }
3858
+ }
3859
+
33053860 void ToggleAnimation()
33063861 {
33073862 if (!Globals.ANIMATION)
33083863 {
33093864 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3310
- browser.show();
3865
+ browser.setVisible(true);
33113866 String filename = browser.getFile();
33123867 if (filename != null && filename.length() > 0)
33133868 {
....@@ -3317,8 +3872,8 @@
33173872
33183873 Globals.ANIMATION ^= true;
33193874
3320
- GrafreeD.wav.cursor = 0;
3321
- GrafreeD.wav.loop = 0;
3875
+ Grafreed.wav.cursor = 0;
3876
+ Grafreed.wav.loop = 0;
33223877 }
33233878 } else
33243879 {
....@@ -3368,7 +3923,7 @@
33683923 void CreateMaterial()
33693924 {
33703925 //copy.ClearMaterial(); // PATCH
3371
- copy.CreateMaterialS(multiplyToggle.isSelected());
3926
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33723927 if (copy.selection.size() > 0)
33733928 //SetMaterial(copy);
33743929 {
....@@ -3419,7 +3974,7 @@
34193974 assert false;
34203975 }
34213976
3422
- void EditSelection()
3977
+ void EditSelection(boolean newWindow)
34233978 {
34243979 }
34253980
....@@ -3427,11 +3982,11 @@
34273982 {
34283983 copy.ResetBlockLoop(); // temporary problem
34293984
3430
- boolean random = CameraPane.RANDOM;
3431
- CameraPane.RANDOM = false; // parse everything
3985
+ boolean random = CameraPane.SWITCH;
3986
+ CameraPane.SWITCH = false; // parse everything
34323987 copy.ResetDisplayList();
34333988 copy.HardTouch();
3434
- CameraPane.RANDOM = random;
3989
+ CameraPane.SWITCH = random;
34353990 }
34363991
34373992 // public void applySelf()
....@@ -3501,10 +4056,40 @@
35014056 current.fakedepth = (float) fakedepthField.getFloat();
35024057 current.shadowbias = (float) shadowbiasField.getFloat();
35034058
3504
- if (!NumberSlider.frozen)
4059
+ if (!cNumberSlider.frozen)
35054060 {
35064061 //System.out.println("Propagate = " + propagate);
35074062 copy.UpdateMaterial(anchor, current, propagate);
4063
+
4064
+ if (copy.material != null)
4065
+ {
4066
+ cMaterial mat = copy.material;
4067
+
4068
+ colorField.SetToolTipValue((mat.color));
4069
+ modulationField.SetToolTipValue((mat.modulation));
4070
+ metalnessField.SetToolTipValue((mat.metalness));
4071
+ diffuseField.SetToolTipValue((mat.diffuse));
4072
+ specularField.SetToolTipValue((mat.specular));
4073
+ shininessField.SetToolTipValue((mat.shininess));
4074
+ shiftField.SetToolTipValue((mat.shift));
4075
+ ambientField.SetToolTipValue((mat.ambient));
4076
+ lightareaField.SetToolTipValue((mat.lightarea));
4077
+ diffusenessField.SetToolTipValue((mat.factor));
4078
+ velvetField.SetToolTipValue((mat.velvet));
4079
+ sheenField.SetToolTipValue((mat.sheen));
4080
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4081
+ backlitField.SetToolTipValue((mat.bump));
4082
+ anisoField.SetToolTipValue((mat.aniso));
4083
+ anisoVField.SetToolTipValue((mat.anisoV));
4084
+ cameraField.SetToolTipValue((mat.cameralight));
4085
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4086
+ shadowField.SetToolTipValue((mat.shadow));
4087
+ textureField.SetToolTipValue((mat.texture));
4088
+ opacityField.SetToolTipValue((mat.opacity));
4089
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4090
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4091
+ }
4092
+
35084093 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35094094 {
35104095 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3533,9 +4118,22 @@
35334118 //copy.Touch();
35344119 }
35354120
4121
+ cNumberSlider versionField;
4122
+
35364123 public void stateChanged(ChangeEvent e)
35374124 {
35384125 // assert(false);
4126
+ if (e.getSource() == versionField)
4127
+ {
4128
+ int version = versionField.getInteger();
4129
+
4130
+ if (copy.versions[version] != null)
4131
+ {
4132
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4133
+ }
4134
+
4135
+ return;
4136
+ }
35394137
35404138 if (freezematerial)
35414139 {
....@@ -3549,6 +4147,7 @@
35494147 || e.getSource() == apertureField
35504148 || e.getSource() == shadowblurField)
35514149 {
4150
+ new Exception().printStackTrace();
35524151 System.exit(0);
35534152 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35544153 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3619,7 +4218,7 @@
36194218 }
36204219
36214220 if (normalpushField != null)
3622
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4221
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36234222 }
36244223
36254224 void SnapObject()
....@@ -3874,7 +4473,7 @@
38744473
38754474 radioPanel.revalidate();
38764475 radioPanel.repaint();
3877
- ctrlPanel.revalidate(); // ? new
4476
+ ctrlPanel.validate(); // ? new
38784477 ctrlPanel.repaint();
38794478 }
38804479 }
....@@ -3883,6 +4482,8 @@
38834482
38844483 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38854484 {
4485
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4486
+ Save();
38864487 //Tween.set(thing, 0).target(1).start(tweenManager);
38874488 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38884489 // if (thing instanceof GenericJointDemo)
....@@ -3969,6 +4570,12 @@
39694570 {
39704571 ResetModel();
39714572 Select(thing.GetTreePath(), true, false); // unselect... false);
4573
+
4574
+ if (thing.Size() == 0)
4575
+ {
4576
+ //EditSelection(false);
4577
+ }
4578
+
39724579 refreshContents();
39734580 }
39744581
....@@ -4086,6 +4693,7 @@
40864693 }
40874694 }
40884695 }
4696
+
40894697 LoadGFDThread loadGFDThread;
40904698
40914699 void ReadGFD(String fullname, iCallBack cb)
....@@ -4105,8 +4713,10 @@
41054713
41064714 try
41074715 {
4716
+ // Try compressed version first.
41084717 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4109
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4718
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4719
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41104720
41114721 readobj = (Object3D) p.readObject();
41124722 istream.close();
....@@ -4114,7 +4724,20 @@
41144724 readobj.ResetDisplayList();
41154725 } catch (Exception e)
41164726 {
4117
- e.printStackTrace();
4727
+ //e.printStackTrace();
4728
+ try
4729
+ {
4730
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4731
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4732
+
4733
+ readobj = (Object3D) p.readObject();
4734
+ istream.close();
4735
+
4736
+ readobj.ResetDisplayList();
4737
+ } catch (Exception e2)
4738
+ {
4739
+ e2.printStackTrace();
4740
+ }
41184741 }
41194742 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41204743 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4160,6 +4783,12 @@
41604783
41614784 void LoadIt(Object obj)
41624785 {
4786
+ if (obj == null)
4787
+ {
4788
+ // Invalid file
4789
+ return;
4790
+ }
4791
+
41634792 System.out.println("Loaded " + obj);
41644793 //new Exception().printStackTrace();
41654794 Object3D readobj = (Object3D) obj;
....@@ -4169,6 +4798,8 @@
41694798
41704799 if (readobj != null)
41714800 {
4801
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4802
+ // Save();
41724803 try
41734804 {
41744805 //readobj.deepCopySelf(copy);
....@@ -4223,15 +4854,20 @@
42234854 c.addChild(csg);
42244855 }
42254856
4857
+ copy.versions = readobj.versions;
4858
+ copy.versionindex = readobj.versionindex;
4859
+
4860
+ SetUndoStates();
4861
+
42264862 ResetModel();
42274863 copy.HardTouch(); // recompile?
42284864 refreshContents();
42294865 }
42304866 }
42314867
4232
- void load() // throws ClassNotFoundException
4868
+ void Open() // throws ClassNotFoundException
42334869 {
4234
- if (GrafreeD.standAlone)
4870
+ if (Grafreed.standAlone)
42354871 {
42364872 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42374873 browser.show();
....@@ -4318,11 +4954,13 @@
43184954 try
43194955 {
43204956 FileOutputStream ostream = new FileOutputStream(lastname);
4321
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4957
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4958
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43224959
43234960 p.writeObject(copy);
43244961 p.flush();
43254962
4963
+ zstream.close();
43264964 ostream.close();
43274965
43284966 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4332,17 +4970,20 @@
43324970 {
43334971 }
43344972 }
4973
+
43354974 String lastname;
43364975
43374976 void saveAs()
43384977 {
4339
- if (GrafreeD.standAlone)
4978
+ if (Grafreed.standAlone)
43404979 {
43414980 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43424981 browser.setVisible(true);
43434982 String filename = browser.getFile();
43444983 if (filename != null && filename.length() > 0)
43454984 {
4985
+ if (!filename.endsWith(".gfd"))
4986
+ filename += ".gfd";
43464987 lastname = browser.getDirectory() + filename;
43474988 save();
43484989 }
....@@ -4441,13 +5082,13 @@
44415082 try
44425083 {
44435084 FileOutputStream ostream = new FileOutputStream(filename);
4444
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4445
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5085
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5086
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44465087
44475088 Object3D objectparent = obj.parent;
44485089 obj.parent = null;
44495090
4450
- Object3D object = (Object3D) GrafreeD.clone(obj);
5091
+ Object3D object = (Object3D) Grafreed.clone(obj);
44515092
44525093 obj.parent = objectparent;
44535094
....@@ -4459,8 +5100,8 @@
44595100 p.writeObject(object);
44605101 p.flush();
44615102
5103
+ zstream.close();
44625104 ostream.close();
4463
- // zstream.close();
44645105
44655106 // group.selection.get(0).parent = parent;
44665107 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4481,7 +5122,7 @@
44815122 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44825123 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44835124 copy.generatePOV(buffer);
4484
- if (GrafreeD.standAlone)
5125
+ if (Grafreed.standAlone)
44855126 {
44865127 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44875128 browser.show();
....@@ -4507,21 +5148,20 @@
45075148 Object3D client;
45085149 Object3D copy;
45095150 MenuBar menuBar;
4510
- Menu windowMenu;
4511
- MenuItem loadItem;
5151
+ Menu fileMenu;
5152
+ MenuItem newItem;
5153
+ MenuItem openItem;
45125154 MenuItem saveItem;
45135155 MenuItem saveAsItem;
45145156 MenuItem exportAsItem;
45155157 MenuItem reexportItem;
45165158 MenuItem povItem;
45175159 MenuItem closeItem;
4518
- Menu cameraMenu;
5160
+
45195161 CheckboxMenuItem zBufferItem;
45205162 //MenuItem normalLensItem;
4521
- MenuItem editCameraItem;
4522
- MenuItem revertCameraItem;
4523
- CheckboxMenuItem toggleLiveItem;
45245163 MenuItem stepItem;
5164
+ CheckboxMenuItem toggleLiveItem;
45255165 CheckboxMenuItem toggleFullScreenItem;
45265166 CheckboxMenuItem toggleTimelineItem;
45275167 CheckboxMenuItem toggleRenderItem;
....@@ -4530,28 +5170,42 @@
45305170 CheckboxMenuItem toggleFootContactItem;
45315171 CheckboxMenuItem toggleDLItem;
45325172 CheckboxMenuItem toggleTextureItem;
4533
- CheckboxMenuItem toggleRandomItem;
5173
+ CheckboxMenuItem toggleSwitchItem;
45345174 CheckboxMenuItem toggleRootItem;
45355175 CheckboxMenuItem animationItem;
5176
+ MenuItem archiveItem;
45365177 CheckboxMenuItem toggleHandleItem;
45375178 CheckboxMenuItem togglePaintItem;
45385179 JSplitPane mainPanel;
45395180 JScrollPane scrollpane;
5181
+
45405182 JPanel toolbarPanel;
4541
- JPanel treePanel;
5183
+
5184
+ cGridBag treePanel;
5185
+
45425186 JPanel radioPanel;
45435187 ButtonGroup buttonGroup;
4544
- JPanel ctrlPanel;
4545
- JPanel materialPanel;
5188
+
5189
+ cGridBag toolboxPanel;
5190
+ cGridBag materialPanel;
5191
+ cGridBag ctrlPanel;
5192
+
45465193 JScrollPane infoPanel;
4547
- JPanel optionsPanel;
5194
+
5195
+ cGridBag optionsPanel;
5196
+
45485197 JTabbedPane objectPanel;
4549
- JPanel XYZPanel;
5198
+ boolean materialFlushed;
5199
+ Object3D latestObject;
5200
+
5201
+ cGridBag XYZPanel;
5202
+
45505203 JSplitPane gridPanel;
45515204 JSplitPane bigPanel;
4552
- JPanel bigThree;
4553
- JTabbedPane scenePanel;
4554
- JPanel centralPanel;
5205
+
5206
+ cGridBag bigThree;
5207
+ cGridBag scenePanel;
5208
+ cGridBag centralPanel;
45555209 JSplitPane cameraPanel;
45565210 JPanel timelinePanel;
45575211 JMenuBar timelineMenubar;
....@@ -4604,67 +5258,72 @@
46045258 // MATERIAL
46055259 JLabel materialLabel;
46065260 JLabel colorLabel;
4607
- NumberSlider colorField;
5261
+ cNumberSlider colorField;
46085262 JLabel modulationLabel;
4609
- NumberSlider modulationField;
5263
+ cNumberSlider modulationField;
46105264 JLabel metalnessLabel;
4611
- NumberSlider metalnessField;
5265
+ cNumberSlider metalnessField;
46125266 JLabel diffuseLabel;
4613
- NumberSlider diffuseField;
5267
+ cNumberSlider diffuseField;
46145268 JLabel specularLabel;
4615
- NumberSlider specularField;
5269
+ cNumberSlider specularField;
46165270 JLabel shininessLabel;
4617
- NumberSlider shininessField;
5271
+ cNumberSlider shininessField;
46185272 JLabel shiftLabel;
4619
- NumberSlider shiftField;
5273
+ cNumberSlider shiftField;
46205274 JLabel ambientLabel;
4621
- NumberSlider ambientField;
5275
+ cNumberSlider ambientField;
46225276 JLabel lightareaLabel;
4623
- NumberSlider lightareaField;
5277
+ cNumberSlider lightareaField;
46245278 JLabel diffusenessLabel;
4625
- NumberSlider diffusenessField;
5279
+ cNumberSlider diffusenessField;
46265280 JLabel velvetLabel;
4627
- NumberSlider velvetField;
5281
+ cNumberSlider velvetField;
46285282 JLabel sheenLabel;
4629
- NumberSlider sheenField;
5283
+ cNumberSlider sheenField;
46305284 JLabel subsurfaceLabel;
4631
- NumberSlider subsurfaceField;
5285
+ cNumberSlider subsurfaceField;
46325286 //JLabel bumpLabel;
46335287 //NumberSlider bumpField;
46345288 JLabel backlitLabel;
4635
- NumberSlider backlitField;
5289
+ cNumberSlider backlitField;
46365290 JLabel anisoLabel;
4637
- NumberSlider anisoField;
5291
+ cNumberSlider anisoField;
46385292 JLabel anisoVLabel;
4639
- NumberSlider anisoVField;
5293
+ cNumberSlider anisoVField;
46405294 JLabel cameraLabel;
4641
- NumberSlider cameraField;
5295
+ cNumberSlider cameraField;
46425296 JLabel selfshadowLabel;
4643
- NumberSlider selfshadowField;
5297
+ cNumberSlider selfshadowField;
46445298 JLabel shadowLabel;
4645
- NumberSlider shadowField;
5299
+ cNumberSlider shadowField;
46465300 JLabel textureLabel;
4647
- NumberSlider textureField;
5301
+ cNumberSlider textureField;
46485302 JLabel opacityLabel;
4649
- NumberSlider opacityField;
5303
+ cNumberSlider opacityField;
46505304 JLabel fakedepthLabel;
4651
- NumberSlider fakedepthField;
5305
+ cNumberSlider fakedepthField;
46525306 JLabel shadowbiasLabel;
4653
- NumberSlider shadowbiasField;
5307
+ cNumberSlider shadowbiasField;
46545308 JLabel bumpLabel;
4655
- NumberSlider bumpField;
5309
+ cNumberSlider bumpField;
46565310 JLabel noiseLabel;
4657
- NumberSlider noiseField;
5311
+ cNumberSlider noiseField;
46585312 JLabel powerLabel;
4659
- NumberSlider powerField;
5313
+ cNumberSlider powerField;
46605314 JLabel borderfadeLabel;
4661
- NumberSlider borderfadeField;
5315
+ cNumberSlider borderfadeField;
46625316 JLabel fogLabel;
4663
- NumberSlider fogField;
5317
+ cNumberSlider fogField;
46645318 JLabel opacityPowerLabel;
4665
- NumberSlider opacityPowerField;
4666
- JTree jTree;
5319
+ cNumberSlider opacityPowerField;
5320
+ cTree jTree;
46675321 //ObjectUI parent;
46685322
4669
- NumberSlider normalpushField;
5323
+ cNumberSlider normalpushField;
5324
+
5325
+ private MenuItem importGFDItem;
5326
+ private MenuItem importVRMLX3DItem;
5327
+ private MenuItem import3DSItem;
5328
+ private MenuItem importOBJItem;
46705329 }