Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
Object3D.java
....@@ -14,12 +14,28 @@
1414 import //weka.core.
1515 matrix.Matrix;
1616
17
+import java.util.UUID;
18
+
1719 //import net.sourceforge.sizeof.SizeOf;
1820 public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D>
1921 {
2022 //static final long serialVersionUID = -607422624994562685L;
2123 static final long serialVersionUID = 5022536242724664900L;
2224
25
+ // Use GetUUID for backward compatibility with null.
26
+ private UUID uuid = UUID.randomUUID();
27
+
28
+ // TEMPORARY for mocap undo. No need to be transient.
29
+ mocap.reader.BVHReader.BVHResult savebvh;
30
+ Object3D saveskeleton;
31
+ //
32
+
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
37
+ int versionindex = -1;
38
+
2339 ScriptNode scriptnode;
2440
2541 void InitOthers()
....@@ -100,64 +116,201 @@
100116
101117 // transient boolean reduced; // for morph reduction
102118
103
-transient com.bulletphysics.linearmath.Transform cache; // for fast merge
104
-transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge
119
+ transient com.bulletphysics.linearmath.Transform cache; // for fast merge
120
+ transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge
105121
106
-transient Object3D transientsupport; // for cloning
107
-transient boolean transientlink2master;
122
+ transient Object3D transientsupport; // for cloning
123
+ transient boolean transientlink2master;
108124
109
-void SaveSupports()
110
-{
111
- if (blockloop)
112
- return;
113
-
114
- transientsupport = support;
115
- transientlink2master = link2master;
116
-
117
- support = null;
118
- link2master = false;
119
-
120
- if (bRep != null)
125
+ void SaveSupports()
121126 {
122
- bRep.SaveSupports();
127
+ if (blockloop)
128
+ return;
129
+
130
+ transientsupport = support;
131
+ transientlink2master = link2master;
132
+
133
+ support = null;
134
+ link2master = false;
135
+
136
+ if (bRep != null)
137
+ {
138
+ bRep.SaveSupports();
139
+ }
140
+
141
+ for (int i = 0; i < Size(); i++)
142
+ {
143
+ Object3D child = (Object3D) get(i);
144
+ if (child == null)
145
+ continue;
146
+ blockloop = true;
147
+ child.SaveSupports();
148
+ blockloop = false;
149
+ }
123150 }
124
-
125
- for (int i = 0; i < Size(); i++)
151
+
152
+ void RestoreSupports()
126153 {
127
- Object3D child = (Object3D) get(i);
128
- if (child == null)
129
- continue;
154
+ if (blockloop)
155
+ return;
156
+
157
+ support = transientsupport;
158
+ link2master = transientlink2master;
159
+ transientsupport = null;
160
+ transientlink2master = false;
161
+
162
+ if (bRep != null)
163
+ {
164
+ bRep.RestoreSupports();
165
+ }
166
+
167
+ for (int i = 0; i < Size(); i++)
168
+ {
169
+ Object3D child = (Object3D) get(i);
170
+ if (child == null)
171
+ continue;
172
+ blockloop = true;
173
+ child.RestoreSupports();
174
+ blockloop = false;
175
+ }
176
+ }
177
+
178
+ void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
179
+ {
180
+ Object3D o;
181
+
182
+ if (hashtable.containsKey(GetUUID()))
183
+ {
184
+ o = hashtable.get(GetUUID());
185
+
186
+ Grafreed.Assert(this.bRep == o.bRep);
187
+ //if (this.bRep != null)
188
+ // assert(this.bRep.support == o.transientrep);
189
+ if (this.support != null)
190
+ assert(this.support.bRep == o.transientrep);
191
+ }
192
+ else
193
+ {
194
+ o = new Object3D("copy of " + this.name);
195
+
196
+ hashtable.put(GetUUID(), o);
197
+ }
198
+
199
+ if (!blockloop)
200
+ {
201
+ blockloop = true;
202
+
203
+ for (int i=0; i<Size(); i++)
204
+ {
205
+ get(i).ExtractBigData(hashtable);
206
+ }
207
+
208
+ blockloop = false;
209
+ }
210
+
211
+ ExtractBigData(o);
212
+ }
213
+
214
+ void ExtractBigData(Object3D o)
215
+ {
216
+ if (o.bRep != null)
217
+ Grafreed.Assert(o.bRep == this.bRep);
218
+
219
+ o.bRep = this.bRep;
220
+// July 2019 if (this.bRep != null)
221
+// {
222
+// o.transientrep = this.bRep.support;
223
+// o.bRep.support = null;
224
+// }
225
+ o.selection = this.selection;
226
+ o.versionlist = this.versionlist;
227
+ o.versionindex = this.versionindex;
228
+
229
+ if (this.support != null)
230
+ {
231
+ if (o.transientrep != null)
232
+ Grafreed.Assert(o.transientrep == this.support.bRep);
233
+
234
+ o.transientrep = this.support.bRep;
235
+ this.support.bRep = null;
236
+ }
237
+
238
+ // o.support = this.support;
239
+ // o.fileparent = this.fileparent;
240
+ // if (this.bRep != null)
241
+ // o.bRep = this.bRep.support;
242
+
243
+ this.bRep = null;
244
+ // if (this.bRep != null)
245
+ // this.bRep.support = null;
246
+ // this.support = null;
247
+ // this.fileparent = null;
248
+ }
249
+
250
+// Object3D GetObject(java.util.UUID uuid)
251
+// {
252
+// if (this.uuid.equals(uuid))
253
+// return this;
254
+//
255
+// if (blockloop)
256
+// return null;
257
+//
258
+// blockloop = true;
259
+//
260
+// for (int i=0; i<Size(); i++)
261
+// {
262
+// Object3D o = get(i).GetObject(uuid);
263
+//
264
+// if (o != null)
265
+// return o;
266
+// }
267
+//
268
+// blockloop = false;
269
+//
270
+// return null;
271
+// }
272
+
273
+ void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
274
+ {
275
+ if (!hashtable.containsKey(GetUUID()))
276
+ return;
277
+
278
+ Object3D o = hashtable.get(GetUUID());
279
+
280
+ RestoreBigData(o);
281
+
282
+ if (blockloop)
283
+ return;
284
+
130285 blockloop = true;
131
- child.SaveSupports();
286
+
287
+ //hashtable.remove(GetUUID());
288
+
289
+ for (int i=0; i<Size(); i++)
290
+ {
291
+ get(i).RestoreBigData(hashtable);
292
+ }
293
+
132294 blockloop = false;
133295 }
134
-}
135296
136
-void RestoreSupports()
137
-{
138
- if (blockloop)
139
- return;
140
-
141
- support = transientsupport;
142
- link2master = transientlink2master;
143
- transientsupport = null;
144
- transientlink2master = false;
145
-
146
- if (bRep != null)
297
+ void RestoreBigData(Object3D o)
147298 {
148
- bRep.RestoreSupports();
299
+ this.bRep = o.bRep;
300
+ if (this.support != null && o.transientrep != null)
301
+ {
302
+ this.support.bRep = o.transientrep;
303
+ }
304
+
305
+ this.selection = o.selection;
306
+
307
+ this.versionlist = o.versionlist;
308
+ this.versionindex = o.versionindex;
309
+// July 2019 if (this.bRep != null)
310
+// this.bRep.support = o.transientrep;
311
+ // this.support = o.support;
312
+ // this.fileparent = o.fileparent;
149313 }
150
-
151
- for (int i = 0; i < Size(); i++)
152
- {
153
- Object3D child = (Object3D) get(i);
154
- if (child == null)
155
- continue;
156
- blockloop = true;
157
- child.RestoreSupports();
158
- blockloop = false;
159
- }
160
-}
161314
162315 // MOCAP SUPPORT
163316 double tx,ty,tz,rx,ry,rz;
....@@ -300,6 +453,7 @@
300453 }
301454
302455 boolean live = false;
456
+ transient boolean keepdontselect;
303457 boolean dontselect = false;
304458 boolean hide = false;
305459 boolean link2master = false; // performs reset support/master at each frame
....@@ -482,12 +636,14 @@
482636 toParent = LA.newMatrix();
483637 fromParent = LA.newMatrix();
484638 }
639
+
485640 if (toParentMarked == null)
486641 {
487642 if (maxcount != 1)
488643 {
489644 new Exception().printStackTrace();
490645 }
646
+
491647 toParentMarked = LA.newMatrix();
492648 fromParentMarked = LA.newMatrix();
493649 }
....@@ -775,7 +931,7 @@
775931 if (step == 0)
776932 step = 1;
777933 if (maxcount == 0)
778
- maxcount = 2048; // 4;
934
+ maxcount = 128; // 2048; // 4;
779935 // if (acceleration == 0)
780936 // acceleration = 10;
781937 if (delay == 0) // serial
....@@ -798,7 +954,7 @@
798954
799955 if (marked && Globals.isLIVE() && live &&
800956 //TEMP21aug2018
801
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
957
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
802958 currentframe != Globals.framecount)
803959 {
804960 currentframe = Globals.framecount;
....@@ -810,7 +966,8 @@
810966
811967 boolean changedir = random && Math.random() < 0.01; // && !link2master;
812968
813
- if (transformcount*factor > maxcount || (step == 1 && changedir))
969
+ if (transformcount*factor >= maxcount && (rewind || random) ||
970
+ (step == 1 && changedir))
814971 {
815972 countdown = 1;
816973 delay = speedup?8:1;
....@@ -882,6 +1039,10 @@
8821039 if (material == null || material.multiply)
8831040 return true;
8841041
1042
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1043
+ return false;
1044
+
1045
+ // Transparent objects are dynamic because we have to sort the triangles.
8851046 return material.opacity > 0.99;
8861047 }
8871048
....@@ -1282,6 +1443,7 @@
12821443 toParent = LA.newMatrix();
12831444 fromParent = LA.newMatrix();
12841445 }
1446
+
12851447 LA.matCopy(other.toParent, toParent);
12861448 LA.matCopy(other.fromParent, fromParent);
12871449
....@@ -2303,6 +2465,10 @@
23032465 }
23042466 */
23052467 }
2468
+ else
2469
+ {
2470
+ //((ObjEditor)editWindow).SetupUI2(null);
2471
+ }
23062472 }
23072473
23082474 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2344,6 +2510,14 @@
23442510 {
23452511 editWindow.refreshContents();
23462512 }
2513
+ else
2514
+ {
2515
+ if (manipWindow != null)
2516
+ {
2517
+ manipWindow.refreshContents();
2518
+ }
2519
+ }
2520
+
23472521 //if (parent != null)
23482522 //parent.refreshEditWindow();
23492523 }
....@@ -2423,7 +2597,8 @@
24232597 private static final int editSelf = 1;
24242598 private static final int editChild = 2;
24252599
2426
- void drawEditHandles(ClickInfo info, int level)
2600
+ void drawEditHandles(//ClickInfo info,
2601
+ int level)
24272602 {
24282603 if (level == 0)
24292604 {
....@@ -2431,7 +2606,8 @@
24312606 return;
24322607
24332608 Object3D selectee;
2434
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2609
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2610
+ level + 1))
24352611 {
24362612 selectee = (Object3D) e.nextElement();
24372613 }
....@@ -2439,19 +2615,22 @@
24392615 } else
24402616 {
24412617 //super.
2442
- drawEditHandles0(info, level + 1);
2618
+ drawEditHandles0(//info,
2619
+ level + 1);
24432620 }
24442621 }
24452622
2446
- boolean doEditClick(ClickInfo info, int level)
2623
+ boolean doEditClick(//ClickInfo info,
2624
+ int level)
24472625 {
24482626 doSomething = 0;
24492627 if (level == 0)
24502628 {
2451
- return doParentClick(info);
2629
+ return doParentClick(); //info);
24522630 }
24532631 if (//super.
2454
- doEditClick0(info, level))
2632
+ doEditClick0(//info,
2633
+ level))
24552634 {
24562635 doSomething = 1;
24572636 return true;
....@@ -2461,7 +2640,7 @@
24612640 }
24622641 }
24632642
2464
- boolean doParentClick(ClickInfo info)
2643
+ boolean doParentClick() //ClickInfo info)
24652644 {
24662645 if (selection == null)
24672646 {
....@@ -2474,7 +2653,8 @@
24742653 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
24752654 {
24762655 Object3D selectee = (Object3D) e.nextElement();
2477
- if (selectee.doEditClick(info, 1))
2656
+ if (selectee.doEditClick(//info,
2657
+ 1))
24782658 {
24792659 childToDrag = selectee;
24802660 doSomething = 2;
....@@ -2486,13 +2666,15 @@
24862666 return retval;
24872667 }
24882668
2489
- void doEditDrag(ClickInfo info, boolean opposite)
2669
+ void doEditDrag(//ClickInfo clickInfo,
2670
+ boolean opposite)
24902671 {
24912672 switch (doSomething)
24922673 {
24932674 case 1: // '\001'
24942675 //super.
2495
- doEditDrag0(info, opposite);
2676
+ doEditDrag0(//clickInfo,
2677
+ opposite);
24962678 break;
24972679
24982680 case 2: // '\002'
....@@ -2505,11 +2687,13 @@
25052687 {
25062688 //sel.hitSomething = childToDrag.hitSomething;
25072689 //childToDrag.doEditDrag(info);
2508
- sel.doEditDrag(info, opposite);
2690
+ sel.doEditDrag(//clickInfo,
2691
+ opposite);
25092692 } else
25102693 {
25112694 //super.
2512
- doEditDrag0(info, opposite);
2695
+ doEditDrag0(//clickInfo,
2696
+ opposite);
25132697 }
25142698 }
25152699 break;
....@@ -2527,6 +2711,9 @@
25272711 {
25282712 deselectAll();
25292713 }
2714
+
2715
+ new Exception().printStackTrace();
2716
+
25302717 ClickInfo newInfo = new ClickInfo();
25312718 newInfo.flags = info.flags;
25322719 newInfo.bounds = info.bounds;
....@@ -2619,6 +2806,18 @@
26192806 void GenNormalsS(boolean crease)
26202807 {
26212808 selection.GenNormals(crease);
2809
+// for (int i=0; i<selection.size(); i++)
2810
+// {
2811
+// Object3D selectee = (Object3D) selection.elementAt(i);
2812
+// selectee.GenNormals(crease);
2813
+// }
2814
+
2815
+ //Touch();
2816
+ }
2817
+
2818
+ void GenNormalsMeshS()
2819
+ {
2820
+ selection.GenNormalsMesh();
26222821 // for (int i=0; i<selection.size(); i++)
26232822 // {
26242823 // Object3D selectee = (Object3D) selection.elementAt(i);
....@@ -2759,6 +2958,24 @@
27592958 if (child == null)
27602959 continue;
27612960 child.GenNormals(crease);
2961
+// Children().release(i);
2962
+ }
2963
+ blockloop = false;
2964
+ }
2965
+
2966
+ void GenNormalsMesh()
2967
+ {
2968
+ if (blockloop)
2969
+ return;
2970
+
2971
+ blockloop = true;
2972
+ GenNormalsMesh0();
2973
+ for (int i = 0; i < Children().Size(); i++)
2974
+ {
2975
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2976
+ if (child == null)
2977
+ continue;
2978
+ child.GenNormalsMesh();
27622979 // Children().release(i);
27632980 }
27642981 blockloop = false;
....@@ -2931,11 +3148,20 @@
29313148 }
29323149 }
29333150
3151
+ void GenNormalsMesh0()
3152
+ {
3153
+ if (bRep != null)
3154
+ {
3155
+ bRep.GenerateNormalsMesh();
3156
+ Touch();
3157
+ }
3158
+ }
3159
+
29343160 void GenNormalsMINE0()
29353161 {
29363162 if (bRep != null)
29373163 {
2938
- bRep.GenerateNormalsMINE();
3164
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
29393165 Touch();
29403166 }
29413167 }
....@@ -3381,7 +3607,8 @@
33813607 if (blockloop)
33823608 return;
33833609
3384
- if (marked || (bRep != null && material != null)) // borderline...
3610
+ if (//marked || // does not make sense
3611
+ (bRep != null || material != null)) // borderline...
33853612 live = h;
33863613
33873614 for (int i = 0; i < Size(); i++)
....@@ -3402,7 +3629,8 @@
34023629 return;
34033630
34043631 //if (bRep != null)
3405
- if (marked || (bRep != null && material != null)) // borderline...
3632
+ if (//marked || // does not make sense
3633
+ (bRep != null || material != null)) // borderline...
34063634 link2master = h;
34073635
34083636 for (int i = 0; i < Size(); i++)
....@@ -3422,7 +3650,8 @@
34223650 if (blockloop)
34233651 return;
34243652
3425
- if (marked || (bRep != null && material != null)) // borderline...
3653
+ if (//marked || // does not make sense
3654
+ (bRep != null || material != null)) // borderline...
34263655 hide = h;
34273656
34283657 for (int i = 0; i < Size(); i++)
....@@ -3442,7 +3671,7 @@
34423671 if (blockloop)
34433672 return;
34443673
3445
- if (bRep != null && material != null) // borderline...
3674
+ if (bRep != null || material != null) // borderline...
34463675 marked = h;
34473676
34483677 for (int i = 0; i < Size(); i++)
....@@ -3452,6 +3681,46 @@
34523681 continue;
34533682 blockloop = true;
34543683 child.MarkLeaves(h);
3684
+ blockloop = false;
3685
+ // release(i);
3686
+ }
3687
+ }
3688
+
3689
+ void RewindLeaves(boolean h)
3690
+ {
3691
+ if (blockloop)
3692
+ return;
3693
+
3694
+ if (bRep != null || material != null) // borderline...
3695
+ rewind = h;
3696
+
3697
+ for (int i = 0; i < Size(); i++)
3698
+ {
3699
+ Object3D child = (Object3D) get(i); // reserve(i);
3700
+ if (child == null)
3701
+ continue;
3702
+ blockloop = true;
3703
+ child.RewindLeaves(h);
3704
+ blockloop = false;
3705
+ // release(i);
3706
+ }
3707
+ }
3708
+
3709
+ void RandomLeaves(boolean h)
3710
+ {
3711
+ if (blockloop)
3712
+ return;
3713
+
3714
+ if (bRep != null || material != null) // borderline...
3715
+ random = h;
3716
+
3717
+ for (int i = 0; i < Size(); i++)
3718
+ {
3719
+ Object3D child = (Object3D) get(i); // reserve(i);
3720
+ if (child == null)
3721
+ continue;
3722
+ blockloop = true;
3723
+ child.RandomLeaves(h);
34553724 blockloop = false;
34563725 // release(i);
34573726 }
....@@ -4229,6 +4498,55 @@
42294498 }
42304499 }
42314500
4501
+ void RepairSOV()
4502
+ {
4503
+ if (blockloop)
4504
+ return;
4505
+
4506
+ String texname = this.GetPigmentTexture();
4507
+
4508
+ if (texname.startsWith("sov"))
4509
+ {
4510
+ String[] s = texname.split("/");
4511
+
4512
+ String[] sname = s[1].split("Color.pn");
4513
+
4514
+ texname = sname[0];
4515
+
4516
+ if (sname.length > 1)
4517
+ {
4518
+ texname += "Color.jpg";
4519
+ }
4520
+
4521
+ this.SetPigmentTexture("sov/" + texname);
4522
+ }
4523
+
4524
+ texname = this.GetBumpTexture();
4525
+
4526
+ if (texname.startsWith("sov"))
4527
+ {
4528
+ String[] s = texname.split("/");
4529
+
4530
+ String[] sname = s[1].split("Bump.pn");
4531
+
4532
+ texname = sname[0];
4533
+
4534
+ if (sname.length > 1)
4535
+ {
4536
+ texname += "Bump.jpg";
4537
+ }
4538
+
4539
+ this.SetBumpTexture("sov/" + texname);
4540
+ }
4541
+
4542
+ for (int i=0; i<Size(); i++)
4543
+ {
4544
+ blockloop = true;
4545
+ get(i).RepairSOV();
4546
+ blockloop = false;
4547
+ }
4548
+ }
4549
+
42324550 void RepairTexture()
42334551 {
42344552 if (this instanceof FileObject || blockloop)
....@@ -4743,6 +5061,14 @@
47435061 }
47445062 }
47455063
5064
+ ObjEditor GetWindow()
5065
+ {
5066
+ if (editWindow != null)
5067
+ return editWindow;
5068
+
5069
+ return manipWindow;
5070
+ }
5071
+
47465072 cTreePath Select(int indexcount, boolean deselect)
47475073 {
47485074 if (hide || dontselect)
....@@ -4779,10 +5105,11 @@
47795105 if (leaf != null)
47805106 {
47815107 cTreePath tp = new cTreePath(this, leaf);
4782
- if (editWindow != null)
5108
+ ObjEditor window = GetWindow();
5109
+ if (window != null)
47835110 {
47845111 //System.out.println("editWindow = " + editWindow + " vs " + this);
4785
- editWindow.Select(tp, deselect, true);
5112
+ window.Select(tp, deselect, true);
47865113 }
47875114
47885115 return tp;
....@@ -4799,6 +5126,7 @@
47995126
48005127 if (child == null)
48015128 continue;
5129
+
48025130 if (child.HasTransparency() && child.size() != 0)
48035131 {
48045132 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -4808,9 +5136,10 @@
48085136 if (leaf != null)
48095137 {
48105138 cTreePath tp = new cTreePath(this, leaf);
4811
- if (editWindow != null)
5139
+ ObjEditor window = GetWindow();
5140
+ if (window != null)
48125141 {
4813
- editWindow.Select(tp, deselect, true);
5142
+ window.Select(tp, deselect, true);
48145143 }
48155144
48165145 return tp;
....@@ -5135,6 +5464,51 @@
51355464 blockloop = false;
51365465 }
51375466
5467
+ void ResetSelectable()
5468
+ {
5469
+ if (blockloop)
5470
+ return;
5471
+
5472
+ blockloop = true;
5473
+
5474
+ keepdontselect = dontselect;
5475
+ dontselect = true;
5476
+
5477
+ Object3D child;
5478
+ int nb = Size();
5479
+ for (int i = 0; i < nb; i++)
5480
+ {
5481
+ child = (Object3D) get(i);
5482
+ if (child == null)
5483
+ continue;
5484
+ child.ResetSelectable();
5485
+ }
5486
+
5487
+ blockloop = false;
5488
+ }
5489
+
5490
+ void RestoreSelectable()
5491
+ {
5492
+ if (blockloop)
5493
+ return;
5494
+
5495
+ blockloop = true;
5496
+
5497
+ dontselect = keepdontselect;
5498
+
5499
+ Object3D child;
5500
+ int nb = Size();
5501
+ for (int i = 0; i < nb; i++)
5502
+ {
5503
+ child = (Object3D) get(i);
5504
+ if (child == null)
5505
+ continue;
5506
+ child.RestoreSelectable();
5507
+ }
5508
+
5509
+ blockloop = false;
5510
+ }
5511
+
51385512 boolean IsSelected()
51395513 {
51405514 if (parent == null)
....@@ -5371,6 +5745,43 @@
53715745 }
53725746 }
53735747
5748
+ UUID GetUUID()
5749
+ {
5750
+ if (uuid == null)
5751
+ {
5752
+ // Serial
5753
+ uuid = UUID.randomUUID();
5754
+ }
5755
+
5756
+ return uuid;
5757
+ }
5758
+
5759
+ Object3D GetObject(UUID uid)
5760
+ {
5761
+ if (blockloop)
5762
+ return null;
5763
+
5764
+ if (GetUUID().equals(uid))
5765
+ return this;
5766
+
5767
+ int nb = Size();
5768
+ for (int i = 0; i < nb; i++)
5769
+ {
5770
+ Object3D child = (Object3D) get(i);
5771
+
5772
+ if (child == null)
5773
+ continue;
5774
+
5775
+ blockloop = true;
5776
+ Object3D obj = child.GetObject(uid);
5777
+ blockloop = false;
5778
+ if (obj != null)
5779
+ return obj;
5780
+ }
5781
+
5782
+ return null;
5783
+ }
5784
+
53745785 void SetBumpTexture(String tex)
53755786 {
53765787 if (GetTextures() == null)
....@@ -5407,6 +5818,38 @@
54075818 }
54085819 }
54095820
5821
+ void EmbedTextures(boolean embed)
5822
+ {
5823
+ if (blockloop)
5824
+ return;
5825
+
5826
+ //if (GetTextures() != null)
5827
+ if (embed)
5828
+ CameraPane.EmbedTextures(GetTextures());
5829
+ else
5830
+ {
5831
+ GetTextures().pigmentdata = null;
5832
+ GetTextures().bumpdata = null;
5833
+ GetTextures().pw = 0;
5834
+ GetTextures().ph = 0;
5835
+ GetTextures().bw = 0;
5836
+ GetTextures().bh = 0;
5837
+ }
5838
+
5839
+ int nb = Size();
5840
+ for (int i = 0; i < nb; i++)
5841
+ {
5842
+ Object3D child = (Object3D) get(i);
5843
+
5844
+ if (child == null)
5845
+ continue;
5846
+
5847
+ blockloop = true;
5848
+ child.EmbedTextures(embed);
5849
+ blockloop = false;
5850
+ }
5851
+ }
5852
+
54105853 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
54115854 {
54125855 Draw(display, root, selected, blocked);
....@@ -5415,12 +5858,23 @@
54155858 boolean NeedSupport()
54165859 {
54175860 return
5418
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5861
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
54195862 // PROBLEM with CROWD!!
54205863 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
54215864 }
54225865
54235866 static boolean DEBUG_SELECTION = false;
5867
+
5868
+ boolean IsLive()
5869
+ {
5870
+ if (live)
5871
+ return true;
5872
+
5873
+ if (parent == null)
5874
+ return false;
5875
+
5876
+ return parent.IsLive();
5877
+ }
54245878
54255879 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
54265880 {
....@@ -5482,8 +5936,10 @@
54825936 if (support != null)
54835937 support = support;
54845938
5485
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5486
- boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5939
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5940
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5941
+
5942
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
54875943
54885944 if (!usecalllists && bRep != null && bRep.displaylist > 0)
54895945 {
....@@ -5493,8 +5949,9 @@
54935949 // usecalllists &= !(parent instanceof RandomNode);
54945950 // usecalllists = false;
54955951
5496
- if (GetBRep() != null)
5497
- usecalllists = usecalllists;
5952
+ if (display.DrawMode() == display.SHADOW)
5953
+ //GetBRep() != null)
5954
+ usecalllists = !!usecalllists;
54985955 //System.out.println("draw " + this);
54995956 //new Exception().printStackTrace();
55005957
....@@ -5503,10 +5960,12 @@
55035960 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
55045961
55055962 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5506
- (touched || (bRep != null && bRep.displaylist <= 0)))
5963
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5964
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
55075965 {
55085966 Globals.lighttouched = true;
55095967 } // all panes...
5968
+
55105969 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
55115970 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
55125971 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5514,7 +5973,7 @@
55145973 if (!(this instanceof Composite))
55155974 touched = false;
55165975 //if (displaylist == -1 && usecalllists)
5517
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5976
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
55185977 {
55195978 bRep.displaylist = display.GenList();
55205979 assert(bRep.displaylist != 0);
....@@ -5525,7 +5984,7 @@
55255984
55265985 //System.out.println("\tnew list " + list);
55275986 //gl.glDrawBuffer(gl.GL_NONE);
5528
- if (usecalllists)
5987
+ if (usecalllists && bRep.displaylist > 0)
55295988 {
55305989 // System.err.println("new list " + bRep.displaylist + " for " + this);
55315990 display.NewList(bRep.displaylist);
....@@ -5534,7 +5993,7 @@
55345993 CallList(display, root, selected, blocked);
55355994
55365995 // compiled = true;
5537
- if (usecalllists)
5996
+ if (usecalllists && bRep.displaylist > 0)
55385997 {
55395998 // System.err.println("end list " + bRep.displaylist + " for " + this);
55405999 display.EndList();
....@@ -5634,6 +6093,7 @@
56346093 if (GetBRep() != null)
56356094 {
56366095 display.NextIndex();
6096
+
56376097 // vertex color conflict : gl.glCallList(list);
56386098 DrawNode(display, root, selected);
56396099 if (this instanceof BezierPatch)
....@@ -5674,16 +6134,27 @@
56746134 tex = GetTextures();
56756135 }
56766136
5677
- boolean failed = false;
6137
+ boolean failedPigment = false;
6138
+ boolean failedBump = false;
56786139
56796140 try
56806141 {
5681
- display.BindTextures(tex, texres);
6142
+ display.BindPigmentTexture(tex, texres);
56826143 }
56836144 catch (Exception e)
56846145 {
56856146 System.err.println("FAILED: " + this);
5686
- failed = true;
6147
+ failedPigment = true;
6148
+ }
6149
+
6150
+ try
6151
+ {
6152
+ display.BindBumpTexture(tex, texres);
6153
+ }
6154
+ catch (Exception e)
6155
+ {
6156
+ //System.err.println("FAILED: " + this);
6157
+ failedBump = true;
56876158 }
56886159
56896160 if (!compiled)
....@@ -5706,8 +6177,11 @@
57066177 }
57076178 }
57086179
5709
- if (!failed)
5710
- display.ReleaseTextures(tex);
6180
+ if (!failedBump)
6181
+ display.ReleaseBumpTexture(tex);
6182
+
6183
+ if (!failedPigment)
6184
+ display.ReleasePigmentTexture(tex);
57116185
57126186 display.PopMaterial(this, selected);
57136187 }
....@@ -6080,6 +6554,11 @@
60806554 // dec 2012
60816555 new Exception().printStackTrace();
60826556 return;
6557
+ }
6558
+
6559
+ if (dontselect)
6560
+ {
6561
+ //bRep.GenerateNormalsMINE();
60836562 }
60846563
60856564 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -6865,20 +7344,23 @@
68657344 }
68667345 }
68677346
6868
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7347
+ static ClickInfo clickInfo = new ClickInfo();
7348
+
7349
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7350
+ Point outPt, Rectangle outRec)
68697351 {
6870
- int hc = info.bounds.x + info.bounds.width / 2;
6871
- int vc = info.bounds.y + info.bounds.height / 2;
6872
- double[][] toscreen = info.toScreen;
7352
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7353
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7354
+ double[][] toscreen = clickInfo.toScreen;
68737355 if (toscreen == null)
68747356 {
6875
- toscreen = new Camera(info.camera.viewCode).toScreen;
7357
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
68767358 }
68777359 cVector vec = in;
68787360 LA.xformPos(in, toscreen, in);
68797361 //System.out.println("Distance = " + info.camera.Distance());
6880
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
6881
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7362
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7363
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
68827364 outPt.x = hc + (int) vec.x;
68837365 outPt.y = vc - (int) vec.y;
68847366 outRec.x = outPt.x - 3;
....@@ -6886,15 +7368,18 @@
68867368 outRec.width = outRec.height = 6;
68877369 }
68887370
6889
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7371
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7372
+ )
68907373 {
68917374 Point pt = new Point(0, 0);
68927375 Rectangle rec = new Rectangle();
6893
- calcHotSpot(in, info, pt, rec);
7376
+ calcHotSpot(in, //clickInfo,
7377
+ pt, rec);
68947378 return rec;
68957379 }
68967380
6897
- void drawEditHandles0(ClickInfo info, int level)
7381
+ void drawEditHandles0(//ClickInfo clickInfo,
7382
+ int level)
68987383 {
68997384 if (level == 0)
69007385 {
....@@ -6903,16 +7388,19 @@
69037388 {
69047389 cVector origin = new cVector();
69057390 //LA.xformPos(origin, toParent, origin);
6906
- Rectangle spot = calcHotSpot(origin, info);
7391
+ if (this.clickInfo == null)
7392
+ this.clickInfo = new ClickInfo();
7393
+
7394
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
69077395 Rectangle boundary = new Rectangle();
69087396 boundary.x = spot.x - 30;
69097397 boundary.y = spot.y - 30;
69107398 boundary.width = spot.width + 60;
69117399 boundary.height = spot.height + 60;
6912
- info.g.setColor(Color.red);
7400
+ clickInfo.g.setColor(Color.red);
69137401 int spotw = spot.x + spot.width;
69147402 int spoth = spot.y + spot.height;
6915
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7403
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
69167404 // if (CameraPane.Xmin > spot.x)
69177405 // {
69187406 // CameraPane.Xmin = spot.x;
....@@ -6932,8 +7420,8 @@
69327420 spot.translate(32, 32);
69337421 spotw = spot.x + spot.width;
69347422 spoth = spot.y + spot.height;
6935
- info.g.setColor(Color.blue);
6936
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7423
+ clickInfo.g.setColor(Color.cyan);
7424
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
69377425 // if (CameraPane.Xmin > spot.x)
69387426 // {
69397427 // CameraPane.Xmin = spot.x;
....@@ -6950,11 +7438,12 @@
69507438 // {
69517439 // CameraPane.Ymax = spoth;
69527440 // }
6953
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
6954
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7441
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7442
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
69557443 spot.translate(0, -32);
6956
- info.g.setColor(Color.green);
6957
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7444
+ clickInfo.g.setColor(Color.yellow);
7445
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7446
+ clickInfo.g.setColor(Color.green);
69587447 // if (CameraPane.Xmin > spot.x)
69597448 // {
69607449 // CameraPane.Xmin = spot.x;
....@@ -6971,8 +7460,8 @@
69717460 // {
69727461 // CameraPane.Ymax = spoth;
69737462 // }
6974
- info.g.drawArc(boundary.x, boundary.y,
6975
- boundary.width, boundary.height, 0, 360);
7463
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7464
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
69767465 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
69777466 // if (CameraPane.Xmin > boundary.x)
69787467 // {
....@@ -6994,7 +7483,8 @@
69947483 }
69957484 }
69967485
6997
- boolean doEditClick0(ClickInfo info, int level)
7486
+ boolean doEditClick0(//ClickInfo clickInfo,
7487
+ int level)
69987488 {
69997489 if (level == 0)
70007490 {
....@@ -7003,10 +7493,10 @@
70037493
70047494 boolean retval = false;
70057495
7006
- startX = info.x;
7007
- startY = info.y;
7496
+ startX = clickInfo.x;
7497
+ startY = clickInfo.y;
70087498
7009
- hitSomething = 0;
7499
+ hitSomething = -1;
70107500 cVector origin = new cVector();
70117501 //LA.xformPos(origin, toParent, origin);
70127502 Rectangle spot = new Rectangle();
....@@ -7014,22 +7504,51 @@
70147504 {
70157505 centerPt = new Point(0, 0);
70167506 }
7017
- calcHotSpot(origin, info, centerPt, spot);
7018
- if (spot.contains(info.x, info.y))
7507
+ calcHotSpot(origin, //info,
7508
+ centerPt, spot);
7509
+ if (spot.contains(clickInfo.x, clickInfo.y))
70197510 {
70207511 hitSomething = hitCenter;
70217512 retval = true;
70227513 }
70237514 spot.translate(32, 0);
7024
- if (spot.contains(info.x, info.y))
7515
+ if (spot.contains(clickInfo.x, clickInfo.y))
70257516 {
70267517 hitSomething = hitRotate;
70277518 retval = true;
70287519 }
70297520 spot.translate(0, 32);
7030
- if (spot.contains(info.x, info.y))
7521
+ if (spot.contains(clickInfo.x, clickInfo.y))
70317522 {
70327523 hitSomething = hitScale;
7524
+
7525
+ double scale = 0.005f * clickInfo.camera.Distance();
7526
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7527
+ double sign = 1;
7528
+ if (hScale < 0)
7529
+ {
7530
+ sign = -1;
7531
+ }
7532
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7533
+ if (hScale < 0.01)
7534
+ {
7535
+ //hScale = 0.01;
7536
+ }
7537
+
7538
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7539
+ sign = 1;
7540
+ if (vScale < 0)
7541
+ {
7542
+ sign = -1;
7543
+ }
7544
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7545
+ if (vScale < 0.01)
7546
+ {
7547
+ //vScale = 0.01;
7548
+ }
7549
+
7550
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7551
+
70337552 retval = true;
70347553 }
70357554
....@@ -7039,7 +7558,7 @@
70397558 }
70407559
70417560 //System.out.println("info.modifiers = " + info.modifiers);
7042
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7561
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
70437562 //System.out.println("modified = " + modified);
70447563 //new Exception().printStackTrace();
70457564 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7067,7 +7586,8 @@
70677586 return true;
70687587 }
70697588
7070
- void doEditDrag0(ClickInfo info, boolean opposite)
7589
+ void doEditDrag0(//ClickInfo info,
7590
+ boolean opposite)
70717591 {
70727592 if (hitSomething == 0)
70737593 {
....@@ -7081,7 +7601,8 @@
70817601
70827602 //System.out.println("hitSomething = " + hitSomething);
70837603
7084
- double scale = 0.005f * info.camera.Distance();
7604
+ double scale = 0.005f * clickInfo.camera.Distance();
7605
+
70857606 cVector xlate = new cVector();
70867607 //cVector xlate2 = new cVector();
70877608 switch (hitSomething)
....@@ -7114,8 +7635,8 @@
71147635 toParent[3][i] = xlate.get(i);
71157636 LA.matInvert(toParent, fromParent);
71167637 */
7117
- cVector delta = LA.newVector(0, 0, startY - info.y);
7118
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7638
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7639
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
71197640
71207641 LA.matCopy(startMat, toParent);
71217642 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7124,7 +7645,7 @@
71247645 } else
71257646 {
71267647 //LA.xformDir(delta, info.camera.fromScreen, delta);
7127
- cVector up = new cVector(info.camera.up);
7648
+ cVector up = new cVector(clickInfo.camera.up);
71287649 cVector away = new cVector();
71297650 //cVector right2 = new cVector();
71307651 //LA.vecCross(up, cVector.Z, right);
....@@ -7141,19 +7662,19 @@
71417662 LA.xformDir(up, ClickInfo.matbuffer, up);
71427663 // if (!CameraPane.LOCALTRANSFORM)
71437664 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7144
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7665
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
71457666 // if (!CameraPane.LOCALTRANSFORM)
71467667 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
71477668 //LA.vecCross(up, cVector.Z, right2);
71487669
7149
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7670
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
71507671
71517672 //System.out.println("DELTA0 = " + delta);
71527673 //System.out.println("AWAY = " + info.camera.away);
71537674 //System.out.println("UP = " + info.camera.up);
71547675 if (away.z > 0)
71557676 {
7156
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7677
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
71577678 {
71587679 delta.x = -delta.x;
71597680 } else
....@@ -7168,7 +7689,7 @@
71687689 //System.out.println("DELTA1 = " + delta);
71697690 LA.xformDir(delta, ClickInfo.matbuffer, delta);
71707691 //System.out.println("DELTA2 = " + delta);
7171
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7692
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
71727693 LA.matCopy(startMat, toParent);
71737694 //System.out.println("DELTA3 = " + delta);
71747695 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7178,8 +7699,8 @@
71787699 break;
71797700
71807701 case hitRotate: // rotate
7181
- int dx = info.x - centerPt.x;
7182
- int dy = -(info.y - centerPt.y);
7702
+ int dx = clickInfo.x - centerPt.x;
7703
+ int dy = -(clickInfo.y - centerPt.y);
71837704 double angle = (double) Math.atan2(dx, dy);
71847705 angle = -(1.570796 - angle);
71857706
....@@ -7202,7 +7723,7 @@
72027723 }
72037724 /**/
72047725
7205
- switch (info.pane.RenderCamera().viewCode)
7726
+ switch (clickInfo.pane.RenderCamera().viewCode)
72067727 {
72077728 case 1: // '\001'
72087729 LA.matZRotate(toParent, angle);
....@@ -7229,26 +7750,30 @@
72297750 break;
72307751
72317752 case hitScale: // scale
7232
- double hScale = (double) (info.x - centerPt.x) / 32;
7753
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7754
+ double sign = 1;
7755
+ if (hScale < 0)
7756
+ {
7757
+ sign = -1;
7758
+ }
7759
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
72337760 if (hScale < 0.01)
72347761 {
7235
- hScale = 0.01;
7762
+ //hScale = 0.01;
72367763 }
7237
- hScale = Math.pow(hScale, scale * 50);
7238
- if (hScale < 0.01)
7764
+
7765
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7766
+ sign = 1;
7767
+ if (vScale < 0)
72397768 {
7240
- hScale = 0.01;
7769
+ sign = -1;
72417770 }
7242
- double vScale = (double) (info.y - centerPt.y) / 32;
7771
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
72437772 if (vScale < 0.01)
72447773 {
7245
- vScale = 0.01;
7774
+ //vScale = 0.01;
72467775 }
7247
- vScale = Math.pow(vScale, scale * 50);
7248
- if (vScale < 0.01)
7249
- {
7250
- vScale = 0.01;
7251
- }
7776
+
72527777 LA.matCopy(startMat, toParent);
72537778 /**/
72547779 for (int i = 0; i < 3; i++)
....@@ -7258,39 +7783,47 @@
72587783 }
72597784 /**/
72607785
7261
- switch (info.pane.RenderCamera().viewCode)
7786
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
7787
+
7788
+ if (totalScale < 0.01)
7789
+ {
7790
+ totalScale = 0.01;
7791
+ }
7792
+
7793
+ switch (clickInfo.pane.RenderCamera().viewCode)
72627794 {
72637795 case 3: // '\001'
7264
- if (modified)
7796
+ if (modified || opposite)
72657797 {
72667798 //LA.matScale(toParent, 1, hScale, vScale);
7267
- LA.matScale(toParent, vScale, 1, 1);
7799
+ LA.matScale(toParent, totalScale, 1, 1);
72687800 } // vScale, 1);
72697801 else
72707802 {
7271
- LA.matScale(toParent, vScale, vScale, vScale);
7803
+ // EXCEPTION!
7804
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
72727805 } // vScale, 1);
72737806 break;
72747807
72757808 case 2: // '\002'
7276
- if (modified)
7809
+ if (modified || opposite)
72777810 {
72787811 //LA.matScale(toParent, hScale, 1, vScale);
7279
- LA.matScale(toParent, 1, vScale, 1);
7812
+ LA.matScale(toParent, 1, totalScale, 1);
72807813 } else
72817814 {
7282
- LA.matScale(toParent, vScale, 1, vScale);
7815
+ LA.matScale(toParent, totalScale, 1, totalScale);
72837816 }
72847817 break;
72857818
72867819 case 1: // '\003'
7287
- if (modified)
7820
+ if (modified || opposite)
72887821 {
72897822 //LA.matScale(toParent, hScale, vScale, 1);
7290
- LA.matScale(toParent, 1, 1, vScale);
7823
+ LA.matScale(toParent, 1, 1, totalScale);
72917824 } else
72927825 {
7293
- LA.matScale(toParent, vScale, vScale, 1);
7826
+ LA.matScale(toParent, totalScale, totalScale, 1);
72947827 }
72957828 break;
72967829 }
....@@ -7324,7 +7857,7 @@
73247857 } // NEW ...
73257858
73267859
7327
- info.pane.repaint();
7860
+ clickInfo.pane.repaint();
73287861 }
73297862
73307863 boolean overflow = false;
....@@ -7431,7 +7964,7 @@
74317964 objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
74327965 } else
74337966 {
7434
- objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
7967
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
74357968 } // + super.toString();
74367969 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
74377970
....@@ -7504,6 +8037,10 @@
75048037 editWindow = null;
75058038 } // ?
75068039 }
8040
+ else
8041
+ {
8042
+ //editWindow.closeUI();
8043
+ }
75078044 }
75088045
75098046 boolean root; // patch for edit windows
....@@ -7515,7 +8052,7 @@
75158052 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
75168053
75178054 Object3D /*Composite*/ parent;
7518
- Object3D /*Composite*/ fileparent;
8055
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
75198056
75208057 double[][] toParent; // dynamic matrix
75218058 double[][] fromParent;
....@@ -7661,6 +8198,10 @@
76618198 }
76628199
76638200 transient ObjEditor editWindow;
8201
+ transient ObjEditor manipWindow;
8202
+
8203
+ transient boolean pinned;
8204
+
76648205 transient ObjectUI objectUI;
76658206 public static int povDepth = 0;
76668207 private static cVector tbMin = new cVector();
....@@ -7679,9 +8220,9 @@
76798220 private static cVector edge2 = new cVector();
76808221 //private static cVector norm = new cVector();
76818222 /*transient private*/ int hitSomething;
7682
- private static final int hitCenter = 1;
7683
- private static final int hitScale = 2;
7684
- private static final int hitRotate = 3;
8223
+ static final int hitCenter = 1;
8224
+ static final int hitScale = 2;
8225
+ static final int hitRotate = 3;
76858226 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
76868227 /*transient*/ private Point centerPt;
76878228 /*transient*/ private int startX;