Normand Briere
2019-07-29 c6c3f0948bd31603547ef8ce47a7784a9a4d55c2
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.*;
....@@ -13,6 +14,9 @@
1314 import javax.swing.plaf.metal.MetalLookAndFeel;
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
17
+
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
1620
1721 //import javax.media.opengl.GLCanvas;
1822
....@@ -35,6 +39,53 @@
3539
3640 GroupEditor callee;
3741 JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ ImageIcon icon = GetIcon(name);
48
+ return new cButton(icon, border);
49
+ }
50
+
51
+ cToggleButton GetToggleButton(String name, boolean border)
52
+ {
53
+ ImageIcon icon = GetIcon(name);
54
+ return new cToggleButton(icon, border);
55
+ }
56
+
57
+ cCheckBox GetCheckBox(String name, boolean border)
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+
63
+ ImageIcon GetIcon(String name)
64
+ {
65
+ try
66
+ {
67
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
68
+
69
+// if (image.getWidth() > 48 && image.getHeight() > 48)
70
+// {
71
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
72
+// Graphics2D g = resized.createGraphics();
73
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
74
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
76
+// g.dispose();
77
+//
78
+// image = resized;
79
+// }
80
+
81
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
82
+ return icon;
83
+ }
84
+ catch (Exception e)
85
+ {
86
+ return null;
87
+ }
88
+ }
3889
3990 // SCRIPT
4091
....@@ -138,34 +189,42 @@
138189 public void closeUI()
139190 {
140191 //new Exception().printStackTrace();
141
- System.out.println("this = " + this);
142
- System.out.println("objEditor = " + objEditor);
192
+// System.out.println("this = " + this);
193
+// System.out.println("objEditor = " + objEditor);
143194 //nameField.removeActionListener(this);
144
- objEditor.ctrlPanel.remove(nameField);
195
+// objEditor.ctrlPanel.remove(nameField);
145196
146
- if (!GroupEditor.allparams)
197
+ objEditor.ctrlPanel.remove(namePanel);
198
+
199
+ if (!allparams)
147200 return;
148201
149
- objEditor.ctrlPanel.remove(liveCB);
150
- objEditor.ctrlPanel.remove(hideCB);
151
- objEditor.ctrlPanel.remove(markCB);
152
-
153
- objEditor.ctrlPanel.remove(randomCB);
154
- objEditor.ctrlPanel.remove(speedupCB);
155
- objEditor.ctrlPanel.remove(rewindCB);
156
-
157
- objEditor.ctrlPanel.remove(resetButton);
158
- objEditor.ctrlPanel.remove(stepButton);
159
-// objEditor.ctrlPanel.remove(stepAllButton);
160
-// objEditor.ctrlPanel.remove(resetAllButton);
161
- objEditor.ctrlPanel.remove(link2masterCB);
162
- //objEditor.ctrlPanel.remove(flipVCB);
163
- //objEditor.ctrlPanel.remove(texresMenu);
164
- objEditor.ctrlPanel.remove(slowerButton);
165
- objEditor.ctrlPanel.remove(fasterButton);
166
- objEditor.ctrlPanel.remove(remarkButton);
202
+// objEditor.ctrlPanel.remove(liveCB);
203
+// objEditor.ctrlPanel.remove(hideCB);
204
+// objEditor.ctrlPanel.remove(markCB);
205
+//
206
+// objEditor.ctrlPanel.remove(randomCB);
207
+// objEditor.ctrlPanel.remove(speedupCB);
208
+// objEditor.ctrlPanel.remove(rewindCB);
209
+//
210
+// objEditor.ctrlPanel.remove(resetButton);
211
+// objEditor.ctrlPanel.remove(stepButton);
212
+//// objEditor.ctrlPanel.remove(stepAllButton);
213
+//// objEditor.ctrlPanel.remove(resetAllButton);
214
+// objEditor.ctrlPanel.remove(link2masterCB);
215
+// //objEditor.ctrlPanel.remove(flipVCB);
216
+// //objEditor.ctrlPanel.remove(texresMenu);
217
+// objEditor.ctrlPanel.remove(slowerButton);
218
+// objEditor.ctrlPanel.remove(fasterButton);
219
+// objEditor.ctrlPanel.remove(remarkButton);
167220
168
- Remove(normalpushField);
221
+ objEditor.ctrlPanel.remove(setupPanel);
222
+ objEditor.ctrlPanel.remove(setupPanel2);
223
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
224
+ objEditor.ctrlPanel.remove(pushPanel);
225
+ //objEditor.ctrlPanel.remove(fillPanel);
226
+
227
+ //Remove(normalpushField);
169228 }
170229
171230 public ObjEditor GetEditor()
....@@ -209,6 +268,12 @@
209268 client = inClient;
210269 copy = client;
211270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
212277 // "this" is not called: SetupUI2(objEditor);
213278 }
214279
....@@ -222,6 +287,12 @@
222287 client = inClient;
223288 copy = client;
224289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
225296 SetupUI2(callee.GetEditor());
226297 }
227298
....@@ -236,6 +307,7 @@
236307 //localCopy.parent = null;
237308
238309 frame = new JFrame();
310
+ frame.setUndecorated(false);
239311 objEditor = this;
240312 this.callee = callee;
241313
....@@ -253,6 +325,12 @@
253325 copy = localCopy;
254326 copy.editWindow = this;
255327
328
+ if (copy.versions == null)
329
+ {
330
+// copy.versions = new byte[100][];
331
+// copy.versionindex = -1;
332
+ }
333
+
256334 SetupMenu();
257335
258336 //SetupName(objEditor); // new
....@@ -266,28 +344,49 @@
266344 return frame.action(event, obj);
267345 }
268346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
269352 void SetupMenu()
270353 {
271354 frame.setMenuBar(menuBar = new MenuBar());
272
- menuBar.add(windowMenu = new Menu("File"));
273
- windowMenu.add(loadItem = new MenuItem("Load..."));
274
- windowMenu.add("-");
275
- windowMenu.add(saveItem = new MenuItem("Save"));
276
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
355
+ menuBar.add(fileMenu = new Menu("File"));
356
+ fileMenu.add(newItem = new MenuItem("New"));
357
+ fileMenu.add(openItem = new MenuItem("Open..."));
358
+
359
+ //oe.menuBar.add(menu = new Menu("Include"));
360
+ Menu menu = new Menu("Import");
361
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
362
+ importOBJItem.addActionListener(this);
363
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
364
+ import3DSItem.addActionListener(this);
365
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
366
+ importVRMLX3DItem.addActionListener(this);
367
+ menu.add("-");
368
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
369
+ importGFDItem.addActionListener(this);
370
+ fileMenu.add(menu);
371
+ fileMenu.add("-");
372
+
373
+ fileMenu.add(saveItem = new MenuItem("Save"));
374
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
277375 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
278
- windowMenu.add("-");
279
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
280
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
281
- windowMenu.add("-");
376
+ fileMenu.add("-");
377
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
378
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
379
+ fileMenu.add("-");
282380 if (client.parent != null)
283381 {
284
- windowMenu.add(closeItem = new MenuItem("Close"));
382
+ fileMenu.add(closeItem = new MenuItem("Close"));
285383 } else
286384 {
287
- windowMenu.add(closeItem = new MenuItem("Exit"));
385
+ fileMenu.add(closeItem = new MenuItem("Exit"));
288386 }
289387
290
- loadItem.addActionListener(this);
388
+ newItem.addActionListener(this);
389
+ openItem.addActionListener(this);
291390 saveItem.addActionListener(this);
292391 saveAsItem.addActionListener(this);
293392 exportAsItem.addActionListener(this);
....@@ -295,82 +394,69 @@
295394 //povItem.addActionListener(this);
296395 closeItem.addActionListener(this);
297396
298
- menuBar.add(cameraMenu = new Menu("View"));
299
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
300
- //zBufferItem.addActionListener(this);
301
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
302
- //normalLensItem.addActionListener(this);
303
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
304
- revertCameraItem.addActionListener(this);
305
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
- toggleTimelineItem.addItemListener(this);
307
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308
- toggleFullScreenItem.addItemListener(this);
309
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
310
- cameraMenu.add("-");
311
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
312
- toggleTextureItem.addItemListener(this);
313
- toggleTextureItem.setState(CameraPane.textureon);
314
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
315
- toggleLiveItem.addItemListener(this);
316
- toggleLiveItem.setState(Globals.isLIVE());
317
- cameraMenu.add(stepItem = new MenuItem("Step"));
318
- stepItem.addActionListener(this);
319
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
320
-// toggleDLItem.addItemListener(this);
321
-// toggleDLItem.setState(false);
322
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
323
- toggleRenderItem.addItemListener(this);
324
- toggleRenderItem.setState(!CameraPane.frozen);
325
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
326
- toggleDebugItem.addItemListener(this);
327
- toggleDebugItem.setState(CameraPane.DEBUG);
328
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
329
- toggleFrustumItem.addItemListener(this);
330
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
331
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
332
- toggleFootContactItem.addItemListener(this);
333
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
334
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
335
- toggleRandomItem.addItemListener(this);
336
- toggleRandomItem.setState(CameraPane.RANDOM);
337
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
338
- toggleHandleItem.addItemListener(this);
339
- toggleHandleItem.setState(CameraPane.HANDLES);
340
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
341
- togglePaintItem.addItemListener(this);
342
- togglePaintItem.setState(CameraPane.PAINTMODE);
343
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
344
-// toggleRootItem.addItemListener(this);
345
-// toggleRootItem.setState(false);
346
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
347
-// animationItem.addItemListener(this);
348
-// animationItem.setState(CameraPane.ANIMATION);
349
- cameraMenu.add("-");
350
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
351
- editCameraItem.addActionListener(this);
352
-
353397 objectPanel = new JTabbedPane();
398
+
399
+ ChangeListener changeListener = new ChangeListener()
400
+ {
401
+ public void stateChanged(ChangeEvent changeEvent)
402
+ {
403
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
404
+// {
405
+// if (latestObject != null)
406
+// {
407
+// refreshContents(true);
408
+// SetMaterial(latestObject);
409
+// }
410
+//
411
+// materialFlushed = true;
412
+// }
413
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
414
+// {
415
+// if (listUI.size() == 0)
416
+// EditSelection(false);
417
+// }
418
+
419
+ refreshContents(false); // To refresh Info tab
420
+ }
421
+ };
422
+ objectPanel.addChangeListener(changeListener);
423
+
354424 toolbarPanel = new JPanel();
355425 toolbarPanel.setName("Toolbar");
356
- treePanel = new JPanel();
426
+
427
+ treePanel = new cGridBag();
357428 treePanel.setName("Tree");
358
- ctrlPanel = new JPanel(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
360
- materialPanel = new JPanel();
361
- materialPanel.setName("Material");
429
+
430
+ editPanel = new cGridBag().setVertical(true);
431
+ //editPanel.setName("Edit");
432
+
433
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
434
+
435
+ editCommandsPanel = new cGridBag();
436
+ editPanel.add(editCommandsPanel);
437
+ editPanel.add(ctrlPanel);
438
+
439
+ toolboxPanel = new cGridBag().setVertical(true);
440
+ //toolboxPanel.setName("Toolbox");
441
+
442
+ materialPanel = new cGridBag().setVertical(true);
443
+ //materialPanel.setName("Material");
444
+
362445 /*JTextPane*/
363446 infoarea = createTextPane();
447
+ doc = infoarea.getStyledDocument();
448
+
364449 infoarea.setEditable(true);
365450 SetText();
451
+
366452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
367453 // infoarea.setOpaque(false);
368454 // //infoarea.setForeground(textcolor);
369
- infoarea.setLineWrap(true);
370
- infoarea.setWrapStyleWord(true);
455
+// TEXTAREA infoarea.setLineWrap(true);
456
+// TEXTAREA infoarea.setWrapStyleWord(true);
371457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
372
- infoPanel.setPreferredSize(new Dimension(50, 200));
373
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
374460 //infoPanel.setLayout(new BorderLayout());
375461 //infoPanel.add(createTextPane());
376462
....@@ -378,16 +464,23 @@
378464 mainPanel.setName("Main");
379465 mainPanel.setContinuousLayout(true);
380466 mainPanel.setOneTouchExpandable(true);
381
- mainPanel.setDividerLocation(1.0);
382467 mainPanel.setDividerSize(9);
383
- mainPanel.setResizeWeight(0);
384
-
468
+ mainPanel.setDividerLocation(0.5); //1.0);
469
+ mainPanel.setResizeWeight(0.5);
470
+
471
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
472
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
473
+ divider.setDividerSize(15);
474
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
475
+
476
+ mainPanel.setUI(new BasicSplitPaneUI());
477
+
385478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
386479 //mainPanel.setLayout(new GridBagLayout());
387480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
388
- treePanel.setLayout(new GridBagLayout());
389
- ctrlPanel.setLayout(new GridBagLayout());
390
- materialPanel.setLayout(new GridBagLayout());
481
+// treePanel.setLayout(new GridBagLayout());
482
+ //ctrlPanel.setLayout(new GridBagLayout());
483
+ //materialPanel.setLayout(new GridBagLayout());
391484
392485 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
393486 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -426,7 +519,7 @@
426519 static String newline = "\n";
427520 protected static final String buttonString = "JButton";
428521 StyledDocument doc;
429
- JTextArea infoarea;
522
+ JTextPane infoarea;
430523
431524 void ClearInfo()
432525 {
....@@ -449,10 +542,10 @@
449542 e.printStackTrace();
450543 }
451544
452
- String selection = infoarea.getText();
453
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
454
- java.awt.datatransfer.Clipboard clipboard =
455
- Toolkit.getDefaultToolkit().getSystemClipboard();
545
+// String selection = infoarea.getText();
546
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
547
+// java.awt.datatransfer.Clipboard clipboard =
548
+// Toolkit.getDefaultToolkit().getSystemClipboard();
456549 //clipboard.setContents(data, data);
457550 }
458551
....@@ -475,13 +568,13 @@
475568 //SendInfo("Name:", "bold");
476569 if (sel.GetTextures() != null || debug)
477570 {
478
- si.SendInfo(sel.toString(), "bold");
571
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
479572 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
480573 if (sel.Size() > 0)
481574 {
482575 si.SendInfo("#children = " + sel.Size(), "regular");
483576 }
484
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
577
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
485578 if (debug)
486579 {
487580 try
....@@ -493,7 +586,10 @@
493586 }
494587
495588 if (full)
496
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
589
+ {
590
+ si.SendInfo(" BBox min: " + minima, "regular");
591
+ si.SendInfo(" BBox max: " + maxima, "regular");
592
+ }
497593
498594 if (sel.bRep != null)
499595 {
....@@ -520,7 +616,7 @@
520616 }
521617 if (sel.support != null)
522618 {
523
- si.SendInfo(" support: " + sel.support, "regular");
619
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
524620 }
525621 if (sel.scriptnode != null)
526622 {
....@@ -591,6 +687,9 @@
591687 {
592688 CameraPane.pointflow = (PointFlow) sel;
593689 }
690
+
691
+ si.SendInfo("_____________________", "regular");
692
+ si.SendInfo("", "regular");
594693 }
595694 }
596695
....@@ -606,68 +705,191 @@
606705 }
607706 }
608707
708
+//static GraphicsDevice device = GraphicsEnvironment
709
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
710
+
711
+ Rectangle keeprect;
712
+ cRadio radio;
713
+
714
+cButton keepButton;
715
+ cButton twoButton; // Full 3D
716
+ cButton sixButton;
717
+ cButton threeButton;
718
+ cButton sevenButton;
719
+ cButton fourButton; // full panel
720
+ cButton oneButton; // full XYZ
721
+ //cButton currentLayout;
722
+
723
+ boolean maximized;
724
+
725
+ cButton fullscreenLayout;
726
+
727
+ void Minimize()
728
+ {
729
+ frame.setState(Frame.ICONIFIED);
730
+ frame.validate();
731
+ }
732
+
733
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
734
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
735
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
736
+ void Maximize()
737
+ {
738
+ if (CameraPane.FULLSCREEN)
739
+ {
740
+ ToggleFullScreen();
741
+ }
742
+
743
+ if (maximized)
744
+ {
745
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
746
+ }
747
+ else
748
+ {
749
+ keeprect = frame.getBounds();
750
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
751
+// Dimension rect2 = frame.getToolkit().getScreenSize();
752
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
753
+// frame.setState(Frame.MAXIMIZED_BOTH);
754
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
755
+ }
756
+
757
+ maximized ^= true;
758
+
759
+ frame.validate();
760
+ }
761
+
762
+ cButton minButton;
763
+ cButton maxButton;
764
+ cButton fullButton;
765
+
609766 void ToggleFullScreen()
610767 {
611
- if (CameraPane.FULLSCREEN)
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
612773 {
613
- frame.getContentPane().remove(/*"Center",*/bigThree);
614
- framePanel.add(bigThree);
615
- frame.getContentPane().add(/*"Center",*/framePanel);
774
+ device.setFullScreenWindow(null);
775
+ frame.dispose();
776
+ frame.setUndecorated(false);
777
+ frame.validate();
778
+ frame.setVisible(true);
779
+
780
+ //frame.setVisible(false);
781
+// frame.removeNotify();
782
+// frame.setUndecorated(false);
783
+// frame.addNotify();
784
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
785
+
786
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
787
+// X framePanel.add(bigThree);
788
+// X frame.getContentPane().add(/*"Center",*/framePanel);
789
+ framePanel.setDividerLocation(46);
790
+
791
+ //frame.setVisible(true);
792
+ radio.layout = keepButton;
793
+ //theFrame = null;
794
+ keepButton = null;
795
+ radio.layout.doClick();
796
+
616797 } else
617798 {
618
- frame.getContentPane().remove(/*"Center",*/framePanel);
619
- framePanel.remove(bigThree);
620
- frame.getContentPane().add(/*"Center",*/bigThree);
799
+ keepButton = radio.layout;
800
+ //keeprect = frame.getBounds();
801
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
802
+// frame.getToolkit().getScreenSize().height);
803
+ //frame.setVisible(false);
804
+
805
+ frame.dispose();
806
+ frame.setUndecorated(true);
807
+ device.setFullScreenWindow(frame);
808
+ frame.validate();
809
+ frame.setVisible(true);
810
+// frame.removeNotify();
811
+// frame.setUndecorated(true);
812
+// frame.addNotify();
813
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
814
+// X framePanel.remove(bigThree);
815
+// X frame.getContentPane().add(/*"Center",*/bigThree);
816
+ framePanel.setDividerLocation(0);
817
+
818
+ radio.layout = fullscreenLayout;
819
+ radio.layout.doClick();
820
+ //frame.setVisible(true);
621821 }
622
- cameraView.ToggleFullScreen();
822
+ frame.validate();
623823 }
624824
625
- private JTextArea createTextPane()
825
+ private byte[] CompressCopy()
626826 {
627
- String[] initString =
628
- {
629
- "This is an editable JTextPane, ", //regular
630
- "another ", //italic
631
- "styled ", //bold
632
- "text ", //small
633
- "component, ", //large
634
- "which supports embedded components..." + newline,//regular
635
- " " + newline, //button
636
- "...and embedded icons..." + newline, //regular
637
- " ", //icon
638
- newline + "JTextPane is a subclass of JEditorPane that "
639
- + "uses a StyledEditorKit and StyledDocument, and provides "
640
- + "cover methods for interacting with those objects."
641
- };
827
+ boolean temp = CameraPane.SWITCH;
828
+ CameraPane.SWITCH = false;
829
+
830
+ copy.ExtractBigData(versiontable);
831
+ // if (copy == client)
832
+
833
+ byte[] versions[] = copy.versions;
834
+ copy.versions = null;
835
+
836
+ byte[] compress = Compress(copy);
837
+
838
+ copy.versions = versions;
839
+
840
+ copy.RestoreBigData(versiontable);
841
+
842
+ CameraPane.SWITCH = temp;
843
+
844
+ return compress;
845
+ }
642846
643
- String[] initStyles =
644
- {
645
- "regular", "italic", "bold", "small", "large",
646
- "regular", "button", "regular", "icon",
647
- "regular"
648
- };
847
+ private JTextPane createTextPane()
848
+ {
849
+// TEXTAREA String[] initString =
850
+// {
851
+// "This is an editable JTextPane, ", //regular
852
+// "another ", //italic
853
+// "styled ", //bold
854
+// "text ", //small
855
+// "component, ", //large
856
+// "which supports embedded components..." + newline,//regular
857
+// " " + newline, //button
858
+// "...and embedded icons..." + newline, //regular
859
+// " ", //icon
860
+// newline + "JTextPane is a subclass of JEditorPane that "
861
+// + "uses a StyledEditorKit and StyledDocument, and provides "
862
+// + "cover methods for interacting with those objects."
863
+// };
864
+//
865
+// String[] initStyles =
866
+// {
867
+// "regular", "italic", "bold", "small", "large",
868
+// "regular", "button", "regular", "icon",
869
+// "regular"
870
+// };
871
+//
872
+// JTextPane textPane = new JTextPane();
873
+// textPane.setEditable(true);
874
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
875
+// addStylesToDocument(doc);
876
+//
877
+// try
878
+// {
879
+// for (int j = 0; j < 2; j++)
880
+// {
881
+// for (int i = 0; i < initString.length; i++)
882
+// {
883
+// doc.insertString(doc.getLength(), initString[i],
884
+// doc.getStyle(initStyles[i]));
885
+// }
886
+// }
887
+// } catch (BadLocationException ble)
888
+// {
889
+// System.err.println("Couldn't insert initial text into text pane.");
890
+// }
649891
650
- JTextPane textPane = new JTextPane();
651
- textPane.setEditable(true);
652
- /*StyledDocument*/ doc = textPane.getStyledDocument();
653
- addStylesToDocument(doc);
654
-
655
- try
656
- {
657
- for (int j = 0; j < 2; j++)
658
- {
659
- for (int i = 0; i < initString.length; i++)
660
- {
661
- doc.insertString(doc.getLength(), initString[i],
662
- doc.getStyle(initStyles[i]));
663
- }
664
- }
665
- } catch (BadLocationException ble)
666
- {
667
- System.err.println("Couldn't insert initial text into text pane.");
668
- }
669
-
670
- return new JTextArea(); // textPane;
892
+ return new JTextPane(); // textPane;
671893 }
672894
673895 protected void addStylesToDocument(StyledDocument doc)
....@@ -720,7 +942,7 @@
720942 protected static ImageIcon createImageIcon(String path,
721943 String description)
722944 {
723
- java.net.URL imgURL = GrafreeD.class.getResource(path);
945
+ java.net.URL imgURL = Grafreed.class.getResource(path);
724946 if (imgURL != null)
725947 {
726948 return new ImageIcon(imgURL, description);
....@@ -752,6 +974,7 @@
752974 // NumberSlider vDivsField;
753975 // JCheckBox endcaps;
754976 JCheckBox liveCB;
977
+ JCheckBox selectableCB;
755978 JCheckBox hideCB;
756979 JCheckBox link2masterCB;
757980 JCheckBox markCB;
....@@ -759,7 +982,12 @@
759982 JCheckBox speedupCB;
760983 JCheckBox rewindCB;
761984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
762989 JComboBox texresMenu;
990
+
763991 JButton resetButton;
764992 JButton stepButton;
765993 JButton stepAllButton;
....@@ -767,115 +995,87 @@
767995 JButton slowerButton;
768996 JButton fasterButton;
769997 JButton remarkButton;
998
+
999
+ cGridBag editPanel;
1000
+ cGridBag editCommandsPanel;
1001
+
1002
+ cGridBag namePanel;
1003
+ cGridBag setupPanel;
1004
+ cGridBag setupPanel2;
1005
+ cGridBag objectCommandsPanel;
1006
+ cGridBag pushPanel;
1007
+ cGridBag fillPanel;
7701008
771
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1009
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7721010 {
7731011 JCheckBox cb;
7741012
775
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
776
- oe.aConstraints.gridwidth = 1; // 3;
777
-// oe.aConstraints.weightx = 1;
778
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
779
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1013
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7801014 cb.addItemListener(this);
781
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
782
- oe.aConstraints.gridwidth = 1;
783
- oe.aConstraints.gridx += 1;
7841015
7851016 return cb;
7861017 }
7871018
788
- cButton AddButton(ObjEditor oe, String label)
1019
+ cButton AddButton(cGridBag panel, String label)
7891020 {
7901021 cButton cb;
7911022
792
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
793
- oe.aConstraints.gridwidth = 1;
794
-// oe.aConstraints.weightx = 1;
795
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
796
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1023
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7971024 cb.addActionListener(this);
798
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
799
- oe.aConstraints.gridwidth = 1;
800
- oe.aConstraints.gridx += 1;
8011025
8021026 return cb;
8031027 }
8041028
805
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1029
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
8061030 {
8071031 JComboBox combo;
8081032
809
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
810
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
811
- oe.aConstraints.gridx += 1;
1033
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8121034 combo.addActionListener(this);
8131035
8141036 return combo;
8151037 }
8161038
817
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
1039
+ cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
8181040 {
819
- NumberSlider combo;
1041
+ cGridBag control = new cGridBag();
1042
+
1043
+ cNumberSlider combo;
8201044
8211045 JLabel jlabel = new JLabel(label);
822
-
823
- aConstraints.fill = GridBagConstraints.VERTICAL;
8241046 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
825
- aConstraints.gridwidth = 1;
826
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
827
- aConstraints.gridx += 1;
828
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
829
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
830
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
831
- aConstraints.gridx += 1;
832
- aConstraints.gridwidth = 1;
833
-
1047
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1048
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8341049 combo.setFloat(current);
835
-
836
- combo.label = jlabel;
837
-
838
- combo.addChangeListener(this);
839
-
840
- return combo;
1050
+
1051
+ panel.add(control);
1052
+
1053
+ return control;
8411054 }
8421055
843
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
1056
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8441057 {
845
- NumberSlider combo;
1058
+ cGridBag control = new cGridBag();
1059
+
1060
+ cNumberSlider combo;
8461061
8471062 JLabel jlabel = new JLabel(label);
848
-
849
- aConstraints.fill = GridBagConstraints.VERTICAL;
8501063 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
851
- aConstraints.gridwidth = 2;
852
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
853
- aConstraints.gridx += 1;
854
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
855
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
856
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
857
- aConstraints.gridx += 1;
858
- aConstraints.gridwidth = 1;
859
-
1064
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1065
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8601066 combo.setInteger(current);
8611067
862
- combo.label = jlabel;
863
-
864
- combo.addChangeListener(this);
865
-
866
- return combo;
1068
+ panel.add(control);
1069
+
1070
+ return control;
8671071 }
8681072
869
- JTextArea AddText(JPanel ctrlPanel, String name)
1073
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8701074 {
8711075 JTextArea text;
8721076
873
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
874
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
875
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8761078 text.addCaretListener(this);
877
- aConstraints.gridx += 1;
878
- aConstraints.gridwidth = 1;
8791079
8801080 return text;
8811081 }
....@@ -905,9 +1105,16 @@
9051105 objEditor.ctrlPanel.remove(j);
9061106 }
9071107
1108
+ void Remove(cNumberSlider j)
1109
+ {
1110
+ j.removeChangeListener(this);
1111
+ //objEditor.ctrlPanel.remove(j.label);
1112
+ objEditor.ctrlPanel.remove(j);
1113
+ }
1114
+
9081115 /*
9091116 */
910
- void Return() // ObjEditor oe)
1117
+ void Return0() // ObjEditor oe)
9111118 {
9121119 aConstraints.gridy += 1;
9131120 aConstraints.gridx = 0;
....@@ -962,37 +1169,80 @@
9621169
9631170 void SetupUI2(ObjEditor oe)
9641171 {
965
-// oe.aConstraints.weightx = 0;
966
-// oe.aConstraints.weighty = 0;
967
-// oe.aConstraints.gridx = 0;
968
-// oe.aConstraints.gridy = 0;
969
- SetupName(oe);
1172
+ //SetupName(oe);
9701173
971
- if (!GroupEditor.allparams)
1174
+ namePanel = new cGridBag();
1175
+
1176
+ nameField = AddText(namePanel, copy.GetName());
1177
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
1178
+ oe.ctrlPanel.add(namePanel);
1179
+
1180
+ oe.ctrlPanel.Return();
1181
+
1182
+ if (!allparams)
9721183 return;
9731184
974
- liveCB = AddCheckBox(oe, "Live", copy.live);
975
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
976
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
1185
+ setupPanel = new cGridBag().setVertical(false);
1186
+
1187
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
1188
+ liveCB.setToolTipText("Animate object");
1189
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectableCB.setToolTipText("Make object selectable");
9771191 // Return();
978
- markCB = AddCheckBox(oe, "Mark", copy.marked);
979
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
980
- randomCB = AddCheckBox(oe, "Rand", copy.random);
981
- Return();
982
- resetButton = AddButton(oe, "Reset");
983
- stepButton = AddButton(oe, "Step");
1192
+
1193
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1194
+ hideCB.setToolTipText("Hide object");
1195
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1196
+ markCB.setToolTipText("As animation target transform");
1197
+
1198
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
1199
+
1200
+ setupPanel2 = new cGridBag().setVertical(false);
1201
+
1202
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1203
+ rewindCB.setToolTipText("Rewind animation");
1204
+
1205
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1206
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1207
+
1208
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1209
+ link2masterCB.setToolTipText("Attach to support");
1210
+
1211
+ if (Globals.ADVANCED)
1212
+ {
1213
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1214
+ speedupCB.setToolTipText("Option motion capture");
1215
+ }
1216
+
1217
+ oe.ctrlPanel.add(setupPanel);
1218
+ oe.ctrlPanel.Return();
1219
+ oe.ctrlPanel.add(setupPanel2);
1220
+ oe.ctrlPanel.Return();
1221
+
1222
+ objectCommandsPanel = new cGridBag().setVertical(false);
1223
+
1224
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1225
+ resetButton.setToolTipText("Jump to frame zero");
1226
+ stepButton = AddButton(objectCommandsPanel, "Step");
1227
+ stepButton.setToolTipText("Step one frame");
9841228 // resetAllButton = AddButton(oe, "Reset All");
9851229 // stepAllButton = AddButton(oe, "Step All");
986
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9871230 // Return();
988
- slowerButton = AddButton(oe, "Slow");
989
- fasterButton = AddButton(oe, "Fast");
990
- remarkButton = AddButton(oe, "Rem");
1231
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1232
+ slowerButton.setToolTipText("Decrease animation speed");
1233
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1234
+ fasterButton.setToolTipText("Increase animation speed");
1235
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1236
+ remarkButton.setToolTipText("Set the current transform as the target");
9911237
992
- Return();
1238
+ oe.ctrlPanel.add(objectCommandsPanel);
1239
+ oe.ctrlPanel.Return();
9931240
994
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
- Return();
1241
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1242
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1243
+ //Return();
1244
+
1245
+ oe.ctrlPanel.Return();
9961246
9971247 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9981248 // ObjEditor.aConstraints.gridx += 1;
....@@ -1087,7 +1337,7 @@
10871337 oe.aConstraints.gridwidth = 1;
10881338 /**/
10891339 nameField = AddText(oe.ctrlPanel, copy.GetName());
1090
- Return();
1340
+ oe.ctrlPanel.Return();
10911341
10921342 //ctrlPanel.add(textureButton = new Button("Texture..."));
10931343 //textureButton.setEnabled(false);
....@@ -1191,8 +1441,11 @@
11911441 //worldPanel.setName("World");
11921442 centralPanel = new cGridBag();
11931443 centralPanel.preferredWidth = 20;
1194
- timelinePanel = new JPanel(new BorderLayout());
1195
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1444
+
1445
+ if (Globals.ADVANCED)
1446
+ {
1447
+ timelinePanel = new JPanel(new BorderLayout());
1448
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11961449
11971450 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11981451 cameraPanel.setContinuousLayout(true);
....@@ -1201,7 +1454,10 @@
12011454 // cameraPanel.setDividerSize(9);
12021455 cameraPanel.setResizeWeight(1.0);
12031456
1457
+ }
1458
+
12041459 centralPanel.add(cameraView);
1460
+ centralPanel.setFocusable(true);
12051461 //frame.setJMenuBar(timelineMenubar);
12061462 //centralPanel.add(timelinePanel);
12071463
....@@ -1227,6 +1483,7 @@
12271483 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12281484 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12291485 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1486
+ //XYZPanel.setName("XYZ");
12301487
12311488 /*
12321489 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1264,11 +1521,23 @@
12641521 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12651522 //tmp.setName("Edit");
12661523 objectPanel.add(materialPanel);
1267
- JPanel north = new JPanel(new BorderLayout());
1268
- north.setName("Edit");
1269
- north.add(ctrlPanel, BorderLayout.NORTH);
1270
- objectPanel.add(north);
1271
- objectPanel.add(infoPanel);
1524
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1525
+// JPanel north = new JPanel(new BorderLayout());
1526
+// north.setName("Edit");
1527
+// north.add(ctrlPanel, BorderLayout.NORTH);
1528
+// objectPanel.add(north);
1529
+ objectPanel.add(editPanel);
1530
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1531
+
1532
+ //if (Globals.ADVANCED)
1533
+ objectPanel.add(infoPanel);
1534
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1535
+
1536
+ objectPanel.add(XYZPanel);
1537
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1538
+
1539
+ objectPanel.add(toolboxPanel);
1540
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
12721541
12731542 /*
12741543 aConstraints.gridx = 0;
....@@ -1277,7 +1546,7 @@
12771546 aConstraints.gridy += 1;
12781547 aConstraints.gridwidth = 1;
12791548 mainPanel.add(objectPanel, aConstraints);
1280
- */
1549
+ */
12811550
12821551 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12831552 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1289,21 +1558,21 @@
12891558 scrollpane.addMouseWheelListener(this); // Default not fast enough
12901559
12911560 /*JTabbedPane*/ scenePanel = new cGridBag();
1292
- scenePanel.preferredWidth = 7;
1561
+ scenePanel.preferredWidth = 5;
12931562
12941563 JTabbedPane tabbedPane = new JTabbedPane();
12951564 tabbedPane.add(scrollpane);
12961565
1297
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1298
-
1299
- optionsPanel = new JPanel(new GridBagLayout());
1566
+ optionsPanel = new cGridBag().setVertical(false);
13001567
13011568 optionsPanel.setName("Options");
13021569
1303
- AddOptions(optionsPanel, aConstraints);
1570
+ AddOptions(optionsPanel); //, aConstraints);
13041571
13051572 tabbedPane.add(optionsPanel);
13061573
1574
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1575
+
13071576 scenePanel.add(tabbedPane);
13081577
13091578 /*
....@@ -1365,9 +1634,9 @@
13651634 /**/
13661635
13671636 bigThree = new cGridBag();
1368
- bigThree.addComponent(scenePanel);
13691637 bigThree.addComponent(centralPanel);
1370
- bigThree.addComponent(XYZPanel);
1638
+ bigThree.addComponent(scenePanel);
1639
+ //bigThree.addComponent(XYZPanel);
13711640
13721641 // // SIDE EFFECT!!!
13731642 // aConstraints.gridx = 0;
....@@ -1376,9 +1645,9 @@
13761645 // aConstraints.gridheight = 1;
13771646
13781647 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1379
- framePanel.setContinuousLayout(true);
1380
- framePanel.setOneTouchExpandable(true);
1381
- framePanel.setDividerLocation(0.8);
1648
+ framePanel.setContinuousLayout(false);
1649
+ framePanel.setOneTouchExpandable(false);
1650
+ //.setDividerLocation(0.8);
13821651 //framePanel.setDividerSize(15);
13831652 //framePanel.setResizeWeight(0.15);
13841653 framePanel.setName("Frame");
....@@ -1395,10 +1664,15 @@
13951664
13961665 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13971666
1398
- frame.setSize(1024, 768);
1399
- frame.show();
1400
-
1667
+ frame.setSize(1280, 860);
1668
+
1669
+ cameraView.requestFocusInWindow();
1670
+
14011671 gridPanel.setDividerLocation(1.0);
1672
+
1673
+ frame.validate();
1674
+
1675
+ frame.setVisible(true);
14021676
14031677 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
14041678 frame.addWindowListener(new WindowAdapter()
....@@ -1411,7 +1685,7 @@
14111685 });
14121686 }
14131687
1414
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1688
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
14151689 {
14161690 }
14171691
....@@ -1426,260 +1700,161 @@
14261700 ctrlPanel.removeAll();
14271701 }
14281702
1429
- void SetupMaterial(JPanel ctrlPanel)
1703
+ void SetupMaterial(cGridBag panel)
14301704 {
1431
- aConstraints.weighty = 0;
1432
- //aConstraints.weightx = 1;
1433
- /*
1705
+ /*
14341706 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14351707 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1436
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1437
- aConstraints.gridx += 1;
14381708 */
14391709
1440
- aConstraints.gridwidth = 1;
1441
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1442
- aConstraints.gridx += 1;
1443
- aConstraints.weighty = 0;
1444
- aConstraints.gridwidth = 1;
1710
+ cGridBag editBar = new cGridBag().setVertical(false);
1711
+
1712
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1713
+ createMaterialButton.setToolTipText("Create material");
14451714
14461715 /*
14471716 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1448
- aConstraints.gridx += 1;
1449
- aConstraints.weighty = 0;
1450
- aConstraints.gridwidth = 1;
14511717 */
14521718
1453
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1454
- aConstraints.gridx += 1;
1719
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1720
+ clearMaterialButton.setToolTipText("Clear material");
1721
+
1722
+ if (Globals.ADVANCED)
1723
+ {
1724
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1725
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1726
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1727
+ }
14551728
1456
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1457
-
1458
- aConstraints.gridx += 1;
1459
-
1460
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1461
-
1462
- aConstraints.gridx += 1;
1463
-
1464
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1465
-
1466
- aConstraints.gridx = 0;
1467
- aConstraints.gridy += 1;
1468
- aConstraints.weighty = 0;
1469
- aConstraints.gridwidth = 1;
1729
+ editBar.preferredHeight = 15;
1730
+
1731
+ panel.add(editBar);
1732
+
14701733 /**/
14711734 //aConstraints.weighty = 0;
14721735 ////aConstraints.weightx = 1;
14731736 //aConstraints.weighty = 1;
14741737 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14751738 //aConstraints.gridx += 1;
1476
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1477
- aConstraints.weighty = 0;
1478
- aConstraints.gridx = 0;
1479
- aConstraints.gridy += 1;
1480
- aConstraints.gridwidth = 1;
1739
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14811740
1482
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1483
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1484
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1485
- aConstraints.gridx += 1;
1486
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1487
- //aConstraints.weightx = 0;
1488
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1489
- aConstraints.gridx = 0;
1490
- aConstraints.gridy += 1;
1491
- aConstraints.gridwidth = 1;
1741
+ cGridBag colorSection = new cGridBag().setVertical(true);
1742
+
1743
+ cGridBag color = new cGridBag();
1744
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1745
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1746
+ color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1747
+ //colorField.preferredWidth = 200;
1748
+ colorSection.add(color);
14921749
1493
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1494
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1495
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1496
- aConstraints.gridx += 1;
1497
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1498
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1499
- aConstraints.gridx = 0;
1500
- aConstraints.gridy += 1;
1501
- aConstraints.gridwidth = 1;
1750
+ cGridBag modulation = new cGridBag();
1751
+ modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
1752
+ modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1754
+ colorSection.add(modulation);
15021755
1503
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1504
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1505
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1506
- aConstraints.gridx += 1;
1507
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1508
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1509
- aConstraints.gridx = 0;
1510
- aConstraints.gridy += 1;
1511
- aConstraints.gridwidth = 1;
1756
+ cGridBag texture = new cGridBag();
1757
+ texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
1758
+ textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1759
+ texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1760
+ colorSection.add(texture);
15121761
1513
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1514
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1515
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1516
- aConstraints.gridx += 1;
1517
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1518
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1519
- aConstraints.gridx = 0;
1520
- aConstraints.gridy += 1;
1521
- aConstraints.gridwidth = 1;
1762
+ panel.add(new JSeparator());
1763
+
1764
+ panel.add(colorSection);
1765
+
1766
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1767
+
1768
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
1769
+
1770
+ cGridBag diffuse = new cGridBag();
1771
+ diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
1772
+ diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1773
+ diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1774
+ diffuseSection.add(diffuse);
15221775
1523
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1524
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1525
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1526
- aConstraints.gridx += 1;
1527
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1528
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1529
- aConstraints.gridx = 0;
1530
- aConstraints.gridy += 1;
1531
- aConstraints.gridwidth = 1;
1776
+ cGridBag diffuseness = new cGridBag();
1777
+ diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints);
1778
+ diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1779
+ diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1780
+ diffuseSection.add(diffuseness);
15321781
1533
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1534
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1535
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1536
- aConstraints.gridx += 1;
1537
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1538
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1539
- aConstraints.gridx = 0;
1540
- aConstraints.gridy += 1;
1541
- aConstraints.gridwidth = 1;
1782
+ cGridBag selfshadow = new cGridBag();
1783
+ selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints);
1784
+ selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1785
+ selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1786
+ diffuseSection.add(selfshadow);
15421787
1543
- //aConstraints.weighty = 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1545
- //aConstraints.gridx += 1;
1546
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1547
- aConstraints.weighty = 0;
1548
- aConstraints.gridx = 0;
1549
- aConstraints.gridy += 1;
1550
- aConstraints.gridwidth = 1;
1788
+ cGridBag sheen = new cGridBag();
1789
+ sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints);
1790
+ sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1791
+ sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1792
+ diffuseSection.add(sheen);
15511793
1552
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1553
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1554
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1555
- aConstraints.gridx += 1;
1556
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1557
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1558
- aConstraints.gridx = 0;
1559
- aConstraints.gridy += 1;
1560
- aConstraints.gridwidth = 1;
1794
+ cGridBag subsurface = new cGridBag();
1795
+ subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints);
1796
+ subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1797
+ subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1798
+ diffuseSection.add(subsurface);
15611799
1562
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1563
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1564
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1565
- aConstraints.gridx += 1;
1566
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1567
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1568
- aConstraints.gridx = 0;
1569
- aConstraints.gridy += 1;
1570
- aConstraints.gridwidth = 1;
1800
+ cGridBag shadow = new cGridBag();
1801
+ shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints);
1802
+ shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1803
+ shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1804
+ diffuseSection.add(shadow);
15711805
1572
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1573
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1574
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1575
- aConstraints.gridx += 1;
1576
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1577
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1578
- aConstraints.gridx = 0;
1579
- aConstraints.gridy += 1;
1580
- aConstraints.gridwidth = 1;
1806
+ cGridBag fakedepth = new cGridBag();
1807
+ fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints);
1808
+ fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1809
+ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1810
+ diffuseSection.add(fakedepth);
15811811
1582
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1583
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1585
- aConstraints.gridx += 1;
1586
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1587
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1588
- aConstraints.gridx = 0;
1589
- aConstraints.gridy += 1;
1590
- aConstraints.gridwidth = 1;
1812
+ cGridBag shadowbias = new cGridBag();
1813
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1814
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1815
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1816
+ diffuseSection.add(shadowbias);
15911817
1592
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1593
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1594
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1595
- aConstraints.gridx += 1;
1596
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1597
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1598
- aConstraints.gridx = 0;
1599
- aConstraints.gridy += 1;
1600
- aConstraints.gridwidth = 1;
1818
+ panel.add(new JSeparator());
1819
+
1820
+ panel.add(diffuseSection);
1821
+
1822
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1823
+
1824
+ cGridBag specularSection = new cGridBag().setVertical(true);
16011825
1602
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1603
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1604
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1605
- aConstraints.gridx += 1;
1606
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1607
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1608
- aConstraints.gridx = 0;
1609
- aConstraints.gridy += 1;
1610
- aConstraints.gridwidth = 1;
1826
+ cGridBag specular = new cGridBag();
1827
+ specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
1828
+ specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1829
+ specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1830
+ specularSection.add(specular);
16111831
1612
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1613
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1614
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1615
- aConstraints.gridx += 1;
1616
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1617
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1618
- aConstraints.gridx = 0;
1619
- aConstraints.gridy += 1;
1620
- aConstraints.gridwidth = 1;
1832
+ cGridBag lightarea = new cGridBag();
1833
+ lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints);
1834
+ lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1835
+ lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1836
+ specularSection.add(lightarea);
16211837
1622
- //aConstraints.weighty = 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1624
- //aConstraints.gridx += 1;
1625
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1626
- aConstraints.weighty = 0;
1627
- aConstraints.gridx = 0;
1628
- aConstraints.gridy += 1;
1629
- aConstraints.gridwidth = 1;
1838
+ cGridBag shininess = new cGridBag();
1839
+ shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints);
1840
+ shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1841
+ shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1842
+ specularSection.add(shininess);
16301843
1631
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1632
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1633
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1634
- aConstraints.gridx += 1;
1635
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1636
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1637
- aConstraints.gridx = 0;
1638
- aConstraints.gridy += 1;
1639
- aConstraints.gridwidth = 1;
1844
+ cGridBag metalness = new cGridBag();
1845
+ metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints);
1846
+ metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1847
+ metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1848
+ specularSection.add(metalness);
16401849
1641
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1642
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1643
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1644
- aConstraints.gridx += 1;
1645
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1646
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1647
- aConstraints.gridx = 0;
1648
- aConstraints.gridy += 1;
1649
- aConstraints.gridwidth = 1;
1850
+ cGridBag velvet = new cGridBag();
1851
+ velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints);
1852
+ velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1853
+ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1854
+ specularSection.add(velvet);
16501855
1651
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1652
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1653
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1654
- aConstraints.gridx += 1;
1655
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1656
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1657
- aConstraints.gridx = 0;
1658
- aConstraints.gridy += 1;
1659
- aConstraints.gridwidth = 1;
1660
-
1661
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1662
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1663
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1664
- aConstraints.gridx += 1;
1665
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1666
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1667
- aConstraints.gridx = 0;
1668
- aConstraints.gridy += 1;
1669
- aConstraints.gridwidth = 1;
1670
-
1671
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1672
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1673
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1674
- aConstraints.gridx += 1;
1675
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1676
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1677
- aConstraints.gridx = 0;
1678
- aConstraints.gridy += 1;
1679
- aConstraints.gridwidth = 1;
1680
-
1681
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1682
- Return();
1856
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1857
+ //Return();
16831858 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16841859 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16851860 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1690,130 +1865,105 @@
16901865 // aConstraints.gridy += 1;
16911866 // aConstraints.gridwidth = 1;
16921867
1693
- //aConstraints.weighty = 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1695
- //aConstraints.gridx += 1;
1696
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1697
- aConstraints.weighty = 0;
1698
- aConstraints.gridx = 0;
1699
- aConstraints.gridy += 1;
1700
- aConstraints.gridwidth = 1;
1868
+ cGridBag anisoU = new cGridBag();
1869
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1870
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1871
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1872
+ specularSection.add(anisoU);
17011873
1702
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1703
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1704
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1705
- aConstraints.gridx += 1;
1706
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1707
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1708
- aConstraints.gridx = 0;
1709
- aConstraints.gridy += 1;
1710
- aConstraints.gridwidth = 1;
1874
+ cGridBag anisoV = new cGridBag();
1875
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1876
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1877
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1878
+ specularSection.add(anisoV);
17111879
1712
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1713
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1714
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1715
- aConstraints.gridx += 1;
1716
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1717
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1718
- aConstraints.gridx = 0;
1719
- aConstraints.gridy += 1;
1720
- aConstraints.gridwidth = 1;
17211880
1722
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1723
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1724
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1725
- aConstraints.gridx += 1;
1726
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1727
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1728
- aConstraints.gridx = 0;
1729
- aConstraints.gridy += 1;
1730
- aConstraints.gridwidth = 1;
1881
+ panel.add(new JSeparator());
1882
+
1883
+ panel.add(specularSection);
1884
+
1885
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1886
+
1887
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17311888
1732
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1733
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1734
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1735
- aConstraints.gridx += 1;
1736
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1737
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1738
- aConstraints.gridx = 0;
1739
- aConstraints.gridy += 1;
1740
- aConstraints.gridwidth = 1;
1741
- aConstraints.weighty = 0;
1889
+ cGridBag camera = new cGridBag();
1890
+ camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
1891
+ cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1892
+ camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1893
+ colorSection.add(camera);
17421894
1743
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1744
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1745
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1746
- aConstraints.gridx += 1;
1747
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1748
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1749
- aConstraints.gridx = 0;
1750
- aConstraints.gridy += 1;
1751
- aConstraints.gridwidth = 1;
1895
+ cGridBag ambient = new cGridBag();
1896
+ ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
1897
+ ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1898
+ ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1899
+ colorSection.add(ambient);
17521900
1753
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1754
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1755
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1756
- aConstraints.gridx += 1;
1757
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1758
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1759
- aConstraints.gridx = 0;
1760
- aConstraints.gridy += 1;
1761
- aConstraints.gridwidth = 1;
1901
+ cGridBag backlit = new cGridBag();
1902
+ backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
1903
+ backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1904
+ backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1905
+ colorSection.add(backlit);
17621906
1763
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1764
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1765
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1766
- aConstraints.gridx += 1;
1767
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1768
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1769
- aConstraints.gridx = 0;
1770
- aConstraints.gridy += 1;
1771
- aConstraints.gridwidth = 1;
1907
+ cGridBag opacity = new cGridBag();
1908
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1909
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1910
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1911
+ colorSection.add(opacity);
17721912
1773
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1774
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1775
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1776
- aConstraints.gridx += 1;
1777
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1778
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1779
- aConstraints.gridx = 0;
1780
- aConstraints.gridy += 1;
1781
- aConstraints.gridwidth = 1;
1913
+ //panel.add(new JSeparator());
1914
+
1915
+ //panel.add(globalSection);
1916
+
1917
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
1918
+
1919
+ cGridBag textureSection = new cGridBag().setVertical(true);
17821920
1783
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1784
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1785
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1786
- aConstraints.gridx += 1;
1787
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1788
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1789
- aConstraints.gridx = 0;
1790
- aConstraints.gridy += 1;
1791
- aConstraints.gridwidth = 1;
1921
+ cGridBag bump = new cGridBag();
1922
+ bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
1923
+ bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1924
+ bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1925
+ textureSection.add(bump);
17921926
1793
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1794
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1795
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1796
- aConstraints.gridx += 1;
1797
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1798
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1799
- aConstraints.gridx = 0;
1800
- aConstraints.gridy += 1;
1801
- aConstraints.gridwidth = 1;
1927
+ cGridBag noise = new cGridBag();
1928
+ noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints);
1929
+ noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1930
+ noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints);
1931
+ textureSection.add(noise);
18021932
1803
- //aConstraints.weighty = 1;
1804
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1805
- //aConstraints.gridx += 1;
1806
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1807
- aConstraints.weighty = 0;
1933
+ cGridBag power = new cGridBag();
1934
+ power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints);
1935
+ powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1936
+ power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints);
1937
+ textureSection.add(power);
18081938
1809
- aConstraints.gridx = 0;
1810
- aConstraints.gridy = 0;
1811
- aConstraints.gridwidth = 1;
1939
+ cGridBag borderfade = new cGridBag();
1940
+ borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints);
1941
+ borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1942
+ borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints);
1943
+ textureSection.add(borderfade);
1944
+
1945
+ cGridBag fog = new cGridBag();
1946
+ fog.add(fogLabel = new JLabel("Punch")); // , aConstraints);
1947
+ fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1948
+ fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints);
1949
+ textureSection.add(fog);
1950
+
1951
+ cGridBag opacityPower = new cGridBag();
1952
+ opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints);
1953
+ opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1954
+ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
1955
+ textureSection.add(opacityPower);
1956
+
1957
+ panel.add(new JSeparator());
1958
+
1959
+ panel.add(textureSection);
1960
+
1961
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18121962
18131963 SetMaterial(copy); // .GetMaterial());
18141964
1815
- colorField.addChangeListener(this);
1816
- modulationField.addChangeListener(this);
1965
+ //colorField.addChangeListener(this);
1966
+// modulationField.addChangeListener(this);
18171967 metalnessField.addChangeListener(this);
18181968 diffuseField.addChangeListener(this);
18191969 specularField.addChangeListener(this);
....@@ -1843,12 +1993,15 @@
18431993 opacityPowerField.addChangeListener(this);
18441994 /**/
18451995
1846
- resetSlidersButton.addActionListener(this);
18471996 clearMaterialButton.addActionListener(this);
18481997 createMaterialButton.addActionListener(this);
1849
-
1850
- propagateToggle.addItemListener(this);
1851
- multiplyToggle.addItemListener(this);
1998
+
1999
+ if (Globals.ADVANCED)
2000
+ {
2001
+ resetSlidersButton.addActionListener(this);
2002
+ propagateToggle.addItemListener(this);
2003
+ multiplyToggle.addItemListener(this);
2004
+ }
18522005 }
18532006
18542007 void DropFile(java.io.File[] files, boolean textures)
....@@ -1866,8 +2019,9 @@
18662019 // 3D models
18672020 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18682021 {
1869
- lastConverter = new com.jmex.model.converters.MaxToJme();
1870
- LoadFile(filename, lastConverter);
2022
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2023
+ //LoadFile(filename, lastConverter);
2024
+ LoadObjFile(filename); // New 3ds loader
18712025 continue;
18722026 }
18732027 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2019,7 +2173,7 @@
20192173
20202174 //? flashIt = false;
20212175 CameraPane pane = (CameraPane) cameraView;
2022
- pane.clickStart(location.x, location.y, 0);
2176
+ pane.clickStart(location.x, location.y, 0, 0);
20232177 pane.clickEnd(location.x, location.y, 0, true);
20242178
20252179 if (group.selection.size() == 1)
....@@ -2068,6 +2222,7 @@
20682222 e2.printStackTrace();
20692223 }
20702224 }
2225
+
20712226 LoadJMEThread loadThread;
20722227
20732228 class LoadJMEThread extends Thread
....@@ -2125,6 +2280,7 @@
21252280 //LoadFile0(filename, converter);
21262281 }
21272282 }
2283
+
21282284 LoadOBJThread loadObjThread;
21292285
21302286 class LoadOBJThread extends Thread
....@@ -2203,19 +2359,19 @@
22032359
22042360 void LoadObjFile(String fullname)
22052361 {
2206
- /*
2362
+ System.out.println("Loading " + fullname);
2363
+ /**/
22072364 //lastFilename = fullname;
22082365 if(loadObjThread == null)
22092366 {
2210
- loadObjThread = new LoadOBJThread();
2211
- loadObjThread.start();
2367
+ loadObjThread = new LoadOBJThread();
2368
+ loadObjThread.start();
22122369 }
22132370
22142371 loadObjThread.add(fullname);
2215
- */
2372
+ /**/
22162373
2217
- System.out.println("Loading " + fullname);
2218
- makeSomething(new FileObject(fullname, true), true);
2374
+ //makeSomething(new FileObject(fullname, true), true);
22192375 }
22202376
22212377 void LoadGFDFile(String fullname)
....@@ -2476,11 +2632,11 @@
24762632
24772633 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24782634 {
2479
- if (GrafreeD.standAlone)
2635
+ if (Grafreed.standAlone)
24802636 {
24812637 /**/
24822638 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2483
- browser.show();
2639
+ browser.setVisible(true);
24842640 String filename = browser.getFile();
24852641 if (filename != null && filename.length() > 0)
24862642 {
....@@ -2591,6 +2747,7 @@
25912747 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25922748 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25932749 }
2750
+
25942751 //cJME.count++;
25952752 //cJME.count %= 12;
25962753 if (gc)
....@@ -2625,6 +2782,7 @@
26252782 }
26262783 if (input == null)
26272784 {
2785
+ new Exception().printStackTrace();
26282786 System.exit(0);
26292787 }
26302788
....@@ -2773,6 +2931,7 @@
27732931 }
27742932 }
27752933 }
2934
+
27762935 cFileSystemPane FSPane;
27772936
27782937 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2826,11 +2985,14 @@
28262985 }
28272986 }
28282987 }
2988
+
28292989 freezematerial = false;
28302990 }
28312991
28322992 void SetMaterial(Object3D object)
28332993 {
2994
+ latestObject = object;
2995
+
28342996 cMaterial mat = object.material;
28352997
28362998 if (mat == null)
....@@ -2839,7 +3001,8 @@
28393001 return;
28403002 }
28413003
2842
- multiplyToggle.setSelected(mat.multiply);
3004
+ if (multiplyToggle != null)
3005
+ multiplyToggle.setSelected(mat.multiply);
28433006
28443007 assert (object.projectedVertices != null);
28453008
....@@ -2941,12 +3104,17 @@
29413104 // }
29423105
29433106 /**/
2944
- if (deselect)
3107
+ if (deselect || child == null)
29453108 {
29463109 //group.deselectAll();
29473110 //freeze = true;
29483111 GetTree().clearSelection();
29493112 //freeze = false;
3113
+
3114
+ if (child == null)
3115
+ {
3116
+ return;
3117
+ }
29503118 }
29513119
29523120 //group.addSelectee(child);
....@@ -3015,7 +3183,7 @@
30153183 cameraView.ToggleDL();
30163184 cameraView.repaint();
30173185 return;
3018
- } else if (event.getSource() == toggleTextureItem)
3186
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30193187 {
30203188 cameraView.ToggleTexture();
30213189 // june 2013 copy.HardTouch();
....@@ -3054,9 +3222,9 @@
30543222 frame.validate();
30553223
30563224 return;
3057
- } else if (event.getSource() == toggleRandomItem)
3225
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30583226 {
3059
- cameraView.ToggleRandom();
3227
+ cameraView.ToggleSwitch();
30603228 cameraView.repaint();
30613229 return;
30623230 } else if (event.getSource() == toggleHandleItem)
....@@ -3085,6 +3253,10 @@
30853253 {
30863254 copy.live ^= true;
30873255 return;
3256
+ } else if (event.getSource() == selectableCB)
3257
+ {
3258
+ copy.dontselect ^= true;
3259
+ return;
30883260 } else if (event.getSource() == hideCB)
30893261 {
30903262 copy.hide ^= true;
....@@ -3099,6 +3271,7 @@
30993271 if (event.getSource() == randomCB)
31003272 {
31013273 copy.random ^= true;
3274
+ objEditor.refreshContents();
31023275 return;
31033276 }
31043277 if (event.getSource() == speedupCB)
....@@ -3122,8 +3295,9 @@
31223295
31233296 public void actionPerformed(ActionEvent event)
31243297 {
3298
+ Object source = event.getSource();
31253299 // SCRIPT DIALOG
3126
- if (event.getSource() == okbutton)
3300
+ if (source == okbutton)
31273301 {
31283302 textpanel.setVisible(false);
31293303 textpanel.remove(textarea);
....@@ -3135,7 +3309,7 @@
31353309 textarea = null;
31363310 textpanel = null;
31373311 }
3138
- if (event.getSource() == cancelbutton)
3312
+ if (source == cancelbutton)
31393313 {
31403314 textpanel.setVisible(false);
31413315 textpanel.remove(textarea);
....@@ -3147,50 +3321,50 @@
31473321 //applySelf();
31483322 //client.refreshEditWindow();
31493323 //refreshContents();
3150
- if (event.getSource() == nameField)
3324
+ if (source == nameField)
31513325 {
31523326 //System.out.println("ObjEditor " + event);
31533327 applySelf0(true);
31543328 //parent.applySelf();
31553329 objEditor.refreshContents();
3156
- } else if (event.getSource() == resetButton)
3330
+ } else if (source == resetButton)
31573331 {
31583332 CameraPane.fullreset = true;
31593333 copy.Reset(); // ResetMeshes();
31603334 copy.Touch();
31613335 objEditor.refreshContents();
3162
- } else if (event.getSource() == stepItem)
3336
+ } else if (source == stepItem)
31633337 {
31643338 //cameraView.ONESTEP = true;
31653339 Globals.ONESTEP = true;
31663340 cameraView.repaint();
31673341 return;
3168
- } else if (event.getSource() == stepButton)
3342
+ } else if (source == stepButton)
31693343 {
31703344 copy.Step();
31713345 copy.Touch();
31723346 objEditor.refreshContents();
3173
- } else if (event.getSource() == slowerButton)
3347
+ } else if (source == slowerButton)
31743348 {
31753349 copy.Slower();
31763350 copy.Touch();
31773351 objEditor.refreshContents();
3178
- } else if (event.getSource() == fasterButton)
3352
+ } else if (source == fasterButton)
31793353 {
31803354 copy.Faster();
31813355 copy.Touch();
31823356 objEditor.refreshContents();
3183
- } else if (event.getSource() == remarkButton)
3357
+ } else if (source == remarkButton)
31843358 {
31853359 copy.Remark();
31863360 copy.Touch();
31873361 objEditor.refreshContents();
3188
- } else if (event.getSource() == stepAllButton)
3362
+ } else if (source == stepAllButton)
31893363 {
31903364 copy.StepAll();
31913365 copy.Touch();
31923366 objEditor.refreshContents();
3193
- } else if (event.getSource() == resetAllButton)
3367
+ } else if (source == resetAllButton)
31943368 {
31953369 //CameraPane.fullreset = true;
31963370 copy.ResetAll(); // ResetMeshes();
....@@ -3223,53 +3397,79 @@
32233397 // Close();
32243398 // }
32253399 // else
3226
- if (event.getSource() == resetSlidersButton)
3400
+ if (source == resetSlidersButton)
32273401 {
32283402 ResetSliders();
3229
- } else if (event.getSource() == clearMaterialButton)
3403
+ } else if (source == clearMaterialButton)
32303404 {
32313405 ClearMaterial();
3232
- } else if (event.getSource() == createMaterialButton)
3406
+ } else if (source == createMaterialButton)
32333407 {
32343408 CreateMaterial();
3235
- } else if (event.getSource() == clearPanelButton)
3409
+ } else if (source == clearPanelButton)
32363410 {
32373411 copy.ClearUI();
32383412 refreshContents(true);
3239
- } /*
3240
- }
3241
-
3242
- public boolean action(Event event, Object arg)
3243
- {
3244
- */ else if (event.getSource() == closeItem)
3413
+ } else if (source == importGFDItem)
3414
+ {
3415
+ ImportGFD();
3416
+ } else
3417
+ if (source == importVRMLX3DItem)
3418
+ {
3419
+ ImportVRMLX3D();
3420
+ } else
3421
+ if (source == import3DSItem)
3422
+ {
3423
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3424
+ } else
3425
+ if (source == importOBJItem)
3426
+ {
3427
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3428
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3429
+ browser.setVisible(true);
3430
+ String filename = browser.getFile();
3431
+ if (filename != null && filename.length() > 0)
3432
+ {
3433
+ String fullname = browser.getDirectory() + filename;
3434
+ makeSomething(ReadOBJ(fullname), true);
3435
+ }
3436
+ } else
3437
+ if (source == closeItem)
32453438 {
32463439 Close();
32473440 //return true;
3248
- } else if (event.getSource() == loadItem)
3441
+ } else if (source == openItem)
32493442 {
3250
- load();
3443
+ Open();
32513444 //return true;
3252
- } else if (event.getSource() == saveItem)
3445
+ } else if (source == newItem)
3446
+ {
3447
+ New();
3448
+ } else if (source == saveItem)
32533449 {
32543450 save();
32553451 //return true;
3256
- } else if (event.getSource() == saveAsItem)
3452
+ } else if (source == saveAsItem)
32573453 {
32583454 saveAs();
32593455 //return true;
3260
- } else if (event.getSource() == reexportItem)
3456
+ } else if (source == reexportItem)
32613457 {
32623458 reexport();
32633459 //return true;
3264
- } else if (event.getSource() == exportAsItem)
3460
+ } else if (source == exportAsItem)
32653461 {
32663462 export();
32673463 //return true;
3268
- } else if (event.getSource() == povItem)
3464
+ } else if (source == povItem)
32693465 {
32703466 generatePOV();
32713467 //return true;
3272
- } else if (event.getSource() == zBufferItem)
3468
+ } else if (event.getSource() == archiveItem)
3469
+ {
3470
+ cTools.Archive(frame);
3471
+ return;
3472
+ } else if (source == zBufferItem)
32733473 {
32743474 try
32753475 {
....@@ -3291,21 +3491,8 @@
32913491 cameraView.repaint();
32923492 //return true;
32933493 }
3294
- */ else if (event.getSource() == editCameraItem)
3295
- {
3296
- cameraView.ProtectCamera();
3297
- cameraView.repaint();
3298
- return;
3299
- } else if (event.getSource() == revertCameraItem)
3300
- {
3301
- cameraView.RevertCamera();
3302
- cameraView.repaint();
3303
- return;
3304
-// } else if (event.getSource() == textureButton)
3305
-// {
3306
-// return; // true;
3307
- } else // combos...
3308
- if (event.getSource() == texresMenu)
3494
+ */ else // combos...
3495
+ if (source == texresMenu)
33093496 {
33103497 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
33113498 copy.texres = texresMenu.getSelectedIndex();
....@@ -3317,12 +3504,409 @@
33173504 }
33183505 }
33193506
3507
+ void New()
3508
+ {
3509
+ while (copy.Size() > 1)
3510
+ {
3511
+ copy.remove(1);
3512
+ }
3513
+
3514
+ ResetModel();
3515
+ objEditor.refreshContents();
3516
+ }
3517
+
3518
+ static public byte[] Compress(Object3D o)
3519
+ {
3520
+ try
3521
+ {
3522
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3523
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3524
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3525
+
3526
+ Object3D parent = o.parent;
3527
+ o.parent = null;
3528
+
3529
+ out.writeObject(o);
3530
+
3531
+ o.parent = parent;
3532
+
3533
+ out.flush();
3534
+
3535
+ baos //zstream
3536
+ .close();
3537
+ out.close();
3538
+
3539
+ byte[] bytes = baos.toByteArray();
3540
+
3541
+ System.out.println("save #bytes = " + bytes.length);
3542
+ return bytes;
3543
+ } catch (Exception e)
3544
+ {
3545
+ System.err.println(e);
3546
+ return null;
3547
+ }
3548
+ }
3549
+
3550
+ static public Object Uncompress(byte[] bytes)
3551
+ {
3552
+ System.out.println("restore #bytes = " + bytes.length);
3553
+ try
3554
+ {
3555
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3556
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3557
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3558
+ Object obj = in.readObject();
3559
+
3560
+ bais //istream
3561
+ .close();
3562
+ in.close();
3563
+
3564
+ return obj;
3565
+ } catch (Exception e)
3566
+ {
3567
+ System.err.println(e);
3568
+ return null;
3569
+ }
3570
+ }
3571
+
3572
+ static public Object clone(Object o)
3573
+ {
3574
+ try
3575
+ {
3576
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3577
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3578
+
3579
+ out.writeObject(o);
3580
+
3581
+ out.flush();
3582
+ out.close();
3583
+
3584
+ byte[] bytes = baos.toByteArray();
3585
+
3586
+ System.out.println("clone = " + bytes.length);
3587
+
3588
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3589
+ ObjectInputStream in = new ObjectInputStream(bais);
3590
+ Object obj = in.readObject();
3591
+ in.close();
3592
+
3593
+ return obj;
3594
+ } catch (Exception e)
3595
+ {
3596
+ System.err.println(e);
3597
+ return null;
3598
+ }
3599
+ }
3600
+
3601
+ cRadio GetCurrentTab()
3602
+ {
3603
+ cRadio ab;
3604
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3605
+ {
3606
+ ab = (cRadio)e.nextElement();
3607
+ if(ab.GetObject() == copy)
3608
+ {
3609
+ return ab;
3610
+ }
3611
+ }
3612
+
3613
+ return null;
3614
+ }
3615
+
3616
+
3617
+ public void Save()
3618
+ {
3619
+ //Save(true);
3620
+ Replace();
3621
+ }
3622
+
3623
+ private boolean Equal(byte[] compress, byte[] name)
3624
+ {
3625
+ if (compress.length != name.length)
3626
+ {
3627
+ return false;
3628
+ }
3629
+
3630
+ for (int i=compress.length; --i>=0;)
3631
+ {
3632
+ if (compress[i] != name[i])
3633
+ return false;
3634
+ }
3635
+
3636
+ return true;
3637
+ }
3638
+
3639
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3640
+
3641
+ public boolean Save(boolean user)
3642
+ {
3643
+ System.err.println("Save");
3644
+
3645
+ cRadio tab = GetCurrentTab();
3646
+
3647
+ byte[] compress = CompressCopy();
3648
+
3649
+ boolean thesame = false;
3650
+
3651
+ // Quick heuristic using length. Works only when stream is compressed.
3652
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3653
+ {
3654
+ thesame = true;
3655
+ }
3656
+
3657
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3658
+ if (!thesame)
3659
+ {
3660
+ //tab.user[tab.versionindex] = user;
3661
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3662
+
3663
+ copy.versions[++copy.versionindex] = compress;
3664
+
3665
+ // if (increment)
3666
+ // tab.versionindex++;
3667
+ }
3668
+
3669
+ //copy.RestoreBigData(versiontable);
3670
+
3671
+ //assert(hashtable.isEmpty());
3672
+
3673
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3674
+ {
3675
+ //tab.user[i] = false;
3676
+ copy.versions[i] = null;
3677
+ }
3678
+
3679
+ SetUndoStates();
3680
+
3681
+ // test save
3682
+ if (false)
3683
+ {
3684
+ try
3685
+ {
3686
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3687
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3688
+
3689
+ p.writeObject(copy);
3690
+
3691
+ p.flush();
3692
+
3693
+ ostream.close();
3694
+ } catch (Exception e)
3695
+ {
3696
+ e.printStackTrace();
3697
+ }
3698
+ }
3699
+
3700
+ return !thesame;
3701
+ }
3702
+
3703
+ void CopyChanged(Object3D obj)
3704
+ {
3705
+ SetUndoStates();
3706
+
3707
+ boolean temp = CameraPane.SWITCH;
3708
+ CameraPane.SWITCH = false;
3709
+
3710
+ copy.ExtractBigData(versiontable);
3711
+
3712
+ copy.clear();
3713
+
3714
+ for (int i=0; i<obj.Size(); i++)
3715
+ {
3716
+ copy.add(obj.get(i));
3717
+ }
3718
+
3719
+ copy.RestoreBigData(versiontable);
3720
+
3721
+ CameraPane.SWITCH = temp;
3722
+
3723
+ //assert(hashtable.isEmpty());
3724
+
3725
+ copy.Touch();
3726
+
3727
+ ResetModel();
3728
+ copy.HardTouch(); // recompile?
3729
+
3730
+ cRadio ab;
3731
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3732
+ {
3733
+ ab = (cRadio)e.nextElement();
3734
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3735
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3736
+ if (test != null)
3737
+ {
3738
+ test.editWindow = ab.object.editWindow;
3739
+ ab.object = test;
3740
+ }
3741
+ }
3742
+
3743
+ refreshContents();
3744
+ }
3745
+
3746
+ cButton undoButton;
3747
+ cButton restoreButton;
3748
+ cButton replaceButton;
3749
+ cButton redoButton;
3750
+
3751
+ boolean muteSlider;
3752
+
3753
+ int VersionCount()
3754
+ {
3755
+ int count = 0;
3756
+
3757
+ for (int i = copy.versions.length; --i >= 0;)
3758
+ {
3759
+ if (copy.versions[i] != null)
3760
+ count++;
3761
+ }
3762
+
3763
+ return count;
3764
+ }
3765
+
3766
+ void SetUndoStates()
3767
+ {
3768
+ cRadio tab = GetCurrentTab();
3769
+
3770
+ restoreButton.setEnabled(copy.versionindex != -1);
3771
+ replaceButton.setEnabled(copy.versionindex != -1);
3772
+
3773
+ undoButton.setEnabled(copy.versionindex > 0);
3774
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3775
+
3776
+ muteSlider = true;
3777
+ versionSlider.setMaximum(VersionCount() - 1);
3778
+ versionSlider.setInteger(copy.versionindex);
3779
+ muteSlider = false;
3780
+ }
3781
+
3782
+ public boolean Undo()
3783
+ {
3784
+ // Option?
3785
+ Replace();
3786
+
3787
+ System.err.println("Undo");
3788
+
3789
+ cRadio tab = GetCurrentTab();
3790
+
3791
+ if (copy.versionindex == 0)
3792
+ {
3793
+ java.awt.Toolkit.getDefaultToolkit().beep();
3794
+ return false;
3795
+ }
3796
+
3797
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3798
+// {
3799
+// if (Save(false))
3800
+// tab.versionindex -= 1;
3801
+// else
3802
+// {
3803
+// if (tab.versionindex <= 0)
3804
+// return false;
3805
+// else
3806
+// tab.versionindex -= 1;
3807
+// }
3808
+// }
3809
+
3810
+ copy.versionindex -= 1;
3811
+
3812
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3813
+
3814
+ return true;
3815
+ }
3816
+
3817
+ public boolean Restore()
3818
+ {
3819
+ System.err.println("Restore");
3820
+
3821
+ cRadio tab = GetCurrentTab();
3822
+
3823
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3824
+ {
3825
+ java.awt.Toolkit.getDefaultToolkit().beep();
3826
+ return false;
3827
+ }
3828
+
3829
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3830
+
3831
+ return true;
3832
+ }
3833
+
3834
+ public boolean Replace()
3835
+ {
3836
+ System.err.println("Replace");
3837
+
3838
+ cRadio tab = GetCurrentTab();
3839
+
3840
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3841
+ {
3842
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3843
+ return false;
3844
+ }
3845
+
3846
+ copy.versions[copy.versionindex] = CompressCopy();
3847
+
3848
+ return true;
3849
+ }
3850
+
3851
+ public void Redo()
3852
+ {
3853
+ // Option?
3854
+ Replace();
3855
+
3856
+ cRadio tab = GetCurrentTab();
3857
+
3858
+ if (copy.versions[copy.versionindex + 1] == null)
3859
+ {
3860
+ java.awt.Toolkit.getDefaultToolkit().beep();
3861
+ return;
3862
+ }
3863
+
3864
+ copy.versionindex += 1;
3865
+
3866
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3867
+
3868
+ //if (!tab.user[tab.versionindex])
3869
+ // tab.graphs[tab.versionindex] = null;
3870
+ }
3871
+
3872
+ void ImportGFD()
3873
+ {
3874
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3875
+ browser.show();
3876
+ String filename = browser.getFile();
3877
+ if (filename != null && filename.length() > 0)
3878
+ {
3879
+ String fullname = browser.getDirectory() + filename;
3880
+
3881
+ //Object3D readobj =
3882
+ objEditor.ReadGFD(fullname, objEditor);
3883
+ //makeSomething(readobj);
3884
+ }
3885
+ }
3886
+
3887
+ void ImportVRMLX3D()
3888
+ {
3889
+ if (Grafreed.standAlone)
3890
+ {
3891
+ /**/
3892
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3893
+ browser.show();
3894
+ String filename = browser.getFile();
3895
+ if (filename != null && filename.length() > 0)
3896
+ {
3897
+ String fullname = browser.getDirectory() + filename;
3898
+ LoadVRMLX3D(fullname);
3899
+ }
3900
+ /**/
3901
+ }
3902
+ }
3903
+
33203904 void ToggleAnimation()
33213905 {
33223906 if (!Globals.ANIMATION)
33233907 {
33243908 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3325
- browser.show();
3909
+ browser.setVisible(true);
33263910 String filename = browser.getFile();
33273911 if (filename != null && filename.length() > 0)
33283912 {
....@@ -3332,8 +3916,8 @@
33323916
33333917 Globals.ANIMATION ^= true;
33343918
3335
- GrafreeD.wav.cursor = 0;
3336
- GrafreeD.wav.loop = 0;
3919
+ Grafreed.wav.cursor = 0;
3920
+ Grafreed.wav.loop = 0;
33373921 }
33383922 } else
33393923 {
....@@ -3383,7 +3967,7 @@
33833967 void CreateMaterial()
33843968 {
33853969 //copy.ClearMaterial(); // PATCH
3386
- copy.CreateMaterialS(multiplyToggle.isSelected());
3970
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33873971 if (copy.selection.size() > 0)
33883972 //SetMaterial(copy);
33893973 {
....@@ -3434,7 +4018,7 @@
34344018 assert false;
34354019 }
34364020
3437
- void EditSelection()
4021
+ void EditSelection(boolean newWindow)
34384022 {
34394023 }
34404024
....@@ -3442,11 +4026,11 @@
34424026 {
34434027 copy.ResetBlockLoop(); // temporary problem
34444028
3445
- boolean random = CameraPane.RANDOM;
3446
- CameraPane.RANDOM = false; // parse everything
4029
+ boolean random = CameraPane.SWITCH;
4030
+ CameraPane.SWITCH = false; // parse everything
34474031 copy.ResetDisplayList();
34484032 copy.HardTouch();
3449
- CameraPane.RANDOM = random;
4033
+ CameraPane.SWITCH = random;
34504034 }
34514035
34524036 // public void applySelf()
....@@ -3516,10 +4100,40 @@
35164100 current.fakedepth = (float) fakedepthField.getFloat();
35174101 current.shadowbias = (float) shadowbiasField.getFloat();
35184102
3519
- if (!NumberSlider.frozen)
4103
+ if (!cNumberSlider.frozen)
35204104 {
35214105 //System.out.println("Propagate = " + propagate);
35224106 copy.UpdateMaterial(anchor, current, propagate);
4107
+
4108
+ if (copy.material != null)
4109
+ {
4110
+ cMaterial mat = copy.material;
4111
+
4112
+ colorField.SetToolTipValue((mat.color));
4113
+ modulationField.SetToolTipValue((mat.modulation));
4114
+ metalnessField.SetToolTipValue((mat.metalness));
4115
+ diffuseField.SetToolTipValue((mat.diffuse));
4116
+ specularField.SetToolTipValue((mat.specular));
4117
+ shininessField.SetToolTipValue((mat.shininess));
4118
+ shiftField.SetToolTipValue((mat.shift));
4119
+ ambientField.SetToolTipValue((mat.ambient));
4120
+ lightareaField.SetToolTipValue((mat.lightarea));
4121
+ diffusenessField.SetToolTipValue((mat.factor));
4122
+ velvetField.SetToolTipValue((mat.velvet));
4123
+ sheenField.SetToolTipValue((mat.sheen));
4124
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4125
+ backlitField.SetToolTipValue((mat.bump));
4126
+ anisoField.SetToolTipValue((mat.aniso));
4127
+ anisoVField.SetToolTipValue((mat.anisoV));
4128
+ cameraField.SetToolTipValue((mat.cameralight));
4129
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4130
+ shadowField.SetToolTipValue((mat.shadow));
4131
+ textureField.SetToolTipValue((mat.texture));
4132
+ opacityField.SetToolTipValue((mat.opacity));
4133
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4134
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4135
+ }
4136
+
35234137 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35244138 {
35254139 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3548,9 +4162,25 @@
35484162 //copy.Touch();
35494163 }
35504164
4165
+ cNumberSlider versionSlider;
4166
+
35514167 public void stateChanged(ChangeEvent e)
35524168 {
35534169 // assert(false);
4170
+ if (e.getSource() == versionSlider)
4171
+ {
4172
+ if (muteSlider)
4173
+ return;
4174
+
4175
+ int version = versionSlider.getInteger();
4176
+
4177
+ if (copy.versions[version] != null)
4178
+ {
4179
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4180
+ }
4181
+
4182
+ return;
4183
+ }
35544184
35554185 if (freezematerial)
35564186 {
....@@ -3564,6 +4194,7 @@
35644194 || e.getSource() == apertureField
35654195 || e.getSource() == shadowblurField)
35664196 {
4197
+ new Exception().printStackTrace();
35674198 System.exit(0);
35684199 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35694200 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3634,7 +4265,7 @@
36344265 }
36354266
36364267 if (normalpushField != null)
3637
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4268
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36384269 }
36394270
36404271 void SnapObject()
....@@ -3889,7 +4520,7 @@
38894520
38904521 radioPanel.revalidate();
38914522 radioPanel.repaint();
3892
- ctrlPanel.revalidate(); // ? new
4523
+ ctrlPanel.validate(); // ? new
38934524 ctrlPanel.repaint();
38944525 }
38954526 }
....@@ -3898,6 +4529,8 @@
38984529
38994530 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
39004531 {
4532
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4533
+ Save();
39014534 //Tween.set(thing, 0).target(1).start(tweenManager);
39024535 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
39034536 // if (thing instanceof GenericJointDemo)
....@@ -3984,6 +4617,12 @@
39844617 {
39854618 ResetModel();
39864619 Select(thing.GetTreePath(), true, false); // unselect... false);
4620
+
4621
+ if (thing.Size() == 0)
4622
+ {
4623
+ //EditSelection(false);
4624
+ }
4625
+
39874626 refreshContents();
39884627 }
39894628
....@@ -4101,6 +4740,7 @@
41014740 }
41024741 }
41034742 }
4743
+
41044744 LoadGFDThread loadGFDThread;
41054745
41064746 void ReadGFD(String fullname, iCallBack cb)
....@@ -4120,8 +4760,10 @@
41204760
41214761 try
41224762 {
4763
+ // Try compressed version first.
41234764 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4124
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4765
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4766
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
41254767
41264768 readobj = (Object3D) p.readObject();
41274769 istream.close();
....@@ -4129,7 +4771,22 @@
41294771 readobj.ResetDisplayList();
41304772 } catch (Exception e)
41314773 {
4132
- e.printStackTrace();
4774
+ if (!e.toString().contains("GZIP"))
4775
+ e.printStackTrace();
4776
+
4777
+ try
4778
+ {
4779
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4780
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4781
+
4782
+ readobj = (Object3D) p.readObject();
4783
+ istream.close();
4784
+
4785
+ readobj.ResetDisplayList();
4786
+ } catch (Exception e2)
4787
+ {
4788
+ e2.printStackTrace();
4789
+ }
41334790 }
41344791 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41354792 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4175,6 +4832,12 @@
41754832
41764833 void LoadIt(Object obj)
41774834 {
4835
+ if (obj == null)
4836
+ {
4837
+ // Invalid file
4838
+ return;
4839
+ }
4840
+
41784841 System.out.println("Loaded " + obj);
41794842 //new Exception().printStackTrace();
41804843 Object3D readobj = (Object3D) obj;
....@@ -4184,6 +4847,8 @@
41844847
41854848 if (readobj != null)
41864849 {
4850
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4851
+ // Save();
41874852 try
41884853 {
41894854 //readobj.deepCopySelf(copy);
....@@ -4228,6 +4893,7 @@
42284893 }
42294894 } catch (ClassCastException e)
42304895 {
4896
+ e.printStackTrace();
42314897 assert (false);
42324898 Composite c = (Composite) copy;
42334899 c.children.clear();
....@@ -4238,15 +4904,26 @@
42384904 c.addChild(csg);
42394905 }
42404906
4907
+ copy.versions = readobj.versions;
4908
+ copy.versionindex = readobj.versionindex;
4909
+
4910
+ if (copy.versions == null)
4911
+ {
4912
+ copy.versions = new byte[100][];
4913
+ copy.versionindex = -1;
4914
+ }
4915
+
4916
+ //? SetUndoStates();
4917
+
42414918 ResetModel();
42424919 copy.HardTouch(); // recompile?
42434920 refreshContents();
42444921 }
42454922 }
42464923
4247
- void load() // throws ClassNotFoundException
4924
+ void Open() // throws ClassNotFoundException
42484925 {
4249
- if (GrafreeD.standAlone)
4926
+ if (Grafreed.standAlone)
42504927 {
42514928 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42524929 browser.show();
....@@ -4333,11 +5010,13 @@
43335010 try
43345011 {
43355012 FileOutputStream ostream = new FileOutputStream(lastname);
4336
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5013
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5014
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43375015
43385016 p.writeObject(copy);
43395017 p.flush();
43405018
5019
+ zstream.close();
43415020 ostream.close();
43425021
43435022 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4345,19 +5024,23 @@
43455024 //ps.print(buffer.toString());
43465025 } catch (IOException e)
43475026 {
5027
+ e.printStackTrace();
43485028 }
43495029 }
5030
+
43505031 String lastname;
43515032
43525033 void saveAs()
43535034 {
4354
- if (GrafreeD.standAlone)
5035
+ if (Grafreed.standAlone)
43555036 {
43565037 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43575038 browser.setVisible(true);
43585039 String filename = browser.getFile();
43595040 if (filename != null && filename.length() > 0)
43605041 {
5042
+ if (!filename.endsWith(".gfd"))
5043
+ filename += ".gfd";
43615044 lastname = browser.getDirectory() + filename;
43625045 save();
43635046 }
....@@ -4456,13 +5139,13 @@
44565139 try
44575140 {
44585141 FileOutputStream ostream = new FileOutputStream(filename);
4459
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4460
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5142
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5143
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44615144
44625145 Object3D objectparent = obj.parent;
44635146 obj.parent = null;
44645147
4465
- Object3D object = (Object3D) GrafreeD.clone(obj);
5148
+ Object3D object = (Object3D) Grafreed.clone(obj);
44665149
44675150 obj.parent = objectparent;
44685151
....@@ -4474,8 +5157,8 @@
44745157 p.writeObject(object);
44755158 p.flush();
44765159
5160
+ zstream.close();
44775161 ostream.close();
4478
- // zstream.close();
44795162
44805163 // group.selection.get(0).parent = parent;
44815164 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4496,7 +5179,7 @@
44965179 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44975180 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44985181 copy.generatePOV(buffer);
4499
- if (GrafreeD.standAlone)
5182
+ if (Grafreed.standAlone)
45005183 {
45015184 FileDialog browser = new FileDialog(frame, "Export POV", 1);
45025185 browser.show();
....@@ -4522,21 +5205,20 @@
45225205 Object3D client;
45235206 Object3D copy;
45245207 MenuBar menuBar;
4525
- Menu windowMenu;
4526
- MenuItem loadItem;
5208
+ Menu fileMenu;
5209
+ MenuItem newItem;
5210
+ MenuItem openItem;
45275211 MenuItem saveItem;
45285212 MenuItem saveAsItem;
45295213 MenuItem exportAsItem;
45305214 MenuItem reexportItem;
45315215 MenuItem povItem;
45325216 MenuItem closeItem;
4533
- Menu cameraMenu;
5217
+
45345218 CheckboxMenuItem zBufferItem;
45355219 //MenuItem normalLensItem;
4536
- MenuItem editCameraItem;
4537
- MenuItem revertCameraItem;
4538
- CheckboxMenuItem toggleLiveItem;
45395220 MenuItem stepItem;
5221
+ CheckboxMenuItem toggleLiveItem;
45405222 CheckboxMenuItem toggleFullScreenItem;
45415223 CheckboxMenuItem toggleTimelineItem;
45425224 CheckboxMenuItem toggleRenderItem;
....@@ -4545,25 +5227,39 @@
45455227 CheckboxMenuItem toggleFootContactItem;
45465228 CheckboxMenuItem toggleDLItem;
45475229 CheckboxMenuItem toggleTextureItem;
4548
- CheckboxMenuItem toggleRandomItem;
5230
+ CheckboxMenuItem toggleSwitchItem;
45495231 CheckboxMenuItem toggleRootItem;
45505232 CheckboxMenuItem animationItem;
5233
+ MenuItem archiveItem;
45515234 CheckboxMenuItem toggleHandleItem;
45525235 CheckboxMenuItem togglePaintItem;
45535236 JSplitPane mainPanel;
45545237 JScrollPane scrollpane;
5238
+
45555239 JPanel toolbarPanel;
4556
- JPanel treePanel;
5240
+
5241
+ cGridBag treePanel;
5242
+
45575243 JPanel radioPanel;
45585244 ButtonGroup buttonGroup;
4559
- JPanel ctrlPanel;
4560
- JPanel materialPanel;
5245
+
5246
+ cGridBag toolboxPanel;
5247
+ cGridBag materialPanel;
5248
+ cGridBag ctrlPanel;
5249
+
45615250 JScrollPane infoPanel;
4562
- JPanel optionsPanel;
5251
+
5252
+ cGridBag optionsPanel;
5253
+
45635254 JTabbedPane objectPanel;
5255
+ boolean materialFlushed;
5256
+ Object3D latestObject;
5257
+
45645258 cGridBag XYZPanel;
5259
+
45655260 JSplitPane gridPanel;
45665261 JSplitPane bigPanel;
5262
+
45675263 cGridBag bigThree;
45685264 cGridBag scenePanel;
45695265 cGridBag centralPanel;
....@@ -4619,67 +5315,72 @@
46195315 // MATERIAL
46205316 JLabel materialLabel;
46215317 JLabel colorLabel;
4622
- NumberSlider colorField;
5318
+ cNumberSlider colorField;
46235319 JLabel modulationLabel;
4624
- NumberSlider modulationField;
5320
+ cNumberSlider modulationField;
46255321 JLabel metalnessLabel;
4626
- NumberSlider metalnessField;
5322
+ cNumberSlider metalnessField;
46275323 JLabel diffuseLabel;
4628
- NumberSlider diffuseField;
5324
+ cNumberSlider diffuseField;
46295325 JLabel specularLabel;
4630
- NumberSlider specularField;
5326
+ cNumberSlider specularField;
46315327 JLabel shininessLabel;
4632
- NumberSlider shininessField;
5328
+ cNumberSlider shininessField;
46335329 JLabel shiftLabel;
4634
- NumberSlider shiftField;
5330
+ cNumberSlider shiftField;
46355331 JLabel ambientLabel;
4636
- NumberSlider ambientField;
5332
+ cNumberSlider ambientField;
46375333 JLabel lightareaLabel;
4638
- NumberSlider lightareaField;
5334
+ cNumberSlider lightareaField;
46395335 JLabel diffusenessLabel;
4640
- NumberSlider diffusenessField;
5336
+ cNumberSlider diffusenessField;
46415337 JLabel velvetLabel;
4642
- NumberSlider velvetField;
5338
+ cNumberSlider velvetField;
46435339 JLabel sheenLabel;
4644
- NumberSlider sheenField;
5340
+ cNumberSlider sheenField;
46455341 JLabel subsurfaceLabel;
4646
- NumberSlider subsurfaceField;
5342
+ cNumberSlider subsurfaceField;
46475343 //JLabel bumpLabel;
46485344 //NumberSlider bumpField;
46495345 JLabel backlitLabel;
4650
- NumberSlider backlitField;
5346
+ cNumberSlider backlitField;
46515347 JLabel anisoLabel;
4652
- NumberSlider anisoField;
5348
+ cNumberSlider anisoField;
46535349 JLabel anisoVLabel;
4654
- NumberSlider anisoVField;
5350
+ cNumberSlider anisoVField;
46555351 JLabel cameraLabel;
4656
- NumberSlider cameraField;
5352
+ cNumberSlider cameraField;
46575353 JLabel selfshadowLabel;
4658
- NumberSlider selfshadowField;
5354
+ cNumberSlider selfshadowField;
46595355 JLabel shadowLabel;
4660
- NumberSlider shadowField;
5356
+ cNumberSlider shadowField;
46615357 JLabel textureLabel;
4662
- NumberSlider textureField;
5358
+ cNumberSlider textureField;
46635359 JLabel opacityLabel;
4664
- NumberSlider opacityField;
5360
+ cNumberSlider opacityField;
46655361 JLabel fakedepthLabel;
4666
- NumberSlider fakedepthField;
5362
+ cNumberSlider fakedepthField;
46675363 JLabel shadowbiasLabel;
4668
- NumberSlider shadowbiasField;
5364
+ cNumberSlider shadowbiasField;
46695365 JLabel bumpLabel;
4670
- NumberSlider bumpField;
5366
+ cNumberSlider bumpField;
46715367 JLabel noiseLabel;
4672
- NumberSlider noiseField;
5368
+ cNumberSlider noiseField;
46735369 JLabel powerLabel;
4674
- NumberSlider powerField;
5370
+ cNumberSlider powerField;
46755371 JLabel borderfadeLabel;
4676
- NumberSlider borderfadeField;
5372
+ cNumberSlider borderfadeField;
46775373 JLabel fogLabel;
4678
- NumberSlider fogField;
5374
+ cNumberSlider fogField;
46795375 JLabel opacityPowerLabel;
4680
- NumberSlider opacityPowerField;
4681
- JTree jTree;
5376
+ cNumberSlider opacityPowerField;
5377
+ cTree jTree;
46825378 //ObjectUI parent;
46835379
4684
- NumberSlider normalpushField;
5380
+ cNumberSlider normalpushField;
5381
+
5382
+ private MenuItem importGFDItem;
5383
+ private MenuItem importVRMLX3DItem;
5384
+ private MenuItem import3DSItem;
5385
+ private MenuItem importOBJItem;
46855386 }