Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
ObjEditor.java
....@@ -207,7 +207,7 @@
207207
208208 objEditor.ctrlPanel.remove(namePanel);
209209
210
- if (!GroupEditor.allparams)
210
+ if (!allparams)
211211 return;
212212
213213 // objEditor.ctrlPanel.remove(liveCB);
....@@ -337,6 +337,11 @@
337337 return frame.action(event, obj);
338338 }
339339
340
+ // Cannot work without static
341
+ static boolean allparams = true;
342
+
343
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
344
+
340345 void SetupMenu()
341346 {
342347 frame.setMenuBar(menuBar = new MenuBar());
....@@ -383,6 +388,32 @@
383388 closeItem.addActionListener(this);
384389
385390 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
+
386417 toolbarPanel = new JPanel();
387418 toolbarPanel.setName("Toolbar");
388419 treePanel = new cGridBag();
....@@ -702,7 +733,9 @@
702733
703734 void ToggleFullScreen()
704735 {
705
- if (CameraPane.FULLSCREEN)
736
+ cameraView.ToggleFullScreen();
737
+
738
+ if (!CameraPane.FULLSCREEN)
706739 {
707740 device.setFullScreenWindow(null);
708741 //frame.setVisible(false);
....@@ -742,8 +775,6 @@
742775 radio.layout.doClick();
743776 //frame.setVisible(true);
744777 }
745
-
746
- cameraView.ToggleFullScreen();
747778 }
748779
749780 private JTextPane createTextPane()
....@@ -884,7 +915,12 @@
884915 JCheckBox speedupCB;
885916 JCheckBox rewindCB;
886917 JCheckBox flipVCB;
918
+
919
+ cCheckBox toggleTextureCB;
920
+ cCheckBox toggleSwitchCB;
921
+
887922 JComboBox texresMenu;
923
+
888924 JButton resetButton;
889925 JButton stepButton;
890926 JButton stepAllButton;
....@@ -1076,7 +1112,7 @@
10761112
10771113 oe.ctrlPanel.Return();
10781114
1079
- if (!GroupEditor.allparams)
1115
+ if (!allparams)
10801116 return;
10811117
10821118 setupPanel = new cGridBag().setVertical(false);
....@@ -1412,7 +1448,6 @@
14121448
14131449 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14141450 //tmp.setName("Edit");
1415
- objectPanel.add(toolboxPanel);
14161451 objectPanel.add(materialPanel);
14171452 // JPanel north = new JPanel(new BorderLayout());
14181453 // north.setName("Edit");
....@@ -1420,6 +1455,7 @@
14201455 // objectPanel.add(north);
14211456 objectPanel.add(editPanel);
14221457 objectPanel.add(infoPanel);
1458
+ objectPanel.add(toolboxPanel);
14231459
14241460 /*
14251461 aConstraints.gridx = 0;
....@@ -1428,7 +1464,7 @@
14281464 aConstraints.gridy += 1;
14291465 aConstraints.gridwidth = 1;
14301466 mainPanel.add(objectPanel, aConstraints);
1431
- */
1467
+ */
14321468
14331469 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14341470 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1445,9 +1481,7 @@
14451481 JTabbedPane tabbedPane = new JTabbedPane();
14461482 tabbedPane.add(scrollpane);
14471483
1448
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1449
-
1450
- optionsPanel = new cGridBag().setVertical(true);
1484
+ optionsPanel = new cGridBag().setVertical(false);
14511485
14521486 optionsPanel.setName("Options");
14531487
....@@ -1455,6 +1489,8 @@
14551489
14561490 tabbedPane.add(optionsPanel);
14571491
1492
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1493
+
14581494 scenePanel.add(tabbedPane);
14591495
14601496 /*
....@@ -1547,6 +1583,8 @@
15471583 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
15481584
15491585 frame.setSize(1280, 860);
1586
+
1587
+ frame.validate();
15501588 frame.setVisible(true);
15511589
15521590 cameraView.requestFocusInWindow();
....@@ -2866,6 +2904,8 @@
28662904
28672905 void SetMaterial(Object3D object)
28682906 {
2907
+ latestObject = object;
2908
+
28692909 cMaterial mat = object.material;
28702910
28712911 if (mat == null)
....@@ -3051,7 +3091,7 @@
30513091 cameraView.ToggleDL();
30523092 cameraView.repaint();
30533093 return;
3054
- } else if (event.getSource() == toggleTextureItem)
3094
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
30553095 {
30563096 cameraView.ToggleTexture();
30573097 // june 2013 copy.HardTouch();
....@@ -3090,7 +3130,7 @@
30903130 frame.validate();
30913131
30923132 return;
3093
- } else if (event.getSource() == toggleSwitchItem)
3133
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30943134 {
30953135 cameraView.ToggleSwitch();
30963136 cameraView.repaint();
....@@ -3497,6 +3537,8 @@
34973537 tab.graphs[i] = null;
34983538 }
34993539
3540
+ SetUndoStates();
3541
+
35003542 // test save
35013543 if (false)
35023544 {
....@@ -3519,6 +3561,8 @@
35193561
35203562 void CopyChanged(Object3D obj)
35213563 {
3564
+ SetUndoStates();
3565
+
35223566 boolean temp = CameraPane.SWITCH;
35233567 CameraPane.SWITCH = false;
35243568
....@@ -3556,6 +3600,17 @@
35563600 }
35573601
35583602 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);
35593614 }
35603615
35613616 public void Undo()
....@@ -4735,6 +4790,8 @@
47354790 String filename = browser.getFile();
47364791 if (filename != null && filename.length() > 0)
47374792 {
4793
+ if (!filename.endsWith(".gfd"))
4794
+ filename += ".gfd";
47384795 lastname = browser.getDirectory() + filename;
47394796 save();
47404797 }
....@@ -4945,6 +5002,8 @@
49455002 cGridBag optionsPanel;
49465003
49475004 JTabbedPane objectPanel;
5005
+ boolean materialFlushed;
5006
+ Object3D latestObject;
49485007
49495008 cGridBag XYZPanel;
49505009