.. | .. |
---|
24 | 24 | |
---|
25 | 25 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 26 | |
---|
| 27 | + // TEMPORARY for mocap undo |
---|
| 28 | + mocap.reader.BVHReader.BVHResult bvh; |
---|
| 29 | + Object3D skeleton; |
---|
| 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 | + if (hashtable.containsKey(GetUUID())) |
---|
| 174 | + { |
---|
| 175 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 176 | + |
---|
| 177 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 178 | + if (this.bRep != null) |
---|
| 179 | + assert(this.bRep.support == o.transientrep); |
---|
| 180 | + |
---|
| 181 | + return; |
---|
| 182 | + } |
---|
| 183 | + |
---|
| 184 | + Object3D o = new Object3D("copy of " + this.name); |
---|
| 185 | + |
---|
| 186 | + hashtable.put(GetUUID(), o); |
---|
| 187 | + |
---|
| 188 | + for (int i=0; i<Size(); i++) |
---|
| 189 | + { |
---|
| 190 | + get(i).ExtractBigData(hashtable); |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + ExtractBigData(o); |
---|
| 194 | + } |
---|
| 195 | + |
---|
| 196 | + void ExtractBigData(Object3D o) |
---|
| 197 | + { |
---|
| 198 | + o.bRep = this.bRep; |
---|
| 199 | + if (this.bRep != null) |
---|
| 200 | + { |
---|
| 201 | + o.transientrep = this.bRep.support; |
---|
| 202 | + o.bRep.support = null; |
---|
| 203 | + } |
---|
| 204 | + |
---|
| 205 | + // o.support = this.support; |
---|
| 206 | + // o.fileparent = this.fileparent; |
---|
| 207 | + // if (this.bRep != null) |
---|
| 208 | + // o.bRep = this.bRep.support; |
---|
| 209 | + |
---|
| 210 | + this.bRep = null; |
---|
| 211 | + // if (this.bRep != null) |
---|
| 212 | + // this.bRep.support = null; |
---|
| 213 | + // this.support = null; |
---|
| 214 | + // this.fileparent = null; |
---|
| 215 | + } |
---|
| 216 | + |
---|
| 217 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 218 | + { |
---|
| 219 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 220 | + return; |
---|
| 221 | + |
---|
| 222 | + if (blockloop) |
---|
| 223 | + return; |
---|
| 224 | + |
---|
134 | 225 | blockloop = true; |
---|
135 | | - child.SaveSupports(); |
---|
136 | | - blockloop = false; |
---|
137 | | - } |
---|
138 | | -} |
---|
139 | 226 | |
---|
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) |
---|
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 | | -} |
---|
165 | | - |
---|
166 | | -void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
167 | | -{ |
---|
168 | | - if (hashtable.containsKey(GetUUID())) |
---|
169 | | - { |
---|
170 | 227 | Object3D o = hashtable.get(GetUUID()); |
---|
171 | 228 | |
---|
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 | | -} |
---|
| 229 | + RestoreBigData(o); |
---|
205 | 230 | |
---|
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); |
---|
| 231 | + //hashtable.remove(GetUUID()); |
---|
| 232 | + |
---|
| 233 | + for (int i=0; i<Size(); i++) |
---|
| 234 | + { |
---|
| 235 | + get(i).RestoreBigData(hashtable); |
---|
| 236 | + } |
---|
| 237 | + |
---|
| 238 | + blockloop = false; |
---|
224 | 239 | } |
---|
225 | | -} |
---|
| 240 | + |
---|
| 241 | + void RestoreBigData(Object3D o) |
---|
| 242 | + { |
---|
| 243 | + this.bRep = o.bRep; |
---|
| 244 | + if (this.bRep != null) |
---|
| 245 | + this.bRep.support = o.transientrep; |
---|
| 246 | + // this.support = o.support; |
---|
| 247 | + // this.fileparent = o.fileparent; |
---|
| 248 | + } |
---|
226 | 249 | |
---|
227 | 250 | // MOCAP SUPPORT |
---|
228 | 251 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
547 | 570 | toParent = LA.newMatrix(); |
---|
548 | 571 | fromParent = LA.newMatrix(); |
---|
549 | 572 | } |
---|
| 573 | + |
---|
550 | 574 | if (toParentMarked == null) |
---|
551 | 575 | { |
---|
552 | 576 | if (maxcount != 1) |
---|
553 | 577 | { |
---|
554 | 578 | new Exception().printStackTrace(); |
---|
555 | 579 | } |
---|
| 580 | + |
---|
556 | 581 | toParentMarked = LA.newMatrix(); |
---|
557 | 582 | fromParentMarked = LA.newMatrix(); |
---|
558 | 583 | } |
---|
.. | .. |
---|
863 | 888 | |
---|
864 | 889 | if (marked && Globals.isLIVE() && live && |
---|
865 | 890 | //TEMP21aug2018 |
---|
866 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 891 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
867 | 892 | currentframe != Globals.framecount) |
---|
868 | 893 | { |
---|
869 | 894 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
875 | 900 | |
---|
876 | 901 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
877 | 902 | |
---|
878 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 903 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 904 | + (step == 1 && changedir)) |
---|
879 | 905 | { |
---|
880 | 906 | countdown = 1; |
---|
881 | 907 | delay = speedup?8:1; |
---|
.. | .. |
---|
947 | 973 | if (material == null || material.multiply) |
---|
948 | 974 | return true; |
---|
949 | 975 | |
---|
| 976 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
950 | 977 | return material.opacity > 0.99; |
---|
951 | 978 | } |
---|
952 | 979 | |
---|
.. | .. |
---|
2368 | 2395 | } |
---|
2369 | 2396 | */ |
---|
2370 | 2397 | } |
---|
| 2398 | + else |
---|
| 2399 | + { |
---|
| 2400 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2401 | + } |
---|
2371 | 2402 | } |
---|
2372 | 2403 | |
---|
2373 | 2404 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2409 | 2440 | { |
---|
2410 | 2441 | editWindow.refreshContents(); |
---|
2411 | 2442 | } |
---|
| 2443 | + else |
---|
| 2444 | + { |
---|
| 2445 | + if (manipWindow != null) |
---|
| 2446 | + { |
---|
| 2447 | + manipWindow.refreshContents(); |
---|
| 2448 | + } |
---|
| 2449 | + } |
---|
| 2450 | + |
---|
2412 | 2451 | //if (parent != null) |
---|
2413 | 2452 | //parent.refreshEditWindow(); |
---|
2414 | 2453 | } |
---|
.. | .. |
---|
2693 | 2732 | //Touch(); |
---|
2694 | 2733 | } |
---|
2695 | 2734 | |
---|
| 2735 | + void GenNormalsMeshS() |
---|
| 2736 | + { |
---|
| 2737 | + selection.GenNormalsMesh(); |
---|
| 2738 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2739 | +// { |
---|
| 2740 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2741 | +// selectee.GenNormals(crease); |
---|
| 2742 | +// } |
---|
| 2743 | + |
---|
| 2744 | + //Touch(); |
---|
| 2745 | + } |
---|
| 2746 | + |
---|
2696 | 2747 | void ClearColorsS() |
---|
2697 | 2748 | { |
---|
2698 | 2749 | selection.ClearColors(); |
---|
.. | .. |
---|
2824 | 2875 | if (child == null) |
---|
2825 | 2876 | continue; |
---|
2826 | 2877 | child.GenNormals(crease); |
---|
| 2878 | +// Children().release(i); |
---|
| 2879 | + } |
---|
| 2880 | + blockloop = false; |
---|
| 2881 | + } |
---|
| 2882 | + |
---|
| 2883 | + void GenNormalsMesh() |
---|
| 2884 | + { |
---|
| 2885 | + if (blockloop) |
---|
| 2886 | + return; |
---|
| 2887 | + |
---|
| 2888 | + blockloop = true; |
---|
| 2889 | + GenNormalsMesh0(); |
---|
| 2890 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2891 | + { |
---|
| 2892 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2893 | + if (child == null) |
---|
| 2894 | + continue; |
---|
| 2895 | + child.GenNormalsMesh(); |
---|
2827 | 2896 | // Children().release(i); |
---|
2828 | 2897 | } |
---|
2829 | 2898 | blockloop = false; |
---|
.. | .. |
---|
2992 | 3061 | if (bRep != null) |
---|
2993 | 3062 | { |
---|
2994 | 3063 | bRep.GenerateNormals(crease); |
---|
| 3064 | + Touch(); |
---|
| 3065 | + } |
---|
| 3066 | + } |
---|
| 3067 | + |
---|
| 3068 | + void GenNormalsMesh0() |
---|
| 3069 | + { |
---|
| 3070 | + if (bRep != null) |
---|
| 3071 | + { |
---|
| 3072 | + bRep.GenerateNormalsMesh(); |
---|
2995 | 3073 | Touch(); |
---|
2996 | 3074 | } |
---|
2997 | 3075 | } |
---|
.. | .. |
---|
3446 | 3524 | if (blockloop) |
---|
3447 | 3525 | return; |
---|
3448 | 3526 | |
---|
3449 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3527 | + if (//marked || // does not make sense |
---|
| 3528 | + (bRep != null || material != null)) // borderline... |
---|
3450 | 3529 | live = h; |
---|
3451 | 3530 | |
---|
3452 | 3531 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3467 | 3546 | return; |
---|
3468 | 3547 | |
---|
3469 | 3548 | //if (bRep != null) |
---|
3470 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3549 | + if (//marked || // does not make sense |
---|
| 3550 | + (bRep != null || material != null)) // borderline... |
---|
3471 | 3551 | link2master = h; |
---|
3472 | 3552 | |
---|
3473 | 3553 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3487 | 3567 | if (blockloop) |
---|
3488 | 3568 | return; |
---|
3489 | 3569 | |
---|
3490 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3570 | + if (//marked || // does not make sense |
---|
| 3571 | + (bRep != null || material != null)) // borderline... |
---|
3491 | 3572 | hide = h; |
---|
3492 | 3573 | |
---|
3493 | 3574 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3507 | 3588 | if (blockloop) |
---|
3508 | 3589 | return; |
---|
3509 | 3590 | |
---|
3510 | | - if (bRep != null && material != null) // borderline... |
---|
| 3591 | + if (bRep != null || material != null) // borderline... |
---|
3511 | 3592 | marked = h; |
---|
3512 | 3593 | |
---|
3513 | 3594 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3517 | 3598 | continue; |
---|
3518 | 3599 | blockloop = true; |
---|
3519 | 3600 | child.MarkLeaves(h); |
---|
| 3601 | + blockloop = false; |
---|
| 3602 | + // release(i); |
---|
| 3603 | + } |
---|
| 3604 | + } |
---|
| 3605 | + |
---|
| 3606 | + void RewindLeaves(boolean h) |
---|
| 3607 | + { |
---|
| 3608 | + if (blockloop) |
---|
| 3609 | + return; |
---|
| 3610 | + |
---|
| 3611 | + if (bRep != null || material != null) // borderline... |
---|
| 3612 | + rewind = h; |
---|
| 3613 | + |
---|
| 3614 | + for (int i = 0; i < Size(); i++) |
---|
| 3615 | + { |
---|
| 3616 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3617 | + if (child == null) |
---|
| 3618 | + continue; |
---|
| 3619 | + blockloop = true; |
---|
| 3620 | + child.RewindLeaves(h); |
---|
| 3621 | + blockloop = false; |
---|
| 3622 | + // release(i); |
---|
| 3623 | + } |
---|
| 3624 | + } |
---|
| 3625 | + |
---|
| 3626 | + void RandomLeaves(boolean h) |
---|
| 3627 | + { |
---|
| 3628 | + if (blockloop) |
---|
| 3629 | + return; |
---|
| 3630 | + |
---|
| 3631 | + if (bRep != null || material != null) // borderline... |
---|
| 3632 | + random = h; |
---|
| 3633 | + |
---|
| 3634 | + for (int i = 0; i < Size(); i++) |
---|
| 3635 | + { |
---|
| 3636 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3637 | + if (child == null) |
---|
| 3638 | + continue; |
---|
| 3639 | + blockloop = true; |
---|
| 3640 | + child.RandomLeaves(h); |
---|
3520 | 3641 | blockloop = false; |
---|
3521 | 3642 | // release(i); |
---|
3522 | 3643 | } |
---|
.. | .. |
---|
4294 | 4415 | } |
---|
4295 | 4416 | } |
---|
4296 | 4417 | |
---|
| 4418 | + void RepairSOV() |
---|
| 4419 | + { |
---|
| 4420 | + if (blockloop) |
---|
| 4421 | + return; |
---|
| 4422 | + |
---|
| 4423 | + String texname = this.GetPigmentTexture(); |
---|
| 4424 | + |
---|
| 4425 | + if (texname.startsWith("sov")) |
---|
| 4426 | + { |
---|
| 4427 | + String[] s = texname.split("/"); |
---|
| 4428 | + |
---|
| 4429 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4430 | + |
---|
| 4431 | + texname = sname[0]; |
---|
| 4432 | + |
---|
| 4433 | + if (sname.length > 1) |
---|
| 4434 | + { |
---|
| 4435 | + texname += "Color.jpg"; |
---|
| 4436 | + } |
---|
| 4437 | + |
---|
| 4438 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4439 | + } |
---|
| 4440 | + |
---|
| 4441 | + texname = this.GetBumpTexture(); |
---|
| 4442 | + |
---|
| 4443 | + if (texname.startsWith("sov")) |
---|
| 4444 | + { |
---|
| 4445 | + String[] s = texname.split("/"); |
---|
| 4446 | + |
---|
| 4447 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4448 | + |
---|
| 4449 | + texname = sname[0]; |
---|
| 4450 | + |
---|
| 4451 | + if (sname.length > 1) |
---|
| 4452 | + { |
---|
| 4453 | + texname += "Bump.jpg"; |
---|
| 4454 | + } |
---|
| 4455 | + |
---|
| 4456 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4457 | + } |
---|
| 4458 | + |
---|
| 4459 | + for (int i=0; i<Size(); i++) |
---|
| 4460 | + { |
---|
| 4461 | + blockloop = true; |
---|
| 4462 | + get(i).RepairSOV(); |
---|
| 4463 | + blockloop = false; |
---|
| 4464 | + } |
---|
| 4465 | + } |
---|
| 4466 | + |
---|
4297 | 4467 | void RepairTexture() |
---|
4298 | 4468 | { |
---|
4299 | 4469 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4808 | 4978 | } |
---|
4809 | 4979 | } |
---|
4810 | 4980 | |
---|
| 4981 | + ObjEditor GetWindow() |
---|
| 4982 | + { |
---|
| 4983 | + if (editWindow != null) |
---|
| 4984 | + return editWindow; |
---|
| 4985 | + |
---|
| 4986 | + return manipWindow; |
---|
| 4987 | + } |
---|
| 4988 | + |
---|
4811 | 4989 | cTreePath Select(int indexcount, boolean deselect) |
---|
4812 | 4990 | { |
---|
4813 | 4991 | if (hide || dontselect) |
---|
.. | .. |
---|
4844 | 5022 | if (leaf != null) |
---|
4845 | 5023 | { |
---|
4846 | 5024 | cTreePath tp = new cTreePath(this, leaf); |
---|
4847 | | - if (editWindow != null) |
---|
| 5025 | + ObjEditor window = GetWindow(); |
---|
| 5026 | + if (window != null) |
---|
4848 | 5027 | { |
---|
4849 | 5028 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4850 | | - editWindow.Select(tp, deselect, true); |
---|
| 5029 | + window.Select(tp, deselect, true); |
---|
4851 | 5030 | } |
---|
4852 | 5031 | |
---|
4853 | 5032 | return tp; |
---|
.. | .. |
---|
4873 | 5052 | if (leaf != null) |
---|
4874 | 5053 | { |
---|
4875 | 5054 | cTreePath tp = new cTreePath(this, leaf); |
---|
4876 | | - if (editWindow != null) |
---|
| 5055 | + ObjEditor window = GetWindow(); |
---|
| 5056 | + if (window != null) |
---|
4877 | 5057 | { |
---|
4878 | | - editWindow.Select(tp, deselect, true); |
---|
| 5058 | + window.Select(tp, deselect, true); |
---|
4879 | 5059 | } |
---|
4880 | 5060 | |
---|
4881 | 5061 | return tp; |
---|
.. | .. |
---|
5517 | 5697 | boolean NeedSupport() |
---|
5518 | 5698 | { |
---|
5519 | 5699 | return |
---|
5520 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 5700 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5521 | 5701 | // PROBLEM with CROWD!! |
---|
5522 | 5702 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5523 | 5703 | } |
---|
5524 | 5704 | |
---|
5525 | 5705 | static boolean DEBUG_SELECTION = false; |
---|
| 5706 | + |
---|
| 5707 | + boolean IsLive() |
---|
| 5708 | + { |
---|
| 5709 | + if (live) |
---|
| 5710 | + return true; |
---|
| 5711 | + |
---|
| 5712 | + if (parent == null) |
---|
| 5713 | + return false; |
---|
| 5714 | + |
---|
| 5715 | + return parent.IsLive(); |
---|
| 5716 | + } |
---|
5526 | 5717 | |
---|
5527 | 5718 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5528 | 5719 | { |
---|
.. | .. |
---|
5585 | 5776 | support = support; |
---|
5586 | 5777 | |
---|
5587 | 5778 | //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); |
---|
| 5779 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5589 | 5780 | |
---|
5590 | 5781 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5591 | 5782 | { |
---|
.. | .. |
---|
5605 | 5796 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5606 | 5797 | |
---|
5607 | 5798 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5608 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5799 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5800 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
5609 | 5801 | { |
---|
5610 | 5802 | Globals.lighttouched = true; |
---|
5611 | 5803 | } // all panes... |
---|
| 5804 | + |
---|
5612 | 5805 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5613 | 5806 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5614 | 5807 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5776 | 5969 | tex = GetTextures(); |
---|
5777 | 5970 | } |
---|
5778 | 5971 | |
---|
5779 | | - boolean failed = false; |
---|
| 5972 | + boolean failedPigment = false; |
---|
| 5973 | + boolean failedBump = false; |
---|
5780 | 5974 | |
---|
5781 | 5975 | try |
---|
5782 | 5976 | { |
---|
5783 | | - display.BindTextures(tex, texres); |
---|
| 5977 | + display.BindPigmentTexture(tex, texres); |
---|
5784 | 5978 | } |
---|
5785 | 5979 | catch (Exception e) |
---|
5786 | 5980 | { |
---|
5787 | 5981 | System.err.println("FAILED: " + this); |
---|
5788 | | - failed = true; |
---|
| 5982 | + failedPigment = true; |
---|
| 5983 | + } |
---|
| 5984 | + |
---|
| 5985 | + try |
---|
| 5986 | + { |
---|
| 5987 | + display.BindBumpTexture(tex, texres); |
---|
| 5988 | + } |
---|
| 5989 | + catch (Exception e) |
---|
| 5990 | + { |
---|
| 5991 | + //System.err.println("FAILED: " + this); |
---|
| 5992 | + failedBump = true; |
---|
5789 | 5993 | } |
---|
5790 | 5994 | |
---|
5791 | 5995 | if (!compiled) |
---|
.. | .. |
---|
5808 | 6012 | } |
---|
5809 | 6013 | } |
---|
5810 | 6014 | |
---|
5811 | | - if (!failed) |
---|
5812 | | - display.ReleaseTextures(tex); |
---|
| 6015 | + if (!failedBump) |
---|
| 6016 | + display.ReleaseBumpTexture(tex); |
---|
| 6017 | + |
---|
| 6018 | + if (!failedPigment) |
---|
| 6019 | + display.ReleasePigmentTexture(tex); |
---|
5813 | 6020 | |
---|
5814 | 6021 | display.PopMaterial(this, selected); |
---|
5815 | 6022 | } |
---|
.. | .. |
---|
6182 | 6389 | // dec 2012 |
---|
6183 | 6390 | new Exception().printStackTrace(); |
---|
6184 | 6391 | return; |
---|
| 6392 | + } |
---|
| 6393 | + |
---|
| 6394 | + if (dontselect) |
---|
| 6395 | + { |
---|
| 6396 | + //bRep.GenerateNormalsMINE(); |
---|
6185 | 6397 | } |
---|
6186 | 6398 | |
---|
6187 | 6399 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7034 | 7246 | spot.translate(32, 32); |
---|
7035 | 7247 | spotw = spot.x + spot.width; |
---|
7036 | 7248 | spoth = spot.y + spot.height; |
---|
7037 | | - info.g.setColor(Color.blue); |
---|
| 7249 | + info.g.setColor(Color.cyan); |
---|
7038 | 7250 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7039 | 7251 | // if (CameraPane.Xmin > spot.x) |
---|
7040 | 7252 | // { |
---|
.. | .. |
---|
7052 | 7264 | // { |
---|
7053 | 7265 | // CameraPane.Ymax = spoth; |
---|
7054 | 7266 | // } |
---|
7055 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7056 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7267 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7268 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7057 | 7269 | spot.translate(0, -32); |
---|
7058 | | - info.g.setColor(Color.green); |
---|
| 7270 | + info.g.setColor(Color.yellow); |
---|
7059 | 7271 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7272 | + info.g.setColor(Color.green); |
---|
7060 | 7273 | // if (CameraPane.Xmin > spot.x) |
---|
7061 | 7274 | // { |
---|
7062 | 7275 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7374 | 7587 | switch (info.pane.RenderCamera().viewCode) |
---|
7375 | 7588 | { |
---|
7376 | 7589 | case 3: // '\001' |
---|
7377 | | - if (modified) |
---|
| 7590 | + if (modified || opposite) |
---|
7378 | 7591 | { |
---|
7379 | 7592 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7380 | 7593 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7381 | 7594 | } // vScale, 1); |
---|
7382 | 7595 | else |
---|
7383 | 7596 | { |
---|
| 7597 | + // EXCEPTION! |
---|
7384 | 7598 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7385 | 7599 | } // vScale, 1); |
---|
7386 | 7600 | break; |
---|
7387 | 7601 | |
---|
7388 | 7602 | case 2: // '\002' |
---|
7389 | | - if (modified) |
---|
| 7603 | + if (modified || opposite) |
---|
7390 | 7604 | { |
---|
7391 | 7605 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7392 | 7606 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7397 | 7611 | break; |
---|
7398 | 7612 | |
---|
7399 | 7613 | case 1: // '\003' |
---|
7400 | | - if (modified) |
---|
| 7614 | + if (modified || opposite) |
---|
7401 | 7615 | { |
---|
7402 | 7616 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7403 | 7617 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7617 | 7831 | editWindow = null; |
---|
7618 | 7832 | } // ? |
---|
7619 | 7833 | } |
---|
| 7834 | + else |
---|
| 7835 | + { |
---|
| 7836 | + //editWindow.closeUI(); |
---|
| 7837 | + } |
---|
7620 | 7838 | } |
---|
7621 | 7839 | |
---|
7622 | 7840 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7774 | 7992 | } |
---|
7775 | 7993 | |
---|
7776 | 7994 | transient ObjEditor editWindow; |
---|
| 7995 | + transient ObjEditor manipWindow; |
---|
| 7996 | + |
---|
7777 | 7997 | transient ObjectUI objectUI; |
---|
7778 | 7998 | public static int povDepth = 0; |
---|
7779 | 7999 | private static cVector tbMin = new cVector(); |
---|