.. | .. |
---|
522 | 522 | maxima.y = sel.toParent[3][1]; |
---|
523 | 523 | maxima.z = sel.toParent[3][2]; |
---|
524 | 524 | 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"); |
---|
530 | 525 | maxima.x = sel.toParent[0][0]; |
---|
531 | 526 | maxima.y = sel.toParent[1][1]; |
---|
532 | 527 | maxima.z = sel.toParent[2][2]; |
---|
533 | 528 | 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]; |
---|
537 | 537 | if (full) |
---|
538 | 538 | si.SendInfo(" Global Scale: " + maxima, "regular"); |
---|
539 | 539 | } |
---|
.. | .. |
---|
692 | 692 | protected static ImageIcon createImageIcon(String path, |
---|
693 | 693 | String description) |
---|
694 | 694 | { |
---|
695 | | - java.net.URL imgURL = GraphreeD.class.getResource(path); |
---|
| 695 | + java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
696 | 696 | if (imgURL != null) |
---|
697 | 697 | { |
---|
698 | 698 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
1107 | 1107 | //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------"); |
---|
1108 | 1108 | //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------"); |
---|
1109 | 1109 | |
---|
1110 | | -// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints); |
---|
| 1110 | +// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints); |
---|
1111 | 1111 | Camera cam = GetCamera(copy, 0); |
---|
1112 | 1112 | |
---|
1113 | 1113 | Composite cams = null; |
---|
.. | .. |
---|
1334 | 1334 | frame.getContentPane().add(/*"Center",*/framePanel); |
---|
1335 | 1335 | //frame.getContentPane().add(/*"Center",*/ worldPane); |
---|
1336 | 1336 | |
---|
1337 | | -// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc); |
---|
| 1337 | +// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1338 | 1338 | |
---|
1339 | 1339 | frame.setSize(1024, 768); |
---|
1340 | 1340 | frame.show(); |
---|
.. | .. |
---|
1859 | 1859 | } |
---|
1860 | 1860 | |
---|
1861 | 1861 | // 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")) |
---|
1873 | 1872 | { |
---|
1874 | | - DropTexture(filename); |
---|
| 1873 | + if (textures) |
---|
| 1874 | + DropTexture(filename); |
---|
| 1875 | + else |
---|
| 1876 | + CreateBillboard(filename); |
---|
1875 | 1877 | continue; |
---|
1876 | 1878 | } |
---|
1877 | 1879 | |
---|
.. | .. |
---|
1880 | 1882 | } |
---|
1881 | 1883 | |
---|
1882 | 1884 | 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); |
---|
1883 | 1939 | } |
---|
1884 | 1940 | |
---|
1885 | 1941 | Point location; |
---|
.. | .. |
---|
2138 | 2194 | { |
---|
2139 | 2195 | Mocap sel = (Mocap) copy.selection.get(0); |
---|
2140 | 2196 | |
---|
| 2197 | + sel.SetCurrentBones(sel.frame); |
---|
| 2198 | + |
---|
2141 | 2199 | sel.fullname = fullname; |
---|
2142 | 2200 | |
---|
2143 | 2201 | if (changename) |
---|
.. | .. |
---|
2151 | 2209 | sel.smoothed = false; |
---|
2152 | 2210 | |
---|
2153 | 2211 | // 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(); |
---|
2155 | 2217 | // sel.setPose(0); |
---|
2156 | 2218 | refreshContents(); |
---|
2157 | 2219 | } else |
---|
2158 | 2220 | { |
---|
2159 | 2221 | mocap.Reset(); |
---|
2160 | 2222 | // new skeleton |
---|
2161 | | - makeSomething(mocap, false); // true); |
---|
| 2223 | + makeSomething(mocap, true); // true); |
---|
2162 | 2224 | } |
---|
2163 | 2225 | } catch (Exception e) |
---|
2164 | 2226 | { |
---|
.. | .. |
---|
2185 | 2247 | { |
---|
2186 | 2248 | Mocap sel = (Mocap) select; |
---|
2187 | 2249 | |
---|
| 2250 | + sel.SetCurrentBones(sel.frame); |
---|
| 2251 | + |
---|
2188 | 2252 | File file = new File(fullname); |
---|
2189 | 2253 | |
---|
2190 | 2254 | // Mocap mocap = new Mocap("Mocap" + file.getName()); |
---|
.. | .. |
---|
2251 | 2315 | |
---|
2252 | 2316 | if (!changename) |
---|
2253 | 2317 | { |
---|
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(); |
---|
2255 | 2323 | } |
---|
2256 | 2324 | |
---|
2257 | 2325 | // sel.setPose(0); |
---|
.. | .. |
---|
2345 | 2413 | |
---|
2346 | 2414 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2347 | 2415 | { |
---|
2348 | | - if (GraphreeD.standAlone) |
---|
| 2416 | + if (GrafreeD.standAlone) |
---|
2349 | 2417 | { |
---|
2350 | 2418 | /**/ |
---|
2351 | 2419 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
.. | .. |
---|
3183 | 3251 | |
---|
3184 | 3252 | CameraPane.ANIMATION ^= true; |
---|
3185 | 3253 | |
---|
3186 | | - GraphreeD.wav.cursor = 0; |
---|
3187 | | - GraphreeD.wav.loop = 0; |
---|
| 3254 | + GrafreeD.wav.cursor = 0; |
---|
| 3255 | + GrafreeD.wav.loop = 0; |
---|
3188 | 3256 | } |
---|
3189 | 3257 | } else |
---|
3190 | 3258 | { |
---|
.. | .. |
---|
4085 | 4153 | |
---|
4086 | 4154 | void load() // throws ClassNotFoundException |
---|
4087 | 4155 | { |
---|
4088 | | - if (GraphreeD.standAlone) |
---|
| 4156 | + if (GrafreeD.standAlone) |
---|
4089 | 4157 | { |
---|
4090 | 4158 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4091 | 4159 | browser.show(); |
---|
.. | .. |
---|
4190 | 4258 | |
---|
4191 | 4259 | void saveAs() |
---|
4192 | 4260 | { |
---|
4193 | | - if (GraphreeD.standAlone) |
---|
| 4261 | + if (GrafreeD.standAlone) |
---|
4194 | 4262 | { |
---|
4195 | 4263 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4196 | 4264 | browser.setVisible(true); |
---|
.. | .. |
---|
4213 | 4281 | |
---|
4214 | 4282 | Object3D object = copy.selection.get(0); |
---|
4215 | 4283 | |
---|
| 4284 | + FileObject fileobj = null; |
---|
| 4285 | + |
---|
| 4286 | + if (object instanceof FileObject) |
---|
| 4287 | + fileobj = (FileObject)object; |
---|
| 4288 | + |
---|
4216 | 4289 | if (object.fileparent != null) |
---|
4217 | 4290 | { |
---|
4218 | | - FileObject fileobj = (FileObject) object.fileparent; |
---|
| 4291 | + assert(fileobj == null); |
---|
4219 | 4292 | |
---|
| 4293 | + fileobj = (FileObject) object.fileparent; |
---|
| 4294 | + } |
---|
| 4295 | + |
---|
| 4296 | + if (fileobj != null) |
---|
| 4297 | + { |
---|
4220 | 4298 | System.out.println("WriteObject " + object + " : " + fileobj.name); |
---|
4221 | 4299 | WriteObject(object, fileobj.name); |
---|
4222 | 4300 | } |
---|
.. | .. |
---|
4259 | 4337 | } |
---|
4260 | 4338 | } |
---|
4261 | 4339 | else |
---|
4262 | | - //if (GraphreeD.standAlone) |
---|
| 4340 | + //if (GrafreeD.standAlone) |
---|
4263 | 4341 | { |
---|
4264 | 4342 | FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE); |
---|
4265 | 4343 | browser.setVisible(true); |
---|
.. | .. |
---|
4291 | 4369 | Object3D objectparent = obj.parent; |
---|
4292 | 4370 | obj.parent = null; |
---|
4293 | 4371 | |
---|
4294 | | - Object3D object = (Object3D) GraphreeD.clone(obj); |
---|
| 4372 | + Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
4295 | 4373 | |
---|
4296 | 4374 | obj.parent = objectparent; |
---|
4297 | 4375 | |
---|
.. | .. |
---|
4325 | 4403 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4326 | 4404 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4327 | 4405 | copy.generatePOV(buffer); |
---|
4328 | | - if (GraphreeD.standAlone) |
---|
| 4406 | + if (GrafreeD.standAlone) |
---|
4329 | 4407 | { |
---|
4330 | 4408 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4331 | 4409 | browser.show(); |
---|