.. | .. |
---|
14 | 14 | |
---|
15 | 15 | //import buoy.widget.BFileChooser; |
---|
16 | 16 | |
---|
17 | | -class GroupEditor extends ObjEditor implements iParse, //iCallBack, |
---|
| 17 | +class GroupEditor extends ObjEditor implements //iParse, //iCallBack, |
---|
18 | 18 | ObjectUI, |
---|
19 | 19 | Runnable, |
---|
20 | 20 | ActionListener, |
---|
.. | .. |
---|
83 | 83 | |
---|
84 | 84 | void CloneSelection(boolean supports) |
---|
85 | 85 | { |
---|
86 | | - // Object3D keep = GraphreeD.clipboard; |
---|
| 86 | + // Object3D keep = GrafreeD.clipboard; |
---|
87 | 87 | //Object3D obj; |
---|
88 | 88 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
89 | 89 | { |
---|
.. | .. |
---|
97 | 97 | |
---|
98 | 98 | void CloneClipboard(boolean supports) |
---|
99 | 99 | { |
---|
100 | | - assert(GraphreeD.clipboard.parent == null); |
---|
101 | | - Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent; |
---|
102 | | - GraphreeD.clipboard.get(0).parent = null; // Avoid copy? |
---|
103 | | - if (LA.isIdentity(GraphreeD.clipboard.toParent)) |
---|
104 | | - makeSomething(CloneObject(GraphreeD.clipboard.get(0), false)); |
---|
| 100 | + assert(GrafreeD.clipboard.parent == null); |
---|
| 101 | + Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent; |
---|
| 102 | + GrafreeD.clipboard.get(0).parent = null; // Avoid copy? |
---|
| 103 | + if (LA.isIdentity(GrafreeD.clipboard.toParent)) |
---|
| 104 | + makeSomething(CloneObject(GrafreeD.clipboard.get(0), false)); |
---|
105 | 105 | else |
---|
106 | | - makeSomething(CloneObject(GraphreeD.clipboard, false)); |
---|
107 | | - GraphreeD.clipboard.get(0).parent = keepparent; |
---|
| 106 | + makeSomething(CloneObject(GrafreeD.clipboard, false)); |
---|
| 107 | + GrafreeD.clipboard.get(0).parent = keepparent; |
---|
108 | 108 | } |
---|
109 | 109 | |
---|
110 | 110 | static Object3D CloneObject(Object3D obj, boolean supports) |
---|
.. | .. |
---|
118 | 118 | // obj.support = null; |
---|
119 | 119 | if (!supports) |
---|
120 | 120 | obj.SaveSupports(); |
---|
121 | | - Object3D clone = (Object3D)GraphreeD.clone(obj); |
---|
| 121 | + Object3D clone = (Object3D)GrafreeD.clone(obj); |
---|
122 | 122 | obj.parent = parent; |
---|
123 | 123 | // obj.support = support; |
---|
124 | 124 | // clone.support = support; // aout 2013 |
---|
.. | .. |
---|
188 | 188 | clearItem.addActionListener(this); |
---|
189 | 189 | clearAllItem = menu.add(new MenuItem("Clear All")); |
---|
190 | 190 | clearAllItem.addActionListener(this); |
---|
191 | | - menu.add("-"); |
---|
192 | | - resetMeshItem = menu.add(new MenuItem("Reset All")); |
---|
| 191 | + |
---|
| 192 | + oe.menuBar.add(menu = new Menu("Setting")); |
---|
| 193 | + resetMeshItem = menu.add(new MenuItem("Reset All")); |
---|
193 | 194 | resetMeshItem.addActionListener(this); |
---|
194 | 195 | stepAllItem = menu.add(new MenuItem("Step All")); |
---|
195 | 196 | stepAllItem.addActionListener(this); |
---|
.. | .. |
---|
221 | 222 | setMasterItem = menu.add(new MenuItem("Set Master Mesh")); |
---|
222 | 223 | setMasterItem.addActionListener(this); |
---|
223 | 224 | |
---|
224 | | - oe.menuBar.add(menu = new Menu("Object")); |
---|
| 225 | + oe.menuBar.add(menu = new Menu("Group")); |
---|
225 | 226 | grabItem = menu.add(new MenuItem("Grab")); |
---|
226 | 227 | grabItem.addActionListener(this); |
---|
227 | | - frontItem = menu.add(new MenuItem("Front")); |
---|
228 | | - frontItem.addActionListener(this); |
---|
229 | 228 | backItem = menu.add(new MenuItem("Back")); |
---|
230 | 229 | backItem.addActionListener(this); |
---|
| 230 | + frontItem = menu.add(new MenuItem("Front")); |
---|
| 231 | + frontItem.addActionListener(this); |
---|
231 | 232 | compositeItem = menu.add(new MenuItem("Composite")); |
---|
232 | 233 | compositeItem.addActionListener(this); |
---|
233 | 234 | menu.add("-"); |
---|
.. | .. |
---|
247 | 248 | scriptNodeItem.addActionListener(this); |
---|
248 | 249 | cameraItem = menu.add(new MenuItem("Camera")); |
---|
249 | 250 | cameraItem.addActionListener(this); |
---|
250 | | - menu.add("-"); |
---|
| 251 | + |
---|
| 252 | + oe.menuBar.add(menu = new Menu("Object")); |
---|
251 | 253 | textureItem = menu.add(new MenuItem("Texture")); |
---|
252 | 254 | textureItem.addActionListener(this); |
---|
253 | 255 | csgItem = menu.add(new MenuItem("CSG")); |
---|
.. | .. |
---|
283 | 285 | genNormalsORGANItem.addActionListener(this); |
---|
284 | 286 | genNormalsCADItem = menu.add(new MenuItem("CAD Normals")); |
---|
285 | 287 | genNormalsCADItem.addActionListener(this); |
---|
| 288 | + genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals")); |
---|
| 289 | + genNormalsMESHItem.addActionListener(this); |
---|
286 | 290 | stripifyItem = menu.add(new MenuItem("Stripify")); |
---|
287 | 291 | stripifyItem.addActionListener(this); |
---|
288 | 292 | unstripifyItem = menu.add(new MenuItem("Unstripify")); |
---|
.. | .. |
---|
292 | 296 | untrimItem = menu.add(new MenuItem("Untrim")); |
---|
293 | 297 | untrimItem.addActionListener(this); |
---|
294 | 298 | menu.add("-"); |
---|
295 | | - clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); |
---|
296 | | - clearMaterialsItem.addActionListener(this); |
---|
297 | 299 | clearColorsItem = menu.add(new MenuItem("Clear AO")); |
---|
298 | 300 | clearColorsItem.addActionListener(this); |
---|
299 | 301 | reverseNormalsItem = menu.add(new MenuItem("Reverse Normals")); |
---|
.. | .. |
---|
310 | 312 | smoothMeshItem.addActionListener(this); |
---|
311 | 313 | clipMeshItem = menu.add(new MenuItem("Clip mesh")); |
---|
312 | 314 | clipMeshItem.addActionListener(this); |
---|
| 315 | + |
---|
| 316 | + oe.menuBar.add(menu = new Menu("Attributes")); |
---|
| 317 | + clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); |
---|
| 318 | + clearMaterialsItem.addActionListener(this); |
---|
313 | 319 | menu.add("-"); |
---|
314 | 320 | liveleavesItem = menu.add(new MenuItem("Live Leaves")); |
---|
315 | 321 | liveleavesItem.addActionListener(this); |
---|
.. | .. |
---|
332 | 338 | flipVItem.addActionListener(this); |
---|
333 | 339 | unflipVItem = menu.add(new MenuItem("Unflip V")); |
---|
334 | 340 | unflipVItem.addActionListener(this); |
---|
335 | | - lowTexturesItem = menu.add(new MenuItem("Low Texture")); |
---|
| 341 | + lowTexturesItem = menu.add(new MenuItem("Low Texture (256)")); |
---|
336 | 342 | lowTexturesItem.addActionListener(this); |
---|
337 | | - normalTexturesItem = menu.add(new MenuItem("Normal Texture")); |
---|
| 343 | + normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)")); |
---|
338 | 344 | normalTexturesItem.addActionListener(this); |
---|
339 | | - highTexturesItem = menu.add(new MenuItem("High Texture")); |
---|
| 345 | + highTexturesItem = menu.add(new MenuItem("High Texture (1024)")); |
---|
340 | 346 | highTexturesItem.addActionListener(this); |
---|
341 | | - veryhighTexturesItem = menu.add(new MenuItem("Very high Texture")); |
---|
| 347 | + veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)")); |
---|
342 | 348 | veryhighTexturesItem.addActionListener(this); |
---|
343 | | - maxTexturesItem = menu.add(new MenuItem("Max Texture")); |
---|
| 349 | + maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)")); |
---|
344 | 350 | maxTexturesItem.addActionListener(this); |
---|
345 | | - panoTexturesItem = menu.add(new MenuItem("Panoramic Texture")); |
---|
| 351 | + panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)")); |
---|
346 | 352 | panoTexturesItem.addActionListener(this); |
---|
347 | | - menu.add("-"); |
---|
348 | | - extractGeometriesItem = menu.add(new MenuItem("Link Geometry")); |
---|
349 | | - extractGeometriesItem.addActionListener(this); |
---|
350 | | - cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry")); |
---|
351 | | - cloneGeometriesItem.addActionListener(this); |
---|
352 | | - shareGeometriesItem = menu.add(new MenuItem("Share Geometry")); |
---|
353 | | - shareGeometriesItem.addActionListener(this); |
---|
354 | | - mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry")); |
---|
355 | | - mergeGeometriesItem.addActionListener(this); |
---|
356 | 353 | |
---|
357 | 354 | oe.menuBar.add(menu = new Menu("Selection")); |
---|
358 | 355 | attachPigmentItem = menu.add(new MenuItem("Attach Pigment...")); |
---|
.. | .. |
---|
370 | 367 | sortbysizeItem.addActionListener(this); |
---|
371 | 368 | sortbynameItem = menu.add(new MenuItem("Sort by name")); |
---|
372 | 369 | sortbynameItem.addActionListener(this); |
---|
| 370 | + menu.add("-"); |
---|
| 371 | + extractGeometriesItem = menu.add(new MenuItem("Link Geometry")); |
---|
| 372 | + extractGeometriesItem.addActionListener(this); |
---|
| 373 | + cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry")); |
---|
| 374 | + cloneGeometriesItem.addActionListener(this); |
---|
| 375 | + shareGeometriesItem = menu.add(new MenuItem("Share Geometry")); |
---|
| 376 | + shareGeometriesItem.addActionListener(this); |
---|
| 377 | + mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry")); |
---|
| 378 | + mergeGeometriesItem.addActionListener(this); |
---|
| 379 | + |
---|
373 | 380 | oe.menuBar.add(menu = new Menu("Insert")); |
---|
374 | 381 | buildCreateMenu(menu); |
---|
375 | | - oe.menuBar.add(menu = new Menu("Tools")); |
---|
| 382 | + |
---|
| 383 | + |
---|
| 384 | + oe.menuBar.add(menu = new Menu("Include")); |
---|
| 385 | + importGFDItem = menu.add(new MenuItem("GrafreeD Object...")); |
---|
| 386 | + importGFDItem.addActionListener(this); |
---|
| 387 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object...")); |
---|
| 388 | + importVRMLX3DItem.addActionListener(this); |
---|
| 389 | + importOBJItem = menu.add(new MenuItem("OBJ Object...")); |
---|
| 390 | + importOBJItem.addActionListener(this); |
---|
| 391 | + import3DSItem = menu.add(new MenuItem("3DS Object...")); |
---|
| 392 | + import3DSItem.addActionListener(this); |
---|
| 393 | + |
---|
| 394 | + oe.menuBar.add(menu = new Menu("Tools")); |
---|
376 | 395 | buildToolsMenu(menu); |
---|
377 | 396 | } |
---|
378 | 397 | |
---|
.. | .. |
---|
1002 | 1021 | |
---|
1003 | 1022 | void buildCreateMenu(Menu menu) |
---|
1004 | 1023 | { |
---|
| 1024 | + //heightFieldItem = menu.add(new MenuItem("Height Field")); |
---|
| 1025 | + //heightFieldItem.addActionListener(this); |
---|
1005 | 1026 | gridItem = menu.add(new MenuItem("Grid")); |
---|
1006 | 1027 | gridItem.addActionListener(this); |
---|
1007 | 1028 | rectoidItem = menu.add(new MenuItem("Box")); |
---|
.. | .. |
---|
1048 | 1069 | doubleItem.addActionListener(this); |
---|
1049 | 1070 | tripleItem = menu.add(new MenuItem("Trident")); |
---|
1050 | 1071 | tripleItem.addActionListener(this); |
---|
1051 | | - menu.add("-"); |
---|
1052 | | - importGFDItem = menu.add(new MenuItem("GraphreeD Object...")); |
---|
1053 | | - importGFDItem.addActionListener(this); |
---|
1054 | | - importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object...")); |
---|
1055 | | - importVRMLX3DItem.addActionListener(this); |
---|
1056 | | - importOBJItem = menu.add(new MenuItem("OBJ Object...")); |
---|
1057 | | - importOBJItem.addActionListener(this); |
---|
1058 | | - import3DSItem = menu.add(new MenuItem("3DS Object...")); |
---|
1059 | | - import3DSItem.addActionListener(this); |
---|
1060 | 1072 | } |
---|
1061 | 1073 | |
---|
1062 | 1074 | void buildToolsMenu(Menu menu) |
---|
.. | .. |
---|
1068 | 1080 | menu.add("-"); |
---|
1069 | 1081 | parseverticesItem = menu.add(new MenuItem("Multiplicity")); |
---|
1070 | 1082 | parseverticesItem.addActionListener(this); |
---|
| 1083 | + textureFieldItem = menu.add(new MenuItem("Texture Field")); |
---|
| 1084 | + textureFieldItem.addActionListener(this); |
---|
1071 | 1085 | alignItem = menu.add(new MenuItem("Align")); |
---|
1072 | 1086 | alignItem.addActionListener(this); |
---|
1073 | 1087 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
.. | .. |
---|
1429 | 1443 | |
---|
1430 | 1444 | void Overwrite(int mask) |
---|
1431 | 1445 | { |
---|
1432 | | - if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1) |
---|
| 1446 | + if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
1433 | 1447 | { |
---|
1434 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 1448 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
1435 | 1449 | |
---|
1436 | 1450 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
1437 | 1451 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
1521 | 1535 | makeSomething(ragdoll); |
---|
1522 | 1536 | //makeSomething(new VehicleDemo()); |
---|
1523 | 1537 | } else |
---|
| 1538 | + /* |
---|
| 1539 | + */ |
---|
| 1540 | + if (event.getSource() == heightFieldItem) |
---|
| 1541 | + { |
---|
| 1542 | + Object3D obj = new Object3D(); |
---|
| 1543 | + |
---|
| 1544 | + obj.CreateMaterial(); |
---|
| 1545 | + obj.bRep = new BoundaryRep(); |
---|
| 1546 | + |
---|
| 1547 | + obj.bRep.CreateMesh(new iHeightField() |
---|
| 1548 | + { |
---|
| 1549 | + public double f(double x, double y) |
---|
| 1550 | + { |
---|
| 1551 | + // The Mandelbrot set is represented by coloring |
---|
| 1552 | + // each point (x,y) according to the number of |
---|
| 1553 | + // iterations it takes before the while loop in |
---|
| 1554 | + // this method ends. For points that are actually |
---|
| 1555 | + // in the Mandelbrot set, or very close to it, the |
---|
| 1556 | + // count will reach the maximum value, 80. These |
---|
| 1557 | + // points will be colored purple. All other colors |
---|
| 1558 | + // represent points that are definitely NOT in the set. |
---|
| 1559 | + x -= 600; |
---|
| 1560 | + y -= 500; |
---|
| 1561 | + x /= 200; |
---|
| 1562 | + y /= 200; |
---|
| 1563 | + int count = 0; |
---|
| 1564 | + double zx = x; |
---|
| 1565 | + double zy = y; |
---|
| 1566 | + while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) { |
---|
| 1567 | + double new_zx = zx*zx - zy*zy + x; |
---|
| 1568 | + zy = 2*zx*zy + y; |
---|
| 1569 | + zx = new_zx; |
---|
| 1570 | + count++; |
---|
| 1571 | + } |
---|
| 1572 | + return count; // Math.sqrt(count); |
---|
| 1573 | + } |
---|
| 1574 | + }, 1000,1000); |
---|
| 1575 | + |
---|
| 1576 | + makeSomething(obj); |
---|
| 1577 | + } else |
---|
1524 | 1578 | if (event.getSource() == gridItem) |
---|
1525 | 1579 | { |
---|
1526 | 1580 | makeSomething(new Grid()); |
---|
.. | .. |
---|
1570 | 1624 | LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent); |
---|
1571 | 1625 | LA.matInvert(obj.toParent, obj.fromParent); |
---|
1572 | 1626 | */ |
---|
1573 | | - makeSomething(new CheckerIG()); |
---|
| 1627 | + makeSomething(new Checker()); |
---|
1574 | 1628 | } else |
---|
1575 | 1629 | if (event.getSource() == meshItem) |
---|
1576 | 1630 | { |
---|
.. | .. |
---|
1726 | 1780 | if (event.getSource() == invariantsItem) |
---|
1727 | 1781 | { |
---|
1728 | 1782 | System.out.println("Invariants:"); |
---|
1729 | | - GraphreeD.theApplet3D.universe.invariants(); |
---|
| 1783 | + GrafreeD.theApplet3D.universe.invariants(); |
---|
1730 | 1784 | } else |
---|
1731 | 1785 | if (event.getSource() == memoryItem) |
---|
1732 | 1786 | { |
---|
.. | .. |
---|
1796 | 1850 | } else |
---|
1797 | 1851 | if (event.getSource() == duplicateItem) |
---|
1798 | 1852 | { |
---|
1799 | | - Object3D keep = GraphreeD.clipboard; |
---|
| 1853 | + Object3D keep = GrafreeD.clipboard; |
---|
1800 | 1854 | loadClipboard(false); |
---|
1801 | 1855 | paste(false); |
---|
1802 | | - GraphreeD.clipboard = keep; |
---|
| 1856 | + GrafreeD.clipboard = keep; |
---|
1803 | 1857 | } else |
---|
1804 | 1858 | if (event.getSource() == cloneItem) |
---|
1805 | 1859 | { |
---|
.. | .. |
---|
1843 | 1897 | } else |
---|
1844 | 1898 | if (event.getSource() == overwriteMatItem) |
---|
1845 | 1899 | { |
---|
| 1900 | + /* july 2015 |
---|
1846 | 1901 | if ((dropAttributes & Object3D.TEXTURE) == 0) |
---|
1847 | | - Overwrite(Object3D.MATERIAL); |
---|
| 1902 | + Overwrite(Object3D.MATERIAL | Object3D.COLOR); |
---|
1848 | 1903 | else |
---|
1849 | 1904 | { |
---|
1850 | 1905 | if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0) |
---|
.. | .. |
---|
1856 | 1911 | Overwrite(Object3D.MATERIAL | Object3D.TEXTURE); |
---|
1857 | 1912 | } |
---|
1858 | 1913 | } |
---|
| 1914 | + */ |
---|
| 1915 | + |
---|
| 1916 | + Overwrite(dropAttributes); |
---|
1859 | 1917 | } |
---|
1860 | 1918 | if (event.getSource() == overwriteGeoItem) |
---|
1861 | 1919 | { |
---|
1862 | 1920 | Overwrite(Object3D.GEOMETRY); |
---|
1863 | | -// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1) |
---|
| 1921 | +// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
1864 | 1922 | // { |
---|
1865 | | -// Object3D content = GraphreeD.clipboard.get(0); |
---|
| 1923 | +// Object3D content = GrafreeD.clipboard.get(0); |
---|
1866 | 1924 | // |
---|
1867 | 1925 | // if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
1868 | 1926 | // content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
1995 | 2053 | } else |
---|
1996 | 2054 | if (event.getSource() == linkverticesItem) |
---|
1997 | 2055 | { |
---|
1998 | | -// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1) |
---|
| 2056 | +// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) |
---|
1999 | 2057 | // { |
---|
2000 | | -// Object3D content = GraphreeD.clipboard.get(0); |
---|
| 2058 | +// Object3D content = GrafreeD.clipboard.get(0); |
---|
2001 | 2059 | // |
---|
2002 | 2060 | // if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2003 | 2061 | // content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2006 | 2064 | // group.selection.get(0).setMasterThis(content); // should be identity |
---|
2007 | 2065 | // refreshContents(); |
---|
2008 | 2066 | // } |
---|
2009 | | - if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1) |
---|
| 2067 | + if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
2010 | 2068 | { |
---|
2011 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 2069 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
2012 | 2070 | |
---|
2013 | 2071 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2014 | 2072 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2049 | 2107 | } else |
---|
2050 | 2108 | if (event.getSource() == setMasterItem) |
---|
2051 | 2109 | { |
---|
2052 | | - if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1) |
---|
| 2110 | + if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) |
---|
2053 | 2111 | { |
---|
2054 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 2112 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
2055 | 2113 | |
---|
2056 | 2114 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2057 | 2115 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2064 | 2122 | { |
---|
2065 | 2123 | if (group.selection.size() == 1) |
---|
2066 | 2124 | { |
---|
2067 | | - if (GraphreeD.clipboard.size() == 1) |
---|
| 2125 | + if (GrafreeD.clipboard.size() == 1) |
---|
2068 | 2126 | { |
---|
2069 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 2127 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
2070 | 2128 | |
---|
2071 | 2129 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2072 | 2130 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2253 | 2311 | { |
---|
2254 | 2312 | GenNormals(true); |
---|
2255 | 2313 | } else |
---|
| 2314 | + if (event.getSource() == genNormalsMESHItem) |
---|
| 2315 | + { |
---|
| 2316 | + GenNormals(true); // TODO |
---|
| 2317 | + } else |
---|
2256 | 2318 | if (event.getSource() == genNormalsORGANItem) |
---|
2257 | 2319 | { |
---|
2258 | 2320 | GenNormals(false); |
---|
.. | .. |
---|
2352 | 2414 | if (event.getSource() == parseverticesItem) |
---|
2353 | 2415 | { |
---|
2354 | 2416 | ParseVertices(); |
---|
| 2417 | + } else |
---|
| 2418 | + if (event.getSource() == textureFieldItem) |
---|
| 2419 | + { |
---|
| 2420 | + TextureVertices(); |
---|
2355 | 2421 | } else |
---|
2356 | 2422 | if (event.getSource() == alignItem) |
---|
2357 | 2423 | { |
---|
.. | .. |
---|
2750 | 2816 | if (event.getSource() == unselectButton) |
---|
2751 | 2817 | { |
---|
2752 | 2818 | objEditor.jTree.clearSelection(); |
---|
2753 | | - // ?? oct 2012 GraphreeD.clipboard.clear(); |
---|
| 2819 | + // ?? oct 2012 GrafreeD.clipboard.clear(); |
---|
2754 | 2820 | objEditor.ResetSliders(); |
---|
2755 | 2821 | refreshContents(true); |
---|
2756 | 2822 | } else |
---|
.. | .. |
---|
3065 | 3131 | obj = (Object3D)e.nextElement(); |
---|
3066 | 3132 | |
---|
3067 | 3133 | System.out.println("Object is: " + obj); |
---|
3068 | | - GraphreeD.AnalyzeObject(obj); |
---|
| 3134 | + GrafreeD.AnalyzeObject(obj); |
---|
3069 | 3135 | System.out.println("Boundary rep: " + obj.bRep); |
---|
3070 | | - GraphreeD.AnalyzeObject(obj.bRep); |
---|
| 3136 | + GrafreeD.AnalyzeObject(obj.bRep); |
---|
3071 | 3137 | |
---|
3072 | 3138 | // System.err.println((size/1024) + " KB is the size of " + obj); |
---|
3073 | 3139 | } |
---|
.. | .. |
---|
3157 | 3223 | |
---|
3158 | 3224 | //Object3D buffer; |
---|
3159 | 3225 | cVector temp = new cVector(); |
---|
3160 | | - BoundaryRep temprep; |
---|
3161 | | - Object3D nodes; |
---|
3162 | | - Vector<Vertex> vertices; |
---|
3163 | | - |
---|
3164 | | - public void Vertex(Object3D node, Vertex v) |
---|
3165 | | - { |
---|
3166 | | - vertices.add(v); |
---|
3167 | | - nodes.addElement(node); |
---|
3168 | | - |
---|
3169 | | - if (temprep.GetCache(v) != null) |
---|
3170 | | - { |
---|
3171 | | - temprep.Remove(v); |
---|
3172 | | - } |
---|
3173 | | - else |
---|
3174 | | - { |
---|
3175 | | - temprep.Remember(v); |
---|
3176 | | - } |
---|
3177 | | - } |
---|
3178 | | - |
---|
3179 | | - public void Face(Object3D node, Face f) |
---|
3180 | | - { |
---|
3181 | | - |
---|
3182 | | - } |
---|
3183 | | - |
---|
| 3226 | +// BoundaryRep temprep; |
---|
| 3227 | +// Object3D nodes; |
---|
| 3228 | +// Vector<Vertex> vertices; |
---|
| 3229 | +// |
---|
| 3230 | +// cGroup buffer; |
---|
| 3231 | +// |
---|
| 3232 | +// public void Vertex(Object3D node, Vertex v) |
---|
| 3233 | +// { |
---|
| 3234 | +//// vertices.add(v); |
---|
| 3235 | +//// nodes.addElement(node); |
---|
| 3236 | +//// |
---|
| 3237 | +//// if (temprep.GetCache(v) != null) |
---|
| 3238 | +//// { |
---|
| 3239 | +//// temprep.Remove(v); |
---|
| 3240 | +//// } else |
---|
| 3241 | +//// { |
---|
| 3242 | +//// temprep.Remember(v); |
---|
| 3243 | +//// } |
---|
| 3244 | +// |
---|
| 3245 | +// //Object3D node = nodes.get(index); |
---|
| 3246 | +// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k)); |
---|
| 3247 | +// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z); |
---|
| 3248 | +// |
---|
| 3249 | +// LA.xformPos(temp, node.GlobalTransformInv(), temp); |
---|
| 3250 | +// |
---|
| 3251 | +// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z); |
---|
| 3252 | +// |
---|
| 3253 | +// cGroup g = new cGroup(); |
---|
| 3254 | +// |
---|
| 3255 | +// if (g.toParent == null) |
---|
| 3256 | +// { |
---|
| 3257 | +// g.toParent = LA.newMatrix(); |
---|
| 3258 | +// g.fromParent = LA.newMatrix(); |
---|
| 3259 | +// } |
---|
| 3260 | +// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
| 3261 | +// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
| 3262 | +// |
---|
| 3263 | +// g.add(GrafreeD.clipboard); |
---|
| 3264 | +// |
---|
| 3265 | +// buffer.add(g); |
---|
| 3266 | +// } |
---|
| 3267 | +// |
---|
| 3268 | +// public void Face(Object3D node, Face f) |
---|
| 3269 | +// { |
---|
| 3270 | +// |
---|
| 3271 | +// } |
---|
| 3272 | +// |
---|
| 3273 | +// void ParseVerticesOld() // ?? |
---|
| 3274 | +// { |
---|
| 3275 | +// //if (group.selection.size() != 1) |
---|
| 3276 | +// // return; |
---|
| 3277 | +// |
---|
| 3278 | +// temprep = new BoundaryRep(); |
---|
| 3279 | +// nodes = new Object3D(); |
---|
| 3280 | +// vertices = new Vector<Vertex>(); |
---|
| 3281 | +// |
---|
| 3282 | +// boolean epsequal = GrafreeD.epsequal; |
---|
| 3283 | +// GrafreeD.epsequal = true; |
---|
| 3284 | +// |
---|
| 3285 | +// for (int i=0; i<group.selection.size(); i++) |
---|
| 3286 | +// { |
---|
| 3287 | +// Object3D buffer = new cGroup(group.selection.get(i).name + "+"); |
---|
| 3288 | +// |
---|
| 3289 | +// group.selection.get(i).Parse( |
---|
| 3290 | +//this ); |
---|
| 3291 | +// |
---|
| 3292 | +// int repsize = temprep.VertexCount(); |
---|
| 3293 | +// int tablesize = temprep.vertextable.size(); |
---|
| 3294 | +// int nodesize = nodes.size(); |
---|
| 3295 | +// |
---|
| 3296 | +// assert(vertices.size() == nodes.size()); |
---|
| 3297 | +// |
---|
| 3298 | +// temprep.vertextable.elements(); |
---|
| 3299 | +// |
---|
| 3300 | +// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet(); |
---|
| 3301 | +// |
---|
| 3302 | +// for (java.util.Map.Entry<Vertex,Vertex> entry : set) |
---|
| 3303 | +// { |
---|
| 3304 | +// cGroup g = new cGroup(); |
---|
| 3305 | +// |
---|
| 3306 | +// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k)); |
---|
| 3307 | +// |
---|
| 3308 | +// Object3D node = nodes.get(index); |
---|
| 3309 | +// temp.set(vertices.get(index)); // temprep.GetVertex(k)); |
---|
| 3310 | +// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z); |
---|
| 3311 | +// |
---|
| 3312 | +// LA.xformPos(temp, node.GlobalTransformInv(), temp); |
---|
| 3313 | +// |
---|
| 3314 | +// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z); |
---|
| 3315 | +// |
---|
| 3316 | +// if (g.toParent == null) |
---|
| 3317 | +// { |
---|
| 3318 | +// g.toParent = LA.newMatrix(); |
---|
| 3319 | +// g.fromParent = LA.newMatrix(); |
---|
| 3320 | +// } |
---|
| 3321 | +// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
| 3322 | +// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
| 3323 | +// |
---|
| 3324 | +// g.add(GrafreeD.clipboard); |
---|
| 3325 | +// |
---|
| 3326 | +// buffer.add(g); |
---|
| 3327 | +// } |
---|
| 3328 | +// |
---|
| 3329 | +// makeSomething(buffer, i==group.selection.size()-1); |
---|
| 3330 | +// } |
---|
| 3331 | +// |
---|
| 3332 | +// GrafreeD.epsequal = epsequal; |
---|
| 3333 | +// |
---|
| 3334 | +// //buffer = null; |
---|
| 3335 | +// temprep = null; |
---|
| 3336 | +// nodes = null; |
---|
| 3337 | +// |
---|
| 3338 | +// refreshContents(); |
---|
| 3339 | +// } |
---|
| 3340 | + |
---|
3184 | 3341 | void ParseVertices() |
---|
3185 | 3342 | { |
---|
3186 | | - //if (group.selection.size() != 1) |
---|
3187 | | - // return; |
---|
3188 | | - |
---|
3189 | | - temprep = new BoundaryRep(); |
---|
3190 | | - nodes = new Object3D(); |
---|
3191 | | - vertices = new Vector<Vertex>(); |
---|
3192 | | - |
---|
3193 | | - boolean epsequal = GraphreeD.epsequal; |
---|
3194 | | - GraphreeD.epsequal = true; |
---|
| 3343 | + boolean epsequal = GrafreeD.epsequal; |
---|
| 3344 | + GrafreeD.epsequal = true; |
---|
3195 | 3345 | |
---|
3196 | 3346 | for (int i=0; i<group.selection.size(); i++) |
---|
3197 | 3347 | { |
---|
3198 | | - Object3D buffer = new cGroup(group.selection.get(i).name + "+"); |
---|
| 3348 | + final cGroup buffer = new cGroup(group.selection.get(i).name + "+"); |
---|
3199 | 3349 | |
---|
3200 | | - group.selection.get(i).Parse(this); |
---|
3201 | | - |
---|
3202 | | - int repsize = temprep.VertexCount(); |
---|
3203 | | - int tablesize = temprep.vertextable.size(); |
---|
3204 | | - int nodesize = nodes.size(); |
---|
| 3350 | + group.selection.get(i).Parse( |
---|
| 3351 | + |
---|
| 3352 | + new iParse() |
---|
| 3353 | + { |
---|
| 3354 | + public void Vertex(Object3D node, Vertex v) |
---|
| 3355 | + { |
---|
| 3356 | + temp.set(v); |
---|
| 3357 | + LA.xformPos(temp, node.GlobalTransformInv(), temp); |
---|
3205 | 3358 | |
---|
3206 | | - assert(vertices.size() == nodes.size()); |
---|
3207 | | - |
---|
3208 | | - temprep.vertextable.elements(); |
---|
3209 | | - |
---|
3210 | | - java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet(); |
---|
| 3359 | + cGroup g = new cGroup(); |
---|
3211 | 3360 | |
---|
3212 | | - for (java.util.Map.Entry<Vertex,Vertex> entry : set) |
---|
3213 | | - { |
---|
3214 | | - cGroup g = new cGroup(); |
---|
| 3361 | + if (g.toParent == null) |
---|
| 3362 | + { |
---|
| 3363 | + g.toParent = LA.newMatrix(); |
---|
| 3364 | + g.fromParent = LA.newMatrix(); |
---|
| 3365 | + } |
---|
| 3366 | + LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
| 3367 | + LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
3215 | 3368 | |
---|
3216 | | - int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k)); |
---|
3217 | | - Object3D node = nodes.get(index); |
---|
3218 | | - temp.set(vertices.get(index)); // temprep.GetVertex(k)); |
---|
3219 | | - // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z); |
---|
| 3369 | + g.add(GrafreeD.clipboard); |
---|
3220 | 3370 | |
---|
3221 | | - LA.xformPos(temp, node.GlobalTransformInv(), temp); |
---|
3222 | | - |
---|
3223 | | - // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z); |
---|
3224 | | - |
---|
3225 | | - if (g.toParent == null) |
---|
3226 | | - { |
---|
3227 | | - g.toParent = LA.newMatrix(); |
---|
3228 | | - g.fromParent = LA.newMatrix(); |
---|
3229 | | - } |
---|
3230 | | - LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
3231 | | - LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
| 3371 | + buffer.add(g); |
---|
| 3372 | + } |
---|
3232 | 3373 | |
---|
3233 | | - g.add(GraphreeD.clipboard); |
---|
| 3374 | + public void Face(Object3D node, Face f) |
---|
| 3375 | + { |
---|
3234 | 3376 | |
---|
3235 | | - buffer.add(g); |
---|
3236 | | - } |
---|
| 3377 | + } |
---|
| 3378 | + } |
---|
| 3379 | + ); |
---|
3237 | 3380 | |
---|
3238 | 3381 | makeSomething(buffer, i==group.selection.size()-1); |
---|
3239 | 3382 | } |
---|
3240 | 3383 | |
---|
3241 | | - GraphreeD.epsequal = epsequal; |
---|
3242 | | - |
---|
3243 | | - //buffer = null; |
---|
3244 | | - temprep = null; |
---|
3245 | | - nodes = null; |
---|
| 3384 | + GrafreeD.epsequal = epsequal; |
---|
3246 | 3385 | |
---|
3247 | 3386 | refreshContents(); |
---|
3248 | 3387 | } |
---|
3249 | | - |
---|
| 3388 | + |
---|
| 3389 | + void TextureVertices() |
---|
| 3390 | + { |
---|
| 3391 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 3392 | + { |
---|
| 3393 | + group.selection.get(i).Parse( |
---|
| 3394 | + new iParse() |
---|
| 3395 | + { |
---|
| 3396 | + public void Vertex(Object3D node, Vertex v) |
---|
| 3397 | + { |
---|
| 3398 | + cTexture tex = node.GetTextures(); |
---|
| 3399 | + String pigment = Object3D.GetPigment(tex); |
---|
| 3400 | + //String bump = Object3D.GetBump(tex); |
---|
| 3401 | + |
---|
| 3402 | + com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres); |
---|
| 3403 | + |
---|
| 3404 | + double s = v.s; |
---|
| 3405 | + |
---|
| 3406 | + if (s == 1) |
---|
| 3407 | + s = 0; |
---|
| 3408 | + |
---|
| 3409 | + double t = v.t; |
---|
| 3410 | + |
---|
| 3411 | + if (t == 1) |
---|
| 3412 | + t = 0; |
---|
| 3413 | + |
---|
| 3414 | + int indexs = (int) (texturedata.getWidth() * s); |
---|
| 3415 | + int indext = (int) (texturedata.getHeight() * t); |
---|
| 3416 | + |
---|
| 3417 | + int index = indext * texturedata.getWidth() + indexs; |
---|
| 3418 | + |
---|
| 3419 | + java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer(); |
---|
| 3420 | + |
---|
| 3421 | + int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight(); |
---|
| 3422 | + |
---|
| 3423 | + float scale = bytebuf.get(index*slide) & 0xFF; |
---|
| 3424 | + scale += bytebuf.get(index*slide+1) & 0xFF; |
---|
| 3425 | + scale += bytebuf.get(index*slide+2) & 0xFF; |
---|
| 3426 | + scale /= 3; |
---|
| 3427 | + |
---|
| 3428 | + scale /= 0xFF; |
---|
| 3429 | + // c'est quoi ca? scale /= 4; |
---|
| 3430 | + |
---|
| 3431 | + //v.AO = scale; |
---|
| 3432 | + |
---|
| 3433 | + v.x += v.norm.x * scale; |
---|
| 3434 | + v.y += v.norm.y * scale; |
---|
| 3435 | + v.z += v.norm.z * scale; |
---|
| 3436 | + } |
---|
| 3437 | + |
---|
| 3438 | + public void Face(Object3D node, Face f) |
---|
| 3439 | + { |
---|
| 3440 | + } |
---|
| 3441 | + } |
---|
| 3442 | + ); |
---|
| 3443 | + } |
---|
| 3444 | + |
---|
| 3445 | + refreshContents(); |
---|
| 3446 | + } |
---|
| 3447 | + |
---|
3250 | 3448 | void Align() |
---|
3251 | 3449 | { |
---|
3252 | 3450 | for (int i=0; i<group.selection.size(); i++) |
---|
.. | .. |
---|
3267 | 3465 | // ref.SaveSupports(); |
---|
3268 | 3466 | // Object3D par = ref.parent; |
---|
3269 | 3467 | // ref.parent = null; |
---|
3270 | | -// Object3D lowres = (Object3D) GraphreeD.clone(ref); |
---|
| 3468 | +// Object3D lowres = (Object3D) GrafreeD.clone(ref); |
---|
3271 | 3469 | // ref.parent = par; |
---|
3272 | 3470 | // ref.RestoreSupports(); |
---|
3273 | 3471 | |
---|
.. | .. |
---|
3297 | 3495 | // lowres.SaveSupports(); |
---|
3298 | 3496 | // par = lowres.parent; |
---|
3299 | 3497 | // lowres.parent = null; |
---|
3300 | | -// Object3D newlow = (Object3D) GraphreeD.clone(lowres); |
---|
| 3498 | +// Object3D newlow = (Object3D) GrafreeD.clone(lowres); |
---|
3301 | 3499 | Object3D newlow = CloneObject(lowres, false); |
---|
3302 | 3500 | newlow.name = sn.switchobject.get(i).name; |
---|
3303 | 3501 | System.out.println(" pose#" + i + " = " + newlow); |
---|
.. | .. |
---|
3319 | 3517 | return; |
---|
3320 | 3518 | |
---|
3321 | 3519 | Object3D poses = group.selection.get(0); |
---|
3322 | | - Object3D ref = GraphreeD.clipboard.get(0); |
---|
| 3520 | + Object3D ref = GrafreeD.clipboard.get(0); |
---|
3323 | 3521 | |
---|
3324 | 3522 | Object3D newgroup = new Object3D("Po:" + poses.name); |
---|
3325 | 3523 | |
---|
.. | .. |
---|
3513 | 3711 | |
---|
3514 | 3712 | void ClipMesh() |
---|
3515 | 3713 | { |
---|
3516 | | - if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1) |
---|
| 3714 | + if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
3517 | 3715 | { |
---|
3518 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 3716 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
3519 | 3717 | |
---|
3520 | 3718 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
3521 | 3719 | content = ((cGroup)content).get(0); |
---|
3522 | 3720 | |
---|
3523 | 3721 | // for (int i=0; i<group.selection.size(); i++) |
---|
3524 | 3722 | // { |
---|
3525 | | -// group.selection.get(i).ClipMesh(GraphreeD.clipboard); |
---|
| 3723 | +// group.selection.get(i).ClipMesh(GrafreeD.clipboard); |
---|
3526 | 3724 | // } |
---|
3527 | | - group.selection.ClipMesh(GraphreeD.clipboard); |
---|
| 3725 | + group.selection.ClipMesh(GrafreeD.clipboard); |
---|
3528 | 3726 | } |
---|
3529 | | -// group.selection.ClipMesh(GraphreeD.clipboard); |
---|
| 3727 | +// group.selection.ClipMesh(GrafreeD.clipboard); |
---|
3530 | 3728 | System.out.println("DONE."); |
---|
3531 | 3729 | refreshContents(); |
---|
3532 | 3730 | } |
---|
.. | .. |
---|
3864 | 4062 | { |
---|
3865 | 4063 | if (group.selection.isEmpty()) |
---|
3866 | 4064 | return; |
---|
3867 | | - GraphreeD.clipboardIsTempGroup = false; |
---|
| 4065 | + GrafreeD.clipboardIsTempGroup = false; |
---|
3868 | 4066 | Composite tGroup = null; |
---|
3869 | 4067 | if (group.selection.size() > 0) // 1) |
---|
3870 | 4068 | { |
---|
3871 | 4069 | tGroup = new cGroup(); |
---|
3872 | | - GraphreeD.clipboardIsTempGroup = true; |
---|
| 4070 | + GrafreeD.clipboardIsTempGroup = true; |
---|
3873 | 4071 | } |
---|
3874 | 4072 | |
---|
3875 | 4073 | if (cut) |
---|
.. | .. |
---|
3909 | 4107 | //System.out.println("cut " + child); |
---|
3910 | 4108 | //System.out.println("parent = " + child.parent); |
---|
3911 | 4109 | // tmp.addChild(child); |
---|
3912 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4110 | + if (GrafreeD.clipboardIsTempGroup) |
---|
3913 | 4111 | tGroup.add/*Child*/(tmp); |
---|
3914 | 4112 | else |
---|
3915 | | - GraphreeD.clipboard = tmp; |
---|
| 4113 | + GrafreeD.clipboard = tmp; |
---|
3916 | 4114 | } |
---|
3917 | 4115 | else |
---|
3918 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4116 | + if (GrafreeD.clipboardIsTempGroup) |
---|
3919 | 4117 | tGroup.add/*Child*/(child); |
---|
3920 | 4118 | else |
---|
3921 | | - GraphreeD.clipboard = child; |
---|
| 4119 | + GrafreeD.clipboard = child; |
---|
3922 | 4120 | } |
---|
3923 | 4121 | |
---|
3924 | 4122 | //ResetModel(); |
---|
.. | .. |
---|
3950 | 4148 | //System.out.println("cut " + elem); |
---|
3951 | 4149 | //System.out.println("parent = " + elem.parent); |
---|
3952 | 4150 | // tmp.addChild(elem); |
---|
3953 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4151 | + if (GrafreeD.clipboardIsTempGroup) |
---|
3954 | 4152 | tGroup.add/*Child*/(tmp); |
---|
3955 | 4153 | else |
---|
3956 | | - GraphreeD.clipboard = tmp; |
---|
| 4154 | + GrafreeD.clipboard = tmp; |
---|
3957 | 4155 | } |
---|
3958 | 4156 | else |
---|
3959 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4157 | + if (GrafreeD.clipboardIsTempGroup) |
---|
3960 | 4158 | tGroup.add/*Child*/(child); |
---|
3961 | 4159 | else |
---|
3962 | | - GraphreeD.clipboard = child; |
---|
| 4160 | + GrafreeD.clipboard = child; |
---|
3963 | 4161 | } |
---|
3964 | 4162 | |
---|
3965 | 4163 | } |
---|
3966 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
3967 | | - GraphreeD.clipboard = tGroup; |
---|
| 4164 | + if (GrafreeD.clipboardIsTempGroup) |
---|
| 4165 | + GrafreeD.clipboard = tGroup; |
---|
3968 | 4166 | if (cut) |
---|
3969 | 4167 | { |
---|
3970 | 4168 | ResetModel(); |
---|
.. | .. |
---|
3974 | 4172 | |
---|
3975 | 4173 | void paste(boolean expand) |
---|
3976 | 4174 | { |
---|
3977 | | - // if (GraphreeD.clipboard == null) |
---|
| 4175 | + // if (GrafreeD.clipboard == null) |
---|
3978 | 4176 | // return; |
---|
3979 | 4177 | boolean first = true; |
---|
3980 | 4178 | |
---|
3981 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4179 | + if (GrafreeD.clipboardIsTempGroup) |
---|
3982 | 4180 | { |
---|
3983 | 4181 | Composite temp; |
---|
3984 | 4182 | |
---|
.. | .. |
---|
3989 | 4187 | temp = (Composite)Applet3D.clipboard.deepCopy(); |
---|
3990 | 4188 | */ |
---|
3991 | 4189 | Object3D elem; |
---|
3992 | | - for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) |
---|
| 4190 | + for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) |
---|
3993 | 4191 | { |
---|
3994 | 4192 | Object3D child = (Object3D)e.nextElement(); |
---|
3995 | 4193 | |
---|
.. | .. |
---|
4003 | 4201 | else |
---|
4004 | 4202 | elem = child.deepCopy(); // ? |
---|
4005 | 4203 | child.parent = keepparent; |
---|
4006 | | - //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent)) |
---|
| 4204 | + //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent)) |
---|
4007 | 4205 | // elem = elem.get(0); |
---|
4008 | 4206 | makeSomething(elem, true); // ?? first); |
---|
4009 | 4207 | //group.addChild(elem); |
---|
.. | .. |
---|
4023 | 4221 | //Object3D cb = Applet3D.clipboard; |
---|
4024 | 4222 | //temp.addChild(cb); |
---|
4025 | 4223 | //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0)); |
---|
4026 | | - assert(GraphreeD.clipboard.parent == null); |
---|
4027 | | - Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent; |
---|
4028 | | - GraphreeD.clipboard.get(0).parent = null; // Avoid copy? |
---|
4029 | | - if (LA.isIdentity(GraphreeD.clipboard.toParent)) |
---|
4030 | | - makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy()); |
---|
| 4224 | + assert(GrafreeD.clipboard.parent == null); |
---|
| 4225 | + Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent; |
---|
| 4226 | + GrafreeD.clipboard.get(0).parent = null; // Avoid copy? |
---|
| 4227 | + if (LA.isIdentity(GrafreeD.clipboard.toParent)) |
---|
| 4228 | + makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy()); |
---|
4031 | 4229 | else |
---|
4032 | | - makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy()); |
---|
4033 | | - GraphreeD.clipboard.get(0).parent = keepparent; |
---|
| 4230 | + makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy()); |
---|
| 4231 | + GrafreeD.clipboard.get(0).parent = keepparent; |
---|
4034 | 4232 | } |
---|
4035 | 4233 | |
---|
4036 | 4234 | ResetModel(); |
---|
.. | .. |
---|
4039 | 4237 | |
---|
4040 | 4238 | void pasteInto(boolean copyit) |
---|
4041 | 4239 | { |
---|
4042 | | -// if (GraphreeD.clipboard == null) |
---|
| 4240 | +// if (GrafreeD.clipboard == null) |
---|
4043 | 4241 | // return; |
---|
4044 | 4242 | |
---|
4045 | 4243 | if (group.selection.size() != 1) |
---|
.. | .. |
---|
4072 | 4270 | { |
---|
4073 | 4271 | boolean first = true; |
---|
4074 | 4272 | |
---|
4075 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4273 | + if (GrafreeD.clipboardIsTempGroup) |
---|
4076 | 4274 | { |
---|
4077 | | - Composite temp = (Composite)GraphreeD.clipboard; |
---|
| 4275 | + Composite temp = (Composite)GrafreeD.clipboard; |
---|
4078 | 4276 | Object3D copy; |
---|
4079 | 4277 | for (Enumeration e = temp.children.elements(); e.hasMoreElements();) |
---|
4080 | 4278 | { |
---|
.. | .. |
---|
4084 | 4282 | } |
---|
4085 | 4283 | } else |
---|
4086 | 4284 | { |
---|
4087 | | - linkSomething(GraphreeD.clipboard); //.get(0)); |
---|
| 4285 | + linkSomething(GrafreeD.clipboard); //.get(0)); |
---|
4088 | 4286 | } |
---|
4089 | 4287 | } |
---|
4090 | 4288 | } |
---|
.. | .. |
---|
4471 | 4669 | |
---|
4472 | 4670 | void ImportGFD() |
---|
4473 | 4671 | { |
---|
4474 | | - FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD); |
---|
| 4672 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
4475 | 4673 | browser.show(); |
---|
4476 | 4674 | String filename = browser.getFile(); |
---|
4477 | 4675 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4509 | 4707 | |
---|
4510 | 4708 | void ImportVRMLX3D() |
---|
4511 | 4709 | { |
---|
4512 | | - if (GraphreeD.standAlone) |
---|
| 4710 | + if (GrafreeD.standAlone) |
---|
4513 | 4711 | { |
---|
4514 | 4712 | /**/ |
---|
4515 | 4713 | FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
.. | .. |
---|
4526 | 4724 | |
---|
4527 | 4725 | String GetFile(String dialogName) |
---|
4528 | 4726 | { |
---|
4529 | | - if (GraphreeD.standAlone) |
---|
| 4727 | + if (GrafreeD.standAlone) |
---|
4530 | 4728 | { |
---|
4531 | 4729 | FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD); |
---|
4532 | 4730 | browser.show(); |
---|
.. | .. |
---|
4653 | 4851 | private MenuItem clearItem; |
---|
4654 | 4852 | private MenuItem clearAllItem; |
---|
4655 | 4853 | private MenuItem genUVItem; |
---|
| 4854 | + private MenuItem genNormalsMESHItem; |
---|
4656 | 4855 | private MenuItem genNormalsCADItem; |
---|
4657 | 4856 | private MenuItem genNormalsORGANItem; |
---|
4658 | 4857 | private MenuItem stripifyItem; |
---|
.. | .. |
---|
4728 | 4927 | private MenuItem particleItem; |
---|
4729 | 4928 | private MenuItem ragdollItem; |
---|
4730 | 4929 | private MenuItem ragdoll2Item; |
---|
| 4930 | + private MenuItem heightFieldItem; |
---|
| 4931 | + private MenuItem textureFieldItem; |
---|
4731 | 4932 | private MenuItem gridItem; |
---|
4732 | 4933 | private MenuItem rectoidItem; |
---|
4733 | 4934 | private MenuItem ellipsoidItem; |
---|