.. | .. |
---|
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[] = new byte[100][]; |
---|
| 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 | + |
---|
| 223 | + if (this.support != null) |
---|
| 224 | + { |
---|
| 225 | + if (o.transientrep != null) |
---|
| 226 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 227 | + |
---|
| 228 | + o.transientrep = this.support.bRep; |
---|
| 229 | + this.support.bRep = null; |
---|
| 230 | + } |
---|
| 231 | + |
---|
| 232 | + // o.support = this.support; |
---|
| 233 | + // o.fileparent = this.fileparent; |
---|
| 234 | + // if (this.bRep != null) |
---|
| 235 | + // o.bRep = this.bRep.support; |
---|
| 236 | + |
---|
| 237 | + this.bRep = null; |
---|
| 238 | + // if (this.bRep != null) |
---|
| 239 | + // this.bRep.support = null; |
---|
| 240 | + // this.support = null; |
---|
| 241 | + // this.fileparent = null; |
---|
| 242 | + } |
---|
| 243 | + |
---|
| 244 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 245 | + { |
---|
| 246 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 247 | + return; |
---|
| 248 | + |
---|
170 | 249 | Object3D o = hashtable.get(GetUUID()); |
---|
171 | 250 | |
---|
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 | | -} |
---|
| 251 | + RestoreBigData(o); |
---|
205 | 252 | |
---|
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); |
---|
| 253 | + if (blockloop) |
---|
| 254 | + return; |
---|
| 255 | + |
---|
| 256 | + blockloop = true; |
---|
| 257 | + |
---|
| 258 | + //hashtable.remove(GetUUID()); |
---|
| 259 | + |
---|
| 260 | + for (int i=0; i<Size(); i++) |
---|
| 261 | + { |
---|
| 262 | + get(i).RestoreBigData(hashtable); |
---|
| 263 | + } |
---|
| 264 | + |
---|
| 265 | + blockloop = false; |
---|
224 | 266 | } |
---|
225 | | -} |
---|
| 267 | + |
---|
| 268 | + void RestoreBigData(Object3D o) |
---|
| 269 | + { |
---|
| 270 | + this.bRep = o.bRep; |
---|
| 271 | + if (this.support != null && o.transientrep != null) |
---|
| 272 | + { |
---|
| 273 | + this.support.bRep = o.transientrep; |
---|
| 274 | + } |
---|
| 275 | + |
---|
| 276 | + this.selection = o.selection; |
---|
| 277 | +// July 2019 if (this.bRep != null) |
---|
| 278 | +// this.bRep.support = o.transientrep; |
---|
| 279 | + // this.support = o.support; |
---|
| 280 | + // this.fileparent = o.fileparent; |
---|
| 281 | + } |
---|
226 | 282 | |
---|
227 | 283 | // MOCAP SUPPORT |
---|
228 | 284 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
547 | 603 | toParent = LA.newMatrix(); |
---|
548 | 604 | fromParent = LA.newMatrix(); |
---|
549 | 605 | } |
---|
| 606 | + |
---|
550 | 607 | if (toParentMarked == null) |
---|
551 | 608 | { |
---|
552 | 609 | if (maxcount != 1) |
---|
553 | 610 | { |
---|
554 | 611 | new Exception().printStackTrace(); |
---|
555 | 612 | } |
---|
| 613 | + |
---|
556 | 614 | toParentMarked = LA.newMatrix(); |
---|
557 | 615 | fromParentMarked = LA.newMatrix(); |
---|
558 | 616 | } |
---|
.. | .. |
---|
863 | 921 | |
---|
864 | 922 | if (marked && Globals.isLIVE() && live && |
---|
865 | 923 | //TEMP21aug2018 |
---|
866 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 924 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
867 | 925 | currentframe != Globals.framecount) |
---|
868 | 926 | { |
---|
869 | 927 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
875 | 933 | |
---|
876 | 934 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
877 | 935 | |
---|
878 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 936 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 937 | + (step == 1 && changedir)) |
---|
879 | 938 | { |
---|
880 | 939 | countdown = 1; |
---|
881 | 940 | delay = speedup?8:1; |
---|
.. | .. |
---|
947 | 1006 | if (material == null || material.multiply) |
---|
948 | 1007 | return true; |
---|
949 | 1008 | |
---|
| 1009 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
950 | 1010 | return material.opacity > 0.99; |
---|
951 | 1011 | } |
---|
952 | 1012 | |
---|
.. | .. |
---|
1347 | 1407 | toParent = LA.newMatrix(); |
---|
1348 | 1408 | fromParent = LA.newMatrix(); |
---|
1349 | 1409 | } |
---|
| 1410 | + |
---|
1350 | 1411 | LA.matCopy(other.toParent, toParent); |
---|
1351 | 1412 | LA.matCopy(other.fromParent, fromParent); |
---|
1352 | 1413 | |
---|
.. | .. |
---|
2368 | 2429 | } |
---|
2369 | 2430 | */ |
---|
2370 | 2431 | } |
---|
| 2432 | + else |
---|
| 2433 | + { |
---|
| 2434 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2435 | + } |
---|
2371 | 2436 | } |
---|
2372 | 2437 | |
---|
2373 | 2438 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2409 | 2474 | { |
---|
2410 | 2475 | editWindow.refreshContents(); |
---|
2411 | 2476 | } |
---|
| 2477 | + else |
---|
| 2478 | + { |
---|
| 2479 | + if (manipWindow != null) |
---|
| 2480 | + { |
---|
| 2481 | + manipWindow.refreshContents(); |
---|
| 2482 | + } |
---|
| 2483 | + } |
---|
| 2484 | + |
---|
2412 | 2485 | //if (parent != null) |
---|
2413 | 2486 | //parent.refreshEditWindow(); |
---|
2414 | 2487 | } |
---|
.. | .. |
---|
2693 | 2766 | //Touch(); |
---|
2694 | 2767 | } |
---|
2695 | 2768 | |
---|
| 2769 | + void GenNormalsMeshS() |
---|
| 2770 | + { |
---|
| 2771 | + selection.GenNormalsMesh(); |
---|
| 2772 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2773 | +// { |
---|
| 2774 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2775 | +// selectee.GenNormals(crease); |
---|
| 2776 | +// } |
---|
| 2777 | + |
---|
| 2778 | + //Touch(); |
---|
| 2779 | + } |
---|
| 2780 | + |
---|
2696 | 2781 | void ClearColorsS() |
---|
2697 | 2782 | { |
---|
2698 | 2783 | selection.ClearColors(); |
---|
.. | .. |
---|
2824 | 2909 | if (child == null) |
---|
2825 | 2910 | continue; |
---|
2826 | 2911 | child.GenNormals(crease); |
---|
| 2912 | +// Children().release(i); |
---|
| 2913 | + } |
---|
| 2914 | + blockloop = false; |
---|
| 2915 | + } |
---|
| 2916 | + |
---|
| 2917 | + void GenNormalsMesh() |
---|
| 2918 | + { |
---|
| 2919 | + if (blockloop) |
---|
| 2920 | + return; |
---|
| 2921 | + |
---|
| 2922 | + blockloop = true; |
---|
| 2923 | + GenNormalsMesh0(); |
---|
| 2924 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2925 | + { |
---|
| 2926 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2927 | + if (child == null) |
---|
| 2928 | + continue; |
---|
| 2929 | + child.GenNormalsMesh(); |
---|
2827 | 2930 | // Children().release(i); |
---|
2828 | 2931 | } |
---|
2829 | 2932 | blockloop = false; |
---|
.. | .. |
---|
2992 | 3095 | if (bRep != null) |
---|
2993 | 3096 | { |
---|
2994 | 3097 | bRep.GenerateNormals(crease); |
---|
| 3098 | + Touch(); |
---|
| 3099 | + } |
---|
| 3100 | + } |
---|
| 3101 | + |
---|
| 3102 | + void GenNormalsMesh0() |
---|
| 3103 | + { |
---|
| 3104 | + if (bRep != null) |
---|
| 3105 | + { |
---|
| 3106 | + bRep.GenerateNormalsMesh(); |
---|
2995 | 3107 | Touch(); |
---|
2996 | 3108 | } |
---|
2997 | 3109 | } |
---|
.. | .. |
---|
3446 | 3558 | if (blockloop) |
---|
3447 | 3559 | return; |
---|
3448 | 3560 | |
---|
3449 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3561 | + if (//marked || // does not make sense |
---|
| 3562 | + (bRep != null || material != null)) // borderline... |
---|
3450 | 3563 | live = h; |
---|
3451 | 3564 | |
---|
3452 | 3565 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3467 | 3580 | return; |
---|
3468 | 3581 | |
---|
3469 | 3582 | //if (bRep != null) |
---|
3470 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3583 | + if (//marked || // does not make sense |
---|
| 3584 | + (bRep != null || material != null)) // borderline... |
---|
3471 | 3585 | link2master = h; |
---|
3472 | 3586 | |
---|
3473 | 3587 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3487 | 3601 | if (blockloop) |
---|
3488 | 3602 | return; |
---|
3489 | 3603 | |
---|
3490 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3604 | + if (//marked || // does not make sense |
---|
| 3605 | + (bRep != null || material != null)) // borderline... |
---|
3491 | 3606 | hide = h; |
---|
3492 | 3607 | |
---|
3493 | 3608 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3507 | 3622 | if (blockloop) |
---|
3508 | 3623 | return; |
---|
3509 | 3624 | |
---|
3510 | | - if (bRep != null && material != null) // borderline... |
---|
| 3625 | + if (bRep != null || material != null) // borderline... |
---|
3511 | 3626 | marked = h; |
---|
3512 | 3627 | |
---|
3513 | 3628 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3517 | 3632 | continue; |
---|
3518 | 3633 | blockloop = true; |
---|
3519 | 3634 | child.MarkLeaves(h); |
---|
| 3635 | + blockloop = false; |
---|
| 3636 | + // release(i); |
---|
| 3637 | + } |
---|
| 3638 | + } |
---|
| 3639 | + |
---|
| 3640 | + void RewindLeaves(boolean h) |
---|
| 3641 | + { |
---|
| 3642 | + if (blockloop) |
---|
| 3643 | + return; |
---|
| 3644 | + |
---|
| 3645 | + if (bRep != null || material != null) // borderline... |
---|
| 3646 | + rewind = h; |
---|
| 3647 | + |
---|
| 3648 | + for (int i = 0; i < Size(); i++) |
---|
| 3649 | + { |
---|
| 3650 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3651 | + if (child == null) |
---|
| 3652 | + continue; |
---|
| 3653 | + blockloop = true; |
---|
| 3654 | + child.RewindLeaves(h); |
---|
| 3655 | + blockloop = false; |
---|
| 3656 | + // release(i); |
---|
| 3657 | + } |
---|
| 3658 | + } |
---|
| 3659 | + |
---|
| 3660 | + void RandomLeaves(boolean h) |
---|
| 3661 | + { |
---|
| 3662 | + if (blockloop) |
---|
| 3663 | + return; |
---|
| 3664 | + |
---|
| 3665 | + if (bRep != null || material != null) // borderline... |
---|
| 3666 | + random = h; |
---|
| 3667 | + |
---|
| 3668 | + for (int i = 0; i < Size(); i++) |
---|
| 3669 | + { |
---|
| 3670 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3671 | + if (child == null) |
---|
| 3672 | + continue; |
---|
| 3673 | + blockloop = true; |
---|
| 3674 | + child.RandomLeaves(h); |
---|
3520 | 3675 | blockloop = false; |
---|
3521 | 3676 | // release(i); |
---|
3522 | 3677 | } |
---|
.. | .. |
---|
4294 | 4449 | } |
---|
4295 | 4450 | } |
---|
4296 | 4451 | |
---|
| 4452 | + void RepairSOV() |
---|
| 4453 | + { |
---|
| 4454 | + if (blockloop) |
---|
| 4455 | + return; |
---|
| 4456 | + |
---|
| 4457 | + String texname = this.GetPigmentTexture(); |
---|
| 4458 | + |
---|
| 4459 | + if (texname.startsWith("sov")) |
---|
| 4460 | + { |
---|
| 4461 | + String[] s = texname.split("/"); |
---|
| 4462 | + |
---|
| 4463 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4464 | + |
---|
| 4465 | + texname = sname[0]; |
---|
| 4466 | + |
---|
| 4467 | + if (sname.length > 1) |
---|
| 4468 | + { |
---|
| 4469 | + texname += "Color.jpg"; |
---|
| 4470 | + } |
---|
| 4471 | + |
---|
| 4472 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4473 | + } |
---|
| 4474 | + |
---|
| 4475 | + texname = this.GetBumpTexture(); |
---|
| 4476 | + |
---|
| 4477 | + if (texname.startsWith("sov")) |
---|
| 4478 | + { |
---|
| 4479 | + String[] s = texname.split("/"); |
---|
| 4480 | + |
---|
| 4481 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4482 | + |
---|
| 4483 | + texname = sname[0]; |
---|
| 4484 | + |
---|
| 4485 | + if (sname.length > 1) |
---|
| 4486 | + { |
---|
| 4487 | + texname += "Bump.jpg"; |
---|
| 4488 | + } |
---|
| 4489 | + |
---|
| 4490 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4491 | + } |
---|
| 4492 | + |
---|
| 4493 | + for (int i=0; i<Size(); i++) |
---|
| 4494 | + { |
---|
| 4495 | + blockloop = true; |
---|
| 4496 | + get(i).RepairSOV(); |
---|
| 4497 | + blockloop = false; |
---|
| 4498 | + } |
---|
| 4499 | + } |
---|
| 4500 | + |
---|
4297 | 4501 | void RepairTexture() |
---|
4298 | 4502 | { |
---|
4299 | 4503 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4808 | 5012 | } |
---|
4809 | 5013 | } |
---|
4810 | 5014 | |
---|
| 5015 | + ObjEditor GetWindow() |
---|
| 5016 | + { |
---|
| 5017 | + if (editWindow != null) |
---|
| 5018 | + return editWindow; |
---|
| 5019 | + |
---|
| 5020 | + return manipWindow; |
---|
| 5021 | + } |
---|
| 5022 | + |
---|
4811 | 5023 | cTreePath Select(int indexcount, boolean deselect) |
---|
4812 | 5024 | { |
---|
4813 | 5025 | if (hide || dontselect) |
---|
.. | .. |
---|
4844 | 5056 | if (leaf != null) |
---|
4845 | 5057 | { |
---|
4846 | 5058 | cTreePath tp = new cTreePath(this, leaf); |
---|
4847 | | - if (editWindow != null) |
---|
| 5059 | + ObjEditor window = GetWindow(); |
---|
| 5060 | + if (window != null) |
---|
4848 | 5061 | { |
---|
4849 | 5062 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4850 | | - editWindow.Select(tp, deselect, true); |
---|
| 5063 | + window.Select(tp, deselect, true); |
---|
4851 | 5064 | } |
---|
4852 | 5065 | |
---|
4853 | 5066 | return tp; |
---|
.. | .. |
---|
4864 | 5077 | |
---|
4865 | 5078 | if (child == null) |
---|
4866 | 5079 | continue; |
---|
| 5080 | + |
---|
4867 | 5081 | if (child.HasTransparency() && child.size() != 0) |
---|
4868 | 5082 | { |
---|
4869 | 5083 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4873 | 5087 | if (leaf != null) |
---|
4874 | 5088 | { |
---|
4875 | 5089 | cTreePath tp = new cTreePath(this, leaf); |
---|
4876 | | - if (editWindow != null) |
---|
| 5090 | + ObjEditor window = GetWindow(); |
---|
| 5091 | + if (window != null) |
---|
4877 | 5092 | { |
---|
4878 | | - editWindow.Select(tp, deselect, true); |
---|
| 5093 | + window.Select(tp, deselect, true); |
---|
4879 | 5094 | } |
---|
4880 | 5095 | |
---|
4881 | 5096 | return tp; |
---|
.. | .. |
---|
5517 | 5732 | boolean NeedSupport() |
---|
5518 | 5733 | { |
---|
5519 | 5734 | return |
---|
5520 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 5735 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5521 | 5736 | // PROBLEM with CROWD!! |
---|
5522 | 5737 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5523 | 5738 | } |
---|
5524 | 5739 | |
---|
5525 | 5740 | static boolean DEBUG_SELECTION = false; |
---|
| 5741 | + |
---|
| 5742 | + boolean IsLive() |
---|
| 5743 | + { |
---|
| 5744 | + if (live) |
---|
| 5745 | + return true; |
---|
| 5746 | + |
---|
| 5747 | + if (parent == null) |
---|
| 5748 | + return false; |
---|
| 5749 | + |
---|
| 5750 | + return parent.IsLive(); |
---|
| 5751 | + } |
---|
5526 | 5752 | |
---|
5527 | 5753 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5528 | 5754 | { |
---|
.. | .. |
---|
5585 | 5811 | support = support; |
---|
5586 | 5812 | |
---|
5587 | 5813 | //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); |
---|
| 5814 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5589 | 5815 | |
---|
5590 | 5816 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5591 | 5817 | { |
---|
.. | .. |
---|
5605 | 5831 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5606 | 5832 | |
---|
5607 | 5833 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5608 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5834 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5835 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5609 | 5836 | { |
---|
5610 | 5837 | Globals.lighttouched = true; |
---|
5611 | 5838 | } // all panes... |
---|
| 5839 | + |
---|
5612 | 5840 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5613 | 5841 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5614 | 5842 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5736 | 5964 | if (GetBRep() != null) |
---|
5737 | 5965 | { |
---|
5738 | 5966 | display.NextIndex(); |
---|
| 5967 | + |
---|
5739 | 5968 | // vertex color conflict : gl.glCallList(list); |
---|
5740 | 5969 | DrawNode(display, root, selected); |
---|
5741 | 5970 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5776 | 6005 | tex = GetTextures(); |
---|
5777 | 6006 | } |
---|
5778 | 6007 | |
---|
5779 | | - boolean failed = false; |
---|
| 6008 | + boolean failedPigment = false; |
---|
| 6009 | + boolean failedBump = false; |
---|
5780 | 6010 | |
---|
5781 | 6011 | try |
---|
5782 | 6012 | { |
---|
5783 | | - display.BindTextures(tex, texres); |
---|
| 6013 | + display.BindPigmentTexture(tex, texres); |
---|
5784 | 6014 | } |
---|
5785 | 6015 | catch (Exception e) |
---|
5786 | 6016 | { |
---|
5787 | 6017 | System.err.println("FAILED: " + this); |
---|
5788 | | - failed = true; |
---|
| 6018 | + failedPigment = true; |
---|
| 6019 | + } |
---|
| 6020 | + |
---|
| 6021 | + try |
---|
| 6022 | + { |
---|
| 6023 | + display.BindBumpTexture(tex, texres); |
---|
| 6024 | + } |
---|
| 6025 | + catch (Exception e) |
---|
| 6026 | + { |
---|
| 6027 | + //System.err.println("FAILED: " + this); |
---|
| 6028 | + failedBump = true; |
---|
5789 | 6029 | } |
---|
5790 | 6030 | |
---|
5791 | 6031 | if (!compiled) |
---|
.. | .. |
---|
5808 | 6048 | } |
---|
5809 | 6049 | } |
---|
5810 | 6050 | |
---|
5811 | | - if (!failed) |
---|
5812 | | - display.ReleaseTextures(tex); |
---|
| 6051 | + if (!failedBump) |
---|
| 6052 | + display.ReleaseBumpTexture(tex); |
---|
| 6053 | + |
---|
| 6054 | + if (!failedPigment) |
---|
| 6055 | + display.ReleasePigmentTexture(tex); |
---|
5813 | 6056 | |
---|
5814 | 6057 | display.PopMaterial(this, selected); |
---|
5815 | 6058 | } |
---|
.. | .. |
---|
6182 | 6425 | // dec 2012 |
---|
6183 | 6426 | new Exception().printStackTrace(); |
---|
6184 | 6427 | return; |
---|
| 6428 | + } |
---|
| 6429 | + |
---|
| 6430 | + if (dontselect) |
---|
| 6431 | + { |
---|
| 6432 | + //bRep.GenerateNormalsMINE(); |
---|
6185 | 6433 | } |
---|
6186 | 6434 | |
---|
6187 | 6435 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7034 | 7282 | spot.translate(32, 32); |
---|
7035 | 7283 | spotw = spot.x + spot.width; |
---|
7036 | 7284 | spoth = spot.y + spot.height; |
---|
7037 | | - info.g.setColor(Color.blue); |
---|
| 7285 | + info.g.setColor(Color.cyan); |
---|
7038 | 7286 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7039 | 7287 | // if (CameraPane.Xmin > spot.x) |
---|
7040 | 7288 | // { |
---|
.. | .. |
---|
7052 | 7300 | // { |
---|
7053 | 7301 | // CameraPane.Ymax = spoth; |
---|
7054 | 7302 | // } |
---|
7055 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7056 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7303 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7304 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7057 | 7305 | spot.translate(0, -32); |
---|
7058 | | - info.g.setColor(Color.green); |
---|
| 7306 | + info.g.setColor(Color.yellow); |
---|
7059 | 7307 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7308 | + info.g.setColor(Color.green); |
---|
7060 | 7309 | // if (CameraPane.Xmin > spot.x) |
---|
7061 | 7310 | // { |
---|
7062 | 7311 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7073 | 7322 | // { |
---|
7074 | 7323 | // CameraPane.Ymax = spoth; |
---|
7075 | 7324 | // } |
---|
7076 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7077 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7325 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7326 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
7078 | 7327 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7079 | 7328 | // if (CameraPane.Xmin > boundary.x) |
---|
7080 | 7329 | // { |
---|
.. | .. |
---|
7374 | 7623 | switch (info.pane.RenderCamera().viewCode) |
---|
7375 | 7624 | { |
---|
7376 | 7625 | case 3: // '\001' |
---|
7377 | | - if (modified) |
---|
| 7626 | + if (modified || opposite) |
---|
7378 | 7627 | { |
---|
7379 | 7628 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7380 | 7629 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7381 | 7630 | } // vScale, 1); |
---|
7382 | 7631 | else |
---|
7383 | 7632 | { |
---|
| 7633 | + // EXCEPTION! |
---|
7384 | 7634 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7385 | 7635 | } // vScale, 1); |
---|
7386 | 7636 | break; |
---|
7387 | 7637 | |
---|
7388 | 7638 | case 2: // '\002' |
---|
7389 | | - if (modified) |
---|
| 7639 | + if (modified || opposite) |
---|
7390 | 7640 | { |
---|
7391 | 7641 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7392 | 7642 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7397 | 7647 | break; |
---|
7398 | 7648 | |
---|
7399 | 7649 | case 1: // '\003' |
---|
7400 | | - if (modified) |
---|
| 7650 | + if (modified || opposite) |
---|
7401 | 7651 | { |
---|
7402 | 7652 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7403 | 7653 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7617 | 7867 | editWindow = null; |
---|
7618 | 7868 | } // ? |
---|
7619 | 7869 | } |
---|
| 7870 | + else |
---|
| 7871 | + { |
---|
| 7872 | + //editWindow.closeUI(); |
---|
| 7873 | + } |
---|
7620 | 7874 | } |
---|
7621 | 7875 | |
---|
7622 | 7876 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7774 | 8028 | } |
---|
7775 | 8029 | |
---|
7776 | 8030 | transient ObjEditor editWindow; |
---|
| 8031 | + transient ObjEditor manipWindow; |
---|
| 8032 | + |
---|
| 8033 | + transient boolean pinned; |
---|
| 8034 | + |
---|
7777 | 8035 | transient ObjectUI objectUI; |
---|
7778 | 8036 | public static int povDepth = 0; |
---|
7779 | 8037 | private static cVector tbMin = new cVector(); |
---|