Normand Briere
2018-12-15 6ed65dcb597fb2153cef75bf1845978f1115658c
ObjEditor.java
....@@ -28,6 +28,8 @@
2828 iSendInfo
2929 //KeyListener
3030 {
31
+ boolean timeline;
32
+ boolean wasFullScreen;
3133
3234 // SCRIPT
3335
....@@ -158,12 +160,16 @@
158160 objEditor.ctrlPanel.remove(slowerButton);
159161 objEditor.ctrlPanel.remove(fasterButton);
160162 objEditor.ctrlPanel.remove(remarkButton);
163
+
164
+ Remove(normalpushField);
161165 }
162166
163167 public ObjEditor GetEditor()
164168 {
165169 return objEditor; //.GetEditor();
166170 }
171
+
172
+ // Sometimes myself, sometimes my callee's.
167173 ObjEditor objEditor;
168174
169175 /*
....@@ -238,7 +244,7 @@
238244 //if (!isDisplayable())
239245 //setUndecorated(true);
240246
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
247
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242248 client = inClient;
243249 copy = localCopy;
244250 copy.editWindow = this;
....@@ -292,9 +298,11 @@
292298 //normalLensItem.addActionListener(this);
293299 cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294300 revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
301
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
302
+ toggleTimelineItem.addItemListener(this);
303
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
304
+ toggleFullScreenItem.addItemListener(this);
305
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298306 cameraMenu.add("-");
299307 cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300308 toggleTextureItem.addItemListener(this);
....@@ -594,6 +602,22 @@
594602 }
595603 }
596604
605
+ void ToggleFullScreen()
606
+ {
607
+ if (CameraPane.FULLSCREEN)
608
+ {
609
+ frame.getContentPane().remove(/*"Center",*/bigThree);
610
+ framePanel.add(bigThree);
611
+ frame.getContentPane().add(/*"Center",*/framePanel);
612
+ } else
613
+ {
614
+ frame.getContentPane().remove(/*"Center",*/framePanel);
615
+ framePanel.remove(bigThree);
616
+ frame.getContentPane().add(/*"Center",*/bigThree);
617
+ }
618
+ cameraView.ToggleFullScreen();
619
+ }
620
+
597621 private JTextArea createTextPane()
598622 {
599623 String[] initString =
....@@ -794,7 +818,7 @@
794818
795819 aConstraints.fill = GridBagConstraints.VERTICAL;
796820 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
821
+ aConstraints.gridwidth = 1;
798822 ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799823 aConstraints.gridx += 1;
800824 aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -963,6 +987,9 @@
963987
964988 Return();
965989
990
+ normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
991
+ Return();
992
+
966993 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
967994 // ObjEditor.aConstraints.gridx += 1;
968995
....@@ -1158,10 +1185,14 @@
11581185 //JPanel worldPanel =
11591186 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601187 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1188
+ centralPanel = new JPanel(new BorderLayout());
1189
+ timelinePanel = new JPanel(new BorderLayout());
1190
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641191
1192
+ centralPanel.add(cameraView);
1193
+ //frame.setJMenuBar(timelineMenubar);
1194
+ //centralPanel.add(timelinePanel);
1195
+
11651196 //topView.camera = ;
11661197 //frontView.camera = new Camera(2);
11671198 //sideView.camera = new Camera(3);
....@@ -1191,7 +1222,7 @@
11911222 gridPanel.add(cameraView);
11921223 gridPanel.add(XYZPanel);
11931224 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1225
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951226 gridPanel.setContinuousLayout(true);
11961227 gridPanel.setOneTouchExpandable(true);
11971228 gridPanel.setDividerLocation(1.0);
....@@ -1244,15 +1275,15 @@
12441275 scrollpane.setWheelScrollingEnabled(true);
12451276 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461277
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1278
+ /*JTabbedPane*/ scenePanel = new JTabbedPane();
1279
+ scenePanel.add(scrollpane);
12491280
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1281
+ scenePanel.add(FSPane = new cFileSystemPane(this));
12511282
12521283 optionsPanel = new JPanel(new GridBagLayout());
12531284
12541285 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1286
+ scenePanel.add(optionsPanel);
12561287
12571288
12581289 /*
....@@ -1275,7 +1306,7 @@
12751306 jtp.add(tree);
12761307 */
12771308
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1309
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791310 bigPanel.setContinuousLayout(true);
12801311 bigPanel.setOneTouchExpandable(true);
12811312 bigPanel.setDividerLocation(0.8);
....@@ -1297,13 +1328,13 @@
12971328 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981329 aWindowConstraints.weightx = 0;
12991330 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1331
+ bigThree.add(scenePanel, aWindowConstraints);
13011332 aWindowConstraints.weightx = 1;
13021333 aWindowConstraints.gridwidth = 3;
13031334 // aConstraints.gridheight = 3;
13041335 aWindowConstraints.gridx = 1;
13051336 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1337
+ bigThree.add(centralPanel, aWindowConstraints);
13071338 aWindowConstraints.weightx = 0;
13081339 aWindowConstraints.gridx = 4;
13091340 aWindowConstraints.gridwidth = 1;
....@@ -1422,7 +1453,7 @@
14221453 aConstraints.gridx += 1;
14231454 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
14241455 //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
+ ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14261457 aConstraints.gridx = 0;
14271458 aConstraints.gridy += 1;
14281459 aConstraints.gridwidth = 1;
....@@ -1432,7 +1463,7 @@
14321463 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14331464 aConstraints.gridx += 1;
14341465 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
+ ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14361467 aConstraints.gridx = 0;
14371468 aConstraints.gridy += 1;
14381469 aConstraints.gridwidth = 1;
....@@ -1442,7 +1473,7 @@
14421473 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14431474 aConstraints.gridx += 1;
14441475 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1476
+ ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14461477 aConstraints.gridx = 0;
14471478 aConstraints.gridy += 1;
14481479 aConstraints.gridwidth = 1;
....@@ -1452,7 +1483,7 @@
14521483 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14531484 aConstraints.gridx += 1;
14541485 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1486
+ ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14561487 aConstraints.gridx = 0;
14571488 aConstraints.gridy += 1;
14581489 aConstraints.gridwidth = 1;
....@@ -1462,7 +1493,7 @@
14621493 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14631494 aConstraints.gridx += 1;
14641495 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1496
+ ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14661497 aConstraints.gridx = 0;
14671498 aConstraints.gridy += 1;
14681499 aConstraints.gridwidth = 1;
....@@ -1531,7 +1562,7 @@
15311562 aConstraints.fill = GridBagConstraints.HORIZONTAL;
15321563 aConstraints.gridx += 1;
15331564 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1565
+ ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
15351566 aConstraints.gridx = 0;
15361567 aConstraints.gridy += 1;
15371568 aConstraints.gridwidth = 1;
....@@ -1600,7 +1631,7 @@
16001631 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16011632 aConstraints.gridx += 1;
16021633 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1634
+ ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16041635 aConstraints.gridx = 0;
16051636 aConstraints.gridy += 1;
16061637 aConstraints.gridwidth = 1;
....@@ -1671,7 +1702,7 @@
16711702 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16721703 aConstraints.gridx += 1;
16731704 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1705
+ ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16751706 aConstraints.gridx = 0;
16761707 aConstraints.gridy += 1;
16771708 aConstraints.gridwidth = 1;
....@@ -2958,20 +2989,36 @@
29582989 // june 2013 copy.HardTouch();
29592990 cameraView.repaint();
29602991 return;
2961
- } else if (event.getSource() == toggleFullItem)
2992
+ } else if (event.getSource() == toggleTimelineItem)
29622993 {
2963
- if (CameraPane.FULLSCREEN)
2994
+ timeline ^= true;
2995
+
2996
+ if (timeline)
29642997 {
2965
- frame.getContentPane().remove(/*"Center",*/bigThree);
2966
- framePanel.add(bigThree);
2967
- frame.getContentPane().add(/*"Center",*/framePanel);
2968
- } else
2969
- {
2970
- frame.getContentPane().remove(/*"Center",*/framePanel);
2971
- frame.getContentPane().add(/*"Center",*/bigThree);
2998
+ centralPanel.remove(cameraView);
2999
+ centralPanel.add(timelinePanel);
3000
+ frame.setJMenuBar(timelineMenubar);
3001
+ wasFullScreen = CameraPane.FULLSCREEN;
3002
+ if (!CameraPane.FULLSCREEN)
3003
+ ToggleFullScreen();
3004
+ toggleFullScreenItem.setEnabled(false);
29723005 }
3006
+ else
3007
+ {
3008
+ centralPanel.remove(timelinePanel);
3009
+ centralPanel.add(cameraView);
3010
+ frame.setJMenuBar(null);
3011
+ if (!wasFullScreen)
3012
+ ToggleFullScreen();
3013
+ toggleFullScreenItem.setEnabled(true);
3014
+ }
3015
+
29733016 frame.validate();
2974
- cameraView.ToggleFullScreen();
3017
+ return;
3018
+ } else if (event.getSource() == toggleFullScreenItem)
3019
+ {
3020
+ ToggleFullScreen();
3021
+ frame.validate();
29753022
29763023 return;
29773024 } else if (event.getSource() == toggleRandomItem)
....@@ -3220,9 +3267,9 @@
32203267 cameraView.RevertCamera();
32213268 cameraView.repaint();
32223269 return;
3223
- } else if (event.getSource() == textureButton)
3224
- {
3225
- return; // true;
3270
+// } else if (event.getSource() == textureButton)
3271
+// {
3272
+// return; // true;
32263273 } else // combos...
32273274 if (event.getSource() == texresMenu)
32283275 {
....@@ -3509,7 +3556,13 @@
35093556 //System.out.println("PARENT = " + parent);
35103557 //if (parent != null)
35113558 // parent.applySelf();
3512
- refreshContents();
3559
+ if (e.getSource() == normalpushField)
3560
+ {
3561
+ objEditor.refreshContents();
3562
+ //Refresh();
3563
+ }
3564
+ else
3565
+ refreshContents();
35133566 // ??? client.refreshEditWindow();
35143567 }
35153568 //else
....@@ -3521,7 +3574,7 @@
35213574 //group.name = nameField.getText();
35223575 //objEditor.applySelf();
35233576
3524
- assert (objEditor == this);
3577
+ // OCT2018: assert (objEditor == this);
35253578 if (copy.selection == null || copy.selection.size() == 0)
35263579 //super.applySelf()
35273580 ; else
....@@ -3545,12 +3598,18 @@
35453598 objEditor.copy = keep;
35463599 }
35473600 }
3601
+
3602
+ if (normalpushField != null)
3603
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
35483604 }
35493605
35503606 void SnapObject()
35513607 {
3552
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3553
- SnapObject(obj);
3608
+ if (copy.selection.size() > 0)
3609
+ {
3610
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3611
+ SnapObject(obj);
3612
+ }
35543613 }
35553614
35563615 void SnapObject(Object3D obj)
....@@ -4444,7 +4503,8 @@
44444503 MenuItem revertCameraItem;
44454504 CheckboxMenuItem toggleLiveItem;
44464505 MenuItem stepItem;
4447
- CheckboxMenuItem toggleFullItem;
4506
+ CheckboxMenuItem toggleFullScreenItem;
4507
+ CheckboxMenuItem toggleTimelineItem;
44484508 CheckboxMenuItem toggleRenderItem;
44494509 CheckboxMenuItem toggleDebugItem;
44504510 CheckboxMenuItem toggleFrustumItem;
....@@ -4471,11 +4531,13 @@
44714531 JSplitPane gridPanel;
44724532 JSplitPane bigPanel;
44734533 JPanel bigThree;
4474
- JTabbedPane jtp;
4475
- JPanel cameraPanel;
4534
+ JTabbedPane scenePanel;
4535
+ JPanel centralPanel;
4536
+ JPanel timelinePanel;
4537
+ JMenuBar timelineMenubar;
44764538 JSplitPane framePanel;
44774539 JTextArea/*Field*/ nameField;
4478
- cButton textureButton;
4540
+ //cButton textureButton;
44794541 cButton okButton;
44804542 cButton applyButton;
44814543 cButton cancelButton;
....@@ -4583,4 +4645,6 @@
45834645 NumberSlider opacityPowerField;
45844646 JTree jTree;
45854647 //ObjectUI parent;
4648
+
4649
+ NumberSlider normalpushField;
45864650 }