Normand Briere
2019-07-30 475f8cbdbd96fdbf8f5b216ffebb31a51f25c2f9
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -14,10 +15,15 @@
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
1617
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1721 //import javax.media.opengl.GLCanvas;
1822
1923 import //weka.core.
2024 matrix.Matrix;
25
+
26
+import grafeme.ui.*;
2127
2228 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2329 ActionListener, ChangeListener,
....@@ -33,6 +39,53 @@
3339
3440 GroupEditor callee;
3541 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
+ }
3689
3790 // SCRIPT
3891
....@@ -124,7 +177,7 @@
124177 void keyPressed(int key, int modifiers)
125178 {
126179 System.out.println("KEY PRESSED");
127
- CameraPane.theRenderer.keyPressed(key, modifiers);
180
+ Globals.theRenderer.keyPressed(key, modifiers);
128181 }
129182 */
130183
....@@ -136,34 +189,42 @@
136189 public void closeUI()
137190 {
138191 //new Exception().printStackTrace();
139
- System.out.println("this = " + this);
140
- System.out.println("objEditor = " + objEditor);
192
+// System.out.println("this = " + this);
193
+// System.out.println("objEditor = " + objEditor);
141194 //nameField.removeActionListener(this);
142
- objEditor.ctrlPanel.remove(nameField);
195
+// objEditor.ctrlPanel.remove(nameField);
143196
144
- if (!GroupEditor.allparams)
197
+ objEditor.ctrlPanel.remove(namePanel);
198
+
199
+ if (!allparams)
145200 return;
146201
147
- objEditor.ctrlPanel.remove(liveCB);
148
- objEditor.ctrlPanel.remove(hideCB);
149
- objEditor.ctrlPanel.remove(markCB);
150
-
151
- objEditor.ctrlPanel.remove(randomCB);
152
- objEditor.ctrlPanel.remove(speedupCB);
153
- objEditor.ctrlPanel.remove(rewindCB);
154
-
155
- objEditor.ctrlPanel.remove(resetButton);
156
- objEditor.ctrlPanel.remove(stepButton);
157
-// objEditor.ctrlPanel.remove(stepAllButton);
158
-// objEditor.ctrlPanel.remove(resetAllButton);
159
- objEditor.ctrlPanel.remove(link2masterCB);
160
- //objEditor.ctrlPanel.remove(flipVCB);
161
- //objEditor.ctrlPanel.remove(texresMenu);
162
- objEditor.ctrlPanel.remove(slowerButton);
163
- objEditor.ctrlPanel.remove(fasterButton);
164
- objEditor.ctrlPanel.remove(remarkButton);
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);
165220
166
- 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);
167228 }
168229
169230 public ObjEditor GetEditor()
....@@ -207,6 +268,12 @@
207268 client = inClient;
208269 copy = client;
209270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
210277 // "this" is not called: SetupUI2(objEditor);
211278 }
212279
....@@ -220,6 +287,12 @@
220287 client = inClient;
221288 copy = client;
222289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
223296 SetupUI2(callee.GetEditor());
224297 }
225298
....@@ -234,6 +307,7 @@
234307 //localCopy.parent = null;
235308
236309 frame = new JFrame();
310
+ frame.setUndecorated(false);
237311 objEditor = this;
238312 this.callee = callee;
239313
....@@ -251,6 +325,12 @@
251325 copy = localCopy;
252326 copy.editWindow = this;
253327
328
+ if (copy.versions == null)
329
+ {
330
+// copy.versions = new byte[100][];
331
+// copy.versionindex = -1;
332
+ }
333
+
254334 SetupMenu();
255335
256336 //SetupName(objEditor); // new
....@@ -264,28 +344,49 @@
264344 return frame.action(event, obj);
265345 }
266346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
267352 void SetupMenu()
268353 {
269354 frame.setMenuBar(menuBar = new MenuBar());
270
- menuBar.add(windowMenu = new Menu("File"));
271
- windowMenu.add(loadItem = new MenuItem("Load..."));
272
- windowMenu.add("-");
273
- windowMenu.add(saveItem = new MenuItem("Save"));
274
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
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..."));
275375 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
276
- windowMenu.add("-");
277
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
278
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
279
- windowMenu.add("-");
376
+ fileMenu.add("-");
377
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
378
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
379
+ fileMenu.add("-");
280380 if (client.parent != null)
281381 {
282
- windowMenu.add(closeItem = new MenuItem("Close"));
382
+ fileMenu.add(closeItem = new MenuItem("Close"));
283383 } else
284384 {
285
- windowMenu.add(closeItem = new MenuItem("Exit"));
385
+ fileMenu.add(closeItem = new MenuItem("Exit"));
286386 }
287387
288
- loadItem.addActionListener(this);
388
+ newItem.addActionListener(this);
389
+ openItem.addActionListener(this);
289390 saveItem.addActionListener(this);
290391 saveAsItem.addActionListener(this);
291392 exportAsItem.addActionListener(this);
....@@ -293,82 +394,69 @@
293394 //povItem.addActionListener(this);
294395 closeItem.addActionListener(this);
295396
296
- menuBar.add(cameraMenu = new Menu("View"));
297
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
298
- //zBufferItem.addActionListener(this);
299
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
300
- //normalLensItem.addActionListener(this);
301
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
302
- revertCameraItem.addActionListener(this);
303
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
304
- toggleTimelineItem.addItemListener(this);
305
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
306
- toggleFullScreenItem.addItemListener(this);
307
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
308
- cameraMenu.add("-");
309
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
310
- toggleTextureItem.addItemListener(this);
311
- toggleTextureItem.setState(CameraPane.textureon);
312
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
313
- toggleLiveItem.addItemListener(this);
314
- toggleLiveItem.setState(Globals.isLIVE());
315
- cameraMenu.add(stepItem = new MenuItem("Step"));
316
- stepItem.addActionListener(this);
317
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
318
-// toggleDLItem.addItemListener(this);
319
-// toggleDLItem.setState(false);
320
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
321
- toggleRenderItem.addItemListener(this);
322
- toggleRenderItem.setState(!CameraPane.frozen);
323
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
324
- toggleDebugItem.addItemListener(this);
325
- toggleDebugItem.setState(CameraPane.DEBUG);
326
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
327
- toggleFrustumItem.addItemListener(this);
328
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
329
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
330
- toggleFootContactItem.addItemListener(this);
331
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
332
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
333
- toggleRandomItem.addItemListener(this);
334
- toggleRandomItem.setState(CameraPane.RANDOM);
335
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
336
- toggleHandleItem.addItemListener(this);
337
- toggleHandleItem.setState(CameraPane.HANDLES);
338
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
339
- togglePaintItem.addItemListener(this);
340
- togglePaintItem.setState(CameraPane.PAINTMODE);
341
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
342
-// toggleRootItem.addItemListener(this);
343
-// toggleRootItem.setState(false);
344
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
345
-// animationItem.addItemListener(this);
346
-// animationItem.setState(CameraPane.ANIMATION);
347
- cameraMenu.add("-");
348
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
349
- editCameraItem.addActionListener(this);
350
-
351397 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
+
352424 toolbarPanel = new JPanel();
353425 toolbarPanel.setName("Toolbar");
354
- treePanel = new JPanel();
426
+
427
+ treePanel = new cGridBag();
355428 treePanel.setName("Tree");
356
- ctrlPanel = new JPanel(); // new GridBagLayout());
357
- ctrlPanel.setName("Edit");
358
- materialPanel = new JPanel();
359
- 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
+
360445 /*JTextPane*/
361446 infoarea = createTextPane();
447
+ doc = infoarea.getStyledDocument();
448
+
362449 infoarea.setEditable(true);
363450 SetText();
451
+
364452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
365453 // infoarea.setOpaque(false);
366454 // //infoarea.setForeground(textcolor);
367
- infoarea.setLineWrap(true);
368
- infoarea.setWrapStyleWord(true);
455
+// TEXTAREA infoarea.setLineWrap(true);
456
+// TEXTAREA infoarea.setWrapStyleWord(true);
369457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
370
- infoPanel.setPreferredSize(new Dimension(50, 200));
371
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
372460 //infoPanel.setLayout(new BorderLayout());
373461 //infoPanel.add(createTextPane());
374462
....@@ -376,16 +464,23 @@
376464 mainPanel.setName("Main");
377465 mainPanel.setContinuousLayout(true);
378466 mainPanel.setOneTouchExpandable(true);
379
- mainPanel.setDividerLocation(1.0);
380467 mainPanel.setDividerSize(9);
381
- mainPanel.setResizeWeight(0);
382
-
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
+
383478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
384479 //mainPanel.setLayout(new GridBagLayout());
385480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
386
- treePanel.setLayout(new GridBagLayout());
387
- ctrlPanel.setLayout(new GridBagLayout());
388
- materialPanel.setLayout(new GridBagLayout());
481
+// treePanel.setLayout(new GridBagLayout());
482
+ //ctrlPanel.setLayout(new GridBagLayout());
483
+ //materialPanel.setLayout(new GridBagLayout());
389484
390485 aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
391486 GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
....@@ -424,7 +519,7 @@
424519 static String newline = "\n";
425520 protected static final String buttonString = "JButton";
426521 StyledDocument doc;
427
- JTextArea infoarea;
522
+ JTextPane infoarea;
428523
429524 void ClearInfo()
430525 {
....@@ -447,10 +542,10 @@
447542 e.printStackTrace();
448543 }
449544
450
- String selection = infoarea.getText();
451
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
452
- java.awt.datatransfer.Clipboard clipboard =
453
- Toolkit.getDefaultToolkit().getSystemClipboard();
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();
454549 //clipboard.setContents(data, data);
455550 }
456551
....@@ -473,13 +568,13 @@
473568 //SendInfo("Name:", "bold");
474569 if (sel.GetTextures() != null || debug)
475570 {
476
- si.SendInfo(sel.toString(), "bold");
571
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
477572 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
478573 if (sel.Size() > 0)
479574 {
480575 si.SendInfo("#children = " + sel.Size(), "regular");
481576 }
482
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
577
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
483578 if (debug)
484579 {
485580 try
....@@ -491,7 +586,10 @@
491586 }
492587
493588 if (full)
494
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
589
+ {
590
+ si.SendInfo(" BBox min: " + minima, "regular");
591
+ si.SendInfo(" BBox max: " + maxima, "regular");
592
+ }
495593
496594 if (sel.bRep != null)
497595 {
....@@ -518,7 +616,7 @@
518616 }
519617 if (sel.support != null)
520618 {
521
- si.SendInfo(" support: " + sel.support, "regular");
619
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
522620 }
523621 if (sel.scriptnode != null)
524622 {
....@@ -589,6 +687,9 @@
589687 {
590688 CameraPane.pointflow = (PointFlow) sel;
591689 }
690
+
691
+ si.SendInfo("_____________________", "regular");
692
+ si.SendInfo("", "regular");
592693 }
593694 }
594695
....@@ -604,68 +705,191 @@
604705 }
605706 }
606707
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
+
607766 void ToggleFullScreen()
608767 {
609
- if (CameraPane.FULLSCREEN)
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
610773 {
611
- frame.getContentPane().remove(/*"Center",*/bigThree);
612
- framePanel.add(bigThree);
613
- 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
+
614797 } else
615798 {
616
- frame.getContentPane().remove(/*"Center",*/framePanel);
617
- framePanel.remove(bigThree);
618
- 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);
619821 }
620
- cameraView.ToggleFullScreen();
822
+ frame.validate();
621823 }
622824
623
- private JTextArea createTextPane()
825
+ private byte[] CompressCopy()
624826 {
625
- String[] initString =
626
- {
627
- "This is an editable JTextPane, ", //regular
628
- "another ", //italic
629
- "styled ", //bold
630
- "text ", //small
631
- "component, ", //large
632
- "which supports embedded components..." + newline,//regular
633
- " " + newline, //button
634
- "...and embedded icons..." + newline, //regular
635
- " ", //icon
636
- newline + "JTextPane is a subclass of JEditorPane that "
637
- + "uses a StyledEditorKit and StyledDocument, and provides "
638
- + "cover methods for interacting with those objects."
639
- };
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
+ }
640846
641
- String[] initStyles =
642
- {
643
- "regular", "italic", "bold", "small", "large",
644
- "regular", "button", "regular", "icon",
645
- "regular"
646
- };
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
+// }
647891
648
- JTextPane textPane = new JTextPane();
649
- textPane.setEditable(true);
650
- /*StyledDocument*/ doc = textPane.getStyledDocument();
651
- addStylesToDocument(doc);
652
-
653
- try
654
- {
655
- for (int j = 0; j < 2; j++)
656
- {
657
- for (int i = 0; i < initString.length; i++)
658
- {
659
- doc.insertString(doc.getLength(), initString[i],
660
- doc.getStyle(initStyles[i]));
661
- }
662
- }
663
- } catch (BadLocationException ble)
664
- {
665
- System.err.println("Couldn't insert initial text into text pane.");
666
- }
667
-
668
- return new JTextArea(); // textPane;
892
+ return new JTextPane(); // textPane;
669893 }
670894
671895 protected void addStylesToDocument(StyledDocument doc)
....@@ -718,7 +942,7 @@
718942 protected static ImageIcon createImageIcon(String path,
719943 String description)
720944 {
721
- java.net.URL imgURL = GrafreeD.class.getResource(path);
945
+ java.net.URL imgURL = Grafreed.class.getResource(path);
722946 if (imgURL != null)
723947 {
724948 return new ImageIcon(imgURL, description);
....@@ -750,6 +974,7 @@
750974 // NumberSlider vDivsField;
751975 // JCheckBox endcaps;
752976 JCheckBox liveCB;
977
+ JCheckBox selectableCB;
753978 JCheckBox hideCB;
754979 JCheckBox link2masterCB;
755980 JCheckBox markCB;
....@@ -757,7 +982,12 @@
757982 JCheckBox speedupCB;
758983 JCheckBox rewindCB;
759984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
760989 JComboBox texresMenu;
990
+
761991 JButton resetButton;
762992 JButton stepButton;
763993 JButton stepAllButton;
....@@ -765,115 +995,87 @@
765995 JButton slowerButton;
766996 JButton fasterButton;
767997 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;
7681008
769
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
1009
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
7701010 {
7711011 JCheckBox cb;
7721012
773
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
774
- oe.aConstraints.gridwidth = 1; // 3;
775
-// oe.aConstraints.weightx = 1;
776
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
777
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1013
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
7781014 cb.addItemListener(this);
779
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
780
- oe.aConstraints.gridwidth = 1;
781
- oe.aConstraints.gridx += 1;
7821015
7831016 return cb;
7841017 }
7851018
786
- cButton AddButton(ObjEditor oe, String label)
1019
+ cButton AddButton(cGridBag panel, String label)
7871020 {
7881021 cButton cb;
7891022
790
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
791
- oe.aConstraints.gridwidth = 1;
792
-// oe.aConstraints.weightx = 1;
793
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
794
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
1023
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
7951024 cb.addActionListener(this);
796
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
797
- oe.aConstraints.gridwidth = 1;
798
- oe.aConstraints.gridx += 1;
7991025
8001026 return cb;
8011027 }
8021028
803
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
1029
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
8041030 {
8051031 JComboBox combo;
8061032
807
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
808
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
809
- oe.aConstraints.gridx += 1;
1033
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8101034 combo.addActionListener(this);
8111035
8121036 return combo;
8131037 }
8141038
815
- 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)
8161040 {
817
- NumberSlider combo;
1041
+ cGridBag control = new cGridBag();
1042
+
1043
+ cNumberSlider combo;
8181044
8191045 JLabel jlabel = new JLabel(label);
820
-
821
- aConstraints.fill = GridBagConstraints.VERTICAL;
8221046 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
823
- aConstraints.gridwidth = 1;
824
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
825
- aConstraints.gridx += 1;
826
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
827
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
828
- ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
829
- aConstraints.gridx += 1;
830
- aConstraints.gridwidth = 1;
831
-
1047
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1048
+ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8321049 combo.setFloat(current);
833
-
834
- combo.label = jlabel;
835
-
836
- combo.addChangeListener(this);
837
-
838
- return combo;
1050
+
1051
+ panel.add(control);
1052
+
1053
+ return control;
8391054 }
8401055
841
- 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)
8421057 {
843
- NumberSlider combo;
1058
+ cGridBag control = new cGridBag();
1059
+
1060
+ cNumberSlider combo;
8441061
8451062 JLabel jlabel = new JLabel(label);
846
-
847
- aConstraints.fill = GridBagConstraints.VERTICAL;
8481063 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
849
- aConstraints.gridwidth = 2;
850
- ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
851
- aConstraints.gridx += 1;
852
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
853
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
854
- ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
855
- aConstraints.gridx += 1;
856
- aConstraints.gridwidth = 1;
857
-
1064
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1065
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8581066 combo.setInteger(current);
8591067
860
- combo.label = jlabel;
861
-
862
- combo.addChangeListener(this);
863
-
864
- return combo;
1068
+ panel.add(control);
1069
+
1070
+ return control;
8651071 }
8661072
867
- JTextArea AddText(JPanel ctrlPanel, String name)
1073
+ JTextArea AddText(cGridBag ctrlPanel, String name)
8681074 {
8691075 JTextArea text;
8701076
871
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
872
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
873
- ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
1077
+ ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
8741078 text.addCaretListener(this);
875
- aConstraints.gridx += 1;
876
- aConstraints.gridwidth = 1;
8771079
8781080 return text;
8791081 }
....@@ -903,9 +1105,16 @@
9031105 objEditor.ctrlPanel.remove(j);
9041106 }
9051107
1108
+ void Remove(cNumberSlider j)
1109
+ {
1110
+ j.removeChangeListener(this);
1111
+ //objEditor.ctrlPanel.remove(j.label);
1112
+ objEditor.ctrlPanel.remove(j);
1113
+ }
1114
+
9061115 /*
9071116 */
908
- void Return() // ObjEditor oe)
1117
+ void Return0() // ObjEditor oe)
9091118 {
9101119 aConstraints.gridy += 1;
9111120 aConstraints.gridx = 0;
....@@ -960,37 +1169,80 @@
9601169
9611170 void SetupUI2(ObjEditor oe)
9621171 {
963
-// oe.aConstraints.weightx = 0;
964
-// oe.aConstraints.weighty = 0;
965
-// oe.aConstraints.gridx = 0;
966
-// oe.aConstraints.gridy = 0;
967
- SetupName(oe);
1172
+ //SetupName(oe);
9681173
969
- 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)
9701183 return;
9711184
972
- liveCB = AddCheckBox(oe, "Live", copy.live);
973
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
974
- 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");
9751191 // Return();
976
- markCB = AddCheckBox(oe, "Mark", copy.marked);
977
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
978
- randomCB = AddCheckBox(oe, "Rand", copy.random);
979
- Return();
980
- resetButton = AddButton(oe, "Reset");
981
- stepButton = AddButton(oe, "Step");
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");
9821228 // resetAllButton = AddButton(oe, "Reset All");
9831229 // stepAllButton = AddButton(oe, "Step All");
984
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
9851230 // Return();
986
- slowerButton = AddButton(oe, "Slow");
987
- fasterButton = AddButton(oe, "Fast");
988
- 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");
9891237
990
- Return();
1238
+ oe.ctrlPanel.add(objectCommandsPanel);
1239
+ oe.ctrlPanel.Return();
9911240
992
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
993
- 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();
9941246
9951247 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
9961248 // ObjEditor.aConstraints.gridx += 1;
....@@ -1085,7 +1337,7 @@
10851337 oe.aConstraints.gridwidth = 1;
10861338 /**/
10871339 nameField = AddText(oe.ctrlPanel, copy.GetName());
1088
- Return();
1340
+ oe.ctrlPanel.Return();
10891341
10901342 //ctrlPanel.add(textureButton = new Button("Texture..."));
10911343 //textureButton.setEnabled(false);
....@@ -1187,9 +1439,13 @@
11871439 //JPanel worldPanel =
11881440 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11891441 //worldPanel.setName("World");
1190
- centralPanel = new JPanel(new BorderLayout());
1191
- timelinePanel = new JPanel(new BorderLayout());
1192
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1442
+ centralPanel = new cGridBag();
1443
+ centralPanel.preferredWidth = 20;
1444
+
1445
+ if (Globals.ADVANCED)
1446
+ {
1447
+ timelinePanel = new JPanel(new BorderLayout());
1448
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11931449
11941450 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11951451 cameraPanel.setContinuousLayout(true);
....@@ -1198,7 +1454,10 @@
11981454 // cameraPanel.setDividerSize(9);
11991455 cameraPanel.setResizeWeight(1.0);
12001456
1457
+ }
1458
+
12011459 centralPanel.add(cameraView);
1460
+ centralPanel.setFocusable(true);
12021461 //frame.setJMenuBar(timelineMenubar);
12031462 //centralPanel.add(timelinePanel);
12041463
....@@ -1217,12 +1476,14 @@
12171476 //frontView.object = copy;
12181477 //sideView.object = copy;
12191478
1220
- XYZPanel = new JPanel();
1221
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1479
+ XYZPanel = new cGridBag().setVertical(true);
1480
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
12221481
1223
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1224
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1225
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1482
+ XYZPanel.preferredWidth = 5;
1483
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1484
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1485
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1486
+ //XYZPanel.setName("XYZ");
12261487
12271488 /*
12281489 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1260,11 +1521,23 @@
12601521 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12611522 //tmp.setName("Edit");
12621523 objectPanel.add(materialPanel);
1263
- JPanel north = new JPanel(new BorderLayout());
1264
- north.setName("Edit");
1265
- north.add(ctrlPanel, BorderLayout.NORTH);
1266
- objectPanel.add(north);
1267
- objectPanel.add(infoPanel);
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"));
12681541
12691542 /*
12701543 aConstraints.gridx = 0;
....@@ -1273,7 +1546,7 @@
12731546 aConstraints.gridy += 1;
12741547 aConstraints.gridwidth = 1;
12751548 mainPanel.add(objectPanel, aConstraints);
1276
- */
1549
+ */
12771550
12781551 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12791552 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1284,16 +1557,23 @@
12841557 scrollpane.setWheelScrollingEnabled(true);
12851558 scrollpane.addMouseWheelListener(this); // Default not fast enough
12861559
1287
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
1288
- scenePanel.add(scrollpane);
1560
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1561
+ scenePanel.preferredWidth = 5;
1562
+
1563
+ JTabbedPane tabbedPane = new JTabbedPane();
1564
+ tabbedPane.add(scrollpane);
12891565
1290
- scenePanel.add(FSPane = new cFileSystemPane(this));
1291
-
1292
- optionsPanel = new JPanel(new GridBagLayout());
1566
+ optionsPanel = new cGridBag().setVertical(false);
12931567
12941568 optionsPanel.setName("Options");
1295
- scenePanel.add(optionsPanel);
1569
+
1570
+ AddOptions(optionsPanel); //, aConstraints);
1571
+
1572
+ tabbedPane.add(optionsPanel);
1573
+
1574
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12961575
1576
+ scenePanel.add(tabbedPane);
12971577
12981578 /*
12991579 cTree jTree = new cTree(null);
....@@ -1327,6 +1607,7 @@
13271607 //bigPanel.setSize(new Dimension(10,10));
13281608 //bigPanel.add(ctrlPanel);
13291609 //bigPanel.add(gridPanel);
1610
+ /**
13301611 bigThree = new JPanel();
13311612 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
13321613 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1350,7 +1631,13 @@
13501631 // aConstraints.gridheight = 3;
13511632 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13521633 bigThree.add(XYZPanel, aWindowConstraints);
1634
+ /**/
13531635
1636
+ bigThree = new cGridBag();
1637
+ bigThree.addComponent(centralPanel);
1638
+ bigThree.addComponent(scenePanel);
1639
+ //bigThree.addComponent(XYZPanel);
1640
+
13541641 // // SIDE EFFECT!!!
13551642 // aConstraints.gridx = 0;
13561643 // aConstraints.gridy = 0;
....@@ -1358,9 +1645,9 @@
13581645 // aConstraints.gridheight = 1;
13591646
13601647 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1361
- framePanel.setContinuousLayout(true);
1362
- framePanel.setOneTouchExpandable(true);
1363
- framePanel.setDividerLocation(0.8);
1648
+ framePanel.setContinuousLayout(false);
1649
+ framePanel.setOneTouchExpandable(false);
1650
+ //.setDividerLocation(0.8);
13641651 //framePanel.setDividerSize(15);
13651652 //framePanel.setResizeWeight(0.15);
13661653 framePanel.setName("Frame");
....@@ -1377,10 +1664,15 @@
13771664
13781665 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13791666
1380
- frame.setSize(1024, 768);
1381
- frame.show();
1382
-
1667
+ frame.setSize(1280, 860);
1668
+
1669
+ cameraView.requestFocusInWindow();
1670
+
13831671 gridPanel.setDividerLocation(1.0);
1672
+
1673
+ frame.validate();
1674
+
1675
+ frame.setVisible(true);
13841676
13851677 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13861678 frame.addWindowListener(new WindowAdapter()
....@@ -1393,6 +1685,10 @@
13931685 });
13941686 }
13951687
1688
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1689
+ {
1690
+ }
1691
+
13961692 JTree GetTree()
13971693 {
13981694 return objEditor.jTree;
....@@ -1404,260 +1700,161 @@
14041700 ctrlPanel.removeAll();
14051701 }
14061702
1407
- void SetupMaterial(JPanel ctrlPanel)
1703
+ void SetupMaterial(cGridBag panel)
14081704 {
1409
- aConstraints.weighty = 0;
1410
- //aConstraints.weightx = 1;
1411
- /*
1705
+ /*
14121706 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
14131707 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1414
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1415
- aConstraints.gridx += 1;
14161708 */
14171709
1418
- aConstraints.gridwidth = 1;
1419
- ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints);
1420
- aConstraints.gridx += 1;
1421
- aConstraints.weighty = 0;
1422
- 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");
14231714
14241715 /*
14251716 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
1426
- aConstraints.gridx += 1;
1427
- aConstraints.weighty = 0;
1428
- aConstraints.gridwidth = 1;
14291717 */
14301718
1431
- ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints);
1432
- 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
+ }
14331728
1434
- ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints);
1435
-
1436
- aConstraints.gridx += 1;
1437
-
1438
- ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints);
1439
-
1440
- aConstraints.gridx += 1;
1441
-
1442
- ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints);
1443
-
1444
- aConstraints.gridx = 0;
1445
- aConstraints.gridy += 1;
1446
- aConstraints.weighty = 0;
1447
- aConstraints.gridwidth = 1;
1729
+ editBar.preferredHeight = 15;
1730
+
1731
+ panel.add(editBar);
1732
+
14481733 /**/
14491734 //aConstraints.weighty = 0;
14501735 ////aConstraints.weightx = 1;
14511736 //aConstraints.weighty = 1;
14521737 aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
14531738 //aConstraints.gridx += 1;
1454
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1455
- aConstraints.weighty = 0;
1456
- aConstraints.gridx = 0;
1457
- aConstraints.gridy += 1;
1458
- aConstraints.gridwidth = 1;
1739
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
14591740
1460
- ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints);
1461
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1462
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1463
- aConstraints.gridx += 1;
1464
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- //aConstraints.weightx = 0;
1466
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1467
- aConstraints.gridx = 0;
1468
- aConstraints.gridy += 1;
1469
- 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);
14701749
1471
- ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints);
1472
- modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1473
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1474
- aConstraints.gridx += 1;
1475
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1476
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1477
- aConstraints.gridx = 0;
1478
- aConstraints.gridy += 1;
1479
- 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);
14801755
1481
- ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints);
1482
- textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1483
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1484
- aConstraints.gridx += 1;
1485
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1486
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1487
- aConstraints.gridx = 0;
1488
- aConstraints.gridy += 1;
1489
- 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);
14901761
1491
- ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints);
1492
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1493
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1494
- aConstraints.gridx += 1;
1495
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1496
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1497
- aConstraints.gridx = 0;
1498
- aConstraints.gridy += 1;
1499
- 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);
15001775
1501
- ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints);
1502
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1503
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1504
- aConstraints.gridx += 1;
1505
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1506
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1507
- aConstraints.gridx = 0;
1508
- aConstraints.gridy += 1;
1509
- 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);
15101781
1511
- ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints);
1512
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1513
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1514
- aConstraints.gridx += 1;
1515
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1516
- ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints);
1517
- aConstraints.gridx = 0;
1518
- aConstraints.gridy += 1;
1519
- 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);
15201787
1521
- //aConstraints.weighty = 1;
1522
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1523
- //aConstraints.gridx += 1;
1524
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1525
- aConstraints.weighty = 0;
1526
- aConstraints.gridx = 0;
1527
- aConstraints.gridy += 1;
1528
- 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);
15291793
1530
- ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints);
1531
- diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1532
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1533
- aConstraints.gridx += 1;
1534
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1535
- ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints);
1536
- aConstraints.gridx = 0;
1537
- aConstraints.gridy += 1;
1538
- 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);
15391799
1540
- ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints);
1541
- diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1542
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1543
- aConstraints.gridx += 1;
1544
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1545
- ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints);
1546
- aConstraints.gridx = 0;
1547
- aConstraints.gridy += 1;
1548
- 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);
15491805
1550
- ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints);
1551
- selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1552
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1553
- aConstraints.gridx += 1;
1554
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1555
- ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1556
- aConstraints.gridx = 0;
1557
- aConstraints.gridy += 1;
1558
- 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);
15591811
1560
- ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints);
1561
- sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1562
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1563
- aConstraints.gridx += 1;
1564
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1565
- ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints);
1566
- aConstraints.gridx = 0;
1567
- aConstraints.gridy += 1;
1568
- 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);
15691817
1570
- ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints);
1571
- subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1573
- aConstraints.gridx += 1;
1574
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1575
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1576
- aConstraints.gridx = 0;
1577
- aConstraints.gridy += 1;
1578
- 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);
15791825
1580
- ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints);
1581
- shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1582
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1583
- aConstraints.gridx += 1;
1584
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1585
- ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints);
1586
- aConstraints.gridx = 0;
1587
- aConstraints.gridy += 1;
1588
- 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);
15891831
1590
- ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints);
1591
- fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1592
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1593
- aConstraints.gridx += 1;
1594
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1595
- ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints);
1596
- aConstraints.gridx = 0;
1597
- aConstraints.gridy += 1;
1598
- 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);
15991837
1600
- //aConstraints.weighty = 1;
1601
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1602
- //aConstraints.gridx += 1;
1603
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1604
- aConstraints.weighty = 0;
1605
- aConstraints.gridx = 0;
1606
- aConstraints.gridy += 1;
1607
- 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);
16081843
1609
- ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints);
1610
- specularLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1611
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1612
- aConstraints.gridx += 1;
1613
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1614
- ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints);
1615
- aConstraints.gridx = 0;
1616
- aConstraints.gridy += 1;
1617
- 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);
16181849
1619
- ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints);
1620
- lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1621
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1622
- aConstraints.gridx += 1;
1623
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1624
- ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints);
1625
- aConstraints.gridx = 0;
1626
- aConstraints.gridy += 1;
1627
- 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);
16281855
1629
- ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints);
1630
- shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1632
- aConstraints.gridx += 1;
1633
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1634
- ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints);
1635
- aConstraints.gridx = 0;
1636
- aConstraints.gridy += 1;
1637
- aConstraints.gridwidth = 1;
1638
-
1639
- ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints);
1640
- metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1641
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1642
- aConstraints.gridx += 1;
1643
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1644
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1645
- aConstraints.gridx = 0;
1646
- aConstraints.gridy += 1;
1647
- aConstraints.gridwidth = 1;
1648
-
1649
- ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints);
1650
- velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1651
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1652
- aConstraints.gridx += 1;
1653
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1654
- ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints);
1655
- aConstraints.gridx = 0;
1656
- aConstraints.gridy += 1;
1657
- aConstraints.gridwidth = 1;
1658
-
1659
- shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1);
1660
- Return();
1856
+ shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
1857
+ //Return();
16611858 // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
16621859 // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16631860 // aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -1668,130 +1865,105 @@
16681865 // aConstraints.gridy += 1;
16691866 // aConstraints.gridwidth = 1;
16701867
1671
- //aConstraints.weighty = 1;
1672
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1673
- //aConstraints.gridx += 1;
1674
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1675
- aConstraints.weighty = 0;
1676
- aConstraints.gridx = 0;
1677
- aConstraints.gridy += 1;
1678
- 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);
16791873
1680
- ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints);
1681
- cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1683
- aConstraints.gridx += 1;
1684
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1685
- ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints);
1686
- aConstraints.gridx = 0;
1687
- aConstraints.gridy += 1;
1688
- 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);
16891879
1690
- ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints);
1691
- ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1693
- aConstraints.gridx += 1;
1694
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1695
- ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints);
1696
- aConstraints.gridx = 0;
1697
- aConstraints.gridy += 1;
1698
- aConstraints.gridwidth = 1;
16991880
1700
- ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints);
1701
- backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1702
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1703
- aConstraints.gridx += 1;
1704
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1705
- ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints);
1706
- aConstraints.gridx = 0;
1707
- aConstraints.gridy += 1;
1708
- 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);
17091888
1710
- ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints);
1711
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1712
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1713
- aConstraints.gridx += 1;
1714
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1715
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
1716
- aConstraints.gridx = 0;
1717
- aConstraints.gridy += 1;
1718
- aConstraints.gridwidth = 1;
1719
- 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);
17201894
1721
- ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints);
1722
- bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1724
- aConstraints.gridx += 1;
1725
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1726
- ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints);
1727
- aConstraints.gridx = 0;
1728
- aConstraints.gridy += 1;
1729
- 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);
17301900
1731
- ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints);
1732
- noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1733
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1734
- aConstraints.gridx += 1;
1735
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1736
- ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints);
1737
- aConstraints.gridx = 0;
1738
- aConstraints.gridy += 1;
1739
- 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);
17401906
1741
- ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints);
1742
- powerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1744
- aConstraints.gridx += 1;
1745
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1746
- ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints);
1747
- aConstraints.gridx = 0;
1748
- aConstraints.gridy += 1;
1749
- 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);
17501912
1751
- ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints);
1752
- borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1754
- aConstraints.gridx += 1;
1755
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1756
- ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints);
1757
- aConstraints.gridx = 0;
1758
- aConstraints.gridy += 1;
1759
- 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);
17601920
1761
- ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints);
1762
- fogLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1763
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1764
- aConstraints.gridx += 1;
1765
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1766
- ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints);
1767
- aConstraints.gridx = 0;
1768
- aConstraints.gridy += 1;
1769
- 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);
17701926
1771
- ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints);
1772
- opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1773
- aConstraints.fill = GridBagConstraints.HORIZONTAL;
1774
- aConstraints.gridx += 1;
1775
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1776
- ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints);
1777
- aConstraints.gridx = 0;
1778
- aConstraints.gridy += 1;
1779
- 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);
17801932
1781
- //aConstraints.weighty = 1;
1782
- aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100;
1783
- //aConstraints.gridx += 1;
1784
- ctrlPanel.add(new JLabel("----------------------------------"), aConstraints);
1785
- 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);
17861938
1787
- aConstraints.gridx = 0;
1788
- aConstraints.gridy = 0;
1789
- 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);
17901962
17911963 SetMaterial(copy); // .GetMaterial());
17921964
1793
- colorField.addChangeListener(this);
1794
- modulationField.addChangeListener(this);
1965
+ //colorField.addChangeListener(this);
1966
+// modulationField.addChangeListener(this);
17951967 metalnessField.addChangeListener(this);
17961968 diffuseField.addChangeListener(this);
17971969 specularField.addChangeListener(this);
....@@ -1821,12 +1993,15 @@
18211993 opacityPowerField.addChangeListener(this);
18221994 /**/
18231995
1824
- resetSlidersButton.addActionListener(this);
18251996 clearMaterialButton.addActionListener(this);
18261997 createMaterialButton.addActionListener(this);
1827
-
1828
- propagateToggle.addItemListener(this);
1829
- multiplyToggle.addItemListener(this);
1998
+
1999
+ if (Globals.ADVANCED)
2000
+ {
2001
+ resetSlidersButton.addActionListener(this);
2002
+ propagateToggle.addItemListener(this);
2003
+ multiplyToggle.addItemListener(this);
2004
+ }
18302005 }
18312006
18322007 void DropFile(java.io.File[] files, boolean textures)
....@@ -1844,8 +2019,9 @@
18442019 // 3D models
18452020 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18462021 {
1847
- lastConverter = new com.jmex.model.converters.MaxToJme();
1848
- LoadFile(filename, lastConverter);
2022
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2023
+ //LoadFile(filename, lastConverter);
2024
+ LoadObjFile(filename); // New 3ds loader
18492025 continue;
18502026 }
18512027 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -1997,7 +2173,7 @@
19972173
19982174 //? flashIt = false;
19992175 CameraPane pane = (CameraPane) cameraView;
2000
- pane.clickStart(location.x, location.y, 0);
2176
+ pane.clickStart(location.x, location.y, 0, 0);
20012177 pane.clickEnd(location.x, location.y, 0, true);
20022178
20032179 if (group.selection.size() == 1)
....@@ -2046,6 +2222,7 @@
20462222 e2.printStackTrace();
20472223 }
20482224 }
2225
+
20492226 LoadJMEThread loadThread;
20502227
20512228 class LoadJMEThread extends Thread
....@@ -2103,6 +2280,7 @@
21032280 //LoadFile0(filename, converter);
21042281 }
21052282 }
2283
+
21062284 LoadOBJThread loadObjThread;
21072285
21082286 class LoadOBJThread extends Thread
....@@ -2181,19 +2359,19 @@
21812359
21822360 void LoadObjFile(String fullname)
21832361 {
2184
- /*
2362
+ System.out.println("Loading " + fullname);
2363
+ /**/
21852364 //lastFilename = fullname;
21862365 if(loadObjThread == null)
21872366 {
2188
- loadObjThread = new LoadOBJThread();
2189
- loadObjThread.start();
2367
+ loadObjThread = new LoadOBJThread();
2368
+ loadObjThread.start();
21902369 }
21912370
21922371 loadObjThread.add(fullname);
2193
- */
2372
+ /**/
21942373
2195
- System.out.println("Loading " + fullname);
2196
- makeSomething(new FileObject(fullname, true), true);
2374
+ //makeSomething(new FileObject(fullname, true), true);
21972375 }
21982376
21992377 void LoadGFDFile(String fullname)
....@@ -2454,11 +2632,11 @@
24542632
24552633 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
24562634 {
2457
- if (GrafreeD.standAlone)
2635
+ if (Grafreed.standAlone)
24582636 {
24592637 /**/
24602638 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2461
- browser.show();
2639
+ browser.setVisible(true);
24622640 String filename = browser.getFile();
24632641 if (filename != null && filename.length() > 0)
24642642 {
....@@ -2569,6 +2747,7 @@
25692747 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25702748 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25712749 }
2750
+
25722751 //cJME.count++;
25732752 //cJME.count %= 12;
25742753 if (gc)
....@@ -2603,6 +2782,7 @@
26032782 }
26042783 if (input == null)
26052784 {
2785
+ new Exception().printStackTrace();
26062786 System.exit(0);
26072787 }
26082788
....@@ -2751,6 +2931,7 @@
27512931 }
27522932 }
27532933 }
2934
+
27542935 cFileSystemPane FSPane;
27552936
27562937 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2804,11 +2985,14 @@
28042985 }
28052986 }
28062987 }
2988
+
28072989 freezematerial = false;
28082990 }
28092991
28102992 void SetMaterial(Object3D object)
28112993 {
2994
+ latestObject = object;
2995
+
28122996 cMaterial mat = object.material;
28132997
28142998 if (mat == null)
....@@ -2817,7 +3001,8 @@
28173001 return;
28183002 }
28193003
2820
- multiplyToggle.setSelected(mat.multiply);
3004
+ if (multiplyToggle != null)
3005
+ multiplyToggle.setSelected(mat.multiply);
28213006
28223007 assert (object.projectedVertices != null);
28233008
....@@ -2919,12 +3104,17 @@
29193104 // }
29203105
29213106 /**/
2922
- if (deselect)
3107
+ if (deselect || child == null)
29233108 {
29243109 //group.deselectAll();
29253110 //freeze = true;
29263111 GetTree().clearSelection();
29273112 //freeze = false;
3113
+
3114
+ if (child == null)
3115
+ {
3116
+ return;
3117
+ }
29283118 }
29293119
29303120 //group.addSelectee(child);
....@@ -2993,7 +3183,7 @@
29933183 cameraView.ToggleDL();
29943184 cameraView.repaint();
29953185 return;
2996
- } else if (event.getSource() == toggleTextureItem)
3186
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29973187 {
29983188 cameraView.ToggleTexture();
29993189 // june 2013 copy.HardTouch();
....@@ -3032,9 +3222,9 @@
30323222 frame.validate();
30333223
30343224 return;
3035
- } else if (event.getSource() == toggleRandomItem)
3225
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30363226 {
3037
- cameraView.ToggleRandom();
3227
+ cameraView.ToggleSwitch();
30383228 cameraView.repaint();
30393229 return;
30403230 } else if (event.getSource() == toggleHandleItem)
....@@ -3063,6 +3253,10 @@
30633253 {
30643254 copy.live ^= true;
30653255 return;
3256
+ } else if (event.getSource() == selectableCB)
3257
+ {
3258
+ copy.dontselect ^= true;
3259
+ return;
30663260 } else if (event.getSource() == hideCB)
30673261 {
30683262 copy.hide ^= true;
....@@ -3077,6 +3271,7 @@
30773271 if (event.getSource() == randomCB)
30783272 {
30793273 copy.random ^= true;
3274
+ objEditor.refreshContents();
30803275 return;
30813276 }
30823277 if (event.getSource() == speedupCB)
....@@ -3100,8 +3295,9 @@
31003295
31013296 public void actionPerformed(ActionEvent event)
31023297 {
3298
+ Object source = event.getSource();
31033299 // SCRIPT DIALOG
3104
- if (event.getSource() == okbutton)
3300
+ if (source == okbutton)
31053301 {
31063302 textpanel.setVisible(false);
31073303 textpanel.remove(textarea);
....@@ -3113,7 +3309,7 @@
31133309 textarea = null;
31143310 textpanel = null;
31153311 }
3116
- if (event.getSource() == cancelbutton)
3312
+ if (source == cancelbutton)
31173313 {
31183314 textpanel.setVisible(false);
31193315 textpanel.remove(textarea);
....@@ -3125,50 +3321,50 @@
31253321 //applySelf();
31263322 //client.refreshEditWindow();
31273323 //refreshContents();
3128
- if (event.getSource() == nameField)
3324
+ if (source == nameField)
31293325 {
31303326 //System.out.println("ObjEditor " + event);
31313327 applySelf0(true);
31323328 //parent.applySelf();
31333329 objEditor.refreshContents();
3134
- } else if (event.getSource() == resetButton)
3330
+ } else if (source == resetButton)
31353331 {
31363332 CameraPane.fullreset = true;
31373333 copy.Reset(); // ResetMeshes();
31383334 copy.Touch();
31393335 objEditor.refreshContents();
3140
- } else if (event.getSource() == stepItem)
3336
+ } else if (source == stepItem)
31413337 {
31423338 //cameraView.ONESTEP = true;
31433339 Globals.ONESTEP = true;
31443340 cameraView.repaint();
31453341 return;
3146
- } else if (event.getSource() == stepButton)
3342
+ } else if (source == stepButton)
31473343 {
31483344 copy.Step();
31493345 copy.Touch();
31503346 objEditor.refreshContents();
3151
- } else if (event.getSource() == slowerButton)
3347
+ } else if (source == slowerButton)
31523348 {
31533349 copy.Slower();
31543350 copy.Touch();
31553351 objEditor.refreshContents();
3156
- } else if (event.getSource() == fasterButton)
3352
+ } else if (source == fasterButton)
31573353 {
31583354 copy.Faster();
31593355 copy.Touch();
31603356 objEditor.refreshContents();
3161
- } else if (event.getSource() == remarkButton)
3357
+ } else if (source == remarkButton)
31623358 {
31633359 copy.Remark();
31643360 copy.Touch();
31653361 objEditor.refreshContents();
3166
- } else if (event.getSource() == stepAllButton)
3362
+ } else if (source == stepAllButton)
31673363 {
31683364 copy.StepAll();
31693365 copy.Touch();
31703366 objEditor.refreshContents();
3171
- } else if (event.getSource() == resetAllButton)
3367
+ } else if (source == resetAllButton)
31723368 {
31733369 //CameraPane.fullreset = true;
31743370 copy.ResetAll(); // ResetMeshes();
....@@ -3201,53 +3397,79 @@
32013397 // Close();
32023398 // }
32033399 // else
3204
- if (event.getSource() == resetSlidersButton)
3400
+ if (source == resetSlidersButton)
32053401 {
32063402 ResetSliders();
3207
- } else if (event.getSource() == clearMaterialButton)
3403
+ } else if (source == clearMaterialButton)
32083404 {
32093405 ClearMaterial();
3210
- } else if (event.getSource() == createMaterialButton)
3406
+ } else if (source == createMaterialButton)
32113407 {
32123408 CreateMaterial();
3213
- } else if (event.getSource() == clearPanelButton)
3409
+ } else if (source == clearPanelButton)
32143410 {
32153411 copy.ClearUI();
32163412 refreshContents(true);
3217
- } /*
3218
- }
3219
-
3220
- public boolean action(Event event, Object arg)
3221
- {
3222
- */ 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)
32233438 {
32243439 Close();
32253440 //return true;
3226
- } else if (event.getSource() == loadItem)
3441
+ } else if (source == openItem)
32273442 {
3228
- load();
3443
+ Open();
32293444 //return true;
3230
- } else if (event.getSource() == saveItem)
3445
+ } else if (source == newItem)
3446
+ {
3447
+ New();
3448
+ } else if (source == saveItem)
32313449 {
32323450 save();
32333451 //return true;
3234
- } else if (event.getSource() == saveAsItem)
3452
+ } else if (source == saveAsItem)
32353453 {
32363454 saveAs();
32373455 //return true;
3238
- } else if (event.getSource() == reexportItem)
3456
+ } else if (source == reexportItem)
32393457 {
32403458 reexport();
32413459 //return true;
3242
- } else if (event.getSource() == exportAsItem)
3460
+ } else if (source == exportAsItem)
32433461 {
32443462 export();
32453463 //return true;
3246
- } else if (event.getSource() == povItem)
3464
+ } else if (source == povItem)
32473465 {
32483466 generatePOV();
32493467 //return true;
3250
- } else if (event.getSource() == zBufferItem)
3468
+ } else if (event.getSource() == archiveItem)
3469
+ {
3470
+ cTools.Archive(frame);
3471
+ return;
3472
+ } else if (source == zBufferItem)
32513473 {
32523474 try
32533475 {
....@@ -3269,21 +3491,8 @@
32693491 cameraView.repaint();
32703492 //return true;
32713493 }
3272
- */ else if (event.getSource() == editCameraItem)
3273
- {
3274
- cameraView.ProtectCamera();
3275
- cameraView.repaint();
3276
- return;
3277
- } else if (event.getSource() == revertCameraItem)
3278
- {
3279
- cameraView.RevertCamera();
3280
- cameraView.repaint();
3281
- return;
3282
-// } else if (event.getSource() == textureButton)
3283
-// {
3284
-// return; // true;
3285
- } else // combos...
3286
- if (event.getSource() == texresMenu)
3494
+ */ else // combos...
3495
+ if (source == texresMenu)
32873496 {
32883497 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32893498 copy.texres = texresMenu.getSelectedIndex();
....@@ -3295,27 +3504,424 @@
32953504 }
32963505 }
32973506
3298
- void ToggleAnimation()
3507
+ void New()
32993508 {
3300
- if (!CameraPane.ANIMATION)
3509
+ while (copy.Size() > 1)
33013510 {
3302
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
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);
33033875 browser.show();
33043876 String filename = browser.getFile();
33053877 if (filename != null && filename.length() > 0)
33063878 {
3307
- CameraPane.filename = browser.getDirectory() + filename;
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
+
3904
+ void ToggleAnimation()
3905
+ {
3906
+ if (!Globals.ANIMATION)
3907
+ {
3908
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
3909
+ browser.setVisible(true);
3910
+ String filename = browser.getFile();
3911
+ if (filename != null && filename.length() > 0)
3912
+ {
3913
+ Globals.filename = browser.getDirectory() + filename;
33083914 //CameraPane.framecount = 0;
3309
- CameraPane.imagecount = 0;
3915
+ Globals.imagecount = 0;
33103916
3311
- CameraPane.ANIMATION ^= true;
3917
+ Globals.ANIMATION ^= true;
33123918
3313
- GrafreeD.wav.cursor = 0;
3314
- GrafreeD.wav.loop = 0;
3919
+ Grafreed.wav.cursor = 0;
3920
+ Grafreed.wav.loop = 0;
33153921 }
33163922 } else
33173923 {
3318
- CameraPane.ANIMATION ^= true;
3924
+ Globals.ANIMATION ^= true;
33193925 }
33203926 }
33213927
....@@ -3361,7 +3967,7 @@
33613967 void CreateMaterial()
33623968 {
33633969 //copy.ClearMaterial(); // PATCH
3364
- copy.CreateMaterialS(multiplyToggle.isSelected());
3970
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
33653971 if (copy.selection.size() > 0)
33663972 //SetMaterial(copy);
33673973 {
....@@ -3412,7 +4018,7 @@
34124018 assert false;
34134019 }
34144020
3415
- void EditSelection()
4021
+ void EditSelection(boolean newWindow)
34164022 {
34174023 }
34184024
....@@ -3420,11 +4026,11 @@
34204026 {
34214027 copy.ResetBlockLoop(); // temporary problem
34224028
3423
- boolean random = CameraPane.RANDOM;
3424
- CameraPane.RANDOM = false; // parse everything
4029
+ boolean random = CameraPane.SWITCH;
4030
+ CameraPane.SWITCH = false; // parse everything
34254031 copy.ResetDisplayList();
34264032 copy.HardTouch();
3427
- CameraPane.RANDOM = random;
4033
+ CameraPane.SWITCH = random;
34284034 }
34294035
34304036 // public void applySelf()
....@@ -3494,10 +4100,40 @@
34944100 current.fakedepth = (float) fakedepthField.getFloat();
34954101 current.shadowbias = (float) shadowbiasField.getFloat();
34964102
3497
- if (!NumberSlider.frozen)
4103
+ if (!cNumberSlider.frozen)
34984104 {
34994105 //System.out.println("Propagate = " + propagate);
35004106 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
+
35014137 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
35024138 {
35034139 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3526,9 +4162,25 @@
35264162 //copy.Touch();
35274163 }
35284164
4165
+ cNumberSlider versionSlider;
4166
+
35294167 public void stateChanged(ChangeEvent e)
35304168 {
35314169 // 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
+ }
35324184
35334185 if (freezematerial)
35344186 {
....@@ -3542,6 +4194,7 @@
35424194 || e.getSource() == apertureField
35434195 || e.getSource() == shadowblurField)
35444196 {
4197
+ new Exception().printStackTrace();
35454198 System.exit(0);
35464199 cameraView.options1[0] = (float) focusField.getFloat() * 10;
35474200 cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
....@@ -3612,7 +4265,7 @@
36124265 }
36134266
36144267 if (normalpushField != null)
3615
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
4268
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
36164269 }
36174270
36184271 void SnapObject()
....@@ -3867,7 +4520,7 @@
38674520
38684521 radioPanel.revalidate();
38694522 radioPanel.repaint();
3870
- ctrlPanel.revalidate(); // ? new
4523
+ ctrlPanel.validate(); // ? new
38714524 ctrlPanel.repaint();
38724525 }
38734526 }
....@@ -3876,6 +4529,8 @@
38764529
38774530 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38784531 {
4532
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4533
+ Save();
38794534 //Tween.set(thing, 0).target(1).start(tweenManager);
38804535 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38814536 // if (thing instanceof GenericJointDemo)
....@@ -3962,6 +4617,12 @@
39624617 {
39634618 ResetModel();
39644619 Select(thing.GetTreePath(), true, false); // unselect... false);
4620
+
4621
+ if (thing.Size() == 0)
4622
+ {
4623
+ //EditSelection(false);
4624
+ }
4625
+
39654626 refreshContents();
39664627 }
39674628
....@@ -4079,6 +4740,7 @@
40794740 }
40804741 }
40814742 }
4743
+
40824744 LoadGFDThread loadGFDThread;
40834745
40844746 void ReadGFD(String fullname, iCallBack cb)
....@@ -4098,8 +4760,10 @@
40984760
40994761 try
41004762 {
4763
+ // Try compressed version first.
41014764 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4102
- 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);
41034767
41044768 readobj = (Object3D) p.readObject();
41054769 istream.close();
....@@ -4107,7 +4771,22 @@
41074771 readobj.ResetDisplayList();
41084772 } catch (Exception e)
41094773 {
4110
- 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
+ }
41114790 }
41124791 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
41134792 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4153,6 +4832,12 @@
41534832
41544833 void LoadIt(Object obj)
41554834 {
4835
+ if (obj == null)
4836
+ {
4837
+ // Invalid file
4838
+ return;
4839
+ }
4840
+
41564841 System.out.println("Loaded " + obj);
41574842 //new Exception().printStackTrace();
41584843 Object3D readobj = (Object3D) obj;
....@@ -4162,10 +4847,14 @@
41624847
41634848 if (readobj != null)
41644849 {
4850
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4851
+ // Save();
41654852 try
41664853 {
41674854 //readobj.deepCopySelf(copy);
41684855 copy.clear(); // june 2014
4856
+ copy.skyboxname = readobj.skyboxname;
4857
+ copy.skyboxext = readobj.skyboxext;
41694858 for (int i = 0; i < readobj.size(); i++)
41704859 {
41714860 Object3D child = readobj.get(i); // reserve(i);
....@@ -4206,6 +4895,7 @@
42064895 }
42074896 } catch (ClassCastException e)
42084897 {
4898
+ e.printStackTrace();
42094899 assert (false);
42104900 Composite c = (Composite) copy;
42114901 c.children.clear();
....@@ -4216,15 +4906,26 @@
42164906 c.addChild(csg);
42174907 }
42184908
4909
+ copy.versions = readobj.versions;
4910
+ copy.versionindex = readobj.versionindex;
4911
+
4912
+ if (copy.versions == null)
4913
+ {
4914
+ copy.versions = new byte[100][];
4915
+ copy.versionindex = -1;
4916
+ }
4917
+
4918
+ //? SetUndoStates();
4919
+
42194920 ResetModel();
42204921 copy.HardTouch(); // recompile?
42214922 refreshContents();
42224923 }
42234924 }
42244925
4225
- void load() // throws ClassNotFoundException
4926
+ void Open() // throws ClassNotFoundException
42264927 {
4227
- if (GrafreeD.standAlone)
4928
+ if (Grafreed.standAlone)
42284929 {
42294930 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
42304931 browser.show();
....@@ -4311,11 +5012,13 @@
43115012 try
43125013 {
43135014 FileOutputStream ostream = new FileOutputStream(lastname);
4314
- ObjectOutputStream p = new ObjectOutputStream(ostream);
5015
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5016
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43155017
43165018 p.writeObject(copy);
43175019 p.flush();
43185020
5021
+ zstream.close();
43195022 ostream.close();
43205023
43215024 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4323,19 +5026,23 @@
43235026 //ps.print(buffer.toString());
43245027 } catch (IOException e)
43255028 {
5029
+ e.printStackTrace();
43265030 }
43275031 }
5032
+
43285033 String lastname;
43295034
43305035 void saveAs()
43315036 {
4332
- if (GrafreeD.standAlone)
5037
+ if (Grafreed.standAlone)
43335038 {
43345039 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
43355040 browser.setVisible(true);
43365041 String filename = browser.getFile();
43375042 if (filename != null && filename.length() > 0)
43385043 {
5044
+ if (!filename.endsWith(".gfd"))
5045
+ filename += ".gfd";
43395046 lastname = browser.getDirectory() + filename;
43405047 save();
43415048 }
....@@ -4434,13 +5141,13 @@
44345141 try
44355142 {
44365143 FileOutputStream ostream = new FileOutputStream(filename);
4437
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4438
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
5144
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
5145
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
44395146
44405147 Object3D objectparent = obj.parent;
44415148 obj.parent = null;
44425149
4443
- Object3D object = (Object3D) GrafreeD.clone(obj);
5150
+ Object3D object = (Object3D) Grafreed.clone(obj);
44445151
44455152 obj.parent = objectparent;
44465153
....@@ -4452,8 +5159,8 @@
44525159 p.writeObject(object);
44535160 p.flush();
44545161
5162
+ zstream.close();
44555163 ostream.close();
4456
- // zstream.close();
44575164
44585165 // group.selection.get(0).parent = parent;
44595166 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4474,7 +5181,7 @@
44745181 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44755182 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44765183 copy.generatePOV(buffer);
4477
- if (GrafreeD.standAlone)
5184
+ if (Grafreed.standAlone)
44785185 {
44795186 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44805187 browser.show();
....@@ -4500,21 +5207,20 @@
45005207 Object3D client;
45015208 Object3D copy;
45025209 MenuBar menuBar;
4503
- Menu windowMenu;
4504
- MenuItem loadItem;
5210
+ Menu fileMenu;
5211
+ MenuItem newItem;
5212
+ MenuItem openItem;
45055213 MenuItem saveItem;
45065214 MenuItem saveAsItem;
45075215 MenuItem exportAsItem;
45085216 MenuItem reexportItem;
45095217 MenuItem povItem;
45105218 MenuItem closeItem;
4511
- Menu cameraMenu;
5219
+
45125220 CheckboxMenuItem zBufferItem;
45135221 //MenuItem normalLensItem;
4514
- MenuItem editCameraItem;
4515
- MenuItem revertCameraItem;
4516
- CheckboxMenuItem toggleLiveItem;
45175222 MenuItem stepItem;
5223
+ CheckboxMenuItem toggleLiveItem;
45185224 CheckboxMenuItem toggleFullScreenItem;
45195225 CheckboxMenuItem toggleTimelineItem;
45205226 CheckboxMenuItem toggleRenderItem;
....@@ -4523,28 +5229,42 @@
45235229 CheckboxMenuItem toggleFootContactItem;
45245230 CheckboxMenuItem toggleDLItem;
45255231 CheckboxMenuItem toggleTextureItem;
4526
- CheckboxMenuItem toggleRandomItem;
5232
+ CheckboxMenuItem toggleSwitchItem;
45275233 CheckboxMenuItem toggleRootItem;
45285234 CheckboxMenuItem animationItem;
5235
+ MenuItem archiveItem;
45295236 CheckboxMenuItem toggleHandleItem;
45305237 CheckboxMenuItem togglePaintItem;
45315238 JSplitPane mainPanel;
45325239 JScrollPane scrollpane;
5240
+
45335241 JPanel toolbarPanel;
4534
- JPanel treePanel;
5242
+
5243
+ cGridBag treePanel;
5244
+
45355245 JPanel radioPanel;
45365246 ButtonGroup buttonGroup;
4537
- JPanel ctrlPanel;
4538
- JPanel materialPanel;
5247
+
5248
+ cGridBag toolboxPanel;
5249
+ cGridBag materialPanel;
5250
+ cGridBag ctrlPanel;
5251
+
45395252 JScrollPane infoPanel;
4540
- JPanel optionsPanel;
5253
+
5254
+ cGridBag optionsPanel;
5255
+
45415256 JTabbedPane objectPanel;
4542
- JPanel XYZPanel;
5257
+ boolean materialFlushed;
5258
+ Object3D latestObject;
5259
+
5260
+ cGridBag XYZPanel;
5261
+
45435262 JSplitPane gridPanel;
45445263 JSplitPane bigPanel;
4545
- JPanel bigThree;
4546
- JTabbedPane scenePanel;
4547
- JPanel centralPanel;
5264
+
5265
+ cGridBag bigThree;
5266
+ cGridBag scenePanel;
5267
+ cGridBag centralPanel;
45485268 JSplitPane cameraPanel;
45495269 JPanel timelinePanel;
45505270 JMenuBar timelineMenubar;
....@@ -4597,67 +5317,72 @@
45975317 // MATERIAL
45985318 JLabel materialLabel;
45995319 JLabel colorLabel;
4600
- NumberSlider colorField;
5320
+ cNumberSlider colorField;
46015321 JLabel modulationLabel;
4602
- NumberSlider modulationField;
5322
+ cNumberSlider modulationField;
46035323 JLabel metalnessLabel;
4604
- NumberSlider metalnessField;
5324
+ cNumberSlider metalnessField;
46055325 JLabel diffuseLabel;
4606
- NumberSlider diffuseField;
5326
+ cNumberSlider diffuseField;
46075327 JLabel specularLabel;
4608
- NumberSlider specularField;
5328
+ cNumberSlider specularField;
46095329 JLabel shininessLabel;
4610
- NumberSlider shininessField;
5330
+ cNumberSlider shininessField;
46115331 JLabel shiftLabel;
4612
- NumberSlider shiftField;
5332
+ cNumberSlider shiftField;
46135333 JLabel ambientLabel;
4614
- NumberSlider ambientField;
5334
+ cNumberSlider ambientField;
46155335 JLabel lightareaLabel;
4616
- NumberSlider lightareaField;
5336
+ cNumberSlider lightareaField;
46175337 JLabel diffusenessLabel;
4618
- NumberSlider diffusenessField;
5338
+ cNumberSlider diffusenessField;
46195339 JLabel velvetLabel;
4620
- NumberSlider velvetField;
5340
+ cNumberSlider velvetField;
46215341 JLabel sheenLabel;
4622
- NumberSlider sheenField;
5342
+ cNumberSlider sheenField;
46235343 JLabel subsurfaceLabel;
4624
- NumberSlider subsurfaceField;
5344
+ cNumberSlider subsurfaceField;
46255345 //JLabel bumpLabel;
46265346 //NumberSlider bumpField;
46275347 JLabel backlitLabel;
4628
- NumberSlider backlitField;
5348
+ cNumberSlider backlitField;
46295349 JLabel anisoLabel;
4630
- NumberSlider anisoField;
5350
+ cNumberSlider anisoField;
46315351 JLabel anisoVLabel;
4632
- NumberSlider anisoVField;
5352
+ cNumberSlider anisoVField;
46335353 JLabel cameraLabel;
4634
- NumberSlider cameraField;
5354
+ cNumberSlider cameraField;
46355355 JLabel selfshadowLabel;
4636
- NumberSlider selfshadowField;
5356
+ cNumberSlider selfshadowField;
46375357 JLabel shadowLabel;
4638
- NumberSlider shadowField;
5358
+ cNumberSlider shadowField;
46395359 JLabel textureLabel;
4640
- NumberSlider textureField;
5360
+ cNumberSlider textureField;
46415361 JLabel opacityLabel;
4642
- NumberSlider opacityField;
5362
+ cNumberSlider opacityField;
46435363 JLabel fakedepthLabel;
4644
- NumberSlider fakedepthField;
5364
+ cNumberSlider fakedepthField;
46455365 JLabel shadowbiasLabel;
4646
- NumberSlider shadowbiasField;
5366
+ cNumberSlider shadowbiasField;
46475367 JLabel bumpLabel;
4648
- NumberSlider bumpField;
5368
+ cNumberSlider bumpField;
46495369 JLabel noiseLabel;
4650
- NumberSlider noiseField;
5370
+ cNumberSlider noiseField;
46515371 JLabel powerLabel;
4652
- NumberSlider powerField;
5372
+ cNumberSlider powerField;
46535373 JLabel borderfadeLabel;
4654
- NumberSlider borderfadeField;
5374
+ cNumberSlider borderfadeField;
46555375 JLabel fogLabel;
4656
- NumberSlider fogField;
5376
+ cNumberSlider fogField;
46575377 JLabel opacityPowerLabel;
4658
- NumberSlider opacityPowerField;
4659
- JTree jTree;
5378
+ cNumberSlider opacityPowerField;
5379
+ cTree jTree;
46605380 //ObjectUI parent;
46615381
4662
- NumberSlider normalpushField;
5382
+ cNumberSlider normalpushField;
5383
+
5384
+ private MenuItem importGFDItem;
5385
+ private MenuItem importVRMLX3DItem;
5386
+ private MenuItem import3DSItem;
5387
+ private MenuItem importOBJItem;
46635388 }