.. | .. |
---|
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 |
---|
.. | .. |
---|
881 | 927 | |
---|
882 | 928 | if (marked && Globals.isLIVE() && live && |
---|
883 | 929 | //TEMP21aug2018 |
---|
884 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 930 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
885 | 931 | currentframe != Globals.framecount) |
---|
886 | 932 | { |
---|
887 | 933 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
893 | 939 | |
---|
894 | 940 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
895 | 941 | |
---|
896 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 942 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 943 | + (step == 1 && changedir)) |
---|
897 | 944 | { |
---|
898 | 945 | countdown = 1; |
---|
899 | 946 | delay = speedup?8:1; |
---|
.. | .. |
---|
965 | 1012 | if (material == null || material.multiply) |
---|
966 | 1013 | return true; |
---|
967 | 1014 | |
---|
| 1015 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
968 | 1016 | return material.opacity > 0.99; |
---|
969 | 1017 | } |
---|
970 | 1018 | |
---|
.. | .. |
---|
1365 | 1413 | toParent = LA.newMatrix(); |
---|
1366 | 1414 | fromParent = LA.newMatrix(); |
---|
1367 | 1415 | } |
---|
| 1416 | + |
---|
1368 | 1417 | LA.matCopy(other.toParent, toParent); |
---|
1369 | 1418 | LA.matCopy(other.fromParent, fromParent); |
---|
1370 | 1419 | |
---|
.. | .. |
---|
2386 | 2435 | } |
---|
2387 | 2436 | */ |
---|
2388 | 2437 | } |
---|
| 2438 | + else |
---|
| 2439 | + { |
---|
| 2440 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2441 | + } |
---|
2389 | 2442 | } |
---|
2390 | 2443 | |
---|
2391 | 2444 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2427 | 2480 | { |
---|
2428 | 2481 | editWindow.refreshContents(); |
---|
2429 | 2482 | } |
---|
| 2483 | + else |
---|
| 2484 | + { |
---|
| 2485 | + if (manipWindow != null) |
---|
| 2486 | + { |
---|
| 2487 | + manipWindow.refreshContents(); |
---|
| 2488 | + } |
---|
| 2489 | + } |
---|
| 2490 | + |
---|
2430 | 2491 | //if (parent != null) |
---|
2431 | 2492 | //parent.refreshEditWindow(); |
---|
2432 | 2493 | } |
---|
.. | .. |
---|
2506 | 2567 | private static final int editSelf = 1; |
---|
2507 | 2568 | private static final int editChild = 2; |
---|
2508 | 2569 | |
---|
2509 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2570 | + void drawEditHandles(//ClickInfo info, |
---|
| 2571 | + int level) |
---|
2510 | 2572 | { |
---|
2511 | 2573 | if (level == 0) |
---|
2512 | 2574 | { |
---|
.. | .. |
---|
2514 | 2576 | return; |
---|
2515 | 2577 | |
---|
2516 | 2578 | Object3D selectee; |
---|
2517 | | - 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)) |
---|
2518 | 2581 | { |
---|
2519 | 2582 | selectee = (Object3D) e.nextElement(); |
---|
2520 | 2583 | } |
---|
.. | .. |
---|
2522 | 2585 | } else |
---|
2523 | 2586 | { |
---|
2524 | 2587 | //super. |
---|
2525 | | - drawEditHandles0(info, level + 1); |
---|
| 2588 | + drawEditHandles0(//info, |
---|
| 2589 | + level + 1); |
---|
2526 | 2590 | } |
---|
2527 | 2591 | } |
---|
2528 | 2592 | |
---|
2529 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2593 | + boolean doEditClick(//ClickInfo info, |
---|
| 2594 | + int level) |
---|
2530 | 2595 | { |
---|
2531 | 2596 | doSomething = 0; |
---|
2532 | 2597 | if (level == 0) |
---|
2533 | 2598 | { |
---|
2534 | | - return doParentClick(info); |
---|
| 2599 | + return doParentClick(); //info); |
---|
2535 | 2600 | } |
---|
2536 | 2601 | if (//super. |
---|
2537 | | - doEditClick0(info, level)) |
---|
| 2602 | + doEditClick0(//info, |
---|
| 2603 | + level)) |
---|
2538 | 2604 | { |
---|
2539 | 2605 | doSomething = 1; |
---|
2540 | 2606 | return true; |
---|
.. | .. |
---|
2544 | 2610 | } |
---|
2545 | 2611 | } |
---|
2546 | 2612 | |
---|
2547 | | - boolean doParentClick(ClickInfo info) |
---|
| 2613 | + boolean doParentClick() //ClickInfo info) |
---|
2548 | 2614 | { |
---|
2549 | 2615 | if (selection == null) |
---|
2550 | 2616 | { |
---|
.. | .. |
---|
2557 | 2623 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2558 | 2624 | { |
---|
2559 | 2625 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2560 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2626 | + if (selectee.doEditClick(//info, |
---|
| 2627 | + 1)) |
---|
2561 | 2628 | { |
---|
2562 | 2629 | childToDrag = selectee; |
---|
2563 | 2630 | doSomething = 2; |
---|
.. | .. |
---|
2569 | 2636 | return retval; |
---|
2570 | 2637 | } |
---|
2571 | 2638 | |
---|
2572 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2639 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2640 | + boolean opposite) |
---|
2573 | 2641 | { |
---|
2574 | 2642 | switch (doSomething) |
---|
2575 | 2643 | { |
---|
2576 | 2644 | case 1: // '\001' |
---|
2577 | 2645 | //super. |
---|
2578 | | - doEditDrag0(info, opposite); |
---|
| 2646 | + doEditDrag0(//clickInfo, |
---|
| 2647 | + opposite); |
---|
2579 | 2648 | break; |
---|
2580 | 2649 | |
---|
2581 | 2650 | case 2: // '\002' |
---|
.. | .. |
---|
2588 | 2657 | { |
---|
2589 | 2658 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2590 | 2659 | //childToDrag.doEditDrag(info); |
---|
2591 | | - sel.doEditDrag(info, opposite); |
---|
| 2660 | + sel.doEditDrag(//clickInfo, |
---|
| 2661 | + opposite); |
---|
2592 | 2662 | } else |
---|
2593 | 2663 | { |
---|
2594 | 2664 | //super. |
---|
2595 | | - doEditDrag0(info, opposite); |
---|
| 2665 | + doEditDrag0(//clickInfo, |
---|
| 2666 | + opposite); |
---|
2596 | 2667 | } |
---|
2597 | 2668 | } |
---|
2598 | 2669 | break; |
---|
.. | .. |
---|
2610 | 2681 | { |
---|
2611 | 2682 | deselectAll(); |
---|
2612 | 2683 | } |
---|
| 2684 | + |
---|
| 2685 | + new Exception().printStackTrace(); |
---|
| 2686 | + |
---|
2613 | 2687 | ClickInfo newInfo = new ClickInfo(); |
---|
2614 | 2688 | newInfo.flags = info.flags; |
---|
2615 | 2689 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3057 | 3131 | { |
---|
3058 | 3132 | if (bRep != null) |
---|
3059 | 3133 | { |
---|
3060 | | - bRep.GenerateNormalsMINE(); |
---|
| 3134 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3061 | 3135 | Touch(); |
---|
3062 | 3136 | } |
---|
3063 | 3137 | } |
---|
.. | .. |
---|
3503 | 3577 | if (blockloop) |
---|
3504 | 3578 | return; |
---|
3505 | 3579 | |
---|
3506 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3580 | + if (//marked || // does not make sense |
---|
| 3581 | + (bRep != null || material != null)) // borderline... |
---|
3507 | 3582 | live = h; |
---|
3508 | 3583 | |
---|
3509 | 3584 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3524 | 3599 | return; |
---|
3525 | 3600 | |
---|
3526 | 3601 | //if (bRep != null) |
---|
3527 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3602 | + if (//marked || // does not make sense |
---|
| 3603 | + (bRep != null || material != null)) // borderline... |
---|
3528 | 3604 | link2master = h; |
---|
3529 | 3605 | |
---|
3530 | 3606 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3544 | 3620 | if (blockloop) |
---|
3545 | 3621 | return; |
---|
3546 | 3622 | |
---|
3547 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3623 | + if (//marked || // does not make sense |
---|
| 3624 | + (bRep != null || material != null)) // borderline... |
---|
3548 | 3625 | hide = h; |
---|
3549 | 3626 | |
---|
3550 | 3627 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3564 | 3641 | if (blockloop) |
---|
3565 | 3642 | return; |
---|
3566 | 3643 | |
---|
3567 | | - if (bRep != null && material != null) // borderline... |
---|
| 3644 | + if (bRep != null || material != null) // borderline... |
---|
3568 | 3645 | marked = h; |
---|
3569 | 3646 | |
---|
3570 | 3647 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3574 | 3651 | continue; |
---|
3575 | 3652 | blockloop = true; |
---|
3576 | 3653 | child.MarkLeaves(h); |
---|
| 3654 | + blockloop = false; |
---|
| 3655 | + // release(i); |
---|
| 3656 | + } |
---|
| 3657 | + } |
---|
| 3658 | + |
---|
| 3659 | + void RewindLeaves(boolean h) |
---|
| 3660 | + { |
---|
| 3661 | + if (blockloop) |
---|
| 3662 | + return; |
---|
| 3663 | + |
---|
| 3664 | + if (bRep != null || material != null) // borderline... |
---|
| 3665 | + rewind = h; |
---|
| 3666 | + |
---|
| 3667 | + for (int i = 0; i < Size(); i++) |
---|
| 3668 | + { |
---|
| 3669 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3670 | + if (child == null) |
---|
| 3671 | + continue; |
---|
| 3672 | + blockloop = true; |
---|
| 3673 | + child.RewindLeaves(h); |
---|
| 3674 | + blockloop = false; |
---|
| 3675 | + // release(i); |
---|
| 3676 | + } |
---|
| 3677 | + } |
---|
| 3678 | + |
---|
| 3679 | + void RandomLeaves(boolean h) |
---|
| 3680 | + { |
---|
| 3681 | + if (blockloop) |
---|
| 3682 | + return; |
---|
| 3683 | + |
---|
| 3684 | + if (bRep != null || material != null) // borderline... |
---|
| 3685 | + random = h; |
---|
| 3686 | + |
---|
| 3687 | + for (int i = 0; i < Size(); i++) |
---|
| 3688 | + { |
---|
| 3689 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3690 | + if (child == null) |
---|
| 3691 | + continue; |
---|
| 3692 | + blockloop = true; |
---|
| 3693 | + child.RandomLeaves(h); |
---|
3577 | 3694 | blockloop = false; |
---|
3578 | 3695 | // release(i); |
---|
3579 | 3696 | } |
---|
.. | .. |
---|
4351 | 4468 | } |
---|
4352 | 4469 | } |
---|
4353 | 4470 | |
---|
| 4471 | + void RepairSOV() |
---|
| 4472 | + { |
---|
| 4473 | + if (blockloop) |
---|
| 4474 | + return; |
---|
| 4475 | + |
---|
| 4476 | + String texname = this.GetPigmentTexture(); |
---|
| 4477 | + |
---|
| 4478 | + if (texname.startsWith("sov")) |
---|
| 4479 | + { |
---|
| 4480 | + String[] s = texname.split("/"); |
---|
| 4481 | + |
---|
| 4482 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4483 | + |
---|
| 4484 | + texname = sname[0]; |
---|
| 4485 | + |
---|
| 4486 | + if (sname.length > 1) |
---|
| 4487 | + { |
---|
| 4488 | + texname += "Color.jpg"; |
---|
| 4489 | + } |
---|
| 4490 | + |
---|
| 4491 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4492 | + } |
---|
| 4493 | + |
---|
| 4494 | + texname = this.GetBumpTexture(); |
---|
| 4495 | + |
---|
| 4496 | + if (texname.startsWith("sov")) |
---|
| 4497 | + { |
---|
| 4498 | + String[] s = texname.split("/"); |
---|
| 4499 | + |
---|
| 4500 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4501 | + |
---|
| 4502 | + texname = sname[0]; |
---|
| 4503 | + |
---|
| 4504 | + if (sname.length > 1) |
---|
| 4505 | + { |
---|
| 4506 | + texname += "Bump.jpg"; |
---|
| 4507 | + } |
---|
| 4508 | + |
---|
| 4509 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4510 | + } |
---|
| 4511 | + |
---|
| 4512 | + for (int i=0; i<Size(); i++) |
---|
| 4513 | + { |
---|
| 4514 | + blockloop = true; |
---|
| 4515 | + get(i).RepairSOV(); |
---|
| 4516 | + blockloop = false; |
---|
| 4517 | + } |
---|
| 4518 | + } |
---|
| 4519 | + |
---|
4354 | 4520 | void RepairTexture() |
---|
4355 | 4521 | { |
---|
4356 | 4522 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4865 | 5031 | } |
---|
4866 | 5032 | } |
---|
4867 | 5033 | |
---|
| 5034 | + ObjEditor GetWindow() |
---|
| 5035 | + { |
---|
| 5036 | + if (editWindow != null) |
---|
| 5037 | + return editWindow; |
---|
| 5038 | + |
---|
| 5039 | + return manipWindow; |
---|
| 5040 | + } |
---|
| 5041 | + |
---|
4868 | 5042 | cTreePath Select(int indexcount, boolean deselect) |
---|
4869 | 5043 | { |
---|
4870 | 5044 | if (hide || dontselect) |
---|
.. | .. |
---|
4901 | 5075 | if (leaf != null) |
---|
4902 | 5076 | { |
---|
4903 | 5077 | cTreePath tp = new cTreePath(this, leaf); |
---|
4904 | | - if (editWindow != null) |
---|
| 5078 | + ObjEditor window = GetWindow(); |
---|
| 5079 | + if (window != null) |
---|
4905 | 5080 | { |
---|
4906 | 5081 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4907 | | - editWindow.Select(tp, deselect, true); |
---|
| 5082 | + window.Select(tp, deselect, true); |
---|
4908 | 5083 | } |
---|
4909 | 5084 | |
---|
4910 | 5085 | return tp; |
---|
.. | .. |
---|
4921 | 5096 | |
---|
4922 | 5097 | if (child == null) |
---|
4923 | 5098 | continue; |
---|
| 5099 | + |
---|
4924 | 5100 | if (child.HasTransparency() && child.size() != 0) |
---|
4925 | 5101 | { |
---|
4926 | 5102 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4930 | 5106 | if (leaf != null) |
---|
4931 | 5107 | { |
---|
4932 | 5108 | cTreePath tp = new cTreePath(this, leaf); |
---|
4933 | | - if (editWindow != null) |
---|
| 5109 | + ObjEditor window = GetWindow(); |
---|
| 5110 | + if (window != null) |
---|
4934 | 5111 | { |
---|
4935 | | - editWindow.Select(tp, deselect, true); |
---|
| 5112 | + window.Select(tp, deselect, true); |
---|
4936 | 5113 | } |
---|
4937 | 5114 | |
---|
4938 | 5115 | return tp; |
---|
.. | .. |
---|
5257 | 5434 | blockloop = false; |
---|
5258 | 5435 | } |
---|
5259 | 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 | + |
---|
5260 | 5482 | boolean IsSelected() |
---|
5261 | 5483 | { |
---|
5262 | 5484 | if (parent == null) |
---|
.. | .. |
---|
5566 | 5788 | } |
---|
5567 | 5789 | } |
---|
5568 | 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 | + |
---|
5569 | 5823 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5570 | 5824 | { |
---|
5571 | 5825 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5653 | 5907 | support = support; |
---|
5654 | 5908 | |
---|
5655 | 5909 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5656 | | - 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); |
---|
5657 | 5911 | |
---|
5658 | 5912 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5659 | 5913 | { |
---|
.. | .. |
---|
5673 | 5927 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5674 | 5928 | |
---|
5675 | 5929 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5676 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5930 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5931 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5677 | 5932 | { |
---|
5678 | 5933 | Globals.lighttouched = true; |
---|
5679 | 5934 | } // all panes... |
---|
| 5935 | + |
---|
5680 | 5936 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5681 | 5937 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5682 | 5938 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5804 | 6060 | if (GetBRep() != null) |
---|
5805 | 6061 | { |
---|
5806 | 6062 | display.NextIndex(); |
---|
| 6063 | + |
---|
5807 | 6064 | // vertex color conflict : gl.glCallList(list); |
---|
5808 | 6065 | DrawNode(display, root, selected); |
---|
5809 | 6066 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5844 | 6101 | tex = GetTextures(); |
---|
5845 | 6102 | } |
---|
5846 | 6103 | |
---|
5847 | | - boolean failed = false; |
---|
| 6104 | + boolean failedPigment = false; |
---|
| 6105 | + boolean failedBump = false; |
---|
5848 | 6106 | |
---|
5849 | 6107 | try |
---|
5850 | 6108 | { |
---|
5851 | | - display.BindTextures(tex, texres); |
---|
| 6109 | + display.BindPigmentTexture(tex, texres); |
---|
5852 | 6110 | } |
---|
5853 | 6111 | catch (Exception e) |
---|
5854 | 6112 | { |
---|
5855 | 6113 | System.err.println("FAILED: " + this); |
---|
5856 | | - failed = true; |
---|
| 6114 | + failedPigment = true; |
---|
| 6115 | + } |
---|
| 6116 | + |
---|
| 6117 | + try |
---|
| 6118 | + { |
---|
| 6119 | + display.BindBumpTexture(tex, texres); |
---|
| 6120 | + } |
---|
| 6121 | + catch (Exception e) |
---|
| 6122 | + { |
---|
| 6123 | + //System.err.println("FAILED: " + this); |
---|
| 6124 | + failedBump = true; |
---|
5857 | 6125 | } |
---|
5858 | 6126 | |
---|
5859 | 6127 | if (!compiled) |
---|
.. | .. |
---|
5876 | 6144 | } |
---|
5877 | 6145 | } |
---|
5878 | 6146 | |
---|
5879 | | - if (!failed) |
---|
5880 | | - display.ReleaseTextures(tex); |
---|
| 6147 | + if (!failedBump) |
---|
| 6148 | + display.ReleaseBumpTexture(tex); |
---|
| 6149 | + |
---|
| 6150 | + if (!failedPigment) |
---|
| 6151 | + display.ReleasePigmentTexture(tex); |
---|
5881 | 6152 | |
---|
5882 | 6153 | display.PopMaterial(this, selected); |
---|
5883 | 6154 | } |
---|
.. | .. |
---|
6250 | 6521 | // dec 2012 |
---|
6251 | 6522 | new Exception().printStackTrace(); |
---|
6252 | 6523 | return; |
---|
| 6524 | + } |
---|
| 6525 | + |
---|
| 6526 | + if (dontselect) |
---|
| 6527 | + { |
---|
| 6528 | + //bRep.GenerateNormalsMINE(); |
---|
6253 | 6529 | } |
---|
6254 | 6530 | |
---|
6255 | 6531 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7035 | 7311 | } |
---|
7036 | 7312 | } |
---|
7037 | 7313 | |
---|
7038 | | - 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) |
---|
7039 | 7318 | { |
---|
7040 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7041 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7042 | | - 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; |
---|
7043 | 7322 | if (toscreen == null) |
---|
7044 | 7323 | { |
---|
7045 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7324 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7046 | 7325 | } |
---|
7047 | 7326 | cVector vec = in; |
---|
7048 | 7327 | LA.xformPos(in, toscreen, in); |
---|
7049 | 7328 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7050 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7051 | | - 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(); |
---|
7052 | 7331 | outPt.x = hc + (int) vec.x; |
---|
7053 | 7332 | outPt.y = vc - (int) vec.y; |
---|
7054 | 7333 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7056 | 7335 | outRec.width = outRec.height = 6; |
---|
7057 | 7336 | } |
---|
7058 | 7337 | |
---|
7059 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7338 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7339 | + ) |
---|
7060 | 7340 | { |
---|
7061 | 7341 | Point pt = new Point(0, 0); |
---|
7062 | 7342 | Rectangle rec = new Rectangle(); |
---|
7063 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7343 | + calcHotSpot(in, //clickInfo, |
---|
| 7344 | + pt, rec); |
---|
7064 | 7345 | return rec; |
---|
7065 | 7346 | } |
---|
7066 | 7347 | |
---|
7067 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7348 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7349 | + int level) |
---|
7068 | 7350 | { |
---|
7069 | 7351 | if (level == 0) |
---|
7070 | 7352 | { |
---|
.. | .. |
---|
7073 | 7355 | { |
---|
7074 | 7356 | cVector origin = new cVector(); |
---|
7075 | 7357 | //LA.xformPos(origin, toParent, origin); |
---|
7076 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7358 | + if (this.clickInfo == null) |
---|
| 7359 | + this.clickInfo = new ClickInfo(); |
---|
| 7360 | + |
---|
| 7361 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7077 | 7362 | Rectangle boundary = new Rectangle(); |
---|
7078 | 7363 | boundary.x = spot.x - 30; |
---|
7079 | 7364 | boundary.y = spot.y - 30; |
---|
7080 | 7365 | boundary.width = spot.width + 60; |
---|
7081 | 7366 | boundary.height = spot.height + 60; |
---|
7082 | | - info.g.setColor(Color.red); |
---|
| 7367 | + clickInfo.g.setColor(Color.red); |
---|
7083 | 7368 | int spotw = spot.x + spot.width; |
---|
7084 | 7369 | int spoth = spot.y + spot.height; |
---|
7085 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7370 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7086 | 7371 | // if (CameraPane.Xmin > spot.x) |
---|
7087 | 7372 | // { |
---|
7088 | 7373 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7102 | 7387 | spot.translate(32, 32); |
---|
7103 | 7388 | spotw = spot.x + spot.width; |
---|
7104 | 7389 | spoth = spot.y + spot.height; |
---|
7105 | | - info.g.setColor(Color.cyan); |
---|
7106 | | - 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); |
---|
7107 | 7392 | // if (CameraPane.Xmin > spot.x) |
---|
7108 | 7393 | // { |
---|
7109 | 7394 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7123 | 7408 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7124 | 7409 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7125 | 7410 | spot.translate(0, -32); |
---|
7126 | | - info.g.setColor(Color.yellow); |
---|
7127 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7128 | | - 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); |
---|
7129 | 7414 | // if (CameraPane.Xmin > spot.x) |
---|
7130 | 7415 | // { |
---|
7131 | 7416 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7142 | 7427 | // { |
---|
7143 | 7428 | // CameraPane.Ymax = spoth; |
---|
7144 | 7429 | // } |
---|
7145 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7146 | | - 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); |
---|
7147 | 7432 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7148 | 7433 | // if (CameraPane.Xmin > boundary.x) |
---|
7149 | 7434 | // { |
---|
.. | .. |
---|
7165 | 7450 | } |
---|
7166 | 7451 | } |
---|
7167 | 7452 | |
---|
7168 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7453 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7454 | + int level) |
---|
7169 | 7455 | { |
---|
7170 | 7456 | if (level == 0) |
---|
7171 | 7457 | { |
---|
.. | .. |
---|
7174 | 7460 | |
---|
7175 | 7461 | boolean retval = false; |
---|
7176 | 7462 | |
---|
7177 | | - startX = info.x; |
---|
7178 | | - startY = info.y; |
---|
| 7463 | + startX = clickInfo.x; |
---|
| 7464 | + startY = clickInfo.y; |
---|
7179 | 7465 | |
---|
7180 | 7466 | hitSomething = -1; |
---|
7181 | 7467 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7185 | 7471 | { |
---|
7186 | 7472 | centerPt = new Point(0, 0); |
---|
7187 | 7473 | } |
---|
7188 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7189 | | - if (spot.contains(info.x, info.y)) |
---|
| 7474 | + calcHotSpot(origin, //info, |
---|
| 7475 | + centerPt, spot); |
---|
| 7476 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7190 | 7477 | { |
---|
7191 | 7478 | hitSomething = hitCenter; |
---|
7192 | 7479 | retval = true; |
---|
7193 | 7480 | } |
---|
7194 | 7481 | spot.translate(32, 0); |
---|
7195 | | - if (spot.contains(info.x, info.y)) |
---|
| 7482 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7196 | 7483 | { |
---|
7197 | 7484 | hitSomething = hitRotate; |
---|
7198 | 7485 | retval = true; |
---|
7199 | 7486 | } |
---|
7200 | 7487 | spot.translate(0, 32); |
---|
7201 | | - if (spot.contains(info.x, info.y)) |
---|
| 7488 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7202 | 7489 | { |
---|
7203 | 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 | + |
---|
7204 | 7519 | retval = true; |
---|
7205 | 7520 | } |
---|
7206 | 7521 | |
---|
.. | .. |
---|
7210 | 7525 | } |
---|
7211 | 7526 | |
---|
7212 | 7527 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7213 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7528 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7214 | 7529 | //System.out.println("modified = " + modified); |
---|
7215 | 7530 | //new Exception().printStackTrace(); |
---|
7216 | 7531 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7238 | 7553 | return true; |
---|
7239 | 7554 | } |
---|
7240 | 7555 | |
---|
7241 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7556 | + void doEditDrag0(//ClickInfo info, |
---|
| 7557 | + boolean opposite) |
---|
7242 | 7558 | { |
---|
7243 | 7559 | if (hitSomething == 0) |
---|
7244 | 7560 | { |
---|
.. | .. |
---|
7252 | 7568 | |
---|
7253 | 7569 | //System.out.println("hitSomething = " + hitSomething); |
---|
7254 | 7570 | |
---|
7255 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7571 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7256 | 7572 | |
---|
7257 | 7573 | cVector xlate = new cVector(); |
---|
7258 | 7574 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7286 | 7602 | toParent[3][i] = xlate.get(i); |
---|
7287 | 7603 | LA.matInvert(toParent, fromParent); |
---|
7288 | 7604 | */ |
---|
7289 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7290 | | - 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); |
---|
7291 | 7607 | |
---|
7292 | 7608 | LA.matCopy(startMat, toParent); |
---|
7293 | 7609 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7296 | 7612 | } else |
---|
7297 | 7613 | { |
---|
7298 | 7614 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7299 | | - cVector up = new cVector(info.camera.up); |
---|
| 7615 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7300 | 7616 | cVector away = new cVector(); |
---|
7301 | 7617 | //cVector right2 = new cVector(); |
---|
7302 | 7618 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7313 | 7629 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7314 | 7630 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7315 | 7631 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7316 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7632 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7317 | 7633 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7318 | 7634 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7319 | 7635 | //LA.vecCross(up, cVector.Z, right2); |
---|
7320 | 7636 | |
---|
7321 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7637 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7322 | 7638 | |
---|
7323 | 7639 | //System.out.println("DELTA0 = " + delta); |
---|
7324 | 7640 | //System.out.println("AWAY = " + info.camera.away); |
---|
7325 | 7641 | //System.out.println("UP = " + info.camera.up); |
---|
7326 | 7642 | if (away.z > 0) |
---|
7327 | 7643 | { |
---|
7328 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7644 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7329 | 7645 | { |
---|
7330 | 7646 | delta.x = -delta.x; |
---|
7331 | 7647 | } else |
---|
.. | .. |
---|
7340 | 7656 | //System.out.println("DELTA1 = " + delta); |
---|
7341 | 7657 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7342 | 7658 | //System.out.println("DELTA2 = " + delta); |
---|
7343 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7659 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7344 | 7660 | LA.matCopy(startMat, toParent); |
---|
7345 | 7661 | //System.out.println("DELTA3 = " + delta); |
---|
7346 | 7662 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7350 | 7666 | break; |
---|
7351 | 7667 | |
---|
7352 | 7668 | case hitRotate: // rotate |
---|
7353 | | - int dx = info.x - centerPt.x; |
---|
7354 | | - int dy = -(info.y - centerPt.y); |
---|
| 7669 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7670 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7355 | 7671 | double angle = (double) Math.atan2(dx, dy); |
---|
7356 | 7672 | angle = -(1.570796 - angle); |
---|
7357 | 7673 | |
---|
.. | .. |
---|
7374 | 7690 | } |
---|
7375 | 7691 | /**/ |
---|
7376 | 7692 | |
---|
7377 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7693 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7378 | 7694 | { |
---|
7379 | 7695 | case 1: // '\001' |
---|
7380 | 7696 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7401 | 7717 | break; |
---|
7402 | 7718 | |
---|
7403 | 7719 | case hitScale: // scale |
---|
7404 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7720 | + double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
7405 | 7721 | double sign = 1; |
---|
7406 | 7722 | if (hScale < 0) |
---|
7407 | 7723 | { |
---|
.. | .. |
---|
7413 | 7729 | //hScale = 0.01; |
---|
7414 | 7730 | } |
---|
7415 | 7731 | |
---|
7416 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7732 | + double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
7417 | 7733 | sign = 1; |
---|
7418 | 7734 | if (vScale < 0) |
---|
7419 | 7735 | { |
---|
.. | .. |
---|
7424 | 7740 | { |
---|
7425 | 7741 | //vScale = 0.01; |
---|
7426 | 7742 | } |
---|
| 7743 | + |
---|
7427 | 7744 | LA.matCopy(startMat, toParent); |
---|
7428 | 7745 | /**/ |
---|
7429 | 7746 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7433 | 7750 | } |
---|
7434 | 7751 | /**/ |
---|
7435 | 7752 | |
---|
7436 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7753 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7437 | 7754 | |
---|
7438 | 7755 | if (totalScale < 0.01) |
---|
7439 | 7756 | { |
---|
7440 | 7757 | totalScale = 0.01; |
---|
7441 | 7758 | } |
---|
7442 | 7759 | |
---|
7443 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7760 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7444 | 7761 | { |
---|
7445 | 7762 | case 3: // '\001' |
---|
7446 | 7763 | if (modified || opposite) |
---|
.. | .. |
---|
7450 | 7767 | } // vScale, 1); |
---|
7451 | 7768 | else |
---|
7452 | 7769 | { |
---|
7453 | | - LA.matScale(toParent, 1, totalScale, totalScale); |
---|
| 7770 | + // EXCEPTION! |
---|
| 7771 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7454 | 7772 | } // vScale, 1); |
---|
7455 | 7773 | break; |
---|
7456 | 7774 | |
---|
.. | .. |
---|
7506 | 7824 | } // NEW ... |
---|
7507 | 7825 | |
---|
7508 | 7826 | |
---|
7509 | | - info.pane.repaint(); |
---|
| 7827 | + clickInfo.pane.repaint(); |
---|
7510 | 7828 | } |
---|
7511 | 7829 | |
---|
7512 | 7830 | boolean overflow = false; |
---|
.. | .. |
---|
7686 | 8004 | editWindow = null; |
---|
7687 | 8005 | } // ? |
---|
7688 | 8006 | } |
---|
| 8007 | + else |
---|
| 8008 | + { |
---|
| 8009 | + //editWindow.closeUI(); |
---|
| 8010 | + } |
---|
7689 | 8011 | } |
---|
7690 | 8012 | |
---|
7691 | 8013 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7843 | 8165 | } |
---|
7844 | 8166 | |
---|
7845 | 8167 | transient ObjEditor editWindow; |
---|
| 8168 | + transient ObjEditor manipWindow; |
---|
| 8169 | + |
---|
| 8170 | + transient boolean pinned; |
---|
| 8171 | + |
---|
7846 | 8172 | transient ObjectUI objectUI; |
---|
7847 | 8173 | public static int povDepth = 0; |
---|
7848 | 8174 | private static cVector tbMin = new cVector(); |
---|