Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
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
+ private ImageIcon GetIcon(String name)
64
+ {
65
+ try
66
+ {
67
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
68
+
69
+ if (image.getWidth() != 24 && image.getHeight() != 24)
70
+ {
71
+ BufferedImage resized = new BufferedImage(24, 24, 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, 24, 24, 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 cGridBag(); // new GridBagLayout());
359
- ctrlPanel.setName("Edit");
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(false);
440
+ //toolboxPanel.setName("Toolbox");
441
+
360442 materialPanel = new cGridBag().setVertical(true);
361
- materialPanel.setName("Material");
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,15 +464,22 @@
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());
481
+// treePanel.setLayout(new GridBagLayout());
482
+ //ctrlPanel.setLayout(new GridBagLayout());
390483 //materialPanel.setLayout(new GridBagLayout());
391484
392485 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.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 selectCB;
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,54 +995,48 @@
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
- cNumberSlider AddSlider(cGridBag 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 {
8191041 cGridBag control = new cGridBag();
8201042
....@@ -826,12 +1048,12 @@
8261048 control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8271049 combo.setFloat(current);
8281050
829
- ctrlPanel.add(control);
1051
+ panel.add(control);
8301052
831
- return combo;
1053
+ return control;
8321054 }
8331055
834
- cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current)
1056
+ cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
8351057 {
8361058 cGridBag control = new cGridBag();
8371059
....@@ -839,25 +1061,21 @@
8391061
8401062 JLabel jlabel = new JLabel(label);
8411063 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
842
- ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
843
- ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1064
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1065
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8441066 combo.setInteger(current);
8451067
846
- ctrlPanel.add(control);
1068
+ panel.add(control);
8471069
848
- return combo;
1070
+ return control;
8491071 }
8501072
8511073 JTextArea AddText(cGridBag ctrlPanel, String name)
8521074 {
8531075 JTextArea text;
8541076
855
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
856
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
8571077 ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8581078 text.addCaretListener(this);
859
- aConstraints.gridx += 1;
860
- aConstraints.gridwidth = 1;
8611079
8621080 return text;
8631081 }
....@@ -896,7 +1114,7 @@
8961114
8971115 /*
8981116 */
899
- void Return() // ObjEditor oe)
1117
+ void Return0() // ObjEditor oe)
9001118 {
9011119 aConstraints.gridy += 1;
9021120 aConstraints.gridx = 0;
....@@ -951,37 +1169,77 @@
9511169
9521170 void SetupUI2(ObjEditor oe)
9531171 {
954
-// oe.aConstraints.weightx = 0;
955
-// oe.aConstraints.weighty = 0;
956
-// oe.aConstraints.gridx = 0;
957
-// oe.aConstraints.gridy = 0;
958
- SetupName(oe);
1172
+ //SetupName(oe);
9591173
960
- 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)
9611183 return;
9621184
963
- liveCB = AddCheckBox(oe, "Live", copy.live);
964
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
965
- 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
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectCB.setToolTipText("Make object selectable");
9661191 // Return();
967
- markCB = AddCheckBox(oe, "Mark", copy.marked);
968
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
969
- randomCB = AddCheckBox(oe, "Rand", copy.random);
970
- Return();
971
- resetButton = AddButton(oe, "Reset");
972
- stepButton = AddButton(oe, "Step");
1192
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
1193
+ hideCB.setToolTipText("Hide object");
1194
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1195
+ markCB.setToolTipText("As animation target transform");
1196
+
1197
+ setupPanel2 = new cGridBag().setVertical(false);
1198
+
1199
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
1200
+ rewindCB.setToolTipText("Rewind animation");
1201
+
1202
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1203
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
1204
+
1205
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1206
+ link2masterCB.setToolTipText("Attach to support");
1207
+
1208
+ if (Globals.ADVANCED)
1209
+ {
1210
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
1211
+ speedupCB.setToolTipText("Option motion capture");
1212
+ }
1213
+
1214
+ oe.ctrlPanel.add(setupPanel);
1215
+ oe.ctrlPanel.Return();
1216
+ oe.ctrlPanel.add(setupPanel2);
1217
+ oe.ctrlPanel.Return();
1218
+
1219
+ objectCommandsPanel = new cGridBag().setVertical(false);
1220
+
1221
+ resetButton = AddButton(objectCommandsPanel, "Reset");
1222
+ resetButton.setToolTipText("Jump to frame zero");
1223
+ stepButton = AddButton(objectCommandsPanel, "Step");
1224
+ stepButton.setToolTipText("Step one frame");
9731225 // resetAllButton = AddButton(oe, "Reset All");
9741226 // stepAllButton = AddButton(oe, "Step All");
975
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9761227 // Return();
977
- slowerButton = AddButton(oe, "Slow");
978
- fasterButton = AddButton(oe, "Fast");
979
- remarkButton = AddButton(oe, "Rem");
1228
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
1229
+ slowerButton.setToolTipText("Decrease animation speed");
1230
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
1231
+ fasterButton.setToolTipText("Increase animation speed");
1232
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
1233
+ remarkButton.setToolTipText("Set the current transform as the target");
9801234
981
- Return();
1235
+ oe.ctrlPanel.add(objectCommandsPanel);
1236
+ oe.ctrlPanel.Return();
9821237
983
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
984
- Return();
1238
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1239
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1240
+ //Return();
1241
+
1242
+ oe.ctrlPanel.Return();
9851243
9861244 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9871245 // ObjEditor.aConstraints.gridx += 1;
....@@ -1076,7 +1334,7 @@
10761334 oe.aConstraints.gridwidth = 1;
10771335 /**/
10781336 nameField = AddText(oe.ctrlPanel, copy.GetName());
1079
- Return();
1337
+ oe.ctrlPanel.Return();
10801338
10811339 //ctrlPanel.add(textureButton = new Button("Texture..."));
10821340 //textureButton.setEnabled(false);
....@@ -1180,8 +1438,11 @@
11801438 //worldPanel.setName("World");
11811439 centralPanel = new cGridBag();
11821440 centralPanel.preferredWidth = 20;
1183
- timelinePanel = new JPanel(new BorderLayout());
1184
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1441
+
1442
+ if (Globals.ADVANCED)
1443
+ {
1444
+ timelinePanel = new JPanel(new BorderLayout());
1445
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11851446
11861447 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11871448 cameraPanel.setContinuousLayout(true);
....@@ -1190,7 +1451,10 @@
11901451 // cameraPanel.setDividerSize(9);
11911452 cameraPanel.setResizeWeight(1.0);
11921453
1454
+ }
1455
+
11931456 centralPanel.add(cameraView);
1457
+ centralPanel.setFocusable(true);
11941458 //frame.setJMenuBar(timelineMenubar);
11951459 //centralPanel.add(timelinePanel);
11961460
....@@ -1216,6 +1480,7 @@
12161480 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12171481 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12181482 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1483
+ //XYZPanel.setName("XYZ");
12191484
12201485 /*
12211486 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1253,11 +1518,23 @@
12531518 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12541519 //tmp.setName("Edit");
12551520 objectPanel.add(materialPanel);
1256
- JPanel north = new JPanel(new BorderLayout());
1257
- north.setName("Edit");
1258
- north.add(ctrlPanel, BorderLayout.NORTH);
1259
- objectPanel.add(north);
1260
- objectPanel.add(infoPanel);
1521
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1522
+// JPanel north = new JPanel(new BorderLayout());
1523
+// north.setName("Edit");
1524
+// north.add(ctrlPanel, BorderLayout.NORTH);
1525
+// objectPanel.add(north);
1526
+ objectPanel.add(editPanel);
1527
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1528
+
1529
+ //if (Globals.ADVANCED)
1530
+ objectPanel.add(infoPanel);
1531
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1532
+
1533
+ objectPanel.add(XYZPanel);
1534
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1535
+
1536
+ objectPanel.add(toolboxPanel);
1537
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
12611538
12621539 /*
12631540 aConstraints.gridx = 0;
....@@ -1266,7 +1543,7 @@
12661543 aConstraints.gridy += 1;
12671544 aConstraints.gridwidth = 1;
12681545 mainPanel.add(objectPanel, aConstraints);
1269
- */
1546
+ */
12701547
12711548 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12721549 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1278,14 +1555,12 @@
12781555 scrollpane.addMouseWheelListener(this); // Default not fast enough
12791556
12801557 /*JTabbedPane*/ scenePanel = new cGridBag();
1281
- scenePanel.preferredWidth = 7;
1558
+ scenePanel.preferredWidth = 5;
12821559
12831560 JTabbedPane tabbedPane = new JTabbedPane();
12841561 tabbedPane.add(scrollpane);
12851562
1286
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1287
-
1288
- optionsPanel = new cGridBag().setVertical(true);
1563
+ optionsPanel = new cGridBag().setVertical(false);
12891564
12901565 optionsPanel.setName("Options");
12911566
....@@ -1293,6 +1568,8 @@
12931568
12941569 tabbedPane.add(optionsPanel);
12951570
1571
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1572
+
12961573 scenePanel.add(tabbedPane);
12971574
12981575 /*
....@@ -1356,7 +1633,7 @@
13561633 bigThree = new cGridBag();
13571634 bigThree.addComponent(scenePanel);
13581635 bigThree.addComponent(centralPanel);
1359
- bigThree.addComponent(XYZPanel);
1636
+ //bigThree.addComponent(XYZPanel);
13601637
13611638 // // SIDE EFFECT!!!
13621639 // aConstraints.gridx = 0;
....@@ -1365,9 +1642,9 @@
13651642 // aConstraints.gridheight = 1;
13661643
13671644 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1368
- framePanel.setContinuousLayout(true);
1369
- framePanel.setOneTouchExpandable(true);
1370
- framePanel.setDividerLocation(0.8);
1645
+ framePanel.setContinuousLayout(false);
1646
+ framePanel.setOneTouchExpandable(false);
1647
+ //.setDividerLocation(0.8);
13711648 //framePanel.setDividerSize(15);
13721649 //framePanel.setResizeWeight(0.15);
13731650 framePanel.setName("Frame");
....@@ -1384,10 +1661,15 @@
13841661
13851662 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13861663
1387
- frame.setSize(1024, 768);
1388
- frame.show();
1389
-
1664
+ frame.setSize(1280, 860);
1665
+
1666
+ cameraView.requestFocusInWindow();
1667
+
13901668 gridPanel.setDividerLocation(1.0);
1669
+
1670
+ frame.validate();
1671
+
1672
+ frame.setVisible(true);
13911673
13921674 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13931675 frame.addWindowListener(new WindowAdapter()
....@@ -1415,7 +1697,7 @@
14151697 ctrlPanel.removeAll();
14161698 }
14171699
1418
- void SetupMaterial(cGridBag ctrlPanel)
1700
+ void SetupMaterial(cGridBag panel)
14191701 {
14201702 /*
14211703 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
....@@ -1424,18 +1706,26 @@
14241706
14251707 cGridBag editBar = new cGridBag().setVertical(false);
14261708
1427
- editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints);
1709
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
1710
+ createMaterialButton.setToolTipText("Create material");
14281711
14291712 /*
14301713 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14311714 */
14321715
1433
- editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints);
1434
- editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints);
1435
- editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1436
- editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1716
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
1717
+ clearMaterialButton.setToolTipText("Clear material");
1718
+
1719
+ if (Globals.ADVANCED)
1720
+ {
1721
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
1722
+ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
1723
+ editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
1724
+ }
14371725
1438
- ctrlPanel.add(editBar);
1726
+ editBar.preferredHeight = 15;
1727
+
1728
+ panel.add(editBar);
14391729
14401730 /**/
14411731 //aConstraints.weighty = 0;
....@@ -1445,17 +1735,13 @@
14451735 //aConstraints.gridx += 1;
14461736 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14471737
1448
- JPanel colorPanel = new JPanel(new BorderLayout());
1449
- colorPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1450
-
14511738 cGridBag colorSection = new cGridBag().setVertical(true);
1452
-
1453
- colorPanel.add(colorSection);
14541739
14551740 cGridBag color = new cGridBag();
14561741 color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
14571742 colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
14581743 color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1744
+ //colorField.preferredWidth = 200;
14591745 colorSection.add(color);
14601746
14611747 cGridBag modulation = new cGridBag();
....@@ -1470,34 +1756,13 @@
14701756 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
14711757 colorSection.add(texture);
14721758
1473
- cGridBag anisoU = new cGridBag();
1474
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1475
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1476
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1477
- colorSection.add(anisoU);
1478
-
1479
- cGridBag anisoV = new cGridBag();
1480
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1481
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1482
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1483
- colorSection.add(anisoV);
1484
-
1485
- cGridBag shadowbias = new cGridBag();
1486
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1487
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1488
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1489
- colorSection.add(shadowbias);
1490
-
1491
- ctrlPanel.add(colorPanel);
1759
+ panel.add(new JSeparator());
1760
+
1761
+ panel.add(colorSection);
14921762
14931763 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14941764
1495
- JPanel diffusePanel = new JPanel(new BorderLayout());
1496
- diffusePanel.setBorder(BorderFactory.createLineBorder(Color.black));
1497
-
14981765 cGridBag diffuseSection = new cGridBag().setVertical(true);
1499
-
1500
- diffusePanel.add(diffuseSection);
15011766
15021767 cGridBag diffuse = new cGridBag();
15031768 diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints);
....@@ -1541,16 +1806,19 @@
15411806 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15421807 diffuseSection.add(fakedepth);
15431808
1544
- ctrlPanel.add(diffusePanel);
1809
+ cGridBag shadowbias = new cGridBag();
1810
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1811
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1812
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1813
+ diffuseSection.add(shadowbias);
1814
+
1815
+ panel.add(new JSeparator());
1816
+
1817
+ panel.add(diffuseSection);
15451818
15461819 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15471820
1548
- JPanel specularPanel = new JPanel(new BorderLayout());
1549
- specularPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1550
-
15511821 cGridBag specularSection = new cGridBag().setVertical(true);
1552
-
1553
- specularPanel.add(specularSection);
15541822
15551823 cGridBag specular = new cGridBag();
15561824 specular.add(specularLabel = new JLabel("Specular")); // , aConstraints);
....@@ -1582,7 +1850,7 @@
15821850 velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15831851 specularSection.add(velvet);
15841852
1585
- shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1);
1853
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
15861854 //Return();
15871855 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
15881856 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
....@@ -1594,52 +1862,58 @@
15941862 // aConstraints.gridy += 1;
15951863 // aConstraints.gridwidth = 1;
15961864
1865
+ cGridBag anisoU = new cGridBag();
1866
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1867
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1868
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1869
+ specularSection.add(anisoU);
15971870
1598
- ctrlPanel.add(specularPanel);
1871
+ cGridBag anisoV = new cGridBag();
1872
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1873
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1874
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1875
+ specularSection.add(anisoV);
1876
+
1877
+
1878
+ panel.add(new JSeparator());
1879
+
1880
+ panel.add(specularSection);
15991881
16001882 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16011883
1602
- JPanel globalPanel = new JPanel(new BorderLayout());
1603
- globalPanel.setBorder(BorderFactory.createLineBorder(Color.black));
1604
-
1605
- cGridBag globalSection = new cGridBag().setVertical(true);
1606
-
1607
- globalPanel.add(globalSection);
1884
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16081885
16091886 cGridBag camera = new cGridBag();
16101887 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16111888 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16121889 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
- globalSection.add(camera);
1890
+ colorSection.add(camera);
16141891
16151892 cGridBag ambient = new cGridBag();
16161893 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16171894 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16181895 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
- globalSection.add(ambient);
1896
+ colorSection.add(ambient);
16201897
16211898 cGridBag backlit = new cGridBag();
16221899 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
16231900 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16241901 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1625
- globalSection.add(backlit);
1902
+ colorSection.add(backlit);
16261903
16271904 cGridBag opacity = new cGridBag();
16281905 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
16291906 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16301907 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1631
- globalSection.add(opacity);
1908
+ colorSection.add(opacity);
16321909
1633
- ctrlPanel.add(globalPanel);
1910
+ //panel.add(new JSeparator());
1911
+
1912
+ //panel.add(globalSection);
16341913
16351914 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16361915
1637
- JPanel texturePanel = new JPanel(new BorderLayout());
1638
- texturePanel.setBorder(BorderFactory.createLineBorder(Color.black));
1639
-
16401916 cGridBag textureSection = new cGridBag().setVertical(true);
1641
-
1642
- texturePanel.add(textureSection);
16431917
16441918 cGridBag bump = new cGridBag();
16451919 bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints);
....@@ -1677,7 +1951,9 @@
16771951 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
16781952 textureSection.add(opacityPower);
16791953
1680
- ctrlPanel.add(texturePanel);
1954
+ panel.add(new JSeparator());
1955
+
1956
+ panel.add(textureSection);
16811957
16821958 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16831959
....@@ -1714,12 +1990,15 @@
17141990 opacityPowerField.addChangeListener(this);
17151991 /**/
17161992
1717
- resetSlidersButton.addActionListener(this);
17181993 clearMaterialButton.addActionListener(this);
17191994 createMaterialButton.addActionListener(this);
1720
-
1721
- propagateToggle.addItemListener(this);
1722
- multiplyToggle.addItemListener(this);
1995
+
1996
+ if (Globals.ADVANCED)
1997
+ {
1998
+ resetSlidersButton.addActionListener(this);
1999
+ propagateToggle.addItemListener(this);
2000
+ multiplyToggle.addItemListener(this);
2001
+ }
17232002 }
17242003
17252004 void DropFile(java.io.File[] files, boolean textures)
....@@ -1737,8 +2016,9 @@
17372016 // 3D models
17382017 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
17392018 {
1740
- lastConverter = new com.jmex.model.converters.MaxToJme();
1741
- LoadFile(filename, lastConverter);
2019
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2020
+ //LoadFile(filename, lastConverter);
2021
+ LoadObjFile(filename); // New 3ds loader
17422022 continue;
17432023 }
17442024 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1890,7 +2170,7 @@
18902170
18912171 //? flashIt = false;
18922172 CameraPane pane = (CameraPane) cameraView;
1893
- pane.clickStart(location.x, location.y, 0);
2173
+ pane.clickStart(location.x, location.y, 0, 0);
18942174 pane.clickEnd(location.x, location.y, 0, true);
18952175
18962176 if (group.selection.size() == 1)
....@@ -1939,6 +2219,7 @@
19392219 e2.printStackTrace();
19402220 }
19412221 }
2222
+
19422223 LoadJMEThread loadThread;
19432224
19442225 class LoadJMEThread extends Thread
....@@ -1996,6 +2277,7 @@
19962277 //LoadFile0(filename, converter);
19972278 }
19982279 }
2280
+
19992281 LoadOBJThread loadObjThread;
20002282
20012283 class LoadOBJThread extends Thread
....@@ -2074,19 +2356,19 @@
20742356
20752357 void LoadObjFile(String fullname)
20762358 {
2077
- /*
2359
+ System.out.println("Loading " + fullname);
2360
+ /**/
20782361 //lastFilename = fullname;
20792362 if(loadObjThread == null)
20802363 {
2081
- loadObjThread = new LoadOBJThread();
2082
- loadObjThread.start();
2364
+ loadObjThread = new LoadOBJThread();
2365
+ loadObjThread.start();
20832366 }
20842367
20852368 loadObjThread.add(fullname);
2086
- */
2369
+ /**/
20872370
2088
- System.out.println("Loading " + fullname);
2089
- makeSomething(new FileObject(fullname, true), true);
2371
+ //makeSomething(new FileObject(fullname, true), true);
20902372 }
20912373
20922374 void LoadGFDFile(String fullname)
....@@ -2347,11 +2629,11 @@
23472629
23482630 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23492631 {
2350
- if (GrafreeD.standAlone)
2632
+ if (Grafreed.standAlone)
23512633 {
23522634 /**/
23532635 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2354
- browser.show();
2636
+ browser.setVisible(true);
23552637 String filename = browser.getFile();
23562638 if (filename != null && filename.length() > 0)
23572639 {
....@@ -2462,6 +2744,7 @@
24622744 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
24632745 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
24642746 }
2747
+
24652748 //cJME.count++;
24662749 //cJME.count %= 12;
24672750 if (gc)
....@@ -2496,6 +2779,7 @@
24962779 }
24972780 if (input == null)
24982781 {
2782
+ new Exception().printStackTrace();
24992783 System.exit(0);
25002784 }
25012785
....@@ -2644,6 +2928,7 @@
26442928 }
26452929 }
26462930 }
2931
+
26472932 cFileSystemPane FSPane;
26482933
26492934 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2697,11 +2982,14 @@
26972982 }
26982983 }
26992984 }
2985
+
27002986 freezematerial = false;
27012987 }
27022988
27032989 void SetMaterial(Object3D object)
27042990 {
2991
+ latestObject = object;
2992
+
27052993 cMaterial mat = object.material;
27062994
27072995 if (mat == null)
....@@ -2710,7 +2998,8 @@
27102998 return;
27112999 }
27123000
2713
- multiplyToggle.setSelected(mat.multiply);
3001
+ if (multiplyToggle != null)
3002
+ multiplyToggle.setSelected(mat.multiply);
27143003
27153004 assert (object.projectedVertices != null);
27163005
....@@ -2812,12 +3101,17 @@
28123101 // }
28133102
28143103 /**/
2815
- if (deselect)
3104
+ if (deselect || child == null)
28163105 {
28173106 //group.deselectAll();
28183107 //freeze = true;
28193108 GetTree().clearSelection();
28203109 //freeze = false;
3110
+
3111
+ if (child == null)
3112
+ {
3113
+ return;
3114
+ }
28213115 }
28223116
28233117 //group.addSelectee(child);
....@@ -2886,7 +3180,7 @@
28863180 cameraView.ToggleDL();
28873181 cameraView.repaint();
28883182 return;
2889
- } else if (event.getSource() == toggleTextureItem)
3183
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
28903184 {
28913185 cameraView.ToggleTexture();
28923186 // june 2013 copy.HardTouch();
....@@ -2925,9 +3219,9 @@
29253219 frame.validate();
29263220
29273221 return;
2928
- } else if (event.getSource() == toggleRandomItem)
3222
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29293223 {
2930
- cameraView.ToggleRandom();
3224
+ cameraView.ToggleSwitch();
29313225 cameraView.repaint();
29323226 return;
29333227 } else if (event.getSource() == toggleHandleItem)
....@@ -2956,6 +3250,10 @@
29563250 {
29573251 copy.live ^= true;
29583252 return;
3253
+ } else if (event.getSource() == selectCB)
3254
+ {
3255
+ copy.dontselect ^= true;
3256
+ return;
29593257 } else if (event.getSource() == hideCB)
29603258 {
29613259 copy.hide ^= true;
....@@ -2970,6 +3268,7 @@
29703268 if (event.getSource() == randomCB)
29713269 {
29723270 copy.random ^= true;
3271
+ objEditor.refreshContents();
29733272 return;
29743273 }
29753274 if (event.getSource() == speedupCB)
....@@ -2993,8 +3292,9 @@
29933292
29943293 public void actionPerformed(ActionEvent event)
29953294 {
3295
+ Object source = event.getSource();
29963296 // SCRIPT DIALOG
2997
- if (event.getSource() == okbutton)
3297
+ if (source == okbutton)
29983298 {
29993299 textpanel.setVisible(false);
30003300 textpanel.remove(textarea);
....@@ -3006,7 +3306,7 @@
30063306 textarea = null;
30073307 textpanel = null;
30083308 }
3009
- if (event.getSource() == cancelbutton)
3309
+ if (source == cancelbutton)
30103310 {
30113311 textpanel.setVisible(false);
30123312 textpanel.remove(textarea);
....@@ -3018,50 +3318,50 @@
30183318 //applySelf();
30193319 //client.refreshEditWindow();
30203320 //refreshContents();
3021
- if (event.getSource() == nameField)
3321
+ if (source == nameField)
30223322 {
30233323 //System.out.println("ObjEditor " + event);
30243324 applySelf0(true);
30253325 //parent.applySelf();
30263326 objEditor.refreshContents();
3027
- } else if (event.getSource() == resetButton)
3327
+ } else if (source == resetButton)
30283328 {
30293329 CameraPane.fullreset = true;
30303330 copy.Reset(); // ResetMeshes();
30313331 copy.Touch();
30323332 objEditor.refreshContents();
3033
- } else if (event.getSource() == stepItem)
3333
+ } else if (source == stepItem)
30343334 {
30353335 //cameraView.ONESTEP = true;
30363336 Globals.ONESTEP = true;
30373337 cameraView.repaint();
30383338 return;
3039
- } else if (event.getSource() == stepButton)
3339
+ } else if (source == stepButton)
30403340 {
30413341 copy.Step();
30423342 copy.Touch();
30433343 objEditor.refreshContents();
3044
- } else if (event.getSource() == slowerButton)
3344
+ } else if (source == slowerButton)
30453345 {
30463346 copy.Slower();
30473347 copy.Touch();
30483348 objEditor.refreshContents();
3049
- } else if (event.getSource() == fasterButton)
3349
+ } else if (source == fasterButton)
30503350 {
30513351 copy.Faster();
30523352 copy.Touch();
30533353 objEditor.refreshContents();
3054
- } else if (event.getSource() == remarkButton)
3354
+ } else if (source == remarkButton)
30553355 {
30563356 copy.Remark();
30573357 copy.Touch();
30583358 objEditor.refreshContents();
3059
- } else if (event.getSource() == stepAllButton)
3359
+ } else if (source == stepAllButton)
30603360 {
30613361 copy.StepAll();
30623362 copy.Touch();
30633363 objEditor.refreshContents();
3064
- } else if (event.getSource() == resetAllButton)
3364
+ } else if (source == resetAllButton)
30653365 {
30663366 //CameraPane.fullreset = true;
30673367 copy.ResetAll(); // ResetMeshes();
....@@ -3094,53 +3394,79 @@
30943394 // Close();
30953395 // }
30963396 // else
3097
- if (event.getSource() == resetSlidersButton)
3397
+ if (source == resetSlidersButton)
30983398 {
30993399 ResetSliders();
3100
- } else if (event.getSource() == clearMaterialButton)
3400
+ } else if (source == clearMaterialButton)
31013401 {
31023402 ClearMaterial();
3103
- } else if (event.getSource() == createMaterialButton)
3403
+ } else if (source == createMaterialButton)
31043404 {
31053405 CreateMaterial();
3106
- } else if (event.getSource() == clearPanelButton)
3406
+ } else if (source == clearPanelButton)
31073407 {
31083408 copy.ClearUI();
31093409 refreshContents(true);
3110
- } /*
3111
- }
3112
-
3113
- public boolean action(Event event, Object arg)
3114
- {
3115
- */ else if (event.getSource() == closeItem)
3410
+ } else if (source == importGFDItem)
3411
+ {
3412
+ ImportGFD();
3413
+ } else
3414
+ if (source == importVRMLX3DItem)
3415
+ {
3416
+ ImportVRMLX3D();
3417
+ } else
3418
+ if (source == import3DSItem)
3419
+ {
3420
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3421
+ } else
3422
+ if (source == importOBJItem)
3423
+ {
3424
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3425
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3426
+ browser.setVisible(true);
3427
+ String filename = browser.getFile();
3428
+ if (filename != null && filename.length() > 0)
3429
+ {
3430
+ String fullname = browser.getDirectory() + filename;
3431
+ makeSomething(ReadOBJ(fullname), true);
3432
+ }
3433
+ } else
3434
+ if (source == closeItem)
31163435 {
31173436 Close();
31183437 //return true;
3119
- } else if (event.getSource() == loadItem)
3438
+ } else if (source == openItem)
31203439 {
3121
- load();
3440
+ Open();
31223441 //return true;
3123
- } else if (event.getSource() == saveItem)
3442
+ } else if (source == newItem)
3443
+ {
3444
+ New();
3445
+ } else if (source == saveItem)
31243446 {
31253447 save();
31263448 //return true;
3127
- } else if (event.getSource() == saveAsItem)
3449
+ } else if (source == saveAsItem)
31283450 {
31293451 saveAs();
31303452 //return true;
3131
- } else if (event.getSource() == reexportItem)
3453
+ } else if (source == reexportItem)
31323454 {
31333455 reexport();
31343456 //return true;
3135
- } else if (event.getSource() == exportAsItem)
3457
+ } else if (source == exportAsItem)
31363458 {
31373459 export();
31383460 //return true;
3139
- } else if (event.getSource() == povItem)
3461
+ } else if (source == povItem)
31403462 {
31413463 generatePOV();
31423464 //return true;
3143
- } else if (event.getSource() == zBufferItem)
3465
+ } else if (event.getSource() == archiveItem)
3466
+ {
3467
+ cTools.Archive(frame);
3468
+ return;
3469
+ } else if (source == zBufferItem)
31443470 {
31453471 try
31463472 {
....@@ -3162,21 +3488,8 @@
31623488 cameraView.repaint();
31633489 //return true;
31643490 }
3165
- */ else if (event.getSource() == editCameraItem)
3166
- {
3167
- cameraView.ProtectCamera();
3168
- cameraView.repaint();
3169
- return;
3170
- } else if (event.getSource() == revertCameraItem)
3171
- {
3172
- cameraView.RevertCamera();
3173
- cameraView.repaint();
3174
- return;
3175
-// } else if (event.getSource() == textureButton)
3176
-// {
3177
-// return; // true;
3178
- } else // combos...
3179
- if (event.getSource() == texresMenu)
3491
+ */ else // combos...
3492
+ if (source == texresMenu)
31803493 {
31813494 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
31823495 copy.texres = texresMenu.getSelectedIndex();
....@@ -3188,12 +3501,409 @@
31883501 }
31893502 }
31903503
3504
+ void New()
3505
+ {
3506
+ while (copy.Size() > 1)
3507
+ {
3508
+ copy.remove(1);
3509
+ }
3510
+
3511
+ ResetModel();
3512
+ objEditor.refreshContents();
3513
+ }
3514
+
3515
+ static public byte[] Compress(Object3D o)
3516
+ {
3517
+ try
3518
+ {
3519
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3520
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3521
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
3522
+
3523
+ Object3D parent = o.parent;
3524
+ o.parent = null;
3525
+
3526
+ out.writeObject(o);
3527
+
3528
+ o.parent = parent;
3529
+
3530
+ out.flush();
3531
+
3532
+ baos //zstream
3533
+ .close();
3534
+ out.close();
3535
+
3536
+ byte[] bytes = baos.toByteArray();
3537
+
3538
+ System.out.println("save #bytes = " + bytes.length);
3539
+ return bytes;
3540
+ } catch (Exception e)
3541
+ {
3542
+ System.err.println(e);
3543
+ return null;
3544
+ }
3545
+ }
3546
+
3547
+ static public Object Uncompress(byte[] bytes)
3548
+ {
3549
+ System.out.println("restore #bytes = " + bytes.length);
3550
+ try
3551
+ {
3552
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3553
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3554
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
3555
+ Object obj = in.readObject();
3556
+
3557
+ bais //istream
3558
+ .close();
3559
+ in.close();
3560
+
3561
+ return obj;
3562
+ } catch (Exception e)
3563
+ {
3564
+ System.err.println(e);
3565
+ return null;
3566
+ }
3567
+ }
3568
+
3569
+ static public Object clone(Object o)
3570
+ {
3571
+ try
3572
+ {
3573
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3574
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3575
+
3576
+ out.writeObject(o);
3577
+
3578
+ out.flush();
3579
+ out.close();
3580
+
3581
+ byte[] bytes = baos.toByteArray();
3582
+
3583
+ System.out.println("clone = " + bytes.length);
3584
+
3585
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3586
+ ObjectInputStream in = new ObjectInputStream(bais);
3587
+ Object obj = in.readObject();
3588
+ in.close();
3589
+
3590
+ return obj;
3591
+ } catch (Exception e)
3592
+ {
3593
+ System.err.println(e);
3594
+ return null;
3595
+ }
3596
+ }
3597
+
3598
+ cRadio GetCurrentTab()
3599
+ {
3600
+ cRadio ab;
3601
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3602
+ {
3603
+ ab = (cRadio)e.nextElement();
3604
+ if(ab.GetObject() == copy)
3605
+ {
3606
+ return ab;
3607
+ }
3608
+ }
3609
+
3610
+ return null;
3611
+ }
3612
+
3613
+
3614
+ public void Save()
3615
+ {
3616
+ //Save(true);
3617
+ Replace();
3618
+ }
3619
+
3620
+ private boolean Equal(byte[] compress, byte[] name)
3621
+ {
3622
+ if (compress.length != name.length)
3623
+ {
3624
+ return false;
3625
+ }
3626
+
3627
+ for (int i=compress.length; --i>=0;)
3628
+ {
3629
+ if (compress[i] != name[i])
3630
+ return false;
3631
+ }
3632
+
3633
+ return true;
3634
+ }
3635
+
3636
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3637
+
3638
+ public boolean Save(boolean user)
3639
+ {
3640
+ System.err.println("Save");
3641
+
3642
+ cRadio tab = GetCurrentTab();
3643
+
3644
+ byte[] compress = CompressCopy();
3645
+
3646
+ boolean thesame = false;
3647
+
3648
+ // Quick heuristic using length. Works only when stream is compressed.
3649
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3650
+ {
3651
+ thesame = true;
3652
+ }
3653
+
3654
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3655
+ if (!thesame)
3656
+ {
3657
+ //tab.user[tab.versionindex] = user;
3658
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3659
+
3660
+ copy.versions[++copy.versionindex] = compress;
3661
+
3662
+ // if (increment)
3663
+ // tab.versionindex++;
3664
+ }
3665
+
3666
+ //copy.RestoreBigData(versiontable);
3667
+
3668
+ //assert(hashtable.isEmpty());
3669
+
3670
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3671
+ {
3672
+ //tab.user[i] = false;
3673
+ copy.versions[i] = null;
3674
+ }
3675
+
3676
+ SetUndoStates();
3677
+
3678
+ // test save
3679
+ if (false)
3680
+ {
3681
+ try
3682
+ {
3683
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
3684
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3685
+
3686
+ p.writeObject(copy);
3687
+
3688
+ p.flush();
3689
+
3690
+ ostream.close();
3691
+ } catch (Exception e)
3692
+ {
3693
+ e.printStackTrace();
3694
+ }
3695
+ }
3696
+
3697
+ return !thesame;
3698
+ }
3699
+
3700
+ void CopyChanged(Object3D obj)
3701
+ {
3702
+ SetUndoStates();
3703
+
3704
+ boolean temp = CameraPane.SWITCH;
3705
+ CameraPane.SWITCH = false;
3706
+
3707
+ copy.ExtractBigData(versiontable);
3708
+
3709
+ copy.clear();
3710
+
3711
+ for (int i=0; i<obj.Size(); i++)
3712
+ {
3713
+ copy.add(obj.get(i));
3714
+ }
3715
+
3716
+ copy.RestoreBigData(versiontable);
3717
+
3718
+ CameraPane.SWITCH = temp;
3719
+
3720
+ //assert(hashtable.isEmpty());
3721
+
3722
+ copy.Touch();
3723
+
3724
+ ResetModel();
3725
+ copy.HardTouch(); // recompile?
3726
+
3727
+ cRadio ab;
3728
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3729
+ {
3730
+ ab = (cRadio)e.nextElement();
3731
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3732
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3733
+ if (test != null)
3734
+ {
3735
+ test.editWindow = ab.object.editWindow;
3736
+ ab.object = test;
3737
+ }
3738
+ }
3739
+
3740
+ refreshContents();
3741
+ }
3742
+
3743
+ cButton undoButton;
3744
+ cButton restoreButton;
3745
+ cButton replaceButton;
3746
+ cButton redoButton;
3747
+
3748
+ boolean muteSlider;
3749
+
3750
+ int VersionCount()
3751
+ {
3752
+ int count = 0;
3753
+
3754
+ for (int i = copy.versions.length; --i >= 0;)
3755
+ {
3756
+ if (copy.versions[i] != null)
3757
+ count++;
3758
+ }
3759
+
3760
+ return count;
3761
+ }
3762
+
3763
+ void SetUndoStates()
3764
+ {
3765
+ cRadio tab = GetCurrentTab();
3766
+
3767
+ restoreButton.setEnabled(copy.versionindex != -1);
3768
+ replaceButton.setEnabled(copy.versionindex != -1);
3769
+
3770
+ undoButton.setEnabled(copy.versionindex > 0);
3771
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3772
+
3773
+ muteSlider = true;
3774
+ versionSlider.setMaximum(VersionCount() - 1);
3775
+ versionSlider.setInteger(copy.versionindex);
3776
+ muteSlider = false;
3777
+ }
3778
+
3779
+ public boolean Undo()
3780
+ {
3781
+ // Option?
3782
+ Replace();
3783
+
3784
+ System.err.println("Undo");
3785
+
3786
+ cRadio tab = GetCurrentTab();
3787
+
3788
+ if (copy.versionindex == 0)
3789
+ {
3790
+ java.awt.Toolkit.getDefaultToolkit().beep();
3791
+ return false;
3792
+ }
3793
+
3794
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3795
+// {
3796
+// if (Save(false))
3797
+// tab.versionindex -= 1;
3798
+// else
3799
+// {
3800
+// if (tab.versionindex <= 0)
3801
+// return false;
3802
+// else
3803
+// tab.versionindex -= 1;
3804
+// }
3805
+// }
3806
+
3807
+ copy.versionindex -= 1;
3808
+
3809
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3810
+
3811
+ return true;
3812
+ }
3813
+
3814
+ public boolean Restore()
3815
+ {
3816
+ System.err.println("Restore");
3817
+
3818
+ cRadio tab = GetCurrentTab();
3819
+
3820
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3821
+ {
3822
+ java.awt.Toolkit.getDefaultToolkit().beep();
3823
+ return false;
3824
+ }
3825
+
3826
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3827
+
3828
+ return true;
3829
+ }
3830
+
3831
+ public boolean Replace()
3832
+ {
3833
+ System.err.println("Replace");
3834
+
3835
+ cRadio tab = GetCurrentTab();
3836
+
3837
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3838
+ {
3839
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3840
+ return false;
3841
+ }
3842
+
3843
+ copy.versions[copy.versionindex] = CompressCopy();
3844
+
3845
+ return true;
3846
+ }
3847
+
3848
+ public void Redo()
3849
+ {
3850
+ // Option?
3851
+ Replace();
3852
+
3853
+ cRadio tab = GetCurrentTab();
3854
+
3855
+ if (copy.versions[copy.versionindex + 1] == null)
3856
+ {
3857
+ java.awt.Toolkit.getDefaultToolkit().beep();
3858
+ return;
3859
+ }
3860
+
3861
+ copy.versionindex += 1;
3862
+
3863
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3864
+
3865
+ //if (!tab.user[tab.versionindex])
3866
+ // tab.graphs[tab.versionindex] = null;
3867
+ }
3868
+
3869
+ void ImportGFD()
3870
+ {
3871
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3872
+ browser.show();
3873
+ String filename = browser.getFile();
3874
+ if (filename != null && filename.length() > 0)
3875
+ {
3876
+ String fullname = browser.getDirectory() + filename;
3877
+
3878
+ //Object3D readobj =
3879
+ objEditor.ReadGFD(fullname, objEditor);
3880
+ //makeSomething(readobj);
3881
+ }
3882
+ }
3883
+
3884
+ void ImportVRMLX3D()
3885
+ {
3886
+ if (Grafreed.standAlone)
3887
+ {
3888
+ /**/
3889
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3890
+ browser.show();
3891
+ String filename = browser.getFile();
3892
+ if (filename != null && filename.length() > 0)
3893
+ {
3894
+ String fullname = browser.getDirectory() + filename;
3895
+ LoadVRMLX3D(fullname);
3896
+ }
3897
+ /**/
3898
+ }
3899
+ }
3900
+
31913901 void ToggleAnimation()
31923902 {
31933903 if (!Globals.ANIMATION)
31943904 {
31953905 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3196
- browser.show();
3906
+ browser.setVisible(true);
31973907 String filename = browser.getFile();
31983908 if (filename != null && filename.length() > 0)
31993909 {
....@@ -3203,8 +3913,8 @@
32033913
32043914 Globals.ANIMATION ^= true;
32053915
3206
- GrafreeD.wav.cursor = 0;
3207
- GrafreeD.wav.loop = 0;
3916
+ Grafreed.wav.cursor = 0;
3917
+ Grafreed.wav.loop = 0;
32083918 }
32093919 } else
32103920 {
....@@ -3254,7 +3964,7 @@
32543964 void CreateMaterial()
32553965 {
32563966 //copy.ClearMaterial(); // PATCH
3257
- copy.CreateMaterialS(multiplyToggle.isSelected());
3967
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
32583968 if (copy.selection.size() > 0)
32593969 //SetMaterial(copy);
32603970 {
....@@ -3305,7 +4015,7 @@
33054015 assert false;
33064016 }
33074017
3308
- void EditSelection()
4018
+ void EditSelection(boolean newWindow)
33094019 {
33104020 }
33114021
....@@ -3313,11 +4023,11 @@
33134023 {
33144024 copy.ResetBlockLoop(); // temporary problem
33154025
3316
- boolean random = CameraPane.RANDOM;
3317
- CameraPane.RANDOM = false; // parse everything
4026
+ boolean random = CameraPane.SWITCH;
4027
+ CameraPane.SWITCH = false; // parse everything
33184028 copy.ResetDisplayList();
33194029 copy.HardTouch();
3320
- CameraPane.RANDOM = random;
4030
+ CameraPane.SWITCH = random;
33214031 }
33224032
33234033 // public void applySelf()
....@@ -3391,6 +4101,36 @@
33914101 {
33924102 //System.out.println("Propagate = " + propagate);
33934103 copy.UpdateMaterial(anchor, current, propagate);
4104
+
4105
+ if (copy.material != null)
4106
+ {
4107
+ cMaterial mat = copy.material;
4108
+
4109
+ colorField.SetToolTipValue((mat.color));
4110
+ modulationField.SetToolTipValue((mat.modulation));
4111
+ metalnessField.SetToolTipValue((mat.metalness));
4112
+ diffuseField.SetToolTipValue((mat.diffuse));
4113
+ specularField.SetToolTipValue((mat.specular));
4114
+ shininessField.SetToolTipValue((mat.shininess));
4115
+ shiftField.SetToolTipValue((mat.shift));
4116
+ ambientField.SetToolTipValue((mat.ambient));
4117
+ lightareaField.SetToolTipValue((mat.lightarea));
4118
+ diffusenessField.SetToolTipValue((mat.factor));
4119
+ velvetField.SetToolTipValue((mat.velvet));
4120
+ sheenField.SetToolTipValue((mat.sheen));
4121
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4122
+ backlitField.SetToolTipValue((mat.bump));
4123
+ anisoField.SetToolTipValue((mat.aniso));
4124
+ anisoVField.SetToolTipValue((mat.anisoV));
4125
+ cameraField.SetToolTipValue((mat.cameralight));
4126
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4127
+ shadowField.SetToolTipValue((mat.shadow));
4128
+ textureField.SetToolTipValue((mat.texture));
4129
+ opacityField.SetToolTipValue((mat.opacity));
4130
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4131
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
4132
+ }
4133
+
33944134 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
33954135 {
33964136 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3419,9 +4159,25 @@
34194159 //copy.Touch();
34204160 }
34214161
4162
+ cNumberSlider versionSlider;
4163
+
34224164 public void stateChanged(ChangeEvent e)
34234165 {
34244166 // assert(false);
4167
+ if (e.getSource() == versionSlider)
4168
+ {
4169
+ if (muteSlider)
4170
+ return;
4171
+
4172
+ int version = versionSlider.getInteger();
4173
+
4174
+ if (copy.versions[version] != null)
4175
+ {
4176
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4177
+ }
4178
+
4179
+ return;
4180
+ }
34254181
34264182 if (freezematerial)
34274183 {
....@@ -3435,6 +4191,7 @@
34354191 || e.getSource() == apertureField
34364192 || e.getSource() == shadowblurField)
34374193 {
4194
+ new Exception().printStackTrace();
34384195 System.exit(0);
34394196 cameraView.options1[0] = (float) focusField.getFloat() * 10;
34404197 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3505,7 +4262,7 @@
35054262 }
35064263
35074264 if (normalpushField != null)
3508
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4265
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35094266 }
35104267
35114268 void SnapObject()
....@@ -3769,6 +4526,8 @@
37694526
37704527 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
37714528 {
4529
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4530
+ Save();
37724531 //Tween.set(thing, 0).target(1).start(tweenManager);
37734532 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
37744533 // if (thing instanceof GenericJointDemo)
....@@ -3855,6 +4614,12 @@
38554614 {
38564615 ResetModel();
38574616 Select(thing.GetTreePath(), true, false); // unselect... false);
4617
+
4618
+ if (thing.Size() == 0)
4619
+ {
4620
+ //EditSelection(false);
4621
+ }
4622
+
38584623 refreshContents();
38594624 }
38604625
....@@ -3972,6 +4737,7 @@
39724737 }
39734738 }
39744739 }
4740
+
39754741 LoadGFDThread loadGFDThread;
39764742
39774743 void ReadGFD(String fullname, iCallBack cb)
....@@ -3991,8 +4757,10 @@
39914757
39924758 try
39934759 {
4760
+ // Try compressed version first.
39944761 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
3995
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4762
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4763
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
39964764
39974765 readobj = (Object3D) p.readObject();
39984766 istream.close();
....@@ -4000,7 +4768,20 @@
40004768 readobj.ResetDisplayList();
40014769 } catch (Exception e)
40024770 {
4003
- e.printStackTrace();
4771
+ //e.printStackTrace();
4772
+ try
4773
+ {
4774
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4775
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4776
+
4777
+ readobj = (Object3D) p.readObject();
4778
+ istream.close();
4779
+
4780
+ readobj.ResetDisplayList();
4781
+ } catch (Exception e2)
4782
+ {
4783
+ e2.printStackTrace();
4784
+ }
40044785 }
40054786 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40064787 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4046,6 +4827,12 @@
40464827
40474828 void LoadIt(Object obj)
40484829 {
4830
+ if (obj == null)
4831
+ {
4832
+ // Invalid file
4833
+ return;
4834
+ }
4835
+
40494836 System.out.println("Loaded " + obj);
40504837 //new Exception().printStackTrace();
40514838 Object3D readobj = (Object3D) obj;
....@@ -4055,6 +4842,8 @@
40554842
40564843 if (readobj != null)
40574844 {
4845
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4846
+ // Save();
40584847 try
40594848 {
40604849 //readobj.deepCopySelf(copy);
....@@ -4109,15 +4898,26 @@
41094898 c.addChild(csg);
41104899 }
41114900
4901
+ copy.versions = readobj.versions;
4902
+ copy.versionindex = readobj.versionindex;
4903
+
4904
+ if (copy.versions == null)
4905
+ {
4906
+ copy.versions = new byte[100][];
4907
+ copy.versionindex = -1;
4908
+ }
4909
+
4910
+ //? SetUndoStates();
4911
+
41124912 ResetModel();
41134913 copy.HardTouch(); // recompile?
41144914 refreshContents();
41154915 }
41164916 }
41174917
4118
- void load() // throws ClassNotFoundException
4918
+ void Open() // throws ClassNotFoundException
41194919 {
4120
- if (GrafreeD.standAlone)
4920
+ if (Grafreed.standAlone)
41214921 {
41224922 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41234923 browser.show();
....@@ -4204,11 +5004,13 @@
42045004 try
42055005 {
42065006 FileOutputStream ostream = new FileOutputStream(lastname);
4207
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5007
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5008
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42085009
42095010 p.writeObject(copy);
42105011 p.flush();
42115012
5013
+ zstream.close();
42125014 ostream.close();
42135015
42145016 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4218,17 +5020,20 @@
42185020 {
42195021 }
42205022 }
5023
+
42215024 String lastname;
42225025
42235026 void saveAs()
42245027 {
4225
- if (GrafreeD.standAlone)
5028
+ if (Grafreed.standAlone)
42265029 {
42275030 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42285031 browser.setVisible(true);
42295032 String filename = browser.getFile();
42305033 if (filename != null && filename.length() > 0)
42315034 {
5035
+ if (!filename.endsWith(".gfd"))
5036
+ filename += ".gfd";
42325037 lastname = browser.getDirectory() + filename;
42335038 save();
42345039 }
....@@ -4327,13 +5132,13 @@
43275132 try
43285133 {
43295134 FileOutputStream ostream = new FileOutputStream(filename);
4330
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4331
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5135
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5136
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43325137
43335138 Object3D objectparent = obj.parent;
43345139 obj.parent = null;
43355140
4336
- Object3D object = (Object3D) GrafreeD.clone(obj);
5141
+ Object3D object = (Object3D) Grafreed.clone(obj);
43375142
43385143 obj.parent = objectparent;
43395144
....@@ -4345,8 +5150,8 @@
43455150 p.writeObject(object);
43465151 p.flush();
43475152
5153
+ zstream.close();
43485154 ostream.close();
4349
- // zstream.close();
43505155
43515156 // group.selection.get(0).parent = parent;
43525157 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4367,7 +5172,7 @@
43675172 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43685173 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43695174 copy.generatePOV(buffer);
4370
- if (GrafreeD.standAlone)
5175
+ if (Grafreed.standAlone)
43715176 {
43725177 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43735178 browser.show();
....@@ -4393,21 +5198,20 @@
43935198 Object3D client;
43945199 Object3D copy;
43955200 MenuBar menuBar;
4396
- Menu windowMenu;
4397
- MenuItem loadItem;
5201
+ Menu fileMenu;
5202
+ MenuItem newItem;
5203
+ MenuItem openItem;
43985204 MenuItem saveItem;
43995205 MenuItem saveAsItem;
44005206 MenuItem exportAsItem;
44015207 MenuItem reexportItem;
44025208 MenuItem povItem;
44035209 MenuItem closeItem;
4404
- Menu cameraMenu;
5210
+
44055211 CheckboxMenuItem zBufferItem;
44065212 //MenuItem normalLensItem;
4407
- MenuItem editCameraItem;
4408
- MenuItem revertCameraItem;
4409
- CheckboxMenuItem toggleLiveItem;
44105213 MenuItem stepItem;
5214
+ CheckboxMenuItem toggleLiveItem;
44115215 CheckboxMenuItem toggleFullScreenItem;
44125216 CheckboxMenuItem toggleTimelineItem;
44135217 CheckboxMenuItem toggleRenderItem;
....@@ -4416,25 +5220,39 @@
44165220 CheckboxMenuItem toggleFootContactItem;
44175221 CheckboxMenuItem toggleDLItem;
44185222 CheckboxMenuItem toggleTextureItem;
4419
- CheckboxMenuItem toggleRandomItem;
5223
+ CheckboxMenuItem toggleSwitchItem;
44205224 CheckboxMenuItem toggleRootItem;
44215225 CheckboxMenuItem animationItem;
5226
+ MenuItem archiveItem;
44225227 CheckboxMenuItem toggleHandleItem;
44235228 CheckboxMenuItem togglePaintItem;
44245229 JSplitPane mainPanel;
44255230 JScrollPane scrollpane;
5231
+
44265232 JPanel toolbarPanel;
4427
- JPanel treePanel;
5233
+
5234
+ cGridBag treePanel;
5235
+
44285236 JPanel radioPanel;
44295237 ButtonGroup buttonGroup;
4430
- cGridBag ctrlPanel;
5238
+
5239
+ cGridBag toolboxPanel;
44315240 cGridBag materialPanel;
5241
+ cGridBag ctrlPanel;
5242
+
44325243 JScrollPane infoPanel;
5244
+
44335245 cGridBag optionsPanel;
5246
+
44345247 JTabbedPane objectPanel;
5248
+ boolean materialFlushed;
5249
+ Object3D latestObject;
5250
+
44355251 cGridBag XYZPanel;
5252
+
44365253 JSplitPane gridPanel;
44375254 JSplitPane bigPanel;
5255
+
44385256 cGridBag bigThree;
44395257 cGridBag scenePanel;
44405258 cGridBag centralPanel;
....@@ -4549,8 +5367,13 @@
45495367 cNumberSlider fogField;
45505368 JLabel opacityPowerLabel;
45515369 cNumberSlider opacityPowerField;
4552
- JTree jTree;
5370
+ cTree jTree;
45535371 //ObjectUI parent;
45545372
45555373 cNumberSlider normalpushField;
5374
+
5375
+ private MenuItem importGFDItem;
5376
+ private MenuItem importVRMLX3DItem;
5377
+ private MenuItem import3DSItem;
5378
+ private MenuItem importOBJItem;
45565379 }