Normand Briere
2019-08-13 c67de8aca04d988179191ccb52461af00125920e
ObjEditor.java
....@@ -15,6 +15,9 @@
1515 //import javax.swing.plaf.ColorUIResource;
1616 //import javax.swing.plaf.metal.DefaultMetalTheme;
1717
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1821 //import javax.media.opengl.GLCanvas;
1922
2023 import //weka.core.
....@@ -31,6 +34,7 @@
3134 iSendInfo
3235 //KeyListener
3336 {
37
+ public cToggleButton pinButton;
3438 boolean timeline;
3539 boolean wasFullScreen;
3640
....@@ -38,51 +42,78 @@
3842 JFrame frame;
3943
4044 static ObjEditor theFrame;
45
+
46
+ public cGridBag GetSeparator()
47
+ {
48
+ cGridBag separator = new cGridBag();
49
+ separator.add(new JSeparator());
50
+ separator.preferredHeight = 5;
51
+ return separator;
52
+ }
4153
4254 cButton GetButton(String name, boolean border)
4355 {
44
- try
45
- {
46
- ImageIcon icon = GetIcon(name);
47
- return new cButton(icon, border);
48
- }
49
- catch (Exception e)
50
- {
51
- return new cButton(name, border);
52
- }
56
+ ImageIcon icon = GetIcon(name);
57
+ return new cButton(icon, border);
58
+ }
59
+
60
+ cLabel GetLabel(String name, boolean border)
61
+ {
62
+ //ImageIcon icon = GetIcon(name);
63
+ return new cLabel(GetImage(name), border);
64
+ }
65
+
66
+ cToggleButton GetToggleButton(String name, boolean border)
67
+ {
68
+ ImageIcon icon = GetIcon(name);
69
+ return new cToggleButton(icon, border);
5370 }
5471
5572 cCheckBox GetCheckBox(String name, boolean border)
5673 {
74
+ ImageIcon icon = GetIcon(name);
75
+ return new cCheckBox(icon, border);
76
+ }
77
+
78
+ ImageIcon GetIcon(String name)
79
+ {
5780 try
5881 {
59
- ImageIcon icon = GetIcon(name);
60
- return new cCheckBox(icon, border);
82
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
83
+
84
+// if (image.getWidth() > 48 && image.getHeight() > 48)
85
+// {
86
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
87
+// Graphics2D g = resized.createGraphics();
88
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
89
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
90
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
91
+// g.dispose();
92
+//
93
+// image = resized;
94
+// }
95
+
96
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
97
+ return icon;
6198 }
6299 catch (Exception e)
63100 {
64
- return new cCheckBox(name, border);
101
+ return null;
65102 }
66103 }
67
-
68
- private ImageIcon GetIcon(String name) throws IOException
104
+
105
+ BufferedImage GetImage(String name)
69106 {
70
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
71
-
72
- if (image.getWidth() != 24 && image.getHeight() != 24)
107
+ try
73108 {
74
- BufferedImage resized = new BufferedImage(24, 24, image.getType());
75
- Graphics2D g = resized.createGraphics();
76
- g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
77
- //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
78
- g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
79
- g.dispose();
80
-
81
- image = resized;
109
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
110
+
111
+ return image;
82112 }
83
-
84
- javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
85
- return icon;
113
+ catch (Exception e)
114
+ {
115
+ return null;
116
+ }
86117 }
87118
88119 // SCRIPT
....@@ -194,7 +225,7 @@
194225
195226 objEditor.ctrlPanel.remove(namePanel);
196227
197
- if (!GroupEditor.allparams)
228
+ if (!allparams)
198229 return;
199230
200231 // objEditor.ctrlPanel.remove(liveCB);
....@@ -266,6 +297,14 @@
266297 client = inClient;
267298 copy = client;
268299
300
+// if (copy.versionlist == null)
301
+// {
302
+// copy.versionlist = new Object3D[100];
303
+// copy.versionindex = -1;
304
+//
305
+// callee.Save(true);
306
+// }
307
+
269308 // "this" is not called: SetupUI2(objEditor);
270309 }
271310
....@@ -279,6 +318,14 @@
279318 client = inClient;
280319 copy = client;
281320
321
+ if (copy.versionlist == null)
322
+ {
323
+ copy.versionlist = new Object3D[100];
324
+ copy.versionindex = -1;
325
+
326
+// Save(true);
327
+ }
328
+
282329 SetupUI2(callee.GetEditor());
283330 }
284331
....@@ -293,7 +340,7 @@
293340 //localCopy.parent = null;
294341
295342 frame = new JFrame();
296
- frame.setUndecorated(true);
343
+ frame.setUndecorated(false);
297344 objEditor = this;
298345 this.callee = callee;
299346
....@@ -311,6 +358,14 @@
311358 copy = localCopy;
312359 copy.editWindow = this;
313360
361
+// if (copy.versionlist == null)
362
+// {
363
+// copy.versionlist = new Object3D[100];
364
+// copy.versionindex = -1;
365
+//
366
+// Save(true);
367
+// }
368
+
314369 SetupMenu();
315370
316371 //SetupName(objEditor); // new
....@@ -324,12 +379,17 @@
324379 return frame.action(event, obj);
325380 }
326381
382
+ // Cannot work without static
383
+ static boolean allparams = true;
384
+
385
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
386
+
327387 void SetupMenu()
328388 {
329389 frame.setMenuBar(menuBar = new MenuBar());
330390 menuBar.add(fileMenu = new Menu("File"));
331391 fileMenu.add(newItem = new MenuItem("New"));
332
- fileMenu.add(loadItem = new MenuItem("Open..."));
392
+ fileMenu.add(openItem = new MenuItem("Open..."));
333393
334394 //oe.menuBar.add(menu = new Menu("Include"));
335395 Menu menu = new Menu("Import");
....@@ -361,7 +421,7 @@
361421 }
362422
363423 newItem.addActionListener(this);
364
- loadItem.addActionListener(this);
424
+ openItem.addActionListener(this);
365425 saveItem.addActionListener(this);
366426 saveAsItem.addActionListener(this);
367427 exportAsItem.addActionListener(this);
....@@ -370,13 +430,71 @@
370430 closeItem.addActionListener(this);
371431
372432 objectPanel = new JTabbedPane();
433
+
434
+ ChangeListener changeListener = new ChangeListener()
435
+ {
436
+ String name;
437
+
438
+ public void stateChanged(ChangeEvent changeEvent)
439
+ {
440
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
441
+// {
442
+// if (latestObject != null)
443
+// {
444
+// refreshContents(true);
445
+// SetMaterial(latestObject);
446
+// }
447
+//
448
+// materialFlushed = true;
449
+// }
450
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
451
+// {
452
+// if (listUI.size() == 0)
453
+// EditSelection(false);
454
+// }
455
+
456
+ if (objectPanel.getSelectedIndex() == 4)
457
+ {
458
+ name = copy.skyboxname;
459
+
460
+ if (name == null)
461
+ {
462
+ name = "";
463
+ }
464
+
465
+ copy.skyboxname = "cubemaps/default-skyboxes/rgb";
466
+ copy.skyboxext = "jpg";
467
+ }
468
+ else
469
+ {
470
+ if (name != null)
471
+ {
472
+ if (name.equals(""))
473
+ {
474
+ copy.skyboxname = null;
475
+ copy.skyboxext = null;
476
+ }
477
+ else
478
+ {
479
+ copy.skyboxname = name;
480
+ }
481
+ }
482
+ }
483
+
484
+// refreshContents(false); // To refresh Info tab
485
+ cameraView.repaint();
486
+ }
487
+ };
488
+ objectPanel.addChangeListener(changeListener);
489
+
373490 toolbarPanel = new JPanel();
374491 toolbarPanel.setName("Toolbar");
492
+
375493 treePanel = new cGridBag();
376494 treePanel.setName("Tree");
377495
378496 editPanel = new cGridBag().setVertical(true);
379
- editPanel.setName("Edit");
497
+ //editPanel.setName("Edit");
380498
381499 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
382500
....@@ -384,23 +502,29 @@
384502 editPanel.add(editCommandsPanel);
385503 editPanel.add(ctrlPanel);
386504
387
- materialPanel = new cGridBag().setVertical(true);
505
+ toolboxPanel = new cGridBag().setVertical(true);
506
+ //toolboxPanel.setName("Toolbox");
388507
389
- materialPanel.setName("Material");
508
+ skyboxPanel = new cGridBag().setVertical(true);
509
+
510
+ materialPanel = new cGridBag().setVertical(false);
511
+ //materialPanel.setName("Material");
512
+
390513 /*JTextPane*/
391514 infoarea = createTextPane();
392515 doc = infoarea.getStyledDocument();
393516
394517 infoarea.setEditable(true);
395518 SetText();
519
+
396520 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
397521 // infoarea.setOpaque(false);
398522 // //infoarea.setForeground(textcolor);
399523 // TEXTAREA infoarea.setLineWrap(true);
400524 // TEXTAREA infoarea.setWrapStyleWord(true);
401525 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
402
- infoPanel.setPreferredSize(new Dimension(50, 200));
403
- infoPanel.setName("Info");
526
+ infoPanel.setPreferredSize(new Dimension(1, 1));
527
+ //infoPanel.setName("Info");
404528 //infoPanel.setLayout(new BorderLayout());
405529 //infoPanel.add(createTextPane());
406530
....@@ -411,7 +535,14 @@
411535 mainPanel.setDividerSize(9);
412536 mainPanel.setDividerLocation(0.5); //1.0);
413537 mainPanel.setResizeWeight(0.5);
414
-
538
+
539
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
540
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
541
+ divider.setDividerSize(15);
542
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
543
+
544
+ mainPanel.setUI(new BasicSplitPaneUI());
545
+
415546 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
416547 //mainPanel.setLayout(new GridBagLayout());
417548 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -642,8 +773,8 @@
642773 }
643774 }
644775
645
-static GraphicsDevice device = GraphicsEnvironment
646
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
776
+//static GraphicsDevice device = GraphicsEnvironment
777
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
647778
648779 Rectangle keeprect;
649780 cRadio radio;
....@@ -659,13 +790,25 @@
659790
660791 boolean maximized;
661792
793
+ cButton fullscreenLayout;
794
+ cButton expandedLayout;
795
+
662796 void Minimize()
663797 {
664798 frame.setState(Frame.ICONIFIED);
799
+ frame.validate();
665800 }
666801
802
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
803
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
804
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
667805 void Maximize()
668806 {
807
+ if (CameraPane.FULLSCREEN)
808
+ {
809
+ ToggleFullScreen();
810
+ }
811
+
669812 if (maximized)
670813 {
671814 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -673,20 +816,38 @@
673816 else
674817 {
675818 keeprect = frame.getBounds();
676
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
677
- Dimension rect2 = frame.getToolkit().getScreenSize();
678
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
819
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
820
+// Dimension rect2 = frame.getToolkit().getScreenSize();
821
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
679822 // frame.setState(Frame.MAXIMIZED_BOTH);
823
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
680824 }
681825
682826 maximized ^= true;
827
+
828
+ frame.validate();
683829 }
830
+
831
+ cButton minButton;
832
+ cButton maxButton;
833
+ cButton fullButton;
834
+ cButton collapseButton;
835
+ cButton maximize3DButton;
684836
685837 void ToggleFullScreen()
686838 {
687
- if (CameraPane.FULLSCREEN)
839
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
840
+
841
+ cameraView.ToggleFullScreen();
842
+
843
+ if (!CameraPane.FULLSCREEN)
688844 {
689845 device.setFullScreenWindow(null);
846
+ frame.dispose();
847
+ frame.setUndecorated(false);
848
+ frame.validate();
849
+ frame.setVisible(true);
850
+
690851 //frame.setVisible(false);
691852 // frame.removeNotify();
692853 // frame.setUndecorated(false);
....@@ -696,13 +857,13 @@
696857 // X frame.getContentPane().remove(/*"Center",*/bigThree);
697858 // X framePanel.add(bigThree);
698859 // X frame.getContentPane().add(/*"Center",*/framePanel);
699
- framePanel.setDividerLocation(1);
860
+// framePanel.setDividerLocation(46); // icons are 24x24
700861
701862 //frame.setVisible(true);
702
- radio.layout = keepButton;
863
+// radio.layout = keepButton;
703864 //theFrame = null;
704865 keepButton = null;
705
- radio.layout.doClick();
866
+// radio.layout.doClick();
706867
707868 } else
708869 {
....@@ -711,22 +872,59 @@
711872 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
712873 // frame.getToolkit().getScreenSize().height);
713874 //frame.setVisible(false);
875
+
876
+ frame.dispose();
877
+ frame.setUndecorated(true);
714878 device.setFullScreenWindow(frame);
879
+ frame.validate();
880
+ frame.setVisible(true);
715881 // frame.removeNotify();
716882 // frame.setUndecorated(true);
717883 // frame.addNotify();
718884 // X frame.getContentPane().remove(/*"Center",*/framePanel);
719885 // X framePanel.remove(bigThree);
720886 // X frame.getContentPane().add(/*"Center",*/bigThree);
721
- framePanel.setDividerLocation(0);
887
+// framePanel.setDividerLocation(0);
722888
723
- radio.layout = twoButton;
724
- radio.layout.doClick();
889
+// radio.layout = fullscreenLayout;
890
+// radio.layout.doClick();
725891 //frame.setVisible(true);
726892 }
727
-
728
- cameraView.ToggleFullScreen();
893
+ frame.validate();
894
+
895
+ cameraView.requestFocusInWindow();
729896 }
897
+
898
+ void CollapseToolbar()
899
+ {
900
+ framePanel.setDividerLocation(0);
901
+ //frame.validate();
902
+
903
+ cameraView.requestFocusInWindow();
904
+ }
905
+
906
+ private Object3D Duplicate(Object3D object)
907
+ {
908
+ boolean temp = CameraPane.SWITCH;
909
+ CameraPane.SWITCH = false;
910
+
911
+ object.ExtractBigData(versiontable);
912
+ // if (copy == client)
913
+
914
+ Object3D versions[] = object.versionlist;
915
+ object.versionlist = null;
916
+
917
+ //byte[] compress = Compress(copy);
918
+ Object3D compress = (Object3D)Grafreed.clone(object);
919
+
920
+ object.versionlist = versions;
921
+
922
+ object.RestoreBigData(versiontable);
923
+
924
+ CameraPane.SWITCH = temp;
925
+
926
+ return compress;
927
+ }
730928
731929 private JTextPane createTextPane()
732930 {
....@@ -849,6 +1047,7 @@
8491047 {
8501048 SetupMaterial(materialPanel);
8511049 }
1050
+
8521051 //SetupName();
8531052 //SetupViews();
8541053 }
....@@ -858,7 +1057,7 @@
8581057 // NumberSlider vDivsField;
8591058 // JCheckBox endcaps;
8601059 JCheckBox liveCB;
861
- JCheckBox selectCB;
1060
+ JCheckBox selectableCB;
8621061 JCheckBox hideCB;
8631062 JCheckBox link2masterCB;
8641063 JCheckBox markCB;
....@@ -866,7 +1065,12 @@
8661065 JCheckBox speedupCB;
8671066 JCheckBox rewindCB;
8681067 JCheckBox flipVCB;
1068
+
1069
+ cCheckBox toggleTextureCB;
1070
+ cCheckBox toggleSwitchCB;
1071
+
8691072 JComboBox texresMenu;
1073
+
8701074 JButton resetButton;
8711075 JButton stepButton;
8721076 JButton stepAllButton;
....@@ -1052,39 +1256,55 @@
10521256
10531257 namePanel = new cGridBag();
10541258
1259
+ //if (copy.pinned)
1260
+ {
1261
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1262
+ pinButton.setSelected(copy.pinned);
1263
+ cGridBag t = new cGridBag();
1264
+ t.preferredWidth = 2;
1265
+ t.add(pinButton);
1266
+ namePanel.add(t);
1267
+
1268
+ pinButton.addItemListener(this);
1269
+ }
1270
+
10551271 nameField = AddText(namePanel, copy.GetName());
1056
- namePanel.add(nameField);
1272
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
10571273 oe.ctrlPanel.add(namePanel);
10581274
10591275 oe.ctrlPanel.Return();
10601276
1061
- if (!GroupEditor.allparams)
1277
+ if (!allparams)
10621278 return;
10631279
10641280 setupPanel = new cGridBag().setVertical(false);
10651281
10661282 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
10671283 liveCB.setToolTipText("Animate object");
1068
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1069
- selectCB.setToolTipText("Make object selectable");
1284
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1285
+ selectableCB.setToolTipText("Make object selectable");
10701286 // Return();
1287
+
10711288 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10721289 hideCB.setToolTipText("Hide object");
10731290 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1074
- markCB.setToolTipText("Set the animation target transform");
1291
+ markCB.setToolTipText("As animation target transform");
1292
+
1293
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10751294
10761295 setupPanel2 = new cGridBag().setVertical(false);
10771296
10781297 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10791298 rewindCB.setToolTipText("Rewind animation");
10801299
1081
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1082
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1300
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1301
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10831302
1303
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1304
+ link2masterCB.setToolTipText("Attach to support");
1305
+
10841306 if (Globals.ADVANCED)
10851307 {
1086
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1087
- link2masterCB.setToolTipText("Attach to support");
10881308 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
10891309 speedupCB.setToolTipText("Option motion capture");
10901310 }
....@@ -1358,6 +1578,7 @@
13581578 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
13591579 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
13601580 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1581
+ //XYZPanel.setName("XYZ");
13611582
13621583 /*
13631584 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1395,13 +1616,29 @@
13951616 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
13961617 //tmp.setName("Edit");
13971618 objectPanel.add(materialPanel);
1619
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1620
+ objectPanel.setToolTipTextAt(0, "Material");
1621
+
1622
+ objectPanel.add(toolboxPanel);
1623
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1624
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1625
+
1626
+ objectPanel.add(skyboxPanel);
1627
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1628
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1629
+
13981630 // JPanel north = new JPanel(new BorderLayout());
13991631 // north.setName("Edit");
14001632 // north.add(ctrlPanel, BorderLayout.NORTH);
14011633 // objectPanel.add(north);
14021634 objectPanel.add(editPanel);
1403
- objectPanel.add(infoPanel);
1404
-
1635
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1636
+ objectPanel.setToolTipTextAt(3, "Edit controls");
1637
+
1638
+ objectPanel.add(XYZPanel);
1639
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1640
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1641
+
14051642 /*
14061643 aConstraints.gridx = 0;
14071644 aConstraints.gridwidth = 1;
....@@ -1409,7 +1646,7 @@
14091646 aConstraints.gridy += 1;
14101647 aConstraints.gridwidth = 1;
14111648 mainPanel.add(objectPanel, aConstraints);
1412
- */
1649
+ */
14131650
14141651 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14151652 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1421,14 +1658,12 @@
14211658 scrollpane.addMouseWheelListener(this); // Default not fast enough
14221659
14231660 /*JTabbedPane*/ scenePanel = new cGridBag();
1424
- scenePanel.preferredWidth = 6;
1661
+ scenePanel.preferredWidth = 5;
14251662
14261663 JTabbedPane tabbedPane = new JTabbedPane();
14271664 tabbedPane.add(scrollpane);
14281665
1429
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1430
-
1431
- optionsPanel = new cGridBag().setVertical(true);
1666
+ optionsPanel = new cGridBag().setVertical(false);
14321667
14331668 optionsPanel.setName("Options");
14341669
....@@ -1436,8 +1671,15 @@
14361671
14371672 tabbedPane.add(optionsPanel);
14381673
1674
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1675
+
14391676 scenePanel.add(tabbedPane);
14401677
1678
+ //if (Globals.ADVANCED)
1679
+ tabbedPane.add(infoPanel);
1680
+ tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1681
+ tabbedPane.setToolTipTextAt(3, "Information");
1682
+
14411683 /*
14421684 cTree jTree = new cTree(null);
14431685 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1499,7 +1741,7 @@
14991741 bigThree = new cGridBag();
15001742 bigThree.addComponent(scenePanel);
15011743 bigThree.addComponent(centralPanel);
1502
- bigThree.addComponent(XYZPanel);
1744
+ //bigThree.addComponent(XYZPanel);
15031745
15041746 // // SIDE EFFECT!!!
15051747 // aConstraints.gridx = 0;
....@@ -1508,9 +1750,26 @@
15081750 // aConstraints.gridheight = 1;
15091751
15101752 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1511
- framePanel.setContinuousLayout(true);
1512
- framePanel.setOneTouchExpandable(true);
1513
- framePanel.setDividerLocation(0.8);
1753
+
1754
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1755
+ new java.beans.PropertyChangeListener()
1756
+ {
1757
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1758
+ {
1759
+ if ((Integer)pce.getOldValue() == 1)
1760
+ {
1761
+ if (radio.layout != expandedLayout)
1762
+ {
1763
+ radio.layout = expandedLayout;
1764
+ radio.layout.doClick();
1765
+ }
1766
+ }
1767
+ }
1768
+ });
1769
+
1770
+ framePanel.setContinuousLayout(false);
1771
+ framePanel.setOneTouchExpandable(false);
1772
+ //.setDividerLocation(0.8);
15141773 //framePanel.setDividerSize(15);
15151774 //framePanel.setResizeWeight(0.15);
15161775 framePanel.setName("Frame");
....@@ -1528,16 +1787,18 @@
15281787 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
15291788
15301789 frame.setSize(1280, 860);
1531
- frame.setVisible(true);
1532
-
1790
+
15331791 cameraView.requestFocusInWindow();
15341792
15351793 gridPanel.setDividerLocation(1.0);
1794
+
1795
+ frame.validate();
1796
+
1797
+ frame.setVisible(true);
15361798
15371799 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
15381800 frame.addWindowListener(new WindowAdapter()
15391801 {
1540
-
15411802 public void windowClosing(WindowEvent e)
15421803 {
15431804 Close();
....@@ -1560,12 +1821,403 @@
15601821 ctrlPanel.removeAll();
15611822 }
15621823
1563
- void SetupMaterial(cGridBag panel)
1824
+ void SetupMaterial(cGridBag materialpanel)
15641825 {
1565
- /*
1826
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1827
+
1828
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1829
+ skin.setToolTipText("Skin");
1830
+ skin.addMouseListener(new MouseAdapter()
1831
+ {
1832
+ public void mouseClicked(MouseEvent e)
1833
+ {
1834
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1835
+ cMaterial material = object.material;
1836
+
1837
+ // Skin
1838
+ colorField.setFloat(material.color);
1839
+ saturationField.setFloat(material.modulation);
1840
+ subsurfaceField.setFloat(material.subsurface);
1841
+ selfshadowField.setFloat(material.diffuseness);
1842
+ diffusenessField.setFloat(material.factor);
1843
+ shininessField.setFloat(material.shininess);
1844
+ shadowbiasField.setFloat(material.shadowbias);
1845
+ diffuseField.setFloat(material.diffuse);
1846
+ specularField.setFloat(material.specular);
1847
+
1848
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1849
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1850
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1851
+
1852
+ materialtouched = true;
1853
+ applySelf();
1854
+ }
1855
+ });
1856
+ presetpanel.add(skin);
1857
+
1858
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1859
+ lambert.setToolTipText("Diffuse");
1860
+ lambert.addMouseListener(new MouseAdapter()
1861
+ {
1862
+ public void mouseClicked(MouseEvent e)
1863
+ {
1864
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1865
+ cMaterial material = object.material;
1866
+
1867
+ diffusenessField.setFloat(material.factor);
1868
+ selfshadowField.setFloat(material.diffuseness);
1869
+
1870
+ materialtouched = true;
1871
+ applySelf();
1872
+ }
1873
+ });
1874
+ presetpanel.add(lambert);
1875
+
1876
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1877
+ diffuse2.setToolTipText("Diffuse2");
1878
+ diffuse2.addMouseListener(new MouseAdapter()
1879
+ {
1880
+ public void mouseClicked(MouseEvent e)
1881
+ {
1882
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1883
+ cMaterial material = object.material;
1884
+
1885
+ diffusenessField.setFloat(material.factor);
1886
+ selfshadowField.setFloat(material.diffuseness);
1887
+
1888
+ materialtouched = true;
1889
+ applySelf();
1890
+ }
1891
+ });
1892
+ presetpanel.add(diffuse2);
1893
+
1894
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1895
+ diffusemoon.setToolTipText("Moon");
1896
+ diffusemoon.addMouseListener(new MouseAdapter()
1897
+ {
1898
+ public void mouseClicked(MouseEvent e)
1899
+ {
1900
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1901
+ cMaterial material = object.material;
1902
+
1903
+ diffusenessField.setFloat(material.factor);
1904
+ selfshadowField.setFloat(material.diffuseness);
1905
+
1906
+ materialtouched = true;
1907
+ applySelf();
1908
+ }
1909
+ });
1910
+ presetpanel.add(diffusemoon);
1911
+
1912
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1913
+ diffusemoon2.setToolTipText("Moon2");
1914
+ diffusemoon2.addMouseListener(new MouseAdapter()
1915
+ {
1916
+ public void mouseClicked(MouseEvent e)
1917
+ {
1918
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1919
+ cMaterial material = object.material;
1920
+
1921
+ diffusenessField.setFloat(material.factor);
1922
+ selfshadowField.setFloat(material.diffuseness);
1923
+
1924
+ materialtouched = true;
1925
+ applySelf();
1926
+ }
1927
+ });
1928
+ presetpanel.add(diffusemoon2);
1929
+
1930
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1931
+ diffusemoon3.setToolTipText("Moon3");
1932
+ diffusemoon3.addMouseListener(new MouseAdapter()
1933
+ {
1934
+ public void mouseClicked(MouseEvent e)
1935
+ {
1936
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1937
+ cMaterial material = object.material;
1938
+
1939
+ diffusenessField.setFloat(material.factor);
1940
+ selfshadowField.setFloat(material.diffuseness);
1941
+
1942
+ materialtouched = true;
1943
+ applySelf();
1944
+ }
1945
+ });
1946
+ presetpanel.add(diffusemoon3);
1947
+
1948
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1949
+ diffusesheen.setToolTipText("Sheen");
1950
+ diffusesheen.addMouseListener(new MouseAdapter()
1951
+ {
1952
+ public void mouseClicked(MouseEvent e)
1953
+ {
1954
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1955
+ cMaterial material = object.material;
1956
+
1957
+ sheenField.setFloat(material.sheen);
1958
+
1959
+ materialtouched = true;
1960
+ applySelf();
1961
+ }
1962
+ });
1963
+ presetpanel.add(diffusesheen);
1964
+
1965
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1966
+ rough.setToolTipText("Rough metal");
1967
+ rough.addMouseListener(new MouseAdapter()
1968
+ {
1969
+ public void mouseClicked(MouseEvent e)
1970
+ {
1971
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1972
+ cMaterial material = object.material;
1973
+
1974
+ shininessField.setFloat(material.shininess);
1975
+ velvetField.setFloat(material.velvet);
1976
+
1977
+ materialtouched = true;
1978
+ applySelf();
1979
+ }
1980
+ });
1981
+ presetpanel.add(rough);
1982
+
1983
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
1984
+ rough2.setToolTipText("Medium metal");
1985
+ rough2.addMouseListener(new MouseAdapter()
1986
+ {
1987
+ public void mouseClicked(MouseEvent e)
1988
+ {
1989
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
1990
+ cMaterial material = object.material;
1991
+
1992
+ shininessField.setFloat(material.shininess);
1993
+ lightareaField.setFloat(material.lightarea);
1994
+
1995
+ materialtouched = true;
1996
+ applySelf();
1997
+ }
1998
+ });
1999
+ presetpanel.add(rough2);
2000
+
2001
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2002
+ shini0.setToolTipText("Shiny");
2003
+ shini0.addMouseListener(new MouseAdapter()
2004
+ {
2005
+ public void mouseClicked(MouseEvent e)
2006
+ {
2007
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2008
+ cMaterial material = object.material;
2009
+
2010
+ shininessField.setFloat(material.shininess);
2011
+ lightareaField.setFloat(material.lightarea);
2012
+
2013
+ materialtouched = true;
2014
+ applySelf();
2015
+ }
2016
+ });
2017
+ presetpanel.add(shini0);
2018
+
2019
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2020
+ shini1.setToolTipText("Shiny2");
2021
+ shini1.addMouseListener(new MouseAdapter()
2022
+ {
2023
+ public void mouseClicked(MouseEvent e)
2024
+ {
2025
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2026
+ cMaterial material = object.material;
2027
+
2028
+ shininessField.setFloat(material.shininess);
2029
+ lightareaField.setFloat(material.lightarea);
2030
+
2031
+ materialtouched = true;
2032
+ applySelf();
2033
+ }
2034
+ });
2035
+ presetpanel.add(shini1);
2036
+
2037
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2038
+ shini2.setToolTipText("Shiny3");
2039
+ shini2.addMouseListener(new MouseAdapter()
2040
+ {
2041
+ public void mouseClicked(MouseEvent e)
2042
+ {
2043
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2044
+ cMaterial material = object.material;
2045
+
2046
+ shininessField.setFloat(material.shininess);
2047
+ lightareaField.setFloat(material.lightarea);
2048
+
2049
+ materialtouched = true;
2050
+ applySelf();
2051
+ }
2052
+ });
2053
+ presetpanel.add(shini2);
2054
+
2055
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2056
+ aniso.setToolTipText("AnisoU");
2057
+ aniso.addMouseListener(new MouseAdapter()
2058
+ {
2059
+ public void mouseClicked(MouseEvent e)
2060
+ {
2061
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2062
+ cMaterial material = object.material;
2063
+
2064
+ anisoField.setFloat(material.aniso);
2065
+ anisoVField.setFloat(material.anisoV);
2066
+
2067
+ materialtouched = true;
2068
+ applySelf();
2069
+ }
2070
+ });
2071
+ presetpanel.add(aniso);
2072
+
2073
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2074
+ aniso2.setToolTipText("AnisoV");
2075
+ aniso2.addMouseListener(new MouseAdapter()
2076
+ {
2077
+ public void mouseClicked(MouseEvent e)
2078
+ {
2079
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2080
+ cMaterial material = object.material;
2081
+
2082
+ anisoField.setFloat(material.aniso);
2083
+ anisoVField.setFloat(material.anisoV);
2084
+
2085
+ materialtouched = true;
2086
+ applySelf();
2087
+ }
2088
+ });
2089
+ presetpanel.add(aniso2);
2090
+
2091
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2092
+ aniso3.setToolTipText("AnisoUV");
2093
+ aniso3.addMouseListener(new MouseAdapter()
2094
+ {
2095
+ public void mouseClicked(MouseEvent e)
2096
+ {
2097
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2098
+ cMaterial material = object.material;
2099
+
2100
+ anisoField.setFloat(material.aniso);
2101
+ anisoVField.setFloat(material.anisoV);
2102
+
2103
+ materialtouched = true;
2104
+ applySelf();
2105
+ }
2106
+ });
2107
+ presetpanel.add(aniso3);
2108
+
2109
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2110
+ velvet0.setToolTipText("Velvet");
2111
+ velvet0.addMouseListener(new MouseAdapter()
2112
+ {
2113
+ public void mouseClicked(MouseEvent e)
2114
+ {
2115
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2116
+ cMaterial material = object.material;
2117
+
2118
+ diffusenessField.setFloat(material.factor);
2119
+ selfshadowField.setFloat(material.diffuseness);
2120
+ sheenField.setFloat(material.sheen);
2121
+ shininessField.setFloat(material.shininess);
2122
+ velvetField.setFloat(material.velvet);
2123
+ shiftField.setFloat(material.shift);
2124
+
2125
+ materialtouched = true;
2126
+ applySelf();
2127
+ }
2128
+ });
2129
+ presetpanel.add(velvet0);
2130
+
2131
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2132
+ bump0.setToolTipText("Bump texture");
2133
+ bump0.addMouseListener(new MouseAdapter()
2134
+ {
2135
+ public void mouseClicked(MouseEvent e)
2136
+ {
2137
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2138
+ cMaterial material = object.material;
2139
+
2140
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2141
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2142
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2143
+
2144
+ materialtouched = true;
2145
+ applySelf();
2146
+ }
2147
+ });
2148
+ presetpanel.add(bump0);
2149
+
2150
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2151
+ halo.setToolTipText("Halo");
2152
+ halo.addMouseListener(new MouseAdapter()
2153
+ {
2154
+ public void mouseClicked(MouseEvent e)
2155
+ {
2156
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2157
+ cMaterial material = object.material;
2158
+
2159
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2160
+
2161
+ materialtouched = true;
2162
+ applySelf();
2163
+ }
2164
+ });
2165
+ presetpanel.add(halo);
2166
+
2167
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2168
+ candle.setToolTipText("Candle");
2169
+ candle.addMouseListener(new MouseAdapter()
2170
+ {
2171
+ public void mouseClicked(MouseEvent e)
2172
+ {
2173
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2174
+ cMaterial material = object.material;
2175
+
2176
+ subsurfaceField.setFloat(material.subsurface);
2177
+ shadowbiasField.setFloat(material.shadowbias);
2178
+ ambientField.setFloat(material.ambient);
2179
+ specularField.setFloat(material.specular);
2180
+ lightareaField.setFloat(material.lightarea);
2181
+ shininessField.setFloat(material.shininess);
2182
+
2183
+ materialtouched = true;
2184
+ applySelf();
2185
+ }
2186
+ });
2187
+ presetpanel.add(candle);
2188
+
2189
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2190
+ shadowShader.setToolTipText("Shadow");
2191
+ shadowShader.addMouseListener(new MouseAdapter()
2192
+ {
2193
+ public void mouseClicked(MouseEvent e)
2194
+ {
2195
+ diffuseField.setFloat(0.001);
2196
+ ambientField.setFloat(0.001);
2197
+ cameraField.setFloat(0.001);
2198
+ specularField.setFloat(0.001);
2199
+ fakedepthField.setFloat(0.001);
2200
+ opacityField.setFloat(0.6);
2201
+
2202
+ materialtouched = true;
2203
+ applySelf();
2204
+ }
2205
+ });
2206
+ presetpanel.add(shadowShader);
2207
+
2208
+ cGridBag panel = new cGridBag().setVertical(true);
2209
+
2210
+ presetpanel.preferredWidth = 1;
2211
+
2212
+ materialpanel.add(presetpanel);
2213
+ materialpanel.add(panel);
2214
+
2215
+ panel.preferredWidth = 8;
2216
+
2217
+ /*
15662218 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
15672219 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1568
- */
2220
+ */
15692221
15702222 cGridBag editBar = new cGridBag().setVertical(false);
15712223
....@@ -1599,45 +2251,50 @@
15992251 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16002252
16012253 cGridBag colorSection = new cGridBag().setVertical(true);
2254
+
2255
+ cGridBag huepanel = new cGridBag();
2256
+ cGridBag huelabel = new cGridBag();
2257
+ skin = GetLabel("icons/hue.png", false);
2258
+ skin.fit = true;
2259
+ huelabel.add(skin);
2260
+ huelabel.preferredWidth = 20;
2261
+ huepanel.add(new cGridBag()); // Label
2262
+ huepanel.add(huelabel); // Field/slider
2263
+
2264
+ huepanel.preferredHeight = 7;
2265
+
2266
+ colorSection.add(huepanel);
16022267
16032268 cGridBag color = new cGridBag();
1604
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1605
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1606
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2269
+
2270
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2271
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2272
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2273
+
16072274 //colorField.preferredWidth = 200;
16082275 colorSection.add(color);
16092276
16102277 cGridBag modulation = new cGridBag();
16112278 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
16122279 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1613
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2280
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
16142281 colorSection.add(modulation);
16152282
2283
+ cGridBag opacity = new cGridBag();
2284
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2285
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2286
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2287
+ colorSection.add(opacity);
2288
+
2289
+ colorSection.add(GetSeparator());
2290
+
16162291 cGridBag texture = new cGridBag();
16172292 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
16182293 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16192294 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16202295 colorSection.add(texture);
16212296
1622
- cGridBag anisoU = new cGridBag();
1623
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1624
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1625
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1626
- colorSection.add(anisoU);
1627
-
1628
- cGridBag anisoV = new cGridBag();
1629
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1630
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1631
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1632
- colorSection.add(anisoV);
1633
-
1634
- cGridBag shadowbias = new cGridBag();
1635
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1636
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1637
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1638
- colorSection.add(shadowbias);
1639
-
1640
- panel.add(new JSeparator());
2297
+ panel.add(GetSeparator());
16412298
16422299 panel.add(colorSection);
16432300
....@@ -1687,7 +2344,13 @@
16872344 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16882345 diffuseSection.add(fakedepth);
16892346
1690
- panel.add(new JSeparator());
2347
+ cGridBag shadowbias = new cGridBag();
2348
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
2349
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2350
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
2351
+ diffuseSection.add(shadowbias);
2352
+
2353
+ panel.add(GetSeparator());
16912354
16922355 panel.add(diffuseSection);
16932356
....@@ -1737,42 +2400,48 @@
17372400 // aConstraints.gridy += 1;
17382401 // aConstraints.gridwidth = 1;
17392402
2403
+ cGridBag anisoU = new cGridBag();
2404
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
2405
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2406
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2407
+ specularSection.add(anisoU);
17402408
1741
- panel.add(new JSeparator());
2409
+ cGridBag anisoV = new cGridBag();
2410
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
2411
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2412
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2413
+ specularSection.add(anisoV);
2414
+
2415
+
2416
+ panel.add(GetSeparator());
17422417
17432418 panel.add(specularSection);
17442419
17452420 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17462421
1747
- cGridBag globalSection = new cGridBag().setVertical(true);
2422
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17482423
17492424 cGridBag camera = new cGridBag();
17502425 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
17512426 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17522427 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1753
- globalSection.add(camera);
2428
+ colorSection.add(camera);
17542429
17552430 cGridBag ambient = new cGridBag();
17562431 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
17572432 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17582433 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1759
- globalSection.add(ambient);
2434
+ colorSection.add(ambient);
17602435
17612436 cGridBag backlit = new cGridBag();
17622437 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17632438 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17642439 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1765
- globalSection.add(backlit);
2440
+ colorSection.add(backlit);
17662441
1767
- cGridBag opacity = new cGridBag();
1768
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1769
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1770
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1771
- globalSection.add(opacity);
1772
-
1773
- panel.add(new JSeparator());
2442
+ //panel.add(new JSeparator());
17742443
1775
- panel.add(globalSection);
2444
+ //panel.add(globalSection);
17762445
17772446 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17782447
....@@ -1814,7 +2483,7 @@
18142483 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
18152484 textureSection.add(opacityPower);
18162485
1817
- panel.add(new JSeparator());
2486
+ panel.add(GetSeparator());
18182487
18192488 panel.add(textureSection);
18202489
....@@ -1879,8 +2548,9 @@
18792548 // 3D models
18802549 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18812550 {
1882
- lastConverter = new com.jmex.model.converters.MaxToJme();
1883
- LoadFile(filename, lastConverter);
2551
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2552
+ //LoadFile(filename, lastConverter);
2553
+ LoadObjFile(filename); // New 3ds loader
18842554 continue;
18852555 }
18862556 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2606,6 +3276,7 @@
26063276 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
26073277 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
26083278 }
3279
+
26093280 //cJME.count++;
26103281 //cJME.count %= 12;
26113282 if (gc)
....@@ -2789,6 +3460,7 @@
27893460 }
27903461 }
27913462 }
3463
+
27923464 cFileSystemPane FSPane;
27933465
27943466 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2798,7 +3470,7 @@
27983470
27993471 freezematerial = true;
28003472 colorField.setFloat(mat.color);
2801
- modulationField.setFloat(mat.modulation);
3473
+ saturationField.setFloat(mat.modulation);
28023474 metalnessField.setFloat(mat.metalness);
28033475 diffuseField.setFloat(mat.diffuse);
28043476 specularField.setFloat(mat.specular);
....@@ -2842,11 +3514,14 @@
28423514 }
28433515 }
28443516 }
3517
+
28453518 freezematerial = false;
28463519 }
28473520
28483521 void SetMaterial(Object3D object)
28493522 {
3523
+ latestObject = object;
3524
+
28503525 cMaterial mat = object.material;
28513526
28523527 if (mat == null)
....@@ -2958,12 +3633,17 @@
29583633 // }
29593634
29603635 /**/
2961
- if (deselect)
3636
+ if (deselect || child == null)
29623637 {
29633638 //group.deselectAll();
29643639 //freeze = true;
29653640 GetTree().clearSelection();
29663641 //freeze = false;
3642
+
3643
+ if (child == null)
3644
+ {
3645
+ return;
3646
+ }
29673647 }
29683648
29693649 //group.addSelectee(child);
....@@ -2997,6 +3677,17 @@
29973677 public void itemStateChanged(ItemEvent event)
29983678 {
29993679 // System.out.println("Propagate = " + propagate);
3680
+ if (event.getSource() == pinButton)
3681
+ {
3682
+ copy.pinned ^= true;
3683
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3684
+ {
3685
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3686
+ copy.CloseUI();
3687
+ //copy.editWindow.refreshContents();
3688
+ }
3689
+ }
3690
+ else
30003691 if (event.getSource() == propagateToggle)
30013692 {
30023693 propagate ^= true;
....@@ -3032,7 +3723,7 @@
30323723 cameraView.ToggleDL();
30333724 cameraView.repaint();
30343725 return;
3035
- } else if (event.getSource() == toggleTextureItem)
3726
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30363727 {
30373728 cameraView.ToggleTexture();
30383729 // june 2013 copy.HardTouch();
....@@ -3071,7 +3762,7 @@
30713762 frame.validate();
30723763
30733764 return;
3074
- } else if (event.getSource() == toggleSwitchItem)
3765
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30753766 {
30763767 cameraView.ToggleSwitch();
30773768 cameraView.repaint();
....@@ -3101,8 +3792,9 @@
31013792 } else if (event.getSource() == liveCB)
31023793 {
31033794 copy.live ^= true;
3795
+ objEditor.refreshContents(true); // To show item colors
31043796 return;
3105
- } else if (event.getSource() == selectCB)
3797
+ } else if (event.getSource() == selectableCB)
31063798 {
31073799 copy.dontselect ^= true;
31083800 return;
....@@ -3110,7 +3802,7 @@
31103802 {
31113803 copy.hide ^= true;
31123804 copy.Touch(); // display list issue
3113
- objEditor.refreshContents();
3805
+ objEditor.refreshContents(true); // To show item colors
31143806 return;
31153807 } else if (event.getSource() == link2masterCB)
31163808 {
....@@ -3287,9 +3979,9 @@
32873979 {
32883980 Close();
32893981 //return true;
3290
- } else if (source == loadItem)
3982
+ } else if (source == openItem)
32913983 {
3292
- load();
3984
+ Open();
32933985 //return true;
32943986 } else if (source == newItem)
32953987 {
....@@ -3314,6 +4006,10 @@
33144006 {
33154007 generatePOV();
33164008 //return true;
4009
+ } else if (event.getSource() == archiveItem)
4010
+ {
4011
+ cTools.Archive(frame);
4012
+ return;
33174013 } else if (source == zBufferItem)
33184014 {
33194015 try
....@@ -3362,11 +4058,12 @@
33624058
33634059 static public byte[] Compress(Object3D o)
33644060 {
4061
+ // Slower to actually compress.
33654062 try
33664063 {
33674064 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3368
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3369
- ObjectOutputStream out = new ObjectOutputStream(zstream);
4065
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
4066
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
33704067
33714068 Object3D parent = o.parent;
33724069 o.parent = null;
....@@ -3377,10 +4074,14 @@
33774074
33784075 out.flush();
33794076
3380
- zstream.close();
4077
+ baos //zstream
4078
+ .close();
33814079 out.close();
33824080
3383
- return baos.toByteArray();
4081
+ byte[] bytes = baos.toByteArray();
4082
+
4083
+ System.out.println("save #bytes = " + bytes.length);
4084
+ return bytes;
33844085 } catch (Exception e)
33854086 {
33864087 System.err.println(e);
....@@ -3390,13 +4091,16 @@
33904091
33914092 static public Object Uncompress(byte[] bytes)
33924093 {
3393
- System.out.println("#bytes = " + bytes.length);
4094
+ System.out.println("restore #bytes = " + bytes.length);
33944095 try
33954096 {
33964097 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3397
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3398
- ObjectInputStream in = new ObjectInputStream(istream);
4098
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
4099
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
33994100 Object obj = in.readObject();
4101
+
4102
+ bais //istream
4103
+ .close();
34004104 in.close();
34014105
34024106 return obj;
....@@ -3451,39 +4155,95 @@
34514155 return null;
34524156 }
34534157
3454
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
34554158
34564159 public void Save()
34574160 {
4161
+ //Save(true);
4162
+ Replace();
4163
+ SetVersionStates();
4164
+ }
4165
+
4166
+ private boolean Equal(byte[] compress, byte[] name)
4167
+ {
4168
+ if (compress.length != name.length)
4169
+ {
4170
+ return false;
4171
+ }
4172
+
4173
+ for (int i=compress.length; --i>=0;)
4174
+ {
4175
+ if (compress[i] != name[i])
4176
+ return false;
4177
+ }
4178
+
4179
+ return true;
4180
+ }
4181
+
4182
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4183
+
4184
+ void DeleteVersion()
4185
+ {
4186
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4187
+ {
4188
+ copy.versionlist[i] = copy.versionlist[i+1];
4189
+ }
4190
+
4191
+ CopyChanged();
4192
+
4193
+ SetVersionStates();
4194
+ }
4195
+
4196
+ public boolean Save(boolean user)
4197
+ {
34584198 System.err.println("Save");
4199
+ Replace();
34594200
3460
- cRadio tab = GetCurrentTab();
4201
+ //cRadio tab = GetCurrentTab();
34614202
3462
- boolean temp = CameraPane.SWITCH;
3463
- CameraPane.SWITCH = false;
4203
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
34644204
3465
- copy.ExtractBigData(hashtable);
4205
+ boolean thesame = false;
4206
+
4207
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4208
+// {
4209
+// thesame = true;
4210
+// }
34664211
34674212 //EditorFrame.m_MainFrame.requestFocusInWindow();
3468
- tab.graphs[tab.undoindex++] = Compress(copy);
3469
-
3470
- copy.RestoreBigData(hashtable);
3471
-
3472
- CameraPane.SWITCH = temp;
3473
-
3474
- //assert(hashtable.isEmpty());
3475
-
3476
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
4213
+ if (!thesame)
34774214 {
3478
- tab.graphs[i] = null;
4215
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4216
+ {
4217
+ copy.versionlist[i] = copy.versionlist[i-1];
4218
+ }
4219
+
4220
+ //tab.user[tab.versionindex] = user;
4221
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
4222
+
4223
+ copy.versionlist[++copy.versionindex] = compress;
4224
+
4225
+ // if (increment)
4226
+ // tab.versionindex++;
34794227 }
34804228
4229
+ //copy.RestoreBigData(versiontable);
4230
+
4231
+ //assert(hashtable.isEmpty());
4232
+
4233
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4234
+// {
4235
+// //tab.user[i] = false;
4236
+// copy.versionlist[i] = null;
4237
+// }
4238
+
4239
+ SetVersionStates();
4240
+
34814241 // test save
34824242 if (false)
34834243 {
34844244 try
34854245 {
3486
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
4246
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
34874247 ObjectOutputStream p = new ObjectOutputStream(ostream);
34884248
34894249 p.writeObject(copy);
....@@ -3496,26 +4256,68 @@
34964256 e.printStackTrace();
34974257 }
34984258 }
4259
+
4260
+ return !thesame;
4261
+ }
4262
+
4263
+ boolean flashIt = true;
4264
+
4265
+ void RefreshSelection()
4266
+ {
4267
+ Object3D selection = new Object3D();
4268
+
4269
+ for (int i = 0; i < copy.selection.size(); i++)
4270
+ {
4271
+ Object3D elem = copy.selection.elementAt(i);
4272
+
4273
+ Object3D obj = copy.GetObject(elem.GetUUID());
4274
+
4275
+ if (obj == null)
4276
+ {
4277
+ copy.selection.remove(i--);
4278
+ }
4279
+ else
4280
+ {
4281
+ selection.add(obj);
4282
+ copy.selection.setElementAt(obj, i);
4283
+ }
4284
+ }
4285
+
4286
+ flashIt = false;
4287
+ GetTree().clearSelection();
4288
+ for (int i = 0; i < selection.size(); i++)
4289
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4290
+ flashIt = true;
4291
+
4292
+ //refreshContents(false);
34994293 }
35004294
3501
- void CopyChanged(Object3D obj)
4295
+ void CopyChanged()
35024296 {
4297
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4298
+
4299
+ SetVersionStates();
4300
+
35034301 boolean temp = CameraPane.SWITCH;
35044302 CameraPane.SWITCH = false;
35054303
3506
- copy.ExtractBigData(hashtable);
4304
+ copy.ExtractBigData(versiontable);
35074305
35084306 copy.clear();
35094307
4308
+ copy.skyboxname = obj.skyboxname;
4309
+ copy.skyboxext = obj.skyboxext;
4310
+
35104311 for (int i=0; i<obj.Size(); i++)
35114312 {
35124313 copy.add(obj.get(i));
35134314 }
35144315
3515
- copy.RestoreBigData(hashtable);
4316
+ copy.RestoreBigData(versiontable);
35164317
35174318 CameraPane.SWITCH = temp;
35184319
4320
+ RefreshSelection();
35194321 //assert(hashtable.isEmpty());
35204322
35214323 copy.Touch();
....@@ -3536,45 +4338,144 @@
35364338 }
35374339 }
35384340
3539
- refreshContents();
4341
+ refreshContents(true);
35404342 }
35414343
3542
- public void Undo()
4344
+ cButton previousVersionButton;
4345
+ cButton restoreButton;
4346
+ cButton replaceButton;
4347
+ cButton nextVersionButton;
4348
+ cButton saveVersionButton;
4349
+ cButton deleteVersionButton;
4350
+
4351
+ boolean muteSlider;
4352
+
4353
+ int VersionCount()
35434354 {
4355
+ int count = 0;
4356
+
4357
+ for (int i = copy.versionlist.length; --i >= 0;)
4358
+ {
4359
+ if (copy.versionlist[i] != null)
4360
+ count++;
4361
+ }
4362
+
4363
+ return count;
4364
+ }
4365
+
4366
+ void SetVersionStates()
4367
+ {
4368
+ //if (true)
4369
+ // return;
4370
+
4371
+ //cRadio tab = GetCurrentTab();
4372
+
4373
+ restoreButton.setEnabled(copy.versionindex != -1);
4374
+ replaceButton.setEnabled(copy.versionindex != -1);
4375
+
4376
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4377
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4378
+
4379
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4380
+ copy.versionlist[copy.versionindex + 1] != null);
4381
+
4382
+ muteSlider = true;
4383
+ versionSlider.setMinimum(0);
4384
+ versionSlider.setMaximum(VersionCount() - 1);
4385
+ versionSlider.setInteger(copy.versionindex);
4386
+ versionSlider.setEnabled(copy.versionindex != -1);
4387
+ muteSlider = false;
4388
+ }
4389
+
4390
+ public boolean PreviousVersion()
4391
+ {
4392
+ // Option?
4393
+ Replace();
4394
+
35444395 System.err.println("Undo");
35454396
3546
- cRadio tab = GetCurrentTab();
4397
+ //cRadio tab = GetCurrentTab();
35474398
3548
- if (tab.undoindex == 0)
4399
+ if (copy.versionindex == 0)
35494400 {
35504401 java.awt.Toolkit.getDefaultToolkit().beep();
3551
- return;
4402
+ return false;
35524403 }
35534404
3554
- if (tab.graphs[tab.undoindex] == null)
3555
- {
3556
- Save();
3557
- tab.undoindex -= 1;
3558
- }
4405
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
4406
+// {
4407
+// if (Save(false))
4408
+// tab.versionindex -= 1;
4409
+// else
4410
+// {
4411
+// if (tab.versionindex <= 0)
4412
+// return false;
4413
+// else
4414
+// tab.versionindex -= 1;
4415
+// }
4416
+// }
35594417
3560
- tab.undoindex -= 1;
4418
+ copy.versionindex -= 1;
35614419
3562
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4420
+ CopyChanged();
4421
+
4422
+ return true;
35634423 }
35644424
3565
- public void Redo()
4425
+ public boolean Restore()
35664426 {
3567
- cRadio tab = GetCurrentTab();
4427
+ System.err.println("Restore");
35684428
3569
- if (tab.graphs[tab.undoindex + 1] == null)
4429
+ //cRadio tab = GetCurrentTab();
4430
+
4431
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4432
+ {
4433
+ java.awt.Toolkit.getDefaultToolkit().beep();
4434
+ return false;
4435
+ }
4436
+
4437
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4438
+ CopyChanged();
4439
+
4440
+ return true;
4441
+ }
4442
+
4443
+ public boolean Replace()
4444
+ {
4445
+ System.err.println("Replace");
4446
+
4447
+ //cRadio tab = GetCurrentTab();
4448
+
4449
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
4450
+ {
4451
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
4452
+ return false;
4453
+ }
4454
+
4455
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
4456
+
4457
+ return true;
4458
+ }
4459
+
4460
+ public void NextVersion()
4461
+ {
4462
+ // Option?
4463
+ Replace();
4464
+
4465
+ //cRadio tab = GetCurrentTab();
4466
+
4467
+ if (copy.versionlist[copy.versionindex + 1] == null)
35704468 {
35714469 java.awt.Toolkit.getDefaultToolkit().beep();
35724470 return;
35734471 }
35744472
3575
- tab.undoindex += 1;
4473
+ copy.versionindex += 1;
35764474
3577
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4475
+ CopyChanged();
4476
+
4477
+ //if (!tab.user[tab.versionindex])
4478
+ // tab.graphs[tab.versionindex] = null;
35784479 }
35794480
35804481 void ImportGFD()
....@@ -3726,7 +4627,7 @@
37264627 assert false;
37274628 }
37284629
3729
- void EditSelection()
4630
+ void EditSelection(boolean newWindow)
37304631 {
37314632 }
37324633
....@@ -3785,7 +4686,7 @@
37854686 //copy.material = new cMaterial(copy.GetMaterial());
37864687
37874688 current.color = (float) colorField.getFloat();
3788
- current.modulation = (float) modulationField.getFloat();
4689
+ current.modulation = (float) saturationField.getFloat();
37894690 current.metalness = (float) metalnessField.getFloat();
37904691 current.diffuse = (float) diffuseField.getFloat();
37914692 current.specular = (float) specularField.getFloat();
....@@ -3818,7 +4719,7 @@
38184719 cMaterial mat = copy.material;
38194720
38204721 colorField.SetToolTipValue((mat.color));
3821
- modulationField.SetToolTipValue((mat.modulation));
4722
+ saturationField.SetToolTipValue((mat.modulation));
38224723 metalnessField.SetToolTipValue((mat.metalness));
38234724 diffuseField.SetToolTipValue((mat.diffuse));
38244725 specularField.SetToolTipValue((mat.specular));
....@@ -3870,9 +4771,26 @@
38704771 //copy.Touch();
38714772 }
38724773
4774
+ cNumberSlider versionSlider;
4775
+
38734776 public void stateChanged(ChangeEvent e)
38744777 {
38754778 // assert(false);
4779
+ if (e.getSource() == versionSlider)
4780
+ {
4781
+ if (muteSlider)
4782
+ return;
4783
+
4784
+ int version = versionSlider.getInteger();
4785
+
4786
+ if (version != -1 && copy.versionlist[version] != null)
4787
+ {
4788
+ copy.versionindex = version;
4789
+ CopyChanged();
4790
+ }
4791
+
4792
+ return;
4793
+ }
38764794
38774795 if (freezematerial)
38784796 {
....@@ -3908,6 +4826,12 @@
39084826 {
39094827 //System.out.println("stateChanged = " + this);
39104828 materialtouched = true;
4829
+
4830
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4831
+ {
4832
+ saturationField.setFloat(1);
4833
+ }
4834
+
39114835 applySelf();
39124836 //System.out.println("this = " + this);
39134837 //System.out.println("PARENT = " + parent);
....@@ -4207,6 +5131,7 @@
42075131 {
42085132 if (GetTree() != null)
42095133 {
5134
+ GetTree().revalidate();
42105135 GetTree().repaint();
42115136 }
42125137
....@@ -4215,13 +5140,16 @@
42155140 ctrlPanel.validate(); // ? new
42165141 ctrlPanel.repaint();
42175142 }
5143
+
5144
+ if (previousVersionButton != null && copy.versionlist != null)
5145
+ SetVersionStates();
42185146 }
42195147
42205148 static TweenManager tweenManager = new TweenManager();
42215149
42225150 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
42235151 {
4224
- if (Globals.SAVEONMAKE)
5152
+ if (Globals.REPLACEONMAKE) // && resetmodel)
42255153 Save();
42265154 //Tween.set(thing, 0).target(1).start(tweenManager);
42275155 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4309,6 +5237,12 @@
43095237 {
43105238 ResetModel();
43115239 Select(thing.GetTreePath(), true, false); // unselect... false);
5240
+
5241
+ if (thing.Size() == 0)
5242
+ {
5243
+ //EditSelection(false);
5244
+ }
5245
+
43125246 refreshContents();
43135247 }
43145248
....@@ -4457,7 +5391,9 @@
44575391 readobj.ResetDisplayList();
44585392 } catch (Exception e)
44595393 {
4460
- //e.printStackTrace();
5394
+ if (!e.toString().contains("GZIP"))
5395
+ e.printStackTrace();
5396
+
44615397 try
44625398 {
44635399 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4531,12 +5467,14 @@
45315467
45325468 if (readobj != null)
45335469 {
4534
- if (Globals.SAVEONMAKE)
4535
- Save();
5470
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
5471
+ // Save();
45365472 try
45375473 {
45385474 //readobj.deepCopySelf(copy);
45395475 copy.clear(); // june 2014
5476
+ copy.skyboxname = readobj.skyboxname;
5477
+ copy.skyboxext = readobj.skyboxext;
45405478 for (int i = 0; i < readobj.size(); i++)
45415479 {
45425480 Object3D child = readobj.get(i); // reserve(i);
....@@ -4577,6 +5515,7 @@
45775515 }
45785516 } catch (ClassCastException e)
45795517 {
5518
+ e.printStackTrace();
45805519 assert (false);
45815520 Composite c = (Composite) copy;
45825521 c.children.clear();
....@@ -4587,17 +5526,31 @@
45875526 c.addChild(csg);
45885527 }
45895528
5529
+ copy.versionlist = readobj.versionlist;
5530
+ copy.versionindex = readobj.versionindex;
5531
+
5532
+ if (copy.versionlist == null)
5533
+ {
5534
+ // Backward compatibility
5535
+ copy.versionlist = new Object3D[100];
5536
+ copy.versionindex = -1;
5537
+
5538
+ Save(true);
5539
+ }
5540
+
5541
+ //? SetUndoStates();
5542
+
45905543 ResetModel();
45915544 copy.HardTouch(); // recompile?
45925545 refreshContents();
45935546 }
45945547 }
45955548
4596
- void load() // throws ClassNotFoundException
5549
+ void Open() // throws ClassNotFoundException
45975550 {
45985551 if (Grafreed.standAlone)
45995552 {
4600
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5553
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
46015554 browser.show();
46025555 String filename = browser.getFile();
46035556 if (filename != null && filename.length() > 0)
....@@ -4674,6 +5627,8 @@
46745627
46755628 void save()
46765629 {
5630
+ Replace();
5631
+
46775632 if (lastname == null)
46785633 {
46795634 return;
....@@ -4696,6 +5651,7 @@
46965651 //ps.print(buffer.toString());
46975652 } catch (IOException e)
46985653 {
5654
+ e.printStackTrace();
46995655 }
47005656 }
47015657
....@@ -4710,6 +5666,8 @@
47105666 String filename = browser.getFile();
47115667 if (filename != null && filename.length() > 0)
47125668 {
5669
+ if (!filename.endsWith(".gfd"))
5670
+ filename += ".gfd";
47135671 lastname = browser.getDirectory() + filename;
47145672 save();
47155673 }
....@@ -4876,7 +5834,7 @@
48765834 MenuBar menuBar;
48775835 Menu fileMenu;
48785836 MenuItem newItem;
4879
- MenuItem loadItem;
5837
+ MenuItem openItem;
48805838 MenuItem saveItem;
48815839 MenuItem saveAsItem;
48825840 MenuItem exportAsItem;
....@@ -4899,22 +5857,37 @@
48995857 CheckboxMenuItem toggleSwitchItem;
49005858 CheckboxMenuItem toggleRootItem;
49015859 CheckboxMenuItem animationItem;
5860
+ MenuItem archiveItem;
49025861 CheckboxMenuItem toggleHandleItem;
49035862 CheckboxMenuItem togglePaintItem;
49045863 JSplitPane mainPanel;
49055864 JScrollPane scrollpane;
5865
+
49065866 JPanel toolbarPanel;
5867
+
49075868 cGridBag treePanel;
5869
+
49085870 JPanel radioPanel;
49095871 ButtonGroup buttonGroup;
4910
- cGridBag ctrlPanel;
5872
+
5873
+ cGridBag toolboxPanel;
5874
+ cGridBag skyboxPanel;
49115875 cGridBag materialPanel;
5876
+ cGridBag ctrlPanel;
5877
+
49125878 JScrollPane infoPanel;
5879
+
49135880 cGridBag optionsPanel;
5881
+
49145882 JTabbedPane objectPanel;
5883
+ boolean materialFlushed;
5884
+ Object3D latestObject;
5885
+
49155886 cGridBag XYZPanel;
5887
+
49165888 JSplitPane gridPanel;
49175889 JSplitPane bigPanel;
5890
+
49185891 cGridBag bigThree;
49195892 cGridBag scenePanel;
49205893 cGridBag centralPanel;
....@@ -4972,7 +5945,7 @@
49725945 JLabel colorLabel;
49735946 cNumberSlider colorField;
49745947 JLabel modulationLabel;
4975
- cNumberSlider modulationField;
5948
+ cNumberSlider saturationField;
49765949 JLabel metalnessLabel;
49775950 cNumberSlider metalnessField;
49785951 JLabel diffuseLabel;
....@@ -5003,6 +5976,7 @@
50035976 cNumberSlider anisoField;
50045977 JLabel anisoVLabel;
50055978 cNumberSlider anisoVField;
5979
+
50065980 JLabel cameraLabel;
50075981 cNumberSlider cameraField;
50085982 JLabel selfshadowLabel;
....@@ -5017,6 +5991,7 @@
50175991 cNumberSlider fakedepthField;
50185992 JLabel shadowbiasLabel;
50195993 cNumberSlider shadowbiasField;
5994
+
50205995 JLabel bumpLabel;
50215996 cNumberSlider bumpField;
50225997 JLabel noiseLabel;
....@@ -5029,7 +6004,7 @@
50296004 cNumberSlider fogField;
50306005 JLabel opacityPowerLabel;
50316006 cNumberSlider opacityPowerField;
5032
- JTree jTree;
6007
+ cTree jTree;
50336008 //ObjectUI parent;
50346009
50356010 cNumberSlider normalpushField;