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,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
....@@ -1428,7 +1453,7 @@
14281453 aConstraints.gridx += 1;
14291454 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
14301455 //aConstraints.weightx = 0;
1431
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1456
+ ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14321457 aConstraints.gridx = 0;
14331458 aConstraints.gridy += 1;
14341459 aConstraints.gridwidth = 1;
....@@ -1438,7 +1463,7 @@
14381463 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14391464 aConstraints.gridx += 1;
14401465 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1441
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1466
+ ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14421467 aConstraints.gridx = 0;
14431468 aConstraints.gridy += 1;
14441469 aConstraints.gridwidth = 1;
....@@ -1448,7 +1473,7 @@
14481473 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14491474 aConstraints.gridx += 1;
14501475 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1451
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1476
+ ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14521477 aConstraints.gridx = 0;
14531478 aConstraints.gridy += 1;
14541479 aConstraints.gridwidth = 1;
....@@ -1458,7 +1483,7 @@
14581483 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14591484 aConstraints.gridx += 1;
14601485 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1461
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1486
+ ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14621487 aConstraints.gridx = 0;
14631488 aConstraints.gridy += 1;
14641489 aConstraints.gridwidth = 1;
....@@ -1468,7 +1493,7 @@
14681493 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14691494 aConstraints.gridx += 1;
14701495 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1471
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1496
+ ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14721497 aConstraints.gridx = 0;
14731498 aConstraints.gridy += 1;
14741499 aConstraints.gridwidth = 1;
....@@ -1537,7 +1562,7 @@
15371562 aConstraints.fill = GridBagConstraints.HORIZONTAL;
15381563 aConstraints.gridx += 1;
15391564 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1540
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1565
+ ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
15411566 aConstraints.gridx = 0;
15421567 aConstraints.gridy += 1;
15431568 aConstraints.gridwidth = 1;
....@@ -1606,7 +1631,7 @@
16061631 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16071632 aConstraints.gridx += 1;
16081633 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1609
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1634
+ ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16101635 aConstraints.gridx = 0;
16111636 aConstraints.gridy += 1;
16121637 aConstraints.gridwidth = 1;
....@@ -1677,7 +1702,7 @@
16771702 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16781703 aConstraints.gridx += 1;
16791704 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1680
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1705
+ ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16811706 aConstraints.gridx = 0;
16821707 aConstraints.gridy += 1;
16831708 aConstraints.gridwidth = 1;
....@@ -2966,37 +2991,34 @@
29662991 return;
29672992 } else if (event.getSource() == toggleTimelineItem)
29682993 {
2969
- copy.timeline ^= true;
2994
+ timeline ^= true;
29702995
2971
- if (copy.timeline)
2996
+ if (timeline)
29722997 {
29732998 centralPanel.remove(cameraView);
29742999 centralPanel.add(timelinePanel);
29753000 frame.setJMenuBar(timelineMenubar);
3001
+ wasFullScreen = CameraPane.FULLSCREEN;
3002
+ if (!CameraPane.FULLSCREEN)
3003
+ ToggleFullScreen();
3004
+ toggleFullScreenItem.setEnabled(false);
29763005 }
29773006 else
29783007 {
29793008 centralPanel.remove(timelinePanel);
29803009 centralPanel.add(cameraView);
29813010 frame.setJMenuBar(null);
3011
+ if (!wasFullScreen)
3012
+ ToggleFullScreen();
3013
+ toggleFullScreenItem.setEnabled(true);
29823014 }
29833015
29843016 frame.validate();
29853017 return;
29863018 } else if (event.getSource() == toggleFullScreenItem)
29873019 {
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
- }
3020
+ ToggleFullScreen();
29983021 frame.validate();
2999
- cameraView.ToggleFullScreen();
30003022
30013023 return;
30023024 } else if (event.getSource() == toggleRandomItem)
....@@ -3534,7 +3556,13 @@
35343556 //System.out.println("PARENT = " + parent);
35353557 //if (parent != null)
35363558 // parent.applySelf();
3537
- refreshContents();
3559
+ if (e.getSource() == normalpushField)
3560
+ {
3561
+ objEditor.refreshContents();
3562
+ //Refresh();
3563
+ }
3564
+ else
3565
+ refreshContents();
35383566 // ??? client.refreshEditWindow();
35393567 }
35403568 //else
....@@ -3546,7 +3574,7 @@
35463574 //group.name = nameField.getText();
35473575 //objEditor.applySelf();
35483576
3549
- assert (objEditor == this);
3577
+ // OCT2018: assert (objEditor == this);
35503578 if (copy.selection == null || copy.selection.size() == 0)
35513579 //super.applySelf()
35523580 ; else
....@@ -3570,12 +3598,18 @@
35703598 objEditor.copy = keep;
35713599 }
35723600 }
3601
+
3602
+ if (normalpushField != null)
3603
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
35733604 }
35743605
35753606 void SnapObject()
35763607 {
3577
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3578
- SnapObject(obj);
3608
+ if (copy.selection.size() > 0)
3609
+ {
3610
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3611
+ SnapObject(obj);
3612
+ }
35793613 }
35803614
35813615 void SnapObject(Object3D obj)
....@@ -4611,4 +4645,6 @@
46114645 NumberSlider opacityPowerField;
46124646 JTree jTree;
46134647 //ObjectUI parent;
4648
+
4649
+ NumberSlider normalpushField;
46144650 }