Normand Briere
2017-05-07 314b34423070cf127464da79a53cddf6b1c38587
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
....@@ -225,10 +225,10 @@
225225 oe.menuBar.add(menu = new Menu("Group"));
226226 grabItem = menu.add(new MenuItem("Grab"));
227227 grabItem.addActionListener(this);
228
- frontItem = menu.add(new MenuItem("Front"));
229
- frontItem.addActionListener(this);
230228 backItem = menu.add(new MenuItem("Back"));
231229 backItem.addActionListener(this);
230
+ frontItem = menu.add(new MenuItem("Front"));
231
+ frontItem.addActionListener(this);
232232 compositeItem = menu.add(new MenuItem("Composite"));
233233 compositeItem.addActionListener(this);
234234 menu.add("-");
....@@ -285,6 +285,8 @@
285285 genNormalsORGANItem.addActionListener(this);
286286 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287287 genNormalsCADItem.addActionListener(this);
288
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289
+ genNormalsMESHItem.addActionListener(this);
288290 stripifyItem = menu.add(new MenuItem("Stripify"));
289291 stripifyItem.addActionListener(this);
290292 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -380,7 +382,7 @@
380382
381383
382384 oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
385
+ importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
384386 importGFDItem.addActionListener(this);
385387 importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386388 importVRMLX3DItem.addActionListener(this);
....@@ -1441,9 +1443,9 @@
14411443
14421444 void Overwrite(int mask)
14431445 {
1444
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1446
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
14451447 {
1446
- Object3D content = GraphreeD.clipboard.get(0);
1448
+ Object3D content = GrafreeD.clipboard.get(0);
14471449
14481450 if (content instanceof cGroup && ((cGroup)content).transientlink )
14491451 content = ((cGroup)content).get(0);
....@@ -1778,7 +1780,7 @@
17781780 if (event.getSource() == invariantsItem)
17791781 {
17801782 System.out.println("Invariants:");
1781
- GraphreeD.theApplet3D.universe.invariants();
1783
+ GrafreeD.theApplet3D.universe.invariants();
17821784 } else
17831785 if (event.getSource() == memoryItem)
17841786 {
....@@ -1848,10 +1850,10 @@
18481850 } else
18491851 if (event.getSource() == duplicateItem)
18501852 {
1851
- Object3D keep = GraphreeD.clipboard;
1853
+ Object3D keep = GrafreeD.clipboard;
18521854 loadClipboard(false);
18531855 paste(false);
1854
- GraphreeD.clipboard = keep;
1856
+ GrafreeD.clipboard = keep;
18551857 } else
18561858 if (event.getSource() == cloneItem)
18571859 {
....@@ -1895,8 +1897,9 @@
18951897 } else
18961898 if (event.getSource() == overwriteMatItem)
18971899 {
1900
+ /* july 2015
18981901 if ((dropAttributes & Object3D.TEXTURE) == 0)
1899
- Overwrite(Object3D.MATERIAL);
1902
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
19001903 else
19011904 {
19021905 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1908,13 +1911,16 @@
19081911 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
19091912 }
19101913 }
1914
+ */
1915
+
1916
+ Overwrite(dropAttributes);
19111917 }
19121918 if (event.getSource() == overwriteGeoItem)
19131919 {
19141920 Overwrite(Object3D.GEOMETRY);
1915
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1921
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
19161922 // {
1917
-// Object3D content = GraphreeD.clipboard.get(0);
1923
+// Object3D content = GrafreeD.clipboard.get(0);
19181924 //
19191925 // if (content instanceof cGroup && ((cGroup)content).transientlink )
19201926 // content = ((cGroup)content).get(0);
....@@ -2047,9 +2053,9 @@
20472053 } else
20482054 if (event.getSource() == linkverticesItem)
20492055 {
2050
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2056
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20512057 // {
2052
-// Object3D content = GraphreeD.clipboard.get(0);
2058
+// Object3D content = GrafreeD.clipboard.get(0);
20532059 //
20542060 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20552061 // content = ((cGroup)content).get(0);
....@@ -2058,9 +2064,9 @@
20582064 // group.selection.get(0).setMasterThis(content); // should be identity
20592065 // refreshContents();
20602066 // }
2061
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2067
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
20622068 {
2063
- Object3D content = GraphreeD.clipboard.get(0);
2069
+ Object3D content = GrafreeD.clipboard.get(0);
20642070
20652071 if (content instanceof cGroup && ((cGroup)content).transientlink )
20662072 content = ((cGroup)content).get(0);
....@@ -2101,9 +2107,9 @@
21012107 } else
21022108 if (event.getSource() == setMasterItem)
21032109 {
2104
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2110
+ if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21052111 {
2106
- Object3D content = GraphreeD.clipboard.get(0);
2112
+ Object3D content = GrafreeD.clipboard.get(0);
21072113
21082114 if (content instanceof cGroup && ((cGroup)content).transientlink )
21092115 content = ((cGroup)content).get(0);
....@@ -2116,9 +2122,9 @@
21162122 {
21172123 if (group.selection.size() == 1)
21182124 {
2119
- if (GraphreeD.clipboard.size() == 1)
2125
+ if (GrafreeD.clipboard.size() == 1)
21202126 {
2121
- Object3D content = GraphreeD.clipboard.get(0);
2127
+ Object3D content = GrafreeD.clipboard.get(0);
21222128
21232129 if (content instanceof cGroup && ((cGroup)content).transientlink )
21242130 content = ((cGroup)content).get(0);
....@@ -2304,6 +2310,10 @@
23042310 if (event.getSource() == genNormalsCADItem)
23052311 {
23062312 GenNormals(true);
2313
+ } else
2314
+ if (event.getSource() == genNormalsMESHItem)
2315
+ {
2316
+ GenNormals(true); // TODO
23072317 } else
23082318 if (event.getSource() == genNormalsORGANItem)
23092319 {
....@@ -2806,7 +2816,7 @@
28062816 if (event.getSource() == unselectButton)
28072817 {
28082818 objEditor.jTree.clearSelection();
2809
- // ?? oct 2012 GraphreeD.clipboard.clear();
2819
+ // ?? oct 2012 GrafreeD.clipboard.clear();
28102820 objEditor.ResetSliders();
28112821 refreshContents(true);
28122822 } else
....@@ -3121,9 +3131,9 @@
31213131 obj = (Object3D)e.nextElement();
31223132
31233133 System.out.println("Object is: " + obj);
3124
- GraphreeD.AnalyzeObject(obj);
3134
+ GrafreeD.AnalyzeObject(obj);
31253135 System.out.println("Boundary rep: " + obj.bRep);
3126
- GraphreeD.AnalyzeObject(obj.bRep);
3136
+ GrafreeD.AnalyzeObject(obj.bRep);
31273137
31283138 // System.err.println((size/1024) + " KB is the size of " + obj);
31293139 }
....@@ -3250,7 +3260,7 @@
32503260 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
32513261 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32523262 //
3253
-// g.add(GraphreeD.clipboard);
3263
+// g.add(GrafreeD.clipboard);
32543264 //
32553265 // buffer.add(g);
32563266 // }
....@@ -3269,8 +3279,8 @@
32693279 // nodes = new Object3D();
32703280 // vertices = new Vector<Vertex>();
32713281 //
3272
-// boolean epsequal = GraphreeD.epsequal;
3273
-// GraphreeD.epsequal = true;
3282
+// boolean epsequal = GrafreeD.epsequal;
3283
+// GrafreeD.epsequal = true;
32743284 //
32753285 // for (int i=0; i<group.selection.size(); i++)
32763286 // {
....@@ -3311,7 +3321,7 @@
33113321 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33123322 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33133323 //
3314
-// g.add(GraphreeD.clipboard);
3324
+// g.add(GrafreeD.clipboard);
33153325 //
33163326 // buffer.add(g);
33173327 // }
....@@ -3319,7 +3329,7 @@
33193329 // makeSomething(buffer, i==group.selection.size()-1);
33203330 // }
33213331 //
3322
-// GraphreeD.epsequal = epsequal;
3332
+// GrafreeD.epsequal = epsequal;
33233333 //
33243334 // //buffer = null;
33253335 // temprep = null;
....@@ -3330,8 +3340,8 @@
33303340
33313341 void ParseVertices()
33323342 {
3333
- boolean epsequal = GraphreeD.epsequal;
3334
- GraphreeD.epsequal = true;
3343
+ boolean epsequal = GrafreeD.epsequal;
3344
+ GrafreeD.epsequal = true;
33353345
33363346 for (int i=0; i<group.selection.size(); i++)
33373347 {
....@@ -3356,7 +3366,7 @@
33563366 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33573367 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33583368
3359
- g.add(GraphreeD.clipboard);
3369
+ g.add(GrafreeD.clipboard);
33603370
33613371 buffer.add(g);
33623372 }
....@@ -3371,7 +3381,7 @@
33713381 makeSomething(buffer, i==group.selection.size()-1);
33723382 }
33733383
3374
- GraphreeD.epsequal = epsequal;
3384
+ GrafreeD.epsequal = epsequal;
33753385
33763386 refreshContents();
33773387 }
....@@ -3416,7 +3426,7 @@
34163426 scale /= 3;
34173427
34183428 scale /= 0xFF;
3419
- scale /= 4;
3429
+ // c'est quoi ca? scale /= 4;
34203430
34213431 //v.AO = scale;
34223432
....@@ -3455,7 +3465,7 @@
34553465 // ref.SaveSupports();
34563466 // Object3D par = ref.parent;
34573467 // ref.parent = null;
3458
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3468
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
34593469 // ref.parent = par;
34603470 // ref.RestoreSupports();
34613471
....@@ -3485,7 +3495,7 @@
34853495 // lowres.SaveSupports();
34863496 // par = lowres.parent;
34873497 // lowres.parent = null;
3488
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3498
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
34893499 Object3D newlow = CloneObject(lowres, false);
34903500 newlow.name = sn.switchobject.get(i).name;
34913501 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3507,7 +3517,7 @@
35073517 return;
35083518
35093519 Object3D poses = group.selection.get(0);
3510
- Object3D ref = GraphreeD.clipboard.get(0);
3520
+ Object3D ref = GrafreeD.clipboard.get(0);
35113521
35123522 Object3D newgroup = new Object3D("Po:" + poses.name);
35133523
....@@ -3701,20 +3711,20 @@
37013711
37023712 void ClipMesh()
37033713 {
3704
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3714
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
37053715 {
3706
- Object3D content = GraphreeD.clipboard.get(0);
3716
+ Object3D content = GrafreeD.clipboard.get(0);
37073717
37083718 if (content instanceof cGroup && ((cGroup)content).transientlink )
37093719 content = ((cGroup)content).get(0);
37103720
37113721 // for (int i=0; i<group.selection.size(); i++)
37123722 // {
3713
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
3723
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37143724 // }
3715
- group.selection.ClipMesh(GraphreeD.clipboard);
3725
+ group.selection.ClipMesh(GrafreeD.clipboard);
37163726 }
3717
-// group.selection.ClipMesh(GraphreeD.clipboard);
3727
+// group.selection.ClipMesh(GrafreeD.clipboard);
37183728 System.out.println("DONE.");
37193729 refreshContents();
37203730 }
....@@ -4052,12 +4062,12 @@
40524062 {
40534063 if (group.selection.isEmpty())
40544064 return;
4055
- GraphreeD.clipboardIsTempGroup = false;
4065
+ GrafreeD.clipboardIsTempGroup = false;
40564066 Composite tGroup = null;
40574067 if (group.selection.size() > 0) // 1)
40584068 {
40594069 tGroup = new cGroup();
4060
- GraphreeD.clipboardIsTempGroup = true;
4070
+ GrafreeD.clipboardIsTempGroup = true;
40614071 }
40624072
40634073 if (cut)
....@@ -4097,16 +4107,16 @@
40974107 //System.out.println("cut " + child);
40984108 //System.out.println("parent = " + child.parent);
40994109 // tmp.addChild(child);
4100
- if (GraphreeD.clipboardIsTempGroup)
4110
+ if (GrafreeD.clipboardIsTempGroup)
41014111 tGroup.add/*Child*/(tmp);
41024112 else
4103
- GraphreeD.clipboard = tmp;
4113
+ GrafreeD.clipboard = tmp;
41044114 }
41054115 else
4106
- if (GraphreeD.clipboardIsTempGroup)
4116
+ if (GrafreeD.clipboardIsTempGroup)
41074117 tGroup.add/*Child*/(child);
41084118 else
4109
- GraphreeD.clipboard = child;
4119
+ GrafreeD.clipboard = child;
41104120 }
41114121
41124122 //ResetModel();
....@@ -4138,21 +4148,21 @@
41384148 //System.out.println("cut " + elem);
41394149 //System.out.println("parent = " + elem.parent);
41404150 // tmp.addChild(elem);
4141
- if (GraphreeD.clipboardIsTempGroup)
4151
+ if (GrafreeD.clipboardIsTempGroup)
41424152 tGroup.add/*Child*/(tmp);
41434153 else
4144
- GraphreeD.clipboard = tmp;
4154
+ GrafreeD.clipboard = tmp;
41454155 }
41464156 else
4147
- if (GraphreeD.clipboardIsTempGroup)
4157
+ if (GrafreeD.clipboardIsTempGroup)
41484158 tGroup.add/*Child*/(child);
41494159 else
4150
- GraphreeD.clipboard = child;
4160
+ GrafreeD.clipboard = child;
41514161 }
41524162
41534163 }
4154
- if (GraphreeD.clipboardIsTempGroup)
4155
- GraphreeD.clipboard = tGroup;
4164
+ if (GrafreeD.clipboardIsTempGroup)
4165
+ GrafreeD.clipboard = tGroup;
41564166 if (cut)
41574167 {
41584168 ResetModel();
....@@ -4162,11 +4172,11 @@
41624172
41634173 void paste(boolean expand)
41644174 {
4165
- // if (GraphreeD.clipboard == null)
4175
+ // if (GrafreeD.clipboard == null)
41664176 // return;
41674177 boolean first = true;
41684178
4169
- if (GraphreeD.clipboardIsTempGroup)
4179
+ if (GrafreeD.clipboardIsTempGroup)
41704180 {
41714181 Composite temp;
41724182
....@@ -4177,7 +4187,7 @@
41774187 temp = (Composite)Applet3D.clipboard.deepCopy();
41784188 */
41794189 Object3D elem;
4180
- 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))
41814191 {
41824192 Object3D child = (Object3D)e.nextElement();
41834193
....@@ -4191,7 +4201,7 @@
41914201 else
41924202 elem = child.deepCopy(); // ?
41934203 child.parent = keepparent;
4194
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4204
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
41954205 // elem = elem.get(0);
41964206 makeSomething(elem, true); // ?? first);
41974207 //group.addChild(elem);
....@@ -4211,14 +4221,14 @@
42114221 //Object3D cb = Applet3D.clipboard;
42124222 //temp.addChild(cb);
42134223 //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());
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());
42194229 else
4220
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4221
- GraphreeD.clipboard.get(0).parent = keepparent;
4230
+ makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
+ GrafreeD.clipboard.get(0).parent = keepparent;
42224232 }
42234233
42244234 ResetModel();
....@@ -4227,7 +4237,7 @@
42274237
42284238 void pasteInto(boolean copyit)
42294239 {
4230
-// if (GraphreeD.clipboard == null)
4240
+// if (GrafreeD.clipboard == null)
42314241 // return;
42324242
42334243 if (group.selection.size() != 1)
....@@ -4260,9 +4270,9 @@
42604270 {
42614271 boolean first = true;
42624272
4263
- if (GraphreeD.clipboardIsTempGroup)
4273
+ if (GrafreeD.clipboardIsTempGroup)
42644274 {
4265
- Composite temp = (Composite)GraphreeD.clipboard;
4275
+ Composite temp = (Composite)GrafreeD.clipboard;
42664276 Object3D copy;
42674277 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42684278 {
....@@ -4272,7 +4282,7 @@
42724282 }
42734283 } else
42744284 {
4275
- linkSomething(GraphreeD.clipboard); //.get(0));
4285
+ linkSomething(GrafreeD.clipboard); //.get(0));
42764286 }
42774287 }
42784288 }
....@@ -4659,7 +4669,7 @@
46594669
46604670 void ImportGFD()
46614671 {
4662
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4672
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
46634673 browser.show();
46644674 String filename = browser.getFile();
46654675 if (filename != null && filename.length() > 0)
....@@ -4697,7 +4707,7 @@
46974707
46984708 void ImportVRMLX3D()
46994709 {
4700
- if (GraphreeD.standAlone)
4710
+ if (GrafreeD.standAlone)
47014711 {
47024712 /**/
47034713 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4714,7 +4724,7 @@
47144724
47154725 String GetFile(String dialogName)
47164726 {
4717
- if (GraphreeD.standAlone)
4727
+ if (GrafreeD.standAlone)
47184728 {
47194729 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47204730 browser.show();
....@@ -4841,6 +4851,7 @@
48414851 private MenuItem clearItem;
48424852 private MenuItem clearAllItem;
48434853 private MenuItem genUVItem;
4854
+ private MenuItem genNormalsMESHItem;
48444855 private MenuItem genNormalsCADItem;
48454856 private MenuItem genNormalsORGANItem;
48464857 private MenuItem stripifyItem;