Normand Briere
2018-12-17 86f4e9c75951153ae9825f4772633e45698cb602
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,11 +298,11 @@
292298 //normalLensItem.addActionListener(this);
293299 cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294300 revertCameraItem.addActionListener(this);
301
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
302
+ toggleTimelineItem.addItemListener(this);
295303 cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
296304 toggleFullScreenItem.addItemListener(this);
297305 toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
299
- toggleTimelineItem.addItemListener(this);
300306 cameraMenu.add("-");
301307 cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
302308 toggleTextureItem.addItemListener(this);
....@@ -596,6 +602,22 @@
596602 }
597603 }
598604
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
+
599621 private JTextArea createTextPane()
600622 {
601623 String[] initString =
....@@ -796,7 +818,7 @@
796818
797819 aConstraints.fill = GridBagConstraints.VERTICAL;
798820 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
799
- aConstraints.gridwidth = 2;
821
+ aConstraints.gridwidth = 1;
800822 ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
801823 aConstraints.gridx += 1;
802824 aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -965,6 +987,9 @@
965987
966988 Return();
967989
990
+ normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
991
+ Return();
992
+
968993 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
969994 // ObjEditor.aConstraints.gridx += 1;
970995
....@@ -1164,6 +1189,13 @@
11641189 timelinePanel = new JPanel(new BorderLayout());
11651190 timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11661191
1192
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1193
+ cameraPanel.setContinuousLayout(true);
1194
+ cameraPanel.setOneTouchExpandable(true);
1195
+// cameraPanel.setDividerLocation(0.9);
1196
+// cameraPanel.setDividerSize(9);
1197
+ cameraPanel.setResizeWeight(1.0);
1198
+
11671199 centralPanel.add(cameraView);
11681200 //frame.setJMenuBar(timelineMenubar);
11691201 //centralPanel.add(timelinePanel);
....@@ -1428,7 +1460,7 @@
14281460 aConstraints.gridx += 1;
14291461 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
14301462 //aConstraints.weightx = 0;
1431
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1463
+ ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14321464 aConstraints.gridx = 0;
14331465 aConstraints.gridy += 1;
14341466 aConstraints.gridwidth = 1;
....@@ -1438,7 +1470,7 @@
14381470 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14391471 aConstraints.gridx += 1;
14401472 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1441
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1473
+ ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14421474 aConstraints.gridx = 0;
14431475 aConstraints.gridy += 1;
14441476 aConstraints.gridwidth = 1;
....@@ -1448,7 +1480,7 @@
14481480 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14491481 aConstraints.gridx += 1;
14501482 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1451
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1483
+ ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14521484 aConstraints.gridx = 0;
14531485 aConstraints.gridy += 1;
14541486 aConstraints.gridwidth = 1;
....@@ -1458,7 +1490,7 @@
14581490 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14591491 aConstraints.gridx += 1;
14601492 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1461
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1493
+ ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14621494 aConstraints.gridx = 0;
14631495 aConstraints.gridy += 1;
14641496 aConstraints.gridwidth = 1;
....@@ -1468,7 +1500,7 @@
14681500 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14691501 aConstraints.gridx += 1;
14701502 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1471
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1503
+ ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14721504 aConstraints.gridx = 0;
14731505 aConstraints.gridy += 1;
14741506 aConstraints.gridwidth = 1;
....@@ -1537,7 +1569,7 @@
15371569 aConstraints.fill = GridBagConstraints.HORIZONTAL;
15381570 aConstraints.gridx += 1;
15391571 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1540
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1572
+ ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
15411573 aConstraints.gridx = 0;
15421574 aConstraints.gridy += 1;
15431575 aConstraints.gridwidth = 1;
....@@ -1606,7 +1638,7 @@
16061638 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16071639 aConstraints.gridx += 1;
16081640 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1609
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1641
+ ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16101642 aConstraints.gridx = 0;
16111643 aConstraints.gridy += 1;
16121644 aConstraints.gridwidth = 1;
....@@ -1677,7 +1709,7 @@
16771709 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16781710 aConstraints.gridx += 1;
16791711 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1680
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1712
+ ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16811713 aConstraints.gridx = 0;
16821714 aConstraints.gridy += 1;
16831715 aConstraints.gridwidth = 1;
....@@ -2966,37 +2998,35 @@
29662998 return;
29672999 } else if (event.getSource() == toggleTimelineItem)
29683000 {
2969
- copy.timeline ^= true;
3001
+ timeline ^= true;
29703002
2971
- if (copy.timeline)
3003
+ if (timeline)
29723004 {
29733005 centralPanel.remove(cameraView);
2974
- centralPanel.add(timelinePanel);
3006
+ cameraPanel.add(cameraView);
3007
+ centralPanel.add(cameraPanel);
29753008 frame.setJMenuBar(timelineMenubar);
3009
+ wasFullScreen = CameraPane.FULLSCREEN;
3010
+ if (!CameraPane.FULLSCREEN)
3011
+ ToggleFullScreen();
3012
+ toggleFullScreenItem.setEnabled(false);
29763013 }
29773014 else
29783015 {
2979
- centralPanel.remove(timelinePanel);
3016
+ centralPanel.remove(cameraPanel);
29803017 centralPanel.add(cameraView);
29813018 frame.setJMenuBar(null);
3019
+ if (!wasFullScreen)
3020
+ ToggleFullScreen();
3021
+ toggleFullScreenItem.setEnabled(true);
29823022 }
29833023
29843024 frame.validate();
29853025 return;
29863026 } else if (event.getSource() == toggleFullScreenItem)
29873027 {
2988
- if (CameraPane.FULLSCREEN)
2989
- {
2990
- frame.getContentPane().remove(/*"Center",*/bigThree);
2991
- framePanel.add(bigThree);
2992
- frame.getContentPane().add(/*"Center",*/framePanel);
2993
- } else
2994
- {
2995
- frame.getContentPane().remove(/*"Center",*/framePanel);
2996
- frame.getContentPane().add(/*"Center",*/bigThree);
2997
- }
3028
+ ToggleFullScreen();
29983029 frame.validate();
2999
- cameraView.ToggleFullScreen();
30003030
30013031 return;
30023032 } else if (event.getSource() == toggleRandomItem)
....@@ -3534,7 +3564,13 @@
35343564 //System.out.println("PARENT = " + parent);
35353565 //if (parent != null)
35363566 // parent.applySelf();
3537
- refreshContents();
3567
+ if (e.getSource() == normalpushField)
3568
+ {
3569
+ objEditor.refreshContents();
3570
+ //Refresh();
3571
+ }
3572
+ else
3573
+ refreshContents();
35383574 // ??? client.refreshEditWindow();
35393575 }
35403576 //else
....@@ -3546,7 +3582,7 @@
35463582 //group.name = nameField.getText();
35473583 //objEditor.applySelf();
35483584
3549
- assert (objEditor == this);
3585
+ // OCT2018: assert (objEditor == this);
35503586 if (copy.selection == null || copy.selection.size() == 0)
35513587 //super.applySelf()
35523588 ; else
....@@ -3570,12 +3606,18 @@
35703606 objEditor.copy = keep;
35713607 }
35723608 }
3609
+
3610
+ if (normalpushField != null)
3611
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
35733612 }
35743613
35753614 void SnapObject()
35763615 {
3577
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3578
- SnapObject(obj);
3616
+ if (copy.selection.size() > 0)
3617
+ {
3618
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3619
+ SnapObject(obj);
3620
+ }
35793621 }
35803622
35813623 void SnapObject(Object3D obj)
....@@ -4499,6 +4541,7 @@
44994541 JPanel bigThree;
45004542 JTabbedPane scenePanel;
45014543 JPanel centralPanel;
4544
+ JSplitPane cameraPanel;
45024545 JPanel timelinePanel;
45034546 JMenuBar timelineMenubar;
45044547 JSplitPane framePanel;
....@@ -4611,4 +4654,6 @@
46114654 NumberSlider opacityPowerField;
46124655 JTree jTree;
46134656 //ObjectUI parent;
4657
+
4658
+ NumberSlider normalpushField;
46144659 }