.. | .. |
---|
22 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
23 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
24 | 24 | |
---|
| 25 | + // Use GetUUID for backward compatibility with null. |
---|
25 | 26 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 27 | |
---|
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; |
---|
30 | 31 | // |
---|
31 | 32 | |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
| 37 | + int versionindex = -1; |
---|
| 38 | + |
---|
32 | 39 | ScriptNode scriptnode; |
---|
33 | 40 | |
---|
34 | 41 | void InitOthers() |
---|
.. | .. |
---|
170 | 177 | |
---|
171 | 178 | void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
172 | 179 | { |
---|
| 180 | + Object3D o; |
---|
| 181 | + |
---|
173 | 182 | if (hashtable.containsKey(GetUUID())) |
---|
174 | 183 | { |
---|
175 | | - Object3D o = hashtable.get(GetUUID()); |
---|
| 184 | + o = hashtable.get(GetUUID()); |
---|
176 | 185 | |
---|
177 | 186 | 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); |
---|
180 | 195 | |
---|
181 | | - return; |
---|
| 196 | + hashtable.put(GetUUID(), o); |
---|
182 | 197 | } |
---|
183 | 198 | |
---|
184 | | - Object3D o = new Object3D(); |
---|
185 | | - |
---|
186 | | - hashtable.put(GetUUID(), o); |
---|
187 | | - |
---|
188 | | - for (int i=0; i<Size(); i++) |
---|
| 199 | + if (!blockloop) |
---|
189 | 200 | { |
---|
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; |
---|
191 | 209 | } |
---|
192 | 210 | |
---|
193 | 211 | ExtractBigData(o); |
---|
.. | .. |
---|
195 | 213 | |
---|
196 | 214 | void ExtractBigData(Object3D o) |
---|
197 | 215 | { |
---|
| 216 | + if (o.bRep != null) |
---|
| 217 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 218 | + |
---|
198 | 219 | 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) |
---|
200 | 230 | { |
---|
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; |
---|
203 | 236 | } |
---|
204 | 237 | |
---|
205 | 238 | // o.support = this.support; |
---|
.. | .. |
---|
214 | 247 | // this.fileparent = null; |
---|
215 | 248 | } |
---|
216 | 249 | |
---|
| 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 | + |
---|
217 | 273 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
218 | 274 | { |
---|
219 | 275 | if (!hashtable.containsKey(GetUUID())) |
---|
.. | .. |
---|
223 | 279 | |
---|
224 | 280 | RestoreBigData(o); |
---|
225 | 281 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 282 | + if (blockloop) |
---|
| 283 | + return; |
---|
| 284 | + |
---|
| 285 | + blockloop = true; |
---|
| 286 | + |
---|
| 287 | + //hashtable.remove(GetUUID()); |
---|
227 | 288 | |
---|
228 | 289 | for (int i=0; i<Size(); i++) |
---|
229 | 290 | { |
---|
230 | 291 | get(i).RestoreBigData(hashtable); |
---|
231 | 292 | } |
---|
| 293 | + |
---|
| 294 | + blockloop = false; |
---|
232 | 295 | } |
---|
233 | 296 | |
---|
234 | 297 | void RestoreBigData(Object3D o) |
---|
235 | 298 | { |
---|
236 | 299 | 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; |
---|
239 | 311 | // this.support = o.support; |
---|
240 | 312 | // this.fileparent = o.fileparent; |
---|
241 | 313 | } |
---|
.. | .. |
---|
381 | 453 | } |
---|
382 | 454 | |
---|
383 | 455 | boolean live = false; |
---|
| 456 | + transient boolean keepdontselect; |
---|
384 | 457 | boolean dontselect = false; |
---|
385 | 458 | boolean hide = false; |
---|
386 | 459 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
881 | 954 | |
---|
882 | 955 | if (marked && Globals.isLIVE() && live && |
---|
883 | 956 | //TEMP21aug2018 |
---|
884 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 957 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
885 | 958 | currentframe != Globals.framecount) |
---|
886 | 959 | { |
---|
887 | 960 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
893 | 966 | |
---|
894 | 967 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
895 | 968 | |
---|
896 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 969 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 970 | + (step == 1 && changedir)) |
---|
897 | 971 | { |
---|
898 | 972 | countdown = 1; |
---|
899 | 973 | delay = speedup?8:1; |
---|
.. | .. |
---|
965 | 1039 | if (material == null || material.multiply) |
---|
966 | 1040 | return true; |
---|
967 | 1041 | |
---|
| 1042 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1043 | + return false; |
---|
| 1044 | + |
---|
| 1045 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
968 | 1046 | return material.opacity > 0.99; |
---|
969 | 1047 | } |
---|
970 | 1048 | |
---|
.. | .. |
---|
1365 | 1443 | toParent = LA.newMatrix(); |
---|
1366 | 1444 | fromParent = LA.newMatrix(); |
---|
1367 | 1445 | } |
---|
| 1446 | + |
---|
1368 | 1447 | LA.matCopy(other.toParent, toParent); |
---|
1369 | 1448 | LA.matCopy(other.fromParent, fromParent); |
---|
1370 | 1449 | |
---|
.. | .. |
---|
2386 | 2465 | } |
---|
2387 | 2466 | */ |
---|
2388 | 2467 | } |
---|
| 2468 | + else |
---|
| 2469 | + { |
---|
| 2470 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2471 | + if (objectUI != null) |
---|
| 2472 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2473 | + else |
---|
| 2474 | + //new Exception().printStackTrace(); |
---|
| 2475 | + System.err.println("objectUI is null"); |
---|
| 2476 | + } |
---|
2389 | 2477 | } |
---|
2390 | 2478 | |
---|
2391 | 2479 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2427 | 2515 | { |
---|
2428 | 2516 | editWindow.refreshContents(); |
---|
2429 | 2517 | } |
---|
| 2518 | + else |
---|
| 2519 | + { |
---|
| 2520 | + if (manipWindow != null) |
---|
| 2521 | + { |
---|
| 2522 | + manipWindow.refreshContents(); |
---|
| 2523 | + } |
---|
| 2524 | + } |
---|
| 2525 | + |
---|
2430 | 2526 | //if (parent != null) |
---|
2431 | 2527 | //parent.refreshEditWindow(); |
---|
2432 | 2528 | } |
---|
.. | .. |
---|
2506 | 2602 | private static final int editSelf = 1; |
---|
2507 | 2603 | private static final int editChild = 2; |
---|
2508 | 2604 | |
---|
2509 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2605 | + void drawEditHandles(//ClickInfo info, |
---|
| 2606 | + int level) |
---|
2510 | 2607 | { |
---|
2511 | 2608 | if (level == 0) |
---|
2512 | 2609 | { |
---|
.. | .. |
---|
2514 | 2611 | return; |
---|
2515 | 2612 | |
---|
2516 | 2613 | Object3D selectee; |
---|
2517 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2614 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2615 | + level + 1)) |
---|
2518 | 2616 | { |
---|
2519 | 2617 | selectee = (Object3D) e.nextElement(); |
---|
2520 | 2618 | } |
---|
.. | .. |
---|
2522 | 2620 | } else |
---|
2523 | 2621 | { |
---|
2524 | 2622 | //super. |
---|
2525 | | - drawEditHandles0(info, level + 1); |
---|
| 2623 | + drawEditHandles0(//info, |
---|
| 2624 | + level + 1); |
---|
2526 | 2625 | } |
---|
2527 | 2626 | } |
---|
2528 | 2627 | |
---|
2529 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2628 | + boolean doEditClick(//ClickInfo info, |
---|
| 2629 | + int level) |
---|
2530 | 2630 | { |
---|
2531 | 2631 | doSomething = 0; |
---|
2532 | 2632 | if (level == 0) |
---|
2533 | 2633 | { |
---|
2534 | | - return doParentClick(info); |
---|
| 2634 | + return doParentClick(); //info); |
---|
2535 | 2635 | } |
---|
2536 | 2636 | if (//super. |
---|
2537 | | - doEditClick0(info, level)) |
---|
| 2637 | + doEditClick0(//info, |
---|
| 2638 | + level)) |
---|
2538 | 2639 | { |
---|
2539 | 2640 | doSomething = 1; |
---|
2540 | 2641 | return true; |
---|
.. | .. |
---|
2544 | 2645 | } |
---|
2545 | 2646 | } |
---|
2546 | 2647 | |
---|
2547 | | - boolean doParentClick(ClickInfo info) |
---|
| 2648 | + boolean doParentClick() //ClickInfo info) |
---|
2548 | 2649 | { |
---|
2549 | 2650 | if (selection == null) |
---|
2550 | 2651 | { |
---|
.. | .. |
---|
2557 | 2658 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2558 | 2659 | { |
---|
2559 | 2660 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2560 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2661 | + if (selectee.doEditClick(//info, |
---|
| 2662 | + 1)) |
---|
2561 | 2663 | { |
---|
2562 | 2664 | childToDrag = selectee; |
---|
2563 | 2665 | doSomething = 2; |
---|
.. | .. |
---|
2569 | 2671 | return retval; |
---|
2570 | 2672 | } |
---|
2571 | 2673 | |
---|
2572 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2674 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2675 | + boolean opposite) |
---|
2573 | 2676 | { |
---|
2574 | 2677 | switch (doSomething) |
---|
2575 | 2678 | { |
---|
2576 | 2679 | case 1: // '\001' |
---|
2577 | 2680 | //super. |
---|
2578 | | - doEditDrag0(info, opposite); |
---|
| 2681 | + doEditDrag0(//clickInfo, |
---|
| 2682 | + opposite); |
---|
2579 | 2683 | break; |
---|
2580 | 2684 | |
---|
2581 | 2685 | case 2: // '\002' |
---|
.. | .. |
---|
2588 | 2692 | { |
---|
2589 | 2693 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2590 | 2694 | //childToDrag.doEditDrag(info); |
---|
2591 | | - sel.doEditDrag(info, opposite); |
---|
| 2695 | + sel.doEditDrag(//clickInfo, |
---|
| 2696 | + opposite); |
---|
2592 | 2697 | } else |
---|
2593 | 2698 | { |
---|
2594 | 2699 | //super. |
---|
2595 | | - doEditDrag0(info, opposite); |
---|
| 2700 | + doEditDrag0(//clickInfo, |
---|
| 2701 | + opposite); |
---|
2596 | 2702 | } |
---|
2597 | 2703 | } |
---|
2598 | 2704 | break; |
---|
.. | .. |
---|
2610 | 2716 | { |
---|
2611 | 2717 | deselectAll(); |
---|
2612 | 2718 | } |
---|
| 2719 | + |
---|
| 2720 | + new Exception().printStackTrace(); |
---|
| 2721 | + |
---|
2613 | 2722 | ClickInfo newInfo = new ClickInfo(); |
---|
2614 | 2723 | newInfo.flags = info.flags; |
---|
2615 | 2724 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3057 | 3166 | { |
---|
3058 | 3167 | if (bRep != null) |
---|
3059 | 3168 | { |
---|
3060 | | - bRep.GenerateNormalsMINE(); |
---|
| 3169 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3061 | 3170 | Touch(); |
---|
3062 | 3171 | } |
---|
3063 | 3172 | } |
---|
.. | .. |
---|
3503 | 3612 | if (blockloop) |
---|
3504 | 3613 | return; |
---|
3505 | 3614 | |
---|
3506 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3615 | + if (//marked || // does not make sense |
---|
| 3616 | + (bRep != null || material != null)) // borderline... |
---|
3507 | 3617 | live = h; |
---|
3508 | 3618 | |
---|
3509 | 3619 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3524 | 3634 | return; |
---|
3525 | 3635 | |
---|
3526 | 3636 | //if (bRep != null) |
---|
3527 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3637 | + if (//marked || // does not make sense |
---|
| 3638 | + (bRep != null || material != null)) // borderline... |
---|
3528 | 3639 | link2master = h; |
---|
3529 | 3640 | |
---|
3530 | 3641 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3544 | 3655 | if (blockloop) |
---|
3545 | 3656 | return; |
---|
3546 | 3657 | |
---|
3547 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3658 | + if (//marked || // does not make sense |
---|
| 3659 | + (bRep != null || material != null)) // borderline... |
---|
3548 | 3660 | hide = h; |
---|
3549 | 3661 | |
---|
3550 | 3662 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3564 | 3676 | if (blockloop) |
---|
3565 | 3677 | return; |
---|
3566 | 3678 | |
---|
3567 | | - if (bRep != null && material != null) // borderline... |
---|
| 3679 | + if (bRep != null || material != null) // borderline... |
---|
3568 | 3680 | marked = h; |
---|
3569 | 3681 | |
---|
3570 | 3682 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3574 | 3686 | continue; |
---|
3575 | 3687 | blockloop = true; |
---|
3576 | 3688 | child.MarkLeaves(h); |
---|
| 3689 | + blockloop = false; |
---|
| 3690 | + // release(i); |
---|
| 3691 | + } |
---|
| 3692 | + } |
---|
| 3693 | + |
---|
| 3694 | + void RewindLeaves(boolean h) |
---|
| 3695 | + { |
---|
| 3696 | + if (blockloop) |
---|
| 3697 | + return; |
---|
| 3698 | + |
---|
| 3699 | + if (bRep != null || material != null) // borderline... |
---|
| 3700 | + rewind = h; |
---|
| 3701 | + |
---|
| 3702 | + for (int i = 0; i < Size(); i++) |
---|
| 3703 | + { |
---|
| 3704 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3705 | + if (child == null) |
---|
| 3706 | + continue; |
---|
| 3707 | + blockloop = true; |
---|
| 3708 | + child.RewindLeaves(h); |
---|
| 3709 | + blockloop = false; |
---|
| 3710 | + // release(i); |
---|
| 3711 | + } |
---|
| 3712 | + } |
---|
| 3713 | + |
---|
| 3714 | + void RandomLeaves(boolean h) |
---|
| 3715 | + { |
---|
| 3716 | + if (blockloop) |
---|
| 3717 | + return; |
---|
| 3718 | + |
---|
| 3719 | + if (bRep != null || material != null) // borderline... |
---|
| 3720 | + random = h; |
---|
| 3721 | + |
---|
| 3722 | + for (int i = 0; i < Size(); i++) |
---|
| 3723 | + { |
---|
| 3724 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3725 | + if (child == null) |
---|
| 3726 | + continue; |
---|
| 3727 | + blockloop = true; |
---|
| 3728 | + child.RandomLeaves(h); |
---|
3577 | 3729 | blockloop = false; |
---|
3578 | 3730 | // release(i); |
---|
3579 | 3731 | } |
---|
.. | .. |
---|
4351 | 4503 | } |
---|
4352 | 4504 | } |
---|
4353 | 4505 | |
---|
| 4506 | + void RepairSOV() |
---|
| 4507 | + { |
---|
| 4508 | + if (blockloop) |
---|
| 4509 | + return; |
---|
| 4510 | + |
---|
| 4511 | + String texname = this.GetPigmentTexture(); |
---|
| 4512 | + |
---|
| 4513 | + if (texname.startsWith("sov")) |
---|
| 4514 | + { |
---|
| 4515 | + String[] s = texname.split("/"); |
---|
| 4516 | + |
---|
| 4517 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4518 | + |
---|
| 4519 | + texname = sname[0]; |
---|
| 4520 | + |
---|
| 4521 | + if (sname.length > 1) |
---|
| 4522 | + { |
---|
| 4523 | + texname += "Color.jpg"; |
---|
| 4524 | + } |
---|
| 4525 | + |
---|
| 4526 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4527 | + } |
---|
| 4528 | + |
---|
| 4529 | + texname = this.GetBumpTexture(); |
---|
| 4530 | + |
---|
| 4531 | + if (texname.startsWith("sov")) |
---|
| 4532 | + { |
---|
| 4533 | + String[] s = texname.split("/"); |
---|
| 4534 | + |
---|
| 4535 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4536 | + |
---|
| 4537 | + texname = sname[0]; |
---|
| 4538 | + |
---|
| 4539 | + if (sname.length > 1) |
---|
| 4540 | + { |
---|
| 4541 | + texname += "Bump.jpg"; |
---|
| 4542 | + } |
---|
| 4543 | + |
---|
| 4544 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4545 | + } |
---|
| 4546 | + |
---|
| 4547 | + for (int i=0; i<Size(); i++) |
---|
| 4548 | + { |
---|
| 4549 | + blockloop = true; |
---|
| 4550 | + get(i).RepairSOV(); |
---|
| 4551 | + blockloop = false; |
---|
| 4552 | + } |
---|
| 4553 | + } |
---|
| 4554 | + |
---|
4354 | 4555 | void RepairTexture() |
---|
4355 | 4556 | { |
---|
4356 | 4557 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4865 | 5066 | } |
---|
4866 | 5067 | } |
---|
4867 | 5068 | |
---|
| 5069 | + ObjEditor GetWindow() |
---|
| 5070 | + { |
---|
| 5071 | + if (editWindow != null) |
---|
| 5072 | + return editWindow; |
---|
| 5073 | + |
---|
| 5074 | + return manipWindow; |
---|
| 5075 | + } |
---|
| 5076 | + |
---|
4868 | 5077 | cTreePath Select(int indexcount, boolean deselect) |
---|
4869 | 5078 | { |
---|
4870 | 5079 | if (hide || dontselect) |
---|
.. | .. |
---|
4901 | 5110 | if (leaf != null) |
---|
4902 | 5111 | { |
---|
4903 | 5112 | cTreePath tp = new cTreePath(this, leaf); |
---|
4904 | | - if (editWindow != null) |
---|
| 5113 | + ObjEditor window = GetWindow(); |
---|
| 5114 | + if (window != null) |
---|
4905 | 5115 | { |
---|
4906 | 5116 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4907 | | - editWindow.Select(tp, deselect, true); |
---|
| 5117 | + window.Select(tp, deselect, true); |
---|
4908 | 5118 | } |
---|
4909 | 5119 | |
---|
4910 | 5120 | return tp; |
---|
.. | .. |
---|
4921 | 5131 | |
---|
4922 | 5132 | if (child == null) |
---|
4923 | 5133 | continue; |
---|
| 5134 | + |
---|
4924 | 5135 | if (child.HasTransparency() && child.size() != 0) |
---|
4925 | 5136 | { |
---|
4926 | 5137 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4930 | 5141 | if (leaf != null) |
---|
4931 | 5142 | { |
---|
4932 | 5143 | cTreePath tp = new cTreePath(this, leaf); |
---|
4933 | | - if (editWindow != null) |
---|
| 5144 | + ObjEditor window = GetWindow(); |
---|
| 5145 | + if (window != null) |
---|
4934 | 5146 | { |
---|
4935 | | - editWindow.Select(tp, deselect, true); |
---|
| 5147 | + window.Select(tp, deselect, true); |
---|
4936 | 5148 | } |
---|
4937 | 5149 | |
---|
4938 | 5150 | return tp; |
---|
.. | .. |
---|
5257 | 5469 | blockloop = false; |
---|
5258 | 5470 | } |
---|
5259 | 5471 | |
---|
| 5472 | + void ResetSelectable() |
---|
| 5473 | + { |
---|
| 5474 | + if (blockloop) |
---|
| 5475 | + return; |
---|
| 5476 | + |
---|
| 5477 | + blockloop = true; |
---|
| 5478 | + |
---|
| 5479 | + keepdontselect = dontselect; |
---|
| 5480 | + dontselect = true; |
---|
| 5481 | + |
---|
| 5482 | + Object3D child; |
---|
| 5483 | + int nb = Size(); |
---|
| 5484 | + for (int i = 0; i < nb; i++) |
---|
| 5485 | + { |
---|
| 5486 | + child = (Object3D) get(i); |
---|
| 5487 | + if (child == null) |
---|
| 5488 | + continue; |
---|
| 5489 | + child.ResetSelectable(); |
---|
| 5490 | + } |
---|
| 5491 | + |
---|
| 5492 | + blockloop = false; |
---|
| 5493 | + } |
---|
| 5494 | + |
---|
| 5495 | + void RestoreSelectable() |
---|
| 5496 | + { |
---|
| 5497 | + if (blockloop) |
---|
| 5498 | + return; |
---|
| 5499 | + |
---|
| 5500 | + blockloop = true; |
---|
| 5501 | + |
---|
| 5502 | + dontselect = keepdontselect; |
---|
| 5503 | + |
---|
| 5504 | + Object3D child; |
---|
| 5505 | + int nb = Size(); |
---|
| 5506 | + for (int i = 0; i < nb; i++) |
---|
| 5507 | + { |
---|
| 5508 | + child = (Object3D) get(i); |
---|
| 5509 | + if (child == null) |
---|
| 5510 | + continue; |
---|
| 5511 | + child.RestoreSelectable(); |
---|
| 5512 | + } |
---|
| 5513 | + |
---|
| 5514 | + blockloop = false; |
---|
| 5515 | + } |
---|
| 5516 | + |
---|
5260 | 5517 | boolean IsSelected() |
---|
5261 | 5518 | { |
---|
5262 | 5519 | if (parent == null) |
---|
.. | .. |
---|
5566 | 5823 | } |
---|
5567 | 5824 | } |
---|
5568 | 5825 | |
---|
| 5826 | + void EmbedTextures(boolean embed) |
---|
| 5827 | + { |
---|
| 5828 | + if (blockloop) |
---|
| 5829 | + return; |
---|
| 5830 | + |
---|
| 5831 | + //if (GetTextures() != null) |
---|
| 5832 | + if (embed) |
---|
| 5833 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 5834 | + else |
---|
| 5835 | + { |
---|
| 5836 | + GetTextures().pigmentdata = null; |
---|
| 5837 | + GetTextures().bumpdata = null; |
---|
| 5838 | + GetTextures().pw = 0; |
---|
| 5839 | + GetTextures().ph = 0; |
---|
| 5840 | + GetTextures().bw = 0; |
---|
| 5841 | + GetTextures().bh = 0; |
---|
| 5842 | + } |
---|
| 5843 | + |
---|
| 5844 | + int nb = Size(); |
---|
| 5845 | + for (int i = 0; i < nb; i++) |
---|
| 5846 | + { |
---|
| 5847 | + Object3D child = (Object3D) get(i); |
---|
| 5848 | + |
---|
| 5849 | + if (child == null) |
---|
| 5850 | + continue; |
---|
| 5851 | + |
---|
| 5852 | + blockloop = true; |
---|
| 5853 | + child.EmbedTextures(embed); |
---|
| 5854 | + blockloop = false; |
---|
| 5855 | + } |
---|
| 5856 | + } |
---|
| 5857 | + |
---|
5569 | 5858 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5570 | 5859 | { |
---|
5571 | 5860 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5652 | 5941 | if (support != null) |
---|
5653 | 5942 | support = support; |
---|
5654 | 5943 | |
---|
5655 | | - //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); |
---|
| 5944 | + boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5945 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5946 | + |
---|
| 5947 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5657 | 5948 | |
---|
5658 | 5949 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5659 | 5950 | { |
---|
.. | .. |
---|
5663 | 5954 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5664 | 5955 | // usecalllists = false; |
---|
5665 | 5956 | |
---|
5666 | | - if (GetBRep() != null) |
---|
5667 | | - usecalllists = usecalllists; |
---|
| 5957 | + if (display.DrawMode() == display.SHADOW) |
---|
| 5958 | + //GetBRep() != null) |
---|
| 5959 | + usecalllists = !!usecalllists; |
---|
5668 | 5960 | //System.out.println("draw " + this); |
---|
5669 | 5961 | //new Exception().printStackTrace(); |
---|
5670 | 5962 | |
---|
.. | .. |
---|
5673 | 5965 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5674 | 5966 | |
---|
5675 | 5967 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5676 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5968 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5969 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5677 | 5970 | { |
---|
5678 | 5971 | Globals.lighttouched = true; |
---|
5679 | 5972 | } // all panes... |
---|
| 5973 | + |
---|
5680 | 5974 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5681 | 5975 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5682 | 5976 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5684 | 5978 | if (!(this instanceof Composite)) |
---|
5685 | 5979 | touched = false; |
---|
5686 | 5980 | //if (displaylist == -1 && usecalllists) |
---|
5687 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 5981 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5688 | 5982 | { |
---|
5689 | 5983 | bRep.displaylist = display.GenList(); |
---|
5690 | 5984 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5695 | 5989 | |
---|
5696 | 5990 | //System.out.println("\tnew list " + list); |
---|
5697 | 5991 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5698 | | - if (usecalllists) |
---|
| 5992 | + if (usecalllists && bRep.displaylist > 0) |
---|
5699 | 5993 | { |
---|
5700 | 5994 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5701 | 5995 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5704 | 5998 | CallList(display, root, selected, blocked); |
---|
5705 | 5999 | |
---|
5706 | 6000 | // compiled = true; |
---|
5707 | | - if (usecalllists) |
---|
| 6001 | + if (usecalllists && bRep.displaylist > 0) |
---|
5708 | 6002 | { |
---|
5709 | 6003 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5710 | 6004 | display.EndList(); |
---|
.. | .. |
---|
5804 | 6098 | if (GetBRep() != null) |
---|
5805 | 6099 | { |
---|
5806 | 6100 | display.NextIndex(); |
---|
| 6101 | + |
---|
5807 | 6102 | // vertex color conflict : gl.glCallList(list); |
---|
5808 | 6103 | DrawNode(display, root, selected); |
---|
5809 | 6104 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5844 | 6139 | tex = GetTextures(); |
---|
5845 | 6140 | } |
---|
5846 | 6141 | |
---|
5847 | | - boolean failed = false; |
---|
| 6142 | + boolean failedPigment = false; |
---|
| 6143 | + boolean failedBump = false; |
---|
5848 | 6144 | |
---|
5849 | 6145 | try |
---|
5850 | 6146 | { |
---|
5851 | | - display.BindTextures(tex, texres); |
---|
| 6147 | + display.BindPigmentTexture(tex, texres); |
---|
5852 | 6148 | } |
---|
5853 | 6149 | catch (Exception e) |
---|
5854 | 6150 | { |
---|
5855 | 6151 | System.err.println("FAILED: " + this); |
---|
5856 | | - failed = true; |
---|
| 6152 | + failedPigment = true; |
---|
| 6153 | + } |
---|
| 6154 | + |
---|
| 6155 | + try |
---|
| 6156 | + { |
---|
| 6157 | + display.BindBumpTexture(tex, texres); |
---|
| 6158 | + } |
---|
| 6159 | + catch (Exception e) |
---|
| 6160 | + { |
---|
| 6161 | + //System.err.println("FAILED: " + this); |
---|
| 6162 | + failedBump = true; |
---|
5857 | 6163 | } |
---|
5858 | 6164 | |
---|
5859 | 6165 | if (!compiled) |
---|
.. | .. |
---|
5876 | 6182 | } |
---|
5877 | 6183 | } |
---|
5878 | 6184 | |
---|
5879 | | - if (!failed) |
---|
5880 | | - display.ReleaseTextures(tex); |
---|
| 6185 | + if (!failedBump) |
---|
| 6186 | + display.ReleaseBumpTexture(tex); |
---|
| 6187 | + |
---|
| 6188 | + if (!failedPigment) |
---|
| 6189 | + display.ReleasePigmentTexture(tex); |
---|
5881 | 6190 | |
---|
5882 | 6191 | display.PopMaterial(this, selected); |
---|
5883 | 6192 | } |
---|
.. | .. |
---|
6250 | 6559 | // dec 2012 |
---|
6251 | 6560 | new Exception().printStackTrace(); |
---|
6252 | 6561 | return; |
---|
| 6562 | + } |
---|
| 6563 | + |
---|
| 6564 | + if (dontselect) |
---|
| 6565 | + { |
---|
| 6566 | + //bRep.GenerateNormalsMINE(); |
---|
6253 | 6567 | } |
---|
6254 | 6568 | |
---|
6255 | 6569 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7035 | 7349 | } |
---|
7036 | 7350 | } |
---|
7037 | 7351 | |
---|
7038 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7352 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7353 | + |
---|
| 7354 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7355 | + Point outPt, Rectangle outRec) |
---|
7039 | 7356 | { |
---|
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; |
---|
| 7357 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7358 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7359 | + double[][] toscreen = clickInfo.toScreen; |
---|
7043 | 7360 | if (toscreen == null) |
---|
7044 | 7361 | { |
---|
7045 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7362 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7046 | 7363 | } |
---|
7047 | 7364 | cVector vec = in; |
---|
7048 | 7365 | LA.xformPos(in, toscreen, in); |
---|
7049 | 7366 | //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(); |
---|
| 7367 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7368 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7052 | 7369 | outPt.x = hc + (int) vec.x; |
---|
7053 | 7370 | outPt.y = vc - (int) vec.y; |
---|
7054 | 7371 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7056 | 7373 | outRec.width = outRec.height = 6; |
---|
7057 | 7374 | } |
---|
7058 | 7375 | |
---|
7059 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7376 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7377 | + ) |
---|
7060 | 7378 | { |
---|
7061 | 7379 | Point pt = new Point(0, 0); |
---|
7062 | 7380 | Rectangle rec = new Rectangle(); |
---|
7063 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7381 | + calcHotSpot(in, //clickInfo, |
---|
| 7382 | + pt, rec); |
---|
7064 | 7383 | return rec; |
---|
7065 | 7384 | } |
---|
7066 | 7385 | |
---|
7067 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7386 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7387 | + int level) |
---|
7068 | 7388 | { |
---|
7069 | 7389 | if (level == 0) |
---|
7070 | 7390 | { |
---|
.. | .. |
---|
7073 | 7393 | { |
---|
7074 | 7394 | cVector origin = new cVector(); |
---|
7075 | 7395 | //LA.xformPos(origin, toParent, origin); |
---|
7076 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7396 | + if (this.clickInfo == null) |
---|
| 7397 | + this.clickInfo = new ClickInfo(); |
---|
| 7398 | + |
---|
| 7399 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7077 | 7400 | Rectangle boundary = new Rectangle(); |
---|
7078 | 7401 | boundary.x = spot.x - 30; |
---|
7079 | 7402 | boundary.y = spot.y - 30; |
---|
7080 | 7403 | boundary.width = spot.width + 60; |
---|
7081 | 7404 | boundary.height = spot.height + 60; |
---|
7082 | | - info.g.setColor(Color.red); |
---|
| 7405 | + clickInfo.g.setColor(Color.red); |
---|
7083 | 7406 | int spotw = spot.x + spot.width; |
---|
7084 | 7407 | int spoth = spot.y + spot.height; |
---|
7085 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7408 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7086 | 7409 | // if (CameraPane.Xmin > spot.x) |
---|
7087 | 7410 | // { |
---|
7088 | 7411 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7102 | 7425 | spot.translate(32, 32); |
---|
7103 | 7426 | spotw = spot.x + spot.width; |
---|
7104 | 7427 | spoth = spot.y + spot.height; |
---|
7105 | | - info.g.setColor(Color.blue); |
---|
7106 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7428 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7429 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7107 | 7430 | // if (CameraPane.Xmin > spot.x) |
---|
7108 | 7431 | // { |
---|
7109 | 7432 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7120 | 7443 | // { |
---|
7121 | 7444 | // CameraPane.Ymax = spoth; |
---|
7122 | 7445 | // } |
---|
7123 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7124 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7446 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7447 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7125 | 7448 | spot.translate(0, -32); |
---|
7126 | | - info.g.setColor(Color.green); |
---|
7127 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7449 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7450 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7451 | + clickInfo.g.setColor(Color.green); |
---|
7128 | 7452 | // if (CameraPane.Xmin > spot.x) |
---|
7129 | 7453 | // { |
---|
7130 | 7454 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7141 | 7465 | // { |
---|
7142 | 7466 | // CameraPane.Ymax = spoth; |
---|
7143 | 7467 | // } |
---|
7144 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7145 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7468 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7469 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7146 | 7470 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7147 | 7471 | // if (CameraPane.Xmin > boundary.x) |
---|
7148 | 7472 | // { |
---|
.. | .. |
---|
7164 | 7488 | } |
---|
7165 | 7489 | } |
---|
7166 | 7490 | |
---|
7167 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7491 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7492 | + int level) |
---|
7168 | 7493 | { |
---|
7169 | 7494 | if (level == 0) |
---|
7170 | 7495 | { |
---|
.. | .. |
---|
7173 | 7498 | |
---|
7174 | 7499 | boolean retval = false; |
---|
7175 | 7500 | |
---|
7176 | | - startX = info.x; |
---|
7177 | | - startY = info.y; |
---|
| 7501 | + startX = clickInfo.x; |
---|
| 7502 | + startY = clickInfo.y; |
---|
7178 | 7503 | |
---|
7179 | 7504 | hitSomething = -1; |
---|
7180 | 7505 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7184 | 7509 | { |
---|
7185 | 7510 | centerPt = new Point(0, 0); |
---|
7186 | 7511 | } |
---|
7187 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7188 | | - if (spot.contains(info.x, info.y)) |
---|
| 7512 | + calcHotSpot(origin, //info, |
---|
| 7513 | + centerPt, spot); |
---|
| 7514 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7189 | 7515 | { |
---|
7190 | 7516 | hitSomething = hitCenter; |
---|
7191 | 7517 | retval = true; |
---|
7192 | 7518 | } |
---|
7193 | 7519 | spot.translate(32, 0); |
---|
7194 | | - if (spot.contains(info.x, info.y)) |
---|
| 7520 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7195 | 7521 | { |
---|
7196 | 7522 | hitSomething = hitRotate; |
---|
7197 | 7523 | retval = true; |
---|
7198 | 7524 | } |
---|
7199 | 7525 | spot.translate(0, 32); |
---|
7200 | | - if (spot.contains(info.x, info.y)) |
---|
| 7526 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7201 | 7527 | { |
---|
7202 | 7528 | hitSomething = hitScale; |
---|
| 7529 | + |
---|
| 7530 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7531 | + double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7532 | + double sign = 1; |
---|
| 7533 | + if (hScale < 0) |
---|
| 7534 | + { |
---|
| 7535 | + sign = -1; |
---|
| 7536 | + } |
---|
| 7537 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7538 | + if (hScale < 0.01) |
---|
| 7539 | + { |
---|
| 7540 | + //hScale = 0.01; |
---|
| 7541 | + } |
---|
| 7542 | + |
---|
| 7543 | + double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7544 | + sign = 1; |
---|
| 7545 | + if (vScale < 0) |
---|
| 7546 | + { |
---|
| 7547 | + sign = -1; |
---|
| 7548 | + } |
---|
| 7549 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7550 | + if (vScale < 0.01) |
---|
| 7551 | + { |
---|
| 7552 | + //vScale = 0.01; |
---|
| 7553 | + } |
---|
| 7554 | + |
---|
| 7555 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7556 | + |
---|
7203 | 7557 | retval = true; |
---|
7204 | 7558 | } |
---|
7205 | 7559 | |
---|
.. | .. |
---|
7209 | 7563 | } |
---|
7210 | 7564 | |
---|
7211 | 7565 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7212 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7566 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7213 | 7567 | //System.out.println("modified = " + modified); |
---|
7214 | 7568 | //new Exception().printStackTrace(); |
---|
7215 | 7569 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7237 | 7591 | return true; |
---|
7238 | 7592 | } |
---|
7239 | 7593 | |
---|
7240 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7594 | + void doEditDrag0(//ClickInfo info, |
---|
| 7595 | + boolean opposite) |
---|
7241 | 7596 | { |
---|
7242 | 7597 | if (hitSomething == 0) |
---|
7243 | 7598 | { |
---|
.. | .. |
---|
7251 | 7606 | |
---|
7252 | 7607 | //System.out.println("hitSomething = " + hitSomething); |
---|
7253 | 7608 | |
---|
7254 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7609 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7255 | 7610 | |
---|
7256 | 7611 | cVector xlate = new cVector(); |
---|
7257 | 7612 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7285 | 7640 | toParent[3][i] = xlate.get(i); |
---|
7286 | 7641 | LA.matInvert(toParent, fromParent); |
---|
7287 | 7642 | */ |
---|
7288 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7289 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7643 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7644 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7290 | 7645 | |
---|
7291 | 7646 | LA.matCopy(startMat, toParent); |
---|
7292 | 7647 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7295 | 7650 | } else |
---|
7296 | 7651 | { |
---|
7297 | 7652 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7298 | | - cVector up = new cVector(info.camera.up); |
---|
| 7653 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7299 | 7654 | cVector away = new cVector(); |
---|
7300 | 7655 | //cVector right2 = new cVector(); |
---|
7301 | 7656 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7312 | 7667 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7313 | 7668 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7314 | 7669 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7315 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7670 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7316 | 7671 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7317 | 7672 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7318 | 7673 | //LA.vecCross(up, cVector.Z, right2); |
---|
7319 | 7674 | |
---|
7320 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7675 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7321 | 7676 | |
---|
7322 | 7677 | //System.out.println("DELTA0 = " + delta); |
---|
7323 | 7678 | //System.out.println("AWAY = " + info.camera.away); |
---|
7324 | 7679 | //System.out.println("UP = " + info.camera.up); |
---|
7325 | 7680 | if (away.z > 0) |
---|
7326 | 7681 | { |
---|
7327 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7682 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7328 | 7683 | { |
---|
7329 | 7684 | delta.x = -delta.x; |
---|
7330 | 7685 | } else |
---|
.. | .. |
---|
7339 | 7694 | //System.out.println("DELTA1 = " + delta); |
---|
7340 | 7695 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7341 | 7696 | //System.out.println("DELTA2 = " + delta); |
---|
7342 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7697 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7343 | 7698 | LA.matCopy(startMat, toParent); |
---|
7344 | 7699 | //System.out.println("DELTA3 = " + delta); |
---|
7345 | 7700 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7349 | 7704 | break; |
---|
7350 | 7705 | |
---|
7351 | 7706 | case hitRotate: // rotate |
---|
7352 | | - int dx = info.x - centerPt.x; |
---|
7353 | | - int dy = -(info.y - centerPt.y); |
---|
| 7707 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7708 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7354 | 7709 | double angle = (double) Math.atan2(dx, dy); |
---|
7355 | 7710 | angle = -(1.570796 - angle); |
---|
7356 | 7711 | |
---|
.. | .. |
---|
7373 | 7728 | } |
---|
7374 | 7729 | /**/ |
---|
7375 | 7730 | |
---|
7376 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7731 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7377 | 7732 | { |
---|
7378 | 7733 | case 1: // '\001' |
---|
7379 | 7734 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7400 | 7755 | break; |
---|
7401 | 7756 | |
---|
7402 | 7757 | case hitScale: // scale |
---|
7403 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7758 | + double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
7404 | 7759 | double sign = 1; |
---|
7405 | 7760 | if (hScale < 0) |
---|
7406 | 7761 | { |
---|
.. | .. |
---|
7412 | 7767 | //hScale = 0.01; |
---|
7413 | 7768 | } |
---|
7414 | 7769 | |
---|
7415 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7770 | + double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
7416 | 7771 | sign = 1; |
---|
7417 | 7772 | if (vScale < 0) |
---|
7418 | 7773 | { |
---|
.. | .. |
---|
7423 | 7778 | { |
---|
7424 | 7779 | //vScale = 0.01; |
---|
7425 | 7780 | } |
---|
| 7781 | + |
---|
7426 | 7782 | LA.matCopy(startMat, toParent); |
---|
7427 | 7783 | /**/ |
---|
7428 | 7784 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7432 | 7788 | } |
---|
7433 | 7789 | /**/ |
---|
7434 | 7790 | |
---|
7435 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7791 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7436 | 7792 | |
---|
7437 | 7793 | if (totalScale < 0.01) |
---|
7438 | 7794 | { |
---|
7439 | 7795 | totalScale = 0.01; |
---|
7440 | 7796 | } |
---|
7441 | 7797 | |
---|
7442 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7798 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7443 | 7799 | { |
---|
7444 | 7800 | case 3: // '\001' |
---|
7445 | | - if (modified) |
---|
| 7801 | + if (modified || opposite) |
---|
7446 | 7802 | { |
---|
7447 | 7803 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7448 | 7804 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7449 | 7805 | } // vScale, 1); |
---|
7450 | 7806 | else |
---|
7451 | 7807 | { |
---|
| 7808 | + // EXCEPTION! |
---|
7452 | 7809 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7453 | 7810 | } // vScale, 1); |
---|
7454 | 7811 | break; |
---|
7455 | 7812 | |
---|
7456 | 7813 | case 2: // '\002' |
---|
7457 | | - if (modified) |
---|
| 7814 | + if (modified || opposite) |
---|
7458 | 7815 | { |
---|
7459 | 7816 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7460 | 7817 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7465 | 7822 | break; |
---|
7466 | 7823 | |
---|
7467 | 7824 | case 1: // '\003' |
---|
7468 | | - if (modified) |
---|
| 7825 | + if (modified || opposite) |
---|
7469 | 7826 | { |
---|
7470 | 7827 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7471 | 7828 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7505 | 7862 | } // NEW ... |
---|
7506 | 7863 | |
---|
7507 | 7864 | |
---|
7508 | | - info.pane.repaint(); |
---|
| 7865 | + clickInfo.pane.repaint(); |
---|
7509 | 7866 | } |
---|
7510 | 7867 | |
---|
7511 | 7868 | boolean overflow = false; |
---|
.. | .. |
---|
7685 | 8042 | editWindow = null; |
---|
7686 | 8043 | } // ? |
---|
7687 | 8044 | } |
---|
| 8045 | + else |
---|
| 8046 | + { |
---|
| 8047 | + //editWindow.closeUI(); |
---|
| 8048 | + } |
---|
7688 | 8049 | } |
---|
7689 | 8050 | |
---|
7690 | 8051 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7842 | 8203 | } |
---|
7843 | 8204 | |
---|
7844 | 8205 | transient ObjEditor editWindow; |
---|
| 8206 | + transient ObjEditor manipWindow; |
---|
| 8207 | + |
---|
| 8208 | + transient boolean pinned; |
---|
| 8209 | + |
---|
7845 | 8210 | transient ObjectUI objectUI; |
---|
7846 | 8211 | public static int povDepth = 0; |
---|
7847 | 8212 | private static cVector tbMin = new cVector(); |
---|