.. | .. |
---|
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 | + String skyboxname; |
---|
| 33 | + String skyboxext; |
---|
| 34 | + |
---|
| 35 | + byte[] versions[]; |
---|
| 36 | + int versionindex = -1; |
---|
| 37 | + |
---|
32 | 38 | ScriptNode scriptnode; |
---|
33 | 39 | |
---|
34 | 40 | void InitOthers() |
---|
.. | .. |
---|
170 | 176 | |
---|
171 | 177 | void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
172 | 178 | { |
---|
| 179 | + Object3D o; |
---|
| 180 | + |
---|
173 | 181 | if (hashtable.containsKey(GetUUID())) |
---|
174 | 182 | { |
---|
175 | | - Object3D o = hashtable.get(GetUUID()); |
---|
| 183 | + o = hashtable.get(GetUUID()); |
---|
176 | 184 | |
---|
177 | 185 | Grafreed.Assert(this.bRep == o.bRep); |
---|
178 | | - if (this.bRep != null) |
---|
179 | | - assert(this.bRep.support == o.transientrep); |
---|
| 186 | + //if (this.bRep != null) |
---|
| 187 | + // assert(this.bRep.support == o.transientrep); |
---|
| 188 | + if (this.support != null) |
---|
| 189 | + assert(this.support.bRep == o.transientrep); |
---|
| 190 | + } |
---|
| 191 | + else |
---|
| 192 | + { |
---|
| 193 | + o = new Object3D("copy of " + this.name); |
---|
180 | 194 | |
---|
181 | | - return; |
---|
| 195 | + hashtable.put(GetUUID(), o); |
---|
182 | 196 | } |
---|
183 | 197 | |
---|
184 | | - Object3D o = new Object3D(); |
---|
185 | | - |
---|
186 | | - hashtable.put(GetUUID(), o); |
---|
187 | | - |
---|
188 | | - for (int i=0; i<Size(); i++) |
---|
| 198 | + if (!blockloop) |
---|
189 | 199 | { |
---|
190 | | - get(i).ExtractBigData(hashtable); |
---|
| 200 | + blockloop = true; |
---|
| 201 | + |
---|
| 202 | + for (int i=0; i<Size(); i++) |
---|
| 203 | + { |
---|
| 204 | + get(i).ExtractBigData(hashtable); |
---|
| 205 | + } |
---|
| 206 | + |
---|
| 207 | + blockloop = false; |
---|
191 | 208 | } |
---|
192 | 209 | |
---|
193 | 210 | ExtractBigData(o); |
---|
.. | .. |
---|
195 | 212 | |
---|
196 | 213 | void ExtractBigData(Object3D o) |
---|
197 | 214 | { |
---|
| 215 | + if (o.bRep != null) |
---|
| 216 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 217 | + |
---|
198 | 218 | o.bRep = this.bRep; |
---|
199 | | - if (this.bRep != null) |
---|
| 219 | +// July 2019 if (this.bRep != null) |
---|
| 220 | +// { |
---|
| 221 | +// o.transientrep = this.bRep.support; |
---|
| 222 | +// o.bRep.support = null; |
---|
| 223 | +// } |
---|
| 224 | + o.selection = this.selection; |
---|
| 225 | + o.versions = this.versions; |
---|
| 226 | + o.versionindex = this.versionindex; |
---|
| 227 | + |
---|
| 228 | + if (this.support != null) |
---|
200 | 229 | { |
---|
201 | | - o.transientrep = this.bRep.support; |
---|
202 | | - o.bRep.support = null; |
---|
| 230 | + if (o.transientrep != null) |
---|
| 231 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 232 | + |
---|
| 233 | + o.transientrep = this.support.bRep; |
---|
| 234 | + this.support.bRep = null; |
---|
203 | 235 | } |
---|
204 | 236 | |
---|
205 | 237 | // o.support = this.support; |
---|
.. | .. |
---|
223 | 255 | |
---|
224 | 256 | RestoreBigData(o); |
---|
225 | 257 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 258 | + if (blockloop) |
---|
| 259 | + return; |
---|
| 260 | + |
---|
| 261 | + blockloop = true; |
---|
| 262 | + |
---|
| 263 | + //hashtable.remove(GetUUID()); |
---|
227 | 264 | |
---|
228 | 265 | for (int i=0; i<Size(); i++) |
---|
229 | 266 | { |
---|
230 | 267 | get(i).RestoreBigData(hashtable); |
---|
231 | 268 | } |
---|
| 269 | + |
---|
| 270 | + blockloop = false; |
---|
232 | 271 | } |
---|
233 | 272 | |
---|
234 | 273 | void RestoreBigData(Object3D o) |
---|
235 | 274 | { |
---|
236 | 275 | this.bRep = o.bRep; |
---|
237 | | - if (this.bRep != null) |
---|
238 | | - this.bRep.support = o.transientrep; |
---|
| 276 | + if (this.support != null && o.transientrep != null) |
---|
| 277 | + { |
---|
| 278 | + this.support.bRep = o.transientrep; |
---|
| 279 | + } |
---|
| 280 | + |
---|
| 281 | + this.selection = o.selection; |
---|
| 282 | + |
---|
| 283 | + this.versions = o.versions; |
---|
| 284 | + this.versionindex = o.versionindex; |
---|
| 285 | +// July 2019 if (this.bRep != null) |
---|
| 286 | +// this.bRep.support = o.transientrep; |
---|
239 | 287 | // this.support = o.support; |
---|
240 | 288 | // this.fileparent = o.fileparent; |
---|
241 | 289 | } |
---|
.. | .. |
---|
381 | 429 | } |
---|
382 | 430 | |
---|
383 | 431 | boolean live = false; |
---|
| 432 | + transient boolean keepdontselect; |
---|
384 | 433 | boolean dontselect = false; |
---|
385 | 434 | boolean hide = false; |
---|
386 | 435 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
1367 | 1416 | toParent = LA.newMatrix(); |
---|
1368 | 1417 | fromParent = LA.newMatrix(); |
---|
1369 | 1418 | } |
---|
| 1419 | + |
---|
1370 | 1420 | LA.matCopy(other.toParent, toParent); |
---|
1371 | 1421 | LA.matCopy(other.fromParent, fromParent); |
---|
1372 | 1422 | |
---|
.. | .. |
---|
2433 | 2483 | { |
---|
2434 | 2484 | editWindow.refreshContents(); |
---|
2435 | 2485 | } |
---|
| 2486 | + else |
---|
| 2487 | + { |
---|
| 2488 | + if (manipWindow != null) |
---|
| 2489 | + { |
---|
| 2490 | + manipWindow.refreshContents(); |
---|
| 2491 | + } |
---|
| 2492 | + } |
---|
| 2493 | + |
---|
2436 | 2494 | //if (parent != null) |
---|
2437 | 2495 | //parent.refreshEditWindow(); |
---|
2438 | 2496 | } |
---|
.. | .. |
---|
2512 | 2570 | private static final int editSelf = 1; |
---|
2513 | 2571 | private static final int editChild = 2; |
---|
2514 | 2572 | |
---|
2515 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2573 | + void drawEditHandles(//ClickInfo info, |
---|
| 2574 | + int level) |
---|
2516 | 2575 | { |
---|
2517 | 2576 | if (level == 0) |
---|
2518 | 2577 | { |
---|
.. | .. |
---|
2520 | 2579 | return; |
---|
2521 | 2580 | |
---|
2522 | 2581 | Object3D selectee; |
---|
2523 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2582 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2583 | + level + 1)) |
---|
2524 | 2584 | { |
---|
2525 | 2585 | selectee = (Object3D) e.nextElement(); |
---|
2526 | 2586 | } |
---|
.. | .. |
---|
2528 | 2588 | } else |
---|
2529 | 2589 | { |
---|
2530 | 2590 | //super. |
---|
2531 | | - drawEditHandles0(info, level + 1); |
---|
| 2591 | + drawEditHandles0(//info, |
---|
| 2592 | + level + 1); |
---|
2532 | 2593 | } |
---|
2533 | 2594 | } |
---|
2534 | 2595 | |
---|
2535 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2596 | + boolean doEditClick(//ClickInfo info, |
---|
| 2597 | + int level) |
---|
2536 | 2598 | { |
---|
2537 | 2599 | doSomething = 0; |
---|
2538 | 2600 | if (level == 0) |
---|
2539 | 2601 | { |
---|
2540 | | - return doParentClick(info); |
---|
| 2602 | + return doParentClick(); //info); |
---|
2541 | 2603 | } |
---|
2542 | 2604 | if (//super. |
---|
2543 | | - doEditClick0(info, level)) |
---|
| 2605 | + doEditClick0(//info, |
---|
| 2606 | + level)) |
---|
2544 | 2607 | { |
---|
2545 | 2608 | doSomething = 1; |
---|
2546 | 2609 | return true; |
---|
.. | .. |
---|
2550 | 2613 | } |
---|
2551 | 2614 | } |
---|
2552 | 2615 | |
---|
2553 | | - boolean doParentClick(ClickInfo info) |
---|
| 2616 | + boolean doParentClick() //ClickInfo info) |
---|
2554 | 2617 | { |
---|
2555 | 2618 | if (selection == null) |
---|
2556 | 2619 | { |
---|
.. | .. |
---|
2563 | 2626 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2564 | 2627 | { |
---|
2565 | 2628 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2566 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2629 | + if (selectee.doEditClick(//info, |
---|
| 2630 | + 1)) |
---|
2567 | 2631 | { |
---|
2568 | 2632 | childToDrag = selectee; |
---|
2569 | 2633 | doSomething = 2; |
---|
.. | .. |
---|
2575 | 2639 | return retval; |
---|
2576 | 2640 | } |
---|
2577 | 2641 | |
---|
2578 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2642 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2643 | + boolean opposite) |
---|
2579 | 2644 | { |
---|
2580 | 2645 | switch (doSomething) |
---|
2581 | 2646 | { |
---|
2582 | 2647 | case 1: // '\001' |
---|
2583 | 2648 | //super. |
---|
2584 | | - doEditDrag0(info, opposite); |
---|
| 2649 | + doEditDrag0(//clickInfo, |
---|
| 2650 | + opposite); |
---|
2585 | 2651 | break; |
---|
2586 | 2652 | |
---|
2587 | 2653 | case 2: // '\002' |
---|
.. | .. |
---|
2594 | 2660 | { |
---|
2595 | 2661 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2596 | 2662 | //childToDrag.doEditDrag(info); |
---|
2597 | | - sel.doEditDrag(info, opposite); |
---|
| 2663 | + sel.doEditDrag(//clickInfo, |
---|
| 2664 | + opposite); |
---|
2598 | 2665 | } else |
---|
2599 | 2666 | { |
---|
2600 | 2667 | //super. |
---|
2601 | | - doEditDrag0(info, opposite); |
---|
| 2668 | + doEditDrag0(//clickInfo, |
---|
| 2669 | + opposite); |
---|
2602 | 2670 | } |
---|
2603 | 2671 | } |
---|
2604 | 2672 | break; |
---|
.. | .. |
---|
2616 | 2684 | { |
---|
2617 | 2685 | deselectAll(); |
---|
2618 | 2686 | } |
---|
| 2687 | + |
---|
| 2688 | + new Exception().printStackTrace(); |
---|
| 2689 | + |
---|
2619 | 2690 | ClickInfo newInfo = new ClickInfo(); |
---|
2620 | 2691 | newInfo.flags = info.flags; |
---|
2621 | 2692 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3063 | 3134 | { |
---|
3064 | 3135 | if (bRep != null) |
---|
3065 | 3136 | { |
---|
3066 | | - bRep.GenerateNormalsMINE(); |
---|
| 3137 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3067 | 3138 | Touch(); |
---|
3068 | 3139 | } |
---|
3069 | 3140 | } |
---|
.. | .. |
---|
4963 | 5034 | } |
---|
4964 | 5035 | } |
---|
4965 | 5036 | |
---|
| 5037 | + ObjEditor GetWindow() |
---|
| 5038 | + { |
---|
| 5039 | + if (editWindow != null) |
---|
| 5040 | + return editWindow; |
---|
| 5041 | + |
---|
| 5042 | + return manipWindow; |
---|
| 5043 | + } |
---|
| 5044 | + |
---|
4966 | 5045 | cTreePath Select(int indexcount, boolean deselect) |
---|
4967 | 5046 | { |
---|
4968 | 5047 | if (hide || dontselect) |
---|
.. | .. |
---|
4999 | 5078 | if (leaf != null) |
---|
5000 | 5079 | { |
---|
5001 | 5080 | cTreePath tp = new cTreePath(this, leaf); |
---|
5002 | | - if (editWindow != null) |
---|
| 5081 | + ObjEditor window = GetWindow(); |
---|
| 5082 | + if (window != null) |
---|
5003 | 5083 | { |
---|
5004 | 5084 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
5005 | | - editWindow.Select(tp, deselect, true); |
---|
| 5085 | + window.Select(tp, deselect, true); |
---|
5006 | 5086 | } |
---|
5007 | 5087 | |
---|
5008 | 5088 | return tp; |
---|
.. | .. |
---|
5019 | 5099 | |
---|
5020 | 5100 | if (child == null) |
---|
5021 | 5101 | continue; |
---|
| 5102 | + |
---|
5022 | 5103 | if (child.HasTransparency() && child.size() != 0) |
---|
5023 | 5104 | { |
---|
5024 | 5105 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
5028 | 5109 | if (leaf != null) |
---|
5029 | 5110 | { |
---|
5030 | 5111 | cTreePath tp = new cTreePath(this, leaf); |
---|
5031 | | - if (editWindow != null) |
---|
| 5112 | + ObjEditor window = GetWindow(); |
---|
| 5113 | + if (window != null) |
---|
5032 | 5114 | { |
---|
5033 | | - editWindow.Select(tp, deselect, true); |
---|
| 5115 | + window.Select(tp, deselect, true); |
---|
5034 | 5116 | } |
---|
5035 | 5117 | |
---|
5036 | 5118 | return tp; |
---|
.. | .. |
---|
5355 | 5437 | blockloop = false; |
---|
5356 | 5438 | } |
---|
5357 | 5439 | |
---|
| 5440 | + void ResetSelectable() |
---|
| 5441 | + { |
---|
| 5442 | + if (blockloop) |
---|
| 5443 | + return; |
---|
| 5444 | + |
---|
| 5445 | + blockloop = true; |
---|
| 5446 | + |
---|
| 5447 | + keepdontselect = dontselect; |
---|
| 5448 | + dontselect = true; |
---|
| 5449 | + |
---|
| 5450 | + Object3D child; |
---|
| 5451 | + int nb = Size(); |
---|
| 5452 | + for (int i = 0; i < nb; i++) |
---|
| 5453 | + { |
---|
| 5454 | + child = (Object3D) get(i); |
---|
| 5455 | + if (child == null) |
---|
| 5456 | + continue; |
---|
| 5457 | + child.ResetSelectable(); |
---|
| 5458 | + } |
---|
| 5459 | + |
---|
| 5460 | + blockloop = false; |
---|
| 5461 | + } |
---|
| 5462 | + |
---|
| 5463 | + void RestoreSelectable() |
---|
| 5464 | + { |
---|
| 5465 | + if (blockloop) |
---|
| 5466 | + return; |
---|
| 5467 | + |
---|
| 5468 | + blockloop = true; |
---|
| 5469 | + |
---|
| 5470 | + dontselect = keepdontselect; |
---|
| 5471 | + |
---|
| 5472 | + Object3D child; |
---|
| 5473 | + int nb = Size(); |
---|
| 5474 | + for (int i = 0; i < nb; i++) |
---|
| 5475 | + { |
---|
| 5476 | + child = (Object3D) get(i); |
---|
| 5477 | + if (child == null) |
---|
| 5478 | + continue; |
---|
| 5479 | + child.RestoreSelectable(); |
---|
| 5480 | + } |
---|
| 5481 | + |
---|
| 5482 | + blockloop = false; |
---|
| 5483 | + } |
---|
| 5484 | + |
---|
5358 | 5485 | boolean IsSelected() |
---|
5359 | 5486 | { |
---|
5360 | 5487 | if (parent == null) |
---|
.. | .. |
---|
5664 | 5791 | } |
---|
5665 | 5792 | } |
---|
5666 | 5793 | |
---|
| 5794 | + void EmbedTextures(boolean embed) |
---|
| 5795 | + { |
---|
| 5796 | + if (blockloop) |
---|
| 5797 | + return; |
---|
| 5798 | + |
---|
| 5799 | + //if (GetTextures() != null) |
---|
| 5800 | + if (embed) |
---|
| 5801 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 5802 | + else |
---|
| 5803 | + { |
---|
| 5804 | + GetTextures().pigmentdata = null; |
---|
| 5805 | + GetTextures().bumpdata = null; |
---|
| 5806 | + GetTextures().pw = 0; |
---|
| 5807 | + GetTextures().ph = 0; |
---|
| 5808 | + GetTextures().bw = 0; |
---|
| 5809 | + GetTextures().bh = 0; |
---|
| 5810 | + } |
---|
| 5811 | + |
---|
| 5812 | + int nb = Size(); |
---|
| 5813 | + for (int i = 0; i < nb; i++) |
---|
| 5814 | + { |
---|
| 5815 | + Object3D child = (Object3D) get(i); |
---|
| 5816 | + |
---|
| 5817 | + if (child == null) |
---|
| 5818 | + continue; |
---|
| 5819 | + |
---|
| 5820 | + blockloop = true; |
---|
| 5821 | + child.EmbedTextures(embed); |
---|
| 5822 | + blockloop = false; |
---|
| 5823 | + } |
---|
| 5824 | + } |
---|
| 5825 | + |
---|
5667 | 5826 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5668 | 5827 | { |
---|
5669 | 5828 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5751 | 5910 | support = support; |
---|
5752 | 5911 | |
---|
5753 | 5912 | //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); |
---|
| 5913 | + boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5755 | 5914 | |
---|
5756 | 5915 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5757 | 5916 | { |
---|
.. | .. |
---|
5772 | 5931 | |
---|
5773 | 5932 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5774 | 5933 | //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5775 | | - (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
| 5934 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5776 | 5935 | { |
---|
5777 | 5936 | Globals.lighttouched = true; |
---|
5778 | 5937 | } // all panes... |
---|
.. | .. |
---|
5904 | 6063 | if (GetBRep() != null) |
---|
5905 | 6064 | { |
---|
5906 | 6065 | display.NextIndex(); |
---|
| 6066 | + |
---|
5907 | 6067 | // vertex color conflict : gl.glCallList(list); |
---|
5908 | 6068 | DrawNode(display, root, selected); |
---|
5909 | 6069 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
7154 | 7314 | } |
---|
7155 | 7315 | } |
---|
7156 | 7316 | |
---|
7157 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7317 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7318 | + |
---|
| 7319 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7320 | + Point outPt, Rectangle outRec) |
---|
7158 | 7321 | { |
---|
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; |
---|
| 7322 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7323 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7324 | + double[][] toscreen = clickInfo.toScreen; |
---|
7162 | 7325 | if (toscreen == null) |
---|
7163 | 7326 | { |
---|
7164 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7327 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7165 | 7328 | } |
---|
7166 | 7329 | cVector vec = in; |
---|
7167 | 7330 | LA.xformPos(in, toscreen, in); |
---|
7168 | 7331 | //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(); |
---|
| 7332 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7333 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7171 | 7334 | outPt.x = hc + (int) vec.x; |
---|
7172 | 7335 | outPt.y = vc - (int) vec.y; |
---|
7173 | 7336 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7175 | 7338 | outRec.width = outRec.height = 6; |
---|
7176 | 7339 | } |
---|
7177 | 7340 | |
---|
7178 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7341 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7342 | + ) |
---|
7179 | 7343 | { |
---|
7180 | 7344 | Point pt = new Point(0, 0); |
---|
7181 | 7345 | Rectangle rec = new Rectangle(); |
---|
7182 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7346 | + calcHotSpot(in, //clickInfo, |
---|
| 7347 | + pt, rec); |
---|
7183 | 7348 | return rec; |
---|
7184 | 7349 | } |
---|
7185 | 7350 | |
---|
7186 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7351 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7352 | + int level) |
---|
7187 | 7353 | { |
---|
7188 | 7354 | if (level == 0) |
---|
7189 | 7355 | { |
---|
.. | .. |
---|
7192 | 7358 | { |
---|
7193 | 7359 | cVector origin = new cVector(); |
---|
7194 | 7360 | //LA.xformPos(origin, toParent, origin); |
---|
7195 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7361 | + if (this.clickInfo == null) |
---|
| 7362 | + this.clickInfo = new ClickInfo(); |
---|
| 7363 | + |
---|
| 7364 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7196 | 7365 | Rectangle boundary = new Rectangle(); |
---|
7197 | 7366 | boundary.x = spot.x - 30; |
---|
7198 | 7367 | boundary.y = spot.y - 30; |
---|
7199 | 7368 | boundary.width = spot.width + 60; |
---|
7200 | 7369 | boundary.height = spot.height + 60; |
---|
7201 | | - info.g.setColor(Color.red); |
---|
| 7370 | + clickInfo.g.setColor(Color.red); |
---|
7202 | 7371 | int spotw = spot.x + spot.width; |
---|
7203 | 7372 | int spoth = spot.y + spot.height; |
---|
7204 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7373 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7205 | 7374 | // if (CameraPane.Xmin > spot.x) |
---|
7206 | 7375 | // { |
---|
7207 | 7376 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7221 | 7390 | spot.translate(32, 32); |
---|
7222 | 7391 | spotw = spot.x + spot.width; |
---|
7223 | 7392 | spoth = spot.y + spot.height; |
---|
7224 | | - info.g.setColor(Color.cyan); |
---|
7225 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7393 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7394 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7226 | 7395 | // if (CameraPane.Xmin > spot.x) |
---|
7227 | 7396 | // { |
---|
7228 | 7397 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7242 | 7411 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7243 | 7412 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7244 | 7413 | 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); |
---|
| 7414 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7415 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7416 | + clickInfo.g.setColor(Color.green); |
---|
7248 | 7417 | // if (CameraPane.Xmin > spot.x) |
---|
7249 | 7418 | // { |
---|
7250 | 7419 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7261 | 7430 | // { |
---|
7262 | 7431 | // CameraPane.Ymax = spoth; |
---|
7263 | 7432 | // } |
---|
7264 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7265 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7433 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7434 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7266 | 7435 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7267 | 7436 | // if (CameraPane.Xmin > boundary.x) |
---|
7268 | 7437 | // { |
---|
.. | .. |
---|
7284 | 7453 | } |
---|
7285 | 7454 | } |
---|
7286 | 7455 | |
---|
7287 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7456 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7457 | + int level) |
---|
7288 | 7458 | { |
---|
7289 | 7459 | if (level == 0) |
---|
7290 | 7460 | { |
---|
.. | .. |
---|
7293 | 7463 | |
---|
7294 | 7464 | boolean retval = false; |
---|
7295 | 7465 | |
---|
7296 | | - startX = info.x; |
---|
7297 | | - startY = info.y; |
---|
| 7466 | + startX = clickInfo.x; |
---|
| 7467 | + startY = clickInfo.y; |
---|
7298 | 7468 | |
---|
7299 | 7469 | hitSomething = -1; |
---|
7300 | 7470 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7304 | 7474 | { |
---|
7305 | 7475 | centerPt = new Point(0, 0); |
---|
7306 | 7476 | } |
---|
7307 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7308 | | - if (spot.contains(info.x, info.y)) |
---|
| 7477 | + calcHotSpot(origin, //info, |
---|
| 7478 | + centerPt, spot); |
---|
| 7479 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7309 | 7480 | { |
---|
7310 | 7481 | hitSomething = hitCenter; |
---|
7311 | 7482 | retval = true; |
---|
7312 | 7483 | } |
---|
7313 | 7484 | spot.translate(32, 0); |
---|
7314 | | - if (spot.contains(info.x, info.y)) |
---|
| 7485 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7315 | 7486 | { |
---|
7316 | 7487 | hitSomething = hitRotate; |
---|
7317 | 7488 | retval = true; |
---|
7318 | 7489 | } |
---|
7319 | 7490 | spot.translate(0, 32); |
---|
7320 | | - if (spot.contains(info.x, info.y)) |
---|
| 7491 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7321 | 7492 | { |
---|
7322 | 7493 | hitSomething = hitScale; |
---|
| 7494 | + |
---|
| 7495 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7496 | + double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
| 7497 | + double sign = 1; |
---|
| 7498 | + if (hScale < 0) |
---|
| 7499 | + { |
---|
| 7500 | + sign = -1; |
---|
| 7501 | + } |
---|
| 7502 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7503 | + if (hScale < 0.01) |
---|
| 7504 | + { |
---|
| 7505 | + //hScale = 0.01; |
---|
| 7506 | + } |
---|
| 7507 | + |
---|
| 7508 | + double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
| 7509 | + sign = 1; |
---|
| 7510 | + if (vScale < 0) |
---|
| 7511 | + { |
---|
| 7512 | + sign = -1; |
---|
| 7513 | + } |
---|
| 7514 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7515 | + if (vScale < 0.01) |
---|
| 7516 | + { |
---|
| 7517 | + //vScale = 0.01; |
---|
| 7518 | + } |
---|
| 7519 | + |
---|
| 7520 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7521 | + |
---|
7323 | 7522 | retval = true; |
---|
7324 | 7523 | } |
---|
7325 | 7524 | |
---|
.. | .. |
---|
7329 | 7528 | } |
---|
7330 | 7529 | |
---|
7331 | 7530 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7332 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7531 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7333 | 7532 | //System.out.println("modified = " + modified); |
---|
7334 | 7533 | //new Exception().printStackTrace(); |
---|
7335 | 7534 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7357 | 7556 | return true; |
---|
7358 | 7557 | } |
---|
7359 | 7558 | |
---|
7360 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7559 | + void doEditDrag0(//ClickInfo info, |
---|
| 7560 | + boolean opposite) |
---|
7361 | 7561 | { |
---|
7362 | 7562 | if (hitSomething == 0) |
---|
7363 | 7563 | { |
---|
.. | .. |
---|
7371 | 7571 | |
---|
7372 | 7572 | //System.out.println("hitSomething = " + hitSomething); |
---|
7373 | 7573 | |
---|
7374 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7574 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7375 | 7575 | |
---|
7376 | 7576 | cVector xlate = new cVector(); |
---|
7377 | 7577 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7405 | 7605 | toParent[3][i] = xlate.get(i); |
---|
7406 | 7606 | LA.matInvert(toParent, fromParent); |
---|
7407 | 7607 | */ |
---|
7408 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7409 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7608 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7609 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7410 | 7610 | |
---|
7411 | 7611 | LA.matCopy(startMat, toParent); |
---|
7412 | 7612 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7415 | 7615 | } else |
---|
7416 | 7616 | { |
---|
7417 | 7617 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7418 | | - cVector up = new cVector(info.camera.up); |
---|
| 7618 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7419 | 7619 | cVector away = new cVector(); |
---|
7420 | 7620 | //cVector right2 = new cVector(); |
---|
7421 | 7621 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7432 | 7632 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7433 | 7633 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7434 | 7634 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7435 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7635 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7436 | 7636 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7437 | 7637 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7438 | 7638 | //LA.vecCross(up, cVector.Z, right2); |
---|
7439 | 7639 | |
---|
7440 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7640 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7441 | 7641 | |
---|
7442 | 7642 | //System.out.println("DELTA0 = " + delta); |
---|
7443 | 7643 | //System.out.println("AWAY = " + info.camera.away); |
---|
7444 | 7644 | //System.out.println("UP = " + info.camera.up); |
---|
7445 | 7645 | if (away.z > 0) |
---|
7446 | 7646 | { |
---|
7447 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7647 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7448 | 7648 | { |
---|
7449 | 7649 | delta.x = -delta.x; |
---|
7450 | 7650 | } else |
---|
.. | .. |
---|
7459 | 7659 | //System.out.println("DELTA1 = " + delta); |
---|
7460 | 7660 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7461 | 7661 | //System.out.println("DELTA2 = " + delta); |
---|
7462 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7662 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7463 | 7663 | LA.matCopy(startMat, toParent); |
---|
7464 | 7664 | //System.out.println("DELTA3 = " + delta); |
---|
7465 | 7665 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7469 | 7669 | break; |
---|
7470 | 7670 | |
---|
7471 | 7671 | case hitRotate: // rotate |
---|
7472 | | - int dx = info.x - centerPt.x; |
---|
7473 | | - int dy = -(info.y - centerPt.y); |
---|
| 7672 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7673 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7474 | 7674 | double angle = (double) Math.atan2(dx, dy); |
---|
7475 | 7675 | angle = -(1.570796 - angle); |
---|
7476 | 7676 | |
---|
.. | .. |
---|
7493 | 7693 | } |
---|
7494 | 7694 | /**/ |
---|
7495 | 7695 | |
---|
7496 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7696 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7497 | 7697 | { |
---|
7498 | 7698 | case 1: // '\001' |
---|
7499 | 7699 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7520 | 7720 | break; |
---|
7521 | 7721 | |
---|
7522 | 7722 | case hitScale: // scale |
---|
7523 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7723 | + double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
7524 | 7724 | double sign = 1; |
---|
7525 | 7725 | if (hScale < 0) |
---|
7526 | 7726 | { |
---|
.. | .. |
---|
7532 | 7732 | //hScale = 0.01; |
---|
7533 | 7733 | } |
---|
7534 | 7734 | |
---|
7535 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7735 | + double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
7536 | 7736 | sign = 1; |
---|
7537 | 7737 | if (vScale < 0) |
---|
7538 | 7738 | { |
---|
.. | .. |
---|
7543 | 7743 | { |
---|
7544 | 7744 | //vScale = 0.01; |
---|
7545 | 7745 | } |
---|
| 7746 | + |
---|
7546 | 7747 | LA.matCopy(startMat, toParent); |
---|
7547 | 7748 | /**/ |
---|
7548 | 7749 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7552 | 7753 | } |
---|
7553 | 7754 | /**/ |
---|
7554 | 7755 | |
---|
7555 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7756 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7556 | 7757 | |
---|
7557 | 7758 | if (totalScale < 0.01) |
---|
7558 | 7759 | { |
---|
7559 | 7760 | totalScale = 0.01; |
---|
7560 | 7761 | } |
---|
7561 | 7762 | |
---|
7562 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7763 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7563 | 7764 | { |
---|
7564 | 7765 | case 3: // '\001' |
---|
7565 | 7766 | if (modified || opposite) |
---|
.. | .. |
---|
7626 | 7827 | } // NEW ... |
---|
7627 | 7828 | |
---|
7628 | 7829 | |
---|
7629 | | - info.pane.repaint(); |
---|
| 7830 | + clickInfo.pane.repaint(); |
---|
7630 | 7831 | } |
---|
7631 | 7832 | |
---|
7632 | 7833 | boolean overflow = false; |
---|
.. | .. |
---|
7967 | 8168 | } |
---|
7968 | 8169 | |
---|
7969 | 8170 | transient ObjEditor editWindow; |
---|
| 8171 | + transient ObjEditor manipWindow; |
---|
| 8172 | + |
---|
| 8173 | + transient boolean pinned; |
---|
| 8174 | + |
---|
7970 | 8175 | transient ObjectUI objectUI; |
---|
7971 | 8176 | public static int povDepth = 0; |
---|
7972 | 8177 | private static cVector tbMin = new cVector(); |
---|