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;)
....@@ -2300,6 +2390,7 @@
23002390 {
23012391 if (newWindow)
23022392 {
2393
+ new Exception().printStackTrace();
23032394 System.exit(0);
23042395 if (parent != null)
23052396 {
....@@ -2476,13 +2567,13 @@
24762567 return retval;
24772568 }
24782569
2479
- void doEditDrag(ClickInfo info)
2570
+ void doEditDrag(ClickInfo info, boolean opposite)
24802571 {
24812572 switch (doSomething)
24822573 {
24832574 case 1: // '\001'
24842575 //super.
2485
- doEditDrag0(info);
2576
+ doEditDrag0(info, opposite);
24862577 break;
24872578
24882579 case 2: // '\002'
....@@ -2495,11 +2586,11 @@
24952586 {
24962587 //sel.hitSomething = childToDrag.hitSomething;
24972588 //childToDrag.doEditDrag(info);
2498
- sel.doEditDrag(info);
2589
+ sel.doEditDrag(info, opposite);
24992590 } else
25002591 {
25012592 //super.
2502
- doEditDrag0(info);
2593
+ doEditDrag0(info, opposite);
25032594 }
25042595 }
25052596 break;
....@@ -2609,6 +2700,18 @@
26092700 void GenNormalsS(boolean crease)
26102701 {
26112702 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();
26122715 // for (int i=0; i<selection.size(); i++)
26132716 // {
26142717 // Object3D selectee = (Object3D) selection.elementAt(i);
....@@ -2749,6 +2852,24 @@
27492852 if (child == null)
27502853 continue;
27512854 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();
27522873 // Children().release(i);
27532874 }
27542875 blockloop = false;
....@@ -2921,6 +3042,15 @@
29213042 }
29223043 }
29233044
3045
+ void GenNormalsMesh0()
3046
+ {
3047
+ if (bRep != null)
3048
+ {
3049
+ bRep.GenerateNormalsMesh();
3050
+ Touch();
3051
+ }
3052
+ }
3053
+
29243054 void GenNormalsMINE0()
29253055 {
29263056 if (bRep != null)
....@@ -2982,6 +3112,33 @@
29823112 blockloop = false;
29833113 }
29843114
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
+
29853142 void TransformGeometry()
29863143 {
29873144 Object3D obj = this;
....@@ -3203,9 +3360,11 @@
32033360
32043361 BoundaryRep sup = bRep.support;
32053362 bRep.support = null;
3206
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3363
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32073364 // bRep.SplitInTwo(onlyone); // thread...
3208
- temprep.SplitInTwo(reduction34, onlyone);
3365
+
3366
+ while(temprep.SplitInTwo(reduction34, onlyone));
3367
+
32093368 bRep = temprep;
32103369 bRep.support = sup;
32113370 Touch();
....@@ -3727,7 +3886,7 @@
37273886 if (child == null)
37283887 continue;
37293888
3730
- if (GrafreeD.RENDERME > 0)
3889
+ if (Grafreed.RENDERME > 0)
37313890 {
37323891 if (child instanceof Merge)
37333892 ((Merge)child).renderme();
....@@ -3878,7 +4037,7 @@
38784037 if (child == null)
38794038 continue;
38804039
3881
- if (GrafreeD.RENDERME > 0)
4040
+ if (Grafreed.RENDERME > 0)
38824041 {
38834042 if (child instanceof Merge)
38844043 ((Merge)child).renderme();
....@@ -4073,7 +4232,7 @@
40734232 if (child == null)
40744233 continue;
40754234
4076
- if (GrafreeD.RENDERME > 0)
4235
+ if (Grafreed.RENDERME > 0)
40774236 {
40784237 if (child instanceof Merge)
40794238 ((Merge)child).renderme();
....@@ -4680,7 +4839,7 @@
46804839
46814840 cTreePath SelectLeaf(int indexcount, boolean deselect)
46824841 {
4683
- if (hide)
4842
+ if (hide || dontselect)
46844843 return null;
46854844
46864845 if (count <= 0)
....@@ -4706,7 +4865,7 @@
47064865
47074866 cTreePath Select(int indexcount, boolean deselect)
47084867 {
4709
- if (hide)
4868
+ if (hide || dontselect)
47104869 return null;
47114870
47124871 if (count <= 0)
....@@ -5158,10 +5317,34 @@
51585317
51595318 // System.out.println("Fullname = " + fullname);
51605319
5161
- if (fullname.name.indexOf(":") == -1)
5162
- 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(":"));
51635325
5164
- 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];
51655348 }
51665349
51675350 static String GetBump(cTexture fullname)
....@@ -5170,10 +5353,38 @@
51705353 return "";
51715354
51725355 // System.out.println("Fullname = " + fullname);
5173
- if (fullname.name.indexOf(":") == -1)
5174
- return "";
5175
-
5176
- 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];
51775388 }
51785389
51795390 String GetPigmentTexture()
....@@ -5247,7 +5458,7 @@
52475458 System.out.print("; textures = " + textures);
52485459 System.out.println("; usedtextures = " + usedtextures);
52495460
5250
- if (GetTextures() == null)
5461
+ if (GetTextures() == null) // What is that??
52515462 GetTextures().name = ":";
52525463
52535464 String texname = tex;
....@@ -5278,6 +5489,43 @@
52785489 child.ResetPigmentTexture();
52795490 blockloop = false;
52805491 }
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;
52815529 }
52825530
52835531 void SetBumpTexture(String tex)
....@@ -5324,9 +5572,9 @@
53245572 boolean NeedSupport()
53255573 {
53265574 return
5327
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5575
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
53285576 // PROBLEM with CROWD!!
5329
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5577
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53305578 }
53315579
53325580 static boolean DEBUG_SELECTION = false;
....@@ -5341,7 +5589,7 @@
53415589 }
53425590
53435591 if (display.DrawMode() == iCameraPane.SELECTION &&
5344
- hide)
5592
+ (hide || dontselect))
53455593 return;
53465594
53475595 if (name != null && name.contains("sclera"))
....@@ -5583,7 +5831,17 @@
55835831 tex = GetTextures();
55845832 }
55855833
5586
- 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
+ }
55875845
55885846 if (!compiled)
55895847 {
....@@ -5605,7 +5863,8 @@
56055863 }
56065864 }
56075865
5608
- display.ReleaseTextures(tex);
5866
+ if (!failed)
5867
+ display.ReleaseTextures(tex);
56095868
56105869 display.PopMaterial(this, selected);
56115870 }
....@@ -5734,6 +5993,9 @@
57345993
57355994 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57365995 {
5996
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5997
+ return;
5998
+
57375999 if (hide)
57386000 return;
57396001 // shadow optimisation
....@@ -5858,6 +6120,9 @@
58586120 {
58596121 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
58606122 return; // no shadow for transparent objects
6123
+
6124
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6125
+ return;
58616126
58626127 if (hide)
58636128 return;
....@@ -6842,8 +7107,8 @@
68427107 // {
68437108 // CameraPane.Ymax = spoth;
68447109 // }
6845
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
6846
- 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);
68477112 spot.translate(0, -32);
68487113 info.g.setColor(Color.green);
68497114 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -6898,7 +7163,7 @@
68987163 startX = info.x;
68997164 startY = info.y;
69007165
6901
- hitSomething = 0;
7166
+ hitSomething = -1;
69027167 cVector origin = new cVector();
69037168 //LA.xformPos(origin, toParent, origin);
69047169 Rectangle spot = new Rectangle();
....@@ -6931,7 +7196,7 @@
69317196 }
69327197
69337198 //System.out.println("info.modifiers = " + info.modifiers);
6934
- modified = (info.modifiers & CameraPane.META) != 0;
7199
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
69357200 //System.out.println("modified = " + modified);
69367201 //new Exception().printStackTrace();
69377202 //viewCode = info.pane.renderCamera.viewCode;
....@@ -6959,7 +7224,7 @@
69597224 return true;
69607225 }
69617226
6962
- void doEditDrag0(ClickInfo info)
7227
+ void doEditDrag0(ClickInfo info, boolean opposite)
69637228 {
69647229 if (hitSomething == 0)
69657230 {
....@@ -6974,6 +7239,7 @@
69747239 //System.out.println("hitSomething = " + hitSomething);
69757240
69767241 double scale = 0.005f * info.camera.Distance();
7242
+
69777243 cVector xlate = new cVector();
69787244 //cVector xlate2 = new cVector();
69797245 switch (hitSomething)
....@@ -6986,7 +7252,7 @@
69867252
69877253 scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
69887254
6989
- if (modified)
7255
+ if (modified || opposite)
69907256 {
69917257 //assert(false);
69927258 /*
....@@ -7080,6 +7346,7 @@
70807346
70817347 if (modified)
70827348 {
7349
+ // Rotate 90 degrees
70837350 angle /= (Math.PI / 4);
70847351 angle = Math.floor(angle + 0.5);
70857352 angle *= (Math.PI / 4);
....@@ -7121,24 +7388,27 @@
71217388
71227389 case hitScale: // scale
71237390 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);
71247397 if (hScale < 0.01)
71257398 {
7126
- hScale = 0.01;
7399
+ //hScale = 0.01;
71277400 }
7128
- hScale = Math.pow(hScale, scale * 50);
7129
- if (hScale < 0.01)
7130
- {
7131
- hScale = 0.01;
7132
- }
7401
+
71337402 double vScale = (double) (info.y - centerPt.y) / 32;
7134
- if (vScale < 0.01)
7403
+ sign = 1;
7404
+ if (vScale < 0)
71357405 {
7136
- vScale = 0.01;
7406
+ sign = -1;
71377407 }
7138
- vScale = Math.pow(vScale, scale * 50);
7408
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
71397409 if (vScale < 0.01)
71407410 {
7141
- vScale = 0.01;
7411
+ //vScale = 0.01;
71427412 }
71437413 LA.matCopy(startMat, toParent);
71447414 /**/
....@@ -7149,17 +7419,24 @@
71497419 }
71507420 /**/
71517421
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
+
71527429 switch (info.pane.RenderCamera().viewCode)
71537430 {
71547431 case 3: // '\001'
71557432 if (modified)
71567433 {
71577434 //LA.matScale(toParent, 1, hScale, vScale);
7158
- LA.matScale(toParent, vScale, 1, 1);
7435
+ LA.matScale(toParent, totalScale, 1, 1);
71597436 } // vScale, 1);
71607437 else
71617438 {
7162
- LA.matScale(toParent, vScale, vScale, vScale);
7439
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
71637440 } // vScale, 1);
71647441 break;
71657442
....@@ -7167,10 +7444,10 @@
71677444 if (modified)
71687445 {
71697446 //LA.matScale(toParent, hScale, 1, vScale);
7170
- LA.matScale(toParent, 1, vScale, 1);
7447
+ LA.matScale(toParent, 1, totalScale, 1);
71717448 } else
71727449 {
7173
- LA.matScale(toParent, vScale, 1, vScale);
7450
+ LA.matScale(toParent, totalScale, 1, totalScale);
71747451 }
71757452 break;
71767453
....@@ -7178,10 +7455,10 @@
71787455 if (modified)
71797456 {
71807457 //LA.matScale(toParent, hScale, vScale, 1);
7181
- LA.matScale(toParent, 1, 1, vScale);
7458
+ LA.matScale(toParent, 1, 1, totalScale);
71827459 } else
71837460 {
7184
- LA.matScale(toParent, vScale, vScale, 1);
7461
+ LA.matScale(toParent, totalScale, totalScale, 1);
71857462 }
71867463 break;
71877464 }
....@@ -7314,14 +7591,22 @@
73147591 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
73157592 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
73167593 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7594
+
7595
+ String objname;
7596
+
73177597 if (false) //parent != null)
73187598 {
7319
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7599
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
73207600 } else
73217601 {
7322
- 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) ":"") */ "";
73237603 } // + super.toString();
73247604 //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);
73257610 }
73267611
73277612 public int hashCode()
....@@ -7377,6 +7662,7 @@
73777662 objectUI.closeUI();
73787663 if (editWindow != null)
73797664 {
7665
+ editWindow.ctrlPanel.FlushUI();
73807666 editWindow.refreshContents();
73817667 } // ? new
73827668 objectUI = null;
....@@ -7397,7 +7683,7 @@
73977683 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
73987684
73997685 Object3D /*Composite*/ parent;
7400
- Object3D /*Composite*/ fileparent;
7686
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
74017687
74027688 double[][] toParent; // dynamic matrix
74037689 double[][] fromParent;
....@@ -7512,7 +7798,7 @@
75127798 {
75137799 assert(bRep != null);
75147800 if (!(support instanceof GenericJoint)) // support.bRep != null)
7515
- GrafreeD.Assert(support.bRep == bRep.support);
7801
+ Grafreed.Assert(support.bRep == bRep.support);
75167802 }
75177803 else
75187804 {
....@@ -7561,9 +7847,9 @@
75617847 private static cVector edge2 = new cVector();
75627848 //private static cVector norm = new cVector();
75637849 /*transient private*/ int hitSomething;
7564
- private static final int hitCenter = 1;
7565
- private static final int hitScale = 2;
7566
- private static final int hitRotate = 3;
7850
+ static final int hitCenter = 1;
7851
+ static final int hitScale = 2;
7852
+ static final int hitRotate = 3;
75677853 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
75687854 /*transient*/ private Point centerPt;
75697855 /*transient*/ private int startX;