.. | .. |
---|
24 | 24 | |
---|
25 | 25 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 26 | |
---|
| 27 | + // TEMPORARY for mocap undo. No need to be transient. |
---|
| 28 | + mocap.reader.BVHReader.BVHResult savebvh; |
---|
| 29 | + Object3D saveskeleton; |
---|
| 30 | + // |
---|
| 31 | + |
---|
| 32 | + byte[] versions[]; |
---|
| 33 | + int versionindex = -1; |
---|
| 34 | + |
---|
27 | 35 | ScriptNode scriptnode; |
---|
28 | 36 | |
---|
29 | 37 | void InitOthers() |
---|
.. | .. |
---|
104 | 112 | |
---|
105 | 113 | // transient boolean reduced; // for morph reduction |
---|
106 | 114 | |
---|
107 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
108 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 115 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 116 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
109 | 117 | |
---|
110 | | -transient Object3D transientsupport; // for cloning |
---|
111 | | -transient boolean transientlink2master; |
---|
| 118 | + transient Object3D transientsupport; // for cloning |
---|
| 119 | + transient boolean transientlink2master; |
---|
112 | 120 | |
---|
113 | | -void SaveSupports() |
---|
114 | | -{ |
---|
115 | | - if (blockloop) |
---|
116 | | - return; |
---|
117 | | - |
---|
118 | | - transientsupport = support; |
---|
119 | | - transientlink2master = link2master; |
---|
120 | | - |
---|
121 | | - support = null; |
---|
122 | | - link2master = false; |
---|
123 | | - |
---|
124 | | - if (bRep != null) |
---|
| 121 | + void SaveSupports() |
---|
125 | 122 | { |
---|
126 | | - bRep.SaveSupports(); |
---|
| 123 | + if (blockloop) |
---|
| 124 | + return; |
---|
| 125 | + |
---|
| 126 | + transientsupport = support; |
---|
| 127 | + transientlink2master = link2master; |
---|
| 128 | + |
---|
| 129 | + support = null; |
---|
| 130 | + link2master = false; |
---|
| 131 | + |
---|
| 132 | + if (bRep != null) |
---|
| 133 | + { |
---|
| 134 | + bRep.SaveSupports(); |
---|
| 135 | + } |
---|
| 136 | + |
---|
| 137 | + for (int i = 0; i < Size(); i++) |
---|
| 138 | + { |
---|
| 139 | + Object3D child = (Object3D) get(i); |
---|
| 140 | + if (child == null) |
---|
| 141 | + continue; |
---|
| 142 | + blockloop = true; |
---|
| 143 | + child.SaveSupports(); |
---|
| 144 | + blockloop = false; |
---|
| 145 | + } |
---|
127 | 146 | } |
---|
128 | | - |
---|
129 | | - for (int i = 0; i < Size(); i++) |
---|
| 147 | + |
---|
| 148 | + void RestoreSupports() |
---|
130 | 149 | { |
---|
131 | | - Object3D child = (Object3D) get(i); |
---|
132 | | - if (child == null) |
---|
133 | | - continue; |
---|
| 150 | + if (blockloop) |
---|
| 151 | + return; |
---|
| 152 | + |
---|
| 153 | + support = transientsupport; |
---|
| 154 | + link2master = transientlink2master; |
---|
| 155 | + transientsupport = null; |
---|
| 156 | + transientlink2master = false; |
---|
| 157 | + |
---|
| 158 | + if (bRep != null) |
---|
| 159 | + { |
---|
| 160 | + bRep.RestoreSupports(); |
---|
| 161 | + } |
---|
| 162 | + |
---|
| 163 | + for (int i = 0; i < Size(); i++) |
---|
| 164 | + { |
---|
| 165 | + Object3D child = (Object3D) get(i); |
---|
| 166 | + if (child == null) |
---|
| 167 | + continue; |
---|
| 168 | + blockloop = true; |
---|
| 169 | + child.RestoreSupports(); |
---|
| 170 | + blockloop = false; |
---|
| 171 | + } |
---|
| 172 | + } |
---|
| 173 | + |
---|
| 174 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 175 | + { |
---|
| 176 | + Object3D o; |
---|
| 177 | + |
---|
| 178 | + if (hashtable.containsKey(GetUUID())) |
---|
| 179 | + { |
---|
| 180 | + o = hashtable.get(GetUUID()); |
---|
| 181 | + |
---|
| 182 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 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); |
---|
| 191 | + |
---|
| 192 | + hashtable.put(GetUUID(), o); |
---|
| 193 | + } |
---|
| 194 | + |
---|
| 195 | + if (!blockloop) |
---|
| 196 | + { |
---|
| 197 | + blockloop = true; |
---|
| 198 | + |
---|
| 199 | + for (int i=0; i<Size(); i++) |
---|
| 200 | + { |
---|
| 201 | + get(i).ExtractBigData(hashtable); |
---|
| 202 | + } |
---|
| 203 | + |
---|
| 204 | + blockloop = false; |
---|
| 205 | + } |
---|
| 206 | + |
---|
| 207 | + ExtractBigData(o); |
---|
| 208 | + } |
---|
| 209 | + |
---|
| 210 | + void ExtractBigData(Object3D o) |
---|
| 211 | + { |
---|
| 212 | + if (o.bRep != null) |
---|
| 213 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 214 | + |
---|
| 215 | + o.bRep = this.bRep; |
---|
| 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) |
---|
| 226 | + { |
---|
| 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; |
---|
| 232 | + } |
---|
| 233 | + |
---|
| 234 | + // o.support = this.support; |
---|
| 235 | + // o.fileparent = this.fileparent; |
---|
| 236 | + // if (this.bRep != null) |
---|
| 237 | + // o.bRep = this.bRep.support; |
---|
| 238 | + |
---|
| 239 | + this.bRep = null; |
---|
| 240 | + // if (this.bRep != null) |
---|
| 241 | + // this.bRep.support = null; |
---|
| 242 | + // this.support = null; |
---|
| 243 | + // this.fileparent = null; |
---|
| 244 | + } |
---|
| 245 | + |
---|
| 246 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 247 | + { |
---|
| 248 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 249 | + return; |
---|
| 250 | + |
---|
| 251 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 252 | + |
---|
| 253 | + RestoreBigData(o); |
---|
| 254 | + |
---|
| 255 | + if (blockloop) |
---|
| 256 | + return; |
---|
| 257 | + |
---|
134 | 258 | blockloop = true; |
---|
135 | | - child.SaveSupports(); |
---|
| 259 | + |
---|
| 260 | + //hashtable.remove(GetUUID()); |
---|
| 261 | + |
---|
| 262 | + for (int i=0; i<Size(); i++) |
---|
| 263 | + { |
---|
| 264 | + get(i).RestoreBigData(hashtable); |
---|
| 265 | + } |
---|
| 266 | + |
---|
136 | 267 | blockloop = false; |
---|
137 | 268 | } |
---|
138 | | -} |
---|
139 | 269 | |
---|
140 | | -void RestoreSupports() |
---|
141 | | -{ |
---|
142 | | - if (blockloop) |
---|
143 | | - return; |
---|
144 | | - |
---|
145 | | - support = transientsupport; |
---|
146 | | - link2master = transientlink2master; |
---|
147 | | - transientsupport = null; |
---|
148 | | - transientlink2master = false; |
---|
149 | | - |
---|
150 | | - if (bRep != null) |
---|
| 270 | + void RestoreBigData(Object3D o) |
---|
151 | 271 | { |
---|
152 | | - bRep.RestoreSupports(); |
---|
| 272 | + this.bRep = o.bRep; |
---|
| 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; |
---|
| 284 | + // this.support = o.support; |
---|
| 285 | + // this.fileparent = o.fileparent; |
---|
153 | 286 | } |
---|
154 | | - |
---|
155 | | - for (int i = 0; i < Size(); i++) |
---|
156 | | - { |
---|
157 | | - Object3D child = (Object3D) get(i); |
---|
158 | | - if (child == null) |
---|
159 | | - continue; |
---|
160 | | - blockloop = true; |
---|
161 | | - child.RestoreSupports(); |
---|
162 | | - blockloop = false; |
---|
163 | | - } |
---|
164 | | -} |
---|
165 | 287 | |
---|
166 | 288 | // MOCAP SUPPORT |
---|
167 | 289 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
304 | 426 | } |
---|
305 | 427 | |
---|
306 | 428 | boolean live = false; |
---|
| 429 | + transient boolean keepdontselect; |
---|
307 | 430 | boolean dontselect = false; |
---|
308 | 431 | boolean hide = false; |
---|
309 | 432 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
486 | 609 | toParent = LA.newMatrix(); |
---|
487 | 610 | fromParent = LA.newMatrix(); |
---|
488 | 611 | } |
---|
| 612 | + |
---|
489 | 613 | if (toParentMarked == null) |
---|
490 | 614 | { |
---|
491 | 615 | if (maxcount != 1) |
---|
492 | 616 | { |
---|
493 | 617 | new Exception().printStackTrace(); |
---|
494 | 618 | } |
---|
| 619 | + |
---|
495 | 620 | toParentMarked = LA.newMatrix(); |
---|
496 | 621 | fromParentMarked = LA.newMatrix(); |
---|
497 | 622 | } |
---|
.. | .. |
---|
802 | 927 | |
---|
803 | 928 | if (marked && Globals.isLIVE() && live && |
---|
804 | 929 | //TEMP21aug2018 |
---|
805 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 930 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
806 | 931 | currentframe != Globals.framecount) |
---|
807 | 932 | { |
---|
808 | 933 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
814 | 939 | |
---|
815 | 940 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
816 | 941 | |
---|
817 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 942 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 943 | + (step == 1 && changedir)) |
---|
818 | 944 | { |
---|
819 | 945 | countdown = 1; |
---|
820 | 946 | delay = speedup?8:1; |
---|
.. | .. |
---|
886 | 1012 | if (material == null || material.multiply) |
---|
887 | 1013 | return true; |
---|
888 | 1014 | |
---|
| 1015 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
889 | 1016 | return material.opacity > 0.99; |
---|
890 | 1017 | } |
---|
891 | 1018 | |
---|
.. | .. |
---|
1286 | 1413 | toParent = LA.newMatrix(); |
---|
1287 | 1414 | fromParent = LA.newMatrix(); |
---|
1288 | 1415 | } |
---|
| 1416 | + |
---|
1289 | 1417 | LA.matCopy(other.toParent, toParent); |
---|
1290 | 1418 | LA.matCopy(other.fromParent, fromParent); |
---|
1291 | 1419 | |
---|
.. | .. |
---|
2307 | 2435 | } |
---|
2308 | 2436 | */ |
---|
2309 | 2437 | } |
---|
| 2438 | + else |
---|
| 2439 | + { |
---|
| 2440 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2441 | + } |
---|
2310 | 2442 | } |
---|
2311 | 2443 | |
---|
2312 | 2444 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2348 | 2480 | { |
---|
2349 | 2481 | editWindow.refreshContents(); |
---|
2350 | 2482 | } |
---|
| 2483 | + else |
---|
| 2484 | + { |
---|
| 2485 | + if (manipWindow != null) |
---|
| 2486 | + { |
---|
| 2487 | + manipWindow.refreshContents(); |
---|
| 2488 | + } |
---|
| 2489 | + } |
---|
| 2490 | + |
---|
2351 | 2491 | //if (parent != null) |
---|
2352 | 2492 | //parent.refreshEditWindow(); |
---|
2353 | 2493 | } |
---|
.. | .. |
---|
2632 | 2772 | //Touch(); |
---|
2633 | 2773 | } |
---|
2634 | 2774 | |
---|
| 2775 | + void GenNormalsMeshS() |
---|
| 2776 | + { |
---|
| 2777 | + selection.GenNormalsMesh(); |
---|
| 2778 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2779 | +// { |
---|
| 2780 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2781 | +// selectee.GenNormals(crease); |
---|
| 2782 | +// } |
---|
| 2783 | + |
---|
| 2784 | + //Touch(); |
---|
| 2785 | + } |
---|
| 2786 | + |
---|
2635 | 2787 | void ClearColorsS() |
---|
2636 | 2788 | { |
---|
2637 | 2789 | selection.ClearColors(); |
---|
.. | .. |
---|
2763 | 2915 | if (child == null) |
---|
2764 | 2916 | continue; |
---|
2765 | 2917 | child.GenNormals(crease); |
---|
| 2918 | +// Children().release(i); |
---|
| 2919 | + } |
---|
| 2920 | + blockloop = false; |
---|
| 2921 | + } |
---|
| 2922 | + |
---|
| 2923 | + void GenNormalsMesh() |
---|
| 2924 | + { |
---|
| 2925 | + if (blockloop) |
---|
| 2926 | + return; |
---|
| 2927 | + |
---|
| 2928 | + blockloop = true; |
---|
| 2929 | + GenNormalsMesh0(); |
---|
| 2930 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2931 | + { |
---|
| 2932 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2933 | + if (child == null) |
---|
| 2934 | + continue; |
---|
| 2935 | + child.GenNormalsMesh(); |
---|
2766 | 2936 | // Children().release(i); |
---|
2767 | 2937 | } |
---|
2768 | 2938 | blockloop = false; |
---|
.. | .. |
---|
2935 | 3105 | } |
---|
2936 | 3106 | } |
---|
2937 | 3107 | |
---|
| 3108 | + void GenNormalsMesh0() |
---|
| 3109 | + { |
---|
| 3110 | + if (bRep != null) |
---|
| 3111 | + { |
---|
| 3112 | + bRep.GenerateNormalsMesh(); |
---|
| 3113 | + Touch(); |
---|
| 3114 | + } |
---|
| 3115 | + } |
---|
| 3116 | + |
---|
2938 | 3117 | void GenNormalsMINE0() |
---|
2939 | 3118 | { |
---|
2940 | 3119 | if (bRep != null) |
---|
2941 | 3120 | { |
---|
2942 | | - bRep.GenerateNormalsMINE(); |
---|
| 3121 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
2943 | 3122 | Touch(); |
---|
2944 | 3123 | } |
---|
2945 | 3124 | } |
---|
.. | .. |
---|
3385 | 3564 | if (blockloop) |
---|
3386 | 3565 | return; |
---|
3387 | 3566 | |
---|
3388 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3567 | + if (//marked || // does not make sense |
---|
| 3568 | + (bRep != null || material != null)) // borderline... |
---|
3389 | 3569 | live = h; |
---|
3390 | 3570 | |
---|
3391 | 3571 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3406 | 3586 | return; |
---|
3407 | 3587 | |
---|
3408 | 3588 | //if (bRep != null) |
---|
3409 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3589 | + if (//marked || // does not make sense |
---|
| 3590 | + (bRep != null || material != null)) // borderline... |
---|
3410 | 3591 | link2master = h; |
---|
3411 | 3592 | |
---|
3412 | 3593 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3426 | 3607 | if (blockloop) |
---|
3427 | 3608 | return; |
---|
3428 | 3609 | |
---|
3429 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3610 | + if (//marked || // does not make sense |
---|
| 3611 | + (bRep != null || material != null)) // borderline... |
---|
3430 | 3612 | hide = h; |
---|
3431 | 3613 | |
---|
3432 | 3614 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3446 | 3628 | if (blockloop) |
---|
3447 | 3629 | return; |
---|
3448 | 3630 | |
---|
3449 | | - if (bRep != null && material != null) // borderline... |
---|
| 3631 | + if (bRep != null || material != null) // borderline... |
---|
3450 | 3632 | marked = h; |
---|
3451 | 3633 | |
---|
3452 | 3634 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3456 | 3638 | continue; |
---|
3457 | 3639 | blockloop = true; |
---|
3458 | 3640 | child.MarkLeaves(h); |
---|
| 3641 | + blockloop = false; |
---|
| 3642 | + // release(i); |
---|
| 3643 | + } |
---|
| 3644 | + } |
---|
| 3645 | + |
---|
| 3646 | + void RewindLeaves(boolean h) |
---|
| 3647 | + { |
---|
| 3648 | + if (blockloop) |
---|
| 3649 | + return; |
---|
| 3650 | + |
---|
| 3651 | + if (bRep != null || material != null) // borderline... |
---|
| 3652 | + rewind = h; |
---|
| 3653 | + |
---|
| 3654 | + for (int i = 0; i < Size(); i++) |
---|
| 3655 | + { |
---|
| 3656 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3657 | + if (child == null) |
---|
| 3658 | + continue; |
---|
| 3659 | + blockloop = true; |
---|
| 3660 | + child.RewindLeaves(h); |
---|
| 3661 | + blockloop = false; |
---|
| 3662 | + // release(i); |
---|
| 3663 | + } |
---|
| 3664 | + } |
---|
| 3665 | + |
---|
| 3666 | + void RandomLeaves(boolean h) |
---|
| 3667 | + { |
---|
| 3668 | + if (blockloop) |
---|
| 3669 | + return; |
---|
| 3670 | + |
---|
| 3671 | + if (bRep != null || material != null) // borderline... |
---|
| 3672 | + random = h; |
---|
| 3673 | + |
---|
| 3674 | + for (int i = 0; i < Size(); i++) |
---|
| 3675 | + { |
---|
| 3676 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3677 | + if (child == null) |
---|
| 3678 | + continue; |
---|
| 3679 | + blockloop = true; |
---|
| 3680 | + child.RandomLeaves(h); |
---|
3459 | 3681 | blockloop = false; |
---|
3460 | 3682 | // release(i); |
---|
3461 | 3683 | } |
---|
.. | .. |
---|
4233 | 4455 | } |
---|
4234 | 4456 | } |
---|
4235 | 4457 | |
---|
| 4458 | + void RepairSOV() |
---|
| 4459 | + { |
---|
| 4460 | + if (blockloop) |
---|
| 4461 | + return; |
---|
| 4462 | + |
---|
| 4463 | + String texname = this.GetPigmentTexture(); |
---|
| 4464 | + |
---|
| 4465 | + if (texname.startsWith("sov")) |
---|
| 4466 | + { |
---|
| 4467 | + String[] s = texname.split("/"); |
---|
| 4468 | + |
---|
| 4469 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4470 | + |
---|
| 4471 | + texname = sname[0]; |
---|
| 4472 | + |
---|
| 4473 | + if (sname.length > 1) |
---|
| 4474 | + { |
---|
| 4475 | + texname += "Color.jpg"; |
---|
| 4476 | + } |
---|
| 4477 | + |
---|
| 4478 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4479 | + } |
---|
| 4480 | + |
---|
| 4481 | + texname = this.GetBumpTexture(); |
---|
| 4482 | + |
---|
| 4483 | + if (texname.startsWith("sov")) |
---|
| 4484 | + { |
---|
| 4485 | + String[] s = texname.split("/"); |
---|
| 4486 | + |
---|
| 4487 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4488 | + |
---|
| 4489 | + texname = sname[0]; |
---|
| 4490 | + |
---|
| 4491 | + if (sname.length > 1) |
---|
| 4492 | + { |
---|
| 4493 | + texname += "Bump.jpg"; |
---|
| 4494 | + } |
---|
| 4495 | + |
---|
| 4496 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4497 | + } |
---|
| 4498 | + |
---|
| 4499 | + for (int i=0; i<Size(); i++) |
---|
| 4500 | + { |
---|
| 4501 | + blockloop = true; |
---|
| 4502 | + get(i).RepairSOV(); |
---|
| 4503 | + blockloop = false; |
---|
| 4504 | + } |
---|
| 4505 | + } |
---|
| 4506 | + |
---|
4236 | 4507 | void RepairTexture() |
---|
4237 | 4508 | { |
---|
4238 | 4509 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4747 | 5018 | } |
---|
4748 | 5019 | } |
---|
4749 | 5020 | |
---|
| 5021 | + ObjEditor GetWindow() |
---|
| 5022 | + { |
---|
| 5023 | + if (editWindow != null) |
---|
| 5024 | + return editWindow; |
---|
| 5025 | + |
---|
| 5026 | + return manipWindow; |
---|
| 5027 | + } |
---|
| 5028 | + |
---|
4750 | 5029 | cTreePath Select(int indexcount, boolean deselect) |
---|
4751 | 5030 | { |
---|
4752 | 5031 | if (hide || dontselect) |
---|
.. | .. |
---|
4783 | 5062 | if (leaf != null) |
---|
4784 | 5063 | { |
---|
4785 | 5064 | cTreePath tp = new cTreePath(this, leaf); |
---|
4786 | | - if (editWindow != null) |
---|
| 5065 | + ObjEditor window = GetWindow(); |
---|
| 5066 | + if (window != null) |
---|
4787 | 5067 | { |
---|
4788 | 5068 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4789 | | - editWindow.Select(tp, deselect, true); |
---|
| 5069 | + window.Select(tp, deselect, true); |
---|
4790 | 5070 | } |
---|
4791 | 5071 | |
---|
4792 | 5072 | return tp; |
---|
.. | .. |
---|
4803 | 5083 | |
---|
4804 | 5084 | if (child == null) |
---|
4805 | 5085 | continue; |
---|
| 5086 | + |
---|
4806 | 5087 | if (child.HasTransparency() && child.size() != 0) |
---|
4807 | 5088 | { |
---|
4808 | 5089 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4812 | 5093 | if (leaf != null) |
---|
4813 | 5094 | { |
---|
4814 | 5095 | cTreePath tp = new cTreePath(this, leaf); |
---|
4815 | | - if (editWindow != null) |
---|
| 5096 | + ObjEditor window = GetWindow(); |
---|
| 5097 | + if (window != null) |
---|
4816 | 5098 | { |
---|
4817 | | - editWindow.Select(tp, deselect, true); |
---|
| 5099 | + window.Select(tp, deselect, true); |
---|
4818 | 5100 | } |
---|
4819 | 5101 | |
---|
4820 | 5102 | return tp; |
---|
.. | .. |
---|
5139 | 5421 | blockloop = false; |
---|
5140 | 5422 | } |
---|
5141 | 5423 | |
---|
| 5424 | + void ResetSelectable() |
---|
| 5425 | + { |
---|
| 5426 | + if (blockloop) |
---|
| 5427 | + return; |
---|
| 5428 | + |
---|
| 5429 | + blockloop = true; |
---|
| 5430 | + |
---|
| 5431 | + keepdontselect = dontselect; |
---|
| 5432 | + dontselect = true; |
---|
| 5433 | + |
---|
| 5434 | + Object3D child; |
---|
| 5435 | + int nb = Size(); |
---|
| 5436 | + for (int i = 0; i < nb; i++) |
---|
| 5437 | + { |
---|
| 5438 | + child = (Object3D) get(i); |
---|
| 5439 | + if (child == null) |
---|
| 5440 | + continue; |
---|
| 5441 | + child.ResetSelectable(); |
---|
| 5442 | + } |
---|
| 5443 | + |
---|
| 5444 | + blockloop = false; |
---|
| 5445 | + } |
---|
| 5446 | + |
---|
| 5447 | + void RestoreSelectable() |
---|
| 5448 | + { |
---|
| 5449 | + if (blockloop) |
---|
| 5450 | + return; |
---|
| 5451 | + |
---|
| 5452 | + blockloop = true; |
---|
| 5453 | + |
---|
| 5454 | + dontselect = keepdontselect; |
---|
| 5455 | + |
---|
| 5456 | + Object3D child; |
---|
| 5457 | + int nb = Size(); |
---|
| 5458 | + for (int i = 0; i < nb; i++) |
---|
| 5459 | + { |
---|
| 5460 | + child = (Object3D) get(i); |
---|
| 5461 | + if (child == null) |
---|
| 5462 | + continue; |
---|
| 5463 | + child.RestoreSelectable(); |
---|
| 5464 | + } |
---|
| 5465 | + |
---|
| 5466 | + blockloop = false; |
---|
| 5467 | + } |
---|
| 5468 | + |
---|
5142 | 5469 | boolean IsSelected() |
---|
5143 | 5470 | { |
---|
5144 | 5471 | if (parent == null) |
---|
.. | .. |
---|
5448 | 5775 | } |
---|
5449 | 5776 | } |
---|
5450 | 5777 | |
---|
| 5778 | + void EmbedTextures(boolean embed) |
---|
| 5779 | + { |
---|
| 5780 | + if (blockloop) |
---|
| 5781 | + return; |
---|
| 5782 | + |
---|
| 5783 | + //if (GetTextures() != null) |
---|
| 5784 | + if (embed) |
---|
| 5785 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 5786 | + else |
---|
| 5787 | + { |
---|
| 5788 | + GetTextures().pigmentdata = null; |
---|
| 5789 | + GetTextures().bumpdata = null; |
---|
| 5790 | + GetTextures().pw = 0; |
---|
| 5791 | + GetTextures().ph = 0; |
---|
| 5792 | + GetTextures().bw = 0; |
---|
| 5793 | + GetTextures().bh = 0; |
---|
| 5794 | + } |
---|
| 5795 | + |
---|
| 5796 | + int nb = Size(); |
---|
| 5797 | + for (int i = 0; i < nb; i++) |
---|
| 5798 | + { |
---|
| 5799 | + Object3D child = (Object3D) get(i); |
---|
| 5800 | + |
---|
| 5801 | + if (child == null) |
---|
| 5802 | + continue; |
---|
| 5803 | + |
---|
| 5804 | + blockloop = true; |
---|
| 5805 | + child.EmbedTextures(embed); |
---|
| 5806 | + blockloop = false; |
---|
| 5807 | + } |
---|
| 5808 | + } |
---|
| 5809 | + |
---|
5451 | 5810 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5452 | 5811 | { |
---|
5453 | 5812 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5456 | 5815 | boolean NeedSupport() |
---|
5457 | 5816 | { |
---|
5458 | 5817 | return |
---|
5459 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 5818 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5460 | 5819 | // PROBLEM with CROWD!! |
---|
5461 | 5820 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5462 | 5821 | } |
---|
5463 | 5822 | |
---|
5464 | 5823 | static boolean DEBUG_SELECTION = false; |
---|
| 5824 | + |
---|
| 5825 | + boolean IsLive() |
---|
| 5826 | + { |
---|
| 5827 | + if (live) |
---|
| 5828 | + return true; |
---|
| 5829 | + |
---|
| 5830 | + if (parent == null) |
---|
| 5831 | + return false; |
---|
| 5832 | + |
---|
| 5833 | + return parent.IsLive(); |
---|
| 5834 | + } |
---|
5465 | 5835 | |
---|
5466 | 5836 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5467 | 5837 | { |
---|
.. | .. |
---|
5524 | 5894 | support = support; |
---|
5525 | 5895 | |
---|
5526 | 5896 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5527 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5897 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5528 | 5898 | |
---|
5529 | 5899 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5530 | 5900 | { |
---|
.. | .. |
---|
5544 | 5914 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5545 | 5915 | |
---|
5546 | 5916 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5547 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5917 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5918 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5548 | 5919 | { |
---|
5549 | 5920 | Globals.lighttouched = true; |
---|
5550 | 5921 | } // all panes... |
---|
| 5922 | + |
---|
5551 | 5923 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5552 | 5924 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5553 | 5925 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5675 | 6047 | if (GetBRep() != null) |
---|
5676 | 6048 | { |
---|
5677 | 6049 | display.NextIndex(); |
---|
| 6050 | + |
---|
5678 | 6051 | // vertex color conflict : gl.glCallList(list); |
---|
5679 | 6052 | DrawNode(display, root, selected); |
---|
5680 | 6053 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5715 | 6088 | tex = GetTextures(); |
---|
5716 | 6089 | } |
---|
5717 | 6090 | |
---|
5718 | | - boolean failed = false; |
---|
| 6091 | + boolean failedPigment = false; |
---|
| 6092 | + boolean failedBump = false; |
---|
5719 | 6093 | |
---|
5720 | 6094 | try |
---|
5721 | 6095 | { |
---|
5722 | | - display.BindTextures(tex, texres); |
---|
| 6096 | + display.BindPigmentTexture(tex, texres); |
---|
5723 | 6097 | } |
---|
5724 | 6098 | catch (Exception e) |
---|
5725 | 6099 | { |
---|
5726 | 6100 | System.err.println("FAILED: " + this); |
---|
5727 | | - failed = true; |
---|
| 6101 | + failedPigment = true; |
---|
| 6102 | + } |
---|
| 6103 | + |
---|
| 6104 | + try |
---|
| 6105 | + { |
---|
| 6106 | + display.BindBumpTexture(tex, texres); |
---|
| 6107 | + } |
---|
| 6108 | + catch (Exception e) |
---|
| 6109 | + { |
---|
| 6110 | + //System.err.println("FAILED: " + this); |
---|
| 6111 | + failedBump = true; |
---|
5728 | 6112 | } |
---|
5729 | 6113 | |
---|
5730 | 6114 | if (!compiled) |
---|
.. | .. |
---|
5747 | 6131 | } |
---|
5748 | 6132 | } |
---|
5749 | 6133 | |
---|
5750 | | - if (!failed) |
---|
5751 | | - display.ReleaseTextures(tex); |
---|
| 6134 | + if (!failedBump) |
---|
| 6135 | + display.ReleaseBumpTexture(tex); |
---|
| 6136 | + |
---|
| 6137 | + if (!failedPigment) |
---|
| 6138 | + display.ReleasePigmentTexture(tex); |
---|
5752 | 6139 | |
---|
5753 | 6140 | display.PopMaterial(this, selected); |
---|
5754 | 6141 | } |
---|
.. | .. |
---|
6121 | 6508 | // dec 2012 |
---|
6122 | 6509 | new Exception().printStackTrace(); |
---|
6123 | 6510 | return; |
---|
| 6511 | + } |
---|
| 6512 | + |
---|
| 6513 | + if (dontselect) |
---|
| 6514 | + { |
---|
| 6515 | + //bRep.GenerateNormalsMINE(); |
---|
6124 | 6516 | } |
---|
6125 | 6517 | |
---|
6126 | 6518 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6973 | 7365 | spot.translate(32, 32); |
---|
6974 | 7366 | spotw = spot.x + spot.width; |
---|
6975 | 7367 | spoth = spot.y + spot.height; |
---|
6976 | | - info.g.setColor(Color.blue); |
---|
| 7368 | + info.g.setColor(Color.cyan); |
---|
6977 | 7369 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6978 | 7370 | // if (CameraPane.Xmin > spot.x) |
---|
6979 | 7371 | // { |
---|
.. | .. |
---|
6991 | 7383 | // { |
---|
6992 | 7384 | // CameraPane.Ymax = spoth; |
---|
6993 | 7385 | // } |
---|
6994 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6995 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7386 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7387 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6996 | 7388 | spot.translate(0, -32); |
---|
6997 | | - info.g.setColor(Color.green); |
---|
| 7389 | + info.g.setColor(Color.yellow); |
---|
6998 | 7390 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7391 | + info.g.setColor(Color.green); |
---|
6999 | 7392 | // if (CameraPane.Xmin > spot.x) |
---|
7000 | 7393 | // { |
---|
7001 | 7394 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7012 | 7405 | // { |
---|
7013 | 7406 | // CameraPane.Ymax = spoth; |
---|
7014 | 7407 | // } |
---|
7015 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7016 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7408 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7409 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
7017 | 7410 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7018 | 7411 | // if (CameraPane.Xmin > boundary.x) |
---|
7019 | 7412 | // { |
---|
.. | .. |
---|
7313 | 7706 | switch (info.pane.RenderCamera().viewCode) |
---|
7314 | 7707 | { |
---|
7315 | 7708 | case 3: // '\001' |
---|
7316 | | - if (modified) |
---|
| 7709 | + if (modified || opposite) |
---|
7317 | 7710 | { |
---|
7318 | 7711 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7319 | 7712 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7320 | 7713 | } // vScale, 1); |
---|
7321 | 7714 | else |
---|
7322 | 7715 | { |
---|
| 7716 | + // EXCEPTION! |
---|
7323 | 7717 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7324 | 7718 | } // vScale, 1); |
---|
7325 | 7719 | break; |
---|
7326 | 7720 | |
---|
7327 | 7721 | case 2: // '\002' |
---|
7328 | | - if (modified) |
---|
| 7722 | + if (modified || opposite) |
---|
7329 | 7723 | { |
---|
7330 | 7724 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7331 | 7725 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7336 | 7730 | break; |
---|
7337 | 7731 | |
---|
7338 | 7732 | case 1: // '\003' |
---|
7339 | | - if (modified) |
---|
| 7733 | + if (modified || opposite) |
---|
7340 | 7734 | { |
---|
7341 | 7735 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7342 | 7736 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7556 | 7950 | editWindow = null; |
---|
7557 | 7951 | } // ? |
---|
7558 | 7952 | } |
---|
| 7953 | + else |
---|
| 7954 | + { |
---|
| 7955 | + //editWindow.closeUI(); |
---|
| 7956 | + } |
---|
7559 | 7957 | } |
---|
7560 | 7958 | |
---|
7561 | 7959 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7567 | 7965 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7568 | 7966 | |
---|
7569 | 7967 | Object3D /*Composite*/ parent; |
---|
7570 | | - Object3D /*Composite*/ fileparent; |
---|
| 7968 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7571 | 7969 | |
---|
7572 | 7970 | double[][] toParent; // dynamic matrix |
---|
7573 | 7971 | double[][] fromParent; |
---|
.. | .. |
---|
7713 | 8111 | } |
---|
7714 | 8112 | |
---|
7715 | 8113 | transient ObjEditor editWindow; |
---|
| 8114 | + transient ObjEditor manipWindow; |
---|
| 8115 | + |
---|
| 8116 | + transient boolean pinned; |
---|
| 8117 | + |
---|
7716 | 8118 | transient ObjectUI objectUI; |
---|
7717 | 8119 | public static int povDepth = 0; |
---|
7718 | 8120 | private static cVector tbMin = new cVector(); |
---|