Normand Briere
2019-07-01 6600d22461ccc1cb602f238a9ffa83cf07dd830e
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;
....@@ -300,6 +388,7 @@
300388 }
301389
302390 boolean live = false;
391
+ boolean dontselect = false;
303392 boolean hide = false;
304393 boolean link2master = false; // performs reset support/master at each frame
305394 boolean marked = false; // animation node
....@@ -481,12 +570,14 @@
481570 toParent = LA.newMatrix();
482571 fromParent = LA.newMatrix();
483572 }
573
+
484574 if (toParentMarked == null)
485575 {
486576 if (maxcount != 1)
487577 {
488578 new Exception().printStackTrace();
489579 }
580
+
490581 toParentMarked = LA.newMatrix();
491582 fromParentMarked = LA.newMatrix();
492583 }
....@@ -774,7 +865,7 @@
774865 if (step == 0)
775866 step = 1;
776867 if (maxcount == 0)
777
- maxcount = 2048; // 4;
868
+ maxcount = 128; // 2048; // 4;
778869 // if (acceleration == 0)
779870 // acceleration = 10;
780871 if (delay == 0) // serial
....@@ -797,7 +888,7 @@
797888
798889 if (marked && Globals.isLIVE() && live &&
799890 //TEMP21aug2018
800
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
891
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
801892 currentframe != Globals.framecount)
802893 {
803894 currentframe = Globals.framecount;
....@@ -809,7 +900,8 @@
809900
810901 boolean changedir = random && Math.random() < 0.01; // && !link2master;
811902
812
- if (transformcount*factor > maxcount || (step == 1 && changedir))
903
+ if (transformcount*factor >= maxcount && (rewind || random) ||
904
+ (step == 1 && changedir))
813905 {
814906 countdown = 1;
815907 delay = speedup?8:1;
....@@ -881,6 +973,7 @@
881973 if (material == null || material.multiply)
882974 return true;
883975
976
+ // Transparent objects are dynamic because we have to sort the triangles.
884977 return material.opacity > 0.99;
885978 }
886979
....@@ -1834,12 +1927,15 @@
18341927 if (obj.name == null)
18351928 continue; // can't be a null one
18361929
1930
+ // Try perfect match first.
18371931 if (n.equals(obj.name))
18381932 {
18391933 theobj = obj;
18401934 count++;
18411935 }
18421936 }
1937
+
1938
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18431939
18441940 if (count != 1)
18451941 for (int i=Size(); --i>=0;)
....@@ -2299,6 +2395,10 @@
22992395 }
23002396 */
23012397 }
2398
+ else
2399
+ {
2400
+ //((ObjEditor)editWindow).SetupUI2(null);
2401
+ }
23022402 }
23032403
23042404 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2340,6 +2440,14 @@
23402440 {
23412441 editWindow.refreshContents();
23422442 }
2443
+ else
2444
+ {
2445
+ if (manipWindow != null)
2446
+ {
2447
+ manipWindow.refreshContents();
2448
+ }
2449
+ }
2450
+
23432451 //if (parent != null)
23442452 //parent.refreshEditWindow();
23452453 }
....@@ -2624,6 +2732,18 @@
26242732 //Touch();
26252733 }
26262734
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
+
26272747 void ClearColorsS()
26282748 {
26292749 selection.ClearColors();
....@@ -2755,6 +2875,24 @@
27552875 if (child == null)
27562876 continue;
27572877 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();
27582896 // Children().release(i);
27592897 }
27602898 blockloop = false;
....@@ -2927,6 +3065,15 @@
29273065 }
29283066 }
29293067
3068
+ void GenNormalsMesh0()
3069
+ {
3070
+ if (bRep != null)
3071
+ {
3072
+ bRep.GenerateNormalsMesh();
3073
+ Touch();
3074
+ }
3075
+ }
3076
+
29303077 void GenNormalsMINE0()
29313078 {
29323079 if (bRep != null)
....@@ -3002,8 +3149,10 @@
30023149 v.fromParent = LA.newMatrix();
30033150 }
30043151
3005
- LA.matConcat(v.toParent, toParent, v.toParent);
3006
- LA.matConcat(fromParent, v.fromParent, v.fromParent);
3152
+// LA.matConcat(v.toParent, toParent, v.toParent);
3153
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3154
+ LA.matConcat(toParent, v.toParent, v.toParent);
3155
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
30073156 }
30083157
30093158 toParent = null; // LA.matIdentity(toParent);
....@@ -3236,7 +3385,9 @@
32363385 bRep.support = null;
32373386 BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32383387 // bRep.SplitInTwo(onlyone); // thread...
3239
- temprep.SplitInTwo(reduction34, onlyone);
3388
+
3389
+ while(temprep.SplitInTwo(reduction34, onlyone));
3390
+
32403391 bRep = temprep;
32413392 bRep.support = sup;
32423393 Touch();
....@@ -3373,7 +3524,8 @@
33733524 if (blockloop)
33743525 return;
33753526
3376
- if (marked || (bRep != null && material != null)) // borderline...
3527
+ if (//marked || // does not make sense
3528
+ (bRep != null || material != null)) // borderline...
33773529 live = h;
33783530
33793531 for (int i = 0; i < Size(); i++)
....@@ -3394,7 +3546,8 @@
33943546 return;
33953547
33963548 //if (bRep != null)
3397
- if (marked || (bRep != null && material != null)) // borderline...
3549
+ if (//marked || // does not make sense
3550
+ (bRep != null || material != null)) // borderline...
33983551 link2master = h;
33993552
34003553 for (int i = 0; i < Size(); i++)
....@@ -3414,7 +3567,8 @@
34143567 if (blockloop)
34153568 return;
34163569
3417
- if (marked || (bRep != null && material != null)) // borderline...
3570
+ if (//marked || // does not make sense
3571
+ (bRep != null || material != null)) // borderline...
34183572 hide = h;
34193573
34203574 for (int i = 0; i < Size(); i++)
....@@ -3434,7 +3588,7 @@
34343588 if (blockloop)
34353589 return;
34363590
3437
- if (bRep != null && material != null) // borderline...
3591
+ if (bRep != null || material != null) // borderline...
34383592 marked = h;
34393593
34403594 for (int i = 0; i < Size(); i++)
....@@ -3444,6 +3598,46 @@
34443598 continue;
34453599 blockloop = true;
34463600 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);
34473641 blockloop = false;
34483642 // release(i);
34493643 }
....@@ -4221,6 +4415,55 @@
42214415 }
42224416 }
42234417
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
+
42244467 void RepairTexture()
42254468 {
42264469 if (this instanceof FileObject || blockloop)
....@@ -4711,7 +4954,7 @@
47114954
47124955 cTreePath SelectLeaf(int indexcount, boolean deselect)
47134956 {
4714
- if (hide)
4957
+ if (hide || dontselect)
47154958 return null;
47164959
47174960 if (count <= 0)
....@@ -4735,9 +4978,17 @@
47354978 }
47364979 }
47374980
4981
+ ObjEditor GetWindow()
4982
+ {
4983
+ if (editWindow != null)
4984
+ return editWindow;
4985
+
4986
+ return manipWindow;
4987
+ }
4988
+
47384989 cTreePath Select(int indexcount, boolean deselect)
47394990 {
4740
- if (hide)
4991
+ if (hide || dontselect)
47414992 return null;
47424993
47434994 if (count <= 0)
....@@ -4771,10 +5022,11 @@
47715022 if (leaf != null)
47725023 {
47735024 cTreePath tp = new cTreePath(this, leaf);
4774
- if (editWindow != null)
5025
+ ObjEditor window = GetWindow();
5026
+ if (window != null)
47755027 {
47765028 //System.out.println("editWindow = " + editWindow + " vs " + this);
4777
- editWindow.Select(tp, deselect, true);
5029
+ window.Select(tp, deselect, true);
47785030 }
47795031
47805032 return tp;
....@@ -4791,6 +5043,7 @@
47915043
47925044 if (child == null)
47935045 continue;
5046
+
47945047 if (child.HasTransparency() && child.size() != 0)
47955048 {
47965049 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -4800,9 +5053,10 @@
48005053 if (leaf != null)
48015054 {
48025055 cTreePath tp = new cTreePath(this, leaf);
4803
- if (editWindow != null)
5056
+ ObjEditor window = GetWindow();
5057
+ if (window != null)
48045058 {
4805
- editWindow.Select(tp, deselect, true);
5059
+ window.Select(tp, deselect, true);
48065060 }
48075061
48085062 return tp;
....@@ -5363,6 +5617,43 @@
53635617 }
53645618 }
53655619
5620
+ UUID GetUUID()
5621
+ {
5622
+ if (uuid == null)
5623
+ {
5624
+ // Serial
5625
+ uuid = UUID.randomUUID();
5626
+ }
5627
+
5628
+ return uuid;
5629
+ }
5630
+
5631
+ Object3D GetObject(UUID uid)
5632
+ {
5633
+ if (blockloop)
5634
+ return null;
5635
+
5636
+ if (GetUUID().equals(uid))
5637
+ return this;
5638
+
5639
+ int nb = Size();
5640
+ for (int i = 0; i < nb; i++)
5641
+ {
5642
+ Object3D child = (Object3D) get(i);
5643
+
5644
+ if (child == null)
5645
+ continue;
5646
+
5647
+ blockloop = true;
5648
+ Object3D obj = child.GetObject(uid);
5649
+ blockloop = false;
5650
+ if (obj != null)
5651
+ return obj;
5652
+ }
5653
+
5654
+ return null;
5655
+ }
5656
+
53665657 void SetBumpTexture(String tex)
53675658 {
53685659 if (GetTextures() == null)
....@@ -5407,12 +5698,23 @@
54075698 boolean NeedSupport()
54085699 {
54095700 return
5410
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5701
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
54115702 // PROBLEM with CROWD!!
54125703 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
54135704 }
54145705
54155706 static boolean DEBUG_SELECTION = false;
5707
+
5708
+ boolean IsLive()
5709
+ {
5710
+ if (live)
5711
+ return true;
5712
+
5713
+ if (parent == null)
5714
+ return false;
5715
+
5716
+ return parent.IsLive();
5717
+ }
54165718
54175719 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
54185720 {
....@@ -5424,7 +5726,7 @@
54245726 }
54255727
54265728 if (display.DrawMode() == iCameraPane.SELECTION &&
5427
- hide)
5729
+ (hide || dontselect))
54285730 return;
54295731
54305732 if (name != null && name.contains("sclera"))
....@@ -5475,7 +5777,7 @@
54755777 support = support;
54765778
54775779 //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);
5780
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
54795781
54805782 if (!usecalllists && bRep != null && bRep.displaylist > 0)
54815783 {
....@@ -5495,10 +5797,12 @@
54955797 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
54965798
54975799 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5498
- (touched || (bRep != null && bRep.displaylist <= 0)))
5800
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5801
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
54995802 {
55005803 Globals.lighttouched = true;
55015804 } // all panes...
5805
+
55025806 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
55035807 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
55045808 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5626,6 +5930,7 @@
56265930 if (GetBRep() != null)
56275931 {
56285932 display.NextIndex();
5933
+
56295934 // vertex color conflict : gl.glCallList(list);
56305935 DrawNode(display, root, selected);
56315936 if (this instanceof BezierPatch)
....@@ -5666,7 +5971,28 @@
56665971 tex = GetTextures();
56675972 }
56685973
5669
- display.BindTextures(tex, texres);
5974
+ boolean failedPigment = false;
5975
+ boolean failedBump = false;
5976
+
5977
+ try
5978
+ {
5979
+ display.BindPigmentTexture(tex, texres);
5980
+ }
5981
+ catch (Exception e)
5982
+ {
5983
+ System.err.println("FAILED: " + this);
5984
+ failedPigment = true;
5985
+ }
5986
+
5987
+ try
5988
+ {
5989
+ display.BindBumpTexture(tex, texres);
5990
+ }
5991
+ catch (Exception e)
5992
+ {
5993
+ //System.err.println("FAILED: " + this);
5994
+ failedBump = true;
5995
+ }
56705996
56715997 if (!compiled)
56725998 {
....@@ -5688,7 +6014,11 @@
56886014 }
56896015 }
56906016
5691
- display.ReleaseTextures(tex);
6017
+ if (!failedBump)
6018
+ display.ReleaseBumpTexture(tex);
6019
+
6020
+ if (!failedPigment)
6021
+ display.ReleasePigmentTexture(tex);
56926022
56936023 display.PopMaterial(this, selected);
56946024 }
....@@ -5817,6 +6147,9 @@
58176147
58186148 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
58196149 {
6150
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6151
+ return;
6152
+
58206153 if (hide)
58216154 return;
58226155 // shadow optimisation
....@@ -5942,6 +6275,9 @@
59426275 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
59436276 return; // no shadow for transparent objects
59446277
6278
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6279
+ return;
6280
+
59456281 if (hide)
59466282 return;
59476283
....@@ -6055,6 +6391,11 @@
60556391 // dec 2012
60566392 new Exception().printStackTrace();
60576393 return;
6394
+ }
6395
+
6396
+ if (dontselect)
6397
+ {
6398
+ //bRep.GenerateNormalsMINE();
60586399 }
60596400
60606401 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -6907,7 +7248,7 @@
69077248 spot.translate(32, 32);
69087249 spotw = spot.x + spot.width;
69097250 spoth = spot.y + spot.height;
6910
- info.g.setColor(Color.blue);
7251
+ info.g.setColor(Color.cyan);
69117252 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
69127253 // if (CameraPane.Xmin > spot.x)
69137254 // {
....@@ -6925,11 +7266,12 @@
69257266 // {
69267267 // CameraPane.Ymax = spoth;
69277268 // }
6928
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
6929
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7269
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7270
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
69307271 spot.translate(0, -32);
6931
- info.g.setColor(Color.green);
7272
+ info.g.setColor(Color.yellow);
69327273 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7274
+ info.g.setColor(Color.green);
69337275 // if (CameraPane.Xmin > spot.x)
69347276 // {
69357277 // CameraPane.Xmin = spot.x;
....@@ -6981,7 +7323,7 @@
69817323 startX = info.x;
69827324 startY = info.y;
69837325
6984
- hitSomething = 0;
7326
+ hitSomething = -1;
69857327 cVector origin = new cVector();
69867328 //LA.xformPos(origin, toParent, origin);
69877329 Rectangle spot = new Rectangle();
....@@ -7057,6 +7399,7 @@
70577399 //System.out.println("hitSomething = " + hitSomething);
70587400
70597401 double scale = 0.005f * info.camera.Distance();
7402
+
70607403 cVector xlate = new cVector();
70617404 //cVector xlate2 = new cVector();
70627405 switch (hitSomething)
....@@ -7205,24 +7548,27 @@
72057548
72067549 case hitScale: // scale
72077550 double hScale = (double) (info.x - centerPt.x) / 32;
7551
+ double sign = 1;
7552
+ if (hScale < 0)
7553
+ {
7554
+ sign = -1;
7555
+ }
7556
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
72087557 if (hScale < 0.01)
72097558 {
7210
- hScale = 0.01;
7559
+ //hScale = 0.01;
72117560 }
7212
- hScale = Math.pow(hScale, scale * 50);
7213
- if (hScale < 0.01)
7214
- {
7215
- hScale = 0.01;
7216
- }
7561
+
72177562 double vScale = (double) (info.y - centerPt.y) / 32;
7218
- if (vScale < 0.01)
7563
+ sign = 1;
7564
+ if (vScale < 0)
72197565 {
7220
- vScale = 0.01;
7566
+ sign = -1;
72217567 }
7222
- vScale = Math.pow(vScale, scale * 50);
7568
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
72237569 if (vScale < 0.01)
72247570 {
7225
- vScale = 0.01;
7571
+ //vScale = 0.01;
72267572 }
72277573 LA.matCopy(startMat, toParent);
72287574 /**/
....@@ -7233,39 +7579,47 @@
72337579 }
72347580 /**/
72357581
7582
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7583
+
7584
+ if (totalScale < 0.01)
7585
+ {
7586
+ totalScale = 0.01;
7587
+ }
7588
+
72367589 switch (info.pane.RenderCamera().viewCode)
72377590 {
72387591 case 3: // '\001'
7239
- if (modified)
7592
+ if (modified || opposite)
72407593 {
72417594 //LA.matScale(toParent, 1, hScale, vScale);
7242
- LA.matScale(toParent, vScale, 1, 1);
7595
+ LA.matScale(toParent, totalScale, 1, 1);
72437596 } // vScale, 1);
72447597 else
72457598 {
7246
- LA.matScale(toParent, vScale, vScale, vScale);
7599
+ // EXCEPTION!
7600
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
72477601 } // vScale, 1);
72487602 break;
72497603
72507604 case 2: // '\002'
7251
- if (modified)
7605
+ if (modified || opposite)
72527606 {
72537607 //LA.matScale(toParent, hScale, 1, vScale);
7254
- LA.matScale(toParent, 1, vScale, 1);
7608
+ LA.matScale(toParent, 1, totalScale, 1);
72557609 } else
72567610 {
7257
- LA.matScale(toParent, vScale, 1, vScale);
7611
+ LA.matScale(toParent, totalScale, 1, totalScale);
72587612 }
72597613 break;
72607614
72617615 case 1: // '\003'
7262
- if (modified)
7616
+ if (modified || opposite)
72637617 {
72647618 //LA.matScale(toParent, hScale, vScale, 1);
7265
- LA.matScale(toParent, 1, 1, vScale);
7619
+ LA.matScale(toParent, 1, 1, totalScale);
72667620 } else
72677621 {
7268
- LA.matScale(toParent, vScale, vScale, 1);
7622
+ LA.matScale(toParent, totalScale, totalScale, 1);
72697623 }
72707624 break;
72717625 }
....@@ -7406,7 +7760,7 @@
74067760 objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
74077761 } else
74087762 {
7409
- objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
7763
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
74107764 } // + super.toString();
74117765 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
74127766
....@@ -7479,6 +7833,10 @@
74797833 editWindow = null;
74807834 } // ?
74817835 }
7836
+ else
7837
+ {
7838
+ //editWindow.closeUI();
7839
+ }
74827840 }
74837841
74847842 boolean root; // patch for edit windows
....@@ -7490,7 +7848,7 @@
74907848 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
74917849
74927850 Object3D /*Composite*/ parent;
7493
- Object3D /*Composite*/ fileparent;
7851
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
74947852
74957853 double[][] toParent; // dynamic matrix
74967854 double[][] fromParent;
....@@ -7636,6 +7994,10 @@
76367994 }
76377995
76387996 transient ObjEditor editWindow;
7997
+ transient ObjEditor manipWindow;
7998
+
7999
+ transient boolean pinned;
8000
+
76398001 transient ObjectUI objectUI;
76408002 public static int povDepth = 0;
76418003 private static cVector tbMin = new cVector();
....@@ -7654,9 +8016,9 @@
76548016 private static cVector edge2 = new cVector();
76558017 //private static cVector norm = new cVector();
76568018 /*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;
8019
+ static final int hitCenter = 1;
8020
+ static final int hitScale = 2;
8021
+ static final int hitRotate = 3;
76608022 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
76618023 /*transient*/ private Point centerPt;
76628024 /*transient*/ private int startX;