Normand Briere
2018-12-15 6ed65dcb597fb2153cef75bf1845978f1115658c
GroupEditor.java
....@@ -14,7 +14,7 @@
1414
1515 //import buoy.widget.BFileChooser;
1616
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
17
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
1818 ObjectUI,
1919 Runnable,
2020 ActionListener,
....@@ -83,7 +83,7 @@
8383
8484 void CloneSelection(boolean supports)
8585 {
86
- // Object3D keep = GraphreeD.clipboard;
86
+ // Object3D keep = GrafreeD.clipboard;
8787 //Object3D obj;
8888 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
8989 {
....@@ -97,14 +97,14 @@
9797
9898 void CloneClipboard(boolean supports)
9999 {
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));
105105 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;
108108 }
109109
110110 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +118,7 @@
118118 // obj.support = null;
119119 if (!supports)
120120 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
121
+ Object3D clone = (Object3D)GrafreeD.clone(obj);
122122 obj.parent = parent;
123123 // obj.support = support;
124124 // clone.support = support; // aout 2013
....@@ -188,8 +188,9 @@
188188 clearItem.addActionListener(this);
189189 clearAllItem = menu.add(new MenuItem("Clear All"));
190190 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"));
193194 resetMeshItem.addActionListener(this);
194195 stepAllItem = menu.add(new MenuItem("Step All"));
195196 stepAllItem.addActionListener(this);
....@@ -218,18 +219,24 @@
218219 resetsupportItem.addActionListener(this);
219220 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220221 linkverticesItem.addActionListener(this);
222
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223
+ relinkverticesItem.addActionListener(this);
221224 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222225 setMasterItem.addActionListener(this);
223226
224
- oe.menuBar.add(menu = new Menu("Object"));
227
+ oe.menuBar.add(menu = new Menu("Group"));
225228 grabItem = menu.add(new MenuItem("Grab"));
226229 grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
229230 backItem = menu.add(new MenuItem("Back"));
230231 backItem.addActionListener(this);
232
+ frontItem = menu.add(new MenuItem("Front"));
233
+ frontItem.addActionListener(this);
231234 compositeItem = menu.add(new MenuItem("Composite"));
232235 compositeItem.addActionListener(this);
236
+ hideItem = menu.add(new MenuItem("Hide"));
237
+ hideItem.addActionListener(this);
238
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
239
+ ungroupItem.addActionListener(this);
233240 menu.add("-");
234241 randomItem = menu.add(new MenuItem("Random"));
235242 randomItem.addActionListener(this);
....@@ -247,9 +254,12 @@
247254 scriptNodeItem.addActionListener(this);
248255 cameraItem = menu.add(new MenuItem("Camera"));
249256 cameraItem.addActionListener(this);
250
- menu.add("-");
257
+
258
+ oe.menuBar.add(menu = new Menu("Object"));
251259 textureItem = menu.add(new MenuItem("Texture"));
252260 textureItem.addActionListener(this);
261
+ billboardItem = menu.add(new MenuItem("Billboard"));
262
+ billboardItem.addActionListener(this);
253263 csgItem = menu.add(new MenuItem("CSG"));
254264 csgItem.addActionListener(this);
255265 shadowXItem = menu.add(new MenuItem("Shadow X"));
....@@ -267,14 +277,12 @@
267277 pointflowItem = menu.add(new MenuItem("Point Flow"));
268278 pointflowItem.addActionListener(this);
269279 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272280 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273281 resetTransformItem.addActionListener(this);
274282 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275283 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
284
+ transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
+ transformgeometryItem.addActionListener(this);
278286
279287 oe.menuBar.add(menu = new Menu("Geometry"));
280288 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +291,10 @@
283291 genNormalsORGANItem.addActionListener(this);
284292 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285293 genNormalsCADItem.addActionListener(this);
294
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295
+ genNormalsMESHItem.addActionListener(this);
296
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
297
+ genNormalsMINEItem.addActionListener(this);
286298 stripifyItem = menu.add(new MenuItem("Stripify"));
287299 stripifyItem.addActionListener(this);
288300 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +304,6 @@
292304 untrimItem = menu.add(new MenuItem("Untrim"));
293305 untrimItem.addActionListener(this);
294306 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297307 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298308 clearColorsItem.addActionListener(this);
299309 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -310,6 +320,10 @@
310320 smoothMeshItem.addActionListener(this);
311321 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312322 clipMeshItem.addActionListener(this);
323
+
324
+ oe.menuBar.add(menu = new Menu("Attributes"));
325
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326
+ clearMaterialsItem.addActionListener(this);
313327 menu.add("-");
314328 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315329 liveleavesItem.addActionListener(this);
....@@ -332,27 +346,18 @@
332346 flipVItem.addActionListener(this);
333347 unflipVItem = menu.add(new MenuItem("Unflip V"));
334348 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
349
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336350 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
351
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338352 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
353
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340354 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
355
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342356 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
357
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344358 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
359
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346360 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);
356361
357362 oe.menuBar.add(menu = new Menu("Selection"));
358363 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,9 +375,31 @@
370375 sortbysizeItem.addActionListener(this);
371376 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372377 sortbynameItem.addActionListener(this);
378
+ menu.add("-");
379
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380
+ extractGeometriesItem.addActionListener(this);
381
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382
+ cloneGeometriesItem.addActionListener(this);
383
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
+ shareGeometriesItem.addActionListener(this);
385
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
+ mergeGeometriesItem.addActionListener(this);
387
+
373388 oe.menuBar.add(menu = new Menu("Insert"));
374389 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
390
+
391
+
392
+ oe.menuBar.add(menu = new Menu("Include"));
393
+ importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
+ importGFDItem.addActionListener(this);
395
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
+ importVRMLX3DItem.addActionListener(this);
397
+ importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
+ importOBJItem.addActionListener(this);
399
+ import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
+ import3DSItem.addActionListener(this);
401
+
402
+ oe.menuBar.add(menu = new Menu("Tools"));
376403 buildToolsMenu(menu);
377404 }
378405
....@@ -493,6 +520,9 @@
493520
494521 oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
495522 flashSelectionButton.addActionListener(this);
523
+
524
+ oe.toolbarPanel.add(new cButton(" ", false));
525
+
496526 oe.aConstraints.gridx += 1;
497527 oe.aConstraints.weighty = 0;
498528 oe.aConstraints.gridwidth = 1;
....@@ -619,14 +649,14 @@
619649
620650 void EditObject(Object3D obj)
621651 {
622
- cRadio dummyButton = new cRadio(obj.name);
623
- dummyButton.SetObject(obj);
624
- dummyButton.layout = sevenButton;
625
- dummyButton.SetCamera(cameraView.renderCamera, false);
626
- dummyButton.addActionListener(this);
627
- radioPanel.add(dummyButton);
628
- buttonGroup.add(dummyButton);
629
- dummyButton.doClick();
652
+ cRadio radioButton = new cRadio(obj.name);
653
+ radioButton.SetObject(obj);
654
+ radioButton.layout = sevenButton;
655
+ radioButton.SetCamera(cameraView.renderCamera, false);
656
+ radioButton.addActionListener(this);
657
+ radioPanel.add(radioButton);
658
+ buttonGroup.add(radioButton);
659
+ radioButton.doClick();
630660 }
631661 void SetupViews(ObjEditor oe)
632662 {
....@@ -688,8 +718,7 @@
688718 dropAttributes |= Object3D.TEXTURE;
689719 else
690720 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
721
+ } else if(e.getSource() == liveCB)
693722 {
694723 cameraView.ToggleLive();
695724 }
....@@ -1002,6 +1031,8 @@
10021031
10031032 void buildCreateMenu(Menu menu)
10041033 {
1034
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1035
+ //heightFieldItem.addActionListener(this);
10051036 gridItem = menu.add(new MenuItem("Grid"));
10061037 gridItem.addActionListener(this);
10071038 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,6 +1045,8 @@
10141045 torusItem.addActionListener(this);
10151046 superItem = menu.add(new MenuItem("Superellipsoid"));
10161047 superItem.addActionListener(this);
1048
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1049
+ kleinItem.addActionListener(this);
10171050 particleItem = menu.add(new MenuItem("Particle system"));
10181051 particleItem.addActionListener(this);
10191052 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1048,15 +1081,6 @@
10481081 doubleItem.addActionListener(this);
10491082 tripleItem = menu.add(new MenuItem("Trident"));
10501083 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);
10601084 }
10611085
10621086 void buildToolsMenu(Menu menu)
....@@ -1068,6 +1092,8 @@
10681092 menu.add("-");
10691093 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701094 parseverticesItem.addActionListener(this);
1095
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1096
+ textureFieldItem.addActionListener(this);
10711097 alignItem = menu.add(new MenuItem("Align"));
10721098 alignItem.addActionListener(this);
10731099 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
....@@ -1094,6 +1120,8 @@
10941120 resetParentItem.addActionListener(this);
10951121 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961122 repairParentItem.addActionListener(this);
1123
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1124
+ repairShadowItem.addActionListener(this);
10971125 menu.add(invariantsItem = new MenuItem("Invariants"));
10981126 invariantsItem.addActionListener(this);
10991127 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1429,9 +1457,9 @@
14291457
14301458 void Overwrite(int mask)
14311459 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1460
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
14331461 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1462
+ Object3D content = GrafreeD.clipboard.get(0);
14351463
14361464 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371465 content = ((cGroup)content).get(0);
....@@ -1521,6 +1549,46 @@
15211549 makeSomething(ragdoll);
15221550 //makeSomething(new VehicleDemo());
15231551 } else
1552
+ /*
1553
+ */
1554
+ if (event.getSource() == heightFieldItem)
1555
+ {
1556
+ Object3D obj = new Object3D();
1557
+
1558
+ obj.CreateMaterial();
1559
+ obj.bRep = new BoundaryRep();
1560
+
1561
+ obj.bRep.CreateMesh(new iHeightField()
1562
+ {
1563
+ public double f(double x, double y)
1564
+ {
1565
+ // The Mandelbrot set is represented by coloring
1566
+ // each point (x,y) according to the number of
1567
+ // iterations it takes before the while loop in
1568
+ // this method ends. For points that are actually
1569
+ // in the Mandelbrot set, or very close to it, the
1570
+ // count will reach the maximum value, 80. These
1571
+ // points will be colored purple. All other colors
1572
+ // represent points that are definitely NOT in the set.
1573
+ x -= 600;
1574
+ y -= 500;
1575
+ x /= 200;
1576
+ y /= 200;
1577
+ int count = 0;
1578
+ double zx = x;
1579
+ double zy = y;
1580
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1581
+ double new_zx = zx*zx - zy*zy + x;
1582
+ zy = 2*zx*zy + y;
1583
+ zx = new_zx;
1584
+ count++;
1585
+ }
1586
+ return count; // Math.sqrt(count);
1587
+ }
1588
+ }, 1000,1000);
1589
+
1590
+ makeSomething(obj);
1591
+ } else
15241592 if (event.getSource() == gridItem)
15251593 {
15261594 makeSomething(new Grid());
....@@ -1540,6 +1608,10 @@
15401608 if (event.getSource() == superItem)
15411609 {
15421610 makeSomething(new Superellipsoid());
1611
+ } else
1612
+ if (event.getSource() == kleinItem)
1613
+ {
1614
+ makeSomething(new Klein());
15431615 } else
15441616 if (event.getSource() == blobItem)
15451617 {
....@@ -1570,7 +1642,7 @@
15701642 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711643 LA.matInvert(obj.toParent, obj.fromParent);
15721644 */
1573
- makeSomething(new CheckerIG());
1645
+ makeSomething(new Checker());
15741646 } else
15751647 if (event.getSource() == meshItem)
15761648 {
....@@ -1726,7 +1798,7 @@
17261798 if (event.getSource() == invariantsItem)
17271799 {
17281800 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
1801
+ GrafreeD.grafreeD.universe.invariants();
17301802 } else
17311803 if (event.getSource() == memoryItem)
17321804 {
....@@ -1796,10 +1868,10 @@
17961868 } else
17971869 if (event.getSource() == duplicateItem)
17981870 {
1799
- Object3D keep = GraphreeD.clipboard;
1871
+ Object3D keep = GrafreeD.clipboard;
18001872 loadClipboard(false);
18011873 paste(false);
1802
- GraphreeD.clipboard = keep;
1874
+ GrafreeD.clipboard = keep;
18031875 } else
18041876 if (event.getSource() == cloneItem)
18051877 {
....@@ -1843,8 +1915,9 @@
18431915 } else
18441916 if (event.getSource() == overwriteMatItem)
18451917 {
1918
+ /* july 2015
18461919 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
1920
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18481921 else
18491922 {
18501923 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +1929,16 @@
18561929 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18571930 }
18581931 }
1932
+ */
1933
+
1934
+ Overwrite(dropAttributes);
18591935 }
18601936 if (event.getSource() == overwriteGeoItem)
18611937 {
18621938 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1939
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18641940 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
1941
+// Object3D content = GrafreeD.clipboard.get(0);
18661942 //
18671943 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18681944 // content = ((cGroup)content).get(0);
....@@ -1945,23 +2021,28 @@
19452021 if (group.selection.size() == 1)
19462022 one = true;
19472023
2024
+ Object3D merge = null;
2025
+
19482026 Object3D content = new cGroup();
19492027
19502028 for (int i=0; i<group.selection.size(); i++)
19512029 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2030
+ merge = new Merge(group.selection.get(i));
19532031
19542032 if (one)
1955
- makeSomething(sel, false);
2033
+ makeSomething(merge, false);
19562034 else
1957
- content.addChild(sel);
2035
+ content.addChild(merge);
19582036 }
19592037
19602038 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2039
+ makeSomething(content, true);
2040
+ else
2041
+ {
2042
+ ResetModel();
2043
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2044
+ refreshContents();
2045
+ }
19652046 } else
19662047 if (event.getSource() == mergeGeometriesItem)
19672048 {
....@@ -1995,9 +2076,9 @@
19952076 } else
19962077 if (event.getSource() == linkverticesItem)
19972078 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2079
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992080 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2081
+// Object3D content = GrafreeD.clipboard.get(0);
20012082 //
20022083 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032084 // content = ((cGroup)content).get(0);
....@@ -2006,9 +2087,9 @@
20062087 // group.selection.get(0).setMasterThis(content); // should be identity
20072088 // refreshContents();
20082089 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2090
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
20102091 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2092
+ Object3D content = GrafreeD.clipboard.get(0);
20122093
20132094 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142095 content = ((cGroup)content).get(0);
....@@ -2038,6 +2119,15 @@
20382119
20392120 refreshContents();
20402121 } else
2122
+ if (event.getSource() == relinkverticesItem)
2123
+ {
2124
+ boolean random = CameraPane.RANDOM;
2125
+ CameraPane.RANDOM = false; // parse all random nodes
2126
+ group.selection.RelinkToSupport();
2127
+ CameraPane.RANDOM = random;
2128
+
2129
+ refreshContents();
2130
+ } else
20412131 if (event.getSource() == resetreferencesItem)
20422132 {
20432133 for (int i=0; i<group.selection.size(); i++)
....@@ -2049,9 +2139,9 @@
20492139 } else
20502140 if (event.getSource() == setMasterItem)
20512141 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2142
+ if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20532143 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2144
+ Object3D content = GrafreeD.clipboard.get(0);
20552145
20562146 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572147 content = ((cGroup)content).get(0);
....@@ -2064,9 +2154,9 @@
20642154 {
20652155 if (group.selection.size() == 1)
20662156 {
2067
- if (GraphreeD.clipboard.size() == 1)
2157
+ if (GrafreeD.clipboard.size() == 1)
20682158 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2159
+ Object3D content = GrafreeD.clipboard.get(0);
20702160
20712161 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722162 content = ((cGroup)content).get(0);
....@@ -2106,6 +2196,10 @@
21062196 if (event.getSource() == grabItem)
21072197 {
21082198 group(new cGroup(), true);
2199
+ } else
2200
+ if (event.getSource() == hideItem)
2201
+ {
2202
+ group(new HiddenObject());
21092203 } else
21102204 if (event.getSource() == frontItem)
21112205 {
....@@ -2229,6 +2323,10 @@
22292323 {
22302324 group(new TextureNode());
22312325 } else
2326
+ if (event.getSource() == billboardItem)
2327
+ {
2328
+ group(new BillboardNode());
2329
+ } else
22322330 if (event.getSource() == shadowXItem)
22332331 {
22342332 CastShadow(0);
....@@ -2243,7 +2341,15 @@
22432341 } else
22442342 if (event.getSource() == ungroupItem)
22452343 {
2246
- ungroup();
2344
+ //ungroup();
2345
+ for (int i=0; i<group.selection.size(); i++)
2346
+ {
2347
+ Ungroup(group.selection.get(i));
2348
+ }
2349
+
2350
+ ClearSelection(false);
2351
+
2352
+ refreshContents();
22472353 } else
22482354 if (event.getSource() == genUVItem)
22492355 {
....@@ -2253,9 +2359,17 @@
22532359 {
22542360 GenNormals(true);
22552361 } else
2362
+ if (event.getSource() == genNormalsMESHItem)
2363
+ {
2364
+ GenNormals(true); // TODO
2365
+ } else
22562366 if (event.getSource() == genNormalsORGANItem)
22572367 {
22582368 GenNormals(false);
2369
+ } else
2370
+ if (event.getSource() == genNormalsMINEItem)
2371
+ {
2372
+ GenNormalsMINE();
22592373 } else
22602374 if (event.getSource() == stripifyItem)
22612375 {
....@@ -2353,6 +2467,10 @@
23532467 {
23542468 ParseVertices();
23552469 } else
2470
+ if (event.getSource() == textureFieldItem)
2471
+ {
2472
+ TextureVertices();
2473
+ } else
23562474 if (event.getSource() == alignItem)
23572475 {
23582476 Align();
....@@ -2421,6 +2539,20 @@
24212539 {
24222540 Object3D obj = (Object3D)e.nextElement();
24232541 obj.RepairParent();
2542
+// for (int i=0; i<obj.size(); i++)
2543
+// {
2544
+// obj.get(i).parent = obj;
2545
+// }
2546
+ }
2547
+
2548
+ refreshContents();
2549
+ } else
2550
+ if (event.getSource() == repairShadowItem)
2551
+ {
2552
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2553
+ {
2554
+ Object3D obj = (Object3D)e.nextElement();
2555
+ obj.RepairShadow();
24242556 // for (int i=0; i<obj.size(); i++)
24252557 // {
24262558 // obj.get(i).parent = obj;
....@@ -2524,8 +2656,8 @@
25242656 // bug
25252657 //gridPanel.setDividerLocation(1.0);
25262658 //bigPanel.setDividerLocation(0.0);
2527
- bigThree.remove(jtp);
2528
- bigThree.remove(cameraPanel);
2659
+ bigThree.remove(scenePanel);
2660
+ bigThree.remove(centralPanel);
25292661 bigThree.remove(XYZPanel);
25302662 aWindowConstraints.gridx = 0;
25312663 aWindowConstraints.gridy = 0;
....@@ -2540,7 +2672,7 @@
25402672 // aConstraints.gridheight = 3;
25412673 aWindowConstraints.gridx = 1;
25422674 aWindowConstraints.fill = GridBagConstraints.BOTH;
2543
- bigThree.add(cameraPanel, aWindowConstraints);
2675
+ bigThree.add(centralPanel, aWindowConstraints);
25442676 aWindowConstraints.weightx = 0;
25452677 aWindowConstraints.gridx = 4;
25462678 aWindowConstraints.gridwidth = 1;
....@@ -2552,8 +2684,8 @@
25522684 if (event.getSource() == threeButton)
25532685 {
25542686 radio.layout = threeButton;
2555
- bigThree.remove(jtp);
2556
- bigThree.remove(cameraPanel);
2687
+ bigThree.remove(scenePanel);
2688
+ bigThree.remove(centralPanel);
25572689 bigThree.remove(XYZPanel);
25582690 aWindowConstraints.gridx = 0;
25592691 aWindowConstraints.gridy = 0;
....@@ -2568,7 +2700,7 @@
25682700 // aConstraints.gridheight = 3;
25692701 aWindowConstraints.gridx = 1;
25702702 aWindowConstraints.fill = GridBagConstraints.BOTH;
2571
- bigThree.add(cameraPanel, aWindowConstraints);
2703
+ bigThree.add(centralPanel, aWindowConstraints);
25722704 aWindowConstraints.weightx = 0;
25732705 aWindowConstraints.gridx = 4;
25742706 aWindowConstraints.gridwidth = 1;
....@@ -2580,8 +2712,8 @@
25802712 if (event.getSource() == fourButton)
25812713 {
25822714 radio.layout = fourButton;
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2715
+ bigThree.remove(scenePanel);
2716
+ bigThree.remove(centralPanel);
25852717 bigThree.remove(XYZPanel);
25862718 aWindowConstraints.gridx = 0;
25872719 aWindowConstraints.gridy = 0;
....@@ -2590,7 +2722,7 @@
25902722 aWindowConstraints.fill = GridBagConstraints.BOTH;
25912723 aWindowConstraints.weightx = 1;
25922724 aWindowConstraints.weighty = 1;
2593
- bigThree.add(jtp, aWindowConstraints);
2725
+ bigThree.add(scenePanel, aWindowConstraints);
25942726 aWindowConstraints.weightx = 1;
25952727 aWindowConstraints.gridwidth = 3;
25962728 // aConstraints.gridheight = 3;
....@@ -2608,8 +2740,8 @@
26082740 if (event.getSource() == sixButton)
26092741 {
26102742 radio.layout = sixButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2743
+ bigThree.remove(scenePanel);
2744
+ bigThree.remove(centralPanel);
26132745 bigThree.remove(XYZPanel);
26142746 aWindowConstraints.gridx = 0;
26152747 aWindowConstraints.gridy = 0;
....@@ -2618,13 +2750,13 @@
26182750 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
26192751 aWindowConstraints.weightx = 0;
26202752 aWindowConstraints.weighty = 1;
2621
- bigThree.add(jtp, aWindowConstraints);
2753
+ bigThree.add(scenePanel, aWindowConstraints);
26222754 aWindowConstraints.weightx = 1;
26232755 aWindowConstraints.gridwidth = 3;
26242756 // aWindowConstraints.gridheight = 3;
26252757 aWindowConstraints.gridx = 1;
26262758 aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2759
+ bigThree.add(centralPanel, aWindowConstraints);
26282760 aWindowConstraints.weightx = 0;
26292761 aWindowConstraints.gridx = 4;
26302762 aWindowConstraints.gridwidth = 1;
....@@ -2636,8 +2768,8 @@
26362768 if (event.getSource() == sevenButton)
26372769 {
26382770 radio.layout = sevenButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2771
+ bigThree.remove(scenePanel);
2772
+ bigThree.remove(centralPanel);
26412773 bigThree.remove(XYZPanel);
26422774 aWindowConstraints.gridx = 0;
26432775 aWindowConstraints.gridy = 0;
....@@ -2646,13 +2778,13 @@
26462778 aWindowConstraints.fill = GridBagConstraints.VERTICAL;
26472779 aWindowConstraints.weightx = 0;
26482780 aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2781
+ bigThree.add(scenePanel, aWindowConstraints);
26502782 aWindowConstraints.weightx = 1;
26512783 aWindowConstraints.gridwidth = 3;
26522784 // aWindowConstraints.gridheight = 3;
26532785 aWindowConstraints.gridx = 1;
26542786 aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- bigThree.add(cameraPanel, aWindowConstraints);
2787
+ bigThree.add(centralPanel, aWindowConstraints);
26562788 aWindowConstraints.weightx = 0;
26572789 aWindowConstraints.gridx = 4;
26582790 aWindowConstraints.gridwidth = 1;
....@@ -2750,7 +2882,7 @@
27502882 if (event.getSource() == unselectButton)
27512883 {
27522884 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
2885
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27542886 objEditor.ResetSliders();
27552887 refreshContents(true);
27562888 } else
....@@ -3065,9 +3197,9 @@
30653197 obj = (Object3D)e.nextElement();
30663198
30673199 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3200
+ GrafreeD.AnalyzeObject(obj);
30693201 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3202
+ GrafreeD.AnalyzeObject(obj.bRep);
30713203
30723204 // System.err.println((size/1024) + " KB is the size of " + obj);
30733205 }
....@@ -3109,6 +3241,13 @@
31093241 void GenNormals(boolean crease)
31103242 {
31113243 group.GenNormalsS(crease);
3244
+
3245
+ refreshContents();
3246
+ }
3247
+
3248
+ void GenNormalsMINE()
3249
+ {
3250
+ group.selection.GenNormalsMINE();
31123251
31133252 refreshContents();
31143253 }
....@@ -3157,104 +3296,250 @@
31573296
31583297 //Object3D buffer;
31593298 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
-
3299
+// BoundaryRep temprep;
3300
+// Object3D nodes;
3301
+// Vector<Vertex> vertices;
3302
+//
3303
+// cGroup buffer;
3304
+//
3305
+// public void Vertex(Object3D node, Vertex v)
3306
+// {
3307
+//// vertices.add(v);
3308
+//// nodes.addElement(node);
3309
+////
3310
+//// if (temprep.GetCache(v) != null)
3311
+//// {
3312
+//// temprep.Remove(v);
3313
+//// } else
3314
+//// {
3315
+//// temprep.Remember(v);
3316
+//// }
3317
+//
3318
+// //Object3D node = nodes.get(index);
3319
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3320
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3321
+//
3322
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3323
+//
3324
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3325
+//
3326
+// cGroup g = new cGroup();
3327
+//
3328
+// if (g.toParent == null)
3329
+// {
3330
+// g.toParent = LA.newMatrix();
3331
+// g.fromParent = LA.newMatrix();
3332
+// }
3333
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3334
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3335
+//
3336
+// g.add(GrafreeD.clipboard);
3337
+//
3338
+// buffer.add(g);
3339
+// }
3340
+//
3341
+// public void Face(Object3D node, Face f)
3342
+// {
3343
+//
3344
+// }
3345
+//
3346
+// void ParseVerticesOld() // ??
3347
+// {
3348
+// //if (group.selection.size() != 1)
3349
+// // return;
3350
+//
3351
+// temprep = new BoundaryRep();
3352
+// nodes = new Object3D();
3353
+// vertices = new Vector<Vertex>();
3354
+//
3355
+// boolean epsequal = GrafreeD.epsequal;
3356
+// GrafreeD.epsequal = true;
3357
+//
3358
+// for (int i=0; i<group.selection.size(); i++)
3359
+// {
3360
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3361
+//
3362
+// group.selection.get(i).Parse(
3363
+//this );
3364
+//
3365
+// int repsize = temprep.VertexCount();
3366
+// int tablesize = temprep.vertextable.size();
3367
+// int nodesize = nodes.size();
3368
+//
3369
+// assert(vertices.size() == nodes.size());
3370
+//
3371
+// temprep.vertextable.elements();
3372
+//
3373
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3374
+//
3375
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3376
+// {
3377
+// cGroup g = new cGroup();
3378
+//
3379
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3380
+//
3381
+// Object3D node = nodes.get(index);
3382
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3383
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3384
+//
3385
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3386
+//
3387
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3388
+//
3389
+// if (g.toParent == null)
3390
+// {
3391
+// g.toParent = LA.newMatrix();
3392
+// g.fromParent = LA.newMatrix();
3393
+// }
3394
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3395
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3396
+//
3397
+// g.add(GrafreeD.clipboard);
3398
+//
3399
+// buffer.add(g);
3400
+// }
3401
+//
3402
+// makeSomething(buffer, i==group.selection.size()-1);
3403
+// }
3404
+//
3405
+// GrafreeD.epsequal = epsequal;
3406
+//
3407
+// //buffer = null;
3408
+// temprep = null;
3409
+// nodes = null;
3410
+//
3411
+// refreshContents();
3412
+// }
3413
+
31843414 void ParseVertices()
31853415 {
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;
3416
+ boolean epsequal = GrafreeD.epsequal;
3417
+ GrafreeD.epsequal = true;
31953418
31963419 for (int i=0; i<group.selection.size(); i++)
31973420 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3421
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993422
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3423
+ group.selection.get(i).Parse(
3424
+
3425
+ new iParse()
3426
+ {
3427
+ public void Vertex(Object3D node, Vertex v)
3428
+ {
3429
+ temp.set(v);
3430
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053431
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();
3432
+ cGroup g = new cGroup();
32113433
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3434
+ if (g.toParent == null)
3435
+ {
3436
+ g.toParent = LA.newMatrix();
3437
+ g.fromParent = LA.newMatrix();
3438
+ }
3439
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3440
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153441
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);
3442
+ g.add(GrafreeD.clipboard);
32203443
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);
3444
+ buffer.add(g);
3445
+ }
32323446
3233
- g.add(GraphreeD.clipboard);
3447
+ public void Face(Object3D node, Face f)
3448
+ {
32343449
3235
- buffer.add(g);
3236
- }
3450
+ }
3451
+ }
3452
+ );
32373453
32383454 makeSomething(buffer, i==group.selection.size()-1);
32393455 }
32403456
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3457
+ GrafreeD.epsequal = epsequal;
32463458
32473459 refreshContents();
32483460 }
3249
-
3461
+
3462
+ void TextureVertices()
3463
+ {
3464
+ for (int i=0; i<group.selection.size(); i++)
3465
+ {
3466
+ group.selection.get(i).Parse(
3467
+ new iParse()
3468
+ {
3469
+ public void Vertex(Object3D node, Vertex v)
3470
+ {
3471
+ cTexture tex = node.GetTextures();
3472
+ String pigment = Object3D.GetPigment(tex);
3473
+ //String bump = Object3D.GetBump(tex);
3474
+
3475
+ com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
3476
+
3477
+ double s = v.s;
3478
+
3479
+ if (s == 1)
3480
+ s = 0;
3481
+
3482
+ double t = v.t;
3483
+
3484
+ if (t == 1)
3485
+ t = 0;
3486
+
3487
+ int indexs = (int) (texturedata.getWidth() * s);
3488
+ int indext = (int) (texturedata.getHeight() * t);
3489
+
3490
+ int index = indext * texturedata.getWidth() + indexs;
3491
+
3492
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3493
+
3494
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3495
+
3496
+ float scale = bytebuf.get(index*slide) & 0xFF;
3497
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3498
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3499
+ scale /= 3;
3500
+
3501
+ scale /= 0xFF;
3502
+ // c'est quoi ca? scale /= 4;
3503
+
3504
+ //v.AO = scale;
3505
+
3506
+ v.x += v.norm.x * scale;
3507
+ v.y += v.norm.y * scale;
3508
+ v.z += v.norm.z * scale;
3509
+ }
3510
+
3511
+ public void Face(Object3D node, Face f)
3512
+ {
3513
+ }
3514
+ }
3515
+ );
3516
+ }
3517
+
3518
+ refreshContents();
3519
+ }
3520
+
32503521 void Align()
32513522 {
3523
+ if (group.selection.size() == 0)
3524
+ return;
3525
+
3526
+ cVector bbmin = new cVector();
3527
+ cVector bbmax = new cVector();
3528
+
3529
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3530
+
3531
+ double dx = bbmax.x - bbmin.x;
3532
+ double dy = bbmax.y - bbmin.y;
3533
+ double dz = bbmax.z - bbmin.z;
3534
+
3535
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3536
+
32523537 for (int i=0; i<group.selection.size(); i++)
32533538 {
32543539 Object3D obj = group.selection.get(i);
32553540
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3541
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3542
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583543 }
32593544
32603545 refreshContents();
....@@ -3267,7 +3552,7 @@
32673552 // ref.SaveSupports();
32683553 // Object3D par = ref.parent;
32693554 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3555
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713556 // ref.parent = par;
32723557 // ref.RestoreSupports();
32733558
....@@ -3297,7 +3582,7 @@
32973582 // lowres.SaveSupports();
32983583 // par = lowres.parent;
32993584 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3585
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33013586 Object3D newlow = CloneObject(lowres, false);
33023587 newlow.name = sn.switchobject.get(i).name;
33033588 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +3604,7 @@
33193604 return;
33203605
33213606 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
3607
+ Object3D ref = GrafreeD.clipboard.get(0);
33233608
33243609 Object3D newgroup = new Object3D("Po:" + poses.name);
33253610
....@@ -3513,20 +3798,20 @@
35133798
35143799 void ClipMesh()
35153800 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3801
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
35173802 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
3803
+ Object3D content = GrafreeD.clipboard.get(0);
35193804
35203805 if (content instanceof cGroup && ((cGroup)content).transientlink )
35213806 content = ((cGroup)content).get(0);
35223807
35233808 // for (int i=0; i<group.selection.size(); i++)
35243809 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
3810
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35263811 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
3812
+ group.selection.ClipMesh(GrafreeD.clipboard);
35283813 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
3814
+// group.selection.ClipMesh(GrafreeD.clipboard);
35303815 System.out.println("DONE.");
35313816 refreshContents();
35323817 }
....@@ -3864,12 +4149,12 @@
38644149 {
38654150 if (group.selection.isEmpty())
38664151 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4152
+ GrafreeD.clipboardIsTempGroup = false;
38684153 Composite tGroup = null;
38694154 if (group.selection.size() > 0) // 1)
38704155 {
38714156 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4157
+ GrafreeD.clipboardIsTempGroup = true;
38734158 }
38744159
38754160 if (cut)
....@@ -3909,16 +4194,16 @@
39094194 //System.out.println("cut " + child);
39104195 //System.out.println("parent = " + child.parent);
39114196 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4197
+ if (GrafreeD.clipboardIsTempGroup)
39134198 tGroup.add/*Child*/(tmp);
39144199 else
3915
- GraphreeD.clipboard = tmp;
4200
+ GrafreeD.clipboard = tmp;
39164201 }
39174202 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4203
+ if (GrafreeD.clipboardIsTempGroup)
39194204 tGroup.add/*Child*/(child);
39204205 else
3921
- GraphreeD.clipboard = child;
4206
+ GrafreeD.clipboard = child;
39224207 }
39234208
39244209 //ResetModel();
....@@ -3950,21 +4235,21 @@
39504235 //System.out.println("cut " + elem);
39514236 //System.out.println("parent = " + elem.parent);
39524237 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4238
+ if (GrafreeD.clipboardIsTempGroup)
39544239 tGroup.add/*Child*/(tmp);
39554240 else
3956
- GraphreeD.clipboard = tmp;
4241
+ GrafreeD.clipboard = tmp;
39574242 }
39584243 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4244
+ if (GrafreeD.clipboardIsTempGroup)
39604245 tGroup.add/*Child*/(child);
39614246 else
3962
- GraphreeD.clipboard = child;
4247
+ GrafreeD.clipboard = child;
39634248 }
39644249
39654250 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4251
+ if (GrafreeD.clipboardIsTempGroup)
4252
+ GrafreeD.clipboard = tGroup;
39684253 if (cut)
39694254 {
39704255 ResetModel();
....@@ -3974,11 +4259,11 @@
39744259
39754260 void paste(boolean expand)
39764261 {
3977
- // if (GraphreeD.clipboard == null)
4262
+ // if (GrafreeD.clipboard == null)
39784263 // return;
39794264 boolean first = true;
39804265
3981
- if (GraphreeD.clipboardIsTempGroup)
4266
+ if (GrafreeD.clipboardIsTempGroup)
39824267 {
39834268 Composite temp;
39844269
....@@ -3989,7 +4274,7 @@
39894274 temp = (Composite)Applet3D.clipboard.deepCopy();
39904275 */
39914276 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4277
+ for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934278 {
39944279 Object3D child = (Object3D)e.nextElement();
39954280
....@@ -4003,7 +4288,7 @@
40034288 else
40044289 elem = child.deepCopy(); // ?
40054290 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4291
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074292 // elem = elem.get(0);
40084293 makeSomething(elem, true); // ?? first);
40094294 //group.addChild(elem);
....@@ -4023,14 +4308,14 @@
40234308 //Object3D cb = Applet3D.clipboard;
40244309 //temp.addChild(cb);
40254310 //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());
4311
+ assert(GrafreeD.clipboard.parent == null);
4312
+ Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4313
+ GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4314
+ if (LA.isIdentity(GrafreeD.clipboard.toParent))
4315
+ makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
40314316 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4317
+ makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4318
+ GrafreeD.clipboard.get(0).parent = keepparent;
40344319 }
40354320
40364321 ResetModel();
....@@ -4039,7 +4324,7 @@
40394324
40404325 void pasteInto(boolean copyit)
40414326 {
4042
-// if (GraphreeD.clipboard == null)
4327
+// if (GrafreeD.clipboard == null)
40434328 // return;
40444329
40454330 if (group.selection.size() != 1)
....@@ -4072,9 +4357,9 @@
40724357 {
40734358 boolean first = true;
40744359
4075
- if (GraphreeD.clipboardIsTempGroup)
4360
+ if (GrafreeD.clipboardIsTempGroup)
40764361 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4362
+ Composite temp = (Composite)GrafreeD.clipboard;
40784363 Object3D copy;
40794364 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804365 {
....@@ -4084,7 +4369,7 @@
40844369 }
40854370 } else
40864371 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4372
+ linkSomething(GrafreeD.clipboard); //.get(0));
40884373 }
40894374 }
40904375 }
....@@ -4276,6 +4561,26 @@
42764561 makeSomething(csg);
42774562 }
42784563
4564
+ void Ungroup(Object3D g)
4565
+ {
4566
+ if (g instanceof HiddenObject)
4567
+ {
4568
+ HiddenObject h = (HiddenObject) g;
4569
+
4570
+ for (int i=0; i<h.ActualSize(); i++)
4571
+ {
4572
+ objEditor.makeSomething(h.get(i), false);
4573
+ }
4574
+ }
4575
+ else
4576
+ {
4577
+ for (int i=0; i<g.Size(); i++)
4578
+ {
4579
+ objEditor.makeSomething(g.get(i), false);
4580
+ }
4581
+ }
4582
+ }
4583
+
42794584 void ungroup()
42804585 {
42814586 /*
....@@ -4471,7 +4776,7 @@
44714776
44724777 void ImportGFD()
44734778 {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4779
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
44754780 browser.show();
44764781 String filename = browser.getFile();
44774782 if (filename != null && filename.length() > 0)
....@@ -4509,7 +4814,7 @@
45094814
45104815 void ImportVRMLX3D()
45114816 {
4512
- if (GraphreeD.standAlone)
4817
+ if (GrafreeD.standAlone)
45134818 {
45144819 /**/
45154820 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4526,7 +4831,7 @@
45264831
45274832 String GetFile(String dialogName)
45284833 {
4529
- if (GraphreeD.standAlone)
4834
+ if (GrafreeD.standAlone)
45304835 {
45314836 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45324837 browser.show();
....@@ -4635,6 +4940,7 @@
46354940 private MenuItem resetsupportItem;
46364941 private MenuItem resetreferencesItem;
46374942 private MenuItem linkverticesItem;
4943
+ private MenuItem relinkverticesItem;
46384944 private MenuItem setMasterItem;
46394945 private MenuItem resetMeshItem;
46404946 private MenuItem stepAllItem;
....@@ -4653,8 +4959,10 @@
46534959 private MenuItem clearItem;
46544960 private MenuItem clearAllItem;
46554961 private MenuItem genUVItem;
4962
+ private MenuItem genNormalsMESHItem;
46564963 private MenuItem genNormalsCADItem;
46574964 private MenuItem genNormalsORGANItem;
4965
+ private MenuItem genNormalsMINEItem;
46584966 private MenuItem stripifyItem;
46594967 private MenuItem unstripifyItem;
46604968 private MenuItem trimItem;
....@@ -4696,6 +5004,7 @@
46965004 private MenuItem resetCentroidItem;
46975005 private MenuItem transformgeometryItem;
46985006 private MenuItem resetTransformItem;
5007
+ private MenuItem hideItem;
46995008 private MenuItem grabItem;
47005009 private MenuItem backItem;
47015010 private MenuItem frontItem;
....@@ -4716,6 +5025,7 @@
47165025
47175026 private MenuItem resetParentItem;
47185027 private MenuItem repairParentItem;
5028
+ private MenuItem repairShadowItem;
47195029 private MenuItem sortbysizeItem;
47205030 private MenuItem sortbynameItem;
47215031
....@@ -4728,12 +5038,15 @@
47285038 private MenuItem particleItem;
47295039 private MenuItem ragdollItem;
47305040 private MenuItem ragdoll2Item;
5041
+ private MenuItem heightFieldItem;
5042
+ private MenuItem textureFieldItem;
47315043 private MenuItem gridItem;
47325044 private MenuItem rectoidItem;
47335045 private MenuItem ellipsoidItem;
47345046 private MenuItem coneItem;
47355047 private MenuItem torusItem;
47365048 private MenuItem superItem;
5049
+ private MenuItem kleinItem;
47375050 private MenuItem blobItem;
47385051 private MenuItem latheItem;
47395052 private MenuItem bezierItem;
....@@ -4746,6 +5059,7 @@
47465059 private MenuItem csgItem;
47475060 private MenuItem templateItem;
47485061 private MenuItem textureItem;
5062
+ private MenuItem billboardItem;
47495063 private MenuItem shadowXItem;
47505064 private MenuItem shadowYItem;
47515065 private MenuItem shadowZItem;