.. | .. |
---|
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; |
---|
| 24 | + |
---|
| 25 | + private UUID uuid = UUID.randomUUID(); |
---|
| 26 | + |
---|
| 27 | + // TEMPORARY for mocap undo |
---|
| 28 | + mocap.reader.BVHReader.BVHResult bvh; |
---|
| 29 | + Object3D skeleton; |
---|
| 30 | + // |
---|
22 | 31 | |
---|
23 | 32 | ScriptNode scriptnode; |
---|
24 | 33 | |
---|
.. | .. |
---|
100 | 109 | |
---|
101 | 110 | // transient boolean reduced; // for morph reduction |
---|
102 | 111 | |
---|
103 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
104 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 112 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 113 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
105 | 114 | |
---|
106 | | -transient Object3D transientsupport; // for cloning |
---|
107 | | -transient boolean transientlink2master; |
---|
| 115 | + transient Object3D transientsupport; // for cloning |
---|
| 116 | + transient boolean transientlink2master; |
---|
108 | 117 | |
---|
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) |
---|
| 118 | + void SaveSupports() |
---|
121 | 119 | { |
---|
122 | | - bRep.SaveSupports(); |
---|
123 | | - } |
---|
124 | | - |
---|
125 | | - for (int i = 0; i < Size(); i++) |
---|
126 | | - { |
---|
127 | | - Object3D child = (Object3D) get(i); |
---|
128 | | - if (child == null) |
---|
129 | | - continue; |
---|
130 | | - blockloop = true; |
---|
131 | | - child.SaveSupports(); |
---|
132 | | - blockloop = false; |
---|
133 | | - } |
---|
134 | | -} |
---|
| 120 | + if (blockloop) |
---|
| 121 | + return; |
---|
135 | 122 | |
---|
136 | | -void RestoreSupports() |
---|
137 | | -{ |
---|
138 | | - if (blockloop) |
---|
139 | | - return; |
---|
| 123 | + transientsupport = support; |
---|
| 124 | + transientlink2master = link2master; |
---|
140 | 125 | |
---|
141 | | - support = transientsupport; |
---|
142 | | - link2master = transientlink2master; |
---|
143 | | - transientsupport = null; |
---|
144 | | - transientlink2master = false; |
---|
145 | | - |
---|
146 | | - if (bRep != null) |
---|
147 | | - { |
---|
148 | | - bRep.RestoreSupports(); |
---|
| 126 | + support = null; |
---|
| 127 | + link2master = false; |
---|
| 128 | + |
---|
| 129 | + if (bRep != null) |
---|
| 130 | + { |
---|
| 131 | + bRep.SaveSupports(); |
---|
| 132 | + } |
---|
| 133 | + |
---|
| 134 | + for (int i = 0; i < Size(); i++) |
---|
| 135 | + { |
---|
| 136 | + Object3D child = (Object3D) get(i); |
---|
| 137 | + if (child == null) |
---|
| 138 | + continue; |
---|
| 139 | + blockloop = true; |
---|
| 140 | + child.SaveSupports(); |
---|
| 141 | + blockloop = false; |
---|
| 142 | + } |
---|
149 | 143 | } |
---|
150 | | - |
---|
151 | | - for (int i = 0; i < Size(); i++) |
---|
| 144 | + |
---|
| 145 | + void RestoreSupports() |
---|
152 | 146 | { |
---|
153 | | - Object3D child = (Object3D) get(i); |
---|
154 | | - if (child == null) |
---|
155 | | - continue; |
---|
156 | | - blockloop = true; |
---|
157 | | - child.RestoreSupports(); |
---|
158 | | - blockloop = false; |
---|
| 147 | + if (blockloop) |
---|
| 148 | + return; |
---|
| 149 | + |
---|
| 150 | + support = transientsupport; |
---|
| 151 | + link2master = transientlink2master; |
---|
| 152 | + transientsupport = null; |
---|
| 153 | + transientlink2master = false; |
---|
| 154 | + |
---|
| 155 | + if (bRep != null) |
---|
| 156 | + { |
---|
| 157 | + bRep.RestoreSupports(); |
---|
| 158 | + } |
---|
| 159 | + |
---|
| 160 | + for (int i = 0; i < Size(); i++) |
---|
| 161 | + { |
---|
| 162 | + Object3D child = (Object3D) get(i); |
---|
| 163 | + if (child == null) |
---|
| 164 | + continue; |
---|
| 165 | + blockloop = true; |
---|
| 166 | + child.RestoreSupports(); |
---|
| 167 | + blockloop = false; |
---|
| 168 | + } |
---|
159 | 169 | } |
---|
160 | | -} |
---|
| 170 | + |
---|
| 171 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 172 | + { |
---|
| 173 | + if (hashtable.containsKey(GetUUID())) |
---|
| 174 | + { |
---|
| 175 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 176 | + |
---|
| 177 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 178 | + if (this.bRep != null) |
---|
| 179 | + assert(this.bRep.support == o.transientrep); |
---|
| 180 | + |
---|
| 181 | + return; |
---|
| 182 | + } |
---|
| 183 | + |
---|
| 184 | + Object3D o = new Object3D(); |
---|
| 185 | + |
---|
| 186 | + hashtable.put(GetUUID(), o); |
---|
| 187 | + |
---|
| 188 | + for (int i=0; i<Size(); i++) |
---|
| 189 | + { |
---|
| 190 | + get(i).ExtractBigData(hashtable); |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + ExtractBigData(o); |
---|
| 194 | + } |
---|
| 195 | + |
---|
| 196 | + void ExtractBigData(Object3D o) |
---|
| 197 | + { |
---|
| 198 | + o.bRep = this.bRep; |
---|
| 199 | + if (this.bRep != null) |
---|
| 200 | + { |
---|
| 201 | + o.transientrep = this.bRep.support; |
---|
| 202 | + o.bRep.support = null; |
---|
| 203 | + } |
---|
| 204 | + |
---|
| 205 | + // o.support = this.support; |
---|
| 206 | + // o.fileparent = this.fileparent; |
---|
| 207 | + // if (this.bRep != null) |
---|
| 208 | + // o.bRep = this.bRep.support; |
---|
| 209 | + |
---|
| 210 | + this.bRep = null; |
---|
| 211 | + // if (this.bRep != null) |
---|
| 212 | + // this.bRep.support = null; |
---|
| 213 | + // this.support = null; |
---|
| 214 | + // this.fileparent = null; |
---|
| 215 | + } |
---|
| 216 | + |
---|
| 217 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 218 | + { |
---|
| 219 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 220 | + return; |
---|
| 221 | + |
---|
| 222 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 223 | + |
---|
| 224 | + RestoreBigData(o); |
---|
| 225 | + |
---|
| 226 | + hashtable.remove(GetUUID()); |
---|
| 227 | + |
---|
| 228 | + for (int i=0; i<Size(); i++) |
---|
| 229 | + { |
---|
| 230 | + get(i).RestoreBigData(hashtable); |
---|
| 231 | + } |
---|
| 232 | + } |
---|
| 233 | + |
---|
| 234 | + void RestoreBigData(Object3D o) |
---|
| 235 | + { |
---|
| 236 | + this.bRep = o.bRep; |
---|
| 237 | + if (this.bRep != null) |
---|
| 238 | + this.bRep.support = o.transientrep; |
---|
| 239 | + // this.support = o.support; |
---|
| 240 | + // this.fileparent = o.fileparent; |
---|
| 241 | + } |
---|
161 | 242 | |
---|
162 | 243 | // MOCAP SUPPORT |
---|
163 | 244 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
300 | 381 | } |
---|
301 | 382 | |
---|
302 | 383 | boolean live = false; |
---|
| 384 | + boolean dontselect = false; |
---|
303 | 385 | boolean hide = false; |
---|
304 | 386 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 387 | boolean marked = false; // animation node |
---|
.. | .. |
---|
481 | 563 | toParent = LA.newMatrix(); |
---|
482 | 564 | fromParent = LA.newMatrix(); |
---|
483 | 565 | } |
---|
| 566 | + |
---|
484 | 567 | if (toParentMarked == null) |
---|
485 | 568 | { |
---|
486 | 569 | if (maxcount != 1) |
---|
487 | 570 | { |
---|
488 | 571 | new Exception().printStackTrace(); |
---|
489 | 572 | } |
---|
| 573 | + |
---|
490 | 574 | toParentMarked = LA.newMatrix(); |
---|
491 | 575 | fromParentMarked = LA.newMatrix(); |
---|
492 | 576 | } |
---|
.. | .. |
---|
774 | 858 | if (step == 0) |
---|
775 | 859 | step = 1; |
---|
776 | 860 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 861 | + maxcount = 128; // 2048; // 4; |
---|
778 | 862 | // if (acceleration == 0) |
---|
779 | 863 | // acceleration = 10; |
---|
780 | 864 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 881 | |
---|
798 | 882 | if (marked && Globals.isLIVE() && live && |
---|
799 | 883 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 884 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
801 | 885 | currentframe != Globals.framecount) |
---|
802 | 886 | { |
---|
803 | 887 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
809 | 893 | |
---|
810 | 894 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
811 | 895 | |
---|
812 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 896 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 897 | + (step == 1 && changedir)) |
---|
813 | 898 | { |
---|
814 | 899 | countdown = 1; |
---|
815 | 900 | delay = speedup?8:1; |
---|
.. | .. |
---|
912 | 997 | fromParent = null; // LA.newMatrix(); |
---|
913 | 998 | bRep = null; // new BoundaryRep(); |
---|
914 | 999 | |
---|
| 1000 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1001 | + { |
---|
| 1002 | + name = oname; |
---|
| 1003 | + } |
---|
| 1004 | + |
---|
915 | 1005 | /* |
---|
916 | 1006 | float hue = (float)Math.random(); |
---|
917 | 1007 | Color col; |
---|
.. | .. |
---|
954 | 1044 | |
---|
955 | 1045 | public Object clone() |
---|
956 | 1046 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1047 | + return Grafreed.clone(this); |
---|
958 | 1048 | } |
---|
959 | 1049 | |
---|
960 | 1050 | Object3D copyExpand() |
---|
.. | .. |
---|
1470 | 1560 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1561 | |
---|
1472 | 1562 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1563 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1564 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1565 | } |
---|
1476 | 1566 | |
---|
.. | .. |
---|
1729 | 1819 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1820 | o.bRep = transientrep; |
---|
1731 | 1821 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1822 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1823 | o.CreateMaterial(); |
---|
1734 | 1824 | o.SetAttributes(this, -1); |
---|
1735 | 1825 | //parent |
---|
.. | .. |
---|
1742 | 1832 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1833 | o.bRep = bRep; |
---|
1744 | 1834 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1835 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1836 | o.CreateMaterial(); |
---|
1747 | 1837 | //o.overwriteThis(this, -1); |
---|
1748 | 1838 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1919 | if (obj.name == null) |
---|
1830 | 1920 | continue; // can't be a null one |
---|
1831 | 1921 | |
---|
| 1922 | + // Try perfect match first. |
---|
1832 | 1923 | if (n.equals(obj.name)) |
---|
1833 | 1924 | { |
---|
1834 | 1925 | theobj = obj; |
---|
1835 | 1926 | count++; |
---|
1836 | 1927 | } |
---|
1837 | 1928 | } |
---|
| 1929 | + |
---|
| 1930 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1931 | |
---|
1839 | 1932 | if (count != 1) |
---|
1840 | 1933 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2294 | 2387 | } |
---|
2295 | 2388 | */ |
---|
2296 | 2389 | } |
---|
| 2390 | + else |
---|
| 2391 | + { |
---|
| 2392 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2393 | + } |
---|
2297 | 2394 | } |
---|
2298 | 2395 | |
---|
2299 | 2396 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2477 | 2574 | return retval; |
---|
2478 | 2575 | } |
---|
2479 | 2576 | |
---|
2480 | | - void doEditDrag(ClickInfo info) |
---|
| 2577 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2481 | 2578 | { |
---|
2482 | 2579 | switch (doSomething) |
---|
2483 | 2580 | { |
---|
2484 | 2581 | case 1: // '\001' |
---|
2485 | 2582 | //super. |
---|
2486 | | - doEditDrag0(info); |
---|
| 2583 | + doEditDrag0(info, opposite); |
---|
2487 | 2584 | break; |
---|
2488 | 2585 | |
---|
2489 | 2586 | case 2: // '\002' |
---|
.. | .. |
---|
2496 | 2593 | { |
---|
2497 | 2594 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2498 | 2595 | //childToDrag.doEditDrag(info); |
---|
2499 | | - sel.doEditDrag(info); |
---|
| 2596 | + sel.doEditDrag(info, opposite); |
---|
2500 | 2597 | } else |
---|
2501 | 2598 | { |
---|
2502 | 2599 | //super. |
---|
2503 | | - doEditDrag0(info); |
---|
| 2600 | + doEditDrag0(info, opposite); |
---|
2504 | 2601 | } |
---|
2505 | 2602 | } |
---|
2506 | 2603 | break; |
---|
.. | .. |
---|
2610 | 2707 | void GenNormalsS(boolean crease) |
---|
2611 | 2708 | { |
---|
2612 | 2709 | selection.GenNormals(crease); |
---|
| 2710 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2711 | +// { |
---|
| 2712 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2713 | +// selectee.GenNormals(crease); |
---|
| 2714 | +// } |
---|
| 2715 | + |
---|
| 2716 | + //Touch(); |
---|
| 2717 | + } |
---|
| 2718 | + |
---|
| 2719 | + void GenNormalsMeshS() |
---|
| 2720 | + { |
---|
| 2721 | + selection.GenNormalsMesh(); |
---|
2613 | 2722 | // for (int i=0; i<selection.size(); i++) |
---|
2614 | 2723 | // { |
---|
2615 | 2724 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2750 | 2859 | if (child == null) |
---|
2751 | 2860 | continue; |
---|
2752 | 2861 | child.GenNormals(crease); |
---|
| 2862 | +// Children().release(i); |
---|
| 2863 | + } |
---|
| 2864 | + blockloop = false; |
---|
| 2865 | + } |
---|
| 2866 | + |
---|
| 2867 | + void GenNormalsMesh() |
---|
| 2868 | + { |
---|
| 2869 | + if (blockloop) |
---|
| 2870 | + return; |
---|
| 2871 | + |
---|
| 2872 | + blockloop = true; |
---|
| 2873 | + GenNormalsMesh0(); |
---|
| 2874 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2875 | + { |
---|
| 2876 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2877 | + if (child == null) |
---|
| 2878 | + continue; |
---|
| 2879 | + child.GenNormalsMesh(); |
---|
2753 | 2880 | // Children().release(i); |
---|
2754 | 2881 | } |
---|
2755 | 2882 | blockloop = false; |
---|
.. | .. |
---|
2922 | 3049 | } |
---|
2923 | 3050 | } |
---|
2924 | 3051 | |
---|
| 3052 | + void GenNormalsMesh0() |
---|
| 3053 | + { |
---|
| 3054 | + if (bRep != null) |
---|
| 3055 | + { |
---|
| 3056 | + bRep.GenerateNormalsMesh(); |
---|
| 3057 | + Touch(); |
---|
| 3058 | + } |
---|
| 3059 | + } |
---|
| 3060 | + |
---|
2925 | 3061 | void GenNormalsMINE0() |
---|
2926 | 3062 | { |
---|
2927 | 3063 | if (bRep != null) |
---|
.. | .. |
---|
2983 | 3119 | blockloop = false; |
---|
2984 | 3120 | } |
---|
2985 | 3121 | |
---|
| 3122 | + void TransformChildren() |
---|
| 3123 | + { |
---|
| 3124 | + if (toParent != null) |
---|
| 3125 | + { |
---|
| 3126 | + for (int i=Size(); --i>=0;) |
---|
| 3127 | + { |
---|
| 3128 | + Object3D v = get(i); |
---|
| 3129 | + |
---|
| 3130 | + if (v.toParent == null) |
---|
| 3131 | + { |
---|
| 3132 | + v.toParent = LA.newMatrix(); |
---|
| 3133 | + v.fromParent = LA.newMatrix(); |
---|
| 3134 | + } |
---|
| 3135 | + |
---|
| 3136 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3137 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3138 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3139 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3140 | + } |
---|
| 3141 | + |
---|
| 3142 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3143 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3144 | + |
---|
| 3145 | + Touch(); |
---|
| 3146 | + } |
---|
| 3147 | + } |
---|
| 3148 | + |
---|
2986 | 3149 | void TransformGeometry() |
---|
2987 | 3150 | { |
---|
2988 | 3151 | Object3D obj = this; |
---|
.. | .. |
---|
3204 | 3367 | |
---|
3205 | 3368 | BoundaryRep sup = bRep.support; |
---|
3206 | 3369 | bRep.support = null; |
---|
3207 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3370 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3208 | 3371 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3209 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3372 | + |
---|
| 3373 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3374 | + |
---|
3210 | 3375 | bRep = temprep; |
---|
3211 | 3376 | bRep.support = sup; |
---|
3212 | 3377 | Touch(); |
---|
.. | .. |
---|
3343 | 3508 | if (blockloop) |
---|
3344 | 3509 | return; |
---|
3345 | 3510 | |
---|
3346 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3511 | + if (//marked || // does not make sense |
---|
| 3512 | + (bRep != null || material != null)) // borderline... |
---|
3347 | 3513 | live = h; |
---|
3348 | 3514 | |
---|
3349 | 3515 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3364 | 3530 | return; |
---|
3365 | 3531 | |
---|
3366 | 3532 | //if (bRep != null) |
---|
3367 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3533 | + if (//marked || // does not make sense |
---|
| 3534 | + (bRep != null || material != null)) // borderline... |
---|
3368 | 3535 | link2master = h; |
---|
3369 | 3536 | |
---|
3370 | 3537 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3384 | 3551 | if (blockloop) |
---|
3385 | 3552 | return; |
---|
3386 | 3553 | |
---|
3387 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3554 | + if (//marked || // does not make sense |
---|
| 3555 | + (bRep != null || material != null)) // borderline... |
---|
3388 | 3556 | hide = h; |
---|
3389 | 3557 | |
---|
3390 | 3558 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3404 | 3572 | if (blockloop) |
---|
3405 | 3573 | return; |
---|
3406 | 3574 | |
---|
3407 | | - if (bRep != null && material != null) // borderline... |
---|
| 3575 | + if (bRep != null || material != null) // borderline... |
---|
3408 | 3576 | marked = h; |
---|
3409 | 3577 | |
---|
3410 | 3578 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3414 | 3582 | continue; |
---|
3415 | 3583 | blockloop = true; |
---|
3416 | 3584 | child.MarkLeaves(h); |
---|
| 3585 | + blockloop = false; |
---|
| 3586 | + // release(i); |
---|
| 3587 | + } |
---|
| 3588 | + } |
---|
| 3589 | + |
---|
| 3590 | + void RewindLeaves(boolean h) |
---|
| 3591 | + { |
---|
| 3592 | + if (blockloop) |
---|
| 3593 | + return; |
---|
| 3594 | + |
---|
| 3595 | + if (bRep != null || material != null) // borderline... |
---|
| 3596 | + rewind = h; |
---|
| 3597 | + |
---|
| 3598 | + for (int i = 0; i < Size(); i++) |
---|
| 3599 | + { |
---|
| 3600 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3601 | + if (child == null) |
---|
| 3602 | + continue; |
---|
| 3603 | + blockloop = true; |
---|
| 3604 | + child.RewindLeaves(h); |
---|
| 3605 | + blockloop = false; |
---|
| 3606 | + // release(i); |
---|
| 3607 | + } |
---|
| 3608 | + } |
---|
| 3609 | + |
---|
| 3610 | + void RandomLeaves(boolean h) |
---|
| 3611 | + { |
---|
| 3612 | + if (blockloop) |
---|
| 3613 | + return; |
---|
| 3614 | + |
---|
| 3615 | + if (bRep != null || material != null) // borderline... |
---|
| 3616 | + random = h; |
---|
| 3617 | + |
---|
| 3618 | + for (int i = 0; i < Size(); i++) |
---|
| 3619 | + { |
---|
| 3620 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3621 | + if (child == null) |
---|
| 3622 | + continue; |
---|
| 3623 | + blockloop = true; |
---|
| 3624 | + child.RandomLeaves(h); |
---|
3417 | 3625 | blockloop = false; |
---|
3418 | 3626 | // release(i); |
---|
3419 | 3627 | } |
---|
.. | .. |
---|
3728 | 3936 | if (child == null) |
---|
3729 | 3937 | continue; |
---|
3730 | 3938 | |
---|
3731 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3939 | + if (Grafreed.RENDERME > 0) |
---|
3732 | 3940 | { |
---|
3733 | 3941 | if (child instanceof Merge) |
---|
3734 | 3942 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3879 | 4087 | if (child == null) |
---|
3880 | 4088 | continue; |
---|
3881 | 4089 | |
---|
3882 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4090 | + if (Grafreed.RENDERME > 0) |
---|
3883 | 4091 | { |
---|
3884 | 4092 | if (child instanceof Merge) |
---|
3885 | 4093 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4074 | 4282 | if (child == null) |
---|
4075 | 4283 | continue; |
---|
4076 | 4284 | |
---|
4077 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4285 | + if (Grafreed.RENDERME > 0) |
---|
4078 | 4286 | { |
---|
4079 | 4287 | if (child instanceof Merge) |
---|
4080 | 4288 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4187 | 4395 | { |
---|
4188 | 4396 | blockloop = true; |
---|
4189 | 4397 | get(i).RepairShadow(); |
---|
| 4398 | + blockloop = false; |
---|
| 4399 | + } |
---|
| 4400 | + } |
---|
| 4401 | + |
---|
| 4402 | + void RepairSOV() |
---|
| 4403 | + { |
---|
| 4404 | + if (blockloop) |
---|
| 4405 | + return; |
---|
| 4406 | + |
---|
| 4407 | + String texname = this.GetPigmentTexture(); |
---|
| 4408 | + |
---|
| 4409 | + if (texname.startsWith("sov")) |
---|
| 4410 | + { |
---|
| 4411 | + String[] s = texname.split("/"); |
---|
| 4412 | + |
---|
| 4413 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4414 | + |
---|
| 4415 | + texname = sname[0]; |
---|
| 4416 | + |
---|
| 4417 | + if (sname.length > 1) |
---|
| 4418 | + { |
---|
| 4419 | + texname += "Color.jpg"; |
---|
| 4420 | + } |
---|
| 4421 | + |
---|
| 4422 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4423 | + } |
---|
| 4424 | + |
---|
| 4425 | + texname = this.GetBumpTexture(); |
---|
| 4426 | + |
---|
| 4427 | + if (texname.startsWith("sov")) |
---|
| 4428 | + { |
---|
| 4429 | + String[] s = texname.split("/"); |
---|
| 4430 | + |
---|
| 4431 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4432 | + |
---|
| 4433 | + texname = sname[0]; |
---|
| 4434 | + |
---|
| 4435 | + if (sname.length > 1) |
---|
| 4436 | + { |
---|
| 4437 | + texname += "Bump.jpg"; |
---|
| 4438 | + } |
---|
| 4439 | + |
---|
| 4440 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4441 | + } |
---|
| 4442 | + |
---|
| 4443 | + for (int i=0; i<Size(); i++) |
---|
| 4444 | + { |
---|
| 4445 | + blockloop = true; |
---|
| 4446 | + get(i).RepairSOV(); |
---|
4190 | 4447 | blockloop = false; |
---|
4191 | 4448 | } |
---|
4192 | 4449 | } |
---|
.. | .. |
---|
4681 | 4938 | |
---|
4682 | 4939 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4683 | 4940 | { |
---|
4684 | | - if (hide) |
---|
| 4941 | + if (hide || dontselect) |
---|
4685 | 4942 | return null; |
---|
4686 | 4943 | |
---|
4687 | 4944 | if (count <= 0) |
---|
.. | .. |
---|
4707 | 4964 | |
---|
4708 | 4965 | cTreePath Select(int indexcount, boolean deselect) |
---|
4709 | 4966 | { |
---|
4710 | | - if (hide) |
---|
| 4967 | + if (hide || dontselect) |
---|
4711 | 4968 | return null; |
---|
4712 | 4969 | |
---|
4713 | 4970 | if (count <= 0) |
---|
.. | .. |
---|
5159 | 5416 | |
---|
5160 | 5417 | // System.out.println("Fullname = " + fullname); |
---|
5161 | 5418 | |
---|
5162 | | - if (fullname.name.indexOf(":") == -1) |
---|
5163 | | - return fullname.name; |
---|
| 5419 | + // Does not work on Windows due to C: |
---|
| 5420 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5421 | +// return fullname.name; |
---|
| 5422 | +// |
---|
| 5423 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5164 | 5424 | |
---|
5165 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5425 | + String[] split = fullname.name.split(":"); |
---|
| 5426 | + |
---|
| 5427 | + if (split.length == 0) |
---|
| 5428 | + { |
---|
| 5429 | + return ""; |
---|
| 5430 | + } |
---|
| 5431 | + |
---|
| 5432 | + if (split.length <= 2) |
---|
| 5433 | + { |
---|
| 5434 | + if (fullname.name.endsWith(":")) |
---|
| 5435 | + { |
---|
| 5436 | + // Windows |
---|
| 5437 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5438 | + } |
---|
| 5439 | + |
---|
| 5440 | + return split[0]; |
---|
| 5441 | + } |
---|
| 5442 | + |
---|
| 5443 | + // Windows |
---|
| 5444 | + assert(split.length == 4); |
---|
| 5445 | + |
---|
| 5446 | + return split[0] + ":" + split[1]; |
---|
5166 | 5447 | } |
---|
5167 | 5448 | |
---|
5168 | 5449 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5171 | 5452 | return ""; |
---|
5172 | 5453 | |
---|
5173 | 5454 | // System.out.println("Fullname = " + fullname); |
---|
5174 | | - if (fullname.name.indexOf(":") == -1) |
---|
5175 | | - return ""; |
---|
5176 | | - |
---|
5177 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5455 | + // Does not work on Windows due to C: |
---|
| 5456 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5457 | +// return ""; |
---|
| 5458 | +// |
---|
| 5459 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5460 | + String[] split = fullname.name.split(":"); |
---|
| 5461 | + |
---|
| 5462 | + if (split.length == 0) |
---|
| 5463 | + { |
---|
| 5464 | + return ""; |
---|
| 5465 | + } |
---|
| 5466 | + |
---|
| 5467 | + if (split.length == 1) |
---|
| 5468 | + { |
---|
| 5469 | + return ""; |
---|
| 5470 | + } |
---|
| 5471 | + |
---|
| 5472 | + if (split.length == 2) |
---|
| 5473 | + { |
---|
| 5474 | + if (fullname.name.endsWith(":")) |
---|
| 5475 | + { |
---|
| 5476 | + // Windows |
---|
| 5477 | + return ""; |
---|
| 5478 | + } |
---|
| 5479 | + |
---|
| 5480 | + return split[1]; |
---|
| 5481 | + } |
---|
| 5482 | + |
---|
| 5483 | + // Windows |
---|
| 5484 | + assert(split.length == 4); |
---|
| 5485 | + |
---|
| 5486 | + return split[2] + ":" + split[3]; |
---|
5178 | 5487 | } |
---|
5179 | 5488 | |
---|
5180 | 5489 | String GetPigmentTexture() |
---|
.. | .. |
---|
5248 | 5557 | System.out.print("; textures = " + textures); |
---|
5249 | 5558 | System.out.println("; usedtextures = " + usedtextures); |
---|
5250 | 5559 | |
---|
5251 | | - if (GetTextures() == null) |
---|
| 5560 | + if (GetTextures() == null) // What is that?? |
---|
5252 | 5561 | GetTextures().name = ":"; |
---|
5253 | 5562 | |
---|
5254 | 5563 | String texname = tex; |
---|
.. | .. |
---|
5279 | 5588 | child.ResetPigmentTexture(); |
---|
5280 | 5589 | blockloop = false; |
---|
5281 | 5590 | } |
---|
| 5591 | + } |
---|
| 5592 | + |
---|
| 5593 | + UUID GetUUID() |
---|
| 5594 | + { |
---|
| 5595 | + if (uuid == null) |
---|
| 5596 | + { |
---|
| 5597 | + // Serial |
---|
| 5598 | + uuid = UUID.randomUUID(); |
---|
| 5599 | + } |
---|
| 5600 | + |
---|
| 5601 | + return uuid; |
---|
| 5602 | + } |
---|
| 5603 | + |
---|
| 5604 | + Object3D GetObject(UUID uid) |
---|
| 5605 | + { |
---|
| 5606 | + if (blockloop) |
---|
| 5607 | + return null; |
---|
| 5608 | + |
---|
| 5609 | + if (GetUUID().equals(uid)) |
---|
| 5610 | + return this; |
---|
| 5611 | + |
---|
| 5612 | + int nb = Size(); |
---|
| 5613 | + for (int i = 0; i < nb; i++) |
---|
| 5614 | + { |
---|
| 5615 | + Object3D child = (Object3D) get(i); |
---|
| 5616 | + |
---|
| 5617 | + if (child == null) |
---|
| 5618 | + continue; |
---|
| 5619 | + |
---|
| 5620 | + blockloop = true; |
---|
| 5621 | + Object3D obj = child.GetObject(uid); |
---|
| 5622 | + blockloop = false; |
---|
| 5623 | + if (obj != null) |
---|
| 5624 | + return obj; |
---|
| 5625 | + } |
---|
| 5626 | + |
---|
| 5627 | + return null; |
---|
5282 | 5628 | } |
---|
5283 | 5629 | |
---|
5284 | 5630 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5325 | 5671 | boolean NeedSupport() |
---|
5326 | 5672 | { |
---|
5327 | 5673 | return |
---|
5328 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5674 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5329 | 5675 | // PROBLEM with CROWD!! |
---|
5330 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5676 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5331 | 5677 | } |
---|
5332 | 5678 | |
---|
5333 | 5679 | static boolean DEBUG_SELECTION = false; |
---|
| 5680 | + |
---|
| 5681 | + boolean IsLive() |
---|
| 5682 | + { |
---|
| 5683 | + if (live) |
---|
| 5684 | + return true; |
---|
| 5685 | + |
---|
| 5686 | + if (parent == null) |
---|
| 5687 | + return false; |
---|
| 5688 | + |
---|
| 5689 | + return parent.IsLive(); |
---|
| 5690 | + } |
---|
5334 | 5691 | |
---|
5335 | 5692 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5336 | 5693 | { |
---|
.. | .. |
---|
5342 | 5699 | } |
---|
5343 | 5700 | |
---|
5344 | 5701 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5345 | | - hide) |
---|
| 5702 | + (hide || dontselect)) |
---|
5346 | 5703 | return; |
---|
5347 | 5704 | |
---|
5348 | 5705 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5393 | 5750 | support = support; |
---|
5394 | 5751 | |
---|
5395 | 5752 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5396 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5753 | + boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5397 | 5754 | |
---|
5398 | 5755 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5399 | 5756 | { |
---|
.. | .. |
---|
5413 | 5770 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5414 | 5771 | |
---|
5415 | 5772 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5416 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5773 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5774 | + (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
5417 | 5775 | { |
---|
5418 | 5776 | Globals.lighttouched = true; |
---|
5419 | 5777 | } // all panes... |
---|
| 5778 | + |
---|
5420 | 5779 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5421 | 5780 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5422 | 5781 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5584 | 5943 | tex = GetTextures(); |
---|
5585 | 5944 | } |
---|
5586 | 5945 | |
---|
5587 | | - display.BindTextures(tex, texres); |
---|
| 5946 | + boolean failedPigment = false; |
---|
| 5947 | + boolean failedBump = false; |
---|
| 5948 | + |
---|
| 5949 | + try |
---|
| 5950 | + { |
---|
| 5951 | + display.BindPigmentTexture(tex, texres); |
---|
| 5952 | + } |
---|
| 5953 | + catch (Exception e) |
---|
| 5954 | + { |
---|
| 5955 | + System.err.println("FAILED: " + this); |
---|
| 5956 | + failedPigment = true; |
---|
| 5957 | + } |
---|
| 5958 | + |
---|
| 5959 | + try |
---|
| 5960 | + { |
---|
| 5961 | + display.BindBumpTexture(tex, texres); |
---|
| 5962 | + } |
---|
| 5963 | + catch (Exception e) |
---|
| 5964 | + { |
---|
| 5965 | + //System.err.println("FAILED: " + this); |
---|
| 5966 | + failedBump = true; |
---|
| 5967 | + } |
---|
5588 | 5968 | |
---|
5589 | 5969 | if (!compiled) |
---|
5590 | 5970 | { |
---|
.. | .. |
---|
5606 | 5986 | } |
---|
5607 | 5987 | } |
---|
5608 | 5988 | |
---|
5609 | | - display.ReleaseTextures(tex); |
---|
| 5989 | + if (!failedBump) |
---|
| 5990 | + display.ReleaseBumpTexture(tex); |
---|
| 5991 | + |
---|
| 5992 | + if (!failedPigment) |
---|
| 5993 | + display.ReleasePigmentTexture(tex); |
---|
5610 | 5994 | |
---|
5611 | 5995 | display.PopMaterial(this, selected); |
---|
5612 | 5996 | } |
---|
.. | .. |
---|
5735 | 6119 | |
---|
5736 | 6120 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5737 | 6121 | { |
---|
| 6122 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6123 | + return; |
---|
| 6124 | + |
---|
5738 | 6125 | if (hide) |
---|
5739 | 6126 | return; |
---|
5740 | 6127 | // shadow optimisation |
---|
.. | .. |
---|
5860 | 6247 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5861 | 6248 | return; // no shadow for transparent objects |
---|
5862 | 6249 | |
---|
| 6250 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6251 | + return; |
---|
| 6252 | + |
---|
5863 | 6253 | if (hide) |
---|
5864 | 6254 | return; |
---|
5865 | 6255 | |
---|
.. | .. |
---|
5973 | 6363 | // dec 2012 |
---|
5974 | 6364 | new Exception().printStackTrace(); |
---|
5975 | 6365 | return; |
---|
| 6366 | + } |
---|
| 6367 | + |
---|
| 6368 | + if (dontselect) |
---|
| 6369 | + { |
---|
| 6370 | + //bRep.GenerateNormalsMINE(); |
---|
5976 | 6371 | } |
---|
5977 | 6372 | |
---|
5978 | 6373 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6825 | 7220 | spot.translate(32, 32); |
---|
6826 | 7221 | spotw = spot.x + spot.width; |
---|
6827 | 7222 | spoth = spot.y + spot.height; |
---|
6828 | | - info.g.setColor(Color.blue); |
---|
| 7223 | + info.g.setColor(Color.cyan); |
---|
6829 | 7224 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6830 | 7225 | // if (CameraPane.Xmin > spot.x) |
---|
6831 | 7226 | // { |
---|
.. | .. |
---|
6843 | 7238 | // { |
---|
6844 | 7239 | // CameraPane.Ymax = spoth; |
---|
6845 | 7240 | // } |
---|
6846 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6847 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7241 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7242 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6848 | 7243 | spot.translate(0, -32); |
---|
6849 | | - info.g.setColor(Color.green); |
---|
| 7244 | + info.g.setColor(Color.yellow); |
---|
6850 | 7245 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7246 | + info.g.setColor(Color.green); |
---|
6851 | 7247 | // if (CameraPane.Xmin > spot.x) |
---|
6852 | 7248 | // { |
---|
6853 | 7249 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6899 | 7295 | startX = info.x; |
---|
6900 | 7296 | startY = info.y; |
---|
6901 | 7297 | |
---|
6902 | | - hitSomething = 0; |
---|
| 7298 | + hitSomething = -1; |
---|
6903 | 7299 | cVector origin = new cVector(); |
---|
6904 | 7300 | //LA.xformPos(origin, toParent, origin); |
---|
6905 | 7301 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6932 | 7328 | } |
---|
6933 | 7329 | |
---|
6934 | 7330 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6935 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7331 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6936 | 7332 | //System.out.println("modified = " + modified); |
---|
6937 | 7333 | //new Exception().printStackTrace(); |
---|
6938 | 7334 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
6960 | 7356 | return true; |
---|
6961 | 7357 | } |
---|
6962 | 7358 | |
---|
6963 | | - void doEditDrag0(ClickInfo info) |
---|
| 7359 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
6964 | 7360 | { |
---|
6965 | 7361 | if (hitSomething == 0) |
---|
6966 | 7362 | { |
---|
.. | .. |
---|
6975 | 7371 | //System.out.println("hitSomething = " + hitSomething); |
---|
6976 | 7372 | |
---|
6977 | 7373 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7374 | + |
---|
6978 | 7375 | cVector xlate = new cVector(); |
---|
6979 | 7376 | //cVector xlate2 = new cVector(); |
---|
6980 | 7377 | switch (hitSomething) |
---|
.. | .. |
---|
6987 | 7384 | |
---|
6988 | 7385 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
6989 | 7386 | |
---|
6990 | | - if (modified) |
---|
| 7387 | + if (modified || opposite) |
---|
6991 | 7388 | { |
---|
6992 | 7389 | //assert(false); |
---|
6993 | 7390 | /* |
---|
.. | .. |
---|
7081 | 7478 | |
---|
7082 | 7479 | if (modified) |
---|
7083 | 7480 | { |
---|
| 7481 | + // Rotate 90 degrees |
---|
7084 | 7482 | angle /= (Math.PI / 4); |
---|
7085 | 7483 | angle = Math.floor(angle + 0.5); |
---|
7086 | 7484 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7122 | 7520 | |
---|
7123 | 7521 | case hitScale: // scale |
---|
7124 | 7522 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7523 | + double sign = 1; |
---|
| 7524 | + if (hScale < 0) |
---|
| 7525 | + { |
---|
| 7526 | + sign = -1; |
---|
| 7527 | + } |
---|
| 7528 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7125 | 7529 | if (hScale < 0.01) |
---|
7126 | 7530 | { |
---|
7127 | | - hScale = 0.01; |
---|
| 7531 | + //hScale = 0.01; |
---|
7128 | 7532 | } |
---|
7129 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7130 | | - if (hScale < 0.01) |
---|
7131 | | - { |
---|
7132 | | - hScale = 0.01; |
---|
7133 | | - } |
---|
| 7533 | + |
---|
7134 | 7534 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7135 | | - if (vScale < 0.01) |
---|
| 7535 | + sign = 1; |
---|
| 7536 | + if (vScale < 0) |
---|
7136 | 7537 | { |
---|
7137 | | - vScale = 0.01; |
---|
| 7538 | + sign = -1; |
---|
7138 | 7539 | } |
---|
7139 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7540 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7140 | 7541 | if (vScale < 0.01) |
---|
7141 | 7542 | { |
---|
7142 | | - vScale = 0.01; |
---|
| 7543 | + //vScale = 0.01; |
---|
7143 | 7544 | } |
---|
7144 | 7545 | LA.matCopy(startMat, toParent); |
---|
7145 | 7546 | /**/ |
---|
.. | .. |
---|
7150 | 7551 | } |
---|
7151 | 7552 | /**/ |
---|
7152 | 7553 | |
---|
| 7554 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7555 | + |
---|
| 7556 | + if (totalScale < 0.01) |
---|
| 7557 | + { |
---|
| 7558 | + totalScale = 0.01; |
---|
| 7559 | + } |
---|
| 7560 | + |
---|
7153 | 7561 | switch (info.pane.RenderCamera().viewCode) |
---|
7154 | 7562 | { |
---|
7155 | 7563 | case 3: // '\001' |
---|
7156 | | - if (modified) |
---|
| 7564 | + if (modified || opposite) |
---|
7157 | 7565 | { |
---|
7158 | 7566 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7159 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7567 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7160 | 7568 | } // vScale, 1); |
---|
7161 | 7569 | else |
---|
7162 | 7570 | { |
---|
7163 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7571 | + // EXCEPTION! |
---|
| 7572 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7164 | 7573 | } // vScale, 1); |
---|
7165 | 7574 | break; |
---|
7166 | 7575 | |
---|
7167 | 7576 | case 2: // '\002' |
---|
7168 | | - if (modified) |
---|
| 7577 | + if (modified || opposite) |
---|
7169 | 7578 | { |
---|
7170 | 7579 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7171 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7580 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7172 | 7581 | } else |
---|
7173 | 7582 | { |
---|
7174 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7583 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7175 | 7584 | } |
---|
7176 | 7585 | break; |
---|
7177 | 7586 | |
---|
7178 | 7587 | case 1: // '\003' |
---|
7179 | | - if (modified) |
---|
| 7588 | + if (modified || opposite) |
---|
7180 | 7589 | { |
---|
7181 | 7590 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7182 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7591 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7183 | 7592 | } else |
---|
7184 | 7593 | { |
---|
7185 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7594 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7186 | 7595 | } |
---|
7187 | 7596 | break; |
---|
7188 | 7597 | } |
---|
.. | .. |
---|
7315 | 7724 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7316 | 7725 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7317 | 7726 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7727 | + |
---|
| 7728 | + String objname; |
---|
| 7729 | + |
---|
7318 | 7730 | if (false) //parent != null) |
---|
7319 | 7731 | { |
---|
7320 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7732 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7321 | 7733 | } else |
---|
7322 | 7734 | { |
---|
7323 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7735 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7324 | 7736 | } // + super.toString(); |
---|
7325 | 7737 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7738 | + |
---|
| 7739 | + if (!Globals.ADVANCED) |
---|
| 7740 | + return objname; |
---|
| 7741 | + |
---|
| 7742 | + return objname + " " + System.identityHashCode(this); |
---|
7326 | 7743 | } |
---|
7327 | 7744 | |
---|
7328 | 7745 | public int hashCode() |
---|
.. | .. |
---|
7388 | 7805 | editWindow = null; |
---|
7389 | 7806 | } // ? |
---|
7390 | 7807 | } |
---|
| 7808 | + else |
---|
| 7809 | + { |
---|
| 7810 | + //editWindow.closeUI(); |
---|
| 7811 | + } |
---|
7391 | 7812 | } |
---|
7392 | 7813 | |
---|
7393 | 7814 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7399 | 7820 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7400 | 7821 | |
---|
7401 | 7822 | Object3D /*Composite*/ parent; |
---|
7402 | | - Object3D /*Composite*/ fileparent; |
---|
| 7823 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7403 | 7824 | |
---|
7404 | 7825 | double[][] toParent; // dynamic matrix |
---|
7405 | 7826 | double[][] fromParent; |
---|
.. | .. |
---|
7514 | 7935 | { |
---|
7515 | 7936 | assert(bRep != null); |
---|
7516 | 7937 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7517 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7938 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7518 | 7939 | } |
---|
7519 | 7940 | else |
---|
7520 | 7941 | { |
---|
.. | .. |
---|
7563 | 7984 | private static cVector edge2 = new cVector(); |
---|
7564 | 7985 | //private static cVector norm = new cVector(); |
---|
7565 | 7986 | /*transient private*/ int hitSomething; |
---|
7566 | | - private static final int hitCenter = 1; |
---|
7567 | | - private static final int hitScale = 2; |
---|
7568 | | - private static final int hitRotate = 3; |
---|
| 7987 | + static final int hitCenter = 1; |
---|
| 7988 | + static final int hitScale = 2; |
---|
| 7989 | + static final int hitRotate = 3; |
---|
7569 | 7990 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7570 | 7991 | /*transient*/ private Point centerPt; |
---|
7571 | 7992 | /*transient*/ private int startX; |
---|