Normand Briere
2019-06-13 4629090fafbef256abd0686a85ee12042d658868
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
+ 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
....@@ -774,7 +856,7 @@
774856 if (step == 0)
775857 step = 1;
776858 if (maxcount == 0)
777
- maxcount = 2048; // 4;
859
+ maxcount = 128; // 2048; // 4;
778860 // if (acceleration == 0)
779861 // acceleration = 10;
780862 if (delay == 0) // serial
....@@ -797,7 +879,7 @@
797879
798880 if (marked && Globals.isLIVE() && live &&
799881 //TEMP21aug2018
800
- Globals.DrawMode() == iCameraPane.SHADOW &&
882
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
801883 currentframe != Globals.framecount)
802884 {
803885 currentframe = Globals.framecount;
....@@ -912,6 +994,11 @@
912994 fromParent = null; // LA.newMatrix();
913995 bRep = null; // new BoundaryRep();
914996
997
+ if (oname != null && oname.equals("LeftHand"))
998
+ {
999
+ name = oname;
1000
+ }
1001
+
9151002 /*
9161003 float hue = (float)Math.random();
9171004 Color col;
....@@ -954,7 +1041,7 @@
9541041
9551042 public Object clone()
9561043 {
957
- return GrafreeD.clone(this);
1044
+ return Grafreed.clone(this);
9581045 }
9591046
9601047 Object3D copyExpand()
....@@ -1470,7 +1557,7 @@
14701557 BoundaryRep.SEUIL = other.material.cameralight;
14711558
14721559 // Set default to 0.1
1473
- BoundaryRep.SEUIL /= 2;
1560
+ BoundaryRep.SEUIL /= 4; // 2;
14741561 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14751562 }
14761563
....@@ -1729,7 +1816,7 @@
17291816 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17301817 o.bRep = transientrep;
17311818 if (clone)
1732
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1819
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17331820 o.CreateMaterial();
17341821 o.SetAttributes(this, -1);
17351822 //parent
....@@ -1742,7 +1829,7 @@
17421829 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17431830 o.bRep = bRep;
17441831 if (clone)
1745
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1832
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17461833 o.CreateMaterial();
17471834 //o.overwriteThis(this, -1);
17481835 o.SetAttributes(this, -1);
....@@ -1829,12 +1916,15 @@
18291916 if (obj.name == null)
18301917 continue; // can't be a null one
18311918
1919
+ // Try perfect match first.
18321920 if (n.equals(obj.name))
18331921 {
18341922 theobj = obj;
18351923 count++;
18361924 }
18371925 }
1926
+
1927
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18381928
18391929 if (count != 1)
18401930 for (int i=Size(); --i>=0;)
....@@ -2477,13 +2567,13 @@
24772567 return retval;
24782568 }
24792569
2480
- void doEditDrag(ClickInfo info)
2570
+ void doEditDrag(ClickInfo info, boolean opposite)
24812571 {
24822572 switch (doSomething)
24832573 {
24842574 case 1: // '\001'
24852575 //super.
2486
- doEditDrag0(info);
2576
+ doEditDrag0(info, opposite);
24872577 break;
24882578
24892579 case 2: // '\002'
....@@ -2496,11 +2586,11 @@
24962586 {
24972587 //sel.hitSomething = childToDrag.hitSomething;
24982588 //childToDrag.doEditDrag(info);
2499
- sel.doEditDrag(info);
2589
+ sel.doEditDrag(info, opposite);
25002590 } else
25012591 {
25022592 //super.
2503
- doEditDrag0(info);
2593
+ doEditDrag0(info, opposite);
25042594 }
25052595 }
25062596 break;
....@@ -2610,6 +2700,18 @@
26102700 void GenNormalsS(boolean crease)
26112701 {
26122702 selection.GenNormals(crease);
2703
+// for (int i=0; i<selection.size(); i++)
2704
+// {
2705
+// Object3D selectee = (Object3D) selection.elementAt(i);
2706
+// selectee.GenNormals(crease);
2707
+// }
2708
+
2709
+ //Touch();
2710
+ }
2711
+
2712
+ void GenNormalsMeshS()
2713
+ {
2714
+ selection.GenNormalsMesh();
26132715 // for (int i=0; i<selection.size(); i++)
26142716 // {
26152717 // Object3D selectee = (Object3D) selection.elementAt(i);
....@@ -2750,6 +2852,24 @@
27502852 if (child == null)
27512853 continue;
27522854 child.GenNormals(crease);
2855
+// Children().release(i);
2856
+ }
2857
+ blockloop = false;
2858
+ }
2859
+
2860
+ void GenNormalsMesh()
2861
+ {
2862
+ if (blockloop)
2863
+ return;
2864
+
2865
+ blockloop = true;
2866
+ GenNormalsMesh0();
2867
+ for (int i = 0; i < Children().Size(); i++)
2868
+ {
2869
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2870
+ if (child == null)
2871
+ continue;
2872
+ child.GenNormalsMesh();
27532873 // Children().release(i);
27542874 }
27552875 blockloop = false;
....@@ -2922,6 +3042,15 @@
29223042 }
29233043 }
29243044
3045
+ void GenNormalsMesh0()
3046
+ {
3047
+ if (bRep != null)
3048
+ {
3049
+ bRep.GenerateNormalsMesh();
3050
+ Touch();
3051
+ }
3052
+ }
3053
+
29253054 void GenNormalsMINE0()
29263055 {
29273056 if (bRep != null)
....@@ -2983,6 +3112,33 @@
29833112 blockloop = false;
29843113 }
29853114
3115
+ void TransformChildren()
3116
+ {
3117
+ if (toParent != null)
3118
+ {
3119
+ for (int i=Size(); --i>=0;)
3120
+ {
3121
+ Object3D v = get(i);
3122
+
3123
+ if (v.toParent == null)
3124
+ {
3125
+ v.toParent = LA.newMatrix();
3126
+ v.fromParent = LA.newMatrix();
3127
+ }
3128
+
3129
+// LA.matConcat(v.toParent, toParent, v.toParent);
3130
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3131
+ LA.matConcat(toParent, v.toParent, v.toParent);
3132
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
3133
+ }
3134
+
3135
+ toParent = null; // LA.matIdentity(toParent);
3136
+ fromParent = null; // LA.matIdentity(fromParent);
3137
+
3138
+ Touch();
3139
+ }
3140
+ }
3141
+
29863142 void TransformGeometry()
29873143 {
29883144 Object3D obj = this;
....@@ -3204,9 +3360,11 @@
32043360
32053361 BoundaryRep sup = bRep.support;
32063362 bRep.support = null;
3207
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3363
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32083364 // bRep.SplitInTwo(onlyone); // thread...
3209
- temprep.SplitInTwo(reduction34, onlyone);
3365
+
3366
+ while(temprep.SplitInTwo(reduction34, onlyone));
3367
+
32103368 bRep = temprep;
32113369 bRep.support = sup;
32123370 Touch();
....@@ -3728,7 +3886,7 @@
37283886 if (child == null)
37293887 continue;
37303888
3731
- if (GrafreeD.RENDERME > 0)
3889
+ if (Grafreed.RENDERME > 0)
37323890 {
37333891 if (child instanceof Merge)
37343892 ((Merge)child).renderme();
....@@ -3879,7 +4037,7 @@
38794037 if (child == null)
38804038 continue;
38814039
3882
- if (GrafreeD.RENDERME > 0)
4040
+ if (Grafreed.RENDERME > 0)
38834041 {
38844042 if (child instanceof Merge)
38854043 ((Merge)child).renderme();
....@@ -4074,7 +4232,7 @@
40744232 if (child == null)
40754233 continue;
40764234
4077
- if (GrafreeD.RENDERME > 0)
4235
+ if (Grafreed.RENDERME > 0)
40784236 {
40794237 if (child instanceof Merge)
40804238 ((Merge)child).renderme();
....@@ -4681,7 +4839,7 @@
46814839
46824840 cTreePath SelectLeaf(int indexcount, boolean deselect)
46834841 {
4684
- if (hide)
4842
+ if (hide || dontselect)
46854843 return null;
46864844
46874845 if (count <= 0)
....@@ -4707,7 +4865,7 @@
47074865
47084866 cTreePath Select(int indexcount, boolean deselect)
47094867 {
4710
- if (hide)
4868
+ if (hide || dontselect)
47114869 return null;
47124870
47134871 if (count <= 0)
....@@ -5159,10 +5317,34 @@
51595317
51605318 // System.out.println("Fullname = " + fullname);
51615319
5162
- if (fullname.name.indexOf(":") == -1)
5163
- return fullname.name;
5320
+ // Does not work on Windows due to C:
5321
+// if (fullname.name.indexOf(":") == -1)
5322
+// return fullname.name;
5323
+//
5324
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51645325
5165
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5326
+ String[] split = fullname.name.split(":");
5327
+
5328
+ if (split.length == 0)
5329
+ {
5330
+ return "";
5331
+ }
5332
+
5333
+ if (split.length <= 2)
5334
+ {
5335
+ if (fullname.name.endsWith(":"))
5336
+ {
5337
+ // Windows
5338
+ return fullname.name.substring(0, fullname.name.length()-1);
5339
+ }
5340
+
5341
+ return split[0];
5342
+ }
5343
+
5344
+ // Windows
5345
+ assert(split.length == 4);
5346
+
5347
+ return split[0] + ":" + split[1];
51665348 }
51675349
51685350 static String GetBump(cTexture fullname)
....@@ -5171,10 +5353,38 @@
51715353 return "";
51725354
51735355 // System.out.println("Fullname = " + fullname);
5174
- if (fullname.name.indexOf(":") == -1)
5175
- return "";
5176
-
5177
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5356
+ // Does not work on Windows due to C:
5357
+// if (fullname.name.indexOf(":") == -1)
5358
+// return "";
5359
+//
5360
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5361
+ String[] split = fullname.name.split(":");
5362
+
5363
+ if (split.length == 0)
5364
+ {
5365
+ return "";
5366
+ }
5367
+
5368
+ if (split.length == 1)
5369
+ {
5370
+ return "";
5371
+ }
5372
+
5373
+ if (split.length == 2)
5374
+ {
5375
+ if (fullname.name.endsWith(":"))
5376
+ {
5377
+ // Windows
5378
+ return "";
5379
+ }
5380
+
5381
+ return split[1];
5382
+ }
5383
+
5384
+ // Windows
5385
+ assert(split.length == 4);
5386
+
5387
+ return split[2] + ":" + split[3];
51785388 }
51795389
51805390 String GetPigmentTexture()
....@@ -5248,7 +5458,7 @@
52485458 System.out.print("; textures = " + textures);
52495459 System.out.println("; usedtextures = " + usedtextures);
52505460
5251
- if (GetTextures() == null)
5461
+ if (GetTextures() == null) // What is that??
52525462 GetTextures().name = ":";
52535463
52545464 String texname = tex;
....@@ -5279,6 +5489,43 @@
52795489 child.ResetPigmentTexture();
52805490 blockloop = false;
52815491 }
5492
+ }
5493
+
5494
+ UUID GetUUID()
5495
+ {
5496
+ if (uuid == null)
5497
+ {
5498
+ // Serial
5499
+ uuid = UUID.randomUUID();
5500
+ }
5501
+
5502
+ return uuid;
5503
+ }
5504
+
5505
+ Object3D GetObject(UUID uid)
5506
+ {
5507
+ if (blockloop)
5508
+ return null;
5509
+
5510
+ if (GetUUID().equals(uid))
5511
+ return this;
5512
+
5513
+ int nb = Size();
5514
+ for (int i = 0; i < nb; i++)
5515
+ {
5516
+ Object3D child = (Object3D) get(i);
5517
+
5518
+ if (child == null)
5519
+ continue;
5520
+
5521
+ blockloop = true;
5522
+ Object3D obj = child.GetObject(uid);
5523
+ blockloop = false;
5524
+ if (obj != null)
5525
+ return obj;
5526
+ }
5527
+
5528
+ return null;
52825529 }
52835530
52845531 void SetBumpTexture(String tex)
....@@ -5325,9 +5572,9 @@
53255572 boolean NeedSupport()
53265573 {
53275574 return
5328
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5575
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
53295576 // PROBLEM with CROWD!!
5330
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5577
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53315578 }
53325579
53335580 static boolean DEBUG_SELECTION = false;
....@@ -5342,7 +5589,7 @@
53425589 }
53435590
53445591 if (display.DrawMode() == iCameraPane.SELECTION &&
5345
- hide)
5592
+ (hide || dontselect))
53465593 return;
53475594
53485595 if (name != null && name.contains("sclera"))
....@@ -5584,7 +5831,17 @@
55845831 tex = GetTextures();
55855832 }
55865833
5587
- display.BindTextures(tex, texres);
5834
+ boolean failed = false;
5835
+
5836
+ try
5837
+ {
5838
+ display.BindTextures(tex, texres);
5839
+ }
5840
+ catch (Exception e)
5841
+ {
5842
+ System.err.println("FAILED: " + this);
5843
+ failed = true;
5844
+ }
55885845
55895846 if (!compiled)
55905847 {
....@@ -5606,7 +5863,8 @@
56065863 }
56075864 }
56085865
5609
- display.ReleaseTextures(tex);
5866
+ if (!failed)
5867
+ display.ReleaseTextures(tex);
56105868
56115869 display.PopMaterial(this, selected);
56125870 }
....@@ -5735,6 +5993,9 @@
57355993
57365994 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57375995 {
5996
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5997
+ return;
5998
+
57385999 if (hide)
57396000 return;
57406001 // shadow optimisation
....@@ -5859,6 +6120,9 @@
58596120 {
58606121 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
58616122 return; // no shadow for transparent objects
6123
+
6124
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6125
+ return;
58626126
58636127 if (hide)
58646128 return;
....@@ -6843,8 +7107,8 @@
68437107 // {
68447108 // CameraPane.Ymax = spoth;
68457109 // }
6846
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
6847
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7110
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7111
+ //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
68487112 spot.translate(0, -32);
68497113 info.g.setColor(Color.green);
68507114 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -6899,7 +7163,7 @@
68997163 startX = info.x;
69007164 startY = info.y;
69017165
6902
- hitSomething = 0;
7166
+ hitSomething = -1;
69037167 cVector origin = new cVector();
69047168 //LA.xformPos(origin, toParent, origin);
69057169 Rectangle spot = new Rectangle();
....@@ -6932,7 +7196,7 @@
69327196 }
69337197
69347198 //System.out.println("info.modifiers = " + info.modifiers);
6935
- modified = (info.modifiers & CameraPane.META) != 0;
7199
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
69367200 //System.out.println("modified = " + modified);
69377201 //new Exception().printStackTrace();
69387202 //viewCode = info.pane.renderCamera.viewCode;
....@@ -6960,7 +7224,7 @@
69607224 return true;
69617225 }
69627226
6963
- void doEditDrag0(ClickInfo info)
7227
+ void doEditDrag0(ClickInfo info, boolean opposite)
69647228 {
69657229 if (hitSomething == 0)
69667230 {
....@@ -6975,6 +7239,7 @@
69757239 //System.out.println("hitSomething = " + hitSomething);
69767240
69777241 double scale = 0.005f * info.camera.Distance();
7242
+
69787243 cVector xlate = new cVector();
69797244 //cVector xlate2 = new cVector();
69807245 switch (hitSomething)
....@@ -6987,7 +7252,7 @@
69877252
69887253 scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
69897254
6990
- if (modified)
7255
+ if (modified || opposite)
69917256 {
69927257 //assert(false);
69937258 /*
....@@ -7081,6 +7346,7 @@
70817346
70827347 if (modified)
70837348 {
7349
+ // Rotate 90 degrees
70847350 angle /= (Math.PI / 4);
70857351 angle = Math.floor(angle + 0.5);
70867352 angle *= (Math.PI / 4);
....@@ -7122,24 +7388,27 @@
71227388
71237389 case hitScale: // scale
71247390 double hScale = (double) (info.x - centerPt.x) / 32;
7391
+ double sign = 1;
7392
+ if (hScale < 0)
7393
+ {
7394
+ sign = -1;
7395
+ }
7396
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
71257397 if (hScale < 0.01)
71267398 {
7127
- hScale = 0.01;
7399
+ //hScale = 0.01;
71287400 }
7129
- hScale = Math.pow(hScale, scale * 50);
7130
- if (hScale < 0.01)
7131
- {
7132
- hScale = 0.01;
7133
- }
7401
+
71347402 double vScale = (double) (info.y - centerPt.y) / 32;
7135
- if (vScale < 0.01)
7403
+ sign = 1;
7404
+ if (vScale < 0)
71367405 {
7137
- vScale = 0.01;
7406
+ sign = -1;
71387407 }
7139
- vScale = Math.pow(vScale, scale * 50);
7408
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
71407409 if (vScale < 0.01)
71417410 {
7142
- vScale = 0.01;
7411
+ //vScale = 0.01;
71437412 }
71447413 LA.matCopy(startMat, toParent);
71457414 /**/
....@@ -7150,17 +7419,24 @@
71507419 }
71517420 /**/
71527421
7422
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7423
+
7424
+ if (totalScale < 0.01)
7425
+ {
7426
+ totalScale = 0.01;
7427
+ }
7428
+
71537429 switch (info.pane.RenderCamera().viewCode)
71547430 {
71557431 case 3: // '\001'
71567432 if (modified)
71577433 {
71587434 //LA.matScale(toParent, 1, hScale, vScale);
7159
- LA.matScale(toParent, vScale, 1, 1);
7435
+ LA.matScale(toParent, totalScale, 1, 1);
71607436 } // vScale, 1);
71617437 else
71627438 {
7163
- LA.matScale(toParent, vScale, vScale, vScale);
7439
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
71647440 } // vScale, 1);
71657441 break;
71667442
....@@ -7168,10 +7444,10 @@
71687444 if (modified)
71697445 {
71707446 //LA.matScale(toParent, hScale, 1, vScale);
7171
- LA.matScale(toParent, 1, vScale, 1);
7447
+ LA.matScale(toParent, 1, totalScale, 1);
71727448 } else
71737449 {
7174
- LA.matScale(toParent, vScale, 1, vScale);
7450
+ LA.matScale(toParent, totalScale, 1, totalScale);
71757451 }
71767452 break;
71777453
....@@ -7179,10 +7455,10 @@
71797455 if (modified)
71807456 {
71817457 //LA.matScale(toParent, hScale, vScale, 1);
7182
- LA.matScale(toParent, 1, 1, vScale);
7458
+ LA.matScale(toParent, 1, 1, totalScale);
71837459 } else
71847460 {
7185
- LA.matScale(toParent, vScale, vScale, 1);
7461
+ LA.matScale(toParent, totalScale, totalScale, 1);
71867462 }
71877463 break;
71887464 }
....@@ -7315,14 +7591,22 @@
73157591 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
73167592 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
73177593 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7594
+
7595
+ String objname;
7596
+
73187597 if (false) //parent != null)
73197598 {
7320
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7599
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
73217600 } else
73227601 {
7323
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7602
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
73247603 } // + super.toString();
73257604 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7605
+
7606
+ if (!Globals.ADVANCED)
7607
+ return objname;
7608
+
7609
+ return objname + " " + System.identityHashCode(this);
73267610 }
73277611
73287612 public int hashCode()
....@@ -7378,6 +7662,7 @@
73787662 objectUI.closeUI();
73797663 if (editWindow != null)
73807664 {
7665
+ editWindow.ctrlPanel.FlushUI();
73817666 editWindow.refreshContents();
73827667 } // ? new
73837668 objectUI = null;
....@@ -7398,7 +7683,7 @@
73987683 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
73997684
74007685 Object3D /*Composite*/ parent;
7401
- Object3D /*Composite*/ fileparent;
7686
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
74027687
74037688 double[][] toParent; // dynamic matrix
74047689 double[][] fromParent;
....@@ -7513,7 +7798,7 @@
75137798 {
75147799 assert(bRep != null);
75157800 if (!(support instanceof GenericJoint)) // support.bRep != null)
7516
- GrafreeD.Assert(support.bRep == bRep.support);
7801
+ Grafreed.Assert(support.bRep == bRep.support);
75177802 }
75187803 else
75197804 {
....@@ -7562,9 +7847,9 @@
75627847 private static cVector edge2 = new cVector();
75637848 //private static cVector norm = new cVector();
75647849 /*transient private*/ int hitSomething;
7565
- private static final int hitCenter = 1;
7566
- private static final int hitScale = 2;
7567
- private static final int hitRotate = 3;
7850
+ static final int hitCenter = 1;
7851
+ static final int hitScale = 2;
7852
+ static final int hitRotate = 3;
75687853 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
75697854 /*transient*/ private Point centerPt;
75707855 /*transient*/ private int startX;