Normand Briere
2018-07-01 655810d1c4e710e7c85772b8dde96772dbcf274b
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;
....@@ -2151,14 +2207,18 @@
21512207 sel.smoothed = false;
21522208
21532209 // if (!changename)
2154
- sel.SetPositionDelta(false, true, true, true/*?*/); // false
2210
+ //sel.SetPositionDelta(false, true, true, true/*?*/); // false
2211
+ sel.SetGlobalTransform();
2212
+ sel.LoadData();
2213
+ sel.Rewind();
2214
+ sel.Fade();
21552215 // sel.setPose(0);
21562216 refreshContents();
21572217 } else
21582218 {
21592219 mocap.Reset();
21602220 // new skeleton
2161
- makeSomething(mocap, false); // true);
2221
+ makeSomething(mocap, true); // true);
21622222 }
21632223 } catch (Exception e)
21642224 {
....@@ -2251,7 +2311,11 @@
22512311
22522312 if (!changename)
22532313 {
2254
- sel.SetPositionDelta(false, true, true, true/*?*/);
2314
+ //sel.SetPositionDelta(false, true, true, true/*?*/);
2315
+ sel.SetGlobalTransform();
2316
+ sel.LoadData();
2317
+ sel.Rewind();
2318
+ sel.Fade();
22552319 }
22562320
22572321 // sel.setPose(0);
....@@ -2345,7 +2409,7 @@
23452409
23462410 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23472411 {
2348
- if (GraphreeD.standAlone)
2412
+ if (GrafreeD.standAlone)
23492413 {
23502414 /**/
23512415 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
....@@ -3183,8 +3247,8 @@
31833247
31843248 CameraPane.ANIMATION ^= true;
31853249
3186
- GraphreeD.wav.cursor = 0;
3187
- GraphreeD.wav.loop = 0;
3250
+ GrafreeD.wav.cursor = 0;
3251
+ GrafreeD.wav.loop = 0;
31883252 }
31893253 } else
31903254 {
....@@ -4085,7 +4149,7 @@
40854149
40864150 void load() // throws ClassNotFoundException
40874151 {
4088
- if (GraphreeD.standAlone)
4152
+ if (GrafreeD.standAlone)
40894153 {
40904154 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
40914155 browser.show();
....@@ -4190,7 +4254,7 @@
41904254
41914255 void saveAs()
41924256 {
4193
- if (GraphreeD.standAlone)
4257
+ if (GrafreeD.standAlone)
41944258 {
41954259 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
41964260 browser.setVisible(true);
....@@ -4213,10 +4277,20 @@
42134277
42144278 Object3D object = copy.selection.get(0);
42154279
4280
+ FileObject fileobj = null;
4281
+
4282
+ if (object instanceof FileObject)
4283
+ fileobj = (FileObject)object;
4284
+
42164285 if (object.fileparent != null)
42174286 {
4218
- FileObject fileobj = (FileObject) object.fileparent;
4287
+ assert(fileobj == null);
42194288
4289
+ fileobj = (FileObject) object.fileparent;
4290
+ }
4291
+
4292
+ if (fileobj != null)
4293
+ {
42204294 System.out.println("WriteObject " + object + " : " + fileobj.name);
42214295 WriteObject(object, fileobj.name);
42224296 }
....@@ -4259,7 +4333,7 @@
42594333 }
42604334 }
42614335 else
4262
- //if (GraphreeD.standAlone)
4336
+ //if (GrafreeD.standAlone)
42634337 {
42644338 FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
42654339 browser.setVisible(true);
....@@ -4291,7 +4365,7 @@
42914365 Object3D objectparent = obj.parent;
42924366 obj.parent = null;
42934367
4294
- Object3D object = (Object3D) GraphreeD.clone(obj);
4368
+ Object3D object = (Object3D) GrafreeD.clone(obj);
42954369
42964370 obj.parent = objectparent;
42974371
....@@ -4325,7 +4399,7 @@
43254399 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
43264400 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
43274401 copy.generatePOV(buffer);
4328
- if (GraphreeD.standAlone)
4402
+ if (GrafreeD.standAlone)
43294403 {
43304404 FileDialog browser = new FileDialog(frame, "Export POV", 1);
43314405 browser.show();