Normand Briere
2019-06-16 372b7fd481a476cd659713a4a01bf28bf6760cbe
Object3D.java
....@@ -5,6 +5,7 @@
55 import java.util.Vector;
66
77 import javax.media.j3d.Transform3D;
8
+import javax.media.opengl.GL;
89 import javax.vecmath.Vector3d;
910
1011 import javax.imageio.ImageIO;
....@@ -13,11 +14,20 @@
1314 import //weka.core.
1415 matrix.Matrix;
1516
17
+import java.util.UUID;
18
+
1619 //import net.sourceforge.sizeof.SizeOf;
1720 public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D>
1821 {
1922 //static final long serialVersionUID = -607422624994562685L;
2023 static final long serialVersionUID = 5022536242724664900L;
24
+
25
+ private UUID uuid = UUID.randomUUID();
26
+
27
+ // TEMPORARY for mocap undo
28
+ mocap.reader.BVHReader.BVHResult bvh;
29
+ Object3D skeleton;
30
+ //
2131
2232 ScriptNode scriptnode;
2333
....@@ -99,64 +109,136 @@
99109
100110 // transient boolean reduced; // for morph reduction
101111
102
-transient com.bulletphysics.linearmath.Transform cache; // for fast merge
103
-transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge
112
+ transient com.bulletphysics.linearmath.Transform cache; // for fast merge
113
+ transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge
104114
105
-transient Object3D transientsupport; // for cloning
106
-transient boolean transientlink2master;
115
+ transient Object3D transientsupport; // for cloning
116
+ transient boolean transientlink2master;
107117
108
-void SaveSupports()
109
-{
110
- if (blockloop)
111
- return;
112
-
113
- transientsupport = support;
114
- transientlink2master = link2master;
115
-
116
- support = null;
117
- link2master = false;
118
-
119
- if (bRep != null)
118
+ void SaveSupports()
120119 {
121
- bRep.SaveSupports();
122
- }
123
-
124
- for (int i = 0; i < Size(); i++)
125
- {
126
- Object3D child = (Object3D) get(i);
127
- if (child == null)
128
- continue;
129
- blockloop = true;
130
- child.SaveSupports();
131
- blockloop = false;
132
- }
133
-}
120
+ if (blockloop)
121
+ return;
134122
135
-void RestoreSupports()
136
-{
137
- if (blockloop)
138
- return;
123
+ transientsupport = support;
124
+ transientlink2master = link2master;
139125
140
- support = transientsupport;
141
- link2master = transientlink2master;
142
- transientsupport = null;
143
- transientlink2master = false;
144
-
145
- if (bRep != null)
146
- {
147
- bRep.RestoreSupports();
126
+ support = null;
127
+ link2master = false;
128
+
129
+ if (bRep != null)
130
+ {
131
+ bRep.SaveSupports();
132
+ }
133
+
134
+ for (int i = 0; i < Size(); i++)
135
+ {
136
+ Object3D child = (Object3D) get(i);
137
+ if (child == null)
138
+ continue;
139
+ blockloop = true;
140
+ child.SaveSupports();
141
+ blockloop = false;
142
+ }
148143 }
149
-
150
- for (int i = 0; i < Size(); i++)
144
+
145
+ void RestoreSupports()
151146 {
152
- Object3D child = (Object3D) get(i);
153
- if (child == null)
154
- continue;
155
- blockloop = true;
156
- child.RestoreSupports();
157
- blockloop = false;
147
+ if (blockloop)
148
+ return;
149
+
150
+ support = transientsupport;
151
+ link2master = transientlink2master;
152
+ transientsupport = null;
153
+ transientlink2master = false;
154
+
155
+ if (bRep != null)
156
+ {
157
+ bRep.RestoreSupports();
158
+ }
159
+
160
+ for (int i = 0; i < Size(); i++)
161
+ {
162
+ Object3D child = (Object3D) get(i);
163
+ if (child == null)
164
+ continue;
165
+ blockloop = true;
166
+ child.RestoreSupports();
167
+ blockloop = false;
168
+ }
158169 }
159
-}
170
+
171
+ void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172
+ {
173
+ if (hashtable.containsKey(GetUUID()))
174
+ {
175
+ Object3D o = hashtable.get(GetUUID());
176
+
177
+ Grafreed.Assert(this.bRep == o.bRep);
178
+ if (this.bRep != null)
179
+ assert(this.bRep.support == o.transientrep);
180
+
181
+ return;
182
+ }
183
+
184
+ Object3D o = new Object3D();
185
+
186
+ hashtable.put(GetUUID(), o);
187
+
188
+ for (int i=0; i<Size(); i++)
189
+ {
190
+ get(i).ExtractBigData(hashtable);
191
+ }
192
+
193
+ ExtractBigData(o);
194
+ }
195
+
196
+ void ExtractBigData(Object3D o)
197
+ {
198
+ o.bRep = this.bRep;
199
+ if (this.bRep != null)
200
+ {
201
+ o.transientrep = this.bRep.support;
202
+ o.bRep.support = null;
203
+ }
204
+
205
+ // o.support = this.support;
206
+ // o.fileparent = this.fileparent;
207
+ // if (this.bRep != null)
208
+ // o.bRep = this.bRep.support;
209
+
210
+ this.bRep = null;
211
+ // if (this.bRep != null)
212
+ // this.bRep.support = null;
213
+ // this.support = null;
214
+ // this.fileparent = null;
215
+ }
216
+
217
+ void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
218
+ {
219
+ if (!hashtable.containsKey(GetUUID()))
220
+ return;
221
+
222
+ Object3D o = hashtable.get(GetUUID());
223
+
224
+ RestoreBigData(o);
225
+
226
+ hashtable.remove(GetUUID());
227
+
228
+ for (int i=0; i<Size(); i++)
229
+ {
230
+ get(i).RestoreBigData(hashtable);
231
+ }
232
+ }
233
+
234
+ void RestoreBigData(Object3D o)
235
+ {
236
+ this.bRep = o.bRep;
237
+ if (this.bRep != null)
238
+ this.bRep.support = o.transientrep;
239
+ // this.support = o.support;
240
+ // this.fileparent = o.fileparent;
241
+ }
160242
161243 // MOCAP SUPPORT
162244 double tx,ty,tz,rx,ry,rz;
....@@ -299,6 +381,7 @@
299381 }
300382
301383 boolean live = false;
384
+ boolean dontselect = false;
302385 boolean hide = false;
303386 boolean link2master = false; // performs reset support/master at each frame
304387 boolean marked = false; // animation node
....@@ -430,16 +513,16 @@
430513 {
431514 Object3D copy = this;
432515
433
- Camera parentcam = CameraPane.theRenderer.ManipCamera();
516
+ Camera parentcam = Globals.theRenderer.ManipCamera();
434517
435
- if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[0])
518
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0])
436519 {
437
- parentcam = CameraPane.theRenderer.Cameras()[1];
520
+ parentcam = Globals.theRenderer.Cameras()[1];
438521 }
439522
440
- if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[1])
523
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1])
441524 {
442
- parentcam = CameraPane.theRenderer.Cameras()[0];
525
+ parentcam = Globals.theRenderer.Cameras()[0];
443526 }
444527
445528 if (this == parentcam)
....@@ -447,7 +530,7 @@
447530 //assert(this instanceof Camera);
448531
449532 for (int count = parentcam.GetTransformCount(); --count>=0;)
450
- LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.toParent, CameraPane.theRenderer.TargetLookAt());
533
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt());
451534 }
452535
453536 copy.marked ^= true;
....@@ -467,7 +550,7 @@
467550 //assert(this instanceof Camera);
468551
469552 for (int count = parentcam.GetTransformCount(); --count>=0;)
470
- LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.fromParent, CameraPane.theRenderer.TargetLookAt());
553
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt());
471554 }
472555
473556 copy.Touch(); // display list issue
....@@ -480,12 +563,14 @@
480563 toParent = LA.newMatrix();
481564 fromParent = LA.newMatrix();
482565 }
566
+
483567 if (toParentMarked == null)
484568 {
485569 if (maxcount != 1)
486570 {
487571 new Exception().printStackTrace();
488572 }
573
+
489574 toParentMarked = LA.newMatrix();
490575 fromParentMarked = LA.newMatrix();
491576 }
....@@ -773,7 +858,7 @@
773858 if (step == 0)
774859 step = 1;
775860 if (maxcount == 0)
776
- maxcount = 2048; // 4;
861
+ maxcount = 128; // 2048; // 4;
777862 // if (acceleration == 0)
778863 // acceleration = 10;
779864 if (delay == 0) // serial
....@@ -796,7 +881,7 @@
796881
797882 if (marked && Globals.isLIVE() && live &&
798883 //TEMP21aug2018
799
- Globals.DrawMode() == iCameraPane.SHADOW &&
884
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
800885 currentframe != Globals.framecount)
801886 {
802887 currentframe = Globals.framecount;
....@@ -911,6 +996,11 @@
911996 fromParent = null; // LA.newMatrix();
912997 bRep = null; // new BoundaryRep();
913998
999
+ if (oname != null && oname.equals("LeftHand"))
1000
+ {
1001
+ name = oname;
1002
+ }
1003
+
9141004 /*
9151005 float hue = (float)Math.random();
9161006 Color col;
....@@ -953,7 +1043,7 @@
9531043
9541044 public Object clone()
9551045 {
956
- return GrafreeD.clone(this);
1046
+ return Grafreed.clone(this);
9571047 }
9581048
9591049 Object3D copyExpand()
....@@ -1469,7 +1559,7 @@
14691559 BoundaryRep.SEUIL = other.material.cameralight;
14701560
14711561 // Set default to 0.1
1472
- BoundaryRep.SEUIL /= 2;
1562
+ BoundaryRep.SEUIL /= 4; // 2;
14731563 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14741564 }
14751565
....@@ -1728,7 +1818,7 @@
17281818 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17291819 o.bRep = transientrep;
17301820 if (clone)
1731
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1821
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17321822 o.CreateMaterial();
17331823 o.SetAttributes(this, -1);
17341824 //parent
....@@ -1741,7 +1831,7 @@
17411831 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17421832 o.bRep = bRep;
17431833 if (clone)
1744
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1834
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17451835 o.CreateMaterial();
17461836 //o.overwriteThis(this, -1);
17471837 o.SetAttributes(this, -1);
....@@ -1828,12 +1918,15 @@
18281918 if (obj.name == null)
18291919 continue; // can't be a null one
18301920
1921
+ // Try perfect match first.
18311922 if (n.equals(obj.name))
18321923 {
18331924 theobj = obj;
18341925 count++;
18351926 }
18361927 }
1928
+
1929
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18371930
18381931 if (count != 1)
18391932 for (int i=Size(); --i>=0;)
....@@ -2299,6 +2392,7 @@
22992392 {
23002393 if (newWindow)
23012394 {
2395
+ new Exception().printStackTrace();
23022396 System.exit(0);
23032397 if (parent != null)
23042398 {
....@@ -2475,13 +2569,13 @@
24752569 return retval;
24762570 }
24772571
2478
- void doEditDrag(ClickInfo info)
2572
+ void doEditDrag(ClickInfo info, boolean opposite)
24792573 {
24802574 switch (doSomething)
24812575 {
24822576 case 1: // '\001'
24832577 //super.
2484
- doEditDrag0(info);
2578
+ doEditDrag0(info, opposite);
24852579 break;
24862580
24872581 case 2: // '\002'
....@@ -2494,11 +2588,11 @@
24942588 {
24952589 //sel.hitSomething = childToDrag.hitSomething;
24962590 //childToDrag.doEditDrag(info);
2497
- sel.doEditDrag(info);
2591
+ sel.doEditDrag(info, opposite);
24982592 } else
24992593 {
25002594 //super.
2501
- doEditDrag0(info);
2595
+ doEditDrag0(info, opposite);
25022596 }
25032597 }
25042598 break;
....@@ -2608,6 +2702,18 @@
26082702 void GenNormalsS(boolean crease)
26092703 {
26102704 selection.GenNormals(crease);
2705
+// for (int i=0; i<selection.size(); i++)
2706
+// {
2707
+// Object3D selectee = (Object3D) selection.elementAt(i);
2708
+// selectee.GenNormals(crease);
2709
+// }
2710
+
2711
+ //Touch();
2712
+ }
2713
+
2714
+ void GenNormalsMeshS()
2715
+ {
2716
+ selection.GenNormalsMesh();
26112717 // for (int i=0; i<selection.size(); i++)
26122718 // {
26132719 // Object3D selectee = (Object3D) selection.elementAt(i);
....@@ -2748,6 +2854,24 @@
27482854 if (child == null)
27492855 continue;
27502856 child.GenNormals(crease);
2857
+// Children().release(i);
2858
+ }
2859
+ blockloop = false;
2860
+ }
2861
+
2862
+ void GenNormalsMesh()
2863
+ {
2864
+ if (blockloop)
2865
+ return;
2866
+
2867
+ blockloop = true;
2868
+ GenNormalsMesh0();
2869
+ for (int i = 0; i < Children().Size(); i++)
2870
+ {
2871
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2872
+ if (child == null)
2873
+ continue;
2874
+ child.GenNormalsMesh();
27512875 // Children().release(i);
27522876 }
27532877 blockloop = false;
....@@ -2905,7 +3029,8 @@
29053029 {
29063030 if (bRep != null)
29073031 {
2908
- bRep.GenUV();
3032
+ bRep.GenUV(); //1);
3033
+ //bRep.UnfoldUV();
29093034 Touch();
29103035 }
29113036 }
....@@ -2915,6 +3040,15 @@
29153040 if (bRep != null)
29163041 {
29173042 bRep.GenerateNormals(crease);
3043
+ Touch();
3044
+ }
3045
+ }
3046
+
3047
+ void GenNormalsMesh0()
3048
+ {
3049
+ if (bRep != null)
3050
+ {
3051
+ bRep.GenerateNormalsMesh();
29183052 Touch();
29193053 }
29203054 }
....@@ -2980,6 +3114,33 @@
29803114 blockloop = false;
29813115 }
29823116
3117
+ void TransformChildren()
3118
+ {
3119
+ if (toParent != null)
3120
+ {
3121
+ for (int i=Size(); --i>=0;)
3122
+ {
3123
+ Object3D v = get(i);
3124
+
3125
+ if (v.toParent == null)
3126
+ {
3127
+ v.toParent = LA.newMatrix();
3128
+ v.fromParent = LA.newMatrix();
3129
+ }
3130
+
3131
+// LA.matConcat(v.toParent, toParent, v.toParent);
3132
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3133
+ LA.matConcat(toParent, v.toParent, v.toParent);
3134
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
3135
+ }
3136
+
3137
+ toParent = null; // LA.matIdentity(toParent);
3138
+ fromParent = null; // LA.matIdentity(fromParent);
3139
+
3140
+ Touch();
3141
+ }
3142
+ }
3143
+
29833144 void TransformGeometry()
29843145 {
29853146 Object3D obj = this;
....@@ -3201,9 +3362,11 @@
32013362
32023363 BoundaryRep sup = bRep.support;
32033364 bRep.support = null;
3204
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3365
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32053366 // bRep.SplitInTwo(onlyone); // thread...
3206
- temprep.SplitInTwo(reduction34, onlyone);
3367
+
3368
+ while(temprep.SplitInTwo(reduction34, onlyone));
3369
+
32073370 bRep = temprep;
32083371 bRep.support = sup;
32093372 Touch();
....@@ -3725,7 +3888,7 @@
37253888 if (child == null)
37263889 continue;
37273890
3728
- if (GrafreeD.RENDERME > 0)
3891
+ if (Grafreed.RENDERME > 0)
37293892 {
37303893 if (child instanceof Merge)
37313894 ((Merge)child).renderme();
....@@ -3876,7 +4039,7 @@
38764039 if (child == null)
38774040 continue;
38784041
3879
- if (GrafreeD.RENDERME > 0)
4042
+ if (Grafreed.RENDERME > 0)
38804043 {
38814044 if (child instanceof Merge)
38824045 ((Merge)child).renderme();
....@@ -4071,7 +4234,7 @@
40714234 if (child == null)
40724235 continue;
40734236
4074
- if (GrafreeD.RENDERME > 0)
4237
+ if (Grafreed.RENDERME > 0)
40754238 {
40764239 if (child instanceof Merge)
40774240 ((Merge)child).renderme();
....@@ -4678,7 +4841,7 @@
46784841
46794842 cTreePath SelectLeaf(int indexcount, boolean deselect)
46804843 {
4681
- if (hide)
4844
+ if (hide || dontselect)
46824845 return null;
46834846
46844847 if (count <= 0)
....@@ -4704,7 +4867,7 @@
47044867
47054868 cTreePath Select(int indexcount, boolean deselect)
47064869 {
4707
- if (hide)
4870
+ if (hide || dontselect)
47084871 return null;
47094872
47104873 if (count <= 0)
....@@ -5156,10 +5319,34 @@
51565319
51575320 // System.out.println("Fullname = " + fullname);
51585321
5159
- if (fullname.name.indexOf(":") == -1)
5160
- return fullname.name;
5322
+ // Does not work on Windows due to C:
5323
+// if (fullname.name.indexOf(":") == -1)
5324
+// return fullname.name;
5325
+//
5326
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51615327
5162
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5328
+ String[] split = fullname.name.split(":");
5329
+
5330
+ if (split.length == 0)
5331
+ {
5332
+ return "";
5333
+ }
5334
+
5335
+ if (split.length <= 2)
5336
+ {
5337
+ if (fullname.name.endsWith(":"))
5338
+ {
5339
+ // Windows
5340
+ return fullname.name.substring(0, fullname.name.length()-1);
5341
+ }
5342
+
5343
+ return split[0];
5344
+ }
5345
+
5346
+ // Windows
5347
+ assert(split.length == 4);
5348
+
5349
+ return split[0] + ":" + split[1];
51635350 }
51645351
51655352 static String GetBump(cTexture fullname)
....@@ -5168,10 +5355,38 @@
51685355 return "";
51695356
51705357 // System.out.println("Fullname = " + fullname);
5171
- if (fullname.name.indexOf(":") == -1)
5172
- return "";
5173
-
5174
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5358
+ // Does not work on Windows due to C:
5359
+// if (fullname.name.indexOf(":") == -1)
5360
+// return "";
5361
+//
5362
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5363
+ String[] split = fullname.name.split(":");
5364
+
5365
+ if (split.length == 0)
5366
+ {
5367
+ return "";
5368
+ }
5369
+
5370
+ if (split.length == 1)
5371
+ {
5372
+ return "";
5373
+ }
5374
+
5375
+ if (split.length == 2)
5376
+ {
5377
+ if (fullname.name.endsWith(":"))
5378
+ {
5379
+ // Windows
5380
+ return "";
5381
+ }
5382
+
5383
+ return split[1];
5384
+ }
5385
+
5386
+ // Windows
5387
+ assert(split.length == 4);
5388
+
5389
+ return split[2] + ":" + split[3];
51755390 }
51765391
51775392 String GetPigmentTexture()
....@@ -5245,7 +5460,7 @@
52455460 System.out.print("; textures = " + textures);
52465461 System.out.println("; usedtextures = " + usedtextures);
52475462
5248
- if (GetTextures() == null)
5463
+ if (GetTextures() == null) // What is that??
52495464 GetTextures().name = ":";
52505465
52515466 String texname = tex;
....@@ -5276,6 +5491,43 @@
52765491 child.ResetPigmentTexture();
52775492 blockloop = false;
52785493 }
5494
+ }
5495
+
5496
+ UUID GetUUID()
5497
+ {
5498
+ if (uuid == null)
5499
+ {
5500
+ // Serial
5501
+ uuid = UUID.randomUUID();
5502
+ }
5503
+
5504
+ return uuid;
5505
+ }
5506
+
5507
+ Object3D GetObject(UUID uid)
5508
+ {
5509
+ if (blockloop)
5510
+ return null;
5511
+
5512
+ if (GetUUID().equals(uid))
5513
+ return this;
5514
+
5515
+ int nb = Size();
5516
+ for (int i = 0; i < nb; i++)
5517
+ {
5518
+ Object3D child = (Object3D) get(i);
5519
+
5520
+ if (child == null)
5521
+ continue;
5522
+
5523
+ blockloop = true;
5524
+ Object3D obj = child.GetObject(uid);
5525
+ blockloop = false;
5526
+ if (obj != null)
5527
+ return obj;
5528
+ }
5529
+
5530
+ return null;
52795531 }
52805532
52815533 void SetBumpTexture(String tex)
....@@ -5322,12 +5574,23 @@
53225574 boolean NeedSupport()
53235575 {
53245576 return
5325
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5577
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
53265578 // PROBLEM with CROWD!!
5327
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5579
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53285580 }
53295581
53305582 static boolean DEBUG_SELECTION = false;
5583
+
5584
+ boolean IsLive()
5585
+ {
5586
+ if (live)
5587
+ return true;
5588
+
5589
+ if (parent == null)
5590
+ return false;
5591
+
5592
+ return parent.IsLive();
5593
+ }
53315594
53325595 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53335596 {
....@@ -5339,7 +5602,7 @@
53395602 }
53405603
53415604 if (display.DrawMode() == iCameraPane.SELECTION &&
5342
- hide)
5605
+ (hide || dontselect))
53435606 return;
53445607
53455608 if (name != null && name.contains("sclera"))
....@@ -5371,7 +5634,7 @@
53715634 return;
53725635 }
53735636
5374
- javax.media.opengl.GL gl = display.GetGL();
5637
+ //javax.media.opengl.GL gl = display.GetGL();
53755638
53765639 /*
53775640 if (touched)
....@@ -5390,7 +5653,7 @@
53905653 support = support;
53915654
53925655 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5393
- boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5656
+ boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
53945657
53955658 if (!usecalllists && bRep != null && bRep.displaylist > 0)
53965659 {
....@@ -5423,7 +5686,7 @@
54235686 //if (displaylist == -1 && usecalllists)
54245687 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
54255688 {
5426
- bRep.displaylist = gl.glGenLists(1);
5689
+ bRep.displaylist = display.GenList();
54275690 assert(bRep.displaylist != 0);
54285691 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
54295692 //System.out.println("\tgen list " + list);
....@@ -5435,14 +5698,16 @@
54355698 if (usecalllists)
54365699 {
54375700 // System.err.println("new list " + bRep.displaylist + " for " + this);
5438
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5701
+ display.NewList(bRep.displaylist);
54395702 }
5703
+
54405704 CallList(display, root, selected, blocked);
5705
+
54415706 // compiled = true;
54425707 if (usecalllists)
54435708 {
54445709 // System.err.println("end list " + bRep.displaylist + " for " + this);
5445
- gl.glEndList();
5710
+ display.EndList();
54465711 }
54475712 //gl.glDrawBuffer(gl.GL_BACK);
54485713 // XXX touched = false;
....@@ -5490,7 +5755,7 @@
54905755 if (display.DrawMode() == iCameraPane.SHADOW)
54915756 {
54925757 if (!link2master // tricky to cull in shadow mode.
5493
- && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
5758
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54945759 {
54955760 //System.out.print("CULLED");
54965761 culled = true;
....@@ -5498,7 +5763,7 @@
54985763 }
54995764 else
55005765 //GetBRep().getBounds(v0, v1, this);
5501
- if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
5766
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
55025767 culled = true;
55035768
55045769 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5538,7 +5803,7 @@
55385803 {
55395804 if (GetBRep() != null)
55405805 {
5541
- CameraPane.NextIndex(this, gl);
5806
+ display.NextIndex();
55425807 // vertex color conflict : gl.glCallList(list);
55435808 DrawNode(display, root, selected);
55445809 if (this instanceof BezierPatch)
....@@ -5579,7 +5844,17 @@
55795844 tex = GetTextures();
55805845 }
55815846
5582
- display.BindTextures(tex, texres);
5847
+ boolean failed = false;
5848
+
5849
+ try
5850
+ {
5851
+ display.BindTextures(tex, texres);
5852
+ }
5853
+ catch (Exception e)
5854
+ {
5855
+ System.err.println("FAILED: " + this);
5856
+ failed = true;
5857
+ }
55835858
55845859 if (!compiled)
55855860 {
....@@ -5595,13 +5870,14 @@
55955870
55965871 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
55975872 assert(bRep.displaylist != 0);
5598
- gl.glCallList(bRep.displaylist);
5873
+ display.CallList(bRep.displaylist);
55995874 // june 2013 drawSelf(display, root, selected);
56005875 }
56015876 }
56025877 }
56035878
5604
- display.ReleaseTextures(tex);
5879
+ if (!failed)
5880
+ display.ReleaseTextures(tex);
56055881
56065882 display.PopMaterial(this, selected);
56075883 }
....@@ -5730,6 +6006,9 @@
57306006
57316007 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57326008 {
6009
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6010
+ return;
6011
+
57336012 if (hide)
57346013 return;
57356014 // shadow optimisation
....@@ -5855,6 +6134,9 @@
58556134 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
58566135 return; // no shadow for transparent objects
58576136
6137
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6138
+ return;
6139
+
58586140 if (hide)
58596141 return;
58606142
....@@ -5895,9 +6177,10 @@
58956177 return;
58966178 }
58976179
6180
+ //bRep.GenUV(1/material.diffuseness);
58986181 // bRep.lock = true;
58996182
5900
- javax.media.opengl.GL gl = display.GetGL();
6183
+ //javax.media.opengl.GL gl = display.GetGL();
59016184
59026185 if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59036186 {
....@@ -5914,23 +6197,7 @@
59146197
59156198 bRep.getMinMax(min, max, 100);
59166199
5917
- gl.glBegin(gl.GL_LINES);
5918
-
5919
- gl.glVertex3d(min.x, min.y, min.z);
5920
- gl.glVertex3d(min.x, min.y, max.z);
5921
- gl.glVertex3d(min.x, min.y, min.z);
5922
- gl.glVertex3d(min.x, max.y, min.z);
5923
- gl.glVertex3d(min.x, min.y, min.z);
5924
- gl.glVertex3d(max.x, min.y, min.z);
5925
-
5926
- gl.glVertex3d(max.x, max.y, max.z);
5927
- gl.glVertex3d(min.x, max.y, max.z);
5928
- gl.glVertex3d(max.x, max.y, max.z);
5929
- gl.glVertex3d(max.x, min.y, max.z);
5930
- gl.glVertex3d(max.x, max.y, max.z);
5931
- gl.glVertex3d(max.x, max.y, min.z);
5932
-
5933
- gl.glEnd();
6200
+ display.DrawBox(min, max);
59346201
59356202 return;
59366203 }
....@@ -5984,178 +6251,14 @@
59846251 new Exception().printStackTrace();
59856252 return;
59866253 }
5987
-
5988
- // TRIANGLE STRIP ARRAY
5989
- if (bRep.trimmed)
5990
- {
5991
- float[] v = bRep.getRawVertices();
5992
- float[] n = bRep.getRawNormals();
5993
- float[] c = bRep.getRawColors();
5994
- float[] uv = bRep.getRawUVMap();
5995
-
5996
- int count2 = 0;
5997
- int count3 = 0;
5998
-
5999
- if (n.length > 0)
6000
- {
6001
- for (int i = 0; i < strips.length; i++)
6002
- {
6003
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6004
-
6005
- /*
6006
- boolean locked = false;
6007
- float eps = 0.1f;
6008
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6009
-
6010
- int dot = 0;
6011
-
6012
- if ((dot&1) == 0)
6013
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6014
-
6015
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6016
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6017
- else
6018
- {
6019
- locked = true;
6020
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6021
- }
6022
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6023
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6024
- if (hasnorm)
6025
- {
6026
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6027
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6028
- }
6029
-
6030
- if ((dot&4) == 0)
6031
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6032
-
6033
- if (wrap || !locked && (dot&8) != 0)
6034
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6035
- else
6036
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6037
-
6038
- f.dot = dot;
6039
- */
6040
-
6041
- if (!selectmode)
6042
- {
6043
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6044
- {
6045
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6046
- } else
6047
- {
6048
- gl.glNormal3f(0, 0, 1);
6049
- }
6050
-
6051
- if (c != null)
6052
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6053
- {
6054
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6055
- }
6056
- }
6057
- if (flipV)
6058
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6059
- else
6060
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6061
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6062
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6063
-
6064
- count2 += 2;
6065
- count3 += 3;
6066
- if (!selectmode)
6067
- {
6068
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6069
- {
6070
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6071
- } else
6072
- {
6073
- gl.glNormal3f(0, 0, 1);
6074
- }
6075
- if (c != null)
6076
- {
6077
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6078
- }
6079
- }
6080
- if (flipV)
6081
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6082
- else
6083
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6084
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6085
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6086
-
6087
- count2 += 2;
6088
- count3 += 3;
6089
- for (int j = 0; j < strips[i] - 2; j++)
6090
- {
6091
- //gl.glTexCoord2d(...);
6092
- if (!selectmode)
6093
- {
6094
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6095
- {
6096
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6097
- } else
6098
- {
6099
- gl.glNormal3f(0, 0, 1);
6100
- }
6101
- if (c != null)
6102
- {
6103
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6104
- }
6105
- }
6106
-
6107
- if (flipV)
6108
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6109
- else
6110
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6111
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6112
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6113
- count2 += 2;
6114
- count3 += 3;
6115
- }
6116
-
6117
- gl.glEnd();
6118
- }
6119
- }
6120
-
6121
- assert count3 == v.length;
6122
- }
6123
- else // !trimmed
6124
- {
6125
- int count = 0;
6126
- for (int i = 0; i < strips.length; i++)
6127
- {
6128
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6129
-
6130
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6131
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6132
-
6133
- drawVertex(gl, p, selectmode);
6134
- drawVertex(gl, q, selectmode);
6135
-
6136
- for (int j = 0; j < strips[i] - 2; j++)
6137
- {
6138
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6139
-
6140
-// if (j%2 == 0)
6141
-// drawFace(p, q, r, display, null);
6142
-// else
6143
-// drawFace(p, r, q, display, null);
6144
-
6145
-// p = q;
6146
-// q = r;
6147
- drawVertex(gl, r, selectmode);
6148
- }
6149
-
6150
- gl.glEnd();
6151
- }
6152
- }
6254
+
6255
+ display.DrawGeometry(bRep, flipV, selectmode);
61536256 } else // catch (Error e)
61546257 {
61556258 // TRIANGLE ARRAY
61566259 if (IsOpaque()) // Static())
61576260 {
6158
- gl.glBegin(gl.GL_TRIANGLES);
6261
+ display.StartTriangles();
61596262 int facecount = bRep.FaceCount();
61606263 for (int i = 0; i < facecount; i++)
61616264 {
....@@ -6220,7 +6323,7 @@
62206323
62216324 display.DrawFace(this, p, q, r, face);
62226325 }
6223
- gl.glEnd();
6326
+ display.EndTriangles();
62246327 }
62256328 else
62266329 {
....@@ -6249,8 +6352,8 @@
62496352 //System.out.println("SORT");
62506353
62516354 java.util.Arrays.sort(facescompare);
6252
-
6253
- gl.glBegin(gl.GL_TRIANGLES);
6355
+
6356
+ display.StartTriangles();
62546357 for (int i = 0; i < facecount; i++)
62556358 {
62566359 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6264,11 +6367,12 @@
62646367
62656368 display.DrawFace(this, p, q, r, face);
62666369 }
6267
- gl.glEnd();
6370
+ display.EndTriangles();
62686371 }
62696372
62706373 if (false) // live && support != null && support.bRep != null) // debug weights
62716374 {
6375
+ /*
62726376 gl.glDisable(gl.GL_LIGHTING);
62736377 float[] colorV = new float[3];
62746378
....@@ -6347,6 +6451,7 @@
63476451 // gl.glEnd();
63486452 }
63496453 }
6454
+ */
63506455 }
63516456 }
63526457
....@@ -6391,7 +6496,7 @@
63916496 center.add(r);
63926497 center.mul(1.0/3);
63936498
6394
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6499
+ center.sub(Globals.theRenderer.EyeCamera().location);
63956500
63966501 distance = center.dot(center);
63976502 }
....@@ -6405,22 +6510,6 @@
64056510 void Print(Vertex v)
64066511 {
64076512 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
6408
- }
6409
-
6410
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6411
- {
6412
- if (!selectmode)
6413
- {
6414
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6415
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6416
-
6417
- if (flipV)
6418
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6419
- else
6420
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6421
- }
6422
-
6423
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
64246513 }
64256514
64266515 void drawSelf(ClickInfo info, int level, boolean select)
....@@ -7013,7 +7102,7 @@
70137102 spot.translate(32, 32);
70147103 spotw = spot.x + spot.width;
70157104 spoth = spot.y + spot.height;
7016
- info.g.setColor(Color.blue);
7105
+ info.g.setColor(Color.cyan);
70177106 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70187107 // if (CameraPane.Xmin > spot.x)
70197108 // {
....@@ -7031,11 +7120,12 @@
70317120 // {
70327121 // CameraPane.Ymax = spoth;
70337122 // }
7034
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7035
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7123
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7124
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
70367125 spot.translate(0, -32);
7037
- info.g.setColor(Color.green);
7126
+ info.g.setColor(Color.yellow);
70387127 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7128
+ info.g.setColor(Color.green);
70397129 // if (CameraPane.Xmin > spot.x)
70407130 // {
70417131 // CameraPane.Xmin = spot.x;
....@@ -7087,7 +7177,7 @@
70877177 startX = info.x;
70887178 startY = info.y;
70897179
7090
- hitSomething = 0;
7180
+ hitSomething = -1;
70917181 cVector origin = new cVector();
70927182 //LA.xformPos(origin, toParent, origin);
70937183 Rectangle spot = new Rectangle();
....@@ -7120,7 +7210,7 @@
71207210 }
71217211
71227212 //System.out.println("info.modifiers = " + info.modifiers);
7123
- modified = (info.modifiers & CameraPane.META) != 0;
7213
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
71247214 //System.out.println("modified = " + modified);
71257215 //new Exception().printStackTrace();
71267216 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7148,7 +7238,7 @@
71487238 return true;
71497239 }
71507240
7151
- void doEditDrag0(ClickInfo info)
7241
+ void doEditDrag0(ClickInfo info, boolean opposite)
71527242 {
71537243 if (hitSomething == 0)
71547244 {
....@@ -7163,6 +7253,7 @@
71637253 //System.out.println("hitSomething = " + hitSomething);
71647254
71657255 double scale = 0.005f * info.camera.Distance();
7256
+
71667257 cVector xlate = new cVector();
71677258 //cVector xlate2 = new cVector();
71687259 switch (hitSomething)
....@@ -7173,9 +7264,9 @@
71737264
71747265 case hitCenter: // Translate
71757266
7176
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7267
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
71777268
7178
- if (modified)
7269
+ if (modified || opposite)
71797270 {
71807271 //assert(false);
71817272 /*
....@@ -7221,10 +7312,10 @@
72217312 }
72227313 LA.xformDir(up, ClickInfo.matbuffer, up);
72237314 // if (!CameraPane.LOCALTRANSFORM)
7224
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7315
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
72257316 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
72267317 // if (!CameraPane.LOCALTRANSFORM)
7227
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7318
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
72287319 //LA.vecCross(up, cVector.Z, right2);
72297320
72307321 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7269,6 +7360,7 @@
72697360
72707361 if (modified)
72717362 {
7363
+ // Rotate 90 degrees
72727364 angle /= (Math.PI / 4);
72737365 angle = Math.floor(angle + 0.5);
72747366 angle *= (Math.PI / 4);
....@@ -7282,7 +7374,7 @@
72827374 }
72837375 /**/
72847376
7285
- switch (info.pane.renderCamera.viewCode)
7377
+ switch (info.pane.RenderCamera().viewCode)
72867378 {
72877379 case 1: // '\001'
72887380 LA.matZRotate(toParent, angle);
....@@ -7310,24 +7402,27 @@
73107402
73117403 case hitScale: // scale
73127404 double hScale = (double) (info.x - centerPt.x) / 32;
7405
+ double sign = 1;
7406
+ if (hScale < 0)
7407
+ {
7408
+ sign = -1;
7409
+ }
7410
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
73137411 if (hScale < 0.01)
73147412 {
7315
- hScale = 0.01;
7413
+ //hScale = 0.01;
73167414 }
7317
- hScale = Math.pow(hScale, scale * 50);
7318
- if (hScale < 0.01)
7319
- {
7320
- hScale = 0.01;
7321
- }
7415
+
73227416 double vScale = (double) (info.y - centerPt.y) / 32;
7323
- if (vScale < 0.01)
7417
+ sign = 1;
7418
+ if (vScale < 0)
73247419 {
7325
- vScale = 0.01;
7420
+ sign = -1;
73267421 }
7327
- vScale = Math.pow(vScale, scale * 50);
7422
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
73287423 if (vScale < 0.01)
73297424 {
7330
- vScale = 0.01;
7425
+ //vScale = 0.01;
73317426 }
73327427 LA.matCopy(startMat, toParent);
73337428 /**/
....@@ -7338,39 +7433,46 @@
73387433 }
73397434 /**/
73407435
7341
- switch (info.pane.renderCamera.viewCode)
7436
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7437
+
7438
+ if (totalScale < 0.01)
7439
+ {
7440
+ totalScale = 0.01;
7441
+ }
7442
+
7443
+ switch (info.pane.RenderCamera().viewCode)
73427444 {
73437445 case 3: // '\001'
7344
- if (modified)
7446
+ if (modified || opposite)
73457447 {
73467448 //LA.matScale(toParent, 1, hScale, vScale);
7347
- LA.matScale(toParent, vScale, 1, 1);
7449
+ LA.matScale(toParent, totalScale, 1, 1);
73487450 } // vScale, 1);
73497451 else
73507452 {
7351
- LA.matScale(toParent, vScale, vScale, vScale);
7453
+ LA.matScale(toParent, 1, totalScale, totalScale);
73527454 } // vScale, 1);
73537455 break;
73547456
73557457 case 2: // '\002'
7356
- if (modified)
7458
+ if (modified || opposite)
73577459 {
73587460 //LA.matScale(toParent, hScale, 1, vScale);
7359
- LA.matScale(toParent, 1, vScale, 1);
7461
+ LA.matScale(toParent, 1, totalScale, 1);
73607462 } else
73617463 {
7362
- LA.matScale(toParent, vScale, 1, vScale);
7464
+ LA.matScale(toParent, totalScale, 1, totalScale);
73637465 }
73647466 break;
73657467
73667468 case 1: // '\003'
7367
- if (modified)
7469
+ if (modified || opposite)
73687470 {
73697471 //LA.matScale(toParent, hScale, vScale, 1);
7370
- LA.matScale(toParent, 1, 1, vScale);
7472
+ LA.matScale(toParent, 1, 1, totalScale);
73717473 } else
73727474 {
7373
- LA.matScale(toParent, vScale, vScale, 1);
7475
+ LA.matScale(toParent, totalScale, totalScale, 1);
73747476 }
73757477 break;
73767478 }
....@@ -7503,14 +7605,22 @@
75037605 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
75047606 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
75057607 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7608
+
7609
+ String objname;
7610
+
75067611 if (false) //parent != null)
75077612 {
7508
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7613
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
75097614 } else
75107615 {
7511
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7616
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
75127617 } // + super.toString();
75137618 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7619
+
7620
+ if (!Globals.ADVANCED)
7621
+ return objname;
7622
+
7623
+ return objname + " " + System.identityHashCode(this);
75147624 }
75157625
75167626 public int hashCode()
....@@ -7566,6 +7676,7 @@
75667676 objectUI.closeUI();
75677677 if (editWindow != null)
75687678 {
7679
+ editWindow.ctrlPanel.FlushUI();
75697680 editWindow.refreshContents();
75707681 } // ? new
75717682 objectUI = null;
....@@ -7586,7 +7697,7 @@
75867697 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
75877698
75887699 Object3D /*Composite*/ parent;
7589
- Object3D /*Composite*/ fileparent;
7700
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
75907701
75917702 double[][] toParent; // dynamic matrix
75927703 double[][] fromParent;
....@@ -7701,7 +7812,7 @@
77017812 {
77027813 assert(bRep != null);
77037814 if (!(support instanceof GenericJoint)) // support.bRep != null)
7704
- GrafreeD.Assert(support.bRep == bRep.support);
7815
+ Grafreed.Assert(support.bRep == bRep.support);
77057816 }
77067817 else
77077818 {
....@@ -7750,9 +7861,9 @@
77507861 private static cVector edge2 = new cVector();
77517862 //private static cVector norm = new cVector();
77527863 /*transient private*/ int hitSomething;
7753
- private static final int hitCenter = 1;
7754
- private static final int hitScale = 2;
7755
- private static final int hitRotate = 3;
7864
+ static final int hitCenter = 1;
7865
+ static final int hitScale = 2;
7866
+ static final int hitRotate = 3;
77567867 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
77577868 /*transient*/ private Point centerPt;
77587869 /*transient*/ private int startX;