Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
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. No need to be transient.
28
+ mocap.reader.BVHReader.BVHResult savebvh;
29
+ Object3D saveskeleton;
30
+ //
2231
2332 ScriptNode scriptnode;
2433
....@@ -100,64 +109,170 @@
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
+ Object3D o;
174
+
175
+ if (hashtable.containsKey(GetUUID()))
176
+ {
177
+ o = hashtable.get(GetUUID());
178
+
179
+ Grafreed.Assert(this.bRep == o.bRep);
180
+ //if (this.bRep != null)
181
+ // assert(this.bRep.support == o.transientrep);
182
+ if (this.support != null)
183
+ assert(this.support.bRep == o.transientrep);
184
+ }
185
+ else
186
+ {
187
+ o = new Object3D("copy of " + this.name);
188
+
189
+ hashtable.put(GetUUID(), o);
190
+ }
191
+
192
+ if (!blockloop)
193
+ {
194
+ blockloop = true;
195
+
196
+ for (int i=0; i<Size(); i++)
197
+ {
198
+ get(i).ExtractBigData(hashtable);
199
+ }
200
+
201
+ blockloop = false;
202
+ }
203
+
204
+ ExtractBigData(o);
205
+ }
206
+
207
+ void ExtractBigData(Object3D o)
208
+ {
209
+ if (o.bRep != null)
210
+ Grafreed.Assert(o.bRep == this.bRep);
211
+
212
+ o.bRep = this.bRep;
213
+// July 2019 if (this.bRep != null)
214
+// {
215
+// o.transientrep = this.bRep.support;
216
+// o.bRep.support = null;
217
+// }
218
+
219
+ if (this.support != null)
220
+ {
221
+ if (o.transientrep != null)
222
+ Grafreed.Assert(o.transientrep == this.support.bRep);
223
+
224
+ o.transientrep = this.support.bRep;
225
+ this.support.bRep = null;
226
+ }
227
+
228
+ // o.support = this.support;
229
+ // o.fileparent = this.fileparent;
230
+ // if (this.bRep != null)
231
+ // o.bRep = this.bRep.support;
232
+
233
+ this.bRep = null;
234
+ // if (this.bRep != null)
235
+ // this.bRep.support = null;
236
+ // this.support = null;
237
+ // this.fileparent = null;
238
+ }
239
+
240
+ void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
241
+ {
242
+ if (!hashtable.containsKey(GetUUID()))
243
+ return;
244
+
245
+ Object3D o = hashtable.get(GetUUID());
246
+
247
+ RestoreBigData(o);
248
+
249
+ if (blockloop)
250
+ return;
251
+
130252 blockloop = true;
131
- child.SaveSupports();
253
+
254
+ //hashtable.remove(GetUUID());
255
+
256
+ for (int i=0; i<Size(); i++)
257
+ {
258
+ get(i).RestoreBigData(hashtable);
259
+ }
260
+
132261 blockloop = false;
133262 }
134
-}
135263
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)
264
+ void RestoreBigData(Object3D o)
147265 {
148
- bRep.RestoreSupports();
266
+ this.bRep = o.bRep;
267
+ if (this.support != null && o.transientrep != null)
268
+ {
269
+ this.support.bRep = o.transientrep;
270
+ }
271
+// July 2019 if (this.bRep != null)
272
+// this.bRep.support = o.transientrep;
273
+ // this.support = o.support;
274
+ // this.fileparent = o.fileparent;
149275 }
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
-}
161276
162277 // MOCAP SUPPORT
163278 double tx,ty,tz,rx,ry,rz;
....@@ -482,12 +597,14 @@
482597 toParent = LA.newMatrix();
483598 fromParent = LA.newMatrix();
484599 }
600
+
485601 if (toParentMarked == null)
486602 {
487603 if (maxcount != 1)
488604 {
489605 new Exception().printStackTrace();
490606 }
607
+
491608 toParentMarked = LA.newMatrix();
492609 fromParentMarked = LA.newMatrix();
493610 }
....@@ -775,7 +892,7 @@
775892 if (step == 0)
776893 step = 1;
777894 if (maxcount == 0)
778
- maxcount = 2048; // 4;
895
+ maxcount = 128; // 2048; // 4;
779896 // if (acceleration == 0)
780897 // acceleration = 10;
781898 if (delay == 0) // serial
....@@ -798,7 +915,7 @@
798915
799916 if (marked && Globals.isLIVE() && live &&
800917 //TEMP21aug2018
801
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
918
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
802919 currentframe != Globals.framecount)
803920 {
804921 currentframe = Globals.framecount;
....@@ -810,7 +927,8 @@
810927
811928 boolean changedir = random && Math.random() < 0.01; // && !link2master;
812929
813
- if (transformcount*factor > maxcount || (step == 1 && changedir))
930
+ if (transformcount*factor >= maxcount && (rewind || random) ||
931
+ (step == 1 && changedir))
814932 {
815933 countdown = 1;
816934 delay = speedup?8:1;
....@@ -882,6 +1000,7 @@
8821000 if (material == null || material.multiply)
8831001 return true;
8841002
1003
+ // Transparent objects are dynamic because we have to sort the triangles.
8851004 return material.opacity > 0.99;
8861005 }
8871006
....@@ -1282,6 +1401,7 @@
12821401 toParent = LA.newMatrix();
12831402 fromParent = LA.newMatrix();
12841403 }
1404
+
12851405 LA.matCopy(other.toParent, toParent);
12861406 LA.matCopy(other.fromParent, fromParent);
12871407
....@@ -2303,6 +2423,10 @@
23032423 }
23042424 */
23052425 }
2426
+ else
2427
+ {
2428
+ //((ObjEditor)editWindow).SetupUI2(null);
2429
+ }
23062430 }
23072431
23082432 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2344,6 +2468,14 @@
23442468 {
23452469 editWindow.refreshContents();
23462470 }
2471
+ else
2472
+ {
2473
+ if (manipWindow != null)
2474
+ {
2475
+ manipWindow.refreshContents();
2476
+ }
2477
+ }
2478
+
23472479 //if (parent != null)
23482480 //parent.refreshEditWindow();
23492481 }
....@@ -2628,6 +2760,18 @@
26282760 //Touch();
26292761 }
26302762
2763
+ void GenNormalsMeshS()
2764
+ {
2765
+ selection.GenNormalsMesh();
2766
+// for (int i=0; i<selection.size(); i++)
2767
+// {
2768
+// Object3D selectee = (Object3D) selection.elementAt(i);
2769
+// selectee.GenNormals(crease);
2770
+// }
2771
+
2772
+ //Touch();
2773
+ }
2774
+
26312775 void ClearColorsS()
26322776 {
26332777 selection.ClearColors();
....@@ -2759,6 +2903,24 @@
27592903 if (child == null)
27602904 continue;
27612905 child.GenNormals(crease);
2906
+// Children().release(i);
2907
+ }
2908
+ blockloop = false;
2909
+ }
2910
+
2911
+ void GenNormalsMesh()
2912
+ {
2913
+ if (blockloop)
2914
+ return;
2915
+
2916
+ blockloop = true;
2917
+ GenNormalsMesh0();
2918
+ for (int i = 0; i < Children().Size(); i++)
2919
+ {
2920
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2921
+ if (child == null)
2922
+ continue;
2923
+ child.GenNormalsMesh();
27622924 // Children().release(i);
27632925 }
27642926 blockloop = false;
....@@ -2927,6 +3089,15 @@
29273089 if (bRep != null)
29283090 {
29293091 bRep.GenerateNormals(crease);
3092
+ Touch();
3093
+ }
3094
+ }
3095
+
3096
+ void GenNormalsMesh0()
3097
+ {
3098
+ if (bRep != null)
3099
+ {
3100
+ bRep.GenerateNormalsMesh();
29303101 Touch();
29313102 }
29323103 }
....@@ -3381,7 +3552,8 @@
33813552 if (blockloop)
33823553 return;
33833554
3384
- if (marked || (bRep != null && material != null)) // borderline...
3555
+ if (//marked || // does not make sense
3556
+ (bRep != null || material != null)) // borderline...
33853557 live = h;
33863558
33873559 for (int i = 0; i < Size(); i++)
....@@ -3402,7 +3574,8 @@
34023574 return;
34033575
34043576 //if (bRep != null)
3405
- if (marked || (bRep != null && material != null)) // borderline...
3577
+ if (//marked || // does not make sense
3578
+ (bRep != null || material != null)) // borderline...
34063579 link2master = h;
34073580
34083581 for (int i = 0; i < Size(); i++)
....@@ -3422,7 +3595,8 @@
34223595 if (blockloop)
34233596 return;
34243597
3425
- if (marked || (bRep != null && material != null)) // borderline...
3598
+ if (//marked || // does not make sense
3599
+ (bRep != null || material != null)) // borderline...
34263600 hide = h;
34273601
34283602 for (int i = 0; i < Size(); i++)
....@@ -3442,7 +3616,7 @@
34423616 if (blockloop)
34433617 return;
34443618
3445
- if (bRep != null && material != null) // borderline...
3619
+ if (bRep != null || material != null) // borderline...
34463620 marked = h;
34473621
34483622 for (int i = 0; i < Size(); i++)
....@@ -3452,6 +3626,46 @@
34523626 continue;
34533627 blockloop = true;
34543628 child.MarkLeaves(h);
3629
+ blockloop = false;
3630
+ // release(i);
3631
+ }
3632
+ }
3633
+
3634
+ void RewindLeaves(boolean h)
3635
+ {
3636
+ if (blockloop)
3637
+ return;
3638
+
3639
+ if (bRep != null || material != null) // borderline...
3640
+ rewind = h;
3641
+
3642
+ for (int i = 0; i < Size(); i++)
3643
+ {
3644
+ Object3D child = (Object3D) get(i); // reserve(i);
3645
+ if (child == null)
3646
+ continue;
3647
+ blockloop = true;
3648
+ child.RewindLeaves(h);
3649
+ blockloop = false;
3650
+ // release(i);
3651
+ }
3652
+ }
3653
+
3654
+ void RandomLeaves(boolean h)
3655
+ {
3656
+ if (blockloop)
3657
+ return;
3658
+
3659
+ if (bRep != null || material != null) // borderline...
3660
+ random = h;
3661
+
3662
+ for (int i = 0; i < Size(); i++)
3663
+ {
3664
+ Object3D child = (Object3D) get(i); // reserve(i);
3665
+ if (child == null)
3666
+ continue;
3667
+ blockloop = true;
3668
+ child.RandomLeaves(h);
34553669 blockloop = false;
34563670 // release(i);
34573671 }
....@@ -4229,6 +4443,55 @@
42294443 }
42304444 }
42314445
4446
+ void RepairSOV()
4447
+ {
4448
+ if (blockloop)
4449
+ return;
4450
+
4451
+ String texname = this.GetPigmentTexture();
4452
+
4453
+ if (texname.startsWith("sov"))
4454
+ {
4455
+ String[] s = texname.split("/");
4456
+
4457
+ String[] sname = s[1].split("Color.pn");
4458
+
4459
+ texname = sname[0];
4460
+
4461
+ if (sname.length > 1)
4462
+ {
4463
+ texname += "Color.jpg";
4464
+ }
4465
+
4466
+ this.SetPigmentTexture("sov/" + texname);
4467
+ }
4468
+
4469
+ texname = this.GetBumpTexture();
4470
+
4471
+ if (texname.startsWith("sov"))
4472
+ {
4473
+ String[] s = texname.split("/");
4474
+
4475
+ String[] sname = s[1].split("Bump.pn");
4476
+
4477
+ texname = sname[0];
4478
+
4479
+ if (sname.length > 1)
4480
+ {
4481
+ texname += "Bump.jpg";
4482
+ }
4483
+
4484
+ this.SetBumpTexture("sov/" + texname);
4485
+ }
4486
+
4487
+ for (int i=0; i<Size(); i++)
4488
+ {
4489
+ blockloop = true;
4490
+ get(i).RepairSOV();
4491
+ blockloop = false;
4492
+ }
4493
+ }
4494
+
42324495 void RepairTexture()
42334496 {
42344497 if (this instanceof FileObject || blockloop)
....@@ -4743,6 +5006,14 @@
47435006 }
47445007 }
47455008
5009
+ ObjEditor GetWindow()
5010
+ {
5011
+ if (editWindow != null)
5012
+ return editWindow;
5013
+
5014
+ return manipWindow;
5015
+ }
5016
+
47465017 cTreePath Select(int indexcount, boolean deselect)
47475018 {
47485019 if (hide || dontselect)
....@@ -4779,10 +5050,11 @@
47795050 if (leaf != null)
47805051 {
47815052 cTreePath tp = new cTreePath(this, leaf);
4782
- if (editWindow != null)
5053
+ ObjEditor window = GetWindow();
5054
+ if (window != null)
47835055 {
47845056 //System.out.println("editWindow = " + editWindow + " vs " + this);
4785
- editWindow.Select(tp, deselect, true);
5057
+ window.Select(tp, deselect, true);
47865058 }
47875059
47885060 return tp;
....@@ -4799,6 +5071,7 @@
47995071
48005072 if (child == null)
48015073 continue;
5074
+
48025075 if (child.HasTransparency() && child.size() != 0)
48035076 {
48045077 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -4808,9 +5081,10 @@
48085081 if (leaf != null)
48095082 {
48105083 cTreePath tp = new cTreePath(this, leaf);
4811
- if (editWindow != null)
5084
+ ObjEditor window = GetWindow();
5085
+ if (window != null)
48125086 {
4813
- editWindow.Select(tp, deselect, true);
5087
+ window.Select(tp, deselect, true);
48145088 }
48155089
48165090 return tp;
....@@ -5371,6 +5645,43 @@
53715645 }
53725646 }
53735647
5648
+ UUID GetUUID()
5649
+ {
5650
+ if (uuid == null)
5651
+ {
5652
+ // Serial
5653
+ uuid = UUID.randomUUID();
5654
+ }
5655
+
5656
+ return uuid;
5657
+ }
5658
+
5659
+ Object3D GetObject(UUID uid)
5660
+ {
5661
+ if (blockloop)
5662
+ return null;
5663
+
5664
+ if (GetUUID().equals(uid))
5665
+ return this;
5666
+
5667
+ int nb = Size();
5668
+ for (int i = 0; i < nb; i++)
5669
+ {
5670
+ Object3D child = (Object3D) get(i);
5671
+
5672
+ if (child == null)
5673
+ continue;
5674
+
5675
+ blockloop = true;
5676
+ Object3D obj = child.GetObject(uid);
5677
+ blockloop = false;
5678
+ if (obj != null)
5679
+ return obj;
5680
+ }
5681
+
5682
+ return null;
5683
+ }
5684
+
53745685 void SetBumpTexture(String tex)
53755686 {
53765687 if (GetTextures() == null)
....@@ -5415,12 +5726,23 @@
54155726 boolean NeedSupport()
54165727 {
54175728 return
5418
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5729
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
54195730 // PROBLEM with CROWD!!
54205731 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
54215732 }
54225733
54235734 static boolean DEBUG_SELECTION = false;
5735
+
5736
+ boolean IsLive()
5737
+ {
5738
+ if (live)
5739
+ return true;
5740
+
5741
+ if (parent == null)
5742
+ return false;
5743
+
5744
+ return parent.IsLive();
5745
+ }
54245746
54255747 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
54265748 {
....@@ -5483,7 +5805,7 @@
54835805 support = support;
54845806
54855807 //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);
5808
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
54875809
54885810 if (!usecalllists && bRep != null && bRep.displaylist > 0)
54895811 {
....@@ -5503,10 +5825,12 @@
55035825 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
55045826
55055827 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5506
- (touched || (bRep != null && bRep.displaylist <= 0)))
5828
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5829
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
55075830 {
55085831 Globals.lighttouched = true;
55095832 } // all panes...
5833
+
55105834 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
55115835 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
55125836 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5634,6 +5958,7 @@
56345958 if (GetBRep() != null)
56355959 {
56365960 display.NextIndex();
5961
+
56375962 // vertex color conflict : gl.glCallList(list);
56385963 DrawNode(display, root, selected);
56395964 if (this instanceof BezierPatch)
....@@ -5674,16 +5999,27 @@
56745999 tex = GetTextures();
56756000 }
56766001
5677
- boolean failed = false;
6002
+ boolean failedPigment = false;
6003
+ boolean failedBump = false;
56786004
56796005 try
56806006 {
5681
- display.BindTextures(tex, texres);
6007
+ display.BindPigmentTexture(tex, texres);
56826008 }
56836009 catch (Exception e)
56846010 {
56856011 System.err.println("FAILED: " + this);
5686
- failed = true;
6012
+ failedPigment = true;
6013
+ }
6014
+
6015
+ try
6016
+ {
6017
+ display.BindBumpTexture(tex, texres);
6018
+ }
6019
+ catch (Exception e)
6020
+ {
6021
+ //System.err.println("FAILED: " + this);
6022
+ failedBump = true;
56876023 }
56886024
56896025 if (!compiled)
....@@ -5706,8 +6042,11 @@
57066042 }
57076043 }
57086044
5709
- if (!failed)
5710
- display.ReleaseTextures(tex);
6045
+ if (!failedBump)
6046
+ display.ReleaseBumpTexture(tex);
6047
+
6048
+ if (!failedPigment)
6049
+ display.ReleasePigmentTexture(tex);
57116050
57126051 display.PopMaterial(this, selected);
57136052 }
....@@ -6080,6 +6419,11 @@
60806419 // dec 2012
60816420 new Exception().printStackTrace();
60826421 return;
6422
+ }
6423
+
6424
+ if (dontselect)
6425
+ {
6426
+ //bRep.GenerateNormalsMINE();
60836427 }
60846428
60856429 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -6932,7 +7276,7 @@
69327276 spot.translate(32, 32);
69337277 spotw = spot.x + spot.width;
69347278 spoth = spot.y + spot.height;
6935
- info.g.setColor(Color.blue);
7279
+ info.g.setColor(Color.cyan);
69367280 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
69377281 // if (CameraPane.Xmin > spot.x)
69387282 // {
....@@ -6950,11 +7294,12 @@
69507294 // {
69517295 // CameraPane.Ymax = spoth;
69527296 // }
6953
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
6954
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7297
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7298
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
69557299 spot.translate(0, -32);
6956
- info.g.setColor(Color.green);
7300
+ info.g.setColor(Color.yellow);
69577301 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7302
+ info.g.setColor(Color.green);
69587303 // if (CameraPane.Xmin > spot.x)
69597304 // {
69607305 // CameraPane.Xmin = spot.x;
....@@ -6971,8 +7316,8 @@
69717316 // {
69727317 // CameraPane.Ymax = spoth;
69737318 // }
6974
- info.g.drawArc(boundary.x, boundary.y,
6975
- boundary.width, boundary.height, 0, 360);
7319
+ info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7320
+ (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
69767321 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
69777322 // if (CameraPane.Xmin > boundary.x)
69787323 // {
....@@ -7006,7 +7351,7 @@
70067351 startX = info.x;
70077352 startY = info.y;
70087353
7009
- hitSomething = 0;
7354
+ hitSomething = -1;
70107355 cVector origin = new cVector();
70117356 //LA.xformPos(origin, toParent, origin);
70127357 Rectangle spot = new Rectangle();
....@@ -7082,6 +7427,7 @@
70827427 //System.out.println("hitSomething = " + hitSomething);
70837428
70847429 double scale = 0.005f * info.camera.Distance();
7430
+
70857431 cVector xlate = new cVector();
70867432 //cVector xlate2 = new cVector();
70877433 switch (hitSomething)
....@@ -7230,24 +7576,27 @@
72307576
72317577 case hitScale: // scale
72327578 double hScale = (double) (info.x - centerPt.x) / 32;
7579
+ double sign = 1;
7580
+ if (hScale < 0)
7581
+ {
7582
+ sign = -1;
7583
+ }
7584
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
72337585 if (hScale < 0.01)
72347586 {
7235
- hScale = 0.01;
7587
+ //hScale = 0.01;
72367588 }
7237
- hScale = Math.pow(hScale, scale * 50);
7238
- if (hScale < 0.01)
7239
- {
7240
- hScale = 0.01;
7241
- }
7589
+
72427590 double vScale = (double) (info.y - centerPt.y) / 32;
7243
- if (vScale < 0.01)
7591
+ sign = 1;
7592
+ if (vScale < 0)
72447593 {
7245
- vScale = 0.01;
7594
+ sign = -1;
72467595 }
7247
- vScale = Math.pow(vScale, scale * 50);
7596
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
72487597 if (vScale < 0.01)
72497598 {
7250
- vScale = 0.01;
7599
+ //vScale = 0.01;
72517600 }
72527601 LA.matCopy(startMat, toParent);
72537602 /**/
....@@ -7258,39 +7607,47 @@
72587607 }
72597608 /**/
72607609
7610
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7611
+
7612
+ if (totalScale < 0.01)
7613
+ {
7614
+ totalScale = 0.01;
7615
+ }
7616
+
72617617 switch (info.pane.RenderCamera().viewCode)
72627618 {
72637619 case 3: // '\001'
7264
- if (modified)
7620
+ if (modified || opposite)
72657621 {
72667622 //LA.matScale(toParent, 1, hScale, vScale);
7267
- LA.matScale(toParent, vScale, 1, 1);
7623
+ LA.matScale(toParent, totalScale, 1, 1);
72687624 } // vScale, 1);
72697625 else
72707626 {
7271
- LA.matScale(toParent, vScale, vScale, vScale);
7627
+ // EXCEPTION!
7628
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
72727629 } // vScale, 1);
72737630 break;
72747631
72757632 case 2: // '\002'
7276
- if (modified)
7633
+ if (modified || opposite)
72777634 {
72787635 //LA.matScale(toParent, hScale, 1, vScale);
7279
- LA.matScale(toParent, 1, vScale, 1);
7636
+ LA.matScale(toParent, 1, totalScale, 1);
72807637 } else
72817638 {
7282
- LA.matScale(toParent, vScale, 1, vScale);
7639
+ LA.matScale(toParent, totalScale, 1, totalScale);
72837640 }
72847641 break;
72857642
72867643 case 1: // '\003'
7287
- if (modified)
7644
+ if (modified || opposite)
72887645 {
72897646 //LA.matScale(toParent, hScale, vScale, 1);
7290
- LA.matScale(toParent, 1, 1, vScale);
7647
+ LA.matScale(toParent, 1, 1, totalScale);
72917648 } else
72927649 {
7293
- LA.matScale(toParent, vScale, vScale, 1);
7650
+ LA.matScale(toParent, totalScale, totalScale, 1);
72947651 }
72957652 break;
72967653 }
....@@ -7431,7 +7788,7 @@
74317788 objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
74327789 } else
74337790 {
7434
- objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
7791
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
74357792 } // + super.toString();
74367793 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
74377794
....@@ -7504,6 +7861,10 @@
75047861 editWindow = null;
75057862 } // ?
75067863 }
7864
+ else
7865
+ {
7866
+ //editWindow.closeUI();
7867
+ }
75077868 }
75087869
75097870 boolean root; // patch for edit windows
....@@ -7515,7 +7876,7 @@
75157876 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
75167877
75177878 Object3D /*Composite*/ parent;
7518
- Object3D /*Composite*/ fileparent;
7879
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
75197880
75207881 double[][] toParent; // dynamic matrix
75217882 double[][] fromParent;
....@@ -7661,6 +8022,10 @@
76618022 }
76628023
76638024 transient ObjEditor editWindow;
8025
+ transient ObjEditor manipWindow;
8026
+
8027
+ transient boolean pinned;
8028
+
76648029 transient ObjectUI objectUI;
76658030 public static int povDepth = 0;
76668031 private static cVector tbMin = new cVector();
....@@ -7679,9 +8044,9 @@
76798044 private static cVector edge2 = new cVector();
76808045 //private static cVector norm = new cVector();
76818046 /*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;
8047
+ static final int hitCenter = 1;
8048
+ static final int hitScale = 2;
8049
+ static final int hitRotate = 3;
76858050 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
76868051 /*transient*/ private Point centerPt;
76878052 /*transient*/ private int startX;