Normand Briere
2019-08-08 8294241adc5fe698b70e13ebd6780af46ab83f7e
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();
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,6 +247,29 @@
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()))
....@@ -223,19 +279,35 @@
223279
224280 RestoreBigData(o);
225281
226
- hashtable.remove(GetUUID());
282
+ if (blockloop)
283
+ return;
284
+
285
+ blockloop = true;
286
+
287
+ //hashtable.remove(GetUUID());
227288
228289 for (int i=0; i<Size(); i++)
229290 {
230291 get(i).RestoreBigData(hashtable);
231292 }
293
+
294
+ blockloop = false;
232295 }
233296
234297 void RestoreBigData(Object3D o)
235298 {
236299 this.bRep = o.bRep;
237
- if (this.bRep != null)
238
- 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;
239311 // this.support = o.support;
240312 // this.fileparent = o.fileparent;
241313 }
....@@ -381,6 +453,7 @@
381453 }
382454
383455 boolean live = false;
456
+ transient boolean keepdontselect;
384457 boolean dontselect = false;
385458 boolean hide = false;
386459 boolean link2master = false; // performs reset support/master at each frame
....@@ -966,6 +1039,9 @@
9661039 if (material == null || material.multiply)
9671040 return true;
9681041
1042
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1043
+ return false;
1044
+
9691045 // Transparent objects are dynamic because we have to sort the triangles.
9701046 return material.opacity > 0.99;
9711047 }
....@@ -1367,6 +1443,7 @@
13671443 toParent = LA.newMatrix();
13681444 fromParent = LA.newMatrix();
13691445 }
1446
+
13701447 LA.matCopy(other.toParent, toParent);
13711448 LA.matCopy(other.fromParent, fromParent);
13721449
....@@ -2391,6 +2468,7 @@
23912468 else
23922469 {
23932470 //((ObjEditor)editWindow).SetupUI2(null);
2471
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
23942472 }
23952473 }
23962474
....@@ -2433,6 +2511,14 @@
24332511 {
24342512 editWindow.refreshContents();
24352513 }
2514
+ else
2515
+ {
2516
+ if (manipWindow != null)
2517
+ {
2518
+ manipWindow.refreshContents();
2519
+ }
2520
+ }
2521
+
24362522 //if (parent != null)
24372523 //parent.refreshEditWindow();
24382524 }
....@@ -2512,7 +2598,8 @@
25122598 private static final int editSelf = 1;
25132599 private static final int editChild = 2;
25142600
2515
- void drawEditHandles(ClickInfo info, int level)
2601
+ void drawEditHandles(//ClickInfo info,
2602
+ int level)
25162603 {
25172604 if (level == 0)
25182605 {
....@@ -2520,7 +2607,8 @@
25202607 return;
25212608
25222609 Object3D selectee;
2523
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2610
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2611
+ level + 1))
25242612 {
25252613 selectee = (Object3D) e.nextElement();
25262614 }
....@@ -2528,19 +2616,22 @@
25282616 } else
25292617 {
25302618 //super.
2531
- drawEditHandles0(info, level + 1);
2619
+ drawEditHandles0(//info,
2620
+ level + 1);
25322621 }
25332622 }
25342623
2535
- boolean doEditClick(ClickInfo info, int level)
2624
+ boolean doEditClick(//ClickInfo info,
2625
+ int level)
25362626 {
25372627 doSomething = 0;
25382628 if (level == 0)
25392629 {
2540
- return doParentClick(info);
2630
+ return doParentClick(); //info);
25412631 }
25422632 if (//super.
2543
- doEditClick0(info, level))
2633
+ doEditClick0(//info,
2634
+ level))
25442635 {
25452636 doSomething = 1;
25462637 return true;
....@@ -2550,7 +2641,7 @@
25502641 }
25512642 }
25522643
2553
- boolean doParentClick(ClickInfo info)
2644
+ boolean doParentClick() //ClickInfo info)
25542645 {
25552646 if (selection == null)
25562647 {
....@@ -2563,7 +2654,8 @@
25632654 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
25642655 {
25652656 Object3D selectee = (Object3D) e.nextElement();
2566
- if (selectee.doEditClick(info, 1))
2657
+ if (selectee.doEditClick(//info,
2658
+ 1))
25672659 {
25682660 childToDrag = selectee;
25692661 doSomething = 2;
....@@ -2575,13 +2667,15 @@
25752667 return retval;
25762668 }
25772669
2578
- void doEditDrag(ClickInfo info, boolean opposite)
2670
+ void doEditDrag(//ClickInfo clickInfo,
2671
+ boolean opposite)
25792672 {
25802673 switch (doSomething)
25812674 {
25822675 case 1: // '\001'
25832676 //super.
2584
- doEditDrag0(info, opposite);
2677
+ doEditDrag0(//clickInfo,
2678
+ opposite);
25852679 break;
25862680
25872681 case 2: // '\002'
....@@ -2594,11 +2688,13 @@
25942688 {
25952689 //sel.hitSomething = childToDrag.hitSomething;
25962690 //childToDrag.doEditDrag(info);
2597
- sel.doEditDrag(info, opposite);
2691
+ sel.doEditDrag(//clickInfo,
2692
+ opposite);
25982693 } else
25992694 {
26002695 //super.
2601
- doEditDrag0(info, opposite);
2696
+ doEditDrag0(//clickInfo,
2697
+ opposite);
26022698 }
26032699 }
26042700 break;
....@@ -2616,6 +2712,9 @@
26162712 {
26172713 deselectAll();
26182714 }
2715
+
2716
+ new Exception().printStackTrace();
2717
+
26192718 ClickInfo newInfo = new ClickInfo();
26202719 newInfo.flags = info.flags;
26212720 newInfo.bounds = info.bounds;
....@@ -3063,7 +3162,7 @@
30633162 {
30643163 if (bRep != null)
30653164 {
3066
- bRep.GenerateNormalsMINE();
3165
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30673166 Touch();
30683167 }
30693168 }
....@@ -4963,6 +5062,14 @@
49635062 }
49645063 }
49655064
5065
+ ObjEditor GetWindow()
5066
+ {
5067
+ if (editWindow != null)
5068
+ return editWindow;
5069
+
5070
+ return manipWindow;
5071
+ }
5072
+
49665073 cTreePath Select(int indexcount, boolean deselect)
49675074 {
49685075 if (hide || dontselect)
....@@ -4999,10 +5106,11 @@
49995106 if (leaf != null)
50005107 {
50015108 cTreePath tp = new cTreePath(this, leaf);
5002
- if (editWindow != null)
5109
+ ObjEditor window = GetWindow();
5110
+ if (window != null)
50035111 {
50045112 //System.out.println("editWindow = " + editWindow + " vs " + this);
5005
- editWindow.Select(tp, deselect, true);
5113
+ window.Select(tp, deselect, true);
50065114 }
50075115
50085116 return tp;
....@@ -5019,6 +5127,7 @@
50195127
50205128 if (child == null)
50215129 continue;
5130
+
50225131 if (child.HasTransparency() && child.size() != 0)
50235132 {
50245133 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -5028,9 +5137,10 @@
50285137 if (leaf != null)
50295138 {
50305139 cTreePath tp = new cTreePath(this, leaf);
5031
- if (editWindow != null)
5140
+ ObjEditor window = GetWindow();
5141
+ if (window != null)
50325142 {
5033
- editWindow.Select(tp, deselect, true);
5143
+ window.Select(tp, deselect, true);
50345144 }
50355145
50365146 return tp;
....@@ -5355,6 +5465,51 @@
53555465 blockloop = false;
53565466 }
53575467
5468
+ void ResetSelectable()
5469
+ {
5470
+ if (blockloop)
5471
+ return;
5472
+
5473
+ blockloop = true;
5474
+
5475
+ keepdontselect = dontselect;
5476
+ dontselect = true;
5477
+
5478
+ Object3D child;
5479
+ int nb = Size();
5480
+ for (int i = 0; i < nb; i++)
5481
+ {
5482
+ child = (Object3D) get(i);
5483
+ if (child == null)
5484
+ continue;
5485
+ child.ResetSelectable();
5486
+ }
5487
+
5488
+ blockloop = false;
5489
+ }
5490
+
5491
+ void RestoreSelectable()
5492
+ {
5493
+ if (blockloop)
5494
+ return;
5495
+
5496
+ blockloop = true;
5497
+
5498
+ dontselect = keepdontselect;
5499
+
5500
+ Object3D child;
5501
+ int nb = Size();
5502
+ for (int i = 0; i < nb; i++)
5503
+ {
5504
+ child = (Object3D) get(i);
5505
+ if (child == null)
5506
+ continue;
5507
+ child.RestoreSelectable();
5508
+ }
5509
+
5510
+ blockloop = false;
5511
+ }
5512
+
53585513 boolean IsSelected()
53595514 {
53605515 if (parent == null)
....@@ -5664,6 +5819,38 @@
56645819 }
56655820 }
56665821
5822
+ void EmbedTextures(boolean embed)
5823
+ {
5824
+ if (blockloop)
5825
+ return;
5826
+
5827
+ //if (GetTextures() != null)
5828
+ if (embed)
5829
+ CameraPane.EmbedTextures(GetTextures());
5830
+ else
5831
+ {
5832
+ GetTextures().pigmentdata = null;
5833
+ GetTextures().bumpdata = null;
5834
+ GetTextures().pw = 0;
5835
+ GetTextures().ph = 0;
5836
+ GetTextures().bw = 0;
5837
+ GetTextures().bh = 0;
5838
+ }
5839
+
5840
+ int nb = Size();
5841
+ for (int i = 0; i < nb; i++)
5842
+ {
5843
+ Object3D child = (Object3D) get(i);
5844
+
5845
+ if (child == null)
5846
+ continue;
5847
+
5848
+ blockloop = true;
5849
+ child.EmbedTextures(embed);
5850
+ blockloop = false;
5851
+ }
5852
+ }
5853
+
56675854 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56685855 {
56695856 Draw(display, root, selected, blocked);
....@@ -5750,8 +5937,10 @@
57505937 if (support != null)
57515938 support = support;
57525939
5753
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5754
- boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5940
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5941
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5942
+
5943
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
57555944
57565945 if (!usecalllists && bRep != null && bRep.displaylist > 0)
57575946 {
....@@ -5761,8 +5950,9 @@
57615950 // usecalllists &= !(parent instanceof RandomNode);
57625951 // usecalllists = false;
57635952
5764
- if (GetBRep() != null)
5765
- usecalllists = usecalllists;
5953
+ if (display.DrawMode() == display.SHADOW)
5954
+ //GetBRep() != null)
5955
+ usecalllists = !!usecalllists;
57665956 //System.out.println("draw " + this);
57675957 //new Exception().printStackTrace();
57685958
....@@ -5772,7 +5962,7 @@
57725962
57735963 if (!selectmode && //display.DrawMode() != display.SELECTION &&
57745964 //(touched || (bRep != null && bRep.displaylist <= 0)))
5775
- (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0)))
5965
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
57765966 {
57775967 Globals.lighttouched = true;
57785968 } // all panes...
....@@ -5784,7 +5974,7 @@
57845974 if (!(this instanceof Composite))
57855975 touched = false;
57865976 //if (displaylist == -1 && usecalllists)
5787
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
5977
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
57885978 {
57895979 bRep.displaylist = display.GenList();
57905980 assert(bRep.displaylist != 0);
....@@ -5795,7 +5985,7 @@
57955985
57965986 //System.out.println("\tnew list " + list);
57975987 //gl.glDrawBuffer(gl.GL_NONE);
5798
- if (usecalllists)
5988
+ if (usecalllists && bRep.displaylist > 0)
57995989 {
58005990 // System.err.println("new list " + bRep.displaylist + " for " + this);
58015991 display.NewList(bRep.displaylist);
....@@ -5804,7 +5994,7 @@
58045994 CallList(display, root, selected, blocked);
58055995
58065996 // compiled = true;
5807
- if (usecalllists)
5997
+ if (usecalllists && bRep.displaylist > 0)
58085998 {
58095999 // System.err.println("end list " + bRep.displaylist + " for " + this);
58106000 display.EndList();
....@@ -5904,6 +6094,7 @@
59046094 if (GetBRep() != null)
59056095 {
59066096 display.NextIndex();
6097
+
59076098 // vertex color conflict : gl.glCallList(list);
59086099 DrawNode(display, root, selected);
59096100 if (this instanceof BezierPatch)
....@@ -7154,20 +7345,23 @@
71547345 }
71557346 }
71567347
7157
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7348
+ static ClickInfo clickInfo = new ClickInfo();
7349
+
7350
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7351
+ Point outPt, Rectangle outRec)
71587352 {
7159
- int hc = info.bounds.x + info.bounds.width / 2;
7160
- int vc = info.bounds.y + info.bounds.height / 2;
7161
- double[][] toscreen = info.toScreen;
7353
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7354
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7355
+ double[][] toscreen = clickInfo.toScreen;
71627356 if (toscreen == null)
71637357 {
7164
- toscreen = new Camera(info.camera.viewCode).toScreen;
7358
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
71657359 }
71667360 cVector vec = in;
71677361 LA.xformPos(in, toscreen, in);
71687362 //System.out.println("Distance = " + info.camera.Distance());
7169
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7170
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7363
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7364
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
71717365 outPt.x = hc + (int) vec.x;
71727366 outPt.y = vc - (int) vec.y;
71737367 outRec.x = outPt.x - 3;
....@@ -7175,15 +7369,18 @@
71757369 outRec.width = outRec.height = 6;
71767370 }
71777371
7178
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7372
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7373
+ )
71797374 {
71807375 Point pt = new Point(0, 0);
71817376 Rectangle rec = new Rectangle();
7182
- calcHotSpot(in, info, pt, rec);
7377
+ calcHotSpot(in, //clickInfo,
7378
+ pt, rec);
71837379 return rec;
71847380 }
71857381
7186
- void drawEditHandles0(ClickInfo info, int level)
7382
+ void drawEditHandles0(//ClickInfo clickInfo,
7383
+ int level)
71877384 {
71887385 if (level == 0)
71897386 {
....@@ -7192,16 +7389,19 @@
71927389 {
71937390 cVector origin = new cVector();
71947391 //LA.xformPos(origin, toParent, origin);
7195
- Rectangle spot = calcHotSpot(origin, info);
7392
+ if (this.clickInfo == null)
7393
+ this.clickInfo = new ClickInfo();
7394
+
7395
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
71967396 Rectangle boundary = new Rectangle();
71977397 boundary.x = spot.x - 30;
71987398 boundary.y = spot.y - 30;
71997399 boundary.width = spot.width + 60;
72007400 boundary.height = spot.height + 60;
7201
- info.g.setColor(Color.red);
7401
+ clickInfo.g.setColor(Color.red);
72027402 int spotw = spot.x + spot.width;
72037403 int spoth = spot.y + spot.height;
7204
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7404
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72057405 // if (CameraPane.Xmin > spot.x)
72067406 // {
72077407 // CameraPane.Xmin = spot.x;
....@@ -7221,8 +7421,8 @@
72217421 spot.translate(32, 32);
72227422 spotw = spot.x + spot.width;
72237423 spoth = spot.y + spot.height;
7224
- info.g.setColor(Color.cyan);
7225
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7424
+ clickInfo.g.setColor(Color.cyan);
7425
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
72267426 // if (CameraPane.Xmin > spot.x)
72277427 // {
72287428 // CameraPane.Xmin = spot.x;
....@@ -7242,9 +7442,9 @@
72427442 // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
72437443 //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
72447444 spot.translate(0, -32);
7245
- info.g.setColor(Color.yellow);
7246
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7247
- info.g.setColor(Color.green);
7445
+ clickInfo.g.setColor(Color.yellow);
7446
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7447
+ clickInfo.g.setColor(Color.green);
72487448 // if (CameraPane.Xmin > spot.x)
72497449 // {
72507450 // CameraPane.Xmin = spot.x;
....@@ -7261,8 +7461,8 @@
72617461 // {
72627462 // CameraPane.Ymax = spoth;
72637463 // }
7264
- info.g.drawArc(boundary.x, boundary.y,
7265
- boundary.width, boundary.height, 0, 360);
7464
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7465
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
72667466 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
72677467 // if (CameraPane.Xmin > boundary.x)
72687468 // {
....@@ -7284,7 +7484,8 @@
72847484 }
72857485 }
72867486
7287
- boolean doEditClick0(ClickInfo info, int level)
7487
+ boolean doEditClick0(//ClickInfo clickInfo,
7488
+ int level)
72887489 {
72897490 if (level == 0)
72907491 {
....@@ -7293,8 +7494,8 @@
72937494
72947495 boolean retval = false;
72957496
7296
- startX = info.x;
7297
- startY = info.y;
7497
+ startX = clickInfo.x;
7498
+ startY = clickInfo.y;
72987499
72997500 hitSomething = -1;
73007501 cVector origin = new cVector();
....@@ -7304,22 +7505,51 @@
73047505 {
73057506 centerPt = new Point(0, 0);
73067507 }
7307
- calcHotSpot(origin, info, centerPt, spot);
7308
- if (spot.contains(info.x, info.y))
7508
+ calcHotSpot(origin, //info,
7509
+ centerPt, spot);
7510
+ if (spot.contains(clickInfo.x, clickInfo.y))
73097511 {
73107512 hitSomething = hitCenter;
73117513 retval = true;
73127514 }
73137515 spot.translate(32, 0);
7314
- if (spot.contains(info.x, info.y))
7516
+ if (spot.contains(clickInfo.x, clickInfo.y))
73157517 {
73167518 hitSomething = hitRotate;
73177519 retval = true;
73187520 }
73197521 spot.translate(0, 32);
7320
- if (spot.contains(info.x, info.y))
7522
+ if (spot.contains(clickInfo.x, clickInfo.y))
73217523 {
73227524 hitSomething = hitScale;
7525
+
7526
+ double scale = 0.005f * clickInfo.camera.Distance();
7527
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7528
+ double sign = 1;
7529
+ if (hScale < 0)
7530
+ {
7531
+ sign = -1;
7532
+ }
7533
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7534
+ if (hScale < 0.01)
7535
+ {
7536
+ //hScale = 0.01;
7537
+ }
7538
+
7539
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7540
+ sign = 1;
7541
+ if (vScale < 0)
7542
+ {
7543
+ sign = -1;
7544
+ }
7545
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7546
+ if (vScale < 0.01)
7547
+ {
7548
+ //vScale = 0.01;
7549
+ }
7550
+
7551
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7552
+
73237553 retval = true;
73247554 }
73257555
....@@ -7329,7 +7559,7 @@
73297559 }
73307560
73317561 //System.out.println("info.modifiers = " + info.modifiers);
7332
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7562
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
73337563 //System.out.println("modified = " + modified);
73347564 //new Exception().printStackTrace();
73357565 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7357,7 +7587,8 @@
73577587 return true;
73587588 }
73597589
7360
- void doEditDrag0(ClickInfo info, boolean opposite)
7590
+ void doEditDrag0(//ClickInfo info,
7591
+ boolean opposite)
73617592 {
73627593 if (hitSomething == 0)
73637594 {
....@@ -7371,7 +7602,7 @@
73717602
73727603 //System.out.println("hitSomething = " + hitSomething);
73737604
7374
- double scale = 0.005f * info.camera.Distance();
7605
+ double scale = 0.005f * clickInfo.camera.Distance();
73757606
73767607 cVector xlate = new cVector();
73777608 //cVector xlate2 = new cVector();
....@@ -7405,8 +7636,8 @@
74057636 toParent[3][i] = xlate.get(i);
74067637 LA.matInvert(toParent, fromParent);
74077638 */
7408
- cVector delta = LA.newVector(0, 0, startY - info.y);
7409
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7639
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7640
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74107641
74117642 LA.matCopy(startMat, toParent);
74127643 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7415,7 +7646,7 @@
74157646 } else
74167647 {
74177648 //LA.xformDir(delta, info.camera.fromScreen, delta);
7418
- cVector up = new cVector(info.camera.up);
7649
+ cVector up = new cVector(clickInfo.camera.up);
74197650 cVector away = new cVector();
74207651 //cVector right2 = new cVector();
74217652 //LA.vecCross(up, cVector.Z, right);
....@@ -7432,19 +7663,19 @@
74327663 LA.xformDir(up, ClickInfo.matbuffer, up);
74337664 // if (!CameraPane.LOCALTRANSFORM)
74347665 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7435
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7666
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
74367667 // if (!CameraPane.LOCALTRANSFORM)
74377668 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
74387669 //LA.vecCross(up, cVector.Z, right2);
74397670
7440
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7671
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
74417672
74427673 //System.out.println("DELTA0 = " + delta);
74437674 //System.out.println("AWAY = " + info.camera.away);
74447675 //System.out.println("UP = " + info.camera.up);
74457676 if (away.z > 0)
74467677 {
7447
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7678
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
74487679 {
74497680 delta.x = -delta.x;
74507681 } else
....@@ -7459,7 +7690,7 @@
74597690 //System.out.println("DELTA1 = " + delta);
74607691 LA.xformDir(delta, ClickInfo.matbuffer, delta);
74617692 //System.out.println("DELTA2 = " + delta);
7462
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7693
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
74637694 LA.matCopy(startMat, toParent);
74647695 //System.out.println("DELTA3 = " + delta);
74657696 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7469,8 +7700,8 @@
74697700 break;
74707701
74717702 case hitRotate: // rotate
7472
- int dx = info.x - centerPt.x;
7473
- int dy = -(info.y - centerPt.y);
7703
+ int dx = clickInfo.x - centerPt.x;
7704
+ int dy = -(clickInfo.y - centerPt.y);
74747705 double angle = (double) Math.atan2(dx, dy);
74757706 angle = -(1.570796 - angle);
74767707
....@@ -7493,7 +7724,7 @@
74937724 }
74947725 /**/
74957726
7496
- switch (info.pane.RenderCamera().viewCode)
7727
+ switch (clickInfo.pane.RenderCamera().viewCode)
74977728 {
74987729 case 1: // '\001'
74997730 LA.matZRotate(toParent, angle);
....@@ -7520,7 +7751,7 @@
75207751 break;
75217752
75227753 case hitScale: // scale
7523
- double hScale = (double) (info.x - centerPt.x) / 32;
7754
+ double hScale = (double) (clickInfo.x - centerPt.x) / 32;
75247755 double sign = 1;
75257756 if (hScale < 0)
75267757 {
....@@ -7532,7 +7763,7 @@
75327763 //hScale = 0.01;
75337764 }
75347765
7535
- double vScale = (double) (info.y - centerPt.y) / 32;
7766
+ double vScale = (double) (clickInfo.y - centerPt.y) / 32;
75367767 sign = 1;
75377768 if (vScale < 0)
75387769 {
....@@ -7543,6 +7774,7 @@
75437774 {
75447775 //vScale = 0.01;
75457776 }
7777
+
75467778 LA.matCopy(startMat, toParent);
75477779 /**/
75487780 for (int i = 0; i < 3; i++)
....@@ -7552,14 +7784,14 @@
75527784 }
75537785 /**/
75547786
7555
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7787
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
75567788
75577789 if (totalScale < 0.01)
75587790 {
75597791 totalScale = 0.01;
75607792 }
75617793
7562
- switch (info.pane.RenderCamera().viewCode)
7794
+ switch (clickInfo.pane.RenderCamera().viewCode)
75637795 {
75647796 case 3: // '\001'
75657797 if (modified || opposite)
....@@ -7626,7 +7858,7 @@
76267858 } // NEW ...
76277859
76287860
7629
- info.pane.repaint();
7861
+ clickInfo.pane.repaint();
76307862 }
76317863
76327864 boolean overflow = false;
....@@ -7967,6 +8199,10 @@
79678199 }
79688200
79698201 transient ObjEditor editWindow;
8202
+ transient ObjEditor manipWindow;
8203
+
8204
+ transient boolean pinned;
8205
+
79708206 transient ObjectUI objectUI;
79718207 public static int povDepth = 0;
79728208 private static cVector tbMin = new cVector();