Normand Briere
2018-07-01 89c1ad67bc65d24ceadfa9e95f8c5515283f1e97
GroupEditor.java
....@@ -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
....@@ -219,18 +219,24 @@
219219 resetsupportItem.addActionListener(this);
220220 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221221 linkverticesItem.addActionListener(this);
222
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223
+ relinkverticesItem.addActionListener(this);
222224 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223225 setMasterItem.addActionListener(this);
224226
225227 oe.menuBar.add(menu = new Menu("Group"));
226228 grabItem = menu.add(new MenuItem("Grab"));
227229 grabItem.addActionListener(this);
228
- frontItem = menu.add(new MenuItem("Front"));
229
- frontItem.addActionListener(this);
230230 backItem = menu.add(new MenuItem("Back"));
231231 backItem.addActionListener(this);
232
+ frontItem = menu.add(new MenuItem("Front"));
233
+ frontItem.addActionListener(this);
232234 compositeItem = menu.add(new MenuItem("Composite"));
233235 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);
234240 menu.add("-");
235241 randomItem = menu.add(new MenuItem("Random"));
236242 randomItem.addActionListener(this);
....@@ -252,6 +258,8 @@
252258 oe.menuBar.add(menu = new Menu("Object"));
253259 textureItem = menu.add(new MenuItem("Texture"));
254260 textureItem.addActionListener(this);
261
+ billboardItem = menu.add(new MenuItem("Billboard"));
262
+ billboardItem.addActionListener(this);
255263 csgItem = menu.add(new MenuItem("CSG"));
256264 csgItem.addActionListener(this);
257265 shadowXItem = menu.add(new MenuItem("Shadow X"));
....@@ -269,14 +277,12 @@
269277 pointflowItem = menu.add(new MenuItem("Point Flow"));
270278 pointflowItem.addActionListener(this);
271279 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274280 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275281 resetTransformItem.addActionListener(this);
276282 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277283 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
284
+ transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
+ transformgeometryItem.addActionListener(this);
280286
281287 oe.menuBar.add(menu = new Menu("Geometry"));
282288 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +291,10 @@
285291 genNormalsORGANItem.addActionListener(this);
286292 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287293 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);
288298 stripifyItem = menu.add(new MenuItem("Stripify"));
289299 stripifyItem.addActionListener(this);
290300 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -380,7 +390,7 @@
380390
381391
382392 oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
393
+ importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
384394 importGFDItem.addActionListener(this);
385395 importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386396 importVRMLX3DItem.addActionListener(this);
....@@ -1033,6 +1043,8 @@
10331043 torusItem.addActionListener(this);
10341044 superItem = menu.add(new MenuItem("Superellipsoid"));
10351045 superItem.addActionListener(this);
1046
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1047
+ kleinItem.addActionListener(this);
10361048 particleItem = menu.add(new MenuItem("Particle system"));
10371049 particleItem.addActionListener(this);
10381050 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1441,9 +1453,9 @@
14411453
14421454 void Overwrite(int mask)
14431455 {
1444
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1456
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
14451457 {
1446
- Object3D content = GraphreeD.clipboard.get(0);
1458
+ Object3D content = GrafreeD.clipboard.get(0);
14471459
14481460 if (content instanceof cGroup && ((cGroup)content).transientlink )
14491461 content = ((cGroup)content).get(0);
....@@ -1592,6 +1604,10 @@
15921604 if (event.getSource() == superItem)
15931605 {
15941606 makeSomething(new Superellipsoid());
1607
+ } else
1608
+ if (event.getSource() == kleinItem)
1609
+ {
1610
+ makeSomething(new Klein());
15951611 } else
15961612 if (event.getSource() == blobItem)
15971613 {
....@@ -1778,7 +1794,7 @@
17781794 if (event.getSource() == invariantsItem)
17791795 {
17801796 System.out.println("Invariants:");
1781
- GraphreeD.theApplet3D.universe.invariants();
1797
+ GrafreeD.theApplet3D.universe.invariants();
17821798 } else
17831799 if (event.getSource() == memoryItem)
17841800 {
....@@ -1848,10 +1864,10 @@
18481864 } else
18491865 if (event.getSource() == duplicateItem)
18501866 {
1851
- Object3D keep = GraphreeD.clipboard;
1867
+ Object3D keep = GrafreeD.clipboard;
18521868 loadClipboard(false);
18531869 paste(false);
1854
- GraphreeD.clipboard = keep;
1870
+ GrafreeD.clipboard = keep;
18551871 } else
18561872 if (event.getSource() == cloneItem)
18571873 {
....@@ -1895,8 +1911,9 @@
18951911 } else
18961912 if (event.getSource() == overwriteMatItem)
18971913 {
1914
+ /* july 2015
18981915 if ((dropAttributes & Object3D.TEXTURE) == 0)
1899
- Overwrite(Object3D.MATERIAL);
1916
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
19001917 else
19011918 {
19021919 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1908,13 +1925,16 @@
19081925 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
19091926 }
19101927 }
1928
+ */
1929
+
1930
+ Overwrite(dropAttributes);
19111931 }
19121932 if (event.getSource() == overwriteGeoItem)
19131933 {
19141934 Overwrite(Object3D.GEOMETRY);
1915
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1935
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
19161936 // {
1917
-// Object3D content = GraphreeD.clipboard.get(0);
1937
+// Object3D content = GrafreeD.clipboard.get(0);
19181938 //
19191939 // if (content instanceof cGroup && ((cGroup)content).transientlink )
19201940 // content = ((cGroup)content).get(0);
....@@ -1997,23 +2017,28 @@
19972017 if (group.selection.size() == 1)
19982018 one = true;
19992019
2020
+ Object3D merge = null;
2021
+
20002022 Object3D content = new cGroup();
20012023
20022024 for (int i=0; i<group.selection.size(); i++)
20032025 {
2004
- Object3D sel = new Merge(group.selection.get(i));
2026
+ merge = new Merge(group.selection.get(i));
20052027
20062028 if (one)
2007
- makeSomething(sel, false);
2029
+ makeSomething(merge, false);
20082030 else
2009
- content.addChild(sel);
2031
+ content.addChild(merge);
20102032 }
20112033
20122034 if (!one)
2013
- makeSomething(content, false);
2014
-
2015
- ResetModel();
2016
- refreshContents();
2035
+ makeSomething(content, true);
2036
+ else
2037
+ {
2038
+ ResetModel();
2039
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2040
+ refreshContents();
2041
+ }
20172042 } else
20182043 if (event.getSource() == mergeGeometriesItem)
20192044 {
....@@ -2047,9 +2072,9 @@
20472072 } else
20482073 if (event.getSource() == linkverticesItem)
20492074 {
2050
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2075
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20512076 // {
2052
-// Object3D content = GraphreeD.clipboard.get(0);
2077
+// Object3D content = GrafreeD.clipboard.get(0);
20532078 //
20542079 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20552080 // content = ((cGroup)content).get(0);
....@@ -2058,9 +2083,9 @@
20582083 // group.selection.get(0).setMasterThis(content); // should be identity
20592084 // refreshContents();
20602085 // }
2061
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2086
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
20622087 {
2063
- Object3D content = GraphreeD.clipboard.get(0);
2088
+ Object3D content = GrafreeD.clipboard.get(0);
20642089
20652090 if (content instanceof cGroup && ((cGroup)content).transientlink )
20662091 content = ((cGroup)content).get(0);
....@@ -2090,6 +2115,15 @@
20902115
20912116 refreshContents();
20922117 } else
2118
+ if (event.getSource() == relinkverticesItem)
2119
+ {
2120
+ boolean random = CameraPane.RANDOM;
2121
+ CameraPane.RANDOM = false; // parse all random nodes
2122
+ group.selection.RelinkToSupport();
2123
+ CameraPane.RANDOM = random;
2124
+
2125
+ refreshContents();
2126
+ } else
20932127 if (event.getSource() == resetreferencesItem)
20942128 {
20952129 for (int i=0; i<group.selection.size(); i++)
....@@ -2101,9 +2135,9 @@
21012135 } else
21022136 if (event.getSource() == setMasterItem)
21032137 {
2104
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2138
+ if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21052139 {
2106
- Object3D content = GraphreeD.clipboard.get(0);
2140
+ Object3D content = GrafreeD.clipboard.get(0);
21072141
21082142 if (content instanceof cGroup && ((cGroup)content).transientlink )
21092143 content = ((cGroup)content).get(0);
....@@ -2116,9 +2150,9 @@
21162150 {
21172151 if (group.selection.size() == 1)
21182152 {
2119
- if (GraphreeD.clipboard.size() == 1)
2153
+ if (GrafreeD.clipboard.size() == 1)
21202154 {
2121
- Object3D content = GraphreeD.clipboard.get(0);
2155
+ Object3D content = GrafreeD.clipboard.get(0);
21222156
21232157 if (content instanceof cGroup && ((cGroup)content).transientlink )
21242158 content = ((cGroup)content).get(0);
....@@ -2158,6 +2192,10 @@
21582192 if (event.getSource() == grabItem)
21592193 {
21602194 group(new cGroup(), true);
2195
+ } else
2196
+ if (event.getSource() == hideItem)
2197
+ {
2198
+ group(new HiddenObject());
21612199 } else
21622200 if (event.getSource() == frontItem)
21632201 {
....@@ -2281,6 +2319,10 @@
22812319 {
22822320 group(new TextureNode());
22832321 } else
2322
+ if (event.getSource() == billboardItem)
2323
+ {
2324
+ group(new BillboardNode());
2325
+ } else
22842326 if (event.getSource() == shadowXItem)
22852327 {
22862328 CastShadow(0);
....@@ -2295,7 +2337,15 @@
22952337 } else
22962338 if (event.getSource() == ungroupItem)
22972339 {
2298
- ungroup();
2340
+ //ungroup();
2341
+ for (int i=0; i<group.selection.size(); i++)
2342
+ {
2343
+ Ungroup(group.selection.get(i));
2344
+ }
2345
+
2346
+ ClearSelection(false);
2347
+
2348
+ refreshContents();
22992349 } else
23002350 if (event.getSource() == genUVItem)
23012351 {
....@@ -2305,9 +2355,17 @@
23052355 {
23062356 GenNormals(true);
23072357 } else
2358
+ if (event.getSource() == genNormalsMESHItem)
2359
+ {
2360
+ GenNormals(true); // TODO
2361
+ } else
23082362 if (event.getSource() == genNormalsORGANItem)
23092363 {
23102364 GenNormals(false);
2365
+ } else
2366
+ if (event.getSource() == genNormalsMINEItem)
2367
+ {
2368
+ GenNormalsMINE();
23112369 } else
23122370 if (event.getSource() == stripifyItem)
23132371 {
....@@ -2806,7 +2864,7 @@
28062864 if (event.getSource() == unselectButton)
28072865 {
28082866 objEditor.jTree.clearSelection();
2809
- // ?? oct 2012 GraphreeD.clipboard.clear();
2867
+ // ?? oct 2012 GrafreeD.clipboard.clear();
28102868 objEditor.ResetSliders();
28112869 refreshContents(true);
28122870 } else
....@@ -3121,9 +3179,9 @@
31213179 obj = (Object3D)e.nextElement();
31223180
31233181 System.out.println("Object is: " + obj);
3124
- GraphreeD.AnalyzeObject(obj);
3182
+ GrafreeD.AnalyzeObject(obj);
31253183 System.out.println("Boundary rep: " + obj.bRep);
3126
- GraphreeD.AnalyzeObject(obj.bRep);
3184
+ GrafreeD.AnalyzeObject(obj.bRep);
31273185
31283186 // System.err.println((size/1024) + " KB is the size of " + obj);
31293187 }
....@@ -3165,6 +3223,13 @@
31653223 void GenNormals(boolean crease)
31663224 {
31673225 group.GenNormalsS(crease);
3226
+
3227
+ refreshContents();
3228
+ }
3229
+
3230
+ void GenNormalsMINE()
3231
+ {
3232
+ group.selection.GenNormalsMINE();
31683233
31693234 refreshContents();
31703235 }
....@@ -3250,7 +3315,7 @@
32503315 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
32513316 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32523317 //
3253
-// g.add(GraphreeD.clipboard);
3318
+// g.add(GrafreeD.clipboard);
32543319 //
32553320 // buffer.add(g);
32563321 // }
....@@ -3269,8 +3334,8 @@
32693334 // nodes = new Object3D();
32703335 // vertices = new Vector<Vertex>();
32713336 //
3272
-// boolean epsequal = GraphreeD.epsequal;
3273
-// GraphreeD.epsequal = true;
3337
+// boolean epsequal = GrafreeD.epsequal;
3338
+// GrafreeD.epsequal = true;
32743339 //
32753340 // for (int i=0; i<group.selection.size(); i++)
32763341 // {
....@@ -3311,7 +3376,7 @@
33113376 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33123377 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33133378 //
3314
-// g.add(GraphreeD.clipboard);
3379
+// g.add(GrafreeD.clipboard);
33153380 //
33163381 // buffer.add(g);
33173382 // }
....@@ -3319,7 +3384,7 @@
33193384 // makeSomething(buffer, i==group.selection.size()-1);
33203385 // }
33213386 //
3322
-// GraphreeD.epsequal = epsequal;
3387
+// GrafreeD.epsequal = epsequal;
33233388 //
33243389 // //buffer = null;
33253390 // temprep = null;
....@@ -3330,8 +3395,8 @@
33303395
33313396 void ParseVertices()
33323397 {
3333
- boolean epsequal = GraphreeD.epsequal;
3334
- GraphreeD.epsequal = true;
3398
+ boolean epsequal = GrafreeD.epsequal;
3399
+ GrafreeD.epsequal = true;
33353400
33363401 for (int i=0; i<group.selection.size(); i++)
33373402 {
....@@ -3356,7 +3421,7 @@
33563421 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33573422 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33583423
3359
- g.add(GraphreeD.clipboard);
3424
+ g.add(GrafreeD.clipboard);
33603425
33613426 buffer.add(g);
33623427 }
....@@ -3371,7 +3436,7 @@
33713436 makeSomething(buffer, i==group.selection.size()-1);
33723437 }
33733438
3374
- GraphreeD.epsequal = epsequal;
3439
+ GrafreeD.epsequal = epsequal;
33753440
33763441 refreshContents();
33773442 }
....@@ -3416,7 +3481,7 @@
34163481 scale /= 3;
34173482
34183483 scale /= 0xFF;
3419
- scale /= 4;
3484
+ // c'est quoi ca? scale /= 4;
34203485
34213486 //v.AO = scale;
34223487
....@@ -3437,12 +3502,26 @@
34373502
34383503 void Align()
34393504 {
3505
+ if (group.selection.size() == 0)
3506
+ return;
3507
+
3508
+ cVector bbmin = new cVector();
3509
+ cVector bbmax = new cVector();
3510
+
3511
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3512
+
3513
+ double dx = bbmax.x - bbmin.x;
3514
+ double dy = bbmax.y - bbmin.y;
3515
+ double dz = bbmax.z - bbmin.z;
3516
+
3517
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3518
+
34403519 for (int i=0; i<group.selection.size(); i++)
34413520 {
34423521 Object3D obj = group.selection.get(i);
34433522
3444
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3445
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3523
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3524
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34463525 }
34473526
34483527 refreshContents();
....@@ -3455,7 +3534,7 @@
34553534 // ref.SaveSupports();
34563535 // Object3D par = ref.parent;
34573536 // ref.parent = null;
3458
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3537
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
34593538 // ref.parent = par;
34603539 // ref.RestoreSupports();
34613540
....@@ -3485,7 +3564,7 @@
34853564 // lowres.SaveSupports();
34863565 // par = lowres.parent;
34873566 // lowres.parent = null;
3488
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3567
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
34893568 Object3D newlow = CloneObject(lowres, false);
34903569 newlow.name = sn.switchobject.get(i).name;
34913570 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3507,7 +3586,7 @@
35073586 return;
35083587
35093588 Object3D poses = group.selection.get(0);
3510
- Object3D ref = GraphreeD.clipboard.get(0);
3589
+ Object3D ref = GrafreeD.clipboard.get(0);
35113590
35123591 Object3D newgroup = new Object3D("Po:" + poses.name);
35133592
....@@ -3701,20 +3780,20 @@
37013780
37023781 void ClipMesh()
37033782 {
3704
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3783
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
37053784 {
3706
- Object3D content = GraphreeD.clipboard.get(0);
3785
+ Object3D content = GrafreeD.clipboard.get(0);
37073786
37083787 if (content instanceof cGroup && ((cGroup)content).transientlink )
37093788 content = ((cGroup)content).get(0);
37103789
37113790 // for (int i=0; i<group.selection.size(); i++)
37123791 // {
3713
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
3792
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37143793 // }
3715
- group.selection.ClipMesh(GraphreeD.clipboard);
3794
+ group.selection.ClipMesh(GrafreeD.clipboard);
37163795 }
3717
-// group.selection.ClipMesh(GraphreeD.clipboard);
3796
+// group.selection.ClipMesh(GrafreeD.clipboard);
37183797 System.out.println("DONE.");
37193798 refreshContents();
37203799 }
....@@ -4052,12 +4131,12 @@
40524131 {
40534132 if (group.selection.isEmpty())
40544133 return;
4055
- GraphreeD.clipboardIsTempGroup = false;
4134
+ GrafreeD.clipboardIsTempGroup = false;
40564135 Composite tGroup = null;
40574136 if (group.selection.size() > 0) // 1)
40584137 {
40594138 tGroup = new cGroup();
4060
- GraphreeD.clipboardIsTempGroup = true;
4139
+ GrafreeD.clipboardIsTempGroup = true;
40614140 }
40624141
40634142 if (cut)
....@@ -4097,16 +4176,16 @@
40974176 //System.out.println("cut " + child);
40984177 //System.out.println("parent = " + child.parent);
40994178 // tmp.addChild(child);
4100
- if (GraphreeD.clipboardIsTempGroup)
4179
+ if (GrafreeD.clipboardIsTempGroup)
41014180 tGroup.add/*Child*/(tmp);
41024181 else
4103
- GraphreeD.clipboard = tmp;
4182
+ GrafreeD.clipboard = tmp;
41044183 }
41054184 else
4106
- if (GraphreeD.clipboardIsTempGroup)
4185
+ if (GrafreeD.clipboardIsTempGroup)
41074186 tGroup.add/*Child*/(child);
41084187 else
4109
- GraphreeD.clipboard = child;
4188
+ GrafreeD.clipboard = child;
41104189 }
41114190
41124191 //ResetModel();
....@@ -4138,21 +4217,21 @@
41384217 //System.out.println("cut " + elem);
41394218 //System.out.println("parent = " + elem.parent);
41404219 // tmp.addChild(elem);
4141
- if (GraphreeD.clipboardIsTempGroup)
4220
+ if (GrafreeD.clipboardIsTempGroup)
41424221 tGroup.add/*Child*/(tmp);
41434222 else
4144
- GraphreeD.clipboard = tmp;
4223
+ GrafreeD.clipboard = tmp;
41454224 }
41464225 else
4147
- if (GraphreeD.clipboardIsTempGroup)
4226
+ if (GrafreeD.clipboardIsTempGroup)
41484227 tGroup.add/*Child*/(child);
41494228 else
4150
- GraphreeD.clipboard = child;
4229
+ GrafreeD.clipboard = child;
41514230 }
41524231
41534232 }
4154
- if (GraphreeD.clipboardIsTempGroup)
4155
- GraphreeD.clipboard = tGroup;
4233
+ if (GrafreeD.clipboardIsTempGroup)
4234
+ GrafreeD.clipboard = tGroup;
41564235 if (cut)
41574236 {
41584237 ResetModel();
....@@ -4162,11 +4241,11 @@
41624241
41634242 void paste(boolean expand)
41644243 {
4165
- // if (GraphreeD.clipboard == null)
4244
+ // if (GrafreeD.clipboard == null)
41664245 // return;
41674246 boolean first = true;
41684247
4169
- if (GraphreeD.clipboardIsTempGroup)
4248
+ if (GrafreeD.clipboardIsTempGroup)
41704249 {
41714250 Composite temp;
41724251
....@@ -4177,7 +4256,7 @@
41774256 temp = (Composite)Applet3D.clipboard.deepCopy();
41784257 */
41794258 Object3D elem;
4180
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4259
+ for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41814260 {
41824261 Object3D child = (Object3D)e.nextElement();
41834262
....@@ -4191,7 +4270,7 @@
41914270 else
41924271 elem = child.deepCopy(); // ?
41934272 child.parent = keepparent;
4194
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4273
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
41954274 // elem = elem.get(0);
41964275 makeSomething(elem, true); // ?? first);
41974276 //group.addChild(elem);
....@@ -4211,14 +4290,14 @@
42114290 //Object3D cb = Applet3D.clipboard;
42124291 //temp.addChild(cb);
42134292 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4214
- assert(GraphreeD.clipboard.parent == null);
4215
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4216
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4217
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4218
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
4293
+ assert(GrafreeD.clipboard.parent == null);
4294
+ Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4295
+ GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4296
+ if (LA.isIdentity(GrafreeD.clipboard.toParent))
4297
+ makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
42194298 else
4220
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4221
- GraphreeD.clipboard.get(0).parent = keepparent;
4299
+ makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4300
+ GrafreeD.clipboard.get(0).parent = keepparent;
42224301 }
42234302
42244303 ResetModel();
....@@ -4227,7 +4306,7 @@
42274306
42284307 void pasteInto(boolean copyit)
42294308 {
4230
-// if (GraphreeD.clipboard == null)
4309
+// if (GrafreeD.clipboard == null)
42314310 // return;
42324311
42334312 if (group.selection.size() != 1)
....@@ -4260,9 +4339,9 @@
42604339 {
42614340 boolean first = true;
42624341
4263
- if (GraphreeD.clipboardIsTempGroup)
4342
+ if (GrafreeD.clipboardIsTempGroup)
42644343 {
4265
- Composite temp = (Composite)GraphreeD.clipboard;
4344
+ Composite temp = (Composite)GrafreeD.clipboard;
42664345 Object3D copy;
42674346 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42684347 {
....@@ -4272,7 +4351,7 @@
42724351 }
42734352 } else
42744353 {
4275
- linkSomething(GraphreeD.clipboard); //.get(0));
4354
+ linkSomething(GrafreeD.clipboard); //.get(0));
42764355 }
42774356 }
42784357 }
....@@ -4464,6 +4543,26 @@
44644543 makeSomething(csg);
44654544 }
44664545
4546
+ void Ungroup(Object3D g)
4547
+ {
4548
+ if (g instanceof HiddenObject)
4549
+ {
4550
+ HiddenObject h = (HiddenObject) g;
4551
+
4552
+ for (int i=0; i<h.ActualSize(); i++)
4553
+ {
4554
+ objEditor.makeSomething(h.get(i), false);
4555
+ }
4556
+ }
4557
+ else
4558
+ {
4559
+ for (int i=0; i<g.Size(); i++)
4560
+ {
4561
+ objEditor.makeSomething(g.get(i), false);
4562
+ }
4563
+ }
4564
+ }
4565
+
44674566 void ungroup()
44684567 {
44694568 /*
....@@ -4659,7 +4758,7 @@
46594758
46604759 void ImportGFD()
46614760 {
4662
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4761
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
46634762 browser.show();
46644763 String filename = browser.getFile();
46654764 if (filename != null && filename.length() > 0)
....@@ -4697,7 +4796,7 @@
46974796
46984797 void ImportVRMLX3D()
46994798 {
4700
- if (GraphreeD.standAlone)
4799
+ if (GrafreeD.standAlone)
47014800 {
47024801 /**/
47034802 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4714,7 +4813,7 @@
47144813
47154814 String GetFile(String dialogName)
47164815 {
4717
- if (GraphreeD.standAlone)
4816
+ if (GrafreeD.standAlone)
47184817 {
47194818 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47204819 browser.show();
....@@ -4823,6 +4922,7 @@
48234922 private MenuItem resetsupportItem;
48244923 private MenuItem resetreferencesItem;
48254924 private MenuItem linkverticesItem;
4925
+ private MenuItem relinkverticesItem;
48264926 private MenuItem setMasterItem;
48274927 private MenuItem resetMeshItem;
48284928 private MenuItem stepAllItem;
....@@ -4841,8 +4941,10 @@
48414941 private MenuItem clearItem;
48424942 private MenuItem clearAllItem;
48434943 private MenuItem genUVItem;
4944
+ private MenuItem genNormalsMESHItem;
48444945 private MenuItem genNormalsCADItem;
48454946 private MenuItem genNormalsORGANItem;
4947
+ private MenuItem genNormalsMINEItem;
48464948 private MenuItem stripifyItem;
48474949 private MenuItem unstripifyItem;
48484950 private MenuItem trimItem;
....@@ -4884,6 +4986,7 @@
48844986 private MenuItem resetCentroidItem;
48854987 private MenuItem transformgeometryItem;
48864988 private MenuItem resetTransformItem;
4989
+ private MenuItem hideItem;
48874990 private MenuItem grabItem;
48884991 private MenuItem backItem;
48894992 private MenuItem frontItem;
....@@ -4924,6 +5027,7 @@
49245027 private MenuItem coneItem;
49255028 private MenuItem torusItem;
49265029 private MenuItem superItem;
5030
+ private MenuItem kleinItem;
49275031 private MenuItem blobItem;
49285032 private MenuItem latheItem;
49295033 private MenuItem bezierItem;
....@@ -4936,6 +5040,7 @@
49365040 private MenuItem csgItem;
49375041 private MenuItem templateItem;
49385042 private MenuItem textureItem;
5043
+ private MenuItem billboardItem;
49395044 private MenuItem shadowXItem;
49405045 private MenuItem shadowYItem;
49415046 private MenuItem shadowZItem;