.. | .. |
---|
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; |
---|
.. | .. |
---|
300 | 426 | } |
---|
301 | 427 | |
---|
302 | 428 | boolean live = false; |
---|
| 429 | + boolean dontselect = false; |
---|
303 | 430 | boolean hide = false; |
---|
304 | 431 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 432 | boolean marked = false; // animation node |
---|
.. | .. |
---|
481 | 608 | toParent = LA.newMatrix(); |
---|
482 | 609 | fromParent = LA.newMatrix(); |
---|
483 | 610 | } |
---|
| 611 | + |
---|
484 | 612 | if (toParentMarked == null) |
---|
485 | 613 | { |
---|
486 | 614 | if (maxcount != 1) |
---|
487 | 615 | { |
---|
488 | 616 | new Exception().printStackTrace(); |
---|
489 | 617 | } |
---|
| 618 | + |
---|
490 | 619 | toParentMarked = LA.newMatrix(); |
---|
491 | 620 | fromParentMarked = LA.newMatrix(); |
---|
492 | 621 | } |
---|
.. | .. |
---|
774 | 903 | if (step == 0) |
---|
775 | 904 | step = 1; |
---|
776 | 905 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 906 | + maxcount = 128; // 2048; // 4; |
---|
778 | 907 | // if (acceleration == 0) |
---|
779 | 908 | // acceleration = 10; |
---|
780 | 909 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 926 | |
---|
798 | 927 | if (marked && Globals.isLIVE() && live && |
---|
799 | 928 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 929 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
801 | 930 | currentframe != Globals.framecount) |
---|
802 | 931 | { |
---|
803 | 932 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
809 | 938 | |
---|
810 | 939 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
811 | 940 | |
---|
812 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 941 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 942 | + (step == 1 && changedir)) |
---|
813 | 943 | { |
---|
814 | 944 | countdown = 1; |
---|
815 | 945 | delay = speedup?8:1; |
---|
.. | .. |
---|
881 | 1011 | if (material == null || material.multiply) |
---|
882 | 1012 | return true; |
---|
883 | 1013 | |
---|
| 1014 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
884 | 1015 | return material.opacity > 0.99; |
---|
885 | 1016 | } |
---|
886 | 1017 | |
---|
.. | .. |
---|
912 | 1043 | fromParent = null; // LA.newMatrix(); |
---|
913 | 1044 | bRep = null; // new BoundaryRep(); |
---|
914 | 1045 | |
---|
| 1046 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1047 | + { |
---|
| 1048 | + name = oname; |
---|
| 1049 | + } |
---|
| 1050 | + |
---|
915 | 1051 | /* |
---|
916 | 1052 | float hue = (float)Math.random(); |
---|
917 | 1053 | Color col; |
---|
.. | .. |
---|
954 | 1090 | |
---|
955 | 1091 | public Object clone() |
---|
956 | 1092 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1093 | + return Grafreed.clone(this); |
---|
958 | 1094 | } |
---|
959 | 1095 | |
---|
960 | 1096 | Object3D copyExpand() |
---|
.. | .. |
---|
1276 | 1412 | toParent = LA.newMatrix(); |
---|
1277 | 1413 | fromParent = LA.newMatrix(); |
---|
1278 | 1414 | } |
---|
| 1415 | + |
---|
1279 | 1416 | LA.matCopy(other.toParent, toParent); |
---|
1280 | 1417 | LA.matCopy(other.fromParent, fromParent); |
---|
1281 | 1418 | |
---|
.. | .. |
---|
1470 | 1607 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1608 | |
---|
1472 | 1609 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1610 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1611 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1612 | } |
---|
1476 | 1613 | |
---|
.. | .. |
---|
1729 | 1866 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1867 | o.bRep = transientrep; |
---|
1731 | 1868 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1869 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1870 | o.CreateMaterial(); |
---|
1734 | 1871 | o.SetAttributes(this, -1); |
---|
1735 | 1872 | //parent |
---|
.. | .. |
---|
1742 | 1879 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1880 | o.bRep = bRep; |
---|
1744 | 1881 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1882 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1883 | o.CreateMaterial(); |
---|
1747 | 1884 | //o.overwriteThis(this, -1); |
---|
1748 | 1885 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1966 | if (obj.name == null) |
---|
1830 | 1967 | continue; // can't be a null one |
---|
1831 | 1968 | |
---|
| 1969 | + // Try perfect match first. |
---|
1832 | 1970 | if (n.equals(obj.name)) |
---|
1833 | 1971 | { |
---|
1834 | 1972 | theobj = obj; |
---|
1835 | 1973 | count++; |
---|
1836 | 1974 | } |
---|
1837 | 1975 | } |
---|
| 1976 | + |
---|
| 1977 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1978 | |
---|
1839 | 1979 | if (count != 1) |
---|
1840 | 1980 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2294 | 2434 | } |
---|
2295 | 2435 | */ |
---|
2296 | 2436 | } |
---|
| 2437 | + else |
---|
| 2438 | + { |
---|
| 2439 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2440 | + } |
---|
2297 | 2441 | } |
---|
2298 | 2442 | |
---|
2299 | 2443 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2335 | 2479 | { |
---|
2336 | 2480 | editWindow.refreshContents(); |
---|
2337 | 2481 | } |
---|
| 2482 | + else |
---|
| 2483 | + { |
---|
| 2484 | + if (manipWindow != null) |
---|
| 2485 | + { |
---|
| 2486 | + manipWindow.refreshContents(); |
---|
| 2487 | + } |
---|
| 2488 | + } |
---|
| 2489 | + |
---|
2338 | 2490 | //if (parent != null) |
---|
2339 | 2491 | //parent.refreshEditWindow(); |
---|
2340 | 2492 | } |
---|
.. | .. |
---|
2477 | 2629 | return retval; |
---|
2478 | 2630 | } |
---|
2479 | 2631 | |
---|
2480 | | - void doEditDrag(ClickInfo info) |
---|
| 2632 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2481 | 2633 | { |
---|
2482 | 2634 | switch (doSomething) |
---|
2483 | 2635 | { |
---|
2484 | 2636 | case 1: // '\001' |
---|
2485 | 2637 | //super. |
---|
2486 | | - doEditDrag0(info); |
---|
| 2638 | + doEditDrag0(info, opposite); |
---|
2487 | 2639 | break; |
---|
2488 | 2640 | |
---|
2489 | 2641 | case 2: // '\002' |
---|
.. | .. |
---|
2496 | 2648 | { |
---|
2497 | 2649 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2498 | 2650 | //childToDrag.doEditDrag(info); |
---|
2499 | | - sel.doEditDrag(info); |
---|
| 2651 | + sel.doEditDrag(info, opposite); |
---|
2500 | 2652 | } else |
---|
2501 | 2653 | { |
---|
2502 | 2654 | //super. |
---|
2503 | | - doEditDrag0(info); |
---|
| 2655 | + doEditDrag0(info, opposite); |
---|
2504 | 2656 | } |
---|
2505 | 2657 | } |
---|
2506 | 2658 | break; |
---|
.. | .. |
---|
2610 | 2762 | void GenNormalsS(boolean crease) |
---|
2611 | 2763 | { |
---|
2612 | 2764 | selection.GenNormals(crease); |
---|
| 2765 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2766 | +// { |
---|
| 2767 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2768 | +// selectee.GenNormals(crease); |
---|
| 2769 | +// } |
---|
| 2770 | + |
---|
| 2771 | + //Touch(); |
---|
| 2772 | + } |
---|
| 2773 | + |
---|
| 2774 | + void GenNormalsMeshS() |
---|
| 2775 | + { |
---|
| 2776 | + selection.GenNormalsMesh(); |
---|
2613 | 2777 | // for (int i=0; i<selection.size(); i++) |
---|
2614 | 2778 | // { |
---|
2615 | 2779 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2750 | 2914 | if (child == null) |
---|
2751 | 2915 | continue; |
---|
2752 | 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(); |
---|
2753 | 2935 | // Children().release(i); |
---|
2754 | 2936 | } |
---|
2755 | 2937 | blockloop = false; |
---|
.. | .. |
---|
2922 | 3104 | } |
---|
2923 | 3105 | } |
---|
2924 | 3106 | |
---|
| 3107 | + void GenNormalsMesh0() |
---|
| 3108 | + { |
---|
| 3109 | + if (bRep != null) |
---|
| 3110 | + { |
---|
| 3111 | + bRep.GenerateNormalsMesh(); |
---|
| 3112 | + Touch(); |
---|
| 3113 | + } |
---|
| 3114 | + } |
---|
| 3115 | + |
---|
2925 | 3116 | void GenNormalsMINE0() |
---|
2926 | 3117 | { |
---|
2927 | 3118 | if (bRep != null) |
---|
.. | .. |
---|
2983 | 3174 | blockloop = false; |
---|
2984 | 3175 | } |
---|
2985 | 3176 | |
---|
| 3177 | + void TransformChildren() |
---|
| 3178 | + { |
---|
| 3179 | + if (toParent != null) |
---|
| 3180 | + { |
---|
| 3181 | + for (int i=Size(); --i>=0;) |
---|
| 3182 | + { |
---|
| 3183 | + Object3D v = get(i); |
---|
| 3184 | + |
---|
| 3185 | + if (v.toParent == null) |
---|
| 3186 | + { |
---|
| 3187 | + v.toParent = LA.newMatrix(); |
---|
| 3188 | + v.fromParent = LA.newMatrix(); |
---|
| 3189 | + } |
---|
| 3190 | + |
---|
| 3191 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3192 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3193 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3194 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3195 | + } |
---|
| 3196 | + |
---|
| 3197 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3198 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3199 | + |
---|
| 3200 | + Touch(); |
---|
| 3201 | + } |
---|
| 3202 | + } |
---|
| 3203 | + |
---|
2986 | 3204 | void TransformGeometry() |
---|
2987 | 3205 | { |
---|
2988 | 3206 | Object3D obj = this; |
---|
.. | .. |
---|
3204 | 3422 | |
---|
3205 | 3423 | BoundaryRep sup = bRep.support; |
---|
3206 | 3424 | bRep.support = null; |
---|
3207 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3425 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3208 | 3426 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3209 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3427 | + |
---|
| 3428 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3429 | + |
---|
3210 | 3430 | bRep = temprep; |
---|
3211 | 3431 | bRep.support = sup; |
---|
3212 | 3432 | Touch(); |
---|
.. | .. |
---|
3343 | 3563 | if (blockloop) |
---|
3344 | 3564 | return; |
---|
3345 | 3565 | |
---|
3346 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3566 | + if (//marked || // does not make sense |
---|
| 3567 | + (bRep != null || material != null)) // borderline... |
---|
3347 | 3568 | live = h; |
---|
3348 | 3569 | |
---|
3349 | 3570 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3364 | 3585 | return; |
---|
3365 | 3586 | |
---|
3366 | 3587 | //if (bRep != null) |
---|
3367 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3588 | + if (//marked || // does not make sense |
---|
| 3589 | + (bRep != null || material != null)) // borderline... |
---|
3368 | 3590 | link2master = h; |
---|
3369 | 3591 | |
---|
3370 | 3592 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3384 | 3606 | if (blockloop) |
---|
3385 | 3607 | return; |
---|
3386 | 3608 | |
---|
3387 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3609 | + if (//marked || // does not make sense |
---|
| 3610 | + (bRep != null || material != null)) // borderline... |
---|
3388 | 3611 | hide = h; |
---|
3389 | 3612 | |
---|
3390 | 3613 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3404 | 3627 | if (blockloop) |
---|
3405 | 3628 | return; |
---|
3406 | 3629 | |
---|
3407 | | - if (bRep != null && material != null) // borderline... |
---|
| 3630 | + if (bRep != null || material != null) // borderline... |
---|
3408 | 3631 | marked = h; |
---|
3409 | 3632 | |
---|
3410 | 3633 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3414 | 3637 | continue; |
---|
3415 | 3638 | blockloop = true; |
---|
3416 | 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); |
---|
3417 | 3680 | blockloop = false; |
---|
3418 | 3681 | // release(i); |
---|
3419 | 3682 | } |
---|
.. | .. |
---|
3728 | 3991 | if (child == null) |
---|
3729 | 3992 | continue; |
---|
3730 | 3993 | |
---|
3731 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3994 | + if (Grafreed.RENDERME > 0) |
---|
3732 | 3995 | { |
---|
3733 | 3996 | if (child instanceof Merge) |
---|
3734 | 3997 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3879 | 4142 | if (child == null) |
---|
3880 | 4143 | continue; |
---|
3881 | 4144 | |
---|
3882 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4145 | + if (Grafreed.RENDERME > 0) |
---|
3883 | 4146 | { |
---|
3884 | 4147 | if (child instanceof Merge) |
---|
3885 | 4148 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4074 | 4337 | if (child == null) |
---|
4075 | 4338 | continue; |
---|
4076 | 4339 | |
---|
4077 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4340 | + if (Grafreed.RENDERME > 0) |
---|
4078 | 4341 | { |
---|
4079 | 4342 | if (child instanceof Merge) |
---|
4080 | 4343 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4187 | 4450 | { |
---|
4188 | 4451 | blockloop = true; |
---|
4189 | 4452 | get(i).RepairShadow(); |
---|
| 4453 | + blockloop = false; |
---|
| 4454 | + } |
---|
| 4455 | + } |
---|
| 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(); |
---|
4190 | 4502 | blockloop = false; |
---|
4191 | 4503 | } |
---|
4192 | 4504 | } |
---|
.. | .. |
---|
4681 | 4993 | |
---|
4682 | 4994 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4683 | 4995 | { |
---|
4684 | | - if (hide) |
---|
| 4996 | + if (hide || dontselect) |
---|
4685 | 4997 | return null; |
---|
4686 | 4998 | |
---|
4687 | 4999 | if (count <= 0) |
---|
.. | .. |
---|
4705 | 5017 | } |
---|
4706 | 5018 | } |
---|
4707 | 5019 | |
---|
| 5020 | + ObjEditor GetWindow() |
---|
| 5021 | + { |
---|
| 5022 | + if (editWindow != null) |
---|
| 5023 | + return editWindow; |
---|
| 5024 | + |
---|
| 5025 | + return manipWindow; |
---|
| 5026 | + } |
---|
| 5027 | + |
---|
4708 | 5028 | cTreePath Select(int indexcount, boolean deselect) |
---|
4709 | 5029 | { |
---|
4710 | | - if (hide) |
---|
| 5030 | + if (hide || dontselect) |
---|
4711 | 5031 | return null; |
---|
4712 | 5032 | |
---|
4713 | 5033 | if (count <= 0) |
---|
.. | .. |
---|
4741 | 5061 | if (leaf != null) |
---|
4742 | 5062 | { |
---|
4743 | 5063 | cTreePath tp = new cTreePath(this, leaf); |
---|
4744 | | - if (editWindow != null) |
---|
| 5064 | + ObjEditor window = GetWindow(); |
---|
| 5065 | + if (window != null) |
---|
4745 | 5066 | { |
---|
4746 | 5067 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4747 | | - editWindow.Select(tp, deselect, true); |
---|
| 5068 | + window.Select(tp, deselect, true); |
---|
4748 | 5069 | } |
---|
4749 | 5070 | |
---|
4750 | 5071 | return tp; |
---|
.. | .. |
---|
4761 | 5082 | |
---|
4762 | 5083 | if (child == null) |
---|
4763 | 5084 | continue; |
---|
| 5085 | + |
---|
4764 | 5086 | if (child.HasTransparency() && child.size() != 0) |
---|
4765 | 5087 | { |
---|
4766 | 5088 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4770 | 5092 | if (leaf != null) |
---|
4771 | 5093 | { |
---|
4772 | 5094 | cTreePath tp = new cTreePath(this, leaf); |
---|
4773 | | - if (editWindow != null) |
---|
| 5095 | + ObjEditor window = GetWindow(); |
---|
| 5096 | + if (window != null) |
---|
4774 | 5097 | { |
---|
4775 | | - editWindow.Select(tp, deselect, true); |
---|
| 5098 | + window.Select(tp, deselect, true); |
---|
4776 | 5099 | } |
---|
4777 | 5100 | |
---|
4778 | 5101 | return tp; |
---|
.. | .. |
---|
5333 | 5656 | } |
---|
5334 | 5657 | } |
---|
5335 | 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 | + |
---|
5336 | 5696 | void SetBumpTexture(String tex) |
---|
5337 | 5697 | { |
---|
5338 | 5698 | if (GetTextures() == null) |
---|
.. | .. |
---|
5377 | 5737 | boolean NeedSupport() |
---|
5378 | 5738 | { |
---|
5379 | 5739 | return |
---|
5380 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5740 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5381 | 5741 | // PROBLEM with CROWD!! |
---|
5382 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5742 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5383 | 5743 | } |
---|
5384 | 5744 | |
---|
5385 | 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 | + } |
---|
5386 | 5757 | |
---|
5387 | 5758 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5388 | 5759 | { |
---|
.. | .. |
---|
5394 | 5765 | } |
---|
5395 | 5766 | |
---|
5396 | 5767 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5397 | | - hide) |
---|
| 5768 | + (hide || dontselect)) |
---|
5398 | 5769 | return; |
---|
5399 | 5770 | |
---|
5400 | 5771 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5445 | 5816 | support = support; |
---|
5446 | 5817 | |
---|
5447 | 5818 | //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); |
---|
| 5819 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5449 | 5820 | |
---|
5450 | 5821 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5451 | 5822 | { |
---|
.. | .. |
---|
5465 | 5836 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5466 | 5837 | |
---|
5467 | 5838 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5468 | | - (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))) |
---|
5469 | 5841 | { |
---|
5470 | 5842 | Globals.lighttouched = true; |
---|
5471 | 5843 | } // all panes... |
---|
| 5844 | + |
---|
5472 | 5845 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5473 | 5846 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5474 | 5847 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5596 | 5969 | if (GetBRep() != null) |
---|
5597 | 5970 | { |
---|
5598 | 5971 | display.NextIndex(); |
---|
| 5972 | + |
---|
5599 | 5973 | // vertex color conflict : gl.glCallList(list); |
---|
5600 | 5974 | DrawNode(display, root, selected); |
---|
5601 | 5975 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5636 | 6010 | tex = GetTextures(); |
---|
5637 | 6011 | } |
---|
5638 | 6012 | |
---|
5639 | | - display.BindTextures(tex, texres); |
---|
| 6013 | + boolean failedPigment = false; |
---|
| 6014 | + boolean failedBump = false; |
---|
| 6015 | + |
---|
| 6016 | + try |
---|
| 6017 | + { |
---|
| 6018 | + display.BindPigmentTexture(tex, texres); |
---|
| 6019 | + } |
---|
| 6020 | + catch (Exception e) |
---|
| 6021 | + { |
---|
| 6022 | + System.err.println("FAILED: " + this); |
---|
| 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; |
---|
| 6034 | + } |
---|
5640 | 6035 | |
---|
5641 | 6036 | if (!compiled) |
---|
5642 | 6037 | { |
---|
.. | .. |
---|
5658 | 6053 | } |
---|
5659 | 6054 | } |
---|
5660 | 6055 | |
---|
5661 | | - display.ReleaseTextures(tex); |
---|
| 6056 | + if (!failedBump) |
---|
| 6057 | + display.ReleaseBumpTexture(tex); |
---|
| 6058 | + |
---|
| 6059 | + if (!failedPigment) |
---|
| 6060 | + display.ReleasePigmentTexture(tex); |
---|
5662 | 6061 | |
---|
5663 | 6062 | display.PopMaterial(this, selected); |
---|
5664 | 6063 | } |
---|
.. | .. |
---|
5787 | 6186 | |
---|
5788 | 6187 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5789 | 6188 | { |
---|
| 6189 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6190 | + return; |
---|
| 6191 | + |
---|
5790 | 6192 | if (hide) |
---|
5791 | 6193 | return; |
---|
5792 | 6194 | // shadow optimisation |
---|
.. | .. |
---|
5912 | 6314 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5913 | 6315 | return; // no shadow for transparent objects |
---|
5914 | 6316 | |
---|
| 6317 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6318 | + return; |
---|
| 6319 | + |
---|
5915 | 6320 | if (hide) |
---|
5916 | 6321 | return; |
---|
5917 | 6322 | |
---|
.. | .. |
---|
6025 | 6430 | // dec 2012 |
---|
6026 | 6431 | new Exception().printStackTrace(); |
---|
6027 | 6432 | return; |
---|
| 6433 | + } |
---|
| 6434 | + |
---|
| 6435 | + if (dontselect) |
---|
| 6436 | + { |
---|
| 6437 | + //bRep.GenerateNormalsMINE(); |
---|
6028 | 6438 | } |
---|
6029 | 6439 | |
---|
6030 | 6440 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6877 | 7287 | spot.translate(32, 32); |
---|
6878 | 7288 | spotw = spot.x + spot.width; |
---|
6879 | 7289 | spoth = spot.y + spot.height; |
---|
6880 | | - info.g.setColor(Color.blue); |
---|
| 7290 | + info.g.setColor(Color.cyan); |
---|
6881 | 7291 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6882 | 7292 | // if (CameraPane.Xmin > spot.x) |
---|
6883 | 7293 | // { |
---|
.. | .. |
---|
6895 | 7305 | // { |
---|
6896 | 7306 | // CameraPane.Ymax = spoth; |
---|
6897 | 7307 | // } |
---|
6898 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6899 | | - 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 |
---|
6900 | 7310 | spot.translate(0, -32); |
---|
6901 | | - info.g.setColor(Color.green); |
---|
| 7311 | + info.g.setColor(Color.yellow); |
---|
6902 | 7312 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7313 | + info.g.setColor(Color.green); |
---|
6903 | 7314 | // if (CameraPane.Xmin > spot.x) |
---|
6904 | 7315 | // { |
---|
6905 | 7316 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6916 | 7327 | // { |
---|
6917 | 7328 | // CameraPane.Ymax = spoth; |
---|
6918 | 7329 | // } |
---|
6919 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
6920 | | - 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); |
---|
6921 | 7332 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
6922 | 7333 | // if (CameraPane.Xmin > boundary.x) |
---|
6923 | 7334 | // { |
---|
.. | .. |
---|
6951 | 7362 | startX = info.x; |
---|
6952 | 7363 | startY = info.y; |
---|
6953 | 7364 | |
---|
6954 | | - hitSomething = 0; |
---|
| 7365 | + hitSomething = -1; |
---|
6955 | 7366 | cVector origin = new cVector(); |
---|
6956 | 7367 | //LA.xformPos(origin, toParent, origin); |
---|
6957 | 7368 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6984 | 7395 | } |
---|
6985 | 7396 | |
---|
6986 | 7397 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6987 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7398 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6988 | 7399 | //System.out.println("modified = " + modified); |
---|
6989 | 7400 | //new Exception().printStackTrace(); |
---|
6990 | 7401 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7012 | 7423 | return true; |
---|
7013 | 7424 | } |
---|
7014 | 7425 | |
---|
7015 | | - void doEditDrag0(ClickInfo info) |
---|
| 7426 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7016 | 7427 | { |
---|
7017 | 7428 | if (hitSomething == 0) |
---|
7018 | 7429 | { |
---|
.. | .. |
---|
7027 | 7438 | //System.out.println("hitSomething = " + hitSomething); |
---|
7028 | 7439 | |
---|
7029 | 7440 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7441 | + |
---|
7030 | 7442 | cVector xlate = new cVector(); |
---|
7031 | 7443 | //cVector xlate2 = new cVector(); |
---|
7032 | 7444 | switch (hitSomething) |
---|
.. | .. |
---|
7039 | 7451 | |
---|
7040 | 7452 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7041 | 7453 | |
---|
7042 | | - if (modified) |
---|
| 7454 | + if (modified || opposite) |
---|
7043 | 7455 | { |
---|
7044 | 7456 | //assert(false); |
---|
7045 | 7457 | /* |
---|
.. | .. |
---|
7133 | 7545 | |
---|
7134 | 7546 | if (modified) |
---|
7135 | 7547 | { |
---|
| 7548 | + // Rotate 90 degrees |
---|
7136 | 7549 | angle /= (Math.PI / 4); |
---|
7137 | 7550 | angle = Math.floor(angle + 0.5); |
---|
7138 | 7551 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7174 | 7587 | |
---|
7175 | 7588 | case hitScale: // scale |
---|
7176 | 7589 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7590 | + double sign = 1; |
---|
| 7591 | + if (hScale < 0) |
---|
| 7592 | + { |
---|
| 7593 | + sign = -1; |
---|
| 7594 | + } |
---|
| 7595 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7177 | 7596 | if (hScale < 0.01) |
---|
7178 | 7597 | { |
---|
7179 | | - hScale = 0.01; |
---|
| 7598 | + //hScale = 0.01; |
---|
7180 | 7599 | } |
---|
7181 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7182 | | - if (hScale < 0.01) |
---|
7183 | | - { |
---|
7184 | | - hScale = 0.01; |
---|
7185 | | - } |
---|
| 7600 | + |
---|
7186 | 7601 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7187 | | - if (vScale < 0.01) |
---|
| 7602 | + sign = 1; |
---|
| 7603 | + if (vScale < 0) |
---|
7188 | 7604 | { |
---|
7189 | | - vScale = 0.01; |
---|
| 7605 | + sign = -1; |
---|
7190 | 7606 | } |
---|
7191 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7607 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7192 | 7608 | if (vScale < 0.01) |
---|
7193 | 7609 | { |
---|
7194 | | - vScale = 0.01; |
---|
| 7610 | + //vScale = 0.01; |
---|
7195 | 7611 | } |
---|
7196 | 7612 | LA.matCopy(startMat, toParent); |
---|
7197 | 7613 | /**/ |
---|
.. | .. |
---|
7202 | 7618 | } |
---|
7203 | 7619 | /**/ |
---|
7204 | 7620 | |
---|
| 7621 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7622 | + |
---|
| 7623 | + if (totalScale < 0.01) |
---|
| 7624 | + { |
---|
| 7625 | + totalScale = 0.01; |
---|
| 7626 | + } |
---|
| 7627 | + |
---|
7205 | 7628 | switch (info.pane.RenderCamera().viewCode) |
---|
7206 | 7629 | { |
---|
7207 | 7630 | case 3: // '\001' |
---|
7208 | | - if (modified) |
---|
| 7631 | + if (modified || opposite) |
---|
7209 | 7632 | { |
---|
7210 | 7633 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7211 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7634 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7212 | 7635 | } // vScale, 1); |
---|
7213 | 7636 | else |
---|
7214 | 7637 | { |
---|
7215 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7638 | + // EXCEPTION! |
---|
| 7639 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7216 | 7640 | } // vScale, 1); |
---|
7217 | 7641 | break; |
---|
7218 | 7642 | |
---|
7219 | 7643 | case 2: // '\002' |
---|
7220 | | - if (modified) |
---|
| 7644 | + if (modified || opposite) |
---|
7221 | 7645 | { |
---|
7222 | 7646 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7223 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7647 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7224 | 7648 | } else |
---|
7225 | 7649 | { |
---|
7226 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7650 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7227 | 7651 | } |
---|
7228 | 7652 | break; |
---|
7229 | 7653 | |
---|
7230 | 7654 | case 1: // '\003' |
---|
7231 | | - if (modified) |
---|
| 7655 | + if (modified || opposite) |
---|
7232 | 7656 | { |
---|
7233 | 7657 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7234 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7658 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7235 | 7659 | } else |
---|
7236 | 7660 | { |
---|
7237 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7661 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7238 | 7662 | } |
---|
7239 | 7663 | break; |
---|
7240 | 7664 | } |
---|
.. | .. |
---|
7367 | 7791 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7368 | 7792 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7369 | 7793 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7794 | + |
---|
| 7795 | + String objname; |
---|
| 7796 | + |
---|
7370 | 7797 | if (false) //parent != null) |
---|
7371 | 7798 | { |
---|
7372 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7799 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7373 | 7800 | } else |
---|
7374 | 7801 | { |
---|
7375 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7802 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7376 | 7803 | } // + super.toString(); |
---|
7377 | 7804 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7805 | + |
---|
| 7806 | + if (!Globals.ADVANCED) |
---|
| 7807 | + return objname; |
---|
| 7808 | + |
---|
| 7809 | + return objname + " " + System.identityHashCode(this); |
---|
7378 | 7810 | } |
---|
7379 | 7811 | |
---|
7380 | 7812 | public int hashCode() |
---|
.. | .. |
---|
7440 | 7872 | editWindow = null; |
---|
7441 | 7873 | } // ? |
---|
7442 | 7874 | } |
---|
| 7875 | + else |
---|
| 7876 | + { |
---|
| 7877 | + //editWindow.closeUI(); |
---|
| 7878 | + } |
---|
7443 | 7879 | } |
---|
7444 | 7880 | |
---|
7445 | 7881 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7451 | 7887 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7452 | 7888 | |
---|
7453 | 7889 | Object3D /*Composite*/ parent; |
---|
7454 | | - Object3D /*Composite*/ fileparent; |
---|
| 7890 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7455 | 7891 | |
---|
7456 | 7892 | double[][] toParent; // dynamic matrix |
---|
7457 | 7893 | double[][] fromParent; |
---|
.. | .. |
---|
7566 | 8002 | { |
---|
7567 | 8003 | assert(bRep != null); |
---|
7568 | 8004 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7569 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 8005 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7570 | 8006 | } |
---|
7571 | 8007 | else |
---|
7572 | 8008 | { |
---|
.. | .. |
---|
7597 | 8033 | } |
---|
7598 | 8034 | |
---|
7599 | 8035 | transient ObjEditor editWindow; |
---|
| 8036 | + transient ObjEditor manipWindow; |
---|
| 8037 | + |
---|
| 8038 | + transient boolean pinned; |
---|
| 8039 | + |
---|
7600 | 8040 | transient ObjectUI objectUI; |
---|
7601 | 8041 | public static int povDepth = 0; |
---|
7602 | 8042 | private static cVector tbMin = new cVector(); |
---|
.. | .. |
---|
7615 | 8055 | private static cVector edge2 = new cVector(); |
---|
7616 | 8056 | //private static cVector norm = new cVector(); |
---|
7617 | 8057 | /*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; |
---|
| 8058 | + static final int hitCenter = 1; |
---|
| 8059 | + static final int hitScale = 2; |
---|
| 8060 | + static final int hitRotate = 3; |
---|
7621 | 8061 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7622 | 8062 | /*transient*/ private Point centerPt; |
---|
7623 | 8063 | /*transient*/ private int startX; |
---|