Normand Briere
2019-08-01 7d02eaffc02895a01d95d8fd7e089044449e1d6d
Object3D.java
....@@ -24,11 +24,17 @@
2424
2525 private UUID uuid = UUID.randomUUID();
2626
27
- // TEMPORARY for mocap undo
28
- mocap.reader.BVHReader.BVHResult bvh;
29
- Object3D skeleton;
27
+ // TEMPORARY for mocap undo. No need to be transient.
28
+ mocap.reader.BVHReader.BVHResult savebvh;
29
+ Object3D saveskeleton;
3030 //
3131
32
+ String skyboxname;
33
+ String skyboxext;
34
+
35
+ byte[] versions[];
36
+ int versionindex = -1;
37
+
3238 ScriptNode scriptnode;
3339
3440 void InitOthers()
....@@ -170,24 +176,35 @@
170176
171177 void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172178 {
179
+ Object3D o;
180
+
173181 if (hashtable.containsKey(GetUUID()))
174182 {
175
- Object3D o = hashtable.get(GetUUID());
183
+ o = hashtable.get(GetUUID());
176184
177185 Grafreed.Assert(this.bRep == o.bRep);
178
- if (this.bRep != null)
179
- assert(this.bRep.support == o.transientrep);
186
+ //if (this.bRep != null)
187
+ // assert(this.bRep.support == o.transientrep);
188
+ if (this.support != null)
189
+ assert(this.support.bRep == o.transientrep);
190
+ }
191
+ else
192
+ {
193
+ o = new Object3D("copy of " + this.name);
180194
181
- return;
195
+ hashtable.put(GetUUID(), o);
182196 }
183197
184
- Object3D o = new Object3D("copy of " + this.name);
185
-
186
- hashtable.put(GetUUID(), o);
187
-
188
- for (int i=0; i<Size(); i++)
198
+ if (!blockloop)
189199 {
190
- get(i).ExtractBigData(hashtable);
200
+ blockloop = true;
201
+
202
+ for (int i=0; i<Size(); i++)
203
+ {
204
+ get(i).ExtractBigData(hashtable);
205
+ }
206
+
207
+ blockloop = false;
191208 }
192209
193210 ExtractBigData(o);
....@@ -195,11 +212,26 @@
195212
196213 void ExtractBigData(Object3D o)
197214 {
215
+ if (o.bRep != null)
216
+ Grafreed.Assert(o.bRep == this.bRep);
217
+
198218 o.bRep = this.bRep;
199
- if (this.bRep != null)
219
+// July 2019 if (this.bRep != null)
220
+// {
221
+// o.transientrep = this.bRep.support;
222
+// o.bRep.support = null;
223
+// }
224
+ o.selection = this.selection;
225
+ o.versions = this.versions;
226
+ o.versionindex = this.versionindex;
227
+
228
+ if (this.support != null)
200229 {
201
- o.transientrep = this.bRep.support;
202
- o.bRep.support = null;
230
+ if (o.transientrep != null)
231
+ Grafreed.Assert(o.transientrep == this.support.bRep);
232
+
233
+ o.transientrep = this.support.bRep;
234
+ this.support.bRep = null;
203235 }
204236
205237 // o.support = this.support;
....@@ -219,14 +251,14 @@
219251 if (!hashtable.containsKey(GetUUID()))
220252 return;
221253
254
+ Object3D o = hashtable.get(GetUUID());
255
+
256
+ RestoreBigData(o);
257
+
222258 if (blockloop)
223259 return;
224260
225261 blockloop = true;
226
-
227
- Object3D o = hashtable.get(GetUUID());
228
-
229
- RestoreBigData(o);
230262
231263 //hashtable.remove(GetUUID());
232264
....@@ -241,8 +273,17 @@
241273 void RestoreBigData(Object3D o)
242274 {
243275 this.bRep = o.bRep;
244
- if (this.bRep != null)
245
- this.bRep.support = o.transientrep;
276
+ if (this.support != null && o.transientrep != null)
277
+ {
278
+ this.support.bRep = o.transientrep;
279
+ }
280
+
281
+ this.selection = o.selection;
282
+
283
+ this.versions = o.versions;
284
+ this.versionindex = o.versionindex;
285
+// July 2019 if (this.bRep != null)
286
+// this.bRep.support = o.transientrep;
246287 // this.support = o.support;
247288 // this.fileparent = o.fileparent;
248289 }
....@@ -388,6 +429,7 @@
388429 }
389430
390431 boolean live = false;
432
+ transient boolean keepdontselect;
391433 boolean dontselect = false;
392434 boolean hide = false;
393435 boolean link2master = false; // performs reset support/master at each frame
....@@ -973,6 +1015,9 @@
9731015 if (material == null || material.multiply)
9741016 return true;
9751017
1018
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1019
+ return false;
1020
+
9761021 // Transparent objects are dynamic because we have to sort the triangles.
9771022 return material.opacity > 0.99;
9781023 }
....@@ -1374,6 +1419,7 @@
13741419 toParent = LA.newMatrix();
13751420 fromParent = LA.newMatrix();
13761421 }
1422
+
13771423 LA.matCopy(other.toParent, toParent);
13781424 LA.matCopy(other.fromParent, fromParent);
13791425
....@@ -2527,7 +2573,8 @@
25272573 private static final int editSelf = 1;
25282574 private static final int editChild = 2;
25292575
2530
- void drawEditHandles(ClickInfo info, int level)
2576
+ void drawEditHandles(//ClickInfo info,
2577
+ int level)
25312578 {
25322579 if (level == 0)
25332580 {
....@@ -2535,7 +2582,8 @@
25352582 return;
25362583
25372584 Object3D selectee;
2538
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2585
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2586
+ level + 1))
25392587 {
25402588 selectee = (Object3D) e.nextElement();
25412589 }
....@@ -2543,19 +2591,22 @@
25432591 } else
25442592 {
25452593 //super.
2546
- drawEditHandles0(info, level + 1);
2594
+ drawEditHandles0(//info,
2595
+ level + 1);
25472596 }
25482597 }
25492598
2550
- boolean doEditClick(ClickInfo info, int level)
2599
+ boolean doEditClick(//ClickInfo info,
2600
+ int level)
25512601 {
25522602 doSomething = 0;
25532603 if (level == 0)
25542604 {
2555
- return doParentClick(info);
2605
+ return doParentClick(); //info);
25562606 }
25572607 if (//super.
2558
- doEditClick0(info, level))
2608
+ doEditClick0(//info,
2609
+ level))
25592610 {
25602611 doSomething = 1;
25612612 return true;
....@@ -2565,7 +2616,7 @@
25652616 }
25662617 }
25672618
2568
- boolean doParentClick(ClickInfo info)
2619
+ boolean doParentClick() //ClickInfo info)
25692620 {
25702621 if (selection == null)
25712622 {
....@@ -2578,7 +2629,8 @@
25782629 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
25792630 {
25802631 Object3D selectee = (Object3D) e.nextElement();
2581
- if (selectee.doEditClick(info, 1))
2632
+ if (selectee.doEditClick(//info,
2633
+ 1))
25822634 {
25832635 childToDrag = selectee;
25842636 doSomething = 2;
....@@ -2590,13 +2642,15 @@
25902642 return retval;
25912643 }
25922644
2593
- void doEditDrag(ClickInfo info, boolean opposite)
2645
+ void doEditDrag(//ClickInfo clickInfo,
2646
+ boolean opposite)
25942647 {
25952648 switch (doSomething)
25962649 {
25972650 case 1: // '\001'
25982651 //super.
2599
- doEditDrag0(info, opposite);
2652
+ doEditDrag0(//clickInfo,
2653
+ opposite);
26002654 break;
26012655
26022656 case 2: // '\002'
....@@ -2609,11 +2663,13 @@
26092663 {
26102664 //sel.hitSomething = childToDrag.hitSomething;
26112665 //childToDrag.doEditDrag(info);
2612
- sel.doEditDrag(info, opposite);
2666
+ sel.doEditDrag(//clickInfo,
2667
+ opposite);
26132668 } else
26142669 {
26152670 //super.
2616
- doEditDrag0(info, opposite);
2671
+ doEditDrag0(//clickInfo,
2672
+ opposite);
26172673 }
26182674 }
26192675 break;
....@@ -2631,6 +2687,9 @@
26312687 {
26322688 deselectAll();
26332689 }
2690
+
2691
+ new Exception().printStackTrace();
2692
+
26342693 ClickInfo newInfo = new ClickInfo();
26352694 newInfo.flags = info.flags;
26362695 newInfo.bounds = info.bounds;
....@@ -3078,7 +3137,7 @@
30783137 {
30793138 if (bRep != null)
30803139 {
3081
- bRep.GenerateNormalsMINE();
3140
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30823141 Touch();
30833142 }
30843143 }
....@@ -5043,6 +5102,7 @@
50435102
50445103 if (child == null)
50455104 continue;
5105
+
50465106 if (child.HasTransparency() && child.size() != 0)
50475107 {
50485108 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -5380,6 +5440,51 @@
53805440 blockloop = false;
53815441 }
53825442
5443
+ void ResetSelectable()
5444
+ {
5445
+ if (blockloop)
5446
+ return;
5447
+
5448
+ blockloop = true;
5449
+
5450
+ keepdontselect = dontselect;
5451
+ dontselect = true;
5452
+
5453
+ Object3D child;
5454
+ int nb = Size();
5455
+ for (int i = 0; i < nb; i++)
5456
+ {
5457
+ child = (Object3D) get(i);
5458
+ if (child == null)
5459
+ continue;
5460
+ child.ResetSelectable();
5461
+ }
5462
+
5463
+ blockloop = false;
5464
+ }
5465
+
5466
+ void RestoreSelectable()
5467
+ {
5468
+ if (blockloop)
5469
+ return;
5470
+
5471
+ blockloop = true;
5472
+
5473
+ dontselect = keepdontselect;
5474
+
5475
+ Object3D child;
5476
+ int nb = Size();
5477
+ for (int i = 0; i < nb; i++)
5478
+ {
5479
+ child = (Object3D) get(i);
5480
+ if (child == null)
5481
+ continue;
5482
+ child.RestoreSelectable();
5483
+ }
5484
+
5485
+ blockloop = false;
5486
+ }
5487
+
53835488 boolean IsSelected()
53845489 {
53855490 if (parent == null)
....@@ -5689,6 +5794,38 @@
56895794 }
56905795 }
56915796
5797
+ void EmbedTextures(boolean embed)
5798
+ {
5799
+ if (blockloop)
5800
+ return;
5801
+
5802
+ //if (GetTextures() != null)
5803
+ if (embed)
5804
+ CameraPane.EmbedTextures(GetTextures());
5805
+ else
5806
+ {
5807
+ GetTextures().pigmentdata = null;
5808
+ GetTextures().bumpdata = null;
5809
+ GetTextures().pw = 0;
5810
+ GetTextures().ph = 0;
5811
+ GetTextures().bw = 0;
5812
+ GetTextures().bh = 0;
5813
+ }
5814
+
5815
+ int nb = Size();
5816
+ for (int i = 0; i < nb; i++)
5817
+ {
5818
+ Object3D child = (Object3D) get(i);
5819
+
5820
+ if (child == null)
5821
+ continue;
5822
+
5823
+ blockloop = true;
5824
+ child.EmbedTextures(embed);
5825
+ blockloop = false;
5826
+ }
5827
+ }
5828
+
56925829 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56935830 {
56945831 Draw(display, root, selected, blocked);
....@@ -5775,8 +5912,10 @@
57755912 if (support != null)
57765913 support = support;
57775914
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);
5915
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5916
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5917
+
5918
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
57805919
57815920 if (!usecalllists && bRep != null && bRep.displaylist > 0)
57825921 {
....@@ -5786,8 +5925,9 @@
57865925 // usecalllists &= !(parent instanceof RandomNode);
57875926 // usecalllists = false;
57885927
5789
- if (GetBRep() != null)
5790
- usecalllists = usecalllists;
5928
+ if (display.DrawMode() == display.SHADOW)
5929
+ //GetBRep() != null)
5930
+ usecalllists = !!usecalllists;
57915931 //System.out.println("draw " + this);
57925932 //new Exception().printStackTrace();
57935933
....@@ -5797,7 +5937,7 @@
57975937
57985938 if (!selectmode && //display.DrawMode() != display.SELECTION &&
57995939 //(touched || (bRep != null && bRep.displaylist <= 0)))
5800
- (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0)))
5940
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
58015941 {
58025942 Globals.lighttouched = true;
58035943 } // all panes...
....@@ -5809,7 +5949,7 @@
58095949 if (!(this instanceof Composite))
58105950 touched = false;
58115951 //if (displaylist == -1 && usecalllists)
5812
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5952
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
58135953 {
58145954 bRep.displaylist = display.GenList();
58155955 assert(bRep.displaylist != 0);
....@@ -5820,7 +5960,7 @@
58205960
58215961 //System.out.println("\tnew list " + list);
58225962 //gl.glDrawBuffer(gl.GL_NONE);
5823
- if (usecalllists)
5963
+ if (usecalllists && bRep.displaylist > 0)
58245964 {
58255965 // System.err.println("new list " + bRep.displaylist + " for " + this);
58265966 display.NewList(bRep.displaylist);
....@@ -5829,7 +5969,7 @@
58295969 CallList(display, root, selected, blocked);
58305970
58315971 // compiled = true;
5832
- if (usecalllists)
5972
+ if (usecalllists && bRep.displaylist > 0)
58335973 {
58345974 // System.err.println("end list " + bRep.displaylist + " for " + this);
58355975 display.EndList();
....@@ -5929,6 +6069,7 @@
59296069 if (GetBRep() != null)
59306070 {
59316071 display.NextIndex();
6072
+
59326073 // vertex color conflict : gl.glCallList(list);
59336074 DrawNode(display, root, selected);
59346075 if (this instanceof BezierPatch)
....@@ -7179,20 +7320,23 @@
71797320 }
71807321 }
71817322
7182
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7323
+ static ClickInfo clickInfo = new ClickInfo();
7324
+
7325
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7326
+ Point outPt, Rectangle outRec)
71837327 {
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;
7328
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7329
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7330
+ double[][] toscreen = clickInfo.toScreen;
71877331 if (toscreen == null)
71887332 {
7189
- toscreen = new Camera(info.camera.viewCode).toScreen;
7333
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
71907334 }
71917335 cVector vec = in;
71927336 LA.xformPos(in, toscreen, in);
71937337 //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();
7338
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7339
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
71967340 outPt.x = hc + (int) vec.x;
71977341 outPt.y = vc - (int) vec.y;
71987342 outRec.x = outPt.x - 3;
....@@ -7200,15 +7344,18 @@
72007344 outRec.width = outRec.height = 6;
72017345 }
72027346
7203
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7347
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7348
+ )
72047349 {
72057350 Point pt = new Point(0, 0);
72067351 Rectangle rec = new Rectangle();
7207
- calcHotSpot(in, info, pt, rec);
7352
+ calcHotSpot(in, //clickInfo,
7353
+ pt, rec);
72087354 return rec;
72097355 }
72107356
7211
- void drawEditHandles0(ClickInfo info, int level)
7357
+ void drawEditHandles0(//ClickInfo clickInfo,
7358
+ int level)
72127359 {
72137360 if (level == 0)
72147361 {
....@@ -7217,16 +7364,19 @@
72177364 {
72187365 cVector origin = new cVector();
72197366 //LA.xformPos(origin, toParent, origin);
7220
- Rectangle spot = calcHotSpot(origin, info);
7367
+ if (this.clickInfo == null)
7368
+ this.clickInfo = new ClickInfo();
7369
+
7370
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
72217371 Rectangle boundary = new Rectangle();
72227372 boundary.x = spot.x - 30;
72237373 boundary.y = spot.y - 30;
72247374 boundary.width = spot.width + 60;
72257375 boundary.height = spot.height + 60;
7226
- info.g.setColor(Color.red);
7376
+ clickInfo.g.setColor(Color.red);
72277377 int spotw = spot.x + spot.width;
72287378 int spoth = spot.y + spot.height;
7229
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7379
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72307380 // if (CameraPane.Xmin > spot.x)
72317381 // {
72327382 // CameraPane.Xmin = spot.x;
....@@ -7246,8 +7396,8 @@
72467396 spot.translate(32, 32);
72477397 spotw = spot.x + spot.width;
72487398 spoth = spot.y + spot.height;
7249
- info.g.setColor(Color.cyan);
7250
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7399
+ clickInfo.g.setColor(Color.cyan);
7400
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72517401 // if (CameraPane.Xmin > spot.x)
72527402 // {
72537403 // CameraPane.Xmin = spot.x;
....@@ -7267,9 +7417,9 @@
72677417 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
72687418 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
72697419 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);
7420
+ clickInfo.g.setColor(Color.yellow);
7421
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7422
+ clickInfo.g.setColor(Color.green);
72737423 // if (CameraPane.Xmin > spot.x)
72747424 // {
72757425 // CameraPane.Xmin = spot.x;
....@@ -7286,8 +7436,8 @@
72867436 // {
72877437 // CameraPane.Ymax = spoth;
72887438 // }
7289
- info.g.drawArc(boundary.x, boundary.y,
7290
- boundary.width, boundary.height, 0, 360);
7439
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7440
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
72917441 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
72927442 // if (CameraPane.Xmin > boundary.x)
72937443 // {
....@@ -7309,7 +7459,8 @@
73097459 }
73107460 }
73117461
7312
- boolean doEditClick0(ClickInfo info, int level)
7462
+ boolean doEditClick0(//ClickInfo clickInfo,
7463
+ int level)
73137464 {
73147465 if (level == 0)
73157466 {
....@@ -7318,8 +7469,8 @@
73187469
73197470 boolean retval = false;
73207471
7321
- startX = info.x;
7322
- startY = info.y;
7472
+ startX = clickInfo.x;
7473
+ startY = clickInfo.y;
73237474
73247475 hitSomething = -1;
73257476 cVector origin = new cVector();
....@@ -7329,22 +7480,51 @@
73297480 {
73307481 centerPt = new Point(0, 0);
73317482 }
7332
- calcHotSpot(origin, info, centerPt, spot);
7333
- if (spot.contains(info.x, info.y))
7483
+ calcHotSpot(origin, //info,
7484
+ centerPt, spot);
7485
+ if (spot.contains(clickInfo.x, clickInfo.y))
73347486 {
73357487 hitSomething = hitCenter;
73367488 retval = true;
73377489 }
73387490 spot.translate(32, 0);
7339
- if (spot.contains(info.x, info.y))
7491
+ if (spot.contains(clickInfo.x, clickInfo.y))
73407492 {
73417493 hitSomething = hitRotate;
73427494 retval = true;
73437495 }
73447496 spot.translate(0, 32);
7345
- if (spot.contains(info.x, info.y))
7497
+ if (spot.contains(clickInfo.x, clickInfo.y))
73467498 {
73477499 hitSomething = hitScale;
7500
+
7501
+ double scale = 0.005f * clickInfo.camera.Distance();
7502
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7503
+ double sign = 1;
7504
+ if (hScale < 0)
7505
+ {
7506
+ sign = -1;
7507
+ }
7508
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7509
+ if (hScale < 0.01)
7510
+ {
7511
+ //hScale = 0.01;
7512
+ }
7513
+
7514
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7515
+ sign = 1;
7516
+ if (vScale < 0)
7517
+ {
7518
+ sign = -1;
7519
+ }
7520
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7521
+ if (vScale < 0.01)
7522
+ {
7523
+ //vScale = 0.01;
7524
+ }
7525
+
7526
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7527
+
73487528 retval = true;
73497529 }
73507530
....@@ -7354,7 +7534,7 @@
73547534 }
73557535
73567536 //System.out.println("info.modifiers = " + info.modifiers);
7357
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7537
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73587538 //System.out.println("modified = " + modified);
73597539 //new Exception().printStackTrace();
73607540 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7382,7 +7562,8 @@
73827562 return true;
73837563 }
73847564
7385
- void doEditDrag0(ClickInfo info, boolean opposite)
7565
+ void doEditDrag0(//ClickInfo info,
7566
+ boolean opposite)
73867567 {
73877568 if (hitSomething == 0)
73887569 {
....@@ -7396,7 +7577,7 @@
73967577
73977578 //System.out.println("hitSomething = " + hitSomething);
73987579
7399
- double scale = 0.005f * info.camera.Distance();
7580
+ double scale = 0.005f * clickInfo.camera.Distance();
74007581
74017582 cVector xlate = new cVector();
74027583 //cVector xlate2 = new cVector();
....@@ -7430,8 +7611,8 @@
74307611 toParent[3][i] = xlate.get(i);
74317612 LA.matInvert(toParent, fromParent);
74327613 */
7433
- cVector delta = LA.newVector(0, 0, startY - info.y);
7434
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7614
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7615
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74357616
74367617 LA.matCopy(startMat, toParent);
74377618 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7440,7 +7621,7 @@
74407621 } else
74417622 {
74427623 //LA.xformDir(delta, info.camera.fromScreen, delta);
7443
- cVector up = new cVector(info.camera.up);
7624
+ cVector up = new cVector(clickInfo.camera.up);
74447625 cVector away = new cVector();
74457626 //cVector right2 = new cVector();
74467627 //LA.vecCross(up, cVector.Z, right);
....@@ -7457,19 +7638,19 @@
74577638 LA.xformDir(up, ClickInfo.matbuffer, up);
74587639 // if (!CameraPane.LOCALTRANSFORM)
74597640 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7460
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7641
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74617642 // if (!CameraPane.LOCALTRANSFORM)
74627643 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74637644 //LA.vecCross(up, cVector.Z, right2);
74647645
7465
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7646
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
74667647
74677648 //System.out.println("DELTA0 = " + delta);
74687649 //System.out.println("AWAY = " + info.camera.away);
74697650 //System.out.println("UP = " + info.camera.up);
74707651 if (away.z > 0)
74717652 {
7472
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7653
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
74737654 {
74747655 delta.x = -delta.x;
74757656 } else
....@@ -7484,7 +7665,7 @@
74847665 //System.out.println("DELTA1 = " + delta);
74857666 LA.xformDir(delta, ClickInfo.matbuffer, delta);
74867667 //System.out.println("DELTA2 = " + delta);
7487
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7668
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74887669 LA.matCopy(startMat, toParent);
74897670 //System.out.println("DELTA3 = " + delta);
74907671 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7494,8 +7675,8 @@
74947675 break;
74957676
74967677 case hitRotate: // rotate
7497
- int dx = info.x - centerPt.x;
7498
- int dy = -(info.y - centerPt.y);
7678
+ int dx = clickInfo.x - centerPt.x;
7679
+ int dy = -(clickInfo.y - centerPt.y);
74997680 double angle = (double) Math.atan2(dx, dy);
75007681 angle = -(1.570796 - angle);
75017682
....@@ -7518,7 +7699,7 @@
75187699 }
75197700 /**/
75207701
7521
- switch (info.pane.RenderCamera().viewCode)
7702
+ switch (clickInfo.pane.RenderCamera().viewCode)
75227703 {
75237704 case 1: // '\001'
75247705 LA.matZRotate(toParent, angle);
....@@ -7545,7 +7726,7 @@
75457726 break;
75467727
75477728 case hitScale: // scale
7548
- double hScale = (double) (info.x - centerPt.x) / 32;
7729
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
75497730 double sign = 1;
75507731 if (hScale < 0)
75517732 {
....@@ -7557,7 +7738,7 @@
75577738 //hScale = 0.01;
75587739 }
75597740
7560
- double vScale = (double) (info.y - centerPt.y) / 32;
7741
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
75617742 sign = 1;
75627743 if (vScale < 0)
75637744 {
....@@ -7568,6 +7749,7 @@
75687749 {
75697750 //vScale = 0.01;
75707751 }
7752
+
75717753 LA.matCopy(startMat, toParent);
75727754 /**/
75737755 for (int i = 0; i < 3; i++)
....@@ -7577,14 +7759,14 @@
75777759 }
75787760 /**/
75797761
7580
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7762
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
75817763
75827764 if (totalScale < 0.01)
75837765 {
75847766 totalScale = 0.01;
75857767 }
75867768
7587
- switch (info.pane.RenderCamera().viewCode)
7769
+ switch (clickInfo.pane.RenderCamera().viewCode)
75887770 {
75897771 case 3: // '\001'
75907772 if (modified || opposite)
....@@ -7651,7 +7833,7 @@
76517833 } // NEW ...
76527834
76537835
7654
- info.pane.repaint();
7836
+ clickInfo.pane.repaint();
76557837 }
76567838
76577839 boolean overflow = false;
....@@ -7994,6 +8176,8 @@
79948176 transient ObjEditor editWindow;
79958177 transient ObjEditor manipWindow;
79968178
8179
+ transient boolean pinned;
8180
+
79978181 transient ObjectUI objectUI;
79988182 public static int povDepth = 0;
79998183 private static cVector tbMin = new cVector();