.. | .. |
---|
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++) |
---|
130 | | - { |
---|
131 | | - Object3D child = (Object3D) get(i); |
---|
132 | | - if (child == null) |
---|
133 | | - continue; |
---|
134 | | - blockloop = true; |
---|
135 | | - child.SaveSupports(); |
---|
136 | | - blockloop = false; |
---|
137 | | - } |
---|
138 | | -} |
---|
139 | 147 | |
---|
140 | | -void RestoreSupports() |
---|
141 | | -{ |
---|
142 | | - if (blockloop) |
---|
143 | | - return; |
---|
| 148 | + void RestoreSupports() |
---|
| 149 | + { |
---|
| 150 | + if (blockloop) |
---|
| 151 | + return; |
---|
144 | 152 | |
---|
145 | | - support = transientsupport; |
---|
146 | | - link2master = transientlink2master; |
---|
147 | | - transientsupport = null; |
---|
148 | | - transientlink2master = false; |
---|
149 | | - |
---|
150 | | - if (bRep != null) |
---|
151 | | - { |
---|
152 | | - bRep.RestoreSupports(); |
---|
153 | | - } |
---|
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 | | -} |
---|
| 153 | + support = transientsupport; |
---|
| 154 | + link2master = transientlink2master; |
---|
| 155 | + transientsupport = null; |
---|
| 156 | + transientlink2master = false; |
---|
165 | 157 | |
---|
166 | | -void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
167 | | -{ |
---|
168 | | - if (hashtable.containsKey(GetUUID())) |
---|
| 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) |
---|
169 | 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 | + |
---|
170 | 251 | Object3D o = hashtable.get(GetUUID()); |
---|
171 | 252 | |
---|
172 | | - assert(this.bRep == o.bRep); |
---|
173 | | - if (this.bRep != null) |
---|
174 | | - assert(this.bRep.support == o.transientrep); |
---|
175 | | - |
---|
176 | | - return; |
---|
177 | | - } |
---|
178 | | - |
---|
179 | | - Object3D o = new Object3D(); |
---|
180 | | - o.bRep = this.bRep; |
---|
181 | | - if (this.bRep != null) |
---|
182 | | - { |
---|
183 | | - o.transientrep = this.bRep.support; |
---|
184 | | - o.bRep.support = null; |
---|
185 | | - } |
---|
186 | | - |
---|
187 | | -// o.support = this.support; |
---|
188 | | -// o.fileparent = this.fileparent; |
---|
189 | | -// if (this.bRep != null) |
---|
190 | | -// o.bRep = this.bRep.support; |
---|
191 | | - |
---|
192 | | - hashtable.put(GetUUID(), o); |
---|
193 | | - |
---|
194 | | - this.bRep = null; |
---|
195 | | -// if (this.bRep != null) |
---|
196 | | -// this.bRep.support = null; |
---|
197 | | -// this.support = null; |
---|
198 | | -// this.fileparent = null; |
---|
199 | | - |
---|
200 | | - for (int i=0; i<Size(); i++) |
---|
201 | | - { |
---|
202 | | - get(i).ExtractBigData(hashtable); |
---|
203 | | - } |
---|
204 | | -} |
---|
| 253 | + RestoreBigData(o); |
---|
205 | 254 | |
---|
206 | | -void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
207 | | -{ |
---|
208 | | - if (!hashtable.containsKey(GetUUID())) |
---|
209 | | - return; |
---|
210 | | - |
---|
211 | | - Object3D o = hashtable.get(GetUUID()); |
---|
212 | | - |
---|
213 | | - this.bRep = o.bRep; |
---|
214 | | - if (this.bRep != null) |
---|
215 | | - this.bRep.support = o.transientrep; |
---|
216 | | -// this.support = o.support; |
---|
217 | | -// this.fileparent = o.fileparent; |
---|
218 | | - |
---|
219 | | - hashtable.remove(GetUUID()); |
---|
220 | | - |
---|
221 | | - for (int i=0; i<Size(); i++) |
---|
222 | | - { |
---|
223 | | - get(i).RestoreBigData(hashtable); |
---|
| 255 | + if (blockloop) |
---|
| 256 | + return; |
---|
| 257 | + |
---|
| 258 | + blockloop = true; |
---|
| 259 | + |
---|
| 260 | + //hashtable.remove(GetUUID()); |
---|
| 261 | + |
---|
| 262 | + for (int i=0; i<Size(); i++) |
---|
| 263 | + { |
---|
| 264 | + get(i).RestoreBigData(hashtable); |
---|
| 265 | + } |
---|
| 266 | + |
---|
| 267 | + blockloop = false; |
---|
224 | 268 | } |
---|
225 | | -} |
---|
| 269 | + |
---|
| 270 | + void RestoreBigData(Object3D o) |
---|
| 271 | + { |
---|
| 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; |
---|
| 286 | + } |
---|
226 | 287 | |
---|
227 | 288 | // MOCAP SUPPORT |
---|
228 | 289 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
365 | 426 | } |
---|
366 | 427 | |
---|
367 | 428 | boolean live = false; |
---|
| 429 | + transient boolean keepdontselect; |
---|
368 | 430 | boolean dontselect = false; |
---|
369 | 431 | boolean hide = false; |
---|
370 | 432 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
547 | 609 | toParent = LA.newMatrix(); |
---|
548 | 610 | fromParent = LA.newMatrix(); |
---|
549 | 611 | } |
---|
| 612 | + |
---|
550 | 613 | if (toParentMarked == null) |
---|
551 | 614 | { |
---|
552 | 615 | if (maxcount != 1) |
---|
553 | 616 | { |
---|
554 | 617 | new Exception().printStackTrace(); |
---|
555 | 618 | } |
---|
| 619 | + |
---|
556 | 620 | toParentMarked = LA.newMatrix(); |
---|
557 | 621 | fromParentMarked = LA.newMatrix(); |
---|
558 | 622 | } |
---|
.. | .. |
---|
863 | 927 | |
---|
864 | 928 | if (marked && Globals.isLIVE() && live && |
---|
865 | 929 | //TEMP21aug2018 |
---|
866 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 930 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
867 | 931 | currentframe != Globals.framecount) |
---|
868 | 932 | { |
---|
869 | 933 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
875 | 939 | |
---|
876 | 940 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
877 | 941 | |
---|
878 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 942 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 943 | + (step == 1 && changedir)) |
---|
879 | 944 | { |
---|
880 | 945 | countdown = 1; |
---|
881 | 946 | delay = speedup?8:1; |
---|
.. | .. |
---|
947 | 1012 | if (material == null || material.multiply) |
---|
948 | 1013 | return true; |
---|
949 | 1014 | |
---|
| 1015 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
950 | 1016 | return material.opacity > 0.99; |
---|
951 | 1017 | } |
---|
952 | 1018 | |
---|
.. | .. |
---|
1347 | 1413 | toParent = LA.newMatrix(); |
---|
1348 | 1414 | fromParent = LA.newMatrix(); |
---|
1349 | 1415 | } |
---|
| 1416 | + |
---|
1350 | 1417 | LA.matCopy(other.toParent, toParent); |
---|
1351 | 1418 | LA.matCopy(other.fromParent, fromParent); |
---|
1352 | 1419 | |
---|
.. | .. |
---|
2368 | 2435 | } |
---|
2369 | 2436 | */ |
---|
2370 | 2437 | } |
---|
| 2438 | + else |
---|
| 2439 | + { |
---|
| 2440 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2441 | + } |
---|
2371 | 2442 | } |
---|
2372 | 2443 | |
---|
2373 | 2444 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2409 | 2480 | { |
---|
2410 | 2481 | editWindow.refreshContents(); |
---|
2411 | 2482 | } |
---|
| 2483 | + else |
---|
| 2484 | + { |
---|
| 2485 | + if (manipWindow != null) |
---|
| 2486 | + { |
---|
| 2487 | + manipWindow.refreshContents(); |
---|
| 2488 | + } |
---|
| 2489 | + } |
---|
| 2490 | + |
---|
2412 | 2491 | //if (parent != null) |
---|
2413 | 2492 | //parent.refreshEditWindow(); |
---|
2414 | 2493 | } |
---|
.. | .. |
---|
2693 | 2772 | //Touch(); |
---|
2694 | 2773 | } |
---|
2695 | 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 | + |
---|
2696 | 2787 | void ClearColorsS() |
---|
2697 | 2788 | { |
---|
2698 | 2789 | selection.ClearColors(); |
---|
.. | .. |
---|
2824 | 2915 | if (child == null) |
---|
2825 | 2916 | continue; |
---|
2826 | 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(); |
---|
2827 | 2936 | // Children().release(i); |
---|
2828 | 2937 | } |
---|
2829 | 2938 | blockloop = false; |
---|
.. | .. |
---|
2996 | 3105 | } |
---|
2997 | 3106 | } |
---|
2998 | 3107 | |
---|
| 3108 | + void GenNormalsMesh0() |
---|
| 3109 | + { |
---|
| 3110 | + if (bRep != null) |
---|
| 3111 | + { |
---|
| 3112 | + bRep.GenerateNormalsMesh(); |
---|
| 3113 | + Touch(); |
---|
| 3114 | + } |
---|
| 3115 | + } |
---|
| 3116 | + |
---|
2999 | 3117 | void GenNormalsMINE0() |
---|
3000 | 3118 | { |
---|
3001 | 3119 | if (bRep != null) |
---|
3002 | 3120 | { |
---|
3003 | | - bRep.GenerateNormalsMINE(); |
---|
| 3121 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3004 | 3122 | Touch(); |
---|
3005 | 3123 | } |
---|
3006 | 3124 | } |
---|
.. | .. |
---|
3446 | 3564 | if (blockloop) |
---|
3447 | 3565 | return; |
---|
3448 | 3566 | |
---|
3449 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3567 | + if (//marked || // does not make sense |
---|
| 3568 | + (bRep != null || material != null)) // borderline... |
---|
3450 | 3569 | live = h; |
---|
3451 | 3570 | |
---|
3452 | 3571 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3467 | 3586 | return; |
---|
3468 | 3587 | |
---|
3469 | 3588 | //if (bRep != null) |
---|
3470 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3589 | + if (//marked || // does not make sense |
---|
| 3590 | + (bRep != null || material != null)) // borderline... |
---|
3471 | 3591 | link2master = h; |
---|
3472 | 3592 | |
---|
3473 | 3593 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3487 | 3607 | if (blockloop) |
---|
3488 | 3608 | return; |
---|
3489 | 3609 | |
---|
3490 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3610 | + if (//marked || // does not make sense |
---|
| 3611 | + (bRep != null || material != null)) // borderline... |
---|
3491 | 3612 | hide = h; |
---|
3492 | 3613 | |
---|
3493 | 3614 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3507 | 3628 | if (blockloop) |
---|
3508 | 3629 | return; |
---|
3509 | 3630 | |
---|
3510 | | - if (bRep != null && material != null) // borderline... |
---|
| 3631 | + if (bRep != null || material != null) // borderline... |
---|
3511 | 3632 | marked = h; |
---|
3512 | 3633 | |
---|
3513 | 3634 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3517 | 3638 | continue; |
---|
3518 | 3639 | blockloop = true; |
---|
3519 | 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); |
---|
3520 | 3681 | blockloop = false; |
---|
3521 | 3682 | // release(i); |
---|
3522 | 3683 | } |
---|
.. | .. |
---|
4294 | 4455 | } |
---|
4295 | 4456 | } |
---|
4296 | 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 | + |
---|
4297 | 4507 | void RepairTexture() |
---|
4298 | 4508 | { |
---|
4299 | 4509 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4808 | 5018 | } |
---|
4809 | 5019 | } |
---|
4810 | 5020 | |
---|
| 5021 | + ObjEditor GetWindow() |
---|
| 5022 | + { |
---|
| 5023 | + if (editWindow != null) |
---|
| 5024 | + return editWindow; |
---|
| 5025 | + |
---|
| 5026 | + return manipWindow; |
---|
| 5027 | + } |
---|
| 5028 | + |
---|
4811 | 5029 | cTreePath Select(int indexcount, boolean deselect) |
---|
4812 | 5030 | { |
---|
4813 | 5031 | if (hide || dontselect) |
---|
.. | .. |
---|
4844 | 5062 | if (leaf != null) |
---|
4845 | 5063 | { |
---|
4846 | 5064 | cTreePath tp = new cTreePath(this, leaf); |
---|
4847 | | - if (editWindow != null) |
---|
| 5065 | + ObjEditor window = GetWindow(); |
---|
| 5066 | + if (window != null) |
---|
4848 | 5067 | { |
---|
4849 | 5068 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4850 | | - editWindow.Select(tp, deselect, true); |
---|
| 5069 | + window.Select(tp, deselect, true); |
---|
4851 | 5070 | } |
---|
4852 | 5071 | |
---|
4853 | 5072 | return tp; |
---|
.. | .. |
---|
4864 | 5083 | |
---|
4865 | 5084 | if (child == null) |
---|
4866 | 5085 | continue; |
---|
| 5086 | + |
---|
4867 | 5087 | if (child.HasTransparency() && child.size() != 0) |
---|
4868 | 5088 | { |
---|
4869 | 5089 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4873 | 5093 | if (leaf != null) |
---|
4874 | 5094 | { |
---|
4875 | 5095 | cTreePath tp = new cTreePath(this, leaf); |
---|
4876 | | - if (editWindow != null) |
---|
| 5096 | + ObjEditor window = GetWindow(); |
---|
| 5097 | + if (window != null) |
---|
4877 | 5098 | { |
---|
4878 | | - editWindow.Select(tp, deselect, true); |
---|
| 5099 | + window.Select(tp, deselect, true); |
---|
4879 | 5100 | } |
---|
4880 | 5101 | |
---|
4881 | 5102 | return tp; |
---|
.. | .. |
---|
5200 | 5421 | blockloop = false; |
---|
5201 | 5422 | } |
---|
5202 | 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 | + |
---|
5203 | 5469 | boolean IsSelected() |
---|
5204 | 5470 | { |
---|
5205 | 5471 | if (parent == null) |
---|
.. | .. |
---|
5517 | 5783 | boolean NeedSupport() |
---|
5518 | 5784 | { |
---|
5519 | 5785 | return |
---|
5520 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 5786 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5521 | 5787 | // PROBLEM with CROWD!! |
---|
5522 | 5788 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5523 | 5789 | } |
---|
5524 | 5790 | |
---|
5525 | 5791 | static boolean DEBUG_SELECTION = false; |
---|
| 5792 | + |
---|
| 5793 | + boolean IsLive() |
---|
| 5794 | + { |
---|
| 5795 | + if (live) |
---|
| 5796 | + return true; |
---|
| 5797 | + |
---|
| 5798 | + if (parent == null) |
---|
| 5799 | + return false; |
---|
| 5800 | + |
---|
| 5801 | + return parent.IsLive(); |
---|
| 5802 | + } |
---|
5526 | 5803 | |
---|
5527 | 5804 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5528 | 5805 | { |
---|
.. | .. |
---|
5585 | 5862 | support = support; |
---|
5586 | 5863 | |
---|
5587 | 5864 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5588 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5865 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5589 | 5866 | |
---|
5590 | 5867 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5591 | 5868 | { |
---|
.. | .. |
---|
5605 | 5882 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5606 | 5883 | |
---|
5607 | 5884 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5608 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5885 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5886 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5609 | 5887 | { |
---|
5610 | 5888 | Globals.lighttouched = true; |
---|
5611 | 5889 | } // all panes... |
---|
| 5890 | + |
---|
5612 | 5891 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5613 | 5892 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5614 | 5893 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5736 | 6015 | if (GetBRep() != null) |
---|
5737 | 6016 | { |
---|
5738 | 6017 | display.NextIndex(); |
---|
| 6018 | + |
---|
5739 | 6019 | // vertex color conflict : gl.glCallList(list); |
---|
5740 | 6020 | DrawNode(display, root, selected); |
---|
5741 | 6021 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5776 | 6056 | tex = GetTextures(); |
---|
5777 | 6057 | } |
---|
5778 | 6058 | |
---|
5779 | | - boolean failed = false; |
---|
| 6059 | + boolean failedPigment = false; |
---|
| 6060 | + boolean failedBump = false; |
---|
5780 | 6061 | |
---|
5781 | 6062 | try |
---|
5782 | 6063 | { |
---|
5783 | | - display.BindTextures(tex, texres); |
---|
| 6064 | + display.BindPigmentTexture(tex, texres); |
---|
5784 | 6065 | } |
---|
5785 | 6066 | catch (Exception e) |
---|
5786 | 6067 | { |
---|
5787 | 6068 | System.err.println("FAILED: " + this); |
---|
5788 | | - failed = true; |
---|
| 6069 | + failedPigment = true; |
---|
| 6070 | + } |
---|
| 6071 | + |
---|
| 6072 | + try |
---|
| 6073 | + { |
---|
| 6074 | + display.BindBumpTexture(tex, texres); |
---|
| 6075 | + } |
---|
| 6076 | + catch (Exception e) |
---|
| 6077 | + { |
---|
| 6078 | + //System.err.println("FAILED: " + this); |
---|
| 6079 | + failedBump = true; |
---|
5789 | 6080 | } |
---|
5790 | 6081 | |
---|
5791 | 6082 | if (!compiled) |
---|
.. | .. |
---|
5808 | 6099 | } |
---|
5809 | 6100 | } |
---|
5810 | 6101 | |
---|
5811 | | - if (!failed) |
---|
5812 | | - display.ReleaseTextures(tex); |
---|
| 6102 | + if (!failedBump) |
---|
| 6103 | + display.ReleaseBumpTexture(tex); |
---|
| 6104 | + |
---|
| 6105 | + if (!failedPigment) |
---|
| 6106 | + display.ReleasePigmentTexture(tex); |
---|
5813 | 6107 | |
---|
5814 | 6108 | display.PopMaterial(this, selected); |
---|
5815 | 6109 | } |
---|
.. | .. |
---|
6182 | 6476 | // dec 2012 |
---|
6183 | 6477 | new Exception().printStackTrace(); |
---|
6184 | 6478 | return; |
---|
| 6479 | + } |
---|
| 6480 | + |
---|
| 6481 | + if (dontselect) |
---|
| 6482 | + { |
---|
| 6483 | + //bRep.GenerateNormalsMINE(); |
---|
6185 | 6484 | } |
---|
6186 | 6485 | |
---|
6187 | 6486 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7034 | 7333 | spot.translate(32, 32); |
---|
7035 | 7334 | spotw = spot.x + spot.width; |
---|
7036 | 7335 | spoth = spot.y + spot.height; |
---|
7037 | | - info.g.setColor(Color.blue); |
---|
| 7336 | + info.g.setColor(Color.cyan); |
---|
7038 | 7337 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7039 | 7338 | // if (CameraPane.Xmin > spot.x) |
---|
7040 | 7339 | // { |
---|
.. | .. |
---|
7052 | 7351 | // { |
---|
7053 | 7352 | // CameraPane.Ymax = spoth; |
---|
7054 | 7353 | // } |
---|
7055 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7056 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7354 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7355 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7057 | 7356 | spot.translate(0, -32); |
---|
7058 | | - info.g.setColor(Color.green); |
---|
| 7357 | + info.g.setColor(Color.yellow); |
---|
7059 | 7358 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7359 | + info.g.setColor(Color.green); |
---|
7060 | 7360 | // if (CameraPane.Xmin > spot.x) |
---|
7061 | 7361 | // { |
---|
7062 | 7362 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7073 | 7373 | // { |
---|
7074 | 7374 | // CameraPane.Ymax = spoth; |
---|
7075 | 7375 | // } |
---|
7076 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7077 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7376 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7377 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
7078 | 7378 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7079 | 7379 | // if (CameraPane.Xmin > boundary.x) |
---|
7080 | 7380 | // { |
---|
.. | .. |
---|
7374 | 7674 | switch (info.pane.RenderCamera().viewCode) |
---|
7375 | 7675 | { |
---|
7376 | 7676 | case 3: // '\001' |
---|
7377 | | - if (modified) |
---|
| 7677 | + if (modified || opposite) |
---|
7378 | 7678 | { |
---|
7379 | 7679 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7380 | 7680 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7381 | 7681 | } // vScale, 1); |
---|
7382 | 7682 | else |
---|
7383 | 7683 | { |
---|
| 7684 | + // EXCEPTION! |
---|
7384 | 7685 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7385 | 7686 | } // vScale, 1); |
---|
7386 | 7687 | break; |
---|
7387 | 7688 | |
---|
7388 | 7689 | case 2: // '\002' |
---|
7389 | | - if (modified) |
---|
| 7690 | + if (modified || opposite) |
---|
7390 | 7691 | { |
---|
7391 | 7692 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7392 | 7693 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7397 | 7698 | break; |
---|
7398 | 7699 | |
---|
7399 | 7700 | case 1: // '\003' |
---|
7400 | | - if (modified) |
---|
| 7701 | + if (modified || opposite) |
---|
7401 | 7702 | { |
---|
7402 | 7703 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7403 | 7704 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7617 | 7918 | editWindow = null; |
---|
7618 | 7919 | } // ? |
---|
7619 | 7920 | } |
---|
| 7921 | + else |
---|
| 7922 | + { |
---|
| 7923 | + //editWindow.closeUI(); |
---|
| 7924 | + } |
---|
7620 | 7925 | } |
---|
7621 | 7926 | |
---|
7622 | 7927 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7774 | 8079 | } |
---|
7775 | 8080 | |
---|
7776 | 8081 | transient ObjEditor editWindow; |
---|
| 8082 | + transient ObjEditor manipWindow; |
---|
| 8083 | + |
---|
| 8084 | + transient boolean pinned; |
---|
| 8085 | + |
---|
7777 | 8086 | transient ObjectUI objectUI; |
---|
7778 | 8087 | public static int povDepth = 0; |
---|
7779 | 8088 | private static cVector tbMin = new cVector(); |
---|