.. | .. |
---|
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[]; |
---|
| 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; |
---|
.. | .. |
---|
300 | 426 | } |
---|
301 | 427 | |
---|
302 | 428 | boolean live = false; |
---|
| 429 | + transient boolean keepdontselect; |
---|
| 430 | + boolean dontselect = false; |
---|
303 | 431 | boolean hide = false; |
---|
304 | 432 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 433 | boolean marked = false; // animation node |
---|
.. | .. |
---|
481 | 609 | toParent = LA.newMatrix(); |
---|
482 | 610 | fromParent = LA.newMatrix(); |
---|
483 | 611 | } |
---|
| 612 | + |
---|
484 | 613 | if (toParentMarked == null) |
---|
485 | 614 | { |
---|
486 | 615 | if (maxcount != 1) |
---|
487 | 616 | { |
---|
488 | 617 | new Exception().printStackTrace(); |
---|
489 | 618 | } |
---|
| 619 | + |
---|
490 | 620 | toParentMarked = LA.newMatrix(); |
---|
491 | 621 | fromParentMarked = LA.newMatrix(); |
---|
492 | 622 | } |
---|
.. | .. |
---|
774 | 904 | if (step == 0) |
---|
775 | 905 | step = 1; |
---|
776 | 906 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 907 | + maxcount = 128; // 2048; // 4; |
---|
778 | 908 | // if (acceleration == 0) |
---|
779 | 909 | // acceleration = 10; |
---|
780 | 910 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 927 | |
---|
798 | 928 | if (marked && Globals.isLIVE() && live && |
---|
799 | 929 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 930 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
801 | 931 | currentframe != Globals.framecount) |
---|
802 | 932 | { |
---|
803 | 933 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
809 | 939 | |
---|
810 | 940 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
811 | 941 | |
---|
812 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 942 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 943 | + (step == 1 && changedir)) |
---|
813 | 944 | { |
---|
814 | 945 | countdown = 1; |
---|
815 | 946 | delay = speedup?8:1; |
---|
.. | .. |
---|
881 | 1012 | if (material == null || material.multiply) |
---|
882 | 1013 | return true; |
---|
883 | 1014 | |
---|
| 1015 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
884 | 1016 | return material.opacity > 0.99; |
---|
885 | 1017 | } |
---|
886 | 1018 | |
---|
.. | .. |
---|
912 | 1044 | fromParent = null; // LA.newMatrix(); |
---|
913 | 1045 | bRep = null; // new BoundaryRep(); |
---|
914 | 1046 | |
---|
| 1047 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1048 | + { |
---|
| 1049 | + name = oname; |
---|
| 1050 | + } |
---|
| 1051 | + |
---|
915 | 1052 | /* |
---|
916 | 1053 | float hue = (float)Math.random(); |
---|
917 | 1054 | Color col; |
---|
.. | .. |
---|
954 | 1091 | |
---|
955 | 1092 | public Object clone() |
---|
956 | 1093 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1094 | + return Grafreed.clone(this); |
---|
958 | 1095 | } |
---|
959 | 1096 | |
---|
960 | 1097 | Object3D copyExpand() |
---|
.. | .. |
---|
1276 | 1413 | toParent = LA.newMatrix(); |
---|
1277 | 1414 | fromParent = LA.newMatrix(); |
---|
1278 | 1415 | } |
---|
| 1416 | + |
---|
1279 | 1417 | LA.matCopy(other.toParent, toParent); |
---|
1280 | 1418 | LA.matCopy(other.fromParent, fromParent); |
---|
1281 | 1419 | |
---|
.. | .. |
---|
1470 | 1608 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1609 | |
---|
1472 | 1610 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1611 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1612 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1613 | } |
---|
1476 | 1614 | |
---|
.. | .. |
---|
1729 | 1867 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1868 | o.bRep = transientrep; |
---|
1731 | 1869 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1870 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1871 | o.CreateMaterial(); |
---|
1734 | 1872 | o.SetAttributes(this, -1); |
---|
1735 | 1873 | //parent |
---|
.. | .. |
---|
1742 | 1880 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1881 | o.bRep = bRep; |
---|
1744 | 1882 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1883 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1884 | o.CreateMaterial(); |
---|
1747 | 1885 | //o.overwriteThis(this, -1); |
---|
1748 | 1886 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1967 | if (obj.name == null) |
---|
1830 | 1968 | continue; // can't be a null one |
---|
1831 | 1969 | |
---|
| 1970 | + // Try perfect match first. |
---|
1832 | 1971 | if (n.equals(obj.name)) |
---|
1833 | 1972 | { |
---|
1834 | 1973 | theobj = obj; |
---|
1835 | 1974 | count++; |
---|
1836 | 1975 | } |
---|
1837 | 1976 | } |
---|
| 1977 | + |
---|
| 1978 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1979 | |
---|
1839 | 1980 | if (count != 1) |
---|
1840 | 1981 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2294 | 2435 | } |
---|
2295 | 2436 | */ |
---|
2296 | 2437 | } |
---|
| 2438 | + else |
---|
| 2439 | + { |
---|
| 2440 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2441 | + } |
---|
2297 | 2442 | } |
---|
2298 | 2443 | |
---|
2299 | 2444 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2335 | 2480 | { |
---|
2336 | 2481 | editWindow.refreshContents(); |
---|
2337 | 2482 | } |
---|
| 2483 | + else |
---|
| 2484 | + { |
---|
| 2485 | + if (manipWindow != null) |
---|
| 2486 | + { |
---|
| 2487 | + manipWindow.refreshContents(); |
---|
| 2488 | + } |
---|
| 2489 | + } |
---|
| 2490 | + |
---|
2338 | 2491 | //if (parent != null) |
---|
2339 | 2492 | //parent.refreshEditWindow(); |
---|
2340 | 2493 | } |
---|
.. | .. |
---|
2477 | 2630 | return retval; |
---|
2478 | 2631 | } |
---|
2479 | 2632 | |
---|
2480 | | - void doEditDrag(ClickInfo info) |
---|
| 2633 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2481 | 2634 | { |
---|
2482 | 2635 | switch (doSomething) |
---|
2483 | 2636 | { |
---|
2484 | 2637 | case 1: // '\001' |
---|
2485 | 2638 | //super. |
---|
2486 | | - doEditDrag0(info); |
---|
| 2639 | + doEditDrag0(info, opposite); |
---|
2487 | 2640 | break; |
---|
2488 | 2641 | |
---|
2489 | 2642 | case 2: // '\002' |
---|
.. | .. |
---|
2496 | 2649 | { |
---|
2497 | 2650 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2498 | 2651 | //childToDrag.doEditDrag(info); |
---|
2499 | | - sel.doEditDrag(info); |
---|
| 2652 | + sel.doEditDrag(info, opposite); |
---|
2500 | 2653 | } else |
---|
2501 | 2654 | { |
---|
2502 | 2655 | //super. |
---|
2503 | | - doEditDrag0(info); |
---|
| 2656 | + doEditDrag0(info, opposite); |
---|
2504 | 2657 | } |
---|
2505 | 2658 | } |
---|
2506 | 2659 | break; |
---|
.. | .. |
---|
2610 | 2763 | void GenNormalsS(boolean crease) |
---|
2611 | 2764 | { |
---|
2612 | 2765 | selection.GenNormals(crease); |
---|
| 2766 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2767 | +// { |
---|
| 2768 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2769 | +// selectee.GenNormals(crease); |
---|
| 2770 | +// } |
---|
| 2771 | + |
---|
| 2772 | + //Touch(); |
---|
| 2773 | + } |
---|
| 2774 | + |
---|
| 2775 | + void GenNormalsMeshS() |
---|
| 2776 | + { |
---|
| 2777 | + selection.GenNormalsMesh(); |
---|
2613 | 2778 | // for (int i=0; i<selection.size(); i++) |
---|
2614 | 2779 | // { |
---|
2615 | 2780 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2750 | 2915 | if (child == null) |
---|
2751 | 2916 | continue; |
---|
2752 | 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(); |
---|
2753 | 2936 | // Children().release(i); |
---|
2754 | 2937 | } |
---|
2755 | 2938 | blockloop = false; |
---|
.. | .. |
---|
2922 | 3105 | } |
---|
2923 | 3106 | } |
---|
2924 | 3107 | |
---|
| 3108 | + void GenNormalsMesh0() |
---|
| 3109 | + { |
---|
| 3110 | + if (bRep != null) |
---|
| 3111 | + { |
---|
| 3112 | + bRep.GenerateNormalsMesh(); |
---|
| 3113 | + Touch(); |
---|
| 3114 | + } |
---|
| 3115 | + } |
---|
| 3116 | + |
---|
2925 | 3117 | void GenNormalsMINE0() |
---|
2926 | 3118 | { |
---|
2927 | 3119 | if (bRep != null) |
---|
2928 | 3120 | { |
---|
2929 | | - bRep.GenerateNormalsMINE(); |
---|
| 3121 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
2930 | 3122 | Touch(); |
---|
2931 | 3123 | } |
---|
2932 | 3124 | } |
---|
.. | .. |
---|
2983 | 3175 | blockloop = false; |
---|
2984 | 3176 | } |
---|
2985 | 3177 | |
---|
| 3178 | + void TransformChildren() |
---|
| 3179 | + { |
---|
| 3180 | + if (toParent != null) |
---|
| 3181 | + { |
---|
| 3182 | + for (int i=Size(); --i>=0;) |
---|
| 3183 | + { |
---|
| 3184 | + Object3D v = get(i); |
---|
| 3185 | + |
---|
| 3186 | + if (v.toParent == null) |
---|
| 3187 | + { |
---|
| 3188 | + v.toParent = LA.newMatrix(); |
---|
| 3189 | + v.fromParent = LA.newMatrix(); |
---|
| 3190 | + } |
---|
| 3191 | + |
---|
| 3192 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3193 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3194 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3195 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3196 | + } |
---|
| 3197 | + |
---|
| 3198 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3199 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3200 | + |
---|
| 3201 | + Touch(); |
---|
| 3202 | + } |
---|
| 3203 | + } |
---|
| 3204 | + |
---|
2986 | 3205 | void TransformGeometry() |
---|
2987 | 3206 | { |
---|
2988 | 3207 | Object3D obj = this; |
---|
.. | .. |
---|
3204 | 3423 | |
---|
3205 | 3424 | BoundaryRep sup = bRep.support; |
---|
3206 | 3425 | bRep.support = null; |
---|
3207 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3426 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3208 | 3427 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3209 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3428 | + |
---|
| 3429 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3430 | + |
---|
3210 | 3431 | bRep = temprep; |
---|
3211 | 3432 | bRep.support = sup; |
---|
3212 | 3433 | Touch(); |
---|
.. | .. |
---|
3343 | 3564 | if (blockloop) |
---|
3344 | 3565 | return; |
---|
3345 | 3566 | |
---|
3346 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3567 | + if (//marked || // does not make sense |
---|
| 3568 | + (bRep != null || material != null)) // borderline... |
---|
3347 | 3569 | live = h; |
---|
3348 | 3570 | |
---|
3349 | 3571 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3364 | 3586 | return; |
---|
3365 | 3587 | |
---|
3366 | 3588 | //if (bRep != null) |
---|
3367 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3589 | + if (//marked || // does not make sense |
---|
| 3590 | + (bRep != null || material != null)) // borderline... |
---|
3368 | 3591 | link2master = h; |
---|
3369 | 3592 | |
---|
3370 | 3593 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3384 | 3607 | if (blockloop) |
---|
3385 | 3608 | return; |
---|
3386 | 3609 | |
---|
3387 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3610 | + if (//marked || // does not make sense |
---|
| 3611 | + (bRep != null || material != null)) // borderline... |
---|
3388 | 3612 | hide = h; |
---|
3389 | 3613 | |
---|
3390 | 3614 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3404 | 3628 | if (blockloop) |
---|
3405 | 3629 | return; |
---|
3406 | 3630 | |
---|
3407 | | - if (bRep != null && material != null) // borderline... |
---|
| 3631 | + if (bRep != null || material != null) // borderline... |
---|
3408 | 3632 | marked = h; |
---|
3409 | 3633 | |
---|
3410 | 3634 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3414 | 3638 | continue; |
---|
3415 | 3639 | blockloop = true; |
---|
3416 | 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); |
---|
3417 | 3681 | blockloop = false; |
---|
3418 | 3682 | // release(i); |
---|
3419 | 3683 | } |
---|
.. | .. |
---|
3728 | 3992 | if (child == null) |
---|
3729 | 3993 | continue; |
---|
3730 | 3994 | |
---|
3731 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3995 | + if (Grafreed.RENDERME > 0) |
---|
3732 | 3996 | { |
---|
3733 | 3997 | if (child instanceof Merge) |
---|
3734 | 3998 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3879 | 4143 | if (child == null) |
---|
3880 | 4144 | continue; |
---|
3881 | 4145 | |
---|
3882 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4146 | + if (Grafreed.RENDERME > 0) |
---|
3883 | 4147 | { |
---|
3884 | 4148 | if (child instanceof Merge) |
---|
3885 | 4149 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4074 | 4338 | if (child == null) |
---|
4075 | 4339 | continue; |
---|
4076 | 4340 | |
---|
4077 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4341 | + if (Grafreed.RENDERME > 0) |
---|
4078 | 4342 | { |
---|
4079 | 4343 | if (child instanceof Merge) |
---|
4080 | 4344 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4187 | 4451 | { |
---|
4188 | 4452 | blockloop = true; |
---|
4189 | 4453 | get(i).RepairShadow(); |
---|
| 4454 | + blockloop = false; |
---|
| 4455 | + } |
---|
| 4456 | + } |
---|
| 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(); |
---|
4190 | 4503 | blockloop = false; |
---|
4191 | 4504 | } |
---|
4192 | 4505 | } |
---|
.. | .. |
---|
4681 | 4994 | |
---|
4682 | 4995 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4683 | 4996 | { |
---|
4684 | | - if (hide) |
---|
| 4997 | + if (hide || dontselect) |
---|
4685 | 4998 | return null; |
---|
4686 | 4999 | |
---|
4687 | 5000 | if (count <= 0) |
---|
.. | .. |
---|
4705 | 5018 | } |
---|
4706 | 5019 | } |
---|
4707 | 5020 | |
---|
| 5021 | + ObjEditor GetWindow() |
---|
| 5022 | + { |
---|
| 5023 | + if (editWindow != null) |
---|
| 5024 | + return editWindow; |
---|
| 5025 | + |
---|
| 5026 | + return manipWindow; |
---|
| 5027 | + } |
---|
| 5028 | + |
---|
4708 | 5029 | cTreePath Select(int indexcount, boolean deselect) |
---|
4709 | 5030 | { |
---|
4710 | | - if (hide) |
---|
| 5031 | + if (hide || dontselect) |
---|
4711 | 5032 | return null; |
---|
4712 | 5033 | |
---|
4713 | 5034 | if (count <= 0) |
---|
.. | .. |
---|
4741 | 5062 | if (leaf != null) |
---|
4742 | 5063 | { |
---|
4743 | 5064 | cTreePath tp = new cTreePath(this, leaf); |
---|
4744 | | - if (editWindow != null) |
---|
| 5065 | + ObjEditor window = GetWindow(); |
---|
| 5066 | + if (window != null) |
---|
4745 | 5067 | { |
---|
4746 | 5068 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4747 | | - editWindow.Select(tp, deselect, true); |
---|
| 5069 | + window.Select(tp, deselect, true); |
---|
4748 | 5070 | } |
---|
4749 | 5071 | |
---|
4750 | 5072 | return tp; |
---|
.. | .. |
---|
4761 | 5083 | |
---|
4762 | 5084 | if (child == null) |
---|
4763 | 5085 | continue; |
---|
| 5086 | + |
---|
4764 | 5087 | if (child.HasTransparency() && child.size() != 0) |
---|
4765 | 5088 | { |
---|
4766 | 5089 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4770 | 5093 | if (leaf != null) |
---|
4771 | 5094 | { |
---|
4772 | 5095 | cTreePath tp = new cTreePath(this, leaf); |
---|
4773 | | - if (editWindow != null) |
---|
| 5096 | + ObjEditor window = GetWindow(); |
---|
| 5097 | + if (window != null) |
---|
4774 | 5098 | { |
---|
4775 | | - editWindow.Select(tp, deselect, true); |
---|
| 5099 | + window.Select(tp, deselect, true); |
---|
4776 | 5100 | } |
---|
4777 | 5101 | |
---|
4778 | 5102 | return tp; |
---|
.. | .. |
---|
5097 | 5421 | blockloop = false; |
---|
5098 | 5422 | } |
---|
5099 | 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 | + |
---|
5100 | 5469 | boolean IsSelected() |
---|
5101 | 5470 | { |
---|
5102 | 5471 | if (parent == null) |
---|
.. | .. |
---|
5333 | 5702 | } |
---|
5334 | 5703 | } |
---|
5335 | 5704 | |
---|
| 5705 | + UUID GetUUID() |
---|
| 5706 | + { |
---|
| 5707 | + if (uuid == null) |
---|
| 5708 | + { |
---|
| 5709 | + // Serial |
---|
| 5710 | + uuid = UUID.randomUUID(); |
---|
| 5711 | + } |
---|
| 5712 | + |
---|
| 5713 | + return uuid; |
---|
| 5714 | + } |
---|
| 5715 | + |
---|
| 5716 | + Object3D GetObject(UUID uid) |
---|
| 5717 | + { |
---|
| 5718 | + if (blockloop) |
---|
| 5719 | + return null; |
---|
| 5720 | + |
---|
| 5721 | + if (GetUUID().equals(uid)) |
---|
| 5722 | + return this; |
---|
| 5723 | + |
---|
| 5724 | + int nb = Size(); |
---|
| 5725 | + for (int i = 0; i < nb; i++) |
---|
| 5726 | + { |
---|
| 5727 | + Object3D child = (Object3D) get(i); |
---|
| 5728 | + |
---|
| 5729 | + if (child == null) |
---|
| 5730 | + continue; |
---|
| 5731 | + |
---|
| 5732 | + blockloop = true; |
---|
| 5733 | + Object3D obj = child.GetObject(uid); |
---|
| 5734 | + blockloop = false; |
---|
| 5735 | + if (obj != null) |
---|
| 5736 | + return obj; |
---|
| 5737 | + } |
---|
| 5738 | + |
---|
| 5739 | + return null; |
---|
| 5740 | + } |
---|
| 5741 | + |
---|
5336 | 5742 | void SetBumpTexture(String tex) |
---|
5337 | 5743 | { |
---|
5338 | 5744 | if (GetTextures() == null) |
---|
.. | .. |
---|
5377 | 5783 | boolean NeedSupport() |
---|
5378 | 5784 | { |
---|
5379 | 5785 | return |
---|
5380 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5786 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5381 | 5787 | // PROBLEM with CROWD!! |
---|
5382 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5788 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5383 | 5789 | } |
---|
5384 | 5790 | |
---|
5385 | 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 | + } |
---|
5386 | 5803 | |
---|
5387 | 5804 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5388 | 5805 | { |
---|
.. | .. |
---|
5394 | 5811 | } |
---|
5395 | 5812 | |
---|
5396 | 5813 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5397 | | - hide) |
---|
| 5814 | + (hide || dontselect)) |
---|
5398 | 5815 | return; |
---|
5399 | 5816 | |
---|
5400 | 5817 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5445 | 5862 | support = support; |
---|
5446 | 5863 | |
---|
5447 | 5864 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5448 | | - 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); |
---|
5449 | 5866 | |
---|
5450 | 5867 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5451 | 5868 | { |
---|
.. | .. |
---|
5465 | 5882 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5466 | 5883 | |
---|
5467 | 5884 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5468 | | - (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))) |
---|
5469 | 5887 | { |
---|
5470 | 5888 | Globals.lighttouched = true; |
---|
5471 | 5889 | } // all panes... |
---|
| 5890 | + |
---|
5472 | 5891 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5473 | 5892 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5474 | 5893 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5596 | 6015 | if (GetBRep() != null) |
---|
5597 | 6016 | { |
---|
5598 | 6017 | display.NextIndex(); |
---|
| 6018 | + |
---|
5599 | 6019 | // vertex color conflict : gl.glCallList(list); |
---|
5600 | 6020 | DrawNode(display, root, selected); |
---|
5601 | 6021 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5636 | 6056 | tex = GetTextures(); |
---|
5637 | 6057 | } |
---|
5638 | 6058 | |
---|
5639 | | - display.BindTextures(tex, texres); |
---|
| 6059 | + boolean failedPigment = false; |
---|
| 6060 | + boolean failedBump = false; |
---|
| 6061 | + |
---|
| 6062 | + try |
---|
| 6063 | + { |
---|
| 6064 | + display.BindPigmentTexture(tex, texres); |
---|
| 6065 | + } |
---|
| 6066 | + catch (Exception e) |
---|
| 6067 | + { |
---|
| 6068 | + System.err.println("FAILED: " + this); |
---|
| 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; |
---|
| 6080 | + } |
---|
5640 | 6081 | |
---|
5641 | 6082 | if (!compiled) |
---|
5642 | 6083 | { |
---|
.. | .. |
---|
5658 | 6099 | } |
---|
5659 | 6100 | } |
---|
5660 | 6101 | |
---|
5661 | | - display.ReleaseTextures(tex); |
---|
| 6102 | + if (!failedBump) |
---|
| 6103 | + display.ReleaseBumpTexture(tex); |
---|
| 6104 | + |
---|
| 6105 | + if (!failedPigment) |
---|
| 6106 | + display.ReleasePigmentTexture(tex); |
---|
5662 | 6107 | |
---|
5663 | 6108 | display.PopMaterial(this, selected); |
---|
5664 | 6109 | } |
---|
.. | .. |
---|
5787 | 6232 | |
---|
5788 | 6233 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5789 | 6234 | { |
---|
| 6235 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6236 | + return; |
---|
| 6237 | + |
---|
5790 | 6238 | if (hide) |
---|
5791 | 6239 | return; |
---|
5792 | 6240 | // shadow optimisation |
---|
.. | .. |
---|
5912 | 6360 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5913 | 6361 | return; // no shadow for transparent objects |
---|
5914 | 6362 | |
---|
| 6363 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6364 | + return; |
---|
| 6365 | + |
---|
5915 | 6366 | if (hide) |
---|
5916 | 6367 | return; |
---|
5917 | 6368 | |
---|
.. | .. |
---|
6025 | 6476 | // dec 2012 |
---|
6026 | 6477 | new Exception().printStackTrace(); |
---|
6027 | 6478 | return; |
---|
| 6479 | + } |
---|
| 6480 | + |
---|
| 6481 | + if (dontselect) |
---|
| 6482 | + { |
---|
| 6483 | + //bRep.GenerateNormalsMINE(); |
---|
6028 | 6484 | } |
---|
6029 | 6485 | |
---|
6030 | 6486 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6877 | 7333 | spot.translate(32, 32); |
---|
6878 | 7334 | spotw = spot.x + spot.width; |
---|
6879 | 7335 | spoth = spot.y + spot.height; |
---|
6880 | | - info.g.setColor(Color.blue); |
---|
| 7336 | + info.g.setColor(Color.cyan); |
---|
6881 | 7337 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6882 | 7338 | // if (CameraPane.Xmin > spot.x) |
---|
6883 | 7339 | // { |
---|
.. | .. |
---|
6895 | 7351 | // { |
---|
6896 | 7352 | // CameraPane.Ymax = spoth; |
---|
6897 | 7353 | // } |
---|
6898 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6899 | | - 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 |
---|
6900 | 7356 | spot.translate(0, -32); |
---|
6901 | | - info.g.setColor(Color.green); |
---|
| 7357 | + info.g.setColor(Color.yellow); |
---|
6902 | 7358 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7359 | + info.g.setColor(Color.green); |
---|
6903 | 7360 | // if (CameraPane.Xmin > spot.x) |
---|
6904 | 7361 | // { |
---|
6905 | 7362 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6916 | 7373 | // { |
---|
6917 | 7374 | // CameraPane.Ymax = spoth; |
---|
6918 | 7375 | // } |
---|
6919 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
6920 | | - 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); |
---|
6921 | 7378 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
6922 | 7379 | // if (CameraPane.Xmin > boundary.x) |
---|
6923 | 7380 | // { |
---|
.. | .. |
---|
6951 | 7408 | startX = info.x; |
---|
6952 | 7409 | startY = info.y; |
---|
6953 | 7410 | |
---|
6954 | | - hitSomething = 0; |
---|
| 7411 | + hitSomething = -1; |
---|
6955 | 7412 | cVector origin = new cVector(); |
---|
6956 | 7413 | //LA.xformPos(origin, toParent, origin); |
---|
6957 | 7414 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6984 | 7441 | } |
---|
6985 | 7442 | |
---|
6986 | 7443 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6987 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7444 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6988 | 7445 | //System.out.println("modified = " + modified); |
---|
6989 | 7446 | //new Exception().printStackTrace(); |
---|
6990 | 7447 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7012 | 7469 | return true; |
---|
7013 | 7470 | } |
---|
7014 | 7471 | |
---|
7015 | | - void doEditDrag0(ClickInfo info) |
---|
| 7472 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7016 | 7473 | { |
---|
7017 | 7474 | if (hitSomething == 0) |
---|
7018 | 7475 | { |
---|
.. | .. |
---|
7027 | 7484 | //System.out.println("hitSomething = " + hitSomething); |
---|
7028 | 7485 | |
---|
7029 | 7486 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7487 | + |
---|
7030 | 7488 | cVector xlate = new cVector(); |
---|
7031 | 7489 | //cVector xlate2 = new cVector(); |
---|
7032 | 7490 | switch (hitSomething) |
---|
.. | .. |
---|
7039 | 7497 | |
---|
7040 | 7498 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7041 | 7499 | |
---|
7042 | | - if (modified) |
---|
| 7500 | + if (modified || opposite) |
---|
7043 | 7501 | { |
---|
7044 | 7502 | //assert(false); |
---|
7045 | 7503 | /* |
---|
.. | .. |
---|
7133 | 7591 | |
---|
7134 | 7592 | if (modified) |
---|
7135 | 7593 | { |
---|
| 7594 | + // Rotate 90 degrees |
---|
7136 | 7595 | angle /= (Math.PI / 4); |
---|
7137 | 7596 | angle = Math.floor(angle + 0.5); |
---|
7138 | 7597 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7174 | 7633 | |
---|
7175 | 7634 | case hitScale: // scale |
---|
7176 | 7635 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7636 | + double sign = 1; |
---|
| 7637 | + if (hScale < 0) |
---|
| 7638 | + { |
---|
| 7639 | + sign = -1; |
---|
| 7640 | + } |
---|
| 7641 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7177 | 7642 | if (hScale < 0.01) |
---|
7178 | 7643 | { |
---|
7179 | | - hScale = 0.01; |
---|
| 7644 | + //hScale = 0.01; |
---|
7180 | 7645 | } |
---|
7181 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7182 | | - if (hScale < 0.01) |
---|
7183 | | - { |
---|
7184 | | - hScale = 0.01; |
---|
7185 | | - } |
---|
| 7646 | + |
---|
7186 | 7647 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7187 | | - if (vScale < 0.01) |
---|
| 7648 | + sign = 1; |
---|
| 7649 | + if (vScale < 0) |
---|
7188 | 7650 | { |
---|
7189 | | - vScale = 0.01; |
---|
| 7651 | + sign = -1; |
---|
7190 | 7652 | } |
---|
7191 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7653 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7192 | 7654 | if (vScale < 0.01) |
---|
7193 | 7655 | { |
---|
7194 | | - vScale = 0.01; |
---|
| 7656 | + //vScale = 0.01; |
---|
7195 | 7657 | } |
---|
7196 | 7658 | LA.matCopy(startMat, toParent); |
---|
7197 | 7659 | /**/ |
---|
.. | .. |
---|
7202 | 7664 | } |
---|
7203 | 7665 | /**/ |
---|
7204 | 7666 | |
---|
| 7667 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7668 | + |
---|
| 7669 | + if (totalScale < 0.01) |
---|
| 7670 | + { |
---|
| 7671 | + totalScale = 0.01; |
---|
| 7672 | + } |
---|
| 7673 | + |
---|
7205 | 7674 | switch (info.pane.RenderCamera().viewCode) |
---|
7206 | 7675 | { |
---|
7207 | 7676 | case 3: // '\001' |
---|
7208 | | - if (modified) |
---|
| 7677 | + if (modified || opposite) |
---|
7209 | 7678 | { |
---|
7210 | 7679 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7211 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7680 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7212 | 7681 | } // vScale, 1); |
---|
7213 | 7682 | else |
---|
7214 | 7683 | { |
---|
7215 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7684 | + // EXCEPTION! |
---|
| 7685 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7216 | 7686 | } // vScale, 1); |
---|
7217 | 7687 | break; |
---|
7218 | 7688 | |
---|
7219 | 7689 | case 2: // '\002' |
---|
7220 | | - if (modified) |
---|
| 7690 | + if (modified || opposite) |
---|
7221 | 7691 | { |
---|
7222 | 7692 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7223 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7693 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7224 | 7694 | } else |
---|
7225 | 7695 | { |
---|
7226 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7696 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7227 | 7697 | } |
---|
7228 | 7698 | break; |
---|
7229 | 7699 | |
---|
7230 | 7700 | case 1: // '\003' |
---|
7231 | | - if (modified) |
---|
| 7701 | + if (modified || opposite) |
---|
7232 | 7702 | { |
---|
7233 | 7703 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7234 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7704 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7235 | 7705 | } else |
---|
7236 | 7706 | { |
---|
7237 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7707 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7238 | 7708 | } |
---|
7239 | 7709 | break; |
---|
7240 | 7710 | } |
---|
.. | .. |
---|
7367 | 7837 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7368 | 7838 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7369 | 7839 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7840 | + |
---|
| 7841 | + String objname; |
---|
| 7842 | + |
---|
7370 | 7843 | if (false) //parent != null) |
---|
7371 | 7844 | { |
---|
7372 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7845 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7373 | 7846 | } else |
---|
7374 | 7847 | { |
---|
7375 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7848 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7376 | 7849 | } // + super.toString(); |
---|
7377 | 7850 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7851 | + |
---|
| 7852 | + if (!Globals.ADVANCED) |
---|
| 7853 | + return objname; |
---|
| 7854 | + |
---|
| 7855 | + return objname + " " + System.identityHashCode(this); |
---|
7378 | 7856 | } |
---|
7379 | 7857 | |
---|
7380 | 7858 | public int hashCode() |
---|
.. | .. |
---|
7440 | 7918 | editWindow = null; |
---|
7441 | 7919 | } // ? |
---|
7442 | 7920 | } |
---|
| 7921 | + else |
---|
| 7922 | + { |
---|
| 7923 | + //editWindow.closeUI(); |
---|
| 7924 | + } |
---|
7443 | 7925 | } |
---|
7444 | 7926 | |
---|
7445 | 7927 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7451 | 7933 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7452 | 7934 | |
---|
7453 | 7935 | Object3D /*Composite*/ parent; |
---|
7454 | | - Object3D /*Composite*/ fileparent; |
---|
| 7936 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7455 | 7937 | |
---|
7456 | 7938 | double[][] toParent; // dynamic matrix |
---|
7457 | 7939 | double[][] fromParent; |
---|
.. | .. |
---|
7566 | 8048 | { |
---|
7567 | 8049 | assert(bRep != null); |
---|
7568 | 8050 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7569 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 8051 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7570 | 8052 | } |
---|
7571 | 8053 | else |
---|
7572 | 8054 | { |
---|
.. | .. |
---|
7597 | 8079 | } |
---|
7598 | 8080 | |
---|
7599 | 8081 | transient ObjEditor editWindow; |
---|
| 8082 | + transient ObjEditor manipWindow; |
---|
| 8083 | + |
---|
| 8084 | + transient boolean pinned; |
---|
| 8085 | + |
---|
7600 | 8086 | transient ObjectUI objectUI; |
---|
7601 | 8087 | public static int povDepth = 0; |
---|
7602 | 8088 | private static cVector tbMin = new cVector(); |
---|
.. | .. |
---|
7615 | 8101 | private static cVector edge2 = new cVector(); |
---|
7616 | 8102 | //private static cVector norm = new cVector(); |
---|
7617 | 8103 | /*transient private*/ int hitSomething; |
---|
7618 | | - private static final int hitCenter = 1; |
---|
7619 | | - private static final int hitScale = 2; |
---|
7620 | | - private static final int hitRotate = 3; |
---|
| 8104 | + static final int hitCenter = 1; |
---|
| 8105 | + static final int hitScale = 2; |
---|
| 8106 | + static final int hitRotate = 3; |
---|
7621 | 8107 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7622 | 8108 | /*transient*/ private Point centerPt; |
---|
7623 | 8109 | /*transient*/ private int startX; |
---|