Normand Briere
2019-07-27 1af7d3700724834e40ad8636bc9a56cdc3b19b15
Object3D.java
....@@ -24,11 +24,14 @@
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
+ byte[] versions[];
33
+ int versionindex = -1;
34
+
3235 ScriptNode scriptnode;
3336
3437 void InitOthers()
....@@ -170,24 +173,35 @@
170173
171174 void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172175 {
176
+ Object3D o;
177
+
173178 if (hashtable.containsKey(GetUUID()))
174179 {
175
- Object3D o = hashtable.get(GetUUID());
180
+ o = hashtable.get(GetUUID());
176181
177182 Grafreed.Assert(this.bRep == o.bRep);
178
- if (this.bRep != null)
179
- assert(this.bRep.support == o.transientrep);
183
+ //if (this.bRep != null)
184
+ // assert(this.bRep.support == o.transientrep);
185
+ if (this.support != null)
186
+ assert(this.support.bRep == o.transientrep);
187
+ }
188
+ else
189
+ {
190
+ o = new Object3D("copy of " + this.name);
180191
181
- return;
192
+ hashtable.put(GetUUID(), o);
182193 }
183194
184
- Object3D o = new Object3D();
185
-
186
- hashtable.put(GetUUID(), o);
187
-
188
- for (int i=0; i<Size(); i++)
195
+ if (!blockloop)
189196 {
190
- get(i).ExtractBigData(hashtable);
197
+ blockloop = true;
198
+
199
+ for (int i=0; i<Size(); i++)
200
+ {
201
+ get(i).ExtractBigData(hashtable);
202
+ }
203
+
204
+ blockloop = false;
191205 }
192206
193207 ExtractBigData(o);
....@@ -195,11 +209,26 @@
195209
196210 void ExtractBigData(Object3D o)
197211 {
212
+ if (o.bRep != null)
213
+ Grafreed.Assert(o.bRep == this.bRep);
214
+
198215 o.bRep = this.bRep;
199
- if (this.bRep != null)
216
+// July 2019 if (this.bRep != null)
217
+// {
218
+// o.transientrep = this.bRep.support;
219
+// o.bRep.support = null;
220
+// }
221
+ o.selection = this.selection;
222
+ o.versions = this.versions;
223
+ o.versionindex = this.versionindex;
224
+
225
+ if (this.support != null)
200226 {
201
- o.transientrep = this.bRep.support;
202
- o.bRep.support = null;
227
+ if (o.transientrep != null)
228
+ Grafreed.Assert(o.transientrep == this.support.bRep);
229
+
230
+ o.transientrep = this.support.bRep;
231
+ this.support.bRep = null;
203232 }
204233
205234 // o.support = this.support;
....@@ -223,19 +252,35 @@
223252
224253 RestoreBigData(o);
225254
226
- hashtable.remove(GetUUID());
255
+ if (blockloop)
256
+ return;
257
+
258
+ blockloop = true;
259
+
260
+ //hashtable.remove(GetUUID());
227261
228262 for (int i=0; i<Size(); i++)
229263 {
230264 get(i).RestoreBigData(hashtable);
231265 }
266
+
267
+ blockloop = false;
232268 }
233269
234270 void RestoreBigData(Object3D o)
235271 {
236272 this.bRep = o.bRep;
237
- if (this.bRep != null)
238
- this.bRep.support = o.transientrep;
273
+ if (this.support != null && o.transientrep != null)
274
+ {
275
+ this.support.bRep = o.transientrep;
276
+ }
277
+
278
+ this.selection = o.selection;
279
+
280
+ this.versions = o.versions;
281
+ this.versionindex = o.versionindex;
282
+// July 2019 if (this.bRep != null)
283
+// this.bRep.support = o.transientrep;
239284 // this.support = o.support;
240285 // this.fileparent = o.fileparent;
241286 }
....@@ -381,6 +426,7 @@
381426 }
382427
383428 boolean live = false;
429
+ transient boolean keepdontselect;
384430 boolean dontselect = false;
385431 boolean hide = false;
386432 boolean link2master = false; // performs reset support/master at each frame
....@@ -881,7 +927,7 @@
881927
882928 if (marked && Globals.isLIVE() && live &&
883929 //TEMP21aug2018
884
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
930
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
885931 currentframe != Globals.framecount)
886932 {
887933 currentframe = Globals.framecount;
....@@ -966,6 +1012,7 @@
9661012 if (material == null || material.multiply)
9671013 return true;
9681014
1015
+ // Transparent objects are dynamic because we have to sort the triangles.
9691016 return material.opacity > 0.99;
9701017 }
9711018
....@@ -1366,6 +1413,7 @@
13661413 toParent = LA.newMatrix();
13671414 fromParent = LA.newMatrix();
13681415 }
1416
+
13691417 LA.matCopy(other.toParent, toParent);
13701418 LA.matCopy(other.fromParent, fromParent);
13711419
....@@ -2387,6 +2435,10 @@
23872435 }
23882436 */
23892437 }
2438
+ else
2439
+ {
2440
+ //((ObjEditor)editWindow).SetupUI2(null);
2441
+ }
23902442 }
23912443
23922444 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2428,6 +2480,14 @@
24282480 {
24292481 editWindow.refreshContents();
24302482 }
2483
+ else
2484
+ {
2485
+ if (manipWindow != null)
2486
+ {
2487
+ manipWindow.refreshContents();
2488
+ }
2489
+ }
2490
+
24312491 //if (parent != null)
24322492 //parent.refreshEditWindow();
24332493 }
....@@ -2507,7 +2567,8 @@
25072567 private static final int editSelf = 1;
25082568 private static final int editChild = 2;
25092569
2510
- void drawEditHandles(ClickInfo info, int level)
2570
+ void drawEditHandles(//ClickInfo info,
2571
+ int level)
25112572 {
25122573 if (level == 0)
25132574 {
....@@ -2515,7 +2576,8 @@
25152576 return;
25162577
25172578 Object3D selectee;
2518
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2579
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2580
+ level + 1))
25192581 {
25202582 selectee = (Object3D) e.nextElement();
25212583 }
....@@ -2523,19 +2585,22 @@
25232585 } else
25242586 {
25252587 //super.
2526
- drawEditHandles0(info, level + 1);
2588
+ drawEditHandles0(//info,
2589
+ level + 1);
25272590 }
25282591 }
25292592
2530
- boolean doEditClick(ClickInfo info, int level)
2593
+ boolean doEditClick(//ClickInfo info,
2594
+ int level)
25312595 {
25322596 doSomething = 0;
25332597 if (level == 0)
25342598 {
2535
- return doParentClick(info);
2599
+ return doParentClick(); //info);
25362600 }
25372601 if (//super.
2538
- doEditClick0(info, level))
2602
+ doEditClick0(//info,
2603
+ level))
25392604 {
25402605 doSomething = 1;
25412606 return true;
....@@ -2545,7 +2610,7 @@
25452610 }
25462611 }
25472612
2548
- boolean doParentClick(ClickInfo info)
2613
+ boolean doParentClick() //ClickInfo info)
25492614 {
25502615 if (selection == null)
25512616 {
....@@ -2558,7 +2623,8 @@
25582623 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
25592624 {
25602625 Object3D selectee = (Object3D) e.nextElement();
2561
- if (selectee.doEditClick(info, 1))
2626
+ if (selectee.doEditClick(//info,
2627
+ 1))
25622628 {
25632629 childToDrag = selectee;
25642630 doSomething = 2;
....@@ -2570,13 +2636,15 @@
25702636 return retval;
25712637 }
25722638
2573
- void doEditDrag(ClickInfo info, boolean opposite)
2639
+ void doEditDrag(//ClickInfo clickInfo,
2640
+ boolean opposite)
25742641 {
25752642 switch (doSomething)
25762643 {
25772644 case 1: // '\001'
25782645 //super.
2579
- doEditDrag0(info, opposite);
2646
+ doEditDrag0(//clickInfo,
2647
+ opposite);
25802648 break;
25812649
25822650 case 2: // '\002'
....@@ -2589,11 +2657,13 @@
25892657 {
25902658 //sel.hitSomething = childToDrag.hitSomething;
25912659 //childToDrag.doEditDrag(info);
2592
- sel.doEditDrag(info, opposite);
2660
+ sel.doEditDrag(//clickInfo,
2661
+ opposite);
25932662 } else
25942663 {
25952664 //super.
2596
- doEditDrag0(info, opposite);
2665
+ doEditDrag0(//clickInfo,
2666
+ opposite);
25972667 }
25982668 }
25992669 break;
....@@ -2611,6 +2681,9 @@
26112681 {
26122682 deselectAll();
26132683 }
2684
+
2685
+ new Exception().printStackTrace();
2686
+
26142687 ClickInfo newInfo = new ClickInfo();
26152688 newInfo.flags = info.flags;
26162689 newInfo.bounds = info.bounds;
....@@ -3058,7 +3131,7 @@
30583131 {
30593132 if (bRep != null)
30603133 {
3061
- bRep.GenerateNormalsMINE();
3134
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30623135 Touch();
30633136 }
30643137 }
....@@ -4958,6 +5031,14 @@
49585031 }
49595032 }
49605033
5034
+ ObjEditor GetWindow()
5035
+ {
5036
+ if (editWindow != null)
5037
+ return editWindow;
5038
+
5039
+ return manipWindow;
5040
+ }
5041
+
49615042 cTreePath Select(int indexcount, boolean deselect)
49625043 {
49635044 if (hide || dontselect)
....@@ -4994,10 +5075,11 @@
49945075 if (leaf != null)
49955076 {
49965077 cTreePath tp = new cTreePath(this, leaf);
4997
- if (editWindow != null)
5078
+ ObjEditor window = GetWindow();
5079
+ if (window != null)
49985080 {
49995081 //System.out.println("editWindow = " + editWindow + " vs " + this);
5000
- editWindow.Select(tp, deselect, true);
5082
+ window.Select(tp, deselect, true);
50015083 }
50025084
50035085 return tp;
....@@ -5014,6 +5096,7 @@
50145096
50155097 if (child == null)
50165098 continue;
5099
+
50175100 if (child.HasTransparency() && child.size() != 0)
50185101 {
50195102 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -5023,9 +5106,10 @@
50235106 if (leaf != null)
50245107 {
50255108 cTreePath tp = new cTreePath(this, leaf);
5026
- if (editWindow != null)
5109
+ ObjEditor window = GetWindow();
5110
+ if (window != null)
50275111 {
5028
- editWindow.Select(tp, deselect, true);
5112
+ window.Select(tp, deselect, true);
50295113 }
50305114
50315115 return tp;
....@@ -5350,6 +5434,51 @@
53505434 blockloop = false;
53515435 }
53525436
5437
+ void ResetSelectable()
5438
+ {
5439
+ if (blockloop)
5440
+ return;
5441
+
5442
+ blockloop = true;
5443
+
5444
+ keepdontselect = dontselect;
5445
+ dontselect = true;
5446
+
5447
+ Object3D child;
5448
+ int nb = Size();
5449
+ for (int i = 0; i < nb; i++)
5450
+ {
5451
+ child = (Object3D) get(i);
5452
+ if (child == null)
5453
+ continue;
5454
+ child.ResetSelectable();
5455
+ }
5456
+
5457
+ blockloop = false;
5458
+ }
5459
+
5460
+ void RestoreSelectable()
5461
+ {
5462
+ if (blockloop)
5463
+ return;
5464
+
5465
+ blockloop = true;
5466
+
5467
+ dontselect = keepdontselect;
5468
+
5469
+ Object3D child;
5470
+ int nb = Size();
5471
+ for (int i = 0; i < nb; i++)
5472
+ {
5473
+ child = (Object3D) get(i);
5474
+ if (child == null)
5475
+ continue;
5476
+ child.RestoreSelectable();
5477
+ }
5478
+
5479
+ blockloop = false;
5480
+ }
5481
+
53535482 boolean IsSelected()
53545483 {
53555484 if (parent == null)
....@@ -5659,6 +5788,38 @@
56595788 }
56605789 }
56615790
5791
+ void EmbedTextures(boolean embed)
5792
+ {
5793
+ if (blockloop)
5794
+ return;
5795
+
5796
+ //if (GetTextures() != null)
5797
+ if (embed)
5798
+ CameraPane.EmbedTextures(GetTextures());
5799
+ else
5800
+ {
5801
+ GetTextures().pigmentdata = null;
5802
+ GetTextures().bumpdata = null;
5803
+ GetTextures().pw = 0;
5804
+ GetTextures().ph = 0;
5805
+ GetTextures().bw = 0;
5806
+ GetTextures().bh = 0;
5807
+ }
5808
+
5809
+ int nb = Size();
5810
+ for (int i = 0; i < nb; i++)
5811
+ {
5812
+ Object3D child = (Object3D) get(i);
5813
+
5814
+ if (child == null)
5815
+ continue;
5816
+
5817
+ blockloop = true;
5818
+ child.EmbedTextures(embed);
5819
+ blockloop = false;
5820
+ }
5821
+ }
5822
+
56625823 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56635824 {
56645825 Draw(display, root, selected, blocked);
....@@ -5746,7 +5907,7 @@
57465907 support = support;
57475908
57485909 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5749
- boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5910
+ boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
57505911
57515912 if (!usecalllists && bRep != null && bRep.displaylist > 0)
57525913 {
....@@ -5767,7 +5928,7 @@
57675928
57685929 if (!selectmode && //display.DrawMode() != display.SELECTION &&
57695930 //(touched || (bRep != null && bRep.displaylist <= 0)))
5770
- (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
5931
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
57715932 {
57725933 Globals.lighttouched = true;
57735934 } // all panes...
....@@ -5899,6 +6060,7 @@
58996060 if (GetBRep() != null)
59006061 {
59016062 display.NextIndex();
6063
+
59026064 // vertex color conflict : gl.glCallList(list);
59036065 DrawNode(display, root, selected);
59046066 if (this instanceof BezierPatch)
....@@ -6359,6 +6521,11 @@
63596521 // dec 2012
63606522 new Exception().printStackTrace();
63616523 return;
6524
+ }
6525
+
6526
+ if (dontselect)
6527
+ {
6528
+ //bRep.GenerateNormalsMINE();
63626529 }
63636530
63646531 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7144,20 +7311,23 @@
71447311 }
71457312 }
71467313
7147
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7314
+ static ClickInfo clickInfo = new ClickInfo();
7315
+
7316
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7317
+ Point outPt, Rectangle outRec)
71487318 {
7149
- int hc = info.bounds.x + info.bounds.width / 2;
7150
- int vc = info.bounds.y + info.bounds.height / 2;
7151
- double[][] toscreen = info.toScreen;
7319
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7320
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7321
+ double[][] toscreen = clickInfo.toScreen;
71527322 if (toscreen == null)
71537323 {
7154
- toscreen = new Camera(info.camera.viewCode).toScreen;
7324
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
71557325 }
71567326 cVector vec = in;
71577327 LA.xformPos(in, toscreen, in);
71587328 //System.out.println("Distance = " + info.camera.Distance());
7159
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7160
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7329
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7330
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
71617331 outPt.x = hc + (int) vec.x;
71627332 outPt.y = vc - (int) vec.y;
71637333 outRec.x = outPt.x - 3;
....@@ -7165,15 +7335,18 @@
71657335 outRec.width = outRec.height = 6;
71667336 }
71677337
7168
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7338
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7339
+ )
71697340 {
71707341 Point pt = new Point(0, 0);
71717342 Rectangle rec = new Rectangle();
7172
- calcHotSpot(in, info, pt, rec);
7343
+ calcHotSpot(in, //clickInfo,
7344
+ pt, rec);
71737345 return rec;
71747346 }
71757347
7176
- void drawEditHandles0(ClickInfo info, int level)
7348
+ void drawEditHandles0(//ClickInfo clickInfo,
7349
+ int level)
71777350 {
71787351 if (level == 0)
71797352 {
....@@ -7182,16 +7355,19 @@
71827355 {
71837356 cVector origin = new cVector();
71847357 //LA.xformPos(origin, toParent, origin);
7185
- Rectangle spot = calcHotSpot(origin, info);
7358
+ if (this.clickInfo == null)
7359
+ this.clickInfo = new ClickInfo();
7360
+
7361
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
71867362 Rectangle boundary = new Rectangle();
71877363 boundary.x = spot.x - 30;
71887364 boundary.y = spot.y - 30;
71897365 boundary.width = spot.width + 60;
71907366 boundary.height = spot.height + 60;
7191
- info.g.setColor(Color.red);
7367
+ clickInfo.g.setColor(Color.red);
71927368 int spotw = spot.x + spot.width;
71937369 int spoth = spot.y + spot.height;
7194
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7370
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
71957371 // if (CameraPane.Xmin > spot.x)
71967372 // {
71977373 // CameraPane.Xmin = spot.x;
....@@ -7211,8 +7387,8 @@
72117387 spot.translate(32, 32);
72127388 spotw = spot.x + spot.width;
72137389 spoth = spot.y + spot.height;
7214
- info.g.setColor(Color.cyan);
7215
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7390
+ clickInfo.g.setColor(Color.cyan);
7391
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72167392 // if (CameraPane.Xmin > spot.x)
72177393 // {
72187394 // CameraPane.Xmin = spot.x;
....@@ -7232,9 +7408,9 @@
72327408 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
72337409 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
72347410 spot.translate(0, -32);
7235
- info.g.setColor(Color.yellow);
7236
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7237
- info.g.setColor(Color.green);
7411
+ clickInfo.g.setColor(Color.yellow);
7412
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7413
+ clickInfo.g.setColor(Color.green);
72387414 // if (CameraPane.Xmin > spot.x)
72397415 // {
72407416 // CameraPane.Xmin = spot.x;
....@@ -7251,8 +7427,8 @@
72517427 // {
72527428 // CameraPane.Ymax = spoth;
72537429 // }
7254
- info.g.drawArc(boundary.x, boundary.y,
7255
- boundary.width, boundary.height, 0, 360);
7430
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7431
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
72567432 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
72577433 // if (CameraPane.Xmin > boundary.x)
72587434 // {
....@@ -7274,7 +7450,8 @@
72747450 }
72757451 }
72767452
7277
- boolean doEditClick0(ClickInfo info, int level)
7453
+ boolean doEditClick0(//ClickInfo clickInfo,
7454
+ int level)
72787455 {
72797456 if (level == 0)
72807457 {
....@@ -7283,8 +7460,8 @@
72837460
72847461 boolean retval = false;
72857462
7286
- startX = info.x;
7287
- startY = info.y;
7463
+ startX = clickInfo.x;
7464
+ startY = clickInfo.y;
72887465
72897466 hitSomething = -1;
72907467 cVector origin = new cVector();
....@@ -7294,22 +7471,51 @@
72947471 {
72957472 centerPt = new Point(0, 0);
72967473 }
7297
- calcHotSpot(origin, info, centerPt, spot);
7298
- if (spot.contains(info.x, info.y))
7474
+ calcHotSpot(origin, //info,
7475
+ centerPt, spot);
7476
+ if (spot.contains(clickInfo.x, clickInfo.y))
72997477 {
73007478 hitSomething = hitCenter;
73017479 retval = true;
73027480 }
73037481 spot.translate(32, 0);
7304
- if (spot.contains(info.x, info.y))
7482
+ if (spot.contains(clickInfo.x, clickInfo.y))
73057483 {
73067484 hitSomething = hitRotate;
73077485 retval = true;
73087486 }
73097487 spot.translate(0, 32);
7310
- if (spot.contains(info.x, info.y))
7488
+ if (spot.contains(clickInfo.x, clickInfo.y))
73117489 {
73127490 hitSomething = hitScale;
7491
+
7492
+ double scale = 0.005f * clickInfo.camera.Distance();
7493
+ double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
7494
+ double sign = 1;
7495
+ if (hScale < 0)
7496
+ {
7497
+ sign = -1;
7498
+ }
7499
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7500
+ if (hScale < 0.01)
7501
+ {
7502
+ //hScale = 0.01;
7503
+ }
7504
+
7505
+ double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
7506
+ sign = 1;
7507
+ if (vScale < 0)
7508
+ {
7509
+ sign = -1;
7510
+ }
7511
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7512
+ if (vScale < 0.01)
7513
+ {
7514
+ //vScale = 0.01;
7515
+ }
7516
+
7517
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7518
+
73137519 retval = true;
73147520 }
73157521
....@@ -7319,7 +7525,7 @@
73197525 }
73207526
73217527 //System.out.println("info.modifiers = " + info.modifiers);
7322
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7528
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73237529 //System.out.println("modified = " + modified);
73247530 //new Exception().printStackTrace();
73257531 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7347,7 +7553,8 @@
73477553 return true;
73487554 }
73497555
7350
- void doEditDrag0(ClickInfo info, boolean opposite)
7556
+ void doEditDrag0(//ClickInfo info,
7557
+ boolean opposite)
73517558 {
73527559 if (hitSomething == 0)
73537560 {
....@@ -7361,7 +7568,7 @@
73617568
73627569 //System.out.println("hitSomething = " + hitSomething);
73637570
7364
- double scale = 0.005f * info.camera.Distance();
7571
+ double scale = 0.005f * clickInfo.camera.Distance();
73657572
73667573 cVector xlate = new cVector();
73677574 //cVector xlate2 = new cVector();
....@@ -7395,8 +7602,8 @@
73957602 toParent[3][i] = xlate.get(i);
73967603 LA.matInvert(toParent, fromParent);
73977604 */
7398
- cVector delta = LA.newVector(0, 0, startY - info.y);
7399
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7605
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7606
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74007607
74017608 LA.matCopy(startMat, toParent);
74027609 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7405,7 +7612,7 @@
74057612 } else
74067613 {
74077614 //LA.xformDir(delta, info.camera.fromScreen, delta);
7408
- cVector up = new cVector(info.camera.up);
7615
+ cVector up = new cVector(clickInfo.camera.up);
74097616 cVector away = new cVector();
74107617 //cVector right2 = new cVector();
74117618 //LA.vecCross(up, cVector.Z, right);
....@@ -7422,19 +7629,19 @@
74227629 LA.xformDir(up, ClickInfo.matbuffer, up);
74237630 // if (!CameraPane.LOCALTRANSFORM)
74247631 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7425
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7632
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74267633 // if (!CameraPane.LOCALTRANSFORM)
74277634 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74287635 //LA.vecCross(up, cVector.Z, right2);
74297636
7430
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7637
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
74317638
74327639 //System.out.println("DELTA0 = " + delta);
74337640 //System.out.println("AWAY = " + info.camera.away);
74347641 //System.out.println("UP = " + info.camera.up);
74357642 if (away.z > 0)
74367643 {
7437
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7644
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
74387645 {
74397646 delta.x = -delta.x;
74407647 } else
....@@ -7449,7 +7656,7 @@
74497656 //System.out.println("DELTA1 = " + delta);
74507657 LA.xformDir(delta, ClickInfo.matbuffer, delta);
74517658 //System.out.println("DELTA2 = " + delta);
7452
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7659
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74537660 LA.matCopy(startMat, toParent);
74547661 //System.out.println("DELTA3 = " + delta);
74557662 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7459,8 +7666,8 @@
74597666 break;
74607667
74617668 case hitRotate: // rotate
7462
- int dx = info.x - centerPt.x;
7463
- int dy = -(info.y - centerPt.y);
7669
+ int dx = clickInfo.x - centerPt.x;
7670
+ int dy = -(clickInfo.y - centerPt.y);
74647671 double angle = (double) Math.atan2(dx, dy);
74657672 angle = -(1.570796 - angle);
74667673
....@@ -7483,7 +7690,7 @@
74837690 }
74847691 /**/
74857692
7486
- switch (info.pane.RenderCamera().viewCode)
7693
+ switch (clickInfo.pane.RenderCamera().viewCode)
74877694 {
74887695 case 1: // '\001'
74897696 LA.matZRotate(toParent, angle);
....@@ -7510,7 +7717,7 @@
75107717 break;
75117718
75127719 case hitScale: // scale
7513
- double hScale = (double) (info.x - centerPt.x) / 32;
7720
+ double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
75147721 double sign = 1;
75157722 if (hScale < 0)
75167723 {
....@@ -7522,7 +7729,7 @@
75227729 //hScale = 0.01;
75237730 }
75247731
7525
- double vScale = (double) (info.y - centerPt.y) / 32;
7732
+ double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
75267733 sign = 1;
75277734 if (vScale < 0)
75287735 {
....@@ -7533,6 +7740,7 @@
75337740 {
75347741 //vScale = 0.01;
75357742 }
7743
+
75367744 LA.matCopy(startMat, toParent);
75377745 /**/
75387746 for (int i = 0; i < 3; i++)
....@@ -7542,14 +7750,14 @@
75427750 }
75437751 /**/
75447752
7545
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7753
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
75467754
75477755 if (totalScale < 0.01)
75487756 {
75497757 totalScale = 0.01;
75507758 }
75517759
7552
- switch (info.pane.RenderCamera().viewCode)
7760
+ switch (clickInfo.pane.RenderCamera().viewCode)
75537761 {
75547762 case 3: // '\001'
75557763 if (modified || opposite)
....@@ -7616,7 +7824,7 @@
76167824 } // NEW ...
76177825
76187826
7619
- info.pane.repaint();
7827
+ clickInfo.pane.repaint();
76207828 }
76217829
76227830 boolean overflow = false;
....@@ -7796,6 +8004,10 @@
77968004 editWindow = null;
77978005 } // ?
77988006 }
8007
+ else
8008
+ {
8009
+ //editWindow.closeUI();
8010
+ }
77998011 }
78008012
78018013 boolean root; // patch for edit windows
....@@ -7953,6 +8165,10 @@
79538165 }
79548166
79558167 transient ObjEditor editWindow;
8168
+ transient ObjEditor manipWindow;
8169
+
8170
+ transient boolean pinned;
8171
+
79568172 transient ObjectUI objectUI;
79578173 public static int povDepth = 0;
79588174 private static cVector tbMin = new cVector();