Normand Briere
2019-04-29 c0c300a9dbd4c0fc127e003e9481d3f9246bbe7a
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,22 @@
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 cGridBag();
1193
+ centralPanel.preferredWidth = 20;
1194
+ timelinePanel = new JPanel(new BorderLayout());
1195
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11641196
1197
+ cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
1198
+ cameraPanel.setContinuousLayout(true);
1199
+ cameraPanel.setOneTouchExpandable(true);
1200
+// cameraPanel.setDividerLocation(0.9);
1201
+// cameraPanel.setDividerSize(9);
1202
+ cameraPanel.setResizeWeight(1.0);
1203
+
1204
+ centralPanel.add(cameraView);
1205
+ //frame.setJMenuBar(timelineMenubar);
1206
+ //centralPanel.add(timelinePanel);
1207
+
11651208 //topView.camera = ;
11661209 //frontView.camera = new Camera(2);
11671210 //sideView.camera = new Camera(3);
....@@ -1177,12 +1220,13 @@
11771220 //frontView.object = copy;
11781221 //sideView.object = copy;
11791222
1180
- XYZPanel = new JPanel();
1181
- XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
1223
+ XYZPanel = new cGridBag().setVertical(true);
1224
+ //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
11821225
1183
- XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1184
- XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll);
1185
- XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll);
1226
+ XYZPanel.preferredWidth = 5;
1227
+ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
1228
+ XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
1229
+ XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
11861230
11871231 /*
11881232 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1191,7 +1235,7 @@
11911235 gridPanel.add(cameraView);
11921236 gridPanel.add(XYZPanel);
11931237 */
1194
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
1238
+ gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
11951239 gridPanel.setContinuousLayout(true);
11961240 gridPanel.setOneTouchExpandable(true);
11971241 gridPanel.setDividerLocation(1.0);
....@@ -1244,16 +1288,23 @@
12441288 scrollpane.setWheelScrollingEnabled(true);
12451289 scrollpane.addMouseWheelListener(this); // Default not fast enough
12461290
1247
- /*JTabbedPane*/ jtp = new JTabbedPane();
1248
- jtp.add(scrollpane);
1291
+ /*JTabbedPane*/ scenePanel = new cGridBag();
1292
+ scenePanel.preferredWidth = 7;
1293
+
1294
+ JTabbedPane tabbedPane = new JTabbedPane();
1295
+ tabbedPane.add(scrollpane);
12491296
1250
- jtp.add(FSPane = new cFileSystemPane(this));
1297
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
12511298
12521299 optionsPanel = new JPanel(new GridBagLayout());
12531300
12541301 optionsPanel.setName("Options");
1255
- jtp.add(optionsPanel);
1256
-
1302
+
1303
+ AddOptions(optionsPanel, aConstraints);
1304
+
1305
+ tabbedPane.add(optionsPanel);
1306
+
1307
+ scenePanel.add(tabbedPane);
12571308
12581309 /*
12591310 cTree jTree = new cTree(null);
....@@ -1275,7 +1326,7 @@
12751326 jtp.add(tree);
12761327 */
12771328
1278
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
1329
+ bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
12791330 bigPanel.setContinuousLayout(true);
12801331 bigPanel.setOneTouchExpandable(true);
12811332 bigPanel.setDividerLocation(0.8);
....@@ -1287,6 +1338,7 @@
12871338 //bigPanel.setSize(new Dimension(10,10));
12881339 //bigPanel.add(ctrlPanel);
12891340 //bigPanel.add(gridPanel);
1341
+ /**
12901342 bigThree = new JPanel();
12911343 //big.setLayout(new FlowLayout(FlowLayout.LEFT));
12921344 bigThree.setLayout(new GridBagLayout()); //1,3,5,5));
....@@ -1297,20 +1349,26 @@
12971349 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
12981350 aWindowConstraints.weightx = 0;
12991351 aWindowConstraints.weighty = 1;
1300
- bigThree.add(jtp, aWindowConstraints);
1352
+ bigThree.add(scenePanel, aWindowConstraints);
13011353 aWindowConstraints.weightx = 1;
13021354 aWindowConstraints.gridwidth = 3;
13031355 // aConstraints.gridheight = 3;
13041356 aWindowConstraints.gridx = 1;
13051357 aWindowConstraints.fill = GridBagConstraints.BOTH;
1306
- bigThree.add(cameraPanel, aWindowConstraints);
1358
+ bigThree.add(centralPanel, aWindowConstraints);
13071359 aWindowConstraints.weightx = 0;
13081360 aWindowConstraints.gridx = 4;
13091361 aWindowConstraints.gridwidth = 1;
13101362 // aConstraints.gridheight = 3;
13111363 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
13121364 bigThree.add(XYZPanel, aWindowConstraints);
1365
+ /**/
13131366
1367
+ bigThree = new cGridBag();
1368
+ bigThree.addComponent(scenePanel);
1369
+ bigThree.addComponent(centralPanel);
1370
+ bigThree.addComponent(XYZPanel);
1371
+
13141372 // // SIDE EFFECT!!!
13151373 // aConstraints.gridx = 0;
13161374 // aConstraints.gridy = 0;
....@@ -1331,12 +1389,13 @@
13311389 //worldPane.add(bigPanel);
13321390 //worldPane.add(worldPanel);
13331391 /**/
1334
- frame.getContentPane().add(/*"Center",*/framePanel);
1392
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1393
+ frame.add(/*"Center",*/framePanel);
13351394 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361395
1337
-// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc);
1396
+// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381397
1339
- frame.setSize(800, 600);
1398
+ frame.setSize(1024, 768);
13401399 frame.show();
13411400
13421401 gridPanel.setDividerLocation(1.0);
....@@ -1352,6 +1411,10 @@
13521411 });
13531412 }
13541413
1414
+ void AddOptions(JPanel panel, GridBagConstraints constraints)
1415
+ {
1416
+ }
1417
+
13551418 JTree GetTree()
13561419 {
13571420 return objEditor.jTree;
....@@ -1422,7 +1485,7 @@
14221485 aConstraints.gridx += 1;
14231486 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
14241487 //aConstraints.weightx = 0;
1425
- ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1488
+ ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14261489 aConstraints.gridx = 0;
14271490 aConstraints.gridy += 1;
14281491 aConstraints.gridwidth = 1;
....@@ -1432,7 +1495,7 @@
14321495 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14331496 aConstraints.gridx += 1;
14341497 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1435
- ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1498
+ ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14361499 aConstraints.gridx = 0;
14371500 aConstraints.gridy += 1;
14381501 aConstraints.gridwidth = 1;
....@@ -1442,7 +1505,7 @@
14421505 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14431506 aConstraints.gridx += 1;
14441507 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1445
- ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1508
+ ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14461509 aConstraints.gridx = 0;
14471510 aConstraints.gridy += 1;
14481511 aConstraints.gridwidth = 1;
....@@ -1452,7 +1515,7 @@
14521515 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14531516 aConstraints.gridx += 1;
14541517 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1455
- ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1518
+ ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14561519 aConstraints.gridx = 0;
14571520 aConstraints.gridy += 1;
14581521 aConstraints.gridwidth = 1;
....@@ -1462,7 +1525,7 @@
14621525 aConstraints.fill = GridBagConstraints.HORIZONTAL;
14631526 aConstraints.gridx += 1;
14641527 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1465
- ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1528
+ ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints);
14661529 aConstraints.gridx = 0;
14671530 aConstraints.gridy += 1;
14681531 aConstraints.gridwidth = 1;
....@@ -1531,7 +1594,7 @@
15311594 aConstraints.fill = GridBagConstraints.HORIZONTAL;
15321595 aConstraints.gridx += 1;
15331596 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1534
- ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1597
+ ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints);
15351598 aConstraints.gridx = 0;
15361599 aConstraints.gridy += 1;
15371600 aConstraints.gridwidth = 1;
....@@ -1600,7 +1663,7 @@
16001663 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16011664 aConstraints.gridx += 1;
16021665 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1603
- ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1666
+ ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16041667 aConstraints.gridx = 0;
16051668 aConstraints.gridy += 1;
16061669 aConstraints.gridwidth = 1;
....@@ -1671,7 +1734,7 @@
16711734 aConstraints.fill = GridBagConstraints.HORIZONTAL;
16721735 aConstraints.gridx += 1;
16731736 aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
1674
- ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints);
1737
+ ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints);
16751738 aConstraints.gridx = 0;
16761739 aConstraints.gridy += 1;
16771740 aConstraints.gridwidth = 1;
....@@ -1859,19 +1922,21 @@
18591922 }
18601923
18611924 // 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")))
1925
+ if (filename.toLowerCase().endsWith(".jpg")
1926
+ || filename.toLowerCase().endsWith(".jpeg")
1927
+ || filename.toLowerCase().endsWith(".gif")
1928
+ || filename.toLowerCase().endsWith(".png")
1929
+ || filename.toLowerCase().endsWith(".tre")
1930
+ || filename.toLowerCase().endsWith(".bmp")
1931
+ || filename.toLowerCase().endsWith(".tga")
1932
+ || filename.toLowerCase().endsWith(".sgi")
1933
+ || filename.toLowerCase().endsWith(".tif")
1934
+ || filename.toLowerCase().endsWith(".tiff"))
18731935 {
1874
- DropTexture(filename);
1936
+ if (textures)
1937
+ DropTexture(filename);
1938
+ else
1939
+ CreateBillboard(filename);
18751940 continue;
18761941 }
18771942
....@@ -1880,6 +1945,60 @@
18801945 }
18811946
18821947 ResetModel();
1948
+ }
1949
+
1950
+ void CreateBillboard(String filename)
1951
+ {
1952
+ Object3D source = null;
1953
+ Object3D group = copy;
1954
+
1955
+ if (group.selection.size() > 0)
1956
+ {
1957
+ source = group.selection.get(0);
1958
+ }
1959
+
1960
+ Grid grid = new Grid(1,1);
1961
+ grid.material = null;
1962
+
1963
+ grid.toParent = LA.newMatrix();
1964
+ grid.fromParent = LA.newMatrix();
1965
+ LA.matYRotate(grid.toParent, Math.PI/2);
1966
+ LA.matXRotate(grid.toParent, -Math.PI/2);
1967
+ LA.matXRotate(grid.fromParent, Math.PI/2);
1968
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
1969
+
1970
+ BillboardNode bb = new BillboardNode();
1971
+ bb.addChild(grid);
1972
+
1973
+ Object3D newgroup = new Object3D();
1974
+ newgroup.CreateMaterial();
1975
+
1976
+ File file = new File(filename);
1977
+ newgroup.name = file.getName();
1978
+ newgroup.addChild(bb);
1979
+
1980
+ Object3D main = newgroup;
1981
+
1982
+ main.SetPigmentTexture(filename);
1983
+
1984
+ if (source != null)
1985
+ {
1986
+ main.material = new cMaterial(source.material);
1987
+ if (main.projectedVertices.length < source.projectedVertices.length)
1988
+ {
1989
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
1990
+ }
1991
+
1992
+ for (int i=0; i<source.projectedVertices.length; i++)
1993
+ {
1994
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
1995
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
1996
+ }
1997
+
1998
+ main.texres = source.texres;
1999
+ }
2000
+
2001
+ makeSomething(newgroup, false);
18832002 }
18842003
18852004 Point location;
....@@ -2138,6 +2257,8 @@
21382257 {
21392258 Mocap sel = (Mocap) copy.selection.get(0);
21402259
2260
+ sel.SetCurrentBones(sel.frame);
2261
+
21412262 sel.fullname = fullname;
21422263
21432264 if (changename)
....@@ -2151,14 +2272,18 @@
21512272 sel.smoothed = false;
21522273
21532274 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2275
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2276
+ sel.SetGlobalTransform();
2277
+ sel.LoadData();
2278
+ sel.Rewind();
2279
+ sel.Fade();
21552280 // sel.setPose(0);
21562281 refreshContents();
21572282 } else
21582283 {
21592284 mocap.Reset();
21602285 // new skeleton
2161
- makeSomething(mocap, false); // true);
2286
+ makeSomething(mocap, true); // true);
21622287 }
21632288 } catch (Exception e)
21642289 {
....@@ -2185,6 +2310,8 @@
21852310 {
21862311 Mocap sel = (Mocap) select;
21872312
2313
+ sel.SetCurrentBones(sel.frame);
2314
+
21882315 File file = new File(fullname);
21892316
21902317 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2378,11 @@
22512378
22522379 if (!changename)
22532380 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2381
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2382
+ sel.SetGlobalTransform();
2383
+ sel.LoadData();
2384
+ sel.Rewind();
2385
+ sel.Fade();
22552386 }
22562387
22572388 // sel.setPose(0);
....@@ -2345,7 +2476,7 @@
23452476
23462477 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472478 {
2348
- if (GraphreeD.standAlone)
2479
+ if (GrafreeD.standAlone)
23492480 {
23502481 /**/
23512482 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
....@@ -2890,20 +3021,37 @@
28903021 // june 2013 copy.HardTouch();
28913022 cameraView.repaint();
28923023 return;
2893
- } else if (event.getSource() == toggleFullItem)
3024
+ } else if (event.getSource() == toggleTimelineItem)
28943025 {
2895
- if (CameraPane.FULLSCREEN)
3026
+ timeline ^= true;
3027
+
3028
+ if (timeline)
28963029 {
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);
3030
+ centralPanel.remove(cameraView);
3031
+ cameraPanel.add(cameraView);
3032
+ centralPanel.add(cameraPanel);
3033
+ frame.setJMenuBar(timelineMenubar);
3034
+ wasFullScreen = CameraPane.FULLSCREEN;
3035
+ if (!CameraPane.FULLSCREEN)
3036
+ ToggleFullScreen();
3037
+ toggleFullScreenItem.setEnabled(false);
29043038 }
3039
+ else
3040
+ {
3041
+ centralPanel.remove(cameraPanel);
3042
+ centralPanel.add(cameraView);
3043
+ frame.setJMenuBar(null);
3044
+ if (!wasFullScreen)
3045
+ ToggleFullScreen();
3046
+ toggleFullScreenItem.setEnabled(true);
3047
+ }
3048
+
29053049 frame.validate();
2906
- cameraView.ToggleFullScreen();
3050
+ return;
3051
+ } else if (event.getSource() == toggleFullScreenItem)
3052
+ {
3053
+ ToggleFullScreen();
3054
+ frame.validate();
29073055
29083056 return;
29093057 } else if (event.getSource() == toggleRandomItem)
....@@ -3013,7 +3161,8 @@
30133161 objEditor.refreshContents();
30143162 } else if (event.getSource() == stepItem)
30153163 {
3016
- cameraView.ONESTEP = true;
3164
+ //cameraView.ONESTEP = true;
3165
+ Globals.ONESTEP = true;
30173166 cameraView.repaint();
30183167 return;
30193168 } else if (event.getSource() == stepButton)
....@@ -3152,9 +3301,9 @@
31523301 cameraView.RevertCamera();
31533302 cameraView.repaint();
31543303 return;
3155
- } else if (event.getSource() == textureButton)
3156
- {
3157
- return; // true;
3304
+// } else if (event.getSource() == textureButton)
3305
+// {
3306
+// return; // true;
31583307 } else // combos...
31593308 if (event.getSource() == texresMenu)
31603309 {
....@@ -3170,25 +3319,25 @@
31703319
31713320 void ToggleAnimation()
31723321 {
3173
- if (!CameraPane.ANIMATION)
3322
+ if (!Globals.ANIMATION)
31743323 {
31753324 FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
31763325 browser.show();
31773326 String filename = browser.getFile();
31783327 if (filename != null && filename.length() > 0)
31793328 {
3180
- CameraPane.filename = browser.getDirectory() + filename;
3329
+ Globals.filename = browser.getDirectory() + filename;
31813330 //CameraPane.framecount = 0;
3182
- CameraPane.imagecount = 0;
3331
+ Globals.imagecount = 0;
31833332
3184
- CameraPane.ANIMATION ^= true;
3333
+ Globals.ANIMATION ^= true;
31853334
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
3335
+ GrafreeD.wav.cursor = 0;
3336
+ GrafreeD.wav.loop = 0;
31883337 }
31893338 } else
31903339 {
3191
- CameraPane.ANIMATION ^= true;
3340
+ Globals.ANIMATION ^= true;
31923341 }
31933342 }
31943343
....@@ -3441,7 +3590,13 @@
34413590 //System.out.println("PARENT = " + parent);
34423591 //if (parent != null)
34433592 // parent.applySelf();
3444
- refreshContents();
3593
+ if (e.getSource() == normalpushField)
3594
+ {
3595
+ objEditor.refreshContents();
3596
+ //Refresh();
3597
+ }
3598
+ else
3599
+ refreshContents();
34453600 // ??? client.refreshEditWindow();
34463601 }
34473602 //else
....@@ -3453,7 +3608,7 @@
34533608 //group.name = nameField.getText();
34543609 //objEditor.applySelf();
34553610
3456
- assert (objEditor == this);
3611
+ // OCT2018: assert (objEditor == this);
34573612 if (copy.selection == null || copy.selection.size() == 0)
34583613 //super.applySelf()
34593614 ; else
....@@ -3477,12 +3632,18 @@
34773632 objEditor.copy = keep;
34783633 }
34793634 }
3635
+
3636
+ if (normalpushField != null)
3637
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
34803638 }
34813639
34823640 void SnapObject()
34833641 {
3484
- Object3D obj = (Object3D)copy.selection.elementAt(0);
3485
- SnapObject(obj);
3642
+ if (copy.selection.size() > 0)
3643
+ {
3644
+ Object3D obj = (Object3D)copy.selection.elementAt(0);
3645
+ SnapObject(obj);
3646
+ }
34863647 }
34873648
34883649 void SnapObject(Object3D obj)
....@@ -3596,7 +3757,7 @@
35963757
35973758 if (obj.parent != null)
35983759 {
3599
- obj.parent.TransformToWorld(interest);
3760
+// obj.parent.TransformToWorld(interest);
36003761 }
36013762
36023763 if (!CameraPane.TRACK)
....@@ -4085,7 +4246,7 @@
40854246
40864247 void load() // throws ClassNotFoundException
40874248 {
4088
- if (GraphreeD.standAlone)
4249
+ if (GrafreeD.standAlone)
40894250 {
40904251 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914252 browser.show();
....@@ -4190,7 +4351,7 @@
41904351
41914352 void saveAs()
41924353 {
4193
- if (GraphreeD.standAlone)
4354
+ if (GrafreeD.standAlone)
41944355 {
41954356 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964357 browser.setVisible(true);
....@@ -4213,10 +4374,20 @@
42134374
42144375 Object3D object = copy.selection.get(0);
42154376
4377
+ FileObject fileobj = null;
4378
+
4379
+ if (object instanceof FileObject)
4380
+ fileobj = (FileObject)object;
4381
+
42164382 if (object.fileparent != null)
42174383 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
4384
+ assert(fileobj == null);
42194385
4386
+ fileobj = (FileObject) object.fileparent;
4387
+ }
4388
+
4389
+ if (fileobj != null)
4390
+ {
42204391 System.out.println("WriteObject " + object + " : " + fileobj.name);
42214392 WriteObject(object, fileobj.name);
42224393 }
....@@ -4259,7 +4430,7 @@
42594430 }
42604431 }
42614432 else
4262
- //if (GraphreeD.standAlone)
4433
+ //if (GrafreeD.standAlone)
42634434 {
42644435 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42654436 browser.setVisible(true);
....@@ -4291,7 +4462,7 @@
42914462 Object3D objectparent = obj.parent;
42924463 obj.parent = null;
42934464
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
4465
+ Object3D object = (Object3D) GrafreeD.clone(obj);
42954466
42964467 obj.parent = objectparent;
42974468
....@@ -4325,7 +4496,7 @@
43254496 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43264497 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43274498 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
4499
+ if (GrafreeD.standAlone)
43294500 {
43304501 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43314502 browser.show();
....@@ -4366,7 +4537,8 @@
43664537 MenuItem revertCameraItem;
43674538 CheckboxMenuItem toggleLiveItem;
43684539 MenuItem stepItem;
4369
- CheckboxMenuItem toggleFullItem;
4540
+ CheckboxMenuItem toggleFullScreenItem;
4541
+ CheckboxMenuItem toggleTimelineItem;
43704542 CheckboxMenuItem toggleRenderItem;
43714543 CheckboxMenuItem toggleDebugItem;
43724544 CheckboxMenuItem toggleFrustumItem;
....@@ -4389,15 +4561,18 @@
43894561 JScrollPane infoPanel;
43904562 JPanel optionsPanel;
43914563 JTabbedPane objectPanel;
4392
- JPanel XYZPanel;
4564
+ cGridBag XYZPanel;
43934565 JSplitPane gridPanel;
43944566 JSplitPane bigPanel;
4395
- JPanel bigThree;
4396
- JTabbedPane jtp;
4397
- JPanel cameraPanel;
4567
+ cGridBag bigThree;
4568
+ cGridBag scenePanel;
4569
+ cGridBag centralPanel;
4570
+ JSplitPane cameraPanel;
4571
+ JPanel timelinePanel;
4572
+ JMenuBar timelineMenubar;
43984573 JSplitPane framePanel;
43994574 JTextArea/*Field*/ nameField;
4400
- cButton textureButton;
4575
+ //cButton textureButton;
44014576 cButton okButton;
44024577 cButton applyButton;
44034578 cButton cancelButton;
....@@ -4505,4 +4680,6 @@
45054680 NumberSlider opacityPowerField;
45064681 JTree jTree;
45074682 //ObjectUI parent;
4683
+
4684
+ NumberSlider normalpushField;
45084685 }