.. | .. |
---|
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 | + |
---|
27 | 32 | ScriptNode scriptnode; |
---|
28 | 33 | |
---|
29 | 34 | void InitOthers() |
---|
.. | .. |
---|
104 | 109 | |
---|
105 | 110 | // transient boolean reduced; // for morph reduction |
---|
106 | 111 | |
---|
107 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
108 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 112 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 113 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
109 | 114 | |
---|
110 | | -transient Object3D transientsupport; // for cloning |
---|
111 | | -transient boolean transientlink2master; |
---|
| 115 | + transient Object3D transientsupport; // for cloning |
---|
| 116 | + transient boolean transientlink2master; |
---|
112 | 117 | |
---|
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) |
---|
| 118 | + void SaveSupports() |
---|
125 | 119 | { |
---|
126 | | - bRep.SaveSupports(); |
---|
| 120 | + if (blockloop) |
---|
| 121 | + return; |
---|
| 122 | + |
---|
| 123 | + transientsupport = support; |
---|
| 124 | + transientlink2master = link2master; |
---|
| 125 | + |
---|
| 126 | + support = null; |
---|
| 127 | + link2master = false; |
---|
| 128 | + |
---|
| 129 | + if (bRep != null) |
---|
| 130 | + { |
---|
| 131 | + bRep.SaveSupports(); |
---|
| 132 | + } |
---|
| 133 | + |
---|
| 134 | + for (int i = 0; i < Size(); i++) |
---|
| 135 | + { |
---|
| 136 | + Object3D child = (Object3D) get(i); |
---|
| 137 | + if (child == null) |
---|
| 138 | + continue; |
---|
| 139 | + blockloop = true; |
---|
| 140 | + child.SaveSupports(); |
---|
| 141 | + blockloop = false; |
---|
| 142 | + } |
---|
127 | 143 | } |
---|
128 | | - |
---|
129 | | - for (int i = 0; i < Size(); i++) |
---|
| 144 | + |
---|
| 145 | + void RestoreSupports() |
---|
130 | 146 | { |
---|
131 | | - Object3D child = (Object3D) get(i); |
---|
132 | | - if (child == null) |
---|
133 | | - continue; |
---|
| 147 | + if (blockloop) |
---|
| 148 | + return; |
---|
| 149 | + |
---|
| 150 | + support = transientsupport; |
---|
| 151 | + link2master = transientlink2master; |
---|
| 152 | + transientsupport = null; |
---|
| 153 | + transientlink2master = false; |
---|
| 154 | + |
---|
| 155 | + if (bRep != null) |
---|
| 156 | + { |
---|
| 157 | + bRep.RestoreSupports(); |
---|
| 158 | + } |
---|
| 159 | + |
---|
| 160 | + for (int i = 0; i < Size(); i++) |
---|
| 161 | + { |
---|
| 162 | + Object3D child = (Object3D) get(i); |
---|
| 163 | + if (child == null) |
---|
| 164 | + continue; |
---|
| 165 | + blockloop = true; |
---|
| 166 | + child.RestoreSupports(); |
---|
| 167 | + blockloop = false; |
---|
| 168 | + } |
---|
| 169 | + } |
---|
| 170 | + |
---|
| 171 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 172 | + { |
---|
| 173 | + Object3D o; |
---|
| 174 | + |
---|
| 175 | + if (hashtable.containsKey(GetUUID())) |
---|
| 176 | + { |
---|
| 177 | + o = hashtable.get(GetUUID()); |
---|
| 178 | + |
---|
| 179 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 180 | + //if (this.bRep != null) |
---|
| 181 | + // assert(this.bRep.support == o.transientrep); |
---|
| 182 | + if (this.support != null) |
---|
| 183 | + assert(this.support.bRep == o.transientrep); |
---|
| 184 | + } |
---|
| 185 | + else |
---|
| 186 | + { |
---|
| 187 | + o = new Object3D("copy of " + this.name); |
---|
| 188 | + |
---|
| 189 | + hashtable.put(GetUUID(), o); |
---|
| 190 | + } |
---|
| 191 | + |
---|
| 192 | + if (!blockloop) |
---|
| 193 | + { |
---|
| 194 | + blockloop = true; |
---|
| 195 | + |
---|
| 196 | + for (int i=0; i<Size(); i++) |
---|
| 197 | + { |
---|
| 198 | + get(i).ExtractBigData(hashtable); |
---|
| 199 | + } |
---|
| 200 | + |
---|
| 201 | + blockloop = false; |
---|
| 202 | + } |
---|
| 203 | + |
---|
| 204 | + ExtractBigData(o); |
---|
| 205 | + } |
---|
| 206 | + |
---|
| 207 | + void ExtractBigData(Object3D o) |
---|
| 208 | + { |
---|
| 209 | + if (o.bRep != null) |
---|
| 210 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 211 | + |
---|
| 212 | + o.bRep = this.bRep; |
---|
| 213 | +// July 2019 if (this.bRep != null) |
---|
| 214 | +// { |
---|
| 215 | +// o.transientrep = this.bRep.support; |
---|
| 216 | +// o.bRep.support = null; |
---|
| 217 | +// } |
---|
| 218 | + |
---|
| 219 | + if (this.support != null) |
---|
| 220 | + { |
---|
| 221 | + if (o.transientrep != null) |
---|
| 222 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 223 | + |
---|
| 224 | + o.transientrep = this.support.bRep; |
---|
| 225 | + this.support.bRep = null; |
---|
| 226 | + } |
---|
| 227 | + |
---|
| 228 | + // o.support = this.support; |
---|
| 229 | + // o.fileparent = this.fileparent; |
---|
| 230 | + // if (this.bRep != null) |
---|
| 231 | + // o.bRep = this.bRep.support; |
---|
| 232 | + |
---|
| 233 | + this.bRep = null; |
---|
| 234 | + // if (this.bRep != null) |
---|
| 235 | + // this.bRep.support = null; |
---|
| 236 | + // this.support = null; |
---|
| 237 | + // this.fileparent = null; |
---|
| 238 | + } |
---|
| 239 | + |
---|
| 240 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 241 | + { |
---|
| 242 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 243 | + return; |
---|
| 244 | + |
---|
| 245 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 246 | + |
---|
| 247 | + RestoreBigData(o); |
---|
| 248 | + |
---|
| 249 | + if (blockloop) |
---|
| 250 | + return; |
---|
| 251 | + |
---|
134 | 252 | blockloop = true; |
---|
135 | | - child.SaveSupports(); |
---|
| 253 | + |
---|
| 254 | + //hashtable.remove(GetUUID()); |
---|
| 255 | + |
---|
| 256 | + for (int i=0; i<Size(); i++) |
---|
| 257 | + { |
---|
| 258 | + get(i).RestoreBigData(hashtable); |
---|
| 259 | + } |
---|
| 260 | + |
---|
136 | 261 | blockloop = false; |
---|
137 | 262 | } |
---|
138 | | -} |
---|
139 | 263 | |
---|
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) |
---|
| 264 | + void RestoreBigData(Object3D o) |
---|
151 | 265 | { |
---|
152 | | - bRep.RestoreSupports(); |
---|
| 266 | + this.bRep = o.bRep; |
---|
| 267 | + if (this.support != null && o.transientrep != null) |
---|
| 268 | + { |
---|
| 269 | + this.support.bRep = o.transientrep; |
---|
| 270 | + } |
---|
| 271 | +// July 2019 if (this.bRep != null) |
---|
| 272 | +// this.bRep.support = o.transientrep; |
---|
| 273 | + // this.support = o.support; |
---|
| 274 | + // this.fileparent = o.fileparent; |
---|
153 | 275 | } |
---|
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 | 276 | |
---|
166 | 277 | // MOCAP SUPPORT |
---|
167 | 278 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
486 | 597 | toParent = LA.newMatrix(); |
---|
487 | 598 | fromParent = LA.newMatrix(); |
---|
488 | 599 | } |
---|
| 600 | + |
---|
489 | 601 | if (toParentMarked == null) |
---|
490 | 602 | { |
---|
491 | 603 | if (maxcount != 1) |
---|
492 | 604 | { |
---|
493 | 605 | new Exception().printStackTrace(); |
---|
494 | 606 | } |
---|
| 607 | + |
---|
495 | 608 | toParentMarked = LA.newMatrix(); |
---|
496 | 609 | fromParentMarked = LA.newMatrix(); |
---|
497 | 610 | } |
---|
.. | .. |
---|
802 | 915 | |
---|
803 | 916 | if (marked && Globals.isLIVE() && live && |
---|
804 | 917 | //TEMP21aug2018 |
---|
805 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 918 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
806 | 919 | currentframe != Globals.framecount) |
---|
807 | 920 | { |
---|
808 | 921 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
814 | 927 | |
---|
815 | 928 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
816 | 929 | |
---|
817 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 930 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 931 | + (step == 1 && changedir)) |
---|
818 | 932 | { |
---|
819 | 933 | countdown = 1; |
---|
820 | 934 | delay = speedup?8:1; |
---|
.. | .. |
---|
886 | 1000 | if (material == null || material.multiply) |
---|
887 | 1001 | return true; |
---|
888 | 1002 | |
---|
| 1003 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
889 | 1004 | return material.opacity > 0.99; |
---|
890 | 1005 | } |
---|
891 | 1006 | |
---|
.. | .. |
---|
1286 | 1401 | toParent = LA.newMatrix(); |
---|
1287 | 1402 | fromParent = LA.newMatrix(); |
---|
1288 | 1403 | } |
---|
| 1404 | + |
---|
1289 | 1405 | LA.matCopy(other.toParent, toParent); |
---|
1290 | 1406 | LA.matCopy(other.fromParent, fromParent); |
---|
1291 | 1407 | |
---|
.. | .. |
---|
2307 | 2423 | } |
---|
2308 | 2424 | */ |
---|
2309 | 2425 | } |
---|
| 2426 | + else |
---|
| 2427 | + { |
---|
| 2428 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2429 | + } |
---|
2310 | 2430 | } |
---|
2311 | 2431 | |
---|
2312 | 2432 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2348 | 2468 | { |
---|
2349 | 2469 | editWindow.refreshContents(); |
---|
2350 | 2470 | } |
---|
| 2471 | + else |
---|
| 2472 | + { |
---|
| 2473 | + if (manipWindow != null) |
---|
| 2474 | + { |
---|
| 2475 | + manipWindow.refreshContents(); |
---|
| 2476 | + } |
---|
| 2477 | + } |
---|
| 2478 | + |
---|
2351 | 2479 | //if (parent != null) |
---|
2352 | 2480 | //parent.refreshEditWindow(); |
---|
2353 | 2481 | } |
---|
.. | .. |
---|
2632 | 2760 | //Touch(); |
---|
2633 | 2761 | } |
---|
2634 | 2762 | |
---|
| 2763 | + void GenNormalsMeshS() |
---|
| 2764 | + { |
---|
| 2765 | + selection.GenNormalsMesh(); |
---|
| 2766 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2767 | +// { |
---|
| 2768 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2769 | +// selectee.GenNormals(crease); |
---|
| 2770 | +// } |
---|
| 2771 | + |
---|
| 2772 | + //Touch(); |
---|
| 2773 | + } |
---|
| 2774 | + |
---|
2635 | 2775 | void ClearColorsS() |
---|
2636 | 2776 | { |
---|
2637 | 2777 | selection.ClearColors(); |
---|
.. | .. |
---|
2763 | 2903 | if (child == null) |
---|
2764 | 2904 | continue; |
---|
2765 | 2905 | child.GenNormals(crease); |
---|
| 2906 | +// Children().release(i); |
---|
| 2907 | + } |
---|
| 2908 | + blockloop = false; |
---|
| 2909 | + } |
---|
| 2910 | + |
---|
| 2911 | + void GenNormalsMesh() |
---|
| 2912 | + { |
---|
| 2913 | + if (blockloop) |
---|
| 2914 | + return; |
---|
| 2915 | + |
---|
| 2916 | + blockloop = true; |
---|
| 2917 | + GenNormalsMesh0(); |
---|
| 2918 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2919 | + { |
---|
| 2920 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2921 | + if (child == null) |
---|
| 2922 | + continue; |
---|
| 2923 | + child.GenNormalsMesh(); |
---|
2766 | 2924 | // Children().release(i); |
---|
2767 | 2925 | } |
---|
2768 | 2926 | blockloop = false; |
---|
.. | .. |
---|
2931 | 3089 | if (bRep != null) |
---|
2932 | 3090 | { |
---|
2933 | 3091 | bRep.GenerateNormals(crease); |
---|
| 3092 | + Touch(); |
---|
| 3093 | + } |
---|
| 3094 | + } |
---|
| 3095 | + |
---|
| 3096 | + void GenNormalsMesh0() |
---|
| 3097 | + { |
---|
| 3098 | + if (bRep != null) |
---|
| 3099 | + { |
---|
| 3100 | + bRep.GenerateNormalsMesh(); |
---|
2934 | 3101 | Touch(); |
---|
2935 | 3102 | } |
---|
2936 | 3103 | } |
---|
.. | .. |
---|
3385 | 3552 | if (blockloop) |
---|
3386 | 3553 | return; |
---|
3387 | 3554 | |
---|
3388 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3555 | + if (//marked || // does not make sense |
---|
| 3556 | + (bRep != null || material != null)) // borderline... |
---|
3389 | 3557 | live = h; |
---|
3390 | 3558 | |
---|
3391 | 3559 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3406 | 3574 | return; |
---|
3407 | 3575 | |
---|
3408 | 3576 | //if (bRep != null) |
---|
3409 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3577 | + if (//marked || // does not make sense |
---|
| 3578 | + (bRep != null || material != null)) // borderline... |
---|
3410 | 3579 | link2master = h; |
---|
3411 | 3580 | |
---|
3412 | 3581 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3426 | 3595 | if (blockloop) |
---|
3427 | 3596 | return; |
---|
3428 | 3597 | |
---|
3429 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3598 | + if (//marked || // does not make sense |
---|
| 3599 | + (bRep != null || material != null)) // borderline... |
---|
3430 | 3600 | hide = h; |
---|
3431 | 3601 | |
---|
3432 | 3602 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3446 | 3616 | if (blockloop) |
---|
3447 | 3617 | return; |
---|
3448 | 3618 | |
---|
3449 | | - if (bRep != null && material != null) // borderline... |
---|
| 3619 | + if (bRep != null || material != null) // borderline... |
---|
3450 | 3620 | marked = h; |
---|
3451 | 3621 | |
---|
3452 | 3622 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3456 | 3626 | continue; |
---|
3457 | 3627 | blockloop = true; |
---|
3458 | 3628 | child.MarkLeaves(h); |
---|
| 3629 | + blockloop = false; |
---|
| 3630 | + // release(i); |
---|
| 3631 | + } |
---|
| 3632 | + } |
---|
| 3633 | + |
---|
| 3634 | + void RewindLeaves(boolean h) |
---|
| 3635 | + { |
---|
| 3636 | + if (blockloop) |
---|
| 3637 | + return; |
---|
| 3638 | + |
---|
| 3639 | + if (bRep != null || material != null) // borderline... |
---|
| 3640 | + rewind = h; |
---|
| 3641 | + |
---|
| 3642 | + for (int i = 0; i < Size(); i++) |
---|
| 3643 | + { |
---|
| 3644 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3645 | + if (child == null) |
---|
| 3646 | + continue; |
---|
| 3647 | + blockloop = true; |
---|
| 3648 | + child.RewindLeaves(h); |
---|
| 3649 | + blockloop = false; |
---|
| 3650 | + // release(i); |
---|
| 3651 | + } |
---|
| 3652 | + } |
---|
| 3653 | + |
---|
| 3654 | + void RandomLeaves(boolean h) |
---|
| 3655 | + { |
---|
| 3656 | + if (blockloop) |
---|
| 3657 | + return; |
---|
| 3658 | + |
---|
| 3659 | + if (bRep != null || material != null) // borderline... |
---|
| 3660 | + random = h; |
---|
| 3661 | + |
---|
| 3662 | + for (int i = 0; i < Size(); i++) |
---|
| 3663 | + { |
---|
| 3664 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3665 | + if (child == null) |
---|
| 3666 | + continue; |
---|
| 3667 | + blockloop = true; |
---|
| 3668 | + child.RandomLeaves(h); |
---|
3459 | 3669 | blockloop = false; |
---|
3460 | 3670 | // release(i); |
---|
3461 | 3671 | } |
---|
.. | .. |
---|
4233 | 4443 | } |
---|
4234 | 4444 | } |
---|
4235 | 4445 | |
---|
| 4446 | + void RepairSOV() |
---|
| 4447 | + { |
---|
| 4448 | + if (blockloop) |
---|
| 4449 | + return; |
---|
| 4450 | + |
---|
| 4451 | + String texname = this.GetPigmentTexture(); |
---|
| 4452 | + |
---|
| 4453 | + if (texname.startsWith("sov")) |
---|
| 4454 | + { |
---|
| 4455 | + String[] s = texname.split("/"); |
---|
| 4456 | + |
---|
| 4457 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4458 | + |
---|
| 4459 | + texname = sname[0]; |
---|
| 4460 | + |
---|
| 4461 | + if (sname.length > 1) |
---|
| 4462 | + { |
---|
| 4463 | + texname += "Color.jpg"; |
---|
| 4464 | + } |
---|
| 4465 | + |
---|
| 4466 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4467 | + } |
---|
| 4468 | + |
---|
| 4469 | + texname = this.GetBumpTexture(); |
---|
| 4470 | + |
---|
| 4471 | + if (texname.startsWith("sov")) |
---|
| 4472 | + { |
---|
| 4473 | + String[] s = texname.split("/"); |
---|
| 4474 | + |
---|
| 4475 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4476 | + |
---|
| 4477 | + texname = sname[0]; |
---|
| 4478 | + |
---|
| 4479 | + if (sname.length > 1) |
---|
| 4480 | + { |
---|
| 4481 | + texname += "Bump.jpg"; |
---|
| 4482 | + } |
---|
| 4483 | + |
---|
| 4484 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4485 | + } |
---|
| 4486 | + |
---|
| 4487 | + for (int i=0; i<Size(); i++) |
---|
| 4488 | + { |
---|
| 4489 | + blockloop = true; |
---|
| 4490 | + get(i).RepairSOV(); |
---|
| 4491 | + blockloop = false; |
---|
| 4492 | + } |
---|
| 4493 | + } |
---|
| 4494 | + |
---|
4236 | 4495 | void RepairTexture() |
---|
4237 | 4496 | { |
---|
4238 | 4497 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4747 | 5006 | } |
---|
4748 | 5007 | } |
---|
4749 | 5008 | |
---|
| 5009 | + ObjEditor GetWindow() |
---|
| 5010 | + { |
---|
| 5011 | + if (editWindow != null) |
---|
| 5012 | + return editWindow; |
---|
| 5013 | + |
---|
| 5014 | + return manipWindow; |
---|
| 5015 | + } |
---|
| 5016 | + |
---|
4750 | 5017 | cTreePath Select(int indexcount, boolean deselect) |
---|
4751 | 5018 | { |
---|
4752 | 5019 | if (hide || dontselect) |
---|
.. | .. |
---|
4783 | 5050 | if (leaf != null) |
---|
4784 | 5051 | { |
---|
4785 | 5052 | cTreePath tp = new cTreePath(this, leaf); |
---|
4786 | | - if (editWindow != null) |
---|
| 5053 | + ObjEditor window = GetWindow(); |
---|
| 5054 | + if (window != null) |
---|
4787 | 5055 | { |
---|
4788 | 5056 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4789 | | - editWindow.Select(tp, deselect, true); |
---|
| 5057 | + window.Select(tp, deselect, true); |
---|
4790 | 5058 | } |
---|
4791 | 5059 | |
---|
4792 | 5060 | return tp; |
---|
.. | .. |
---|
4803 | 5071 | |
---|
4804 | 5072 | if (child == null) |
---|
4805 | 5073 | continue; |
---|
| 5074 | + |
---|
4806 | 5075 | if (child.HasTransparency() && child.size() != 0) |
---|
4807 | 5076 | { |
---|
4808 | 5077 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4812 | 5081 | if (leaf != null) |
---|
4813 | 5082 | { |
---|
4814 | 5083 | cTreePath tp = new cTreePath(this, leaf); |
---|
4815 | | - if (editWindow != null) |
---|
| 5084 | + ObjEditor window = GetWindow(); |
---|
| 5085 | + if (window != null) |
---|
4816 | 5086 | { |
---|
4817 | | - editWindow.Select(tp, deselect, true); |
---|
| 5087 | + window.Select(tp, deselect, true); |
---|
4818 | 5088 | } |
---|
4819 | 5089 | |
---|
4820 | 5090 | return tp; |
---|
.. | .. |
---|
5456 | 5726 | boolean NeedSupport() |
---|
5457 | 5727 | { |
---|
5458 | 5728 | return |
---|
5459 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 5729 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5460 | 5730 | // PROBLEM with CROWD!! |
---|
5461 | 5731 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5462 | 5732 | } |
---|
5463 | 5733 | |
---|
5464 | 5734 | static boolean DEBUG_SELECTION = false; |
---|
| 5735 | + |
---|
| 5736 | + boolean IsLive() |
---|
| 5737 | + { |
---|
| 5738 | + if (live) |
---|
| 5739 | + return true; |
---|
| 5740 | + |
---|
| 5741 | + if (parent == null) |
---|
| 5742 | + return false; |
---|
| 5743 | + |
---|
| 5744 | + return parent.IsLive(); |
---|
| 5745 | + } |
---|
5465 | 5746 | |
---|
5466 | 5747 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5467 | 5748 | { |
---|
.. | .. |
---|
5524 | 5805 | support = support; |
---|
5525 | 5806 | |
---|
5526 | 5807 | //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); |
---|
| 5808 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5528 | 5809 | |
---|
5529 | 5810 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5530 | 5811 | { |
---|
.. | .. |
---|
5544 | 5825 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5545 | 5826 | |
---|
5546 | 5827 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5547 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5828 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5829 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5548 | 5830 | { |
---|
5549 | 5831 | Globals.lighttouched = true; |
---|
5550 | 5832 | } // all panes... |
---|
| 5833 | + |
---|
5551 | 5834 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5552 | 5835 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5553 | 5836 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5675 | 5958 | if (GetBRep() != null) |
---|
5676 | 5959 | { |
---|
5677 | 5960 | display.NextIndex(); |
---|
| 5961 | + |
---|
5678 | 5962 | // vertex color conflict : gl.glCallList(list); |
---|
5679 | 5963 | DrawNode(display, root, selected); |
---|
5680 | 5964 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5715 | 5999 | tex = GetTextures(); |
---|
5716 | 6000 | } |
---|
5717 | 6001 | |
---|
5718 | | - boolean failed = false; |
---|
| 6002 | + boolean failedPigment = false; |
---|
| 6003 | + boolean failedBump = false; |
---|
5719 | 6004 | |
---|
5720 | 6005 | try |
---|
5721 | 6006 | { |
---|
5722 | | - display.BindTextures(tex, texres); |
---|
| 6007 | + display.BindPigmentTexture(tex, texres); |
---|
5723 | 6008 | } |
---|
5724 | 6009 | catch (Exception e) |
---|
5725 | 6010 | { |
---|
5726 | 6011 | System.err.println("FAILED: " + this); |
---|
5727 | | - failed = true; |
---|
| 6012 | + failedPigment = true; |
---|
| 6013 | + } |
---|
| 6014 | + |
---|
| 6015 | + try |
---|
| 6016 | + { |
---|
| 6017 | + display.BindBumpTexture(tex, texres); |
---|
| 6018 | + } |
---|
| 6019 | + catch (Exception e) |
---|
| 6020 | + { |
---|
| 6021 | + //System.err.println("FAILED: " + this); |
---|
| 6022 | + failedBump = true; |
---|
5728 | 6023 | } |
---|
5729 | 6024 | |
---|
5730 | 6025 | if (!compiled) |
---|
.. | .. |
---|
5747 | 6042 | } |
---|
5748 | 6043 | } |
---|
5749 | 6044 | |
---|
5750 | | - if (!failed) |
---|
5751 | | - display.ReleaseTextures(tex); |
---|
| 6045 | + if (!failedBump) |
---|
| 6046 | + display.ReleaseBumpTexture(tex); |
---|
| 6047 | + |
---|
| 6048 | + if (!failedPigment) |
---|
| 6049 | + display.ReleasePigmentTexture(tex); |
---|
5752 | 6050 | |
---|
5753 | 6051 | display.PopMaterial(this, selected); |
---|
5754 | 6052 | } |
---|
.. | .. |
---|
6121 | 6419 | // dec 2012 |
---|
6122 | 6420 | new Exception().printStackTrace(); |
---|
6123 | 6421 | return; |
---|
| 6422 | + } |
---|
| 6423 | + |
---|
| 6424 | + if (dontselect) |
---|
| 6425 | + { |
---|
| 6426 | + //bRep.GenerateNormalsMINE(); |
---|
6124 | 6427 | } |
---|
6125 | 6428 | |
---|
6126 | 6429 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6973 | 7276 | spot.translate(32, 32); |
---|
6974 | 7277 | spotw = spot.x + spot.width; |
---|
6975 | 7278 | spoth = spot.y + spot.height; |
---|
6976 | | - info.g.setColor(Color.blue); |
---|
| 7279 | + info.g.setColor(Color.cyan); |
---|
6977 | 7280 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6978 | 7281 | // if (CameraPane.Xmin > spot.x) |
---|
6979 | 7282 | // { |
---|
.. | .. |
---|
6991 | 7294 | // { |
---|
6992 | 7295 | // CameraPane.Ymax = spoth; |
---|
6993 | 7296 | // } |
---|
6994 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6995 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7297 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7298 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6996 | 7299 | spot.translate(0, -32); |
---|
6997 | | - info.g.setColor(Color.green); |
---|
| 7300 | + info.g.setColor(Color.yellow); |
---|
6998 | 7301 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7302 | + info.g.setColor(Color.green); |
---|
6999 | 7303 | // if (CameraPane.Xmin > spot.x) |
---|
7000 | 7304 | // { |
---|
7001 | 7305 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7012 | 7316 | // { |
---|
7013 | 7317 | // CameraPane.Ymax = spoth; |
---|
7014 | 7318 | // } |
---|
7015 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7016 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7319 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7320 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
7017 | 7321 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7018 | 7322 | // if (CameraPane.Xmin > boundary.x) |
---|
7019 | 7323 | // { |
---|
.. | .. |
---|
7313 | 7617 | switch (info.pane.RenderCamera().viewCode) |
---|
7314 | 7618 | { |
---|
7315 | 7619 | case 3: // '\001' |
---|
7316 | | - if (modified) |
---|
| 7620 | + if (modified || opposite) |
---|
7317 | 7621 | { |
---|
7318 | 7622 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7319 | 7623 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7320 | 7624 | } // vScale, 1); |
---|
7321 | 7625 | else |
---|
7322 | 7626 | { |
---|
| 7627 | + // EXCEPTION! |
---|
7323 | 7628 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7324 | 7629 | } // vScale, 1); |
---|
7325 | 7630 | break; |
---|
7326 | 7631 | |
---|
7327 | 7632 | case 2: // '\002' |
---|
7328 | | - if (modified) |
---|
| 7633 | + if (modified || opposite) |
---|
7329 | 7634 | { |
---|
7330 | 7635 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7331 | 7636 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7336 | 7641 | break; |
---|
7337 | 7642 | |
---|
7338 | 7643 | case 1: // '\003' |
---|
7339 | | - if (modified) |
---|
| 7644 | + if (modified || opposite) |
---|
7340 | 7645 | { |
---|
7341 | 7646 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7342 | 7647 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7556 | 7861 | editWindow = null; |
---|
7557 | 7862 | } // ? |
---|
7558 | 7863 | } |
---|
| 7864 | + else |
---|
| 7865 | + { |
---|
| 7866 | + //editWindow.closeUI(); |
---|
| 7867 | + } |
---|
7559 | 7868 | } |
---|
7560 | 7869 | |
---|
7561 | 7870 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7567 | 7876 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7568 | 7877 | |
---|
7569 | 7878 | Object3D /*Composite*/ parent; |
---|
7570 | | - Object3D /*Composite*/ fileparent; |
---|
| 7879 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7571 | 7880 | |
---|
7572 | 7881 | double[][] toParent; // dynamic matrix |
---|
7573 | 7882 | double[][] fromParent; |
---|
.. | .. |
---|
7713 | 8022 | } |
---|
7714 | 8023 | |
---|
7715 | 8024 | transient ObjEditor editWindow; |
---|
| 8025 | + transient ObjEditor manipWindow; |
---|
| 8026 | + |
---|
| 8027 | + transient boolean pinned; |
---|
| 8028 | + |
---|
7716 | 8029 | transient ObjectUI objectUI; |
---|
7717 | 8030 | public static int povDepth = 0; |
---|
7718 | 8031 | private static cVector tbMin = new cVector(); |
---|