.. | .. |
---|
14 | 14 | import //weka.core. |
---|
15 | 15 | matrix.Matrix; |
---|
16 | 16 | |
---|
| 17 | +import java.util.UUID; |
---|
| 18 | + |
---|
17 | 19 | //import net.sourceforge.sizeof.SizeOf; |
---|
18 | 20 | public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D> |
---|
19 | 21 | { |
---|
20 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
21 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
22 | 24 | |
---|
| 25 | + private UUID uuid = UUID.randomUUID(); |
---|
| 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 | + |
---|
23 | 35 | ScriptNode scriptnode; |
---|
24 | 36 | |
---|
25 | 37 | void InitOthers() |
---|
.. | .. |
---|
100 | 112 | |
---|
101 | 113 | // transient boolean reduced; // for morph reduction |
---|
102 | 114 | |
---|
103 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
104 | | -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 |
---|
105 | 117 | |
---|
106 | | -transient Object3D transientsupport; // for cloning |
---|
107 | | -transient boolean transientlink2master; |
---|
| 118 | + transient Object3D transientsupport; // for cloning |
---|
| 119 | + transient boolean transientlink2master; |
---|
108 | 120 | |
---|
109 | | -void SaveSupports() |
---|
110 | | -{ |
---|
111 | | - if (blockloop) |
---|
112 | | - return; |
---|
113 | | - |
---|
114 | | - transientsupport = support; |
---|
115 | | - transientlink2master = link2master; |
---|
116 | | - |
---|
117 | | - support = null; |
---|
118 | | - link2master = false; |
---|
119 | | - |
---|
120 | | - if (bRep != null) |
---|
| 121 | + void SaveSupports() |
---|
121 | 122 | { |
---|
122 | | - 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 | + } |
---|
123 | 146 | } |
---|
124 | | - |
---|
125 | | - for (int i = 0; i < Size(); i++) |
---|
| 147 | + |
---|
| 148 | + void RestoreSupports() |
---|
126 | 149 | { |
---|
127 | | - Object3D child = (Object3D) get(i); |
---|
128 | | - if (child == null) |
---|
129 | | - continue; |
---|
| 150 | + if (blockloop) |
---|
| 151 | + return; |
---|
| 152 | + |
---|
| 153 | + support = transientsupport; |
---|
| 154 | + link2master = transientlink2master; |
---|
| 155 | + transientsupport = null; |
---|
| 156 | + transientlink2master = false; |
---|
| 157 | + |
---|
| 158 | + if (bRep != null) |
---|
| 159 | + { |
---|
| 160 | + bRep.RestoreSupports(); |
---|
| 161 | + } |
---|
| 162 | + |
---|
| 163 | + for (int i = 0; i < Size(); i++) |
---|
| 164 | + { |
---|
| 165 | + Object3D child = (Object3D) get(i); |
---|
| 166 | + if (child == null) |
---|
| 167 | + continue; |
---|
| 168 | + blockloop = true; |
---|
| 169 | + child.RestoreSupports(); |
---|
| 170 | + blockloop = false; |
---|
| 171 | + } |
---|
| 172 | + } |
---|
| 173 | + |
---|
| 174 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 175 | + { |
---|
| 176 | + Object3D o; |
---|
| 177 | + |
---|
| 178 | + if (hashtable.containsKey(GetUUID())) |
---|
| 179 | + { |
---|
| 180 | + o = hashtable.get(GetUUID()); |
---|
| 181 | + |
---|
| 182 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 183 | + //if (this.bRep != null) |
---|
| 184 | + // assert(this.bRep.support == o.transientrep); |
---|
| 185 | + if (this.support != null) |
---|
| 186 | + assert(this.support.bRep == o.transientrep); |
---|
| 187 | + } |
---|
| 188 | + else |
---|
| 189 | + { |
---|
| 190 | + o = new Object3D("copy of " + this.name); |
---|
| 191 | + |
---|
| 192 | + hashtable.put(GetUUID(), o); |
---|
| 193 | + } |
---|
| 194 | + |
---|
| 195 | + if (!blockloop) |
---|
| 196 | + { |
---|
| 197 | + blockloop = true; |
---|
| 198 | + |
---|
| 199 | + for (int i=0; i<Size(); i++) |
---|
| 200 | + { |
---|
| 201 | + get(i).ExtractBigData(hashtable); |
---|
| 202 | + } |
---|
| 203 | + |
---|
| 204 | + blockloop = false; |
---|
| 205 | + } |
---|
| 206 | + |
---|
| 207 | + ExtractBigData(o); |
---|
| 208 | + } |
---|
| 209 | + |
---|
| 210 | + void ExtractBigData(Object3D o) |
---|
| 211 | + { |
---|
| 212 | + if (o.bRep != null) |
---|
| 213 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 214 | + |
---|
| 215 | + o.bRep = this.bRep; |
---|
| 216 | +// July 2019 if (this.bRep != null) |
---|
| 217 | +// { |
---|
| 218 | +// o.transientrep = this.bRep.support; |
---|
| 219 | +// o.bRep.support = null; |
---|
| 220 | +// } |
---|
| 221 | + o.selection = this.selection; |
---|
| 222 | + o.versions = this.versions; |
---|
| 223 | + o.versionindex = this.versionindex; |
---|
| 224 | + |
---|
| 225 | + if (this.support != null) |
---|
| 226 | + { |
---|
| 227 | + if (o.transientrep != null) |
---|
| 228 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 229 | + |
---|
| 230 | + o.transientrep = this.support.bRep; |
---|
| 231 | + this.support.bRep = null; |
---|
| 232 | + } |
---|
| 233 | + |
---|
| 234 | + // o.support = this.support; |
---|
| 235 | + // o.fileparent = this.fileparent; |
---|
| 236 | + // if (this.bRep != null) |
---|
| 237 | + // o.bRep = this.bRep.support; |
---|
| 238 | + |
---|
| 239 | + this.bRep = null; |
---|
| 240 | + // if (this.bRep != null) |
---|
| 241 | + // this.bRep.support = null; |
---|
| 242 | + // this.support = null; |
---|
| 243 | + // this.fileparent = null; |
---|
| 244 | + } |
---|
| 245 | + |
---|
| 246 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 247 | + { |
---|
| 248 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 249 | + return; |
---|
| 250 | + |
---|
| 251 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 252 | + |
---|
| 253 | + RestoreBigData(o); |
---|
| 254 | + |
---|
| 255 | + if (blockloop) |
---|
| 256 | + return; |
---|
| 257 | + |
---|
130 | 258 | blockloop = true; |
---|
131 | | - child.SaveSupports(); |
---|
| 259 | + |
---|
| 260 | + //hashtable.remove(GetUUID()); |
---|
| 261 | + |
---|
| 262 | + for (int i=0; i<Size(); i++) |
---|
| 263 | + { |
---|
| 264 | + get(i).RestoreBigData(hashtable); |
---|
| 265 | + } |
---|
| 266 | + |
---|
132 | 267 | blockloop = false; |
---|
133 | 268 | } |
---|
134 | | -} |
---|
135 | 269 | |
---|
136 | | -void RestoreSupports() |
---|
137 | | -{ |
---|
138 | | - if (blockloop) |
---|
139 | | - return; |
---|
140 | | - |
---|
141 | | - support = transientsupport; |
---|
142 | | - link2master = transientlink2master; |
---|
143 | | - transientsupport = null; |
---|
144 | | - transientlink2master = false; |
---|
145 | | - |
---|
146 | | - if (bRep != null) |
---|
| 270 | + void RestoreBigData(Object3D o) |
---|
147 | 271 | { |
---|
148 | | - bRep.RestoreSupports(); |
---|
| 272 | + this.bRep = o.bRep; |
---|
| 273 | + if (this.support != null && o.transientrep != null) |
---|
| 274 | + { |
---|
| 275 | + this.support.bRep = o.transientrep; |
---|
| 276 | + } |
---|
| 277 | + |
---|
| 278 | + this.selection = o.selection; |
---|
| 279 | + |
---|
| 280 | + this.versions = o.versions; |
---|
| 281 | + this.versionindex = o.versionindex; |
---|
| 282 | +// July 2019 if (this.bRep != null) |
---|
| 283 | +// this.bRep.support = o.transientrep; |
---|
| 284 | + // this.support = o.support; |
---|
| 285 | + // this.fileparent = o.fileparent; |
---|
149 | 286 | } |
---|
150 | | - |
---|
151 | | - for (int i = 0; i < Size(); i++) |
---|
152 | | - { |
---|
153 | | - Object3D child = (Object3D) get(i); |
---|
154 | | - if (child == null) |
---|
155 | | - continue; |
---|
156 | | - blockloop = true; |
---|
157 | | - child.RestoreSupports(); |
---|
158 | | - blockloop = false; |
---|
159 | | - } |
---|
160 | | -} |
---|
161 | 287 | |
---|
162 | 288 | // MOCAP SUPPORT |
---|
163 | 289 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
482 | 608 | toParent = LA.newMatrix(); |
---|
483 | 609 | fromParent = LA.newMatrix(); |
---|
484 | 610 | } |
---|
| 611 | + |
---|
485 | 612 | if (toParentMarked == null) |
---|
486 | 613 | { |
---|
487 | 614 | if (maxcount != 1) |
---|
488 | 615 | { |
---|
489 | 616 | new Exception().printStackTrace(); |
---|
490 | 617 | } |
---|
| 618 | + |
---|
491 | 619 | toParentMarked = LA.newMatrix(); |
---|
492 | 620 | fromParentMarked = LA.newMatrix(); |
---|
493 | 621 | } |
---|
.. | .. |
---|
798 | 926 | |
---|
799 | 927 | if (marked && Globals.isLIVE() && live && |
---|
800 | 928 | //TEMP21aug2018 |
---|
801 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 929 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
802 | 930 | currentframe != Globals.framecount) |
---|
803 | 931 | { |
---|
804 | 932 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
810 | 938 | |
---|
811 | 939 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
812 | 940 | |
---|
813 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 941 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 942 | + (step == 1 && changedir)) |
---|
814 | 943 | { |
---|
815 | 944 | countdown = 1; |
---|
816 | 945 | delay = speedup?8:1; |
---|
.. | .. |
---|
882 | 1011 | if (material == null || material.multiply) |
---|
883 | 1012 | return true; |
---|
884 | 1013 | |
---|
| 1014 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
885 | 1015 | return material.opacity > 0.99; |
---|
886 | 1016 | } |
---|
887 | 1017 | |
---|
.. | .. |
---|
1282 | 1412 | toParent = LA.newMatrix(); |
---|
1283 | 1413 | fromParent = LA.newMatrix(); |
---|
1284 | 1414 | } |
---|
| 1415 | + |
---|
1285 | 1416 | LA.matCopy(other.toParent, toParent); |
---|
1286 | 1417 | LA.matCopy(other.fromParent, fromParent); |
---|
1287 | 1418 | |
---|
.. | .. |
---|
2303 | 2434 | } |
---|
2304 | 2435 | */ |
---|
2305 | 2436 | } |
---|
| 2437 | + else |
---|
| 2438 | + { |
---|
| 2439 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2440 | + } |
---|
2306 | 2441 | } |
---|
2307 | 2442 | |
---|
2308 | 2443 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2344 | 2479 | { |
---|
2345 | 2480 | editWindow.refreshContents(); |
---|
2346 | 2481 | } |
---|
| 2482 | + else |
---|
| 2483 | + { |
---|
| 2484 | + if (manipWindow != null) |
---|
| 2485 | + { |
---|
| 2486 | + manipWindow.refreshContents(); |
---|
| 2487 | + } |
---|
| 2488 | + } |
---|
| 2489 | + |
---|
2347 | 2490 | //if (parent != null) |
---|
2348 | 2491 | //parent.refreshEditWindow(); |
---|
2349 | 2492 | } |
---|
.. | .. |
---|
2628 | 2771 | //Touch(); |
---|
2629 | 2772 | } |
---|
2630 | 2773 | |
---|
| 2774 | + void GenNormalsMeshS() |
---|
| 2775 | + { |
---|
| 2776 | + selection.GenNormalsMesh(); |
---|
| 2777 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2778 | +// { |
---|
| 2779 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2780 | +// selectee.GenNormals(crease); |
---|
| 2781 | +// } |
---|
| 2782 | + |
---|
| 2783 | + //Touch(); |
---|
| 2784 | + } |
---|
| 2785 | + |
---|
2631 | 2786 | void ClearColorsS() |
---|
2632 | 2787 | { |
---|
2633 | 2788 | selection.ClearColors(); |
---|
.. | .. |
---|
2759 | 2914 | if (child == null) |
---|
2760 | 2915 | continue; |
---|
2761 | 2916 | child.GenNormals(crease); |
---|
| 2917 | +// Children().release(i); |
---|
| 2918 | + } |
---|
| 2919 | + blockloop = false; |
---|
| 2920 | + } |
---|
| 2921 | + |
---|
| 2922 | + void GenNormalsMesh() |
---|
| 2923 | + { |
---|
| 2924 | + if (blockloop) |
---|
| 2925 | + return; |
---|
| 2926 | + |
---|
| 2927 | + blockloop = true; |
---|
| 2928 | + GenNormalsMesh0(); |
---|
| 2929 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2930 | + { |
---|
| 2931 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2932 | + if (child == null) |
---|
| 2933 | + continue; |
---|
| 2934 | + child.GenNormalsMesh(); |
---|
2762 | 2935 | // Children().release(i); |
---|
2763 | 2936 | } |
---|
2764 | 2937 | blockloop = false; |
---|
.. | .. |
---|
2927 | 3100 | if (bRep != null) |
---|
2928 | 3101 | { |
---|
2929 | 3102 | bRep.GenerateNormals(crease); |
---|
| 3103 | + Touch(); |
---|
| 3104 | + } |
---|
| 3105 | + } |
---|
| 3106 | + |
---|
| 3107 | + void GenNormalsMesh0() |
---|
| 3108 | + { |
---|
| 3109 | + if (bRep != null) |
---|
| 3110 | + { |
---|
| 3111 | + bRep.GenerateNormalsMesh(); |
---|
2930 | 3112 | Touch(); |
---|
2931 | 3113 | } |
---|
2932 | 3114 | } |
---|
.. | .. |
---|
3381 | 3563 | if (blockloop) |
---|
3382 | 3564 | return; |
---|
3383 | 3565 | |
---|
3384 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3566 | + if (//marked || // does not make sense |
---|
| 3567 | + (bRep != null || material != null)) // borderline... |
---|
3385 | 3568 | live = h; |
---|
3386 | 3569 | |
---|
3387 | 3570 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3402 | 3585 | return; |
---|
3403 | 3586 | |
---|
3404 | 3587 | //if (bRep != null) |
---|
3405 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3588 | + if (//marked || // does not make sense |
---|
| 3589 | + (bRep != null || material != null)) // borderline... |
---|
3406 | 3590 | link2master = h; |
---|
3407 | 3591 | |
---|
3408 | 3592 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3422 | 3606 | if (blockloop) |
---|
3423 | 3607 | return; |
---|
3424 | 3608 | |
---|
3425 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3609 | + if (//marked || // does not make sense |
---|
| 3610 | + (bRep != null || material != null)) // borderline... |
---|
3426 | 3611 | hide = h; |
---|
3427 | 3612 | |
---|
3428 | 3613 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3442 | 3627 | if (blockloop) |
---|
3443 | 3628 | return; |
---|
3444 | 3629 | |
---|
3445 | | - if (bRep != null && material != null) // borderline... |
---|
| 3630 | + if (bRep != null || material != null) // borderline... |
---|
3446 | 3631 | marked = h; |
---|
3447 | 3632 | |
---|
3448 | 3633 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3452 | 3637 | continue; |
---|
3453 | 3638 | blockloop = true; |
---|
3454 | 3639 | child.MarkLeaves(h); |
---|
| 3640 | + blockloop = false; |
---|
| 3641 | + // release(i); |
---|
| 3642 | + } |
---|
| 3643 | + } |
---|
| 3644 | + |
---|
| 3645 | + void RewindLeaves(boolean h) |
---|
| 3646 | + { |
---|
| 3647 | + if (blockloop) |
---|
| 3648 | + return; |
---|
| 3649 | + |
---|
| 3650 | + if (bRep != null || material != null) // borderline... |
---|
| 3651 | + rewind = h; |
---|
| 3652 | + |
---|
| 3653 | + for (int i = 0; i < Size(); i++) |
---|
| 3654 | + { |
---|
| 3655 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3656 | + if (child == null) |
---|
| 3657 | + continue; |
---|
| 3658 | + blockloop = true; |
---|
| 3659 | + child.RewindLeaves(h); |
---|
| 3660 | + blockloop = false; |
---|
| 3661 | + // release(i); |
---|
| 3662 | + } |
---|
| 3663 | + } |
---|
| 3664 | + |
---|
| 3665 | + void RandomLeaves(boolean h) |
---|
| 3666 | + { |
---|
| 3667 | + if (blockloop) |
---|
| 3668 | + return; |
---|
| 3669 | + |
---|
| 3670 | + if (bRep != null || material != null) // borderline... |
---|
| 3671 | + random = h; |
---|
| 3672 | + |
---|
| 3673 | + for (int i = 0; i < Size(); i++) |
---|
| 3674 | + { |
---|
| 3675 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3676 | + if (child == null) |
---|
| 3677 | + continue; |
---|
| 3678 | + blockloop = true; |
---|
| 3679 | + child.RandomLeaves(h); |
---|
3455 | 3680 | blockloop = false; |
---|
3456 | 3681 | // release(i); |
---|
3457 | 3682 | } |
---|
.. | .. |
---|
4229 | 4454 | } |
---|
4230 | 4455 | } |
---|
4231 | 4456 | |
---|
| 4457 | + void RepairSOV() |
---|
| 4458 | + { |
---|
| 4459 | + if (blockloop) |
---|
| 4460 | + return; |
---|
| 4461 | + |
---|
| 4462 | + String texname = this.GetPigmentTexture(); |
---|
| 4463 | + |
---|
| 4464 | + if (texname.startsWith("sov")) |
---|
| 4465 | + { |
---|
| 4466 | + String[] s = texname.split("/"); |
---|
| 4467 | + |
---|
| 4468 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4469 | + |
---|
| 4470 | + texname = sname[0]; |
---|
| 4471 | + |
---|
| 4472 | + if (sname.length > 1) |
---|
| 4473 | + { |
---|
| 4474 | + texname += "Color.jpg"; |
---|
| 4475 | + } |
---|
| 4476 | + |
---|
| 4477 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4478 | + } |
---|
| 4479 | + |
---|
| 4480 | + texname = this.GetBumpTexture(); |
---|
| 4481 | + |
---|
| 4482 | + if (texname.startsWith("sov")) |
---|
| 4483 | + { |
---|
| 4484 | + String[] s = texname.split("/"); |
---|
| 4485 | + |
---|
| 4486 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4487 | + |
---|
| 4488 | + texname = sname[0]; |
---|
| 4489 | + |
---|
| 4490 | + if (sname.length > 1) |
---|
| 4491 | + { |
---|
| 4492 | + texname += "Bump.jpg"; |
---|
| 4493 | + } |
---|
| 4494 | + |
---|
| 4495 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4496 | + } |
---|
| 4497 | + |
---|
| 4498 | + for (int i=0; i<Size(); i++) |
---|
| 4499 | + { |
---|
| 4500 | + blockloop = true; |
---|
| 4501 | + get(i).RepairSOV(); |
---|
| 4502 | + blockloop = false; |
---|
| 4503 | + } |
---|
| 4504 | + } |
---|
| 4505 | + |
---|
4232 | 4506 | void RepairTexture() |
---|
4233 | 4507 | { |
---|
4234 | 4508 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4743 | 5017 | } |
---|
4744 | 5018 | } |
---|
4745 | 5019 | |
---|
| 5020 | + ObjEditor GetWindow() |
---|
| 5021 | + { |
---|
| 5022 | + if (editWindow != null) |
---|
| 5023 | + return editWindow; |
---|
| 5024 | + |
---|
| 5025 | + return manipWindow; |
---|
| 5026 | + } |
---|
| 5027 | + |
---|
4746 | 5028 | cTreePath Select(int indexcount, boolean deselect) |
---|
4747 | 5029 | { |
---|
4748 | 5030 | if (hide || dontselect) |
---|
.. | .. |
---|
4779 | 5061 | if (leaf != null) |
---|
4780 | 5062 | { |
---|
4781 | 5063 | cTreePath tp = new cTreePath(this, leaf); |
---|
4782 | | - if (editWindow != null) |
---|
| 5064 | + ObjEditor window = GetWindow(); |
---|
| 5065 | + if (window != null) |
---|
4783 | 5066 | { |
---|
4784 | 5067 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4785 | | - editWindow.Select(tp, deselect, true); |
---|
| 5068 | + window.Select(tp, deselect, true); |
---|
4786 | 5069 | } |
---|
4787 | 5070 | |
---|
4788 | 5071 | return tp; |
---|
.. | .. |
---|
4799 | 5082 | |
---|
4800 | 5083 | if (child == null) |
---|
4801 | 5084 | continue; |
---|
| 5085 | + |
---|
4802 | 5086 | if (child.HasTransparency() && child.size() != 0) |
---|
4803 | 5087 | { |
---|
4804 | 5088 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4808 | 5092 | if (leaf != null) |
---|
4809 | 5093 | { |
---|
4810 | 5094 | cTreePath tp = new cTreePath(this, leaf); |
---|
4811 | | - if (editWindow != null) |
---|
| 5095 | + ObjEditor window = GetWindow(); |
---|
| 5096 | + if (window != null) |
---|
4812 | 5097 | { |
---|
4813 | | - editWindow.Select(tp, deselect, true); |
---|
| 5098 | + window.Select(tp, deselect, true); |
---|
4814 | 5099 | } |
---|
4815 | 5100 | |
---|
4816 | 5101 | return tp; |
---|
.. | .. |
---|
5371 | 5656 | } |
---|
5372 | 5657 | } |
---|
5373 | 5658 | |
---|
| 5659 | + UUID GetUUID() |
---|
| 5660 | + { |
---|
| 5661 | + if (uuid == null) |
---|
| 5662 | + { |
---|
| 5663 | + // Serial |
---|
| 5664 | + uuid = UUID.randomUUID(); |
---|
| 5665 | + } |
---|
| 5666 | + |
---|
| 5667 | + return uuid; |
---|
| 5668 | + } |
---|
| 5669 | + |
---|
| 5670 | + Object3D GetObject(UUID uid) |
---|
| 5671 | + { |
---|
| 5672 | + if (blockloop) |
---|
| 5673 | + return null; |
---|
| 5674 | + |
---|
| 5675 | + if (GetUUID().equals(uid)) |
---|
| 5676 | + return this; |
---|
| 5677 | + |
---|
| 5678 | + int nb = Size(); |
---|
| 5679 | + for (int i = 0; i < nb; i++) |
---|
| 5680 | + { |
---|
| 5681 | + Object3D child = (Object3D) get(i); |
---|
| 5682 | + |
---|
| 5683 | + if (child == null) |
---|
| 5684 | + continue; |
---|
| 5685 | + |
---|
| 5686 | + blockloop = true; |
---|
| 5687 | + Object3D obj = child.GetObject(uid); |
---|
| 5688 | + blockloop = false; |
---|
| 5689 | + if (obj != null) |
---|
| 5690 | + return obj; |
---|
| 5691 | + } |
---|
| 5692 | + |
---|
| 5693 | + return null; |
---|
| 5694 | + } |
---|
| 5695 | + |
---|
5374 | 5696 | void SetBumpTexture(String tex) |
---|
5375 | 5697 | { |
---|
5376 | 5698 | if (GetTextures() == null) |
---|
.. | .. |
---|
5415 | 5737 | boolean NeedSupport() |
---|
5416 | 5738 | { |
---|
5417 | 5739 | return |
---|
5418 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 5740 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5419 | 5741 | // PROBLEM with CROWD!! |
---|
5420 | 5742 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5421 | 5743 | } |
---|
5422 | 5744 | |
---|
5423 | 5745 | static boolean DEBUG_SELECTION = false; |
---|
| 5746 | + |
---|
| 5747 | + boolean IsLive() |
---|
| 5748 | + { |
---|
| 5749 | + if (live) |
---|
| 5750 | + return true; |
---|
| 5751 | + |
---|
| 5752 | + if (parent == null) |
---|
| 5753 | + return false; |
---|
| 5754 | + |
---|
| 5755 | + return parent.IsLive(); |
---|
| 5756 | + } |
---|
5424 | 5757 | |
---|
5425 | 5758 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5426 | 5759 | { |
---|
.. | .. |
---|
5483 | 5816 | support = support; |
---|
5484 | 5817 | |
---|
5485 | 5818 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5486 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5819 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5487 | 5820 | |
---|
5488 | 5821 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5489 | 5822 | { |
---|
.. | .. |
---|
5503 | 5836 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5504 | 5837 | |
---|
5505 | 5838 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5506 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5839 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5840 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5507 | 5841 | { |
---|
5508 | 5842 | Globals.lighttouched = true; |
---|
5509 | 5843 | } // all panes... |
---|
| 5844 | + |
---|
5510 | 5845 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5511 | 5846 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5512 | 5847 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5634 | 5969 | if (GetBRep() != null) |
---|
5635 | 5970 | { |
---|
5636 | 5971 | display.NextIndex(); |
---|
| 5972 | + |
---|
5637 | 5973 | // vertex color conflict : gl.glCallList(list); |
---|
5638 | 5974 | DrawNode(display, root, selected); |
---|
5639 | 5975 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5674 | 6010 | tex = GetTextures(); |
---|
5675 | 6011 | } |
---|
5676 | 6012 | |
---|
5677 | | - boolean failed = false; |
---|
| 6013 | + boolean failedPigment = false; |
---|
| 6014 | + boolean failedBump = false; |
---|
5678 | 6015 | |
---|
5679 | 6016 | try |
---|
5680 | 6017 | { |
---|
5681 | | - display.BindTextures(tex, texres); |
---|
| 6018 | + display.BindPigmentTexture(tex, texres); |
---|
5682 | 6019 | } |
---|
5683 | 6020 | catch (Exception e) |
---|
5684 | 6021 | { |
---|
5685 | 6022 | System.err.println("FAILED: " + this); |
---|
5686 | | - failed = true; |
---|
| 6023 | + failedPigment = true; |
---|
| 6024 | + } |
---|
| 6025 | + |
---|
| 6026 | + try |
---|
| 6027 | + { |
---|
| 6028 | + display.BindBumpTexture(tex, texres); |
---|
| 6029 | + } |
---|
| 6030 | + catch (Exception e) |
---|
| 6031 | + { |
---|
| 6032 | + //System.err.println("FAILED: " + this); |
---|
| 6033 | + failedBump = true; |
---|
5687 | 6034 | } |
---|
5688 | 6035 | |
---|
5689 | 6036 | if (!compiled) |
---|
.. | .. |
---|
5706 | 6053 | } |
---|
5707 | 6054 | } |
---|
5708 | 6055 | |
---|
5709 | | - if (!failed) |
---|
5710 | | - display.ReleaseTextures(tex); |
---|
| 6056 | + if (!failedBump) |
---|
| 6057 | + display.ReleaseBumpTexture(tex); |
---|
| 6058 | + |
---|
| 6059 | + if (!failedPigment) |
---|
| 6060 | + display.ReleasePigmentTexture(tex); |
---|
5711 | 6061 | |
---|
5712 | 6062 | display.PopMaterial(this, selected); |
---|
5713 | 6063 | } |
---|
.. | .. |
---|
6080 | 6430 | // dec 2012 |
---|
6081 | 6431 | new Exception().printStackTrace(); |
---|
6082 | 6432 | return; |
---|
| 6433 | + } |
---|
| 6434 | + |
---|
| 6435 | + if (dontselect) |
---|
| 6436 | + { |
---|
| 6437 | + //bRep.GenerateNormalsMINE(); |
---|
6083 | 6438 | } |
---|
6084 | 6439 | |
---|
6085 | 6440 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6932 | 7287 | spot.translate(32, 32); |
---|
6933 | 7288 | spotw = spot.x + spot.width; |
---|
6934 | 7289 | spoth = spot.y + spot.height; |
---|
6935 | | - info.g.setColor(Color.blue); |
---|
| 7290 | + info.g.setColor(Color.cyan); |
---|
6936 | 7291 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6937 | 7292 | // if (CameraPane.Xmin > spot.x) |
---|
6938 | 7293 | // { |
---|
.. | .. |
---|
6950 | 7305 | // { |
---|
6951 | 7306 | // CameraPane.Ymax = spoth; |
---|
6952 | 7307 | // } |
---|
6953 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6954 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7308 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7309 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6955 | 7310 | spot.translate(0, -32); |
---|
6956 | | - info.g.setColor(Color.green); |
---|
| 7311 | + info.g.setColor(Color.yellow); |
---|
6957 | 7312 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7313 | + info.g.setColor(Color.green); |
---|
6958 | 7314 | // if (CameraPane.Xmin > spot.x) |
---|
6959 | 7315 | // { |
---|
6960 | 7316 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6971 | 7327 | // { |
---|
6972 | 7328 | // CameraPane.Ymax = spoth; |
---|
6973 | 7329 | // } |
---|
6974 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
6975 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7330 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7331 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
6976 | 7332 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
6977 | 7333 | // if (CameraPane.Xmin > boundary.x) |
---|
6978 | 7334 | // { |
---|
.. | .. |
---|
7272 | 7628 | switch (info.pane.RenderCamera().viewCode) |
---|
7273 | 7629 | { |
---|
7274 | 7630 | case 3: // '\001' |
---|
7275 | | - if (modified) |
---|
| 7631 | + if (modified || opposite) |
---|
7276 | 7632 | { |
---|
7277 | 7633 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7278 | 7634 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7279 | 7635 | } // vScale, 1); |
---|
7280 | 7636 | else |
---|
7281 | 7637 | { |
---|
| 7638 | + // EXCEPTION! |
---|
7282 | 7639 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7283 | 7640 | } // vScale, 1); |
---|
7284 | 7641 | break; |
---|
7285 | 7642 | |
---|
7286 | 7643 | case 2: // '\002' |
---|
7287 | | - if (modified) |
---|
| 7644 | + if (modified || opposite) |
---|
7288 | 7645 | { |
---|
7289 | 7646 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7290 | 7647 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7295 | 7652 | break; |
---|
7296 | 7653 | |
---|
7297 | 7654 | case 1: // '\003' |
---|
7298 | | - if (modified) |
---|
| 7655 | + if (modified || opposite) |
---|
7299 | 7656 | { |
---|
7300 | 7657 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7301 | 7658 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7515 | 7872 | editWindow = null; |
---|
7516 | 7873 | } // ? |
---|
7517 | 7874 | } |
---|
| 7875 | + else |
---|
| 7876 | + { |
---|
| 7877 | + //editWindow.closeUI(); |
---|
| 7878 | + } |
---|
7518 | 7879 | } |
---|
7519 | 7880 | |
---|
7520 | 7881 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7526 | 7887 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7527 | 7888 | |
---|
7528 | 7889 | Object3D /*Composite*/ parent; |
---|
7529 | | - Object3D /*Composite*/ fileparent; |
---|
| 7890 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7530 | 7891 | |
---|
7531 | 7892 | double[][] toParent; // dynamic matrix |
---|
7532 | 7893 | double[][] fromParent; |
---|
.. | .. |
---|
7672 | 8033 | } |
---|
7673 | 8034 | |
---|
7674 | 8035 | transient ObjEditor editWindow; |
---|
| 8036 | + transient ObjEditor manipWindow; |
---|
| 8037 | + |
---|
| 8038 | + transient boolean pinned; |
---|
| 8039 | + |
---|
7675 | 8040 | transient ObjectUI objectUI; |
---|
7676 | 8041 | public static int povDepth = 0; |
---|
7677 | 8042 | private static cVector tbMin = new cVector(); |
---|