Normand Briere
2019-04-29 bed42c663d286d76a32f155049f9efabc2fdb73f
ObjEditor.java
....@@ -19,6 +19,8 @@
1919 import //weka.core.
2020 matrix.Matrix;
2121
22
+import grafeme.ui.*;
23
+
2224 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
2325 ActionListener, ChangeListener,
2426 InputMethodListener,
....@@ -28,7 +30,12 @@
2830 iSendInfo
2931 //KeyListener
3032 {
33
+ boolean timeline;
34
+ boolean wasFullScreen;
3135
36
+ GroupEditor callee;
37
+ JFrame frame;
38
+
3239 // SCRIPT
3340
3441 transient JFrame textpanel = null;
....@@ -119,14 +126,13 @@
119126 void keyPressed(int key, int modifiers)
120127 {
121128 System.out.println("KEY PRESSED");
122
- CameraPane.theRenderer.keyPressed(key, modifiers);
129
+ Globals.theRenderer.keyPressed(key, modifiers);
123130 }
124131 */
125132
126133 static GridBagConstraints aConstraints;
127134 static GridBagConstraints aWindowConstraints;
128
- GroupEditor callee;
129
- JFrame frame;
135
+
130136 static int GRIDWIDTH = 100; // 4;
131137
132138 public void closeUI()
....@@ -158,12 +164,16 @@
158164 objEditor.ctrlPanel.remove(slowerButton);
159165 objEditor.ctrlPanel.remove(fasterButton);
160166 objEditor.ctrlPanel.remove(remarkButton);
167
+
168
+ Remove(normalpushField);
161169 }
162170
163171 public ObjEditor GetEditor()
164172 {
165173 return objEditor; //.GetEditor();
166174 }
175
+
176
+ // Sometimes myself, sometimes my callee's.
167177 ObjEditor objEditor;
168178
169179 /*
....@@ -238,7 +248,7 @@
238248 //if (!isDisplayable())
239249 //setUndecorated(true);
240250
241
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
251
+ //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
242252 client = inClient;
243253 copy = localCopy;
244254 copy.editWindow = this;
....@@ -292,16 +302,18 @@
292302 //normalLensItem.addActionListener(this);
293303 cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
294304 revertCameraItem.addActionListener(this);
295
- cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
296
- toggleFullItem.addItemListener(this);
297
- toggleFullItem.setState(CameraPane.FULLSCREEN);
305
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
306
+ toggleTimelineItem.addItemListener(this);
307
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
308
+ toggleFullScreenItem.addItemListener(this);
309
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
298310 cameraMenu.add("-");
299311 cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
300312 toggleTextureItem.addItemListener(this);
301313 toggleTextureItem.setState(CameraPane.textureon);
302314 cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
303315 toggleLiveItem.addItemListener(this);
304
- toggleLiveItem.setState(CameraPane.isLIVE());
316
+ toggleLiveItem.setState(Globals.isLIVE());
305317 cameraMenu.add(stepItem = new MenuItem("Step"));
306318 stepItem.addActionListener(this);
307319 // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
....@@ -522,18 +534,18 @@
522534 maxima.y = sel.toParent[3][1];
523535 maxima.z = sel.toParent[3][2];
524536 si.SendInfo(" Orig: " + maxima, "regular");
525
- maxima.x = sel.globalTransform[3][0];
526
- maxima.y = sel.globalTransform[3][1];
527
- maxima.z = sel.globalTransform[3][2];
528
- if (full)
529
- si.SendInfo(" Global Orig: " + maxima, "regular");
530537 maxima.x = sel.toParent[0][0];
531538 maxima.y = sel.toParent[1][1];
532539 maxima.z = sel.toParent[2][2];
533540 si.SendInfo(" Scale: " + maxima, "regular");
534
- maxima.x = sel.globalTransform[0][0];
535
- maxima.y = sel.globalTransform[1][1];
536
- maxima.z = sel.globalTransform[2][2];
541
+ maxima.x = sel.globalTransform[3][0];
542
+ maxima.y = sel.globalTransform[3][1];
543
+ maxima.z = sel.globalTransform[3][2];
544
+ if (full)
545
+ si.SendInfo(" Global Orig: " + maxima, "regular");
546
+ maxima.x = sel.globalTransform[0][0];
547
+ maxima.y = sel.globalTransform[1][1];
548
+ maxima.z = sel.globalTransform[2][2];
537549 if (full)
538550 si.SendInfo(" Global Scale: " + maxima, "regular");
539551 }
....@@ -593,6 +605,22 @@
593605 System.err.println("Couldn't insert initial text into text pane.");
594606 }
595607 }
608
+
609
+ void ToggleFullScreen()
610
+ {
611
+ if (CameraPane.FULLSCREEN)
612
+ {
613
+ frame.getContentPane().remove(/*"Center",*/bigThree);
614
+ framePanel.add(bigThree);
615
+ frame.getContentPane().add(/*"Center",*/framePanel);
616
+ } else
617
+ {
618
+ frame.getContentPane().remove(/*"Center",*/framePanel);
619
+ framePanel.remove(bigThree);
620
+ frame.getContentPane().add(/*"Center",*/bigThree);
621
+ }
622
+ cameraView.ToggleFullScreen();
623
+ }
596624
597625 private JTextArea createTextPane()
598626 {
....@@ -692,7 +720,7 @@
692720 protected static ImageIcon createImageIcon(String path,
693721 String description)
694722 {
695
- java.net.URL imgURL = GraphreeD.class.getResource(path);
723
+ java.net.URL imgURL = GrafreeD.class.getResource(path);
696724 if (imgURL != null)
697725 {
698726 return new ImageIcon(imgURL, description);
....@@ -794,7 +822,7 @@
794822
795823 aConstraints.fill = GridBagConstraints.VERTICAL;
796824 jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
797
- aConstraints.gridwidth = 2;
825
+ aConstraints.gridwidth = 1;
798826 ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
799827 aConstraints.gridx += 1;
800828 aConstraints.fill = GridBagConstraints.HORIZONTAL;
....@@ -963,6 +991,9 @@
963991
964992 Return();
965993
994
+ normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
995
+ Return();
996
+
966997 // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
967998 // ObjEditor.aConstraints.gridx += 1;
968999
....@@ -1107,7 +1138,7 @@
11071138 //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------");
11081139 //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------");
11091140
1110
-// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints);
1141
+// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints);
11111142 Camera cam = GetCamera(copy, 0);
11121143
11131144 Composite cams = null;
....@@ -1158,10 +1189,21 @@
11581189 //JPanel worldPanel =
11591190 // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
11601191 //worldPanel.setName("World");
1161
- /*JPanel*/ cameraPanel =
1162
- new JPanel(new BorderLayout());
1163
- cameraPanel.add(cameraView);
1192
+ centralPanel = new JPanel(new BorderLayout());
1193
+ timelinePanel = new JPanel(new BorderLayout());
1194
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641195
1196
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1197
+ cameraPanel.setContinuousLayout(true);
1198
+ cameraPanel.setOneTouchExpandable(true);
1199
+// cameraPanel.setDividerLocation(0.9);
1200
+// cameraPanel.setDividerSize(9);
1201
+ cameraPanel.setResizeWeight(1.0);
1202
+
1203
+ centralPanel.add(cameraView);
1204
+ //frame.setJMenuBar(timelineMenubar);
1205
+ //centralPanel.add(timelinePanel);
1206
+
11651207 //topView.camera = ;
11661208 //frontView.camera = new Camera(2);
11671209 //sideView.camera = new Camera(3);
....@@ -1177,12 +1219,12 @@
11771219 //frontView.object = copy;
11781220 //sideView.object = copy;
11791221
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1222
+ XYZPanel = new cGridBag().setVertical(true);
1223
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821224
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1225
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1226
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1227
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861228
11871229 /*
11881230 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1233,7 @@
11911233 gridPanel.add(cameraView);
11921234 gridPanel.add(XYZPanel);
11931235 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1236
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951237 gridPanel.setContinuousLayout(true);
11961238 gridPanel.setOneTouchExpandable(true);
11971239 gridPanel.setDividerLocation(1.0);
....@@ -1244,15 +1286,18 @@
12441286 scrollpane.setWheelScrollingEnabled(true);
12451287 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461288
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1289
+ /*JTabbedPane*/ scenePanel = new JTabbedPane();
1290
+ scenePanel.add(scrollpane);
12491291
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1292
+ scenePanel.add(FSPane = new cFileSystemPane(this));
12511293
12521294 optionsPanel = new JPanel(new GridBagLayout());
12531295
12541296 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1297
+
1298
+ AddOptions(optionsPanel, aConstraints);
1299
+
1300
+ scenePanel.add(optionsPanel);
12561301
12571302
12581303 /*
....@@ -1275,7 +1320,7 @@
12751320 jtp.add(tree);
12761321 */
12771322
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1323
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791324 bigPanel.setContinuousLayout(true);
12801325 bigPanel.setOneTouchExpandable(true);
12811326 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1332,7 @@
12871332 //bigPanel.setSize(new Dimension(10,10));
12881333 //bigPanel.add(ctrlPanel);
12891334 //bigPanel.add(gridPanel);
1335
+ /**
12901336 bigThree = new JPanel();
12911337 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921338 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1343,26 @@
12971343 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981344 aWindowConstraints.weightx = 0;
12991345 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1346
+ bigThree.add(scenePanel, aWindowConstraints);
13011347 aWindowConstraints.weightx = 1;
13021348 aWindowConstraints.gridwidth = 3;
13031349 // aConstraints.gridheight = 3;
13041350 aWindowConstraints.gridx = 1;
13051351 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1352
+ bigThree.add(centralPanel, aWindowConstraints);
13071353 aWindowConstraints.weightx = 0;
13081354 aWindowConstraints.gridx = 4;
13091355 aWindowConstraints.gridwidth = 1;
13101356 // aConstraints.gridheight = 3;
13111357 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121358 bigThree.add(XYZPanel, aWindowConstraints);
1359
+ /**/
13131360
1361
+ bigThree = new cGridBag();
1362
+ bigThree.addComponent(scenePanel);
1363
+ bigThree.addComponent(centralPanel);
1364
+ bigThree.addComponent(XYZPanel);
1365
+
13141366 // // SIDE EFFECT!!!
13151367 // aConstraints.gridx = 0;
13161368 // aConstraints.gridy = 0;
....@@ -1331,10 +1383,11 @@
13311383 //worldPane.add(bigPanel);
13321384 //worldPane.add(worldPanel);
13331385 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1386
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1387
+ frame.add(/*"Center",*/framePanel);
13351388 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361389
1337
-// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc);
1390
+// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381391
13391392 frame.setSize(1024, 768);
13401393 frame.show();
....@@ -1352,6 +1405,10 @@
13521405 });
13531406 }
13541407
1408
+ void AddOptions(JPanel panel, GridBagConstraints constraints)
1409
+ {
1410
+ }
1411
+
13551412 JTree GetTree()
13561413 {
13571414 return objEditor.jTree;
....@@ -1422,7 +1479,7 @@
14221479 aConstraints.gridx += 1;
14231480 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
14241481 //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1482
+ ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14261483 aConstraints.gridx = 0;
14271484 aConstraints.gridy += 1;
14281485 aConstraints.gridwidth = 1;
....@@ -1432,7 +1489,7 @@
14321489 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14331490 aConstraints.gridx += 1;
14341491 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1492
+ ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14361493 aConstraints.gridx = 0;
14371494 aConstraints.gridy += 1;
14381495 aConstraints.gridwidth = 1;
....@@ -1442,7 +1499,7 @@
14421499 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14431500 aConstraints.gridx += 1;
14441501 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1502
+ ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14461503 aConstraints.gridx = 0;
14471504 aConstraints.gridy += 1;
14481505 aConstraints.gridwidth = 1;
....@@ -1452,7 +1509,7 @@
14521509 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14531510 aConstraints.gridx += 1;
14541511 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1512
+ ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14561513 aConstraints.gridx = 0;
14571514 aConstraints.gridy += 1;
14581515 aConstraints.gridwidth = 1;
....@@ -1462,7 +1519,7 @@
14621519 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14631520 aConstraints.gridx += 1;
14641521 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1522
+ ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14661523 aConstraints.gridx = 0;
14671524 aConstraints.gridy += 1;
14681525 aConstraints.gridwidth = 1;
....@@ -1531,7 +1588,7 @@
15311588 aConstraints.fill = GridBagConstraints.HORIZONTAL;
15321589 aConstraints.gridx += 1;
15331590 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1591
+ ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
15351592 aConstraints.gridx = 0;
15361593 aConstraints.gridy += 1;
15371594 aConstraints.gridwidth = 1;
....@@ -1600,7 +1657,7 @@
16001657 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16011658 aConstraints.gridx += 1;
16021659 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1660
+ ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16041661 aConstraints.gridx = 0;
16051662 aConstraints.gridy += 1;
16061663 aConstraints.gridwidth = 1;
....@@ -1671,7 +1728,7 @@
16711728 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16721729 aConstraints.gridx += 1;
16731730 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1731
+ ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16751732 aConstraints.gridx = 0;
16761733 aConstraints.gridy += 1;
16771734 aConstraints.gridwidth = 1;
....@@ -1859,19 +1916,21 @@
18591916 }
18601917
18611918 // Images/textures
1862
- if (textures
1863
- && (filename.toLowerCase().endsWith(".jpg")
1864
- || filename.toLowerCase().endsWith(".jpeg")
1865
- || filename.toLowerCase().endsWith(".gif")
1866
- || filename.toLowerCase().endsWith(".png")
1867
- || filename.toLowerCase().endsWith(".tre")
1868
- || filename.toLowerCase().endsWith(".bmp")
1869
- || filename.toLowerCase().endsWith(".tga")
1870
- || filename.toLowerCase().endsWith(".sgi")
1871
- || filename.toLowerCase().endsWith(".tif")
1872
- || filename.toLowerCase().endsWith(".tiff")))
1919
+ if (filename.toLowerCase().endsWith(".jpg")
1920
+ || filename.toLowerCase().endsWith(".jpeg")
1921
+ || filename.toLowerCase().endsWith(".gif")
1922
+ || filename.toLowerCase().endsWith(".png")
1923
+ || filename.toLowerCase().endsWith(".tre")
1924
+ || filename.toLowerCase().endsWith(".bmp")
1925
+ || filename.toLowerCase().endsWith(".tga")
1926
+ || filename.toLowerCase().endsWith(".sgi")
1927
+ || filename.toLowerCase().endsWith(".tif")
1928
+ || filename.toLowerCase().endsWith(".tiff"))
18731929 {
1874
- DropTexture(filename);
1930
+ if (textures)
1931
+ DropTexture(filename);
1932
+ else
1933
+ CreateBillboard(filename);
18751934 continue;
18761935 }
18771936
....@@ -1880,6 +1939,60 @@
18801939 }
18811940
18821941 ResetModel();
1942
+ }
1943
+
1944
+ void CreateBillboard(String filename)
1945
+ {
1946
+ Object3D source = null;
1947
+ Object3D group = copy;
1948
+
1949
+ if (group.selection.size() > 0)
1950
+ {
1951
+ source = group.selection.get(0);
1952
+ }
1953
+
1954
+ Grid grid = new Grid(1,1);
1955
+ grid.material = null;
1956
+
1957
+ grid.toParent = LA.newMatrix();
1958
+ grid.fromParent = LA.newMatrix();
1959
+ LA.matYRotate(grid.toParent, Math.PI/2);
1960
+ LA.matXRotate(grid.toParent, -Math.PI/2);
1961
+ LA.matXRotate(grid.fromParent, Math.PI/2);
1962
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
1963
+
1964
+ BillboardNode bb = new BillboardNode();
1965
+ bb.addChild(grid);
1966
+
1967
+ Object3D newgroup = new Object3D();
1968
+ newgroup.CreateMaterial();
1969
+
1970
+ File file = new File(filename);
1971
+ newgroup.name = file.getName();
1972
+ newgroup.addChild(bb);
1973
+
1974
+ Object3D main = newgroup;
1975
+
1976
+ main.SetPigmentTexture(filename);
1977
+
1978
+ if (source != null)
1979
+ {
1980
+ main.material = new cMaterial(source.material);
1981
+ if (main.projectedVertices.length < source.projectedVertices.length)
1982
+ {
1983
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
1984
+ }
1985
+
1986
+ for (int i=0; i<source.projectedVertices.length; i++)
1987
+ {
1988
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
1989
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
1990
+ }
1991
+
1992
+ main.texres = source.texres;
1993
+ }
1994
+
1995
+ makeSomething(newgroup, false);
18831996 }
18841997
18851998 Point location;
....@@ -2138,6 +2251,8 @@
21382251 {
21392252 Mocap sel = (Mocap) copy.selection.get(0);
21402253
2254
+ sel.SetCurrentBones(sel.frame);
2255
+
21412256 sel.fullname = fullname;
21422257
21432258 if (changename)
....@@ -2151,14 +2266,18 @@
21512266 sel.smoothed = false;
21522267
21532268 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2269
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2270
+ sel.SetGlobalTransform();
2271
+ sel.LoadData();
2272
+ sel.Rewind();
2273
+ sel.Fade();
21552274 // sel.setPose(0);
21562275 refreshContents();
21572276 } else
21582277 {
21592278 mocap.Reset();
21602279 // new skeleton
2161
- makeSomething(mocap, false); // true);
2280
+ makeSomething(mocap, true); // true);
21622281 }
21632282 } catch (Exception e)
21642283 {
....@@ -2185,6 +2304,8 @@
21852304 {
21862305 Mocap sel = (Mocap) select;
21872306
2307
+ sel.SetCurrentBones(sel.frame);
2308
+
21882309 File file = new File(fullname);
21892310
21902311 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2372,11 @@
22512372
22522373 if (!changename)
22532374 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2375
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2376
+ sel.SetGlobalTransform();
2377
+ sel.LoadData();
2378
+ sel.Rewind();
2379
+ sel.Fade();
22552380 }
22562381
22572382 // sel.setPose(0);
....@@ -2345,7 +2470,7 @@
23452470
23462471 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472472 {
2348
- if (GraphreeD.standAlone)
2473
+ if (GrafreeD.standAlone)
23492474 {
23502475 /**/
23512476 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
....@@ -2890,20 +3015,37 @@
28903015 // june 2013 copy.HardTouch();
28913016 cameraView.repaint();
28923017 return;
2893
- } else if (event.getSource() == toggleFullItem)
3018
+ } else if (event.getSource() == toggleTimelineItem)
28943019 {
2895
- if (CameraPane.FULLSCREEN)
3020
+ timeline ^= true;
3021
+
3022
+ if (timeline)
28963023 {
2897
- frame.getContentPane().remove(/*"Center",*/bigThree);
2898
- framePanel.add(bigThree);
2899
- frame.getContentPane().add(/*"Center",*/framePanel);
2900
- } else
2901
- {
2902
- frame.getContentPane().remove(/*"Center",*/framePanel);
2903
- frame.getContentPane().add(/*"Center",*/bigThree);
3024
+ centralPanel.remove(cameraView);
3025
+ cameraPanel.add(cameraView);
3026
+ centralPanel.add(cameraPanel);
3027
+ frame.setJMenuBar(timelineMenubar);
3028
+ wasFullScreen = CameraPane.FULLSCREEN;
3029
+ if (!CameraPane.FULLSCREEN)
3030
+ ToggleFullScreen();
3031
+ toggleFullScreenItem.setEnabled(false);
29043032 }
3033
+ else
3034
+ {
3035
+ centralPanel.remove(cameraPanel);
3036
+ centralPanel.add(cameraView);
3037
+ frame.setJMenuBar(null);
3038
+ if (!wasFullScreen)
3039
+ ToggleFullScreen();
3040
+ toggleFullScreenItem.setEnabled(true);
3041
+ }
3042
+
29053043 frame.validate();
2906
- cameraView.ToggleFullScreen();
3044
+ return;
3045
+ } else if (event.getSource() == toggleFullScreenItem)
3046
+ {
3047
+ ToggleFullScreen();
3048
+ frame.validate();
29073049
29083050 return;
29093051 } else if (event.getSource() == toggleRandomItem)
....@@ -3013,7 +3155,8 @@
30133155 objEditor.refreshContents();
30143156 } else if (event.getSource() == stepItem)
30153157 {
3016
- cameraView.ONESTEP = true;
3158
+ //cameraView.ONESTEP = true;
3159
+ Globals.ONESTEP = true;
30173160 cameraView.repaint();
30183161 return;
30193162 } else if (event.getSource() == stepButton)
....@@ -3152,9 +3295,9 @@
31523295 cameraView.RevertCamera();
31533296 cameraView.repaint();
31543297 return;
3155
- } else if (event.getSource() == textureButton)
3156
- {
3157
- return; // true;
3298
+// } else if (event.getSource() == textureButton)
3299
+// {
3300
+// return; // true;
31583301 } else // combos...
31593302 if (event.getSource() == texresMenu)
31603303 {
....@@ -3170,25 +3313,25 @@
31703313
31713314 void ToggleAnimation()
31723315 {
3173
- if (!CameraPane.ANIMATION)
3316
+ if (!Globals.ANIMATION)
31743317 {
31753318 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
31763319 browser.show();
31773320 String filename = browser.getFile();
31783321 if (filename != null && filename.length() > 0)
31793322 {
3180
- CameraPane.filename = browser.getDirectory() + filename;
3323
+ Globals.filename = browser.getDirectory() + filename;
31813324 //CameraPane.framecount = 0;
3182
- CameraPane.imagecount = 0;
3325
+ Globals.imagecount = 0;
31833326
3184
- CameraPane.ANIMATION ^= true;
3327
+ Globals.ANIMATION ^= true;
31853328
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
3329
+ GrafreeD.wav.cursor = 0;
3330
+ GrafreeD.wav.loop = 0;
31883331 }
31893332 } else
31903333 {
3191
- CameraPane.ANIMATION ^= true;
3334
+ Globals.ANIMATION ^= true;
31923335 }
31933336 }
31943337
....@@ -3441,7 +3584,13 @@
34413584 //System.out.println("PARENT = " + parent);
34423585 //if (parent != null)
34433586 // parent.applySelf();
3444
- refreshContents();
3587
+ if (e.getSource() == normalpushField)
3588
+ {
3589
+ objEditor.refreshContents();
3590
+ //Refresh();
3591
+ }
3592
+ else
3593
+ refreshContents();
34453594 // ??? client.refreshEditWindow();
34463595 }
34473596 //else
....@@ -3453,7 +3602,7 @@
34533602 //group.name = nameField.getText();
34543603 //objEditor.applySelf();
34553604
3456
- assert (objEditor == this);
3605
+ // OCT2018: assert (objEditor == this);
34573606 if (copy.selection == null || copy.selection.size() == 0)
34583607 //super.applySelf()
34593608 ; else
....@@ -3477,12 +3626,18 @@
34773626 objEditor.copy = keep;
34783627 }
34793628 }
3629
+
3630
+ if (normalpushField != null)
3631
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
34803632 }
34813633
34823634 void SnapObject()
34833635 {
3484
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3485
- SnapObject(obj);
3636
+ if (copy.selection.size() > 0)
3637
+ {
3638
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3639
+ SnapObject(obj);
3640
+ }
34863641 }
34873642
34883643 void SnapObject(Object3D obj)
....@@ -3596,7 +3751,7 @@
35963751
35973752 if (obj.parent != null)
35983753 {
3599
- obj.parent.TransformToWorld(interest);
3754
+// obj.parent.TransformToWorld(interest);
36003755 }
36013756
36023757 if (!CameraPane.TRACK)
....@@ -4085,7 +4240,7 @@
40854240
40864241 void load() // throws ClassNotFoundException
40874242 {
4088
- if (GraphreeD.standAlone)
4243
+ if (GrafreeD.standAlone)
40894244 {
40904245 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914246 browser.show();
....@@ -4190,7 +4345,7 @@
41904345
41914346 void saveAs()
41924347 {
4193
- if (GraphreeD.standAlone)
4348
+ if (GrafreeD.standAlone)
41944349 {
41954350 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964351 browser.setVisible(true);
....@@ -4213,10 +4368,20 @@
42134368
42144369 Object3D object = copy.selection.get(0);
42154370
4371
+ FileObject fileobj = null;
4372
+
4373
+ if (object instanceof FileObject)
4374
+ fileobj = (FileObject)object;
4375
+
42164376 if (object.fileparent != null)
42174377 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
4378
+ assert(fileobj == null);
42194379
4380
+ fileobj = (FileObject) object.fileparent;
4381
+ }
4382
+
4383
+ if (fileobj != null)
4384
+ {
42204385 System.out.println("WriteObject " + object + " : " + fileobj.name);
42214386 WriteObject(object, fileobj.name);
42224387 }
....@@ -4259,7 +4424,7 @@
42594424 }
42604425 }
42614426 else
4262
- //if (GraphreeD.standAlone)
4427
+ //if (GrafreeD.standAlone)
42634428 {
42644429 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42654430 browser.setVisible(true);
....@@ -4291,7 +4456,7 @@
42914456 Object3D objectparent = obj.parent;
42924457 obj.parent = null;
42934458
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
4459
+ Object3D object = (Object3D) GrafreeD.clone(obj);
42954460
42964461 obj.parent = objectparent;
42974462
....@@ -4325,7 +4490,7 @@
43254490 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43264491 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43274492 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
4493
+ if (GrafreeD.standAlone)
43294494 {
43304495 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43314496 browser.show();
....@@ -4366,7 +4531,8 @@
43664531 MenuItem revertCameraItem;
43674532 CheckboxMenuItem toggleLiveItem;
43684533 MenuItem stepItem;
4369
- CheckboxMenuItem toggleFullItem;
4534
+ CheckboxMenuItem toggleFullScreenItem;
4535
+ CheckboxMenuItem toggleTimelineItem;
43704536 CheckboxMenuItem toggleRenderItem;
43714537 CheckboxMenuItem toggleDebugItem;
43724538 CheckboxMenuItem toggleFrustumItem;
....@@ -4389,15 +4555,18 @@
43894555 JScrollPane infoPanel;
43904556 JPanel optionsPanel;
43914557 JTabbedPane objectPanel;
4392
- JPanel XYZPanel;
4558
+ cGridBag XYZPanel;
43934559 JSplitPane gridPanel;
43944560 JSplitPane bigPanel;
4395
- JPanel bigThree;
4396
- JTabbedPane jtp;
4397
- JPanel cameraPanel;
4561
+ cGridBag bigThree;
4562
+ JTabbedPane scenePanel;
4563
+ JPanel centralPanel;
4564
+ JSplitPane cameraPanel;
4565
+ JPanel timelinePanel;
4566
+ JMenuBar timelineMenubar;
43984567 JSplitPane framePanel;
43994568 JTextArea/*Field*/ nameField;
4400
- cButton textureButton;
4569
+ //cButton textureButton;
44014570 cButton okButton;
44024571 cButton applyButton;
44034572 cButton cancelButton;
....@@ -4505,4 +4674,6 @@
45054674 NumberSlider opacityPowerField;
45064675 JTree jTree;
45074676 //ObjectUI parent;
4677
+
4678
+ NumberSlider normalpushField;
45084679 }