Normand Briere
2019-08-12 b1d79b74514041a059b454a9f6fc3970773c0cb8
Object3D.java
....@@ -22,13 +22,20 @@
2222 //static final long serialVersionUID = -607422624994562685L;
2323 static final long serialVersionUID = 5022536242724664900L;
2424
25
+ // Use GetUUID for backward compatibility with null.
2526 private UUID uuid = UUID.randomUUID();
2627
27
- // TEMPORARY for mocap undo
28
- mocap.reader.BVHReader.BVHResult bvh;
29
- Object3D skeleton;
28
+ // TEMPORARY for mocap undo. No need to be transient.
29
+ mocap.reader.BVHReader.BVHResult savebvh;
30
+ Object3D saveskeleton;
3031 //
3132
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
37
+ int versionindex = -1;
38
+
3239 ScriptNode scriptnode;
3340
3441 void InitOthers()
....@@ -170,24 +177,35 @@
170177
171178 void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172179 {
180
+ Object3D o;
181
+
173182 if (hashtable.containsKey(GetUUID()))
174183 {
175
- Object3D o = hashtable.get(GetUUID());
184
+ o = hashtable.get(GetUUID());
176185
177186 Grafreed.Assert(this.bRep == o.bRep);
178
- if (this.bRep != null)
179
- assert(this.bRep.support == o.transientrep);
187
+ //if (this.bRep != null)
188
+ // assert(this.bRep.support == o.transientrep);
189
+ if (this.support != null)
190
+ assert(this.support.bRep == o.transientrep);
191
+ }
192
+ else
193
+ {
194
+ o = new Object3D("copy of " + this.name);
180195
181
- return;
196
+ hashtable.put(GetUUID(), o);
182197 }
183198
184
- Object3D o = new Object3D("copy of " + this.name);
185
-
186
- hashtable.put(GetUUID(), o);
187
-
188
- for (int i=0; i<Size(); i++)
199
+ if (!blockloop)
189200 {
190
- get(i).ExtractBigData(hashtable);
201
+ blockloop = true;
202
+
203
+ for (int i=0; i<Size(); i++)
204
+ {
205
+ get(i).ExtractBigData(hashtable);
206
+ }
207
+
208
+ blockloop = false;
191209 }
192210
193211 ExtractBigData(o);
....@@ -195,11 +213,26 @@
195213
196214 void ExtractBigData(Object3D o)
197215 {
216
+ if (o.bRep != null)
217
+ Grafreed.Assert(o.bRep == this.bRep);
218
+
198219 o.bRep = this.bRep;
199
- if (this.bRep != null)
220
+// July 2019 if (this.bRep != null)
221
+// {
222
+// o.transientrep = this.bRep.support;
223
+// o.bRep.support = null;
224
+// }
225
+ o.selection = this.selection;
226
+ o.versionlist = this.versionlist;
227
+ o.versionindex = this.versionindex;
228
+
229
+ if (this.support != null)
200230 {
201
- o.transientrep = this.bRep.support;
202
- o.bRep.support = null;
231
+ if (o.transientrep != null)
232
+ Grafreed.Assert(o.transientrep == this.support.bRep);
233
+
234
+ o.transientrep = this.support.bRep;
235
+ this.support.bRep = null;
203236 }
204237
205238 // o.support = this.support;
....@@ -214,19 +247,42 @@
214247 // this.fileparent = null;
215248 }
216249
250
+// Object3D GetObject(java.util.UUID uuid)
251
+// {
252
+// if (this.uuid.equals(uuid))
253
+// return this;
254
+//
255
+// if (blockloop)
256
+// return null;
257
+//
258
+// blockloop = true;
259
+//
260
+// for (int i=0; i<Size(); i++)
261
+// {
262
+// Object3D o = get(i).GetObject(uuid);
263
+//
264
+// if (o != null)
265
+// return o;
266
+// }
267
+//
268
+// blockloop = false;
269
+//
270
+// return null;
271
+// }
272
+
217273 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
218274 {
219275 if (!hashtable.containsKey(GetUUID()))
220276 return;
221277
278
+ Object3D o = hashtable.get(GetUUID());
279
+
280
+ RestoreBigData(o);
281
+
222282 if (blockloop)
223283 return;
224284
225285 blockloop = true;
226
-
227
- Object3D o = hashtable.get(GetUUID());
228
-
229
- RestoreBigData(o);
230286
231287 //hashtable.remove(GetUUID());
232288
....@@ -241,8 +297,17 @@
241297 void RestoreBigData(Object3D o)
242298 {
243299 this.bRep = o.bRep;
244
- if (this.bRep != null)
245
- this.bRep.support = o.transientrep;
300
+ if (this.support != null && o.transientrep != null)
301
+ {
302
+ this.support.bRep = o.transientrep;
303
+ }
304
+
305
+ this.selection = o.selection;
306
+
307
+ this.versionlist = o.versionlist;
308
+ this.versionindex = o.versionindex;
309
+// July 2019 if (this.bRep != null)
310
+// this.bRep.support = o.transientrep;
246311 // this.support = o.support;
247312 // this.fileparent = o.fileparent;
248313 }
....@@ -388,6 +453,7 @@
388453 }
389454
390455 boolean live = false;
456
+ transient boolean keepdontselect;
391457 boolean dontselect = false;
392458 boolean hide = false;
393459 boolean link2master = false; // performs reset support/master at each frame
....@@ -973,6 +1039,9 @@
9731039 if (material == null || material.multiply)
9741040 return true;
9751041
1042
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1043
+ return false;
1044
+
9761045 // Transparent objects are dynamic because we have to sort the triangles.
9771046 return material.opacity > 0.99;
9781047 }
....@@ -1374,6 +1443,7 @@
13741443 toParent = LA.newMatrix();
13751444 fromParent = LA.newMatrix();
13761445 }
1446
+
13771447 LA.matCopy(other.toParent, toParent);
13781448 LA.matCopy(other.fromParent, fromParent);
13791449
....@@ -2398,6 +2468,11 @@
23982468 else
23992469 {
24002470 //((ObjEditor)editWindow).SetupUI2(null);
2471
+ if (objectUI != null)
2472
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2473
+ else
2474
+ //new Exception().printStackTrace();
2475
+ System.err.println("objectUI is null");
24012476 }
24022477 }
24032478
....@@ -2527,7 +2602,8 @@
25272602 private static final int editSelf = 1;
25282603 private static final int editChild = 2;
25292604
2530
- void drawEditHandles(ClickInfo info, int level)
2605
+ void drawEditHandles(//ClickInfo info,
2606
+ int level)
25312607 {
25322608 if (level == 0)
25332609 {
....@@ -2535,7 +2611,8 @@
25352611 return;
25362612
25372613 Object3D selectee;
2538
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2614
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2615
+ level + 1))
25392616 {
25402617 selectee = (Object3D) e.nextElement();
25412618 }
....@@ -2543,19 +2620,22 @@
25432620 } else
25442621 {
25452622 //super.
2546
- drawEditHandles0(info, level + 1);
2623
+ drawEditHandles0(//info,
2624
+ level + 1);
25472625 }
25482626 }
25492627
2550
- boolean doEditClick(ClickInfo info, int level)
2628
+ boolean doEditClick(//ClickInfo info,
2629
+ int level)
25512630 {
25522631 doSomething = 0;
25532632 if (level == 0)
25542633 {
2555
- return doParentClick(info);
2634
+ return doParentClick(); //info);
25562635 }
25572636 if (//super.
2558
- doEditClick0(info, level))
2637
+ doEditClick0(//info,
2638
+ level))
25592639 {
25602640 doSomething = 1;
25612641 return true;
....@@ -2565,7 +2645,7 @@
25652645 }
25662646 }
25672647
2568
- boolean doParentClick(ClickInfo info)
2648
+ boolean doParentClick() //ClickInfo info)
25692649 {
25702650 if (selection == null)
25712651 {
....@@ -2578,7 +2658,8 @@
25782658 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
25792659 {
25802660 Object3D selectee = (Object3D) e.nextElement();
2581
- if (selectee.doEditClick(info, 1))
2661
+ if (selectee.doEditClick(//info,
2662
+ 1))
25822663 {
25832664 childToDrag = selectee;
25842665 doSomething = 2;
....@@ -2590,13 +2671,15 @@
25902671 return retval;
25912672 }
25922673
2593
- void doEditDrag(ClickInfo info, boolean opposite)
2674
+ void doEditDrag(//ClickInfo clickInfo,
2675
+ boolean opposite)
25942676 {
25952677 switch (doSomething)
25962678 {
25972679 case 1: // '\001'
25982680 //super.
2599
- doEditDrag0(info, opposite);
2681
+ doEditDrag0(//clickInfo,
2682
+ opposite);
26002683 break;
26012684
26022685 case 2: // '\002'
....@@ -2609,11 +2692,13 @@
26092692 {
26102693 //sel.hitSomething = childToDrag.hitSomething;
26112694 //childToDrag.doEditDrag(info);
2612
- sel.doEditDrag(info, opposite);
2695
+ sel.doEditDrag(//clickInfo,
2696
+ opposite);
26132697 } else
26142698 {
26152699 //super.
2616
- doEditDrag0(info, opposite);
2700
+ doEditDrag0(//clickInfo,
2701
+ opposite);
26172702 }
26182703 }
26192704 break;
....@@ -2631,6 +2716,9 @@
26312716 {
26322717 deselectAll();
26332718 }
2719
+
2720
+ new Exception().printStackTrace();
2721
+
26342722 ClickInfo newInfo = new ClickInfo();
26352723 newInfo.flags = info.flags;
26362724 newInfo.bounds = info.bounds;
....@@ -3078,7 +3166,7 @@
30783166 {
30793167 if (bRep != null)
30803168 {
3081
- bRep.GenerateNormalsMINE();
3169
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30823170 Touch();
30833171 }
30843172 }
....@@ -5043,6 +5131,7 @@
50435131
50445132 if (child == null)
50455133 continue;
5134
+
50465135 if (child.HasTransparency() && child.size() != 0)
50475136 {
50485137 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -5380,6 +5469,51 @@
53805469 blockloop = false;
53815470 }
53825471
5472
+ void ResetSelectable()
5473
+ {
5474
+ if (blockloop)
5475
+ return;
5476
+
5477
+ blockloop = true;
5478
+
5479
+ keepdontselect = dontselect;
5480
+ dontselect = true;
5481
+
5482
+ Object3D child;
5483
+ int nb = Size();
5484
+ for (int i = 0; i < nb; i++)
5485
+ {
5486
+ child = (Object3D) get(i);
5487
+ if (child == null)
5488
+ continue;
5489
+ child.ResetSelectable();
5490
+ }
5491
+
5492
+ blockloop = false;
5493
+ }
5494
+
5495
+ void RestoreSelectable()
5496
+ {
5497
+ if (blockloop)
5498
+ return;
5499
+
5500
+ blockloop = true;
5501
+
5502
+ dontselect = keepdontselect;
5503
+
5504
+ Object3D child;
5505
+ int nb = Size();
5506
+ for (int i = 0; i < nb; i++)
5507
+ {
5508
+ child = (Object3D) get(i);
5509
+ if (child == null)
5510
+ continue;
5511
+ child.RestoreSelectable();
5512
+ }
5513
+
5514
+ blockloop = false;
5515
+ }
5516
+
53835517 boolean IsSelected()
53845518 {
53855519 if (parent == null)
....@@ -5689,6 +5823,38 @@
56895823 }
56905824 }
56915825
5826
+ void EmbedTextures(boolean embed)
5827
+ {
5828
+ if (blockloop)
5829
+ return;
5830
+
5831
+ //if (GetTextures() != null)
5832
+ if (embed)
5833
+ CameraPane.EmbedTextures(GetTextures());
5834
+ else
5835
+ {
5836
+ GetTextures().pigmentdata = null;
5837
+ GetTextures().bumpdata = null;
5838
+ GetTextures().pw = 0;
5839
+ GetTextures().ph = 0;
5840
+ GetTextures().bw = 0;
5841
+ GetTextures().bh = 0;
5842
+ }
5843
+
5844
+ int nb = Size();
5845
+ for (int i = 0; i < nb; i++)
5846
+ {
5847
+ Object3D child = (Object3D) get(i);
5848
+
5849
+ if (child == null)
5850
+ continue;
5851
+
5852
+ blockloop = true;
5853
+ child.EmbedTextures(embed);
5854
+ blockloop = false;
5855
+ }
5856
+ }
5857
+
56925858 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56935859 {
56945860 Draw(display, root, selected, blocked);
....@@ -5775,8 +5941,10 @@
57755941 if (support != null)
57765942 support = support;
57775943
5778
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5779
- boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5944
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5945
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5946
+
5947
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
57805948
57815949 if (!usecalllists && bRep != null && bRep.displaylist > 0)
57825950 {
....@@ -5786,8 +5954,9 @@
57865954 // usecalllists &= !(parent instanceof RandomNode);
57875955 // usecalllists = false;
57885956
5789
- if (GetBRep() != null)
5790
- usecalllists = usecalllists;
5957
+ if (display.DrawMode() == display.SHADOW)
5958
+ //GetBRep() != null)
5959
+ usecalllists = !!usecalllists;
57915960 //System.out.println("draw " + this);
57925961 //new Exception().printStackTrace();
57935962
....@@ -5797,7 +5966,7 @@
57975966
57985967 if (!selectmode && //display.DrawMode() != display.SELECTION &&
57995968 //(touched || (bRep != null && bRep.displaylist <= 0)))
5800
- (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0)))
5969
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
58015970 {
58025971 Globals.lighttouched = true;
58035972 } // all panes...
....@@ -5809,7 +5978,7 @@
58095978 if (!(this instanceof Composite))
58105979 touched = false;
58115980 //if (displaylist == -1 && usecalllists)
5812
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5981
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58135982 {
58145983 bRep.displaylist = display.GenList();
58155984 assert(bRep.displaylist != 0);
....@@ -5820,7 +5989,7 @@
58205989
58215990 //System.out.println("\tnew list " + list);
58225991 //gl.glDrawBuffer(gl.GL_NONE);
5823
- if (usecalllists)
5992
+ if (usecalllists && bRep.displaylist > 0)
58245993 {
58255994 // System.err.println("new list " + bRep.displaylist + " for " + this);
58265995 display.NewList(bRep.displaylist);
....@@ -5829,7 +5998,7 @@
58295998 CallList(display, root, selected, blocked);
58305999
58316000 // compiled = true;
5832
- if (usecalllists)
6001
+ if (usecalllists && bRep.displaylist > 0)
58336002 {
58346003 // System.err.println("end list " + bRep.displaylist + " for " + this);
58356004 display.EndList();
....@@ -5929,6 +6098,7 @@
59296098 if (GetBRep() != null)
59306099 {
59316100 display.NextIndex();
6101
+
59326102 // vertex color conflict : gl.glCallList(list);
59336103 DrawNode(display, root, selected);
59346104 if (this instanceof BezierPatch)
....@@ -7179,20 +7349,23 @@
71797349 }
71807350 }
71817351
7182
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7352
+ static ClickInfo clickInfo = new ClickInfo();
7353
+
7354
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7355
+ Point outPt, Rectangle outRec)
71837356 {
7184
- int hc = info.bounds.x + info.bounds.width / 2;
7185
- int vc = info.bounds.y + info.bounds.height / 2;
7186
- double[][] toscreen = info.toScreen;
7357
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7358
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7359
+ double[][] toscreen = clickInfo.toScreen;
71877360 if (toscreen == null)
71887361 {
7189
- toscreen = new Camera(info.camera.viewCode).toScreen;
7362
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
71907363 }
71917364 cVector vec = in;
71927365 LA.xformPos(in, toscreen, in);
71937366 //System.out.println("Distance = " + info.camera.Distance());
7194
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7195
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7367
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7368
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
71967369 outPt.x = hc + (int) vec.x;
71977370 outPt.y = vc - (int) vec.y;
71987371 outRec.x = outPt.x - 3;
....@@ -7200,15 +7373,18 @@
72007373 outRec.width = outRec.height = 6;
72017374 }
72027375
7203
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7376
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7377
+ )
72047378 {
72057379 Point pt = new Point(0, 0);
72067380 Rectangle rec = new Rectangle();
7207
- calcHotSpot(in, info, pt, rec);
7381
+ calcHotSpot(in, //clickInfo,
7382
+ pt, rec);
72087383 return rec;
72097384 }
72107385
7211
- void drawEditHandles0(ClickInfo info, int level)
7386
+ void drawEditHandles0(//ClickInfo clickInfo,
7387
+ int level)
72127388 {
72137389 if (level == 0)
72147390 {
....@@ -7217,16 +7393,19 @@
72177393 {
72187394 cVector origin = new cVector();
72197395 //LA.xformPos(origin, toParent, origin);
7220
- Rectangle spot = calcHotSpot(origin, info);
7396
+ if (this.clickInfo == null)
7397
+ this.clickInfo = new ClickInfo();
7398
+
7399
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
72217400 Rectangle boundary = new Rectangle();
72227401 boundary.x = spot.x - 30;
72237402 boundary.y = spot.y - 30;
72247403 boundary.width = spot.width + 60;
72257404 boundary.height = spot.height + 60;
7226
- info.g.setColor(Color.red);
7405
+ clickInfo.g.setColor(Color.red);
72277406 int spotw = spot.x + spot.width;
72287407 int spoth = spot.y + spot.height;
7229
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7408
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72307409 // if (CameraPane.Xmin > spot.x)
72317410 // {
72327411 // CameraPane.Xmin = spot.x;
....@@ -7246,8 +7425,8 @@
72467425 spot.translate(32, 32);
72477426 spotw = spot.x + spot.width;
72487427 spoth = spot.y + spot.height;
7249
- info.g.setColor(Color.cyan);
7250
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7428
+ clickInfo.g.setColor(Color.cyan);
7429
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72517430 // if (CameraPane.Xmin > spot.x)
72527431 // {
72537432 // CameraPane.Xmin = spot.x;
....@@ -7267,9 +7446,9 @@
72677446 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
72687447 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
72697448 spot.translate(0, -32);
7270
- info.g.setColor(Color.yellow);
7271
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7272
- info.g.setColor(Color.green);
7449
+ clickInfo.g.setColor(Color.yellow);
7450
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7451
+ clickInfo.g.setColor(Color.green);
72737452 // if (CameraPane.Xmin > spot.x)
72747453 // {
72757454 // CameraPane.Xmin = spot.x;
....@@ -7286,8 +7465,8 @@
72867465 // {
72877466 // CameraPane.Ymax = spoth;
72887467 // }
7289
- info.g.drawArc(boundary.x, boundary.y,
7290
- boundary.width, boundary.height, 0, 360);
7468
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7469
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
72917470 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
72927471 // if (CameraPane.Xmin > boundary.x)
72937472 // {
....@@ -7309,7 +7488,8 @@
73097488 }
73107489 }
73117490
7312
- boolean doEditClick0(ClickInfo info, int level)
7491
+ boolean doEditClick0(//ClickInfo clickInfo,
7492
+ int level)
73137493 {
73147494 if (level == 0)
73157495 {
....@@ -7318,8 +7498,8 @@
73187498
73197499 boolean retval = false;
73207500
7321
- startX = info.x;
7322
- startY = info.y;
7501
+ startX = clickInfo.x;
7502
+ startY = clickInfo.y;
73237503
73247504 hitSomething = -1;
73257505 cVector origin = new cVector();
....@@ -7329,22 +7509,51 @@
73297509 {
73307510 centerPt = new Point(0, 0);
73317511 }
7332
- calcHotSpot(origin, info, centerPt, spot);
7333
- if (spot.contains(info.x, info.y))
7512
+ calcHotSpot(origin, //info,
7513
+ centerPt, spot);
7514
+ if (spot.contains(clickInfo.x, clickInfo.y))
73347515 {
73357516 hitSomething = hitCenter;
73367517 retval = true;
73377518 }
73387519 spot.translate(32, 0);
7339
- if (spot.contains(info.x, info.y))
7520
+ if (spot.contains(clickInfo.x, clickInfo.y))
73407521 {
73417522 hitSomething = hitRotate;
73427523 retval = true;
73437524 }
73447525 spot.translate(0, 32);
7345
- if (spot.contains(info.x, info.y))
7526
+ if (spot.contains(clickInfo.x, clickInfo.y))
73467527 {
73477528 hitSomething = hitScale;
7529
+
7530
+ double scale = 0.005f * clickInfo.camera.Distance();
7531
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7532
+ double sign = 1;
7533
+ if (hScale < 0)
7534
+ {
7535
+ sign = -1;
7536
+ }
7537
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7538
+ if (hScale < 0.01)
7539
+ {
7540
+ //hScale = 0.01;
7541
+ }
7542
+
7543
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7544
+ sign = 1;
7545
+ if (vScale < 0)
7546
+ {
7547
+ sign = -1;
7548
+ }
7549
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7550
+ if (vScale < 0.01)
7551
+ {
7552
+ //vScale = 0.01;
7553
+ }
7554
+
7555
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7556
+
73487557 retval = true;
73497558 }
73507559
....@@ -7354,7 +7563,7 @@
73547563 }
73557564
73567565 //System.out.println("info.modifiers = " + info.modifiers);
7357
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7566
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73587567 //System.out.println("modified = " + modified);
73597568 //new Exception().printStackTrace();
73607569 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7382,7 +7591,8 @@
73827591 return true;
73837592 }
73847593
7385
- void doEditDrag0(ClickInfo info, boolean opposite)
7594
+ void doEditDrag0(//ClickInfo info,
7595
+ boolean opposite)
73867596 {
73877597 if (hitSomething == 0)
73887598 {
....@@ -7396,7 +7606,7 @@
73967606
73977607 //System.out.println("hitSomething = " + hitSomething);
73987608
7399
- double scale = 0.005f * info.camera.Distance();
7609
+ double scale = 0.005f * clickInfo.camera.Distance();
74007610
74017611 cVector xlate = new cVector();
74027612 //cVector xlate2 = new cVector();
....@@ -7430,8 +7640,8 @@
74307640 toParent[3][i] = xlate.get(i);
74317641 LA.matInvert(toParent, fromParent);
74327642 */
7433
- cVector delta = LA.newVector(0, 0, startY - info.y);
7434
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7643
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7644
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74357645
74367646 LA.matCopy(startMat, toParent);
74377647 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7440,7 +7650,7 @@
74407650 } else
74417651 {
74427652 //LA.xformDir(delta, info.camera.fromScreen, delta);
7443
- cVector up = new cVector(info.camera.up);
7653
+ cVector up = new cVector(clickInfo.camera.up);
74447654 cVector away = new cVector();
74457655 //cVector right2 = new cVector();
74467656 //LA.vecCross(up, cVector.Z, right);
....@@ -7457,19 +7667,19 @@
74577667 LA.xformDir(up, ClickInfo.matbuffer, up);
74587668 // if (!CameraPane.LOCALTRANSFORM)
74597669 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7460
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7670
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74617671 // if (!CameraPane.LOCALTRANSFORM)
74627672 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74637673 //LA.vecCross(up, cVector.Z, right2);
74647674
7465
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7675
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
74667676
74677677 //System.out.println("DELTA0 = " + delta);
74687678 //System.out.println("AWAY = " + info.camera.away);
74697679 //System.out.println("UP = " + info.camera.up);
74707680 if (away.z > 0)
74717681 {
7472
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7682
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
74737683 {
74747684 delta.x = -delta.x;
74757685 } else
....@@ -7484,7 +7694,7 @@
74847694 //System.out.println("DELTA1 = " + delta);
74857695 LA.xformDir(delta, ClickInfo.matbuffer, delta);
74867696 //System.out.println("DELTA2 = " + delta);
7487
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7697
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74887698 LA.matCopy(startMat, toParent);
74897699 //System.out.println("DELTA3 = " + delta);
74907700 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7494,8 +7704,8 @@
74947704 break;
74957705
74967706 case hitRotate: // rotate
7497
- int dx = info.x - centerPt.x;
7498
- int dy = -(info.y - centerPt.y);
7707
+ int dx = clickInfo.x - centerPt.x;
7708
+ int dy = -(clickInfo.y - centerPt.y);
74997709 double angle = (double) Math.atan2(dx, dy);
75007710 angle = -(1.570796 - angle);
75017711
....@@ -7518,7 +7728,7 @@
75187728 }
75197729 /**/
75207730
7521
- switch (info.pane.RenderCamera().viewCode)
7731
+ switch (clickInfo.pane.RenderCamera().viewCode)
75227732 {
75237733 case 1: // '\001'
75247734 LA.matZRotate(toParent, angle);
....@@ -7545,7 +7755,7 @@
75457755 break;
75467756
75477757 case hitScale: // scale
7548
- double hScale = (double) (info.x - centerPt.x) / 32;
7758
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
75497759 double sign = 1;
75507760 if (hScale < 0)
75517761 {
....@@ -7557,7 +7767,7 @@
75577767 //hScale = 0.01;
75587768 }
75597769
7560
- double vScale = (double) (info.y - centerPt.y) / 32;
7770
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
75617771 sign = 1;
75627772 if (vScale < 0)
75637773 {
....@@ -7568,6 +7778,7 @@
75687778 {
75697779 //vScale = 0.01;
75707780 }
7781
+
75717782 LA.matCopy(startMat, toParent);
75727783 /**/
75737784 for (int i = 0; i < 3; i++)
....@@ -7577,14 +7788,14 @@
75777788 }
75787789 /**/
75797790
7580
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7791
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
75817792
75827793 if (totalScale < 0.01)
75837794 {
75847795 totalScale = 0.01;
75857796 }
75867797
7587
- switch (info.pane.RenderCamera().viewCode)
7798
+ switch (clickInfo.pane.RenderCamera().viewCode)
75887799 {
75897800 case 3: // '\001'
75907801 if (modified || opposite)
....@@ -7651,7 +7862,7 @@
76517862 } // NEW ...
76527863
76537864
7654
- info.pane.repaint();
7865
+ clickInfo.pane.repaint();
76557866 }
76567867
76577868 boolean overflow = false;
....@@ -7994,6 +8205,8 @@
79948205 transient ObjEditor editWindow;
79958206 transient ObjEditor manipWindow;
79968207
8208
+ transient boolean pinned;
8209
+
79978210 transient ObjectUI objectUI;
79988211 public static int povDepth = 0;
79998212 private static cVector tbMin = new cVector();