Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
ObjEditor.java
....@@ -52,6 +52,19 @@
5252 }
5353 }
5454
55
+ cToggleButton GetToggleButton(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cToggleButton(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cToggleButton(name, border);
65
+ }
66
+ }
67
+
5568 cCheckBox GetCheckBox(String name, boolean border)
5669 {
5770 try
....@@ -194,7 +207,7 @@
194207
195208 objEditor.ctrlPanel.remove(namePanel);
196209
197
- if (!GroupEditor.allparams)
210
+ if (!allparams)
198211 return;
199212
200213 // objEditor.ctrlPanel.remove(liveCB);
....@@ -324,6 +337,11 @@
324337 return frame.action(event, obj);
325338 }
326339
340
+ // Cannot work without static
341
+ static boolean allparams = true;
342
+
343
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
344
+
327345 void SetupMenu()
328346 {
329347 frame.setMenuBar(menuBar = new MenuBar());
....@@ -370,6 +388,32 @@
370388 closeItem.addActionListener(this);
371389
372390 objectPanel = new JTabbedPane();
391
+
392
+ ChangeListener changeListener = new ChangeListener()
393
+ {
394
+ public void stateChanged(ChangeEvent changeEvent)
395
+ {
396
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
397
+// {
398
+// if (latestObject != null)
399
+// {
400
+// refreshContents(true);
401
+// SetMaterial(latestObject);
402
+// }
403
+//
404
+// materialFlushed = true;
405
+// }
406
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
407
+// {
408
+// if (listUI.size() == 0)
409
+// EditSelection(false);
410
+// }
411
+
412
+ refreshContents(false); // To refresh Info tab
413
+ }
414
+ };
415
+ objectPanel.addChangeListener(changeListener);
416
+
373417 toolbarPanel = new JPanel();
374418 toolbarPanel.setName("Toolbar");
375419 treePanel = new cGridBag();
....@@ -384,9 +428,12 @@
384428 editPanel.add(editCommandsPanel);
385429 editPanel.add(ctrlPanel);
386430
387
- materialPanel = new cGridBag().setVertical(true);
431
+ toolboxPanel = new cGridBag().setVertical(false);
432
+ toolboxPanel.setName("Toolbox");
388433
434
+ materialPanel = new cGridBag().setVertical(true);
389435 materialPanel.setName("Material");
436
+
390437 /*JTextPane*/
391438 infoarea = createTextPane();
392439 doc = infoarea.getStyledDocument();
....@@ -659,6 +706,8 @@
659706
660707 boolean maximized;
661708
709
+ cButton fullscreenLayout;
710
+
662711 void Minimize()
663712 {
664713 frame.setState(Frame.ICONIFIED);
....@@ -684,7 +733,9 @@
684733
685734 void ToggleFullScreen()
686735 {
687
- if (CameraPane.FULLSCREEN)
736
+ cameraView.ToggleFullScreen();
737
+
738
+ if (!CameraPane.FULLSCREEN)
688739 {
689740 device.setFullScreenWindow(null);
690741 //frame.setVisible(false);
....@@ -720,12 +771,10 @@
720771 // X frame.getContentPane().add(/*"Center",*/bigThree);
721772 framePanel.setDividerLocation(0);
722773
723
- radio.layout = twoButton;
774
+ radio.layout = fullscreenLayout;
724775 radio.layout.doClick();
725776 //frame.setVisible(true);
726777 }
727
-
728
- cameraView.ToggleFullScreen();
729778 }
730779
731780 private JTextPane createTextPane()
....@@ -866,7 +915,12 @@
866915 JCheckBox speedupCB;
867916 JCheckBox rewindCB;
868917 JCheckBox flipVCB;
918
+
919
+ cCheckBox toggleTextureCB;
920
+ cCheckBox toggleSwitchCB;
921
+
869922 JComboBox texresMenu;
923
+
870924 JButton resetButton;
871925 JButton stepButton;
872926 JButton stepAllButton;
....@@ -1058,7 +1112,7 @@
10581112
10591113 oe.ctrlPanel.Return();
10601114
1061
- if (!GroupEditor.allparams)
1115
+ if (!allparams)
10621116 return;
10631117
10641118 setupPanel = new cGridBag().setVertical(false);
....@@ -1401,6 +1455,7 @@
14011455 // objectPanel.add(north);
14021456 objectPanel.add(editPanel);
14031457 objectPanel.add(infoPanel);
1458
+ objectPanel.add(toolboxPanel);
14041459
14051460 /*
14061461 aConstraints.gridx = 0;
....@@ -1409,7 +1464,7 @@
14091464 aConstraints.gridy += 1;
14101465 aConstraints.gridwidth = 1;
14111466 mainPanel.add(objectPanel, aConstraints);
1412
- */
1467
+ */
14131468
14141469 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14151470 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1426,9 +1481,7 @@
14261481 JTabbedPane tabbedPane = new JTabbedPane();
14271482 tabbedPane.add(scrollpane);
14281483
1429
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1430
-
1431
- optionsPanel = new cGridBag().setVertical(true);
1484
+ optionsPanel = new cGridBag().setVertical(false);
14321485
14331486 optionsPanel.setName("Options");
14341487
....@@ -1436,6 +1489,8 @@
14361489
14371490 tabbedPane.add(optionsPanel);
14381491
1492
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1493
+
14391494 scenePanel.add(tabbedPane);
14401495
14411496 /*
....@@ -1528,6 +1583,8 @@
15281583 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
15291584
15301585 frame.setSize(1280, 860);
1586
+
1587
+ frame.validate();
15311588 frame.setVisible(true);
15321589
15331590 cameraView.requestFocusInWindow();
....@@ -2847,6 +2904,8 @@
28472904
28482905 void SetMaterial(Object3D object)
28492906 {
2907
+ latestObject = object;
2908
+
28502909 cMaterial mat = object.material;
28512910
28522911 if (mat == null)
....@@ -3032,7 +3091,7 @@
30323091 cameraView.ToggleDL();
30333092 cameraView.repaint();
30343093 return;
3035
- } else if (event.getSource() == toggleTextureItem)
3094
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30363095 {
30373096 cameraView.ToggleTexture();
30383097 // june 2013 copy.HardTouch();
....@@ -3071,7 +3130,7 @@
30713130 frame.validate();
30723131
30733132 return;
3074
- } else if (event.getSource() == toggleSwitchItem)
3133
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30753134 {
30763135 cameraView.ToggleSwitch();
30773136 cameraView.repaint();
....@@ -3478,6 +3537,8 @@
34783537 tab.graphs[i] = null;
34793538 }
34803539
3540
+ SetUndoStates();
3541
+
34813542 // test save
34823543 if (false)
34833544 {
....@@ -3500,6 +3561,8 @@
35003561
35013562 void CopyChanged(Object3D obj)
35023563 {
3564
+ SetUndoStates();
3565
+
35033566 boolean temp = CameraPane.SWITCH;
35043567 CameraPane.SWITCH = false;
35053568
....@@ -3537,6 +3600,17 @@
35373600 }
35383601
35393602 refreshContents();
3603
+ }
3604
+
3605
+ cButton undoButton;
3606
+ cButton redoButton;
3607
+
3608
+ void SetUndoStates()
3609
+ {
3610
+ cRadio tab = GetCurrentTab();
3611
+
3612
+ undoButton.setEnabled(tab.undoindex > 0);
3613
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
35403614 }
35413615
35423616 public void Undo()
....@@ -3726,7 +3800,7 @@
37263800 assert false;
37273801 }
37283802
3729
- void EditSelection()
3803
+ void EditSelection(boolean newWindow)
37303804 {
37313805 }
37323806
....@@ -4221,7 +4295,7 @@
42214295
42224296 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
42234297 {
4224
- if (Globals.SAVEONMAKE)
4298
+ if (Globals.SAVEONMAKE) // && resetmodel)
42254299 Save();
42264300 //Tween.set(thing, 0).target(1).start(tweenManager);
42274301 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4309,6 +4383,12 @@
43094383 {
43104384 ResetModel();
43114385 Select(thing.GetTreePath(), true, false); // unselect... false);
4386
+
4387
+ if (thing.Size() == 0)
4388
+ {
4389
+ //EditSelection(false);
4390
+ }
4391
+
43124392 refreshContents();
43134393 }
43144394
....@@ -4710,6 +4790,8 @@
47104790 String filename = browser.getFile();
47114791 if (filename != null && filename.length() > 0)
47124792 {
4793
+ if (!filename.endsWith(".gfd"))
4794
+ filename += ".gfd";
47134795 lastname = browser.getDirectory() + filename;
47144796 save();
47154797 }
....@@ -4903,18 +4985,31 @@
49034985 CheckboxMenuItem togglePaintItem;
49044986 JSplitPane mainPanel;
49054987 JScrollPane scrollpane;
4988
+
49064989 JPanel toolbarPanel;
4990
+
49074991 cGridBag treePanel;
4992
+
49084993 JPanel radioPanel;
49094994 ButtonGroup buttonGroup;
4910
- cGridBag ctrlPanel;
4995
+
4996
+ cGridBag toolboxPanel;
49114997 cGridBag materialPanel;
4998
+ cGridBag ctrlPanel;
4999
+
49125000 JScrollPane infoPanel;
5001
+
49135002 cGridBag optionsPanel;
5003
+
49145004 JTabbedPane objectPanel;
5005
+ boolean materialFlushed;
5006
+ Object3D latestObject;
5007
+
49155008 cGridBag XYZPanel;
5009
+
49165010 JSplitPane gridPanel;
49175011 JSplitPane bigPanel;
5012
+
49185013 cGridBag bigThree;
49195014 cGridBag scenePanel;
49205015 cGridBag centralPanel;
....@@ -5029,7 +5124,7 @@
50295124 cNumberSlider fogField;
50305125 JLabel opacityPowerLabel;
50315126 cNumberSlider opacityPowerField;
5032
- JTree jTree;
5127
+ cTree jTree;
50335128 //ObjectUI parent;
50345129
50355130 cNumberSlider normalpushField;