Normand Briere
2019-06-23 f1382bc839a74ef1d1534c61ea94e53cf54716df
Object3D.java
....@@ -14,11 +14,20 @@
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;
24
+
25
+ private UUID uuid = UUID.randomUUID();
26
+
27
+ // TEMPORARY for mocap undo
28
+ mocap.reader.BVHReader.BVHResult bvh;
29
+ Object3D skeleton;
30
+ //
2231
2332 ScriptNode scriptnode;
2433
....@@ -100,64 +109,136 @@
100109
101110 // transient boolean reduced; // for morph reduction
102111
103
-transient com.bulletphysics.linearmath.Transform cache; // for fast merge
104
-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
105114
106
-transient Object3D transientsupport; // for cloning
107
-transient boolean transientlink2master;
115
+ transient Object3D transientsupport; // for cloning
116
+ transient boolean transientlink2master;
108117
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)
118
+ void SaveSupports()
121119 {
122
- bRep.SaveSupports();
123
- }
124
-
125
- for (int i = 0; i < Size(); i++)
126
- {
127
- Object3D child = (Object3D) get(i);
128
- if (child == null)
129
- continue;
130
- blockloop = true;
131
- child.SaveSupports();
132
- blockloop = false;
133
- }
134
-}
120
+ if (blockloop)
121
+ return;
135122
136
-void RestoreSupports()
137
-{
138
- if (blockloop)
139
- return;
123
+ transientsupport = support;
124
+ transientlink2master = link2master;
140125
141
- support = transientsupport;
142
- link2master = transientlink2master;
143
- transientsupport = null;
144
- transientlink2master = false;
145
-
146
- if (bRep != null)
147
- {
148
- 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
+ }
149143 }
150
-
151
- for (int i = 0; i < Size(); i++)
144
+
145
+ void RestoreSupports()
152146 {
153
- Object3D child = (Object3D) get(i);
154
- if (child == null)
155
- continue;
156
- blockloop = true;
157
- child.RestoreSupports();
158
- 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
+ }
159169 }
160
-}
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
+ }
161242
162243 // MOCAP SUPPORT
163244 double tx,ty,tz,rx,ry,rz;
....@@ -300,6 +381,7 @@
300381 }
301382
302383 boolean live = false;
384
+ boolean dontselect = false;
303385 boolean hide = false;
304386 boolean link2master = false; // performs reset support/master at each frame
305387 boolean marked = false; // animation node
....@@ -481,12 +563,14 @@
481563 toParent = LA.newMatrix();
482564 fromParent = LA.newMatrix();
483565 }
566
+
484567 if (toParentMarked == null)
485568 {
486569 if (maxcount != 1)
487570 {
488571 new Exception().printStackTrace();
489572 }
573
+
490574 toParentMarked = LA.newMatrix();
491575 fromParentMarked = LA.newMatrix();
492576 }
....@@ -774,7 +858,7 @@
774858 if (step == 0)
775859 step = 1;
776860 if (maxcount == 0)
777
- maxcount = 2048; // 4;
861
+ maxcount = 128; // 2048; // 4;
778862 // if (acceleration == 0)
779863 // acceleration = 10;
780864 if (delay == 0) // serial
....@@ -809,7 +893,8 @@
809893
810894 boolean changedir = random && Math.random() < 0.01; // && !link2master;
811895
812
- if (transformcount*factor > maxcount || (step == 1 && changedir))
896
+ if (transformcount*factor >= maxcount && (rewind || random) ||
897
+ (step == 1 && changedir))
813898 {
814899 countdown = 1;
815900 delay = speedup?8:1;
....@@ -1834,12 +1919,15 @@
18341919 if (obj.name == null)
18351920 continue; // can't be a null one
18361921
1922
+ // Try perfect match first.
18371923 if (n.equals(obj.name))
18381924 {
18391925 theobj = obj;
18401926 count++;
18411927 }
18421928 }
1929
+
1930
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18431931
18441932 if (count != 1)
18451933 for (int i=Size(); --i>=0;)
....@@ -2299,6 +2387,10 @@
22992387 }
23002388 */
23012389 }
2390
+ else
2391
+ {
2392
+ //((ObjEditor)editWindow).SetupUI2(null);
2393
+ }
23022394 }
23032395
23042396 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2624,6 +2716,18 @@
26242716 //Touch();
26252717 }
26262718
2719
+ void GenNormalsMeshS()
2720
+ {
2721
+ selection.GenNormalsMesh();
2722
+// for (int i=0; i<selection.size(); i++)
2723
+// {
2724
+// Object3D selectee = (Object3D) selection.elementAt(i);
2725
+// selectee.GenNormals(crease);
2726
+// }
2727
+
2728
+ //Touch();
2729
+ }
2730
+
26272731 void ClearColorsS()
26282732 {
26292733 selection.ClearColors();
....@@ -2755,6 +2859,24 @@
27552859 if (child == null)
27562860 continue;
27572861 child.GenNormals(crease);
2862
+// Children().release(i);
2863
+ }
2864
+ blockloop = false;
2865
+ }
2866
+
2867
+ void GenNormalsMesh()
2868
+ {
2869
+ if (blockloop)
2870
+ return;
2871
+
2872
+ blockloop = true;
2873
+ GenNormalsMesh0();
2874
+ for (int i = 0; i < Children().Size(); i++)
2875
+ {
2876
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2877
+ if (child == null)
2878
+ continue;
2879
+ child.GenNormalsMesh();
27582880 // Children().release(i);
27592881 }
27602882 blockloop = false;
....@@ -2927,6 +3049,15 @@
29273049 }
29283050 }
29293051
3052
+ void GenNormalsMesh0()
3053
+ {
3054
+ if (bRep != null)
3055
+ {
3056
+ bRep.GenerateNormalsMesh();
3057
+ Touch();
3058
+ }
3059
+ }
3060
+
29303061 void GenNormalsMINE0()
29313062 {
29323063 if (bRep != null)
....@@ -3002,8 +3133,10 @@
30023133 v.fromParent = LA.newMatrix();
30033134 }
30043135
3005
- LA.matConcat(v.toParent, toParent, v.toParent);
3006
- LA.matConcat(fromParent, v.fromParent, v.fromParent);
3136
+// LA.matConcat(v.toParent, toParent, v.toParent);
3137
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3138
+ LA.matConcat(toParent, v.toParent, v.toParent);
3139
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
30073140 }
30083141
30093142 toParent = null; // LA.matIdentity(toParent);
....@@ -3236,7 +3369,9 @@
32363369 bRep.support = null;
32373370 BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32383371 // bRep.SplitInTwo(onlyone); // thread...
3239
- temprep.SplitInTwo(reduction34, onlyone);
3372
+
3373
+ while(temprep.SplitInTwo(reduction34, onlyone));
3374
+
32403375 bRep = temprep;
32413376 bRep.support = sup;
32423377 Touch();
....@@ -3373,7 +3508,8 @@
33733508 if (blockloop)
33743509 return;
33753510
3376
- if (marked || (bRep != null && material != null)) // borderline...
3511
+ if (//marked || // does not make sense
3512
+ (bRep != null || material != null)) // borderline...
33773513 live = h;
33783514
33793515 for (int i = 0; i < Size(); i++)
....@@ -3394,7 +3530,8 @@
33943530 return;
33953531
33963532 //if (bRep != null)
3397
- if (marked || (bRep != null && material != null)) // borderline...
3533
+ if (//marked || // does not make sense
3534
+ (bRep != null || material != null)) // borderline...
33983535 link2master = h;
33993536
34003537 for (int i = 0; i < Size(); i++)
....@@ -3414,7 +3551,8 @@
34143551 if (blockloop)
34153552 return;
34163553
3417
- if (marked || (bRep != null && material != null)) // borderline...
3554
+ if (//marked || // does not make sense
3555
+ (bRep != null || material != null)) // borderline...
34183556 hide = h;
34193557
34203558 for (int i = 0; i < Size(); i++)
....@@ -3434,7 +3572,7 @@
34343572 if (blockloop)
34353573 return;
34363574
3437
- if (bRep != null && material != null) // borderline...
3575
+ if (bRep != null || material != null) // borderline...
34383576 marked = h;
34393577
34403578 for (int i = 0; i < Size(); i++)
....@@ -3444,6 +3582,46 @@
34443582 continue;
34453583 blockloop = true;
34463584 child.MarkLeaves(h);
3585
+ blockloop = false;
3586
+ // release(i);
3587
+ }
3588
+ }
3589
+
3590
+ void RewindLeaves(boolean h)
3591
+ {
3592
+ if (blockloop)
3593
+ return;
3594
+
3595
+ if (bRep != null || material != null) // borderline...
3596
+ rewind = h;
3597
+
3598
+ for (int i = 0; i < Size(); i++)
3599
+ {
3600
+ Object3D child = (Object3D) get(i); // reserve(i);
3601
+ if (child == null)
3602
+ continue;
3603
+ blockloop = true;
3604
+ child.RewindLeaves(h);
3605
+ blockloop = false;
3606
+ // release(i);
3607
+ }
3608
+ }
3609
+
3610
+ void RandomLeaves(boolean h)
3611
+ {
3612
+ if (blockloop)
3613
+ return;
3614
+
3615
+ if (bRep != null || material != null) // borderline...
3616
+ random = h;
3617
+
3618
+ for (int i = 0; i < Size(); i++)
3619
+ {
3620
+ Object3D child = (Object3D) get(i); // reserve(i);
3621
+ if (child == null)
3622
+ continue;
3623
+ blockloop = true;
3624
+ child.RandomLeaves(h);
34473625 blockloop = false;
34483626 // release(i);
34493627 }
....@@ -4221,6 +4399,55 @@
42214399 }
42224400 }
42234401
4402
+ void RepairSOV()
4403
+ {
4404
+ if (blockloop)
4405
+ return;
4406
+
4407
+ String texname = this.GetPigmentTexture();
4408
+
4409
+ if (texname.startsWith("sov"))
4410
+ {
4411
+ String[] s = texname.split("/");
4412
+
4413
+ String[] sname = s[1].split("Color.pn");
4414
+
4415
+ texname = sname[0];
4416
+
4417
+ if (sname.length > 1)
4418
+ {
4419
+ texname += "Color.jpg";
4420
+ }
4421
+
4422
+ this.SetPigmentTexture("sov/" + texname);
4423
+ }
4424
+
4425
+ texname = this.GetBumpTexture();
4426
+
4427
+ if (texname.startsWith("sov"))
4428
+ {
4429
+ String[] s = texname.split("/");
4430
+
4431
+ String[] sname = s[1].split("Bump.pn");
4432
+
4433
+ texname = sname[0];
4434
+
4435
+ if (sname.length > 1)
4436
+ {
4437
+ texname += "Bump.jpg";
4438
+ }
4439
+
4440
+ this.SetBumpTexture("sov/" + texname);
4441
+ }
4442
+
4443
+ for (int i=0; i<Size(); i++)
4444
+ {
4445
+ blockloop = true;
4446
+ get(i).RepairSOV();
4447
+ blockloop = false;
4448
+ }
4449
+ }
4450
+
42244451 void RepairTexture()
42254452 {
42264453 if (this instanceof FileObject || blockloop)
....@@ -4711,7 +4938,7 @@
47114938
47124939 cTreePath SelectLeaf(int indexcount, boolean deselect)
47134940 {
4714
- if (hide)
4941
+ if (hide || dontselect)
47154942 return null;
47164943
47174944 if (count <= 0)
....@@ -4737,7 +4964,7 @@
47374964
47384965 cTreePath Select(int indexcount, boolean deselect)
47394966 {
4740
- if (hide)
4967
+ if (hide || dontselect)
47414968 return null;
47424969
47434970 if (count <= 0)
....@@ -5363,6 +5590,43 @@
53635590 }
53645591 }
53655592
5593
+ UUID GetUUID()
5594
+ {
5595
+ if (uuid == null)
5596
+ {
5597
+ // Serial
5598
+ uuid = UUID.randomUUID();
5599
+ }
5600
+
5601
+ return uuid;
5602
+ }
5603
+
5604
+ Object3D GetObject(UUID uid)
5605
+ {
5606
+ if (blockloop)
5607
+ return null;
5608
+
5609
+ if (GetUUID().equals(uid))
5610
+ return this;
5611
+
5612
+ int nb = Size();
5613
+ for (int i = 0; i < nb; i++)
5614
+ {
5615
+ Object3D child = (Object3D) get(i);
5616
+
5617
+ if (child == null)
5618
+ continue;
5619
+
5620
+ blockloop = true;
5621
+ Object3D obj = child.GetObject(uid);
5622
+ blockloop = false;
5623
+ if (obj != null)
5624
+ return obj;
5625
+ }
5626
+
5627
+ return null;
5628
+ }
5629
+
53665630 void SetBumpTexture(String tex)
53675631 {
53685632 if (GetTextures() == null)
....@@ -5407,12 +5671,23 @@
54075671 boolean NeedSupport()
54085672 {
54095673 return
5410
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5674
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
54115675 // PROBLEM with CROWD!!
54125676 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
54135677 }
54145678
54155679 static boolean DEBUG_SELECTION = false;
5680
+
5681
+ boolean IsLive()
5682
+ {
5683
+ if (live)
5684
+ return true;
5685
+
5686
+ if (parent == null)
5687
+ return false;
5688
+
5689
+ return parent.IsLive();
5690
+ }
54165691
54175692 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
54185693 {
....@@ -5424,7 +5699,7 @@
54245699 }
54255700
54265701 if (display.DrawMode() == iCameraPane.SELECTION &&
5427
- hide)
5702
+ (hide || dontselect))
54285703 return;
54295704
54305705 if (name != null && name.contains("sclera"))
....@@ -5475,7 +5750,7 @@
54755750 support = support;
54765751
54775752 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5478
- boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5753
+ boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
54795754
54805755 if (!usecalllists && bRep != null && bRep.displaylist > 0)
54815756 {
....@@ -5495,10 +5770,12 @@
54955770 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
54965771
54975772 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5498
- (touched || (bRep != null && bRep.displaylist <= 0)))
5773
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5774
+ (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
54995775 {
55005776 Globals.lighttouched = true;
55015777 } // all panes...
5778
+
55025779 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
55035780 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
55045781 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5666,7 +5943,28 @@
56665943 tex = GetTextures();
56675944 }
56685945
5669
- display.BindTextures(tex, texres);
5946
+ boolean failedPigment = false;
5947
+ boolean failedBump = false;
5948
+
5949
+ try
5950
+ {
5951
+ display.BindPigmentTexture(tex, texres);
5952
+ }
5953
+ catch (Exception e)
5954
+ {
5955
+ System.err.println("FAILED: " + this);
5956
+ failedPigment = true;
5957
+ }
5958
+
5959
+ try
5960
+ {
5961
+ display.BindBumpTexture(tex, texres);
5962
+ }
5963
+ catch (Exception e)
5964
+ {
5965
+ //System.err.println("FAILED: " + this);
5966
+ failedBump = true;
5967
+ }
56705968
56715969 if (!compiled)
56725970 {
....@@ -5688,7 +5986,11 @@
56885986 }
56895987 }
56905988
5691
- display.ReleaseTextures(tex);
5989
+ if (!failedBump)
5990
+ display.ReleaseBumpTexture(tex);
5991
+
5992
+ if (!failedPigment)
5993
+ display.ReleasePigmentTexture(tex);
56925994
56935995 display.PopMaterial(this, selected);
56945996 }
....@@ -5817,6 +6119,9 @@
58176119
58186120 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
58196121 {
6122
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6123
+ return;
6124
+
58206125 if (hide)
58216126 return;
58226127 // shadow optimisation
....@@ -5942,6 +6247,9 @@
59426247 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
59436248 return; // no shadow for transparent objects
59446249
6250
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6251
+ return;
6252
+
59456253 if (hide)
59466254 return;
59476255
....@@ -6055,6 +6363,11 @@
60556363 // dec 2012
60566364 new Exception().printStackTrace();
60576365 return;
6366
+ }
6367
+
6368
+ if (dontselect)
6369
+ {
6370
+ //bRep.GenerateNormalsMINE();
60586371 }
60596372
60606373 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -6907,7 +7220,7 @@
69077220 spot.translate(32, 32);
69087221 spotw = spot.x + spot.width;
69097222 spoth = spot.y + spot.height;
6910
- info.g.setColor(Color.blue);
7223
+ info.g.setColor(Color.cyan);
69117224 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
69127225 // if (CameraPane.Xmin > spot.x)
69137226 // {
....@@ -6925,11 +7238,12 @@
69257238 // {
69267239 // CameraPane.Ymax = spoth;
69277240 // }
6928
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
6929
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7241
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7242
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
69307243 spot.translate(0, -32);
6931
- info.g.setColor(Color.green);
7244
+ info.g.setColor(Color.yellow);
69327245 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7246
+ info.g.setColor(Color.green);
69337247 // if (CameraPane.Xmin > spot.x)
69347248 // {
69357249 // CameraPane.Xmin = spot.x;
....@@ -6981,7 +7295,7 @@
69817295 startX = info.x;
69827296 startY = info.y;
69837297
6984
- hitSomething = 0;
7298
+ hitSomething = -1;
69857299 cVector origin = new cVector();
69867300 //LA.xformPos(origin, toParent, origin);
69877301 Rectangle spot = new Rectangle();
....@@ -7057,6 +7371,7 @@
70577371 //System.out.println("hitSomething = " + hitSomething);
70587372
70597373 double scale = 0.005f * info.camera.Distance();
7374
+
70607375 cVector xlate = new cVector();
70617376 //cVector xlate2 = new cVector();
70627377 switch (hitSomething)
....@@ -7205,24 +7520,27 @@
72057520
72067521 case hitScale: // scale
72077522 double hScale = (double) (info.x - centerPt.x) / 32;
7523
+ double sign = 1;
7524
+ if (hScale < 0)
7525
+ {
7526
+ sign = -1;
7527
+ }
7528
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
72087529 if (hScale < 0.01)
72097530 {
7210
- hScale = 0.01;
7531
+ //hScale = 0.01;
72117532 }
7212
- hScale = Math.pow(hScale, scale * 50);
7213
- if (hScale < 0.01)
7214
- {
7215
- hScale = 0.01;
7216
- }
7533
+
72177534 double vScale = (double) (info.y - centerPt.y) / 32;
7218
- if (vScale < 0.01)
7535
+ sign = 1;
7536
+ if (vScale < 0)
72197537 {
7220
- vScale = 0.01;
7538
+ sign = -1;
72217539 }
7222
- vScale = Math.pow(vScale, scale * 50);
7540
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
72237541 if (vScale < 0.01)
72247542 {
7225
- vScale = 0.01;
7543
+ //vScale = 0.01;
72267544 }
72277545 LA.matCopy(startMat, toParent);
72287546 /**/
....@@ -7233,39 +7551,47 @@
72337551 }
72347552 /**/
72357553
7554
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7555
+
7556
+ if (totalScale < 0.01)
7557
+ {
7558
+ totalScale = 0.01;
7559
+ }
7560
+
72367561 switch (info.pane.RenderCamera().viewCode)
72377562 {
72387563 case 3: // '\001'
7239
- if (modified)
7564
+ if (modified || opposite)
72407565 {
72417566 //LA.matScale(toParent, 1, hScale, vScale);
7242
- LA.matScale(toParent, vScale, 1, 1);
7567
+ LA.matScale(toParent, totalScale, 1, 1);
72437568 } // vScale, 1);
72447569 else
72457570 {
7246
- LA.matScale(toParent, vScale, vScale, vScale);
7571
+ // EXCEPTION!
7572
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
72477573 } // vScale, 1);
72487574 break;
72497575
72507576 case 2: // '\002'
7251
- if (modified)
7577
+ if (modified || opposite)
72527578 {
72537579 //LA.matScale(toParent, hScale, 1, vScale);
7254
- LA.matScale(toParent, 1, vScale, 1);
7580
+ LA.matScale(toParent, 1, totalScale, 1);
72557581 } else
72567582 {
7257
- LA.matScale(toParent, vScale, 1, vScale);
7583
+ LA.matScale(toParent, totalScale, 1, totalScale);
72587584 }
72597585 break;
72607586
72617587 case 1: // '\003'
7262
- if (modified)
7588
+ if (modified || opposite)
72637589 {
72647590 //LA.matScale(toParent, hScale, vScale, 1);
7265
- LA.matScale(toParent, 1, 1, vScale);
7591
+ LA.matScale(toParent, 1, 1, totalScale);
72667592 } else
72677593 {
7268
- LA.matScale(toParent, vScale, vScale, 1);
7594
+ LA.matScale(toParent, totalScale, totalScale, 1);
72697595 }
72707596 break;
72717597 }
....@@ -7406,7 +7732,7 @@
74067732 objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
74077733 } else
74087734 {
7409
- objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
7735
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
74107736 } // + super.toString();
74117737 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
74127738
....@@ -7479,6 +7805,10 @@
74797805 editWindow = null;
74807806 } // ?
74817807 }
7808
+ else
7809
+ {
7810
+ //editWindow.closeUI();
7811
+ }
74827812 }
74837813
74847814 boolean root; // patch for edit windows
....@@ -7490,7 +7820,7 @@
74907820 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
74917821
74927822 Object3D /*Composite*/ parent;
7493
- Object3D /*Composite*/ fileparent;
7823
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
74947824
74957825 double[][] toParent; // dynamic matrix
74967826 double[][] fromParent;
....@@ -7654,9 +7984,9 @@
76547984 private static cVector edge2 = new cVector();
76557985 //private static cVector norm = new cVector();
76567986 /*transient private*/ int hitSomething;
7657
- private static final int hitCenter = 1;
7658
- private static final int hitScale = 2;
7659
- private static final int hitRotate = 3;
7987
+ static final int hitCenter = 1;
7988
+ static final int hitScale = 2;
7989
+ static final int hitRotate = 3;
76607990 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
76617991 /*transient*/ private Point centerPt;
76627992 /*transient*/ private int startX;