Normand Briere
2018-07-01 89c1ad67bc65d24ceadfa9e95f8c5515283f1e97
ObjEditor.java
....@@ -522,18 +522,18 @@
522522 maxima.y = sel.toParent[3][1];
523523 maxima.z = sel.toParent[3][2];
524524 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");
530525 maxima.x = sel.toParent[0][0];
531526 maxima.y = sel.toParent[1][1];
532527 maxima.z = sel.toParent[2][2];
533528 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];
529
+ maxima.x = sel.globalTransform[3][0];
530
+ maxima.y = sel.globalTransform[3][1];
531
+ maxima.z = sel.globalTransform[3][2];
532
+ if (full)
533
+ si.SendInfo(" Global Orig: " + maxima, "regular");
534
+ maxima.x = sel.globalTransform[0][0];
535
+ maxima.y = sel.globalTransform[1][1];
536
+ maxima.z = sel.globalTransform[2][2];
537537 if (full)
538538 si.SendInfo(" Global Scale: " + maxima, "regular");
539539 }
....@@ -692,7 +692,7 @@
692692 protected static ImageIcon createImageIcon(String path,
693693 String description)
694694 {
695
- java.net.URL imgURL = GraphreeD.class.getResource(path);
695
+ java.net.URL imgURL = GrafreeD.class.getResource(path);
696696 if (imgURL != null)
697697 {
698698 return new ImageIcon(imgURL, description);
....@@ -1107,7 +1107,7 @@
11071107 //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------");
11081108 //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------");
11091109
1110
-// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints);
1110
+// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints);
11111111 Camera cam = GetCamera(copy, 0);
11121112
11131113 Composite cams = null;
....@@ -1334,7 +1334,7 @@
13341334 frame.getContentPane().add(/*"Center",*/framePanel);
13351335 //frame.getContentPane().add(/*"Center",*/ worldPane);
13361336
1337
-// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc);
1337
+// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13381338
13391339 frame.setSize(1024, 768);
13401340 frame.show();
....@@ -1859,19 +1859,21 @@
18591859 }
18601860
18611861 // 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")))
1862
+ if (filename.toLowerCase().endsWith(".jpg")
1863
+ || filename.toLowerCase().endsWith(".jpeg")
1864
+ || filename.toLowerCase().endsWith(".gif")
1865
+ || filename.toLowerCase().endsWith(".png")
1866
+ || filename.toLowerCase().endsWith(".tre")
1867
+ || filename.toLowerCase().endsWith(".bmp")
1868
+ || filename.toLowerCase().endsWith(".tga")
1869
+ || filename.toLowerCase().endsWith(".sgi")
1870
+ || filename.toLowerCase().endsWith(".tif")
1871
+ || filename.toLowerCase().endsWith(".tiff"))
18731872 {
1874
- DropTexture(filename);
1873
+ if (textures)
1874
+ DropTexture(filename);
1875
+ else
1876
+ CreateBillboard(filename);
18751877 continue;
18761878 }
18771879
....@@ -1880,6 +1882,60 @@
18801882 }
18811883
18821884 ResetModel();
1885
+ }
1886
+
1887
+ void CreateBillboard(String filename)
1888
+ {
1889
+ Object3D source = null;
1890
+ Object3D group = copy;
1891
+
1892
+ if (group.selection.size() > 0)
1893
+ {
1894
+ source = group.selection.get(0);
1895
+ }
1896
+
1897
+ Grid grid = new Grid(1,1);
1898
+ grid.material = null;
1899
+
1900
+ grid.toParent = LA.newMatrix();
1901
+ grid.fromParent = LA.newMatrix();
1902
+ LA.matYRotate(grid.toParent, Math.PI/2);
1903
+ LA.matXRotate(grid.toParent, -Math.PI/2);
1904
+ LA.matXRotate(grid.fromParent, Math.PI/2);
1905
+ LA.matYRotate(grid.fromParent, -Math.PI/2);
1906
+
1907
+ BillboardNode bb = new BillboardNode();
1908
+ bb.addChild(grid);
1909
+
1910
+ Object3D newgroup = new Object3D();
1911
+ newgroup.CreateMaterial();
1912
+
1913
+ File file = new File(filename);
1914
+ newgroup.name = file.getName();
1915
+ newgroup.addChild(bb);
1916
+
1917
+ Object3D main = newgroup;
1918
+
1919
+ main.SetPigmentTexture(filename);
1920
+
1921
+ if (source != null)
1922
+ {
1923
+ main.material = new cMaterial(source.material);
1924
+ if (main.projectedVertices.length < source.projectedVertices.length)
1925
+ {
1926
+ main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length];
1927
+ }
1928
+
1929
+ for (int i=0; i<source.projectedVertices.length; i++)
1930
+ {
1931
+ main.projectedVertices[i].x = source.projectedVertices[i].x;
1932
+ main.projectedVertices[i].y = source.projectedVertices[i].y;
1933
+ }
1934
+
1935
+ main.texres = source.texres;
1936
+ }
1937
+
1938
+ makeSomething(newgroup, false);
18831939 }
18841940
18851941 Point location;
....@@ -2138,6 +2194,8 @@
21382194 {
21392195 Mocap sel = (Mocap) copy.selection.get(0);
21402196
2197
+ sel.SetCurrentBones(sel.frame);
2198
+
21412199 sel.fullname = fullname;
21422200
21432201 if (changename)
....@@ -2151,14 +2209,18 @@
21512209 sel.smoothed = false;
21522210
21532211 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2212
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2213
+ sel.SetGlobalTransform();
2214
+ sel.LoadData();
2215
+ sel.Rewind();
2216
+ sel.Fade();
21552217 // sel.setPose(0);
21562218 refreshContents();
21572219 } else
21582220 {
21592221 mocap.Reset();
21602222 // new skeleton
2161
- makeSomething(mocap, false); // true);
2223
+ makeSomething(mocap, true); // true);
21622224 }
21632225 } catch (Exception e)
21642226 {
....@@ -2185,6 +2247,8 @@
21852247 {
21862248 Mocap sel = (Mocap) select;
21872249
2250
+ sel.SetCurrentBones(sel.frame);
2251
+
21882252 File file = new File(fullname);
21892253
21902254 // Mocap mocap = new Mocap("Mocap" + file.getName());
....@@ -2251,7 +2315,11 @@
22512315
22522316 if (!changename)
22532317 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2318
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2319
+ sel.SetGlobalTransform();
2320
+ sel.LoadData();
2321
+ sel.Rewind();
2322
+ sel.Fade();
22552323 }
22562324
22572325 // sel.setPose(0);
....@@ -2345,7 +2413,7 @@
23452413
23462414 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472415 {
2348
- if (GraphreeD.standAlone)
2416
+ if (GrafreeD.standAlone)
23492417 {
23502418 /**/
23512419 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
....@@ -3183,8 +3251,8 @@
31833251
31843252 CameraPane.ANIMATION ^= true;
31853253
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
3254
+ GrafreeD.wav.cursor = 0;
3255
+ GrafreeD.wav.loop = 0;
31883256 }
31893257 } else
31903258 {
....@@ -4085,7 +4153,7 @@
40854153
40864154 void load() // throws ClassNotFoundException
40874155 {
4088
- if (GraphreeD.standAlone)
4156
+ if (GrafreeD.standAlone)
40894157 {
40904158 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914159 browser.show();
....@@ -4190,7 +4258,7 @@
41904258
41914259 void saveAs()
41924260 {
4193
- if (GraphreeD.standAlone)
4261
+ if (GrafreeD.standAlone)
41944262 {
41954263 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964264 browser.setVisible(true);
....@@ -4213,10 +4281,20 @@
42134281
42144282 Object3D object = copy.selection.get(0);
42154283
4284
+ FileObject fileobj = null;
4285
+
4286
+ if (object instanceof FileObject)
4287
+ fileobj = (FileObject)object;
4288
+
42164289 if (object.fileparent != null)
42174290 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
4291
+ assert(fileobj == null);
42194292
4293
+ fileobj = (FileObject) object.fileparent;
4294
+ }
4295
+
4296
+ if (fileobj != null)
4297
+ {
42204298 System.out.println("WriteObject " + object + " : " + fileobj.name);
42214299 WriteObject(object, fileobj.name);
42224300 }
....@@ -4259,7 +4337,7 @@
42594337 }
42604338 }
42614339 else
4262
- //if (GraphreeD.standAlone)
4340
+ //if (GrafreeD.standAlone)
42634341 {
42644342 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42654343 browser.setVisible(true);
....@@ -4291,7 +4369,7 @@
42914369 Object3D objectparent = obj.parent;
42924370 obj.parent = null;
42934371
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
4372
+ Object3D object = (Object3D) GrafreeD.clone(obj);
42954373
42964374 obj.parent = objectparent;
42974375
....@@ -4325,7 +4403,7 @@
43254403 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43264404 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43274405 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
4406
+ if (GrafreeD.standAlone)
43294407 {
43304408 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43314409 browser.show();