.. | .. |
---|
24 | 24 | |
---|
25 | 25 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 26 | |
---|
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; |
---|
30 | 30 | // |
---|
31 | 31 | |
---|
| 32 | + byte[] versions[]; |
---|
| 33 | + int versionindex = -1; |
---|
| 34 | + |
---|
32 | 35 | ScriptNode scriptnode; |
---|
33 | 36 | |
---|
34 | 37 | void InitOthers() |
---|
.. | .. |
---|
170 | 173 | |
---|
171 | 174 | void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
172 | 175 | { |
---|
| 176 | + Object3D o; |
---|
| 177 | + |
---|
173 | 178 | if (hashtable.containsKey(GetUUID())) |
---|
174 | 179 | { |
---|
175 | | - Object3D o = hashtable.get(GetUUID()); |
---|
| 180 | + o = hashtable.get(GetUUID()); |
---|
176 | 181 | |
---|
177 | 182 | 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); |
---|
180 | 191 | |
---|
181 | | - return; |
---|
| 192 | + hashtable.put(GetUUID(), o); |
---|
182 | 193 | } |
---|
183 | 194 | |
---|
184 | | - Object3D o = new Object3D(); |
---|
185 | | - |
---|
186 | | - hashtable.put(GetUUID(), o); |
---|
187 | | - |
---|
188 | | - for (int i=0; i<Size(); i++) |
---|
| 195 | + if (!blockloop) |
---|
189 | 196 | { |
---|
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; |
---|
191 | 205 | } |
---|
192 | 206 | |
---|
193 | 207 | ExtractBigData(o); |
---|
.. | .. |
---|
195 | 209 | |
---|
196 | 210 | void ExtractBigData(Object3D o) |
---|
197 | 211 | { |
---|
| 212 | + if (o.bRep != null) |
---|
| 213 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 214 | + |
---|
198 | 215 | 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) |
---|
200 | 226 | { |
---|
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; |
---|
203 | 232 | } |
---|
204 | 233 | |
---|
205 | 234 | // o.support = this.support; |
---|
.. | .. |
---|
223 | 252 | |
---|
224 | 253 | RestoreBigData(o); |
---|
225 | 254 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 255 | + if (blockloop) |
---|
| 256 | + return; |
---|
| 257 | + |
---|
| 258 | + blockloop = true; |
---|
| 259 | + |
---|
| 260 | + //hashtable.remove(GetUUID()); |
---|
227 | 261 | |
---|
228 | 262 | for (int i=0; i<Size(); i++) |
---|
229 | 263 | { |
---|
230 | 264 | get(i).RestoreBigData(hashtable); |
---|
231 | 265 | } |
---|
| 266 | + |
---|
| 267 | + blockloop = false; |
---|
232 | 268 | } |
---|
233 | 269 | |
---|
234 | 270 | void RestoreBigData(Object3D o) |
---|
235 | 271 | { |
---|
236 | 272 | 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; |
---|
239 | 284 | // this.support = o.support; |
---|
240 | 285 | // this.fileparent = o.fileparent; |
---|
241 | 286 | } |
---|
.. | .. |
---|
381 | 426 | } |
---|
382 | 427 | |
---|
383 | 428 | boolean live = false; |
---|
| 429 | + transient boolean keepdontselect; |
---|
384 | 430 | boolean dontselect = false; |
---|
385 | 431 | boolean hide = false; |
---|
386 | 432 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
1367 | 1413 | toParent = LA.newMatrix(); |
---|
1368 | 1414 | fromParent = LA.newMatrix(); |
---|
1369 | 1415 | } |
---|
| 1416 | + |
---|
1370 | 1417 | LA.matCopy(other.toParent, toParent); |
---|
1371 | 1418 | LA.matCopy(other.fromParent, fromParent); |
---|
1372 | 1419 | |
---|
.. | .. |
---|
2433 | 2480 | { |
---|
2434 | 2481 | editWindow.refreshContents(); |
---|
2435 | 2482 | } |
---|
| 2483 | + else |
---|
| 2484 | + { |
---|
| 2485 | + if (manipWindow != null) |
---|
| 2486 | + { |
---|
| 2487 | + manipWindow.refreshContents(); |
---|
| 2488 | + } |
---|
| 2489 | + } |
---|
| 2490 | + |
---|
2436 | 2491 | //if (parent != null) |
---|
2437 | 2492 | //parent.refreshEditWindow(); |
---|
2438 | 2493 | } |
---|
.. | .. |
---|
2512 | 2567 | private static final int editSelf = 1; |
---|
2513 | 2568 | private static final int editChild = 2; |
---|
2514 | 2569 | |
---|
2515 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2570 | + void drawEditHandles(//ClickInfo info, |
---|
| 2571 | + int level) |
---|
2516 | 2572 | { |
---|
2517 | 2573 | if (level == 0) |
---|
2518 | 2574 | { |
---|
.. | .. |
---|
2520 | 2576 | return; |
---|
2521 | 2577 | |
---|
2522 | 2578 | Object3D selectee; |
---|
2523 | | - 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)) |
---|
2524 | 2581 | { |
---|
2525 | 2582 | selectee = (Object3D) e.nextElement(); |
---|
2526 | 2583 | } |
---|
.. | .. |
---|
2528 | 2585 | } else |
---|
2529 | 2586 | { |
---|
2530 | 2587 | //super. |
---|
2531 | | - drawEditHandles0(info, level + 1); |
---|
| 2588 | + drawEditHandles0(//info, |
---|
| 2589 | + level + 1); |
---|
2532 | 2590 | } |
---|
2533 | 2591 | } |
---|
2534 | 2592 | |
---|
2535 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2593 | + boolean doEditClick(//ClickInfo info, |
---|
| 2594 | + int level) |
---|
2536 | 2595 | { |
---|
2537 | 2596 | doSomething = 0; |
---|
2538 | 2597 | if (level == 0) |
---|
2539 | 2598 | { |
---|
2540 | | - return doParentClick(info); |
---|
| 2599 | + return doParentClick(); //info); |
---|
2541 | 2600 | } |
---|
2542 | 2601 | if (//super. |
---|
2543 | | - doEditClick0(info, level)) |
---|
| 2602 | + doEditClick0(//info, |
---|
| 2603 | + level)) |
---|
2544 | 2604 | { |
---|
2545 | 2605 | doSomething = 1; |
---|
2546 | 2606 | return true; |
---|
.. | .. |
---|
2550 | 2610 | } |
---|
2551 | 2611 | } |
---|
2552 | 2612 | |
---|
2553 | | - boolean doParentClick(ClickInfo info) |
---|
| 2613 | + boolean doParentClick() //ClickInfo info) |
---|
2554 | 2614 | { |
---|
2555 | 2615 | if (selection == null) |
---|
2556 | 2616 | { |
---|
.. | .. |
---|
2563 | 2623 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2564 | 2624 | { |
---|
2565 | 2625 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2566 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2626 | + if (selectee.doEditClick(//info, |
---|
| 2627 | + 1)) |
---|
2567 | 2628 | { |
---|
2568 | 2629 | childToDrag = selectee; |
---|
2569 | 2630 | doSomething = 2; |
---|
.. | .. |
---|
2575 | 2636 | return retval; |
---|
2576 | 2637 | } |
---|
2577 | 2638 | |
---|
2578 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2639 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2640 | + boolean opposite) |
---|
2579 | 2641 | { |
---|
2580 | 2642 | switch (doSomething) |
---|
2581 | 2643 | { |
---|
2582 | 2644 | case 1: // '\001' |
---|
2583 | 2645 | //super. |
---|
2584 | | - doEditDrag0(info, opposite); |
---|
| 2646 | + doEditDrag0(//clickInfo, |
---|
| 2647 | + opposite); |
---|
2585 | 2648 | break; |
---|
2586 | 2649 | |
---|
2587 | 2650 | case 2: // '\002' |
---|
.. | .. |
---|
2594 | 2657 | { |
---|
2595 | 2658 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2596 | 2659 | //childToDrag.doEditDrag(info); |
---|
2597 | | - sel.doEditDrag(info, opposite); |
---|
| 2660 | + sel.doEditDrag(//clickInfo, |
---|
| 2661 | + opposite); |
---|
2598 | 2662 | } else |
---|
2599 | 2663 | { |
---|
2600 | 2664 | //super. |
---|
2601 | | - doEditDrag0(info, opposite); |
---|
| 2665 | + doEditDrag0(//clickInfo, |
---|
| 2666 | + opposite); |
---|
2602 | 2667 | } |
---|
2603 | 2668 | } |
---|
2604 | 2669 | break; |
---|
.. | .. |
---|
2616 | 2681 | { |
---|
2617 | 2682 | deselectAll(); |
---|
2618 | 2683 | } |
---|
| 2684 | + |
---|
| 2685 | + new Exception().printStackTrace(); |
---|
| 2686 | + |
---|
2619 | 2687 | ClickInfo newInfo = new ClickInfo(); |
---|
2620 | 2688 | newInfo.flags = info.flags; |
---|
2621 | 2689 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3063 | 3131 | { |
---|
3064 | 3132 | if (bRep != null) |
---|
3065 | 3133 | { |
---|
3066 | | - bRep.GenerateNormalsMINE(); |
---|
| 3134 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3067 | 3135 | Touch(); |
---|
3068 | 3136 | } |
---|
3069 | 3137 | } |
---|
.. | .. |
---|
4963 | 5031 | } |
---|
4964 | 5032 | } |
---|
4965 | 5033 | |
---|
| 5034 | + ObjEditor GetWindow() |
---|
| 5035 | + { |
---|
| 5036 | + if (editWindow != null) |
---|
| 5037 | + return editWindow; |
---|
| 5038 | + |
---|
| 5039 | + return manipWindow; |
---|
| 5040 | + } |
---|
| 5041 | + |
---|
4966 | 5042 | cTreePath Select(int indexcount, boolean deselect) |
---|
4967 | 5043 | { |
---|
4968 | 5044 | if (hide || dontselect) |
---|
.. | .. |
---|
4999 | 5075 | if (leaf != null) |
---|
5000 | 5076 | { |
---|
5001 | 5077 | cTreePath tp = new cTreePath(this, leaf); |
---|
5002 | | - if (editWindow != null) |
---|
| 5078 | + ObjEditor window = GetWindow(); |
---|
| 5079 | + if (window != null) |
---|
5003 | 5080 | { |
---|
5004 | 5081 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
5005 | | - editWindow.Select(tp, deselect, true); |
---|
| 5082 | + window.Select(tp, deselect, true); |
---|
5006 | 5083 | } |
---|
5007 | 5084 | |
---|
5008 | 5085 | return tp; |
---|
.. | .. |
---|
5019 | 5096 | |
---|
5020 | 5097 | if (child == null) |
---|
5021 | 5098 | continue; |
---|
| 5099 | + |
---|
5022 | 5100 | if (child.HasTransparency() && child.size() != 0) |
---|
5023 | 5101 | { |
---|
5024 | 5102 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
5028 | 5106 | if (leaf != null) |
---|
5029 | 5107 | { |
---|
5030 | 5108 | cTreePath tp = new cTreePath(this, leaf); |
---|
5031 | | - if (editWindow != null) |
---|
| 5109 | + ObjEditor window = GetWindow(); |
---|
| 5110 | + if (window != null) |
---|
5032 | 5111 | { |
---|
5033 | | - editWindow.Select(tp, deselect, true); |
---|
| 5112 | + window.Select(tp, deselect, true); |
---|
5034 | 5113 | } |
---|
5035 | 5114 | |
---|
5036 | 5115 | return tp; |
---|
.. | .. |
---|
5355 | 5434 | blockloop = false; |
---|
5356 | 5435 | } |
---|
5357 | 5436 | |
---|
| 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 | + |
---|
5358 | 5482 | boolean IsSelected() |
---|
5359 | 5483 | { |
---|
5360 | 5484 | if (parent == null) |
---|
.. | .. |
---|
5664 | 5788 | } |
---|
5665 | 5789 | } |
---|
5666 | 5790 | |
---|
| 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 | + |
---|
5667 | 5823 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5668 | 5824 | { |
---|
5669 | 5825 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5751 | 5907 | support = support; |
---|
5752 | 5908 | |
---|
5753 | 5909 | //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); |
---|
| 5910 | + boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5755 | 5911 | |
---|
5756 | 5912 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5757 | 5913 | { |
---|
.. | .. |
---|
5772 | 5928 | |
---|
5773 | 5929 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5774 | 5930 | //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5775 | | - (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
| 5931 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5776 | 5932 | { |
---|
5777 | 5933 | Globals.lighttouched = true; |
---|
5778 | 5934 | } // all panes... |
---|
.. | .. |
---|
5904 | 6060 | if (GetBRep() != null) |
---|
5905 | 6061 | { |
---|
5906 | 6062 | display.NextIndex(); |
---|
| 6063 | + |
---|
5907 | 6064 | // vertex color conflict : gl.glCallList(list); |
---|
5908 | 6065 | DrawNode(display, root, selected); |
---|
5909 | 6066 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
7154 | 7311 | } |
---|
7155 | 7312 | } |
---|
7156 | 7313 | |
---|
7157 | | - 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) |
---|
7158 | 7318 | { |
---|
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; |
---|
| 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; |
---|
7162 | 7322 | if (toscreen == null) |
---|
7163 | 7323 | { |
---|
7164 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7324 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7165 | 7325 | } |
---|
7166 | 7326 | cVector vec = in; |
---|
7167 | 7327 | LA.xformPos(in, toscreen, in); |
---|
7168 | 7328 | //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(); |
---|
| 7329 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7330 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7171 | 7331 | outPt.x = hc + (int) vec.x; |
---|
7172 | 7332 | outPt.y = vc - (int) vec.y; |
---|
7173 | 7333 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7175 | 7335 | outRec.width = outRec.height = 6; |
---|
7176 | 7336 | } |
---|
7177 | 7337 | |
---|
7178 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7338 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7339 | + ) |
---|
7179 | 7340 | { |
---|
7180 | 7341 | Point pt = new Point(0, 0); |
---|
7181 | 7342 | Rectangle rec = new Rectangle(); |
---|
7182 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7343 | + calcHotSpot(in, //clickInfo, |
---|
| 7344 | + pt, rec); |
---|
7183 | 7345 | return rec; |
---|
7184 | 7346 | } |
---|
7185 | 7347 | |
---|
7186 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7348 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7349 | + int level) |
---|
7187 | 7350 | { |
---|
7188 | 7351 | if (level == 0) |
---|
7189 | 7352 | { |
---|
.. | .. |
---|
7192 | 7355 | { |
---|
7193 | 7356 | cVector origin = new cVector(); |
---|
7194 | 7357 | //LA.xformPos(origin, toParent, origin); |
---|
7195 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7358 | + if (this.clickInfo == null) |
---|
| 7359 | + this.clickInfo = new ClickInfo(); |
---|
| 7360 | + |
---|
| 7361 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7196 | 7362 | Rectangle boundary = new Rectangle(); |
---|
7197 | 7363 | boundary.x = spot.x - 30; |
---|
7198 | 7364 | boundary.y = spot.y - 30; |
---|
7199 | 7365 | boundary.width = spot.width + 60; |
---|
7200 | 7366 | boundary.height = spot.height + 60; |
---|
7201 | | - info.g.setColor(Color.red); |
---|
| 7367 | + clickInfo.g.setColor(Color.red); |
---|
7202 | 7368 | int spotw = spot.x + spot.width; |
---|
7203 | 7369 | int spoth = spot.y + spot.height; |
---|
7204 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7370 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7205 | 7371 | // if (CameraPane.Xmin > spot.x) |
---|
7206 | 7372 | // { |
---|
7207 | 7373 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7221 | 7387 | spot.translate(32, 32); |
---|
7222 | 7388 | spotw = spot.x + spot.width; |
---|
7223 | 7389 | spoth = spot.y + spot.height; |
---|
7224 | | - info.g.setColor(Color.cyan); |
---|
7225 | | - 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); |
---|
7226 | 7392 | // if (CameraPane.Xmin > spot.x) |
---|
7227 | 7393 | // { |
---|
7228 | 7394 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7242 | 7408 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7243 | 7409 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7244 | 7410 | 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); |
---|
| 7411 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7412 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7413 | + clickInfo.g.setColor(Color.green); |
---|
7248 | 7414 | // if (CameraPane.Xmin > spot.x) |
---|
7249 | 7415 | // { |
---|
7250 | 7416 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7261 | 7427 | // { |
---|
7262 | 7428 | // CameraPane.Ymax = spoth; |
---|
7263 | 7429 | // } |
---|
7264 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7265 | | - 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); |
---|
7266 | 7432 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7267 | 7433 | // if (CameraPane.Xmin > boundary.x) |
---|
7268 | 7434 | // { |
---|
.. | .. |
---|
7284 | 7450 | } |
---|
7285 | 7451 | } |
---|
7286 | 7452 | |
---|
7287 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7453 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7454 | + int level) |
---|
7288 | 7455 | { |
---|
7289 | 7456 | if (level == 0) |
---|
7290 | 7457 | { |
---|
.. | .. |
---|
7293 | 7460 | |
---|
7294 | 7461 | boolean retval = false; |
---|
7295 | 7462 | |
---|
7296 | | - startX = info.x; |
---|
7297 | | - startY = info.y; |
---|
| 7463 | + startX = clickInfo.x; |
---|
| 7464 | + startY = clickInfo.y; |
---|
7298 | 7465 | |
---|
7299 | 7466 | hitSomething = -1; |
---|
7300 | 7467 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7304 | 7471 | { |
---|
7305 | 7472 | centerPt = new Point(0, 0); |
---|
7306 | 7473 | } |
---|
7307 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7308 | | - if (spot.contains(info.x, info.y)) |
---|
| 7474 | + calcHotSpot(origin, //info, |
---|
| 7475 | + centerPt, spot); |
---|
| 7476 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7309 | 7477 | { |
---|
7310 | 7478 | hitSomething = hitCenter; |
---|
7311 | 7479 | retval = true; |
---|
7312 | 7480 | } |
---|
7313 | 7481 | spot.translate(32, 0); |
---|
7314 | | - if (spot.contains(info.x, info.y)) |
---|
| 7482 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7315 | 7483 | { |
---|
7316 | 7484 | hitSomething = hitRotate; |
---|
7317 | 7485 | retval = true; |
---|
7318 | 7486 | } |
---|
7319 | 7487 | spot.translate(0, 32); |
---|
7320 | | - if (spot.contains(info.x, info.y)) |
---|
| 7488 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7321 | 7489 | { |
---|
7322 | 7490 | 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 | + |
---|
7323 | 7519 | retval = true; |
---|
7324 | 7520 | } |
---|
7325 | 7521 | |
---|
.. | .. |
---|
7329 | 7525 | } |
---|
7330 | 7526 | |
---|
7331 | 7527 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7332 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7528 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7333 | 7529 | //System.out.println("modified = " + modified); |
---|
7334 | 7530 | //new Exception().printStackTrace(); |
---|
7335 | 7531 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7357 | 7553 | return true; |
---|
7358 | 7554 | } |
---|
7359 | 7555 | |
---|
7360 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7556 | + void doEditDrag0(//ClickInfo info, |
---|
| 7557 | + boolean opposite) |
---|
7361 | 7558 | { |
---|
7362 | 7559 | if (hitSomething == 0) |
---|
7363 | 7560 | { |
---|
.. | .. |
---|
7371 | 7568 | |
---|
7372 | 7569 | //System.out.println("hitSomething = " + hitSomething); |
---|
7373 | 7570 | |
---|
7374 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7571 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7375 | 7572 | |
---|
7376 | 7573 | cVector xlate = new cVector(); |
---|
7377 | 7574 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7405 | 7602 | toParent[3][i] = xlate.get(i); |
---|
7406 | 7603 | LA.matInvert(toParent, fromParent); |
---|
7407 | 7604 | */ |
---|
7408 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7409 | | - 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); |
---|
7410 | 7607 | |
---|
7411 | 7608 | LA.matCopy(startMat, toParent); |
---|
7412 | 7609 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7415 | 7612 | } else |
---|
7416 | 7613 | { |
---|
7417 | 7614 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7418 | | - cVector up = new cVector(info.camera.up); |
---|
| 7615 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7419 | 7616 | cVector away = new cVector(); |
---|
7420 | 7617 | //cVector right2 = new cVector(); |
---|
7421 | 7618 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7432 | 7629 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7433 | 7630 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7434 | 7631 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7435 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7632 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7436 | 7633 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7437 | 7634 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7438 | 7635 | //LA.vecCross(up, cVector.Z, right2); |
---|
7439 | 7636 | |
---|
7440 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7637 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7441 | 7638 | |
---|
7442 | 7639 | //System.out.println("DELTA0 = " + delta); |
---|
7443 | 7640 | //System.out.println("AWAY = " + info.camera.away); |
---|
7444 | 7641 | //System.out.println("UP = " + info.camera.up); |
---|
7445 | 7642 | if (away.z > 0) |
---|
7446 | 7643 | { |
---|
7447 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7644 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7448 | 7645 | { |
---|
7449 | 7646 | delta.x = -delta.x; |
---|
7450 | 7647 | } else |
---|
.. | .. |
---|
7459 | 7656 | //System.out.println("DELTA1 = " + delta); |
---|
7460 | 7657 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7461 | 7658 | //System.out.println("DELTA2 = " + delta); |
---|
7462 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7659 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7463 | 7660 | LA.matCopy(startMat, toParent); |
---|
7464 | 7661 | //System.out.println("DELTA3 = " + delta); |
---|
7465 | 7662 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7469 | 7666 | break; |
---|
7470 | 7667 | |
---|
7471 | 7668 | case hitRotate: // rotate |
---|
7472 | | - int dx = info.x - centerPt.x; |
---|
7473 | | - int dy = -(info.y - centerPt.y); |
---|
| 7669 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7670 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7474 | 7671 | double angle = (double) Math.atan2(dx, dy); |
---|
7475 | 7672 | angle = -(1.570796 - angle); |
---|
7476 | 7673 | |
---|
.. | .. |
---|
7493 | 7690 | } |
---|
7494 | 7691 | /**/ |
---|
7495 | 7692 | |
---|
7496 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7693 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7497 | 7694 | { |
---|
7498 | 7695 | case 1: // '\001' |
---|
7499 | 7696 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7520 | 7717 | break; |
---|
7521 | 7718 | |
---|
7522 | 7719 | case hitScale: // scale |
---|
7523 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7720 | + double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
7524 | 7721 | double sign = 1; |
---|
7525 | 7722 | if (hScale < 0) |
---|
7526 | 7723 | { |
---|
.. | .. |
---|
7532 | 7729 | //hScale = 0.01; |
---|
7533 | 7730 | } |
---|
7534 | 7731 | |
---|
7535 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7732 | + double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
7536 | 7733 | sign = 1; |
---|
7537 | 7734 | if (vScale < 0) |
---|
7538 | 7735 | { |
---|
.. | .. |
---|
7543 | 7740 | { |
---|
7544 | 7741 | //vScale = 0.01; |
---|
7545 | 7742 | } |
---|
| 7743 | + |
---|
7546 | 7744 | LA.matCopy(startMat, toParent); |
---|
7547 | 7745 | /**/ |
---|
7548 | 7746 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7552 | 7750 | } |
---|
7553 | 7751 | /**/ |
---|
7554 | 7752 | |
---|
7555 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7753 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7556 | 7754 | |
---|
7557 | 7755 | if (totalScale < 0.01) |
---|
7558 | 7756 | { |
---|
7559 | 7757 | totalScale = 0.01; |
---|
7560 | 7758 | } |
---|
7561 | 7759 | |
---|
7562 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7760 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7563 | 7761 | { |
---|
7564 | 7762 | case 3: // '\001' |
---|
7565 | 7763 | if (modified || opposite) |
---|
.. | .. |
---|
7626 | 7824 | } // NEW ... |
---|
7627 | 7825 | |
---|
7628 | 7826 | |
---|
7629 | | - info.pane.repaint(); |
---|
| 7827 | + clickInfo.pane.repaint(); |
---|
7630 | 7828 | } |
---|
7631 | 7829 | |
---|
7632 | 7830 | boolean overflow = false; |
---|
.. | .. |
---|
7967 | 8165 | } |
---|
7968 | 8166 | |
---|
7969 | 8167 | transient ObjEditor editWindow; |
---|
| 8168 | + transient ObjEditor manipWindow; |
---|
| 8169 | + |
---|
| 8170 | + transient boolean pinned; |
---|
| 8171 | + |
---|
7970 | 8172 | transient ObjectUI objectUI; |
---|
7971 | 8173 | public static int povDepth = 0; |
---|
7972 | 8174 | private static cVector tbMin = new cVector(); |
---|