Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
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,143 @@
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();
120
+ if (blockloop)
121
+ return;
122
+
123
+ transientsupport = support;
124
+ transientlink2master = link2master;
125
+
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
+ }
123143 }
124
-
125
- for (int i = 0; i < Size(); i++)
144
+
145
+ void RestoreSupports()
126146 {
127
- Object3D child = (Object3D) get(i);
128
- if (child == null)
129
- continue;
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
+ }
169
+ }
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("copy of " + this.name);
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
+ if (blockloop)
223
+ return;
224
+
130225 blockloop = true;
131
- child.SaveSupports();
226
+
227
+ Object3D o = hashtable.get(GetUUID());
228
+
229
+ RestoreBigData(o);
230
+
231
+ //hashtable.remove(GetUUID());
232
+
233
+ for (int i=0; i<Size(); i++)
234
+ {
235
+ get(i).RestoreBigData(hashtable);
236
+ }
237
+
132238 blockloop = false;
133239 }
134
-}
135240
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)
241
+ void RestoreBigData(Object3D o)
147242 {
148
- bRep.RestoreSupports();
243
+ this.bRep = o.bRep;
244
+ if (this.bRep != null)
245
+ this.bRep.support = o.transientrep;
246
+ // this.support = o.support;
247
+ // this.fileparent = o.fileparent;
149248 }
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
-}
161249
162250 // MOCAP SUPPORT
163251 double tx,ty,tz,rx,ry,rz;
....@@ -482,12 +570,14 @@
482570 toParent = LA.newMatrix();
483571 fromParent = LA.newMatrix();
484572 }
573
+
485574 if (toParentMarked == null)
486575 {
487576 if (maxcount != 1)
488577 {
489578 new Exception().printStackTrace();
490579 }
580
+
491581 toParentMarked = LA.newMatrix();
492582 fromParentMarked = LA.newMatrix();
493583 }
....@@ -775,7 +865,7 @@
775865 if (step == 0)
776866 step = 1;
777867 if (maxcount == 0)
778
- maxcount = 2048; // 4;
868
+ maxcount = 128; // 2048; // 4;
779869 // if (acceleration == 0)
780870 // acceleration = 10;
781871 if (delay == 0) // serial
....@@ -798,7 +888,7 @@
798888
799889 if (marked && Globals.isLIVE() && live &&
800890 //TEMP21aug2018
801
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
891
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
802892 currentframe != Globals.framecount)
803893 {
804894 currentframe = Globals.framecount;
....@@ -810,7 +900,8 @@
810900
811901 boolean changedir = random && Math.random() < 0.01; // && !link2master;
812902
813
- if (transformcount*factor > maxcount || (step == 1 && changedir))
903
+ if (transformcount*factor >= maxcount && (rewind || random) ||
904
+ (step == 1 && changedir))
814905 {
815906 countdown = 1;
816907 delay = speedup?8:1;
....@@ -882,6 +973,7 @@
882973 if (material == null || material.multiply)
883974 return true;
884975
976
+ // Transparent objects are dynamic because we have to sort the triangles.
885977 return material.opacity > 0.99;
886978 }
887979
....@@ -2303,6 +2395,10 @@
23032395 }
23042396 */
23052397 }
2398
+ else
2399
+ {
2400
+ //((ObjEditor)editWindow).SetupUI2(null);
2401
+ }
23062402 }
23072403
23082404 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2344,6 +2440,14 @@
23442440 {
23452441 editWindow.refreshContents();
23462442 }
2443
+ else
2444
+ {
2445
+ if (manipWindow != null)
2446
+ {
2447
+ manipWindow.refreshContents();
2448
+ }
2449
+ }
2450
+
23472451 //if (parent != null)
23482452 //parent.refreshEditWindow();
23492453 }
....@@ -2628,6 +2732,18 @@
26282732 //Touch();
26292733 }
26302734
2735
+ void GenNormalsMeshS()
2736
+ {
2737
+ selection.GenNormalsMesh();
2738
+// for (int i=0; i<selection.size(); i++)
2739
+// {
2740
+// Object3D selectee = (Object3D) selection.elementAt(i);
2741
+// selectee.GenNormals(crease);
2742
+// }
2743
+
2744
+ //Touch();
2745
+ }
2746
+
26312747 void ClearColorsS()
26322748 {
26332749 selection.ClearColors();
....@@ -2759,6 +2875,24 @@
27592875 if (child == null)
27602876 continue;
27612877 child.GenNormals(crease);
2878
+// Children().release(i);
2879
+ }
2880
+ blockloop = false;
2881
+ }
2882
+
2883
+ void GenNormalsMesh()
2884
+ {
2885
+ if (blockloop)
2886
+ return;
2887
+
2888
+ blockloop = true;
2889
+ GenNormalsMesh0();
2890
+ for (int i = 0; i < Children().Size(); i++)
2891
+ {
2892
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2893
+ if (child == null)
2894
+ continue;
2895
+ child.GenNormalsMesh();
27622896 // Children().release(i);
27632897 }
27642898 blockloop = false;
....@@ -2927,6 +3061,15 @@
29273061 if (bRep != null)
29283062 {
29293063 bRep.GenerateNormals(crease);
3064
+ Touch();
3065
+ }
3066
+ }
3067
+
3068
+ void GenNormalsMesh0()
3069
+ {
3070
+ if (bRep != null)
3071
+ {
3072
+ bRep.GenerateNormalsMesh();
29303073 Touch();
29313074 }
29323075 }
....@@ -3381,7 +3524,8 @@
33813524 if (blockloop)
33823525 return;
33833526
3384
- if (marked || (bRep != null && material != null)) // borderline...
3527
+ if (//marked || // does not make sense
3528
+ (bRep != null || material != null)) // borderline...
33853529 live = h;
33863530
33873531 for (int i = 0; i < Size(); i++)
....@@ -3402,7 +3546,8 @@
34023546 return;
34033547
34043548 //if (bRep != null)
3405
- if (marked || (bRep != null && material != null)) // borderline...
3549
+ if (//marked || // does not make sense
3550
+ (bRep != null || material != null)) // borderline...
34063551 link2master = h;
34073552
34083553 for (int i = 0; i < Size(); i++)
....@@ -3422,7 +3567,8 @@
34223567 if (blockloop)
34233568 return;
34243569
3425
- if (marked || (bRep != null && material != null)) // borderline...
3570
+ if (//marked || // does not make sense
3571
+ (bRep != null || material != null)) // borderline...
34263572 hide = h;
34273573
34283574 for (int i = 0; i < Size(); i++)
....@@ -3442,7 +3588,7 @@
34423588 if (blockloop)
34433589 return;
34443590
3445
- if (bRep != null && material != null) // borderline...
3591
+ if (bRep != null || material != null) // borderline...
34463592 marked = h;
34473593
34483594 for (int i = 0; i < Size(); i++)
....@@ -3452,6 +3598,46 @@
34523598 continue;
34533599 blockloop = true;
34543600 child.MarkLeaves(h);
3601
+ blockloop = false;
3602
+ // release(i);
3603
+ }
3604
+ }
3605
+
3606
+ void RewindLeaves(boolean h)
3607
+ {
3608
+ if (blockloop)
3609
+ return;
3610
+
3611
+ if (bRep != null || material != null) // borderline...
3612
+ rewind = h;
3613
+
3614
+ for (int i = 0; i < Size(); i++)
3615
+ {
3616
+ Object3D child = (Object3D) get(i); // reserve(i);
3617
+ if (child == null)
3618
+ continue;
3619
+ blockloop = true;
3620
+ child.RewindLeaves(h);
3621
+ blockloop = false;
3622
+ // release(i);
3623
+ }
3624
+ }
3625
+
3626
+ void RandomLeaves(boolean h)
3627
+ {
3628
+ if (blockloop)
3629
+ return;
3630
+
3631
+ if (bRep != null || material != null) // borderline...
3632
+ random = h;
3633
+
3634
+ for (int i = 0; i < Size(); i++)
3635
+ {
3636
+ Object3D child = (Object3D) get(i); // reserve(i);
3637
+ if (child == null)
3638
+ continue;
3639
+ blockloop = true;
3640
+ child.RandomLeaves(h);
34553641 blockloop = false;
34563642 // release(i);
34573643 }
....@@ -4229,6 +4415,55 @@
42294415 }
42304416 }
42314417
4418
+ void RepairSOV()
4419
+ {
4420
+ if (blockloop)
4421
+ return;
4422
+
4423
+ String texname = this.GetPigmentTexture();
4424
+
4425
+ if (texname.startsWith("sov"))
4426
+ {
4427
+ String[] s = texname.split("/");
4428
+
4429
+ String[] sname = s[1].split("Color.pn");
4430
+
4431
+ texname = sname[0];
4432
+
4433
+ if (sname.length > 1)
4434
+ {
4435
+ texname += "Color.jpg";
4436
+ }
4437
+
4438
+ this.SetPigmentTexture("sov/" + texname);
4439
+ }
4440
+
4441
+ texname = this.GetBumpTexture();
4442
+
4443
+ if (texname.startsWith("sov"))
4444
+ {
4445
+ String[] s = texname.split("/");
4446
+
4447
+ String[] sname = s[1].split("Bump.pn");
4448
+
4449
+ texname = sname[0];
4450
+
4451
+ if (sname.length > 1)
4452
+ {
4453
+ texname += "Bump.jpg";
4454
+ }
4455
+
4456
+ this.SetBumpTexture("sov/" + texname);
4457
+ }
4458
+
4459
+ for (int i=0; i<Size(); i++)
4460
+ {
4461
+ blockloop = true;
4462
+ get(i).RepairSOV();
4463
+ blockloop = false;
4464
+ }
4465
+ }
4466
+
42324467 void RepairTexture()
42334468 {
42344469 if (this instanceof FileObject || blockloop)
....@@ -4743,6 +4978,14 @@
47434978 }
47444979 }
47454980
4981
+ ObjEditor GetWindow()
4982
+ {
4983
+ if (editWindow != null)
4984
+ return editWindow;
4985
+
4986
+ return manipWindow;
4987
+ }
4988
+
47464989 cTreePath Select(int indexcount, boolean deselect)
47474990 {
47484991 if (hide || dontselect)
....@@ -4779,10 +5022,11 @@
47795022 if (leaf != null)
47805023 {
47815024 cTreePath tp = new cTreePath(this, leaf);
4782
- if (editWindow != null)
5025
+ ObjEditor window = GetWindow();
5026
+ if (window != null)
47835027 {
47845028 //System.out.println("editWindow = " + editWindow + " vs " + this);
4785
- editWindow.Select(tp, deselect, true);
5029
+ window.Select(tp, deselect, true);
47865030 }
47875031
47885032 return tp;
....@@ -4808,9 +5052,10 @@
48085052 if (leaf != null)
48095053 {
48105054 cTreePath tp = new cTreePath(this, leaf);
4811
- if (editWindow != null)
5055
+ ObjEditor window = GetWindow();
5056
+ if (window != null)
48125057 {
4813
- editWindow.Select(tp, deselect, true);
5058
+ window.Select(tp, deselect, true);
48145059 }
48155060
48165061 return tp;
....@@ -5371,6 +5616,43 @@
53715616 }
53725617 }
53735618
5619
+ UUID GetUUID()
5620
+ {
5621
+ if (uuid == null)
5622
+ {
5623
+ // Serial
5624
+ uuid = UUID.randomUUID();
5625
+ }
5626
+
5627
+ return uuid;
5628
+ }
5629
+
5630
+ Object3D GetObject(UUID uid)
5631
+ {
5632
+ if (blockloop)
5633
+ return null;
5634
+
5635
+ if (GetUUID().equals(uid))
5636
+ return this;
5637
+
5638
+ int nb = Size();
5639
+ for (int i = 0; i < nb; i++)
5640
+ {
5641
+ Object3D child = (Object3D) get(i);
5642
+
5643
+ if (child == null)
5644
+ continue;
5645
+
5646
+ blockloop = true;
5647
+ Object3D obj = child.GetObject(uid);
5648
+ blockloop = false;
5649
+ if (obj != null)
5650
+ return obj;
5651
+ }
5652
+
5653
+ return null;
5654
+ }
5655
+
53745656 void SetBumpTexture(String tex)
53755657 {
53765658 if (GetTextures() == null)
....@@ -5415,12 +5697,23 @@
54155697 boolean NeedSupport()
54165698 {
54175699 return
5418
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5700
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
54195701 // PROBLEM with CROWD!!
54205702 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
54215703 }
54225704
54235705 static boolean DEBUG_SELECTION = false;
5706
+
5707
+ boolean IsLive()
5708
+ {
5709
+ if (live)
5710
+ return true;
5711
+
5712
+ if (parent == null)
5713
+ return false;
5714
+
5715
+ return parent.IsLive();
5716
+ }
54245717
54255718 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
54265719 {
....@@ -5483,7 +5776,7 @@
54835776 support = support;
54845777
54855778 //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);
5779
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
54875780
54885781 if (!usecalllists && bRep != null && bRep.displaylist > 0)
54895782 {
....@@ -5503,10 +5796,12 @@
55035796 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
55045797
55055798 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5506
- (touched || (bRep != null && bRep.displaylist <= 0)))
5799
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5800
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched || (bRep != null && bRep.displaylist <= 0)))
55075801 {
55085802 Globals.lighttouched = true;
55095803 } // all panes...
5804
+
55105805 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
55115806 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
55125807 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5674,16 +5969,27 @@
56745969 tex = GetTextures();
56755970 }
56765971
5677
- boolean failed = false;
5972
+ boolean failedPigment = false;
5973
+ boolean failedBump = false;
56785974
56795975 try
56805976 {
5681
- display.BindTextures(tex, texres);
5977
+ display.BindPigmentTexture(tex, texres);
56825978 }
56835979 catch (Exception e)
56845980 {
56855981 System.err.println("FAILED: " + this);
5686
- failed = true;
5982
+ failedPigment = true;
5983
+ }
5984
+
5985
+ try
5986
+ {
5987
+ display.BindBumpTexture(tex, texres);
5988
+ }
5989
+ catch (Exception e)
5990
+ {
5991
+ //System.err.println("FAILED: " + this);
5992
+ failedBump = true;
56875993 }
56885994
56895995 if (!compiled)
....@@ -5706,8 +6012,11 @@
57066012 }
57076013 }
57086014
5709
- if (!failed)
5710
- display.ReleaseTextures(tex);
6015
+ if (!failedBump)
6016
+ display.ReleaseBumpTexture(tex);
6017
+
6018
+ if (!failedPigment)
6019
+ display.ReleasePigmentTexture(tex);
57116020
57126021 display.PopMaterial(this, selected);
57136022 }
....@@ -6080,6 +6389,11 @@
60806389 // dec 2012
60816390 new Exception().printStackTrace();
60826391 return;
6392
+ }
6393
+
6394
+ if (dontselect)
6395
+ {
6396
+ //bRep.GenerateNormalsMINE();
60836397 }
60846398
60856399 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -6932,7 +7246,7 @@
69327246 spot.translate(32, 32);
69337247 spotw = spot.x + spot.width;
69347248 spoth = spot.y + spot.height;
6935
- info.g.setColor(Color.blue);
7249
+ info.g.setColor(Color.cyan);
69367250 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
69377251 // if (CameraPane.Xmin > spot.x)
69387252 // {
....@@ -6950,11 +7264,12 @@
69507264 // {
69517265 // CameraPane.Ymax = spoth;
69527266 // }
6953
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
6954
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7267
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7268
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
69557269 spot.translate(0, -32);
6956
- info.g.setColor(Color.green);
7270
+ info.g.setColor(Color.yellow);
69577271 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7272
+ info.g.setColor(Color.green);
69587273 // if (CameraPane.Xmin > spot.x)
69597274 // {
69607275 // CameraPane.Xmin = spot.x;
....@@ -7006,7 +7321,7 @@
70067321 startX = info.x;
70077322 startY = info.y;
70087323
7009
- hitSomething = 0;
7324
+ hitSomething = -1;
70107325 cVector origin = new cVector();
70117326 //LA.xformPos(origin, toParent, origin);
70127327 Rectangle spot = new Rectangle();
....@@ -7082,6 +7397,7 @@
70827397 //System.out.println("hitSomething = " + hitSomething);
70837398
70847399 double scale = 0.005f * info.camera.Distance();
7400
+
70857401 cVector xlate = new cVector();
70867402 //cVector xlate2 = new cVector();
70877403 switch (hitSomething)
....@@ -7230,24 +7546,27 @@
72307546
72317547 case hitScale: // scale
72327548 double hScale = (double) (info.x - centerPt.x) / 32;
7549
+ double sign = 1;
7550
+ if (hScale < 0)
7551
+ {
7552
+ sign = -1;
7553
+ }
7554
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
72337555 if (hScale < 0.01)
72347556 {
7235
- hScale = 0.01;
7557
+ //hScale = 0.01;
72367558 }
7237
- hScale = Math.pow(hScale, scale * 50);
7238
- if (hScale < 0.01)
7239
- {
7240
- hScale = 0.01;
7241
- }
7559
+
72427560 double vScale = (double) (info.y - centerPt.y) / 32;
7243
- if (vScale < 0.01)
7561
+ sign = 1;
7562
+ if (vScale < 0)
72447563 {
7245
- vScale = 0.01;
7564
+ sign = -1;
72467565 }
7247
- vScale = Math.pow(vScale, scale * 50);
7566
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
72487567 if (vScale < 0.01)
72497568 {
7250
- vScale = 0.01;
7569
+ //vScale = 0.01;
72517570 }
72527571 LA.matCopy(startMat, toParent);
72537572 /**/
....@@ -7258,39 +7577,47 @@
72587577 }
72597578 /**/
72607579
7580
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7581
+
7582
+ if (totalScale < 0.01)
7583
+ {
7584
+ totalScale = 0.01;
7585
+ }
7586
+
72617587 switch (info.pane.RenderCamera().viewCode)
72627588 {
72637589 case 3: // '\001'
7264
- if (modified)
7590
+ if (modified || opposite)
72657591 {
72667592 //LA.matScale(toParent, 1, hScale, vScale);
7267
- LA.matScale(toParent, vScale, 1, 1);
7593
+ LA.matScale(toParent, totalScale, 1, 1);
72687594 } // vScale, 1);
72697595 else
72707596 {
7271
- LA.matScale(toParent, vScale, vScale, vScale);
7597
+ // EXCEPTION!
7598
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
72727599 } // vScale, 1);
72737600 break;
72747601
72757602 case 2: // '\002'
7276
- if (modified)
7603
+ if (modified || opposite)
72777604 {
72787605 //LA.matScale(toParent, hScale, 1, vScale);
7279
- LA.matScale(toParent, 1, vScale, 1);
7606
+ LA.matScale(toParent, 1, totalScale, 1);
72807607 } else
72817608 {
7282
- LA.matScale(toParent, vScale, 1, vScale);
7609
+ LA.matScale(toParent, totalScale, 1, totalScale);
72837610 }
72847611 break;
72857612
72867613 case 1: // '\003'
7287
- if (modified)
7614
+ if (modified || opposite)
72887615 {
72897616 //LA.matScale(toParent, hScale, vScale, 1);
7290
- LA.matScale(toParent, 1, 1, vScale);
7617
+ LA.matScale(toParent, 1, 1, totalScale);
72917618 } else
72927619 {
7293
- LA.matScale(toParent, vScale, vScale, 1);
7620
+ LA.matScale(toParent, totalScale, totalScale, 1);
72947621 }
72957622 break;
72967623 }
....@@ -7431,7 +7758,7 @@
74317758 objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
74327759 } else
74337760 {
7434
- objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
7761
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
74357762 } // + super.toString();
74367763 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
74377764
....@@ -7504,6 +7831,10 @@
75047831 editWindow = null;
75057832 } // ?
75067833 }
7834
+ else
7835
+ {
7836
+ //editWindow.closeUI();
7837
+ }
75077838 }
75087839
75097840 boolean root; // patch for edit windows
....@@ -7515,7 +7846,7 @@
75157846 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
75167847
75177848 Object3D /*Composite*/ parent;
7518
- Object3D /*Composite*/ fileparent;
7849
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
75197850
75207851 double[][] toParent; // dynamic matrix
75217852 double[][] fromParent;
....@@ -7661,6 +7992,10 @@
76617992 }
76627993
76637994 transient ObjEditor editWindow;
7995
+ transient ObjEditor manipWindow;
7996
+
7997
+ transient boolean pinned;
7998
+
76647999 transient ObjectUI objectUI;
76658000 public static int povDepth = 0;
76668001 private static cVector tbMin = new cVector();
....@@ -7679,9 +8014,9 @@
76798014 private static cVector edge2 = new cVector();
76808015 //private static cVector norm = new cVector();
76818016 /*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;
8017
+ static final int hitCenter = 1;
8018
+ static final int hitScale = 2;
8019
+ static final int hitRotate = 3;
76858020 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
76868021 /*transient*/ private Point centerPt;
76878022 /*transient*/ private int startX;