.. | .. |
---|
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 || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
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; |
---|
.. | .. |
---|
881 | 966 | if (material == null || material.multiply) |
---|
882 | 967 | return true; |
---|
883 | 968 | |
---|
| 969 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
884 | 970 | return material.opacity > 0.99; |
---|
885 | 971 | } |
---|
886 | 972 | |
---|
.. | .. |
---|
912 | 998 | fromParent = null; // LA.newMatrix(); |
---|
913 | 999 | bRep = null; // new BoundaryRep(); |
---|
914 | 1000 | |
---|
| 1001 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1002 | + { |
---|
| 1003 | + name = oname; |
---|
| 1004 | + } |
---|
| 1005 | + |
---|
915 | 1006 | /* |
---|
916 | 1007 | float hue = (float)Math.random(); |
---|
917 | 1008 | Color col; |
---|
.. | .. |
---|
954 | 1045 | |
---|
955 | 1046 | public Object clone() |
---|
956 | 1047 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1048 | + return Grafreed.clone(this); |
---|
958 | 1049 | } |
---|
959 | 1050 | |
---|
960 | 1051 | Object3D copyExpand() |
---|
.. | .. |
---|
1470 | 1561 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1562 | |
---|
1472 | 1563 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1564 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1565 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1566 | } |
---|
1476 | 1567 | |
---|
.. | .. |
---|
1729 | 1820 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1821 | o.bRep = transientrep; |
---|
1731 | 1822 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1823 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1824 | o.CreateMaterial(); |
---|
1734 | 1825 | o.SetAttributes(this, -1); |
---|
1735 | 1826 | //parent |
---|
.. | .. |
---|
1742 | 1833 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1834 | o.bRep = bRep; |
---|
1744 | 1835 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1836 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1837 | o.CreateMaterial(); |
---|
1747 | 1838 | //o.overwriteThis(this, -1); |
---|
1748 | 1839 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1920 | if (obj.name == null) |
---|
1830 | 1921 | continue; // can't be a null one |
---|
1831 | 1922 | |
---|
| 1923 | + // Try perfect match first. |
---|
1832 | 1924 | if (n.equals(obj.name)) |
---|
1833 | 1925 | { |
---|
1834 | 1926 | theobj = obj; |
---|
1835 | 1927 | count++; |
---|
1836 | 1928 | } |
---|
1837 | 1929 | } |
---|
| 1930 | + |
---|
| 1931 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1932 | |
---|
1839 | 1933 | if (count != 1) |
---|
1840 | 1934 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2294 | 2388 | } |
---|
2295 | 2389 | */ |
---|
2296 | 2390 | } |
---|
| 2391 | + else |
---|
| 2392 | + { |
---|
| 2393 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2394 | + } |
---|
2297 | 2395 | } |
---|
2298 | 2396 | |
---|
2299 | 2397 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
2300 | 2398 | { |
---|
2301 | 2399 | if (newWindow) |
---|
2302 | 2400 | { |
---|
| 2401 | + new Exception().printStackTrace(); |
---|
2303 | 2402 | System.exit(0); |
---|
2304 | 2403 | if (parent != null) |
---|
2305 | 2404 | { |
---|
.. | .. |
---|
2476 | 2575 | return retval; |
---|
2477 | 2576 | } |
---|
2478 | 2577 | |
---|
2479 | | - void doEditDrag(ClickInfo info) |
---|
| 2578 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2480 | 2579 | { |
---|
2481 | 2580 | switch (doSomething) |
---|
2482 | 2581 | { |
---|
2483 | 2582 | case 1: // '\001' |
---|
2484 | 2583 | //super. |
---|
2485 | | - doEditDrag0(info); |
---|
| 2584 | + doEditDrag0(info, opposite); |
---|
2486 | 2585 | break; |
---|
2487 | 2586 | |
---|
2488 | 2587 | case 2: // '\002' |
---|
.. | .. |
---|
2495 | 2594 | { |
---|
2496 | 2595 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2497 | 2596 | //childToDrag.doEditDrag(info); |
---|
2498 | | - sel.doEditDrag(info); |
---|
| 2597 | + sel.doEditDrag(info, opposite); |
---|
2499 | 2598 | } else |
---|
2500 | 2599 | { |
---|
2501 | 2600 | //super. |
---|
2502 | | - doEditDrag0(info); |
---|
| 2601 | + doEditDrag0(info, opposite); |
---|
2503 | 2602 | } |
---|
2504 | 2603 | } |
---|
2505 | 2604 | break; |
---|
.. | .. |
---|
2609 | 2708 | void GenNormalsS(boolean crease) |
---|
2610 | 2709 | { |
---|
2611 | 2710 | selection.GenNormals(crease); |
---|
| 2711 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2712 | +// { |
---|
| 2713 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2714 | +// selectee.GenNormals(crease); |
---|
| 2715 | +// } |
---|
| 2716 | + |
---|
| 2717 | + //Touch(); |
---|
| 2718 | + } |
---|
| 2719 | + |
---|
| 2720 | + void GenNormalsMeshS() |
---|
| 2721 | + { |
---|
| 2722 | + selection.GenNormalsMesh(); |
---|
2612 | 2723 | // for (int i=0; i<selection.size(); i++) |
---|
2613 | 2724 | // { |
---|
2614 | 2725 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2749 | 2860 | if (child == null) |
---|
2750 | 2861 | continue; |
---|
2751 | 2862 | child.GenNormals(crease); |
---|
| 2863 | +// Children().release(i); |
---|
| 2864 | + } |
---|
| 2865 | + blockloop = false; |
---|
| 2866 | + } |
---|
| 2867 | + |
---|
| 2868 | + void GenNormalsMesh() |
---|
| 2869 | + { |
---|
| 2870 | + if (blockloop) |
---|
| 2871 | + return; |
---|
| 2872 | + |
---|
| 2873 | + blockloop = true; |
---|
| 2874 | + GenNormalsMesh0(); |
---|
| 2875 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2876 | + { |
---|
| 2877 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2878 | + if (child == null) |
---|
| 2879 | + continue; |
---|
| 2880 | + child.GenNormalsMesh(); |
---|
2752 | 2881 | // Children().release(i); |
---|
2753 | 2882 | } |
---|
2754 | 2883 | blockloop = false; |
---|
.. | .. |
---|
2921 | 3050 | } |
---|
2922 | 3051 | } |
---|
2923 | 3052 | |
---|
| 3053 | + void GenNormalsMesh0() |
---|
| 3054 | + { |
---|
| 3055 | + if (bRep != null) |
---|
| 3056 | + { |
---|
| 3057 | + bRep.GenerateNormalsMesh(); |
---|
| 3058 | + Touch(); |
---|
| 3059 | + } |
---|
| 3060 | + } |
---|
| 3061 | + |
---|
2924 | 3062 | void GenNormalsMINE0() |
---|
2925 | 3063 | { |
---|
2926 | 3064 | if (bRep != null) |
---|
.. | .. |
---|
2982 | 3120 | blockloop = false; |
---|
2983 | 3121 | } |
---|
2984 | 3122 | |
---|
| 3123 | + void TransformChildren() |
---|
| 3124 | + { |
---|
| 3125 | + if (toParent != null) |
---|
| 3126 | + { |
---|
| 3127 | + for (int i=Size(); --i>=0;) |
---|
| 3128 | + { |
---|
| 3129 | + Object3D v = get(i); |
---|
| 3130 | + |
---|
| 3131 | + if (v.toParent == null) |
---|
| 3132 | + { |
---|
| 3133 | + v.toParent = LA.newMatrix(); |
---|
| 3134 | + v.fromParent = LA.newMatrix(); |
---|
| 3135 | + } |
---|
| 3136 | + |
---|
| 3137 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3138 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3139 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3140 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3141 | + } |
---|
| 3142 | + |
---|
| 3143 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3144 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3145 | + |
---|
| 3146 | + Touch(); |
---|
| 3147 | + } |
---|
| 3148 | + } |
---|
| 3149 | + |
---|
2985 | 3150 | void TransformGeometry() |
---|
2986 | 3151 | { |
---|
2987 | 3152 | Object3D obj = this; |
---|
.. | .. |
---|
3203 | 3368 | |
---|
3204 | 3369 | BoundaryRep sup = bRep.support; |
---|
3205 | 3370 | bRep.support = null; |
---|
3206 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3371 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3207 | 3372 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3208 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3373 | + |
---|
| 3374 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3375 | + |
---|
3209 | 3376 | bRep = temprep; |
---|
3210 | 3377 | bRep.support = sup; |
---|
3211 | 3378 | Touch(); |
---|
.. | .. |
---|
3342 | 3509 | if (blockloop) |
---|
3343 | 3510 | return; |
---|
3344 | 3511 | |
---|
3345 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3512 | + if (//marked || // does not make sense |
---|
| 3513 | + (bRep != null || material != null)) // borderline... |
---|
3346 | 3514 | live = h; |
---|
3347 | 3515 | |
---|
3348 | 3516 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3363 | 3531 | return; |
---|
3364 | 3532 | |
---|
3365 | 3533 | //if (bRep != null) |
---|
3366 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3534 | + if (//marked || // does not make sense |
---|
| 3535 | + (bRep != null || material != null)) // borderline... |
---|
3367 | 3536 | link2master = h; |
---|
3368 | 3537 | |
---|
3369 | 3538 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3383 | 3552 | if (blockloop) |
---|
3384 | 3553 | return; |
---|
3385 | 3554 | |
---|
3386 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3555 | + if (//marked || // does not make sense |
---|
| 3556 | + (bRep != null || material != null)) // borderline... |
---|
3387 | 3557 | hide = h; |
---|
3388 | 3558 | |
---|
3389 | 3559 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3403 | 3573 | if (blockloop) |
---|
3404 | 3574 | return; |
---|
3405 | 3575 | |
---|
3406 | | - if (bRep != null && material != null) // borderline... |
---|
| 3576 | + if (bRep != null || material != null) // borderline... |
---|
3407 | 3577 | marked = h; |
---|
3408 | 3578 | |
---|
3409 | 3579 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3413 | 3583 | continue; |
---|
3414 | 3584 | blockloop = true; |
---|
3415 | 3585 | child.MarkLeaves(h); |
---|
| 3586 | + blockloop = false; |
---|
| 3587 | + // release(i); |
---|
| 3588 | + } |
---|
| 3589 | + } |
---|
| 3590 | + |
---|
| 3591 | + void RewindLeaves(boolean h) |
---|
| 3592 | + { |
---|
| 3593 | + if (blockloop) |
---|
| 3594 | + return; |
---|
| 3595 | + |
---|
| 3596 | + if (bRep != null || material != null) // borderline... |
---|
| 3597 | + rewind = h; |
---|
| 3598 | + |
---|
| 3599 | + for (int i = 0; i < Size(); i++) |
---|
| 3600 | + { |
---|
| 3601 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3602 | + if (child == null) |
---|
| 3603 | + continue; |
---|
| 3604 | + blockloop = true; |
---|
| 3605 | + child.RewindLeaves(h); |
---|
| 3606 | + blockloop = false; |
---|
| 3607 | + // release(i); |
---|
| 3608 | + } |
---|
| 3609 | + } |
---|
| 3610 | + |
---|
| 3611 | + void RandomLeaves(boolean h) |
---|
| 3612 | + { |
---|
| 3613 | + if (blockloop) |
---|
| 3614 | + return; |
---|
| 3615 | + |
---|
| 3616 | + if (bRep != null || material != null) // borderline... |
---|
| 3617 | + random = h; |
---|
| 3618 | + |
---|
| 3619 | + for (int i = 0; i < Size(); i++) |
---|
| 3620 | + { |
---|
| 3621 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3622 | + if (child == null) |
---|
| 3623 | + continue; |
---|
| 3624 | + blockloop = true; |
---|
| 3625 | + child.RandomLeaves(h); |
---|
3416 | 3626 | blockloop = false; |
---|
3417 | 3627 | // release(i); |
---|
3418 | 3628 | } |
---|
.. | .. |
---|
3727 | 3937 | if (child == null) |
---|
3728 | 3938 | continue; |
---|
3729 | 3939 | |
---|
3730 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3940 | + if (Grafreed.RENDERME > 0) |
---|
3731 | 3941 | { |
---|
3732 | 3942 | if (child instanceof Merge) |
---|
3733 | 3943 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3878 | 4088 | if (child == null) |
---|
3879 | 4089 | continue; |
---|
3880 | 4090 | |
---|
3881 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4091 | + if (Grafreed.RENDERME > 0) |
---|
3882 | 4092 | { |
---|
3883 | 4093 | if (child instanceof Merge) |
---|
3884 | 4094 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4073 | 4283 | if (child == null) |
---|
4074 | 4284 | continue; |
---|
4075 | 4285 | |
---|
4076 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4286 | + if (Grafreed.RENDERME > 0) |
---|
4077 | 4287 | { |
---|
4078 | 4288 | if (child instanceof Merge) |
---|
4079 | 4289 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4186 | 4396 | { |
---|
4187 | 4397 | blockloop = true; |
---|
4188 | 4398 | get(i).RepairShadow(); |
---|
| 4399 | + blockloop = false; |
---|
| 4400 | + } |
---|
| 4401 | + } |
---|
| 4402 | + |
---|
| 4403 | + void RepairSOV() |
---|
| 4404 | + { |
---|
| 4405 | + if (blockloop) |
---|
| 4406 | + return; |
---|
| 4407 | + |
---|
| 4408 | + String texname = this.GetPigmentTexture(); |
---|
| 4409 | + |
---|
| 4410 | + if (texname.startsWith("sov")) |
---|
| 4411 | + { |
---|
| 4412 | + String[] s = texname.split("/"); |
---|
| 4413 | + |
---|
| 4414 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4415 | + |
---|
| 4416 | + texname = sname[0]; |
---|
| 4417 | + |
---|
| 4418 | + if (sname.length > 1) |
---|
| 4419 | + { |
---|
| 4420 | + texname += "Color.jpg"; |
---|
| 4421 | + } |
---|
| 4422 | + |
---|
| 4423 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4424 | + } |
---|
| 4425 | + |
---|
| 4426 | + texname = this.GetBumpTexture(); |
---|
| 4427 | + |
---|
| 4428 | + if (texname.startsWith("sov")) |
---|
| 4429 | + { |
---|
| 4430 | + String[] s = texname.split("/"); |
---|
| 4431 | + |
---|
| 4432 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4433 | + |
---|
| 4434 | + texname = sname[0]; |
---|
| 4435 | + |
---|
| 4436 | + if (sname.length > 1) |
---|
| 4437 | + { |
---|
| 4438 | + texname += "Bump.jpg"; |
---|
| 4439 | + } |
---|
| 4440 | + |
---|
| 4441 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4442 | + } |
---|
| 4443 | + |
---|
| 4444 | + for (int i=0; i<Size(); i++) |
---|
| 4445 | + { |
---|
| 4446 | + blockloop = true; |
---|
| 4447 | + get(i).RepairSOV(); |
---|
4189 | 4448 | blockloop = false; |
---|
4190 | 4449 | } |
---|
4191 | 4450 | } |
---|
.. | .. |
---|
4680 | 4939 | |
---|
4681 | 4940 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4682 | 4941 | { |
---|
4683 | | - if (hide) |
---|
| 4942 | + if (hide || dontselect) |
---|
4684 | 4943 | return null; |
---|
4685 | 4944 | |
---|
4686 | 4945 | if (count <= 0) |
---|
.. | .. |
---|
4706 | 4965 | |
---|
4707 | 4966 | cTreePath Select(int indexcount, boolean deselect) |
---|
4708 | 4967 | { |
---|
4709 | | - if (hide) |
---|
| 4968 | + if (hide || dontselect) |
---|
4710 | 4969 | return null; |
---|
4711 | 4970 | |
---|
4712 | 4971 | if (count <= 0) |
---|
.. | .. |
---|
5158 | 5417 | |
---|
5159 | 5418 | // System.out.println("Fullname = " + fullname); |
---|
5160 | 5419 | |
---|
5161 | | - if (fullname.name.indexOf(":") == -1) |
---|
5162 | | - return fullname.name; |
---|
| 5420 | + // Does not work on Windows due to C: |
---|
| 5421 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5422 | +// return fullname.name; |
---|
| 5423 | +// |
---|
| 5424 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5163 | 5425 | |
---|
5164 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5426 | + String[] split = fullname.name.split(":"); |
---|
| 5427 | + |
---|
| 5428 | + if (split.length == 0) |
---|
| 5429 | + { |
---|
| 5430 | + return ""; |
---|
| 5431 | + } |
---|
| 5432 | + |
---|
| 5433 | + if (split.length <= 2) |
---|
| 5434 | + { |
---|
| 5435 | + if (fullname.name.endsWith(":")) |
---|
| 5436 | + { |
---|
| 5437 | + // Windows |
---|
| 5438 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5439 | + } |
---|
| 5440 | + |
---|
| 5441 | + return split[0]; |
---|
| 5442 | + } |
---|
| 5443 | + |
---|
| 5444 | + // Windows |
---|
| 5445 | + assert(split.length == 4); |
---|
| 5446 | + |
---|
| 5447 | + return split[0] + ":" + split[1]; |
---|
5165 | 5448 | } |
---|
5166 | 5449 | |
---|
5167 | 5450 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5170 | 5453 | return ""; |
---|
5171 | 5454 | |
---|
5172 | 5455 | // System.out.println("Fullname = " + fullname); |
---|
5173 | | - if (fullname.name.indexOf(":") == -1) |
---|
5174 | | - return ""; |
---|
5175 | | - |
---|
5176 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5456 | + // Does not work on Windows due to C: |
---|
| 5457 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5458 | +// return ""; |
---|
| 5459 | +// |
---|
| 5460 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5461 | + String[] split = fullname.name.split(":"); |
---|
| 5462 | + |
---|
| 5463 | + if (split.length == 0) |
---|
| 5464 | + { |
---|
| 5465 | + return ""; |
---|
| 5466 | + } |
---|
| 5467 | + |
---|
| 5468 | + if (split.length == 1) |
---|
| 5469 | + { |
---|
| 5470 | + return ""; |
---|
| 5471 | + } |
---|
| 5472 | + |
---|
| 5473 | + if (split.length == 2) |
---|
| 5474 | + { |
---|
| 5475 | + if (fullname.name.endsWith(":")) |
---|
| 5476 | + { |
---|
| 5477 | + // Windows |
---|
| 5478 | + return ""; |
---|
| 5479 | + } |
---|
| 5480 | + |
---|
| 5481 | + return split[1]; |
---|
| 5482 | + } |
---|
| 5483 | + |
---|
| 5484 | + // Windows |
---|
| 5485 | + assert(split.length == 4); |
---|
| 5486 | + |
---|
| 5487 | + return split[2] + ":" + split[3]; |
---|
5177 | 5488 | } |
---|
5178 | 5489 | |
---|
5179 | 5490 | String GetPigmentTexture() |
---|
.. | .. |
---|
5247 | 5558 | System.out.print("; textures = " + textures); |
---|
5248 | 5559 | System.out.println("; usedtextures = " + usedtextures); |
---|
5249 | 5560 | |
---|
5250 | | - if (GetTextures() == null) |
---|
| 5561 | + if (GetTextures() == null) // What is that?? |
---|
5251 | 5562 | GetTextures().name = ":"; |
---|
5252 | 5563 | |
---|
5253 | 5564 | String texname = tex; |
---|
.. | .. |
---|
5278 | 5589 | child.ResetPigmentTexture(); |
---|
5279 | 5590 | blockloop = false; |
---|
5280 | 5591 | } |
---|
| 5592 | + } |
---|
| 5593 | + |
---|
| 5594 | + UUID GetUUID() |
---|
| 5595 | + { |
---|
| 5596 | + if (uuid == null) |
---|
| 5597 | + { |
---|
| 5598 | + // Serial |
---|
| 5599 | + uuid = UUID.randomUUID(); |
---|
| 5600 | + } |
---|
| 5601 | + |
---|
| 5602 | + return uuid; |
---|
| 5603 | + } |
---|
| 5604 | + |
---|
| 5605 | + Object3D GetObject(UUID uid) |
---|
| 5606 | + { |
---|
| 5607 | + if (blockloop) |
---|
| 5608 | + return null; |
---|
| 5609 | + |
---|
| 5610 | + if (GetUUID().equals(uid)) |
---|
| 5611 | + return this; |
---|
| 5612 | + |
---|
| 5613 | + int nb = Size(); |
---|
| 5614 | + for (int i = 0; i < nb; i++) |
---|
| 5615 | + { |
---|
| 5616 | + Object3D child = (Object3D) get(i); |
---|
| 5617 | + |
---|
| 5618 | + if (child == null) |
---|
| 5619 | + continue; |
---|
| 5620 | + |
---|
| 5621 | + blockloop = true; |
---|
| 5622 | + Object3D obj = child.GetObject(uid); |
---|
| 5623 | + blockloop = false; |
---|
| 5624 | + if (obj != null) |
---|
| 5625 | + return obj; |
---|
| 5626 | + } |
---|
| 5627 | + |
---|
| 5628 | + return null; |
---|
5281 | 5629 | } |
---|
5282 | 5630 | |
---|
5283 | 5631 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5324 | 5672 | boolean NeedSupport() |
---|
5325 | 5673 | { |
---|
5326 | 5674 | return |
---|
5327 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5675 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5328 | 5676 | // PROBLEM with CROWD!! |
---|
5329 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5677 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5330 | 5678 | } |
---|
5331 | 5679 | |
---|
5332 | 5680 | static boolean DEBUG_SELECTION = false; |
---|
| 5681 | + |
---|
| 5682 | + boolean IsLive() |
---|
| 5683 | + { |
---|
| 5684 | + if (live) |
---|
| 5685 | + return true; |
---|
| 5686 | + |
---|
| 5687 | + if (parent == null) |
---|
| 5688 | + return false; |
---|
| 5689 | + |
---|
| 5690 | + return parent.IsLive(); |
---|
| 5691 | + } |
---|
5333 | 5692 | |
---|
5334 | 5693 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5335 | 5694 | { |
---|
.. | .. |
---|
5341 | 5700 | } |
---|
5342 | 5701 | |
---|
5343 | 5702 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5344 | | - hide) |
---|
| 5703 | + (hide || dontselect)) |
---|
5345 | 5704 | return; |
---|
5346 | 5705 | |
---|
5347 | 5706 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5392 | 5751 | support = support; |
---|
5393 | 5752 | |
---|
5394 | 5753 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5395 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5754 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5396 | 5755 | |
---|
5397 | 5756 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5398 | 5757 | { |
---|
.. | .. |
---|
5412 | 5771 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5413 | 5772 | |
---|
5414 | 5773 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5415 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5774 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5775 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
5416 | 5776 | { |
---|
5417 | 5777 | Globals.lighttouched = true; |
---|
5418 | 5778 | } // all panes... |
---|
| 5779 | + |
---|
5419 | 5780 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5420 | 5781 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5421 | 5782 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5583 | 5944 | tex = GetTextures(); |
---|
5584 | 5945 | } |
---|
5585 | 5946 | |
---|
5586 | | - display.BindTextures(tex, texres); |
---|
| 5947 | + boolean failedPigment = false; |
---|
| 5948 | + boolean failedBump = false; |
---|
| 5949 | + |
---|
| 5950 | + try |
---|
| 5951 | + { |
---|
| 5952 | + display.BindPigmentTexture(tex, texres); |
---|
| 5953 | + } |
---|
| 5954 | + catch (Exception e) |
---|
| 5955 | + { |
---|
| 5956 | + System.err.println("FAILED: " + this); |
---|
| 5957 | + failedPigment = true; |
---|
| 5958 | + } |
---|
| 5959 | + |
---|
| 5960 | + try |
---|
| 5961 | + { |
---|
| 5962 | + display.BindBumpTexture(tex, texres); |
---|
| 5963 | + } |
---|
| 5964 | + catch (Exception e) |
---|
| 5965 | + { |
---|
| 5966 | + //System.err.println("FAILED: " + this); |
---|
| 5967 | + failedBump = true; |
---|
| 5968 | + } |
---|
5587 | 5969 | |
---|
5588 | 5970 | if (!compiled) |
---|
5589 | 5971 | { |
---|
.. | .. |
---|
5605 | 5987 | } |
---|
5606 | 5988 | } |
---|
5607 | 5989 | |
---|
5608 | | - display.ReleaseTextures(tex); |
---|
| 5990 | + if (!failedBump) |
---|
| 5991 | + display.ReleaseBumpTexture(tex); |
---|
| 5992 | + |
---|
| 5993 | + if (!failedPigment) |
---|
| 5994 | + display.ReleasePigmentTexture(tex); |
---|
5609 | 5995 | |
---|
5610 | 5996 | display.PopMaterial(this, selected); |
---|
5611 | 5997 | } |
---|
.. | .. |
---|
5734 | 6120 | |
---|
5735 | 6121 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5736 | 6122 | { |
---|
| 6123 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6124 | + return; |
---|
| 6125 | + |
---|
5737 | 6126 | if (hide) |
---|
5738 | 6127 | return; |
---|
5739 | 6128 | // shadow optimisation |
---|
.. | .. |
---|
5859 | 6248 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5860 | 6249 | return; // no shadow for transparent objects |
---|
5861 | 6250 | |
---|
| 6251 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6252 | + return; |
---|
| 6253 | + |
---|
5862 | 6254 | if (hide) |
---|
5863 | 6255 | return; |
---|
5864 | 6256 | |
---|
.. | .. |
---|
5972 | 6364 | // dec 2012 |
---|
5973 | 6365 | new Exception().printStackTrace(); |
---|
5974 | 6366 | return; |
---|
| 6367 | + } |
---|
| 6368 | + |
---|
| 6369 | + if (dontselect) |
---|
| 6370 | + { |
---|
| 6371 | + //bRep.GenerateNormalsMINE(); |
---|
5975 | 6372 | } |
---|
5976 | 6373 | |
---|
5977 | 6374 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6824 | 7221 | spot.translate(32, 32); |
---|
6825 | 7222 | spotw = spot.x + spot.width; |
---|
6826 | 7223 | spoth = spot.y + spot.height; |
---|
6827 | | - info.g.setColor(Color.blue); |
---|
| 7224 | + info.g.setColor(Color.cyan); |
---|
6828 | 7225 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6829 | 7226 | // if (CameraPane.Xmin > spot.x) |
---|
6830 | 7227 | // { |
---|
.. | .. |
---|
6842 | 7239 | // { |
---|
6843 | 7240 | // CameraPane.Ymax = spoth; |
---|
6844 | 7241 | // } |
---|
6845 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6846 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7242 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7243 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6847 | 7244 | spot.translate(0, -32); |
---|
6848 | | - info.g.setColor(Color.green); |
---|
| 7245 | + info.g.setColor(Color.yellow); |
---|
6849 | 7246 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7247 | + info.g.setColor(Color.green); |
---|
6850 | 7248 | // if (CameraPane.Xmin > spot.x) |
---|
6851 | 7249 | // { |
---|
6852 | 7250 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6898 | 7296 | startX = info.x; |
---|
6899 | 7297 | startY = info.y; |
---|
6900 | 7298 | |
---|
6901 | | - hitSomething = 0; |
---|
| 7299 | + hitSomething = -1; |
---|
6902 | 7300 | cVector origin = new cVector(); |
---|
6903 | 7301 | //LA.xformPos(origin, toParent, origin); |
---|
6904 | 7302 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6931 | 7329 | } |
---|
6932 | 7330 | |
---|
6933 | 7331 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6934 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7332 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6935 | 7333 | //System.out.println("modified = " + modified); |
---|
6936 | 7334 | //new Exception().printStackTrace(); |
---|
6937 | 7335 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
6959 | 7357 | return true; |
---|
6960 | 7358 | } |
---|
6961 | 7359 | |
---|
6962 | | - void doEditDrag0(ClickInfo info) |
---|
| 7360 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
6963 | 7361 | { |
---|
6964 | 7362 | if (hitSomething == 0) |
---|
6965 | 7363 | { |
---|
.. | .. |
---|
6974 | 7372 | //System.out.println("hitSomething = " + hitSomething); |
---|
6975 | 7373 | |
---|
6976 | 7374 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7375 | + |
---|
6977 | 7376 | cVector xlate = new cVector(); |
---|
6978 | 7377 | //cVector xlate2 = new cVector(); |
---|
6979 | 7378 | switch (hitSomething) |
---|
.. | .. |
---|
6986 | 7385 | |
---|
6987 | 7386 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
6988 | 7387 | |
---|
6989 | | - if (modified) |
---|
| 7388 | + if (modified || opposite) |
---|
6990 | 7389 | { |
---|
6991 | 7390 | //assert(false); |
---|
6992 | 7391 | /* |
---|
.. | .. |
---|
7080 | 7479 | |
---|
7081 | 7480 | if (modified) |
---|
7082 | 7481 | { |
---|
| 7482 | + // Rotate 90 degrees |
---|
7083 | 7483 | angle /= (Math.PI / 4); |
---|
7084 | 7484 | angle = Math.floor(angle + 0.5); |
---|
7085 | 7485 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7121 | 7521 | |
---|
7122 | 7522 | case hitScale: // scale |
---|
7123 | 7523 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7524 | + double sign = 1; |
---|
| 7525 | + if (hScale < 0) |
---|
| 7526 | + { |
---|
| 7527 | + sign = -1; |
---|
| 7528 | + } |
---|
| 7529 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7124 | 7530 | if (hScale < 0.01) |
---|
7125 | 7531 | { |
---|
7126 | | - hScale = 0.01; |
---|
| 7532 | + //hScale = 0.01; |
---|
7127 | 7533 | } |
---|
7128 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7129 | | - if (hScale < 0.01) |
---|
7130 | | - { |
---|
7131 | | - hScale = 0.01; |
---|
7132 | | - } |
---|
| 7534 | + |
---|
7133 | 7535 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7134 | | - if (vScale < 0.01) |
---|
| 7536 | + sign = 1; |
---|
| 7537 | + if (vScale < 0) |
---|
7135 | 7538 | { |
---|
7136 | | - vScale = 0.01; |
---|
| 7539 | + sign = -1; |
---|
7137 | 7540 | } |
---|
7138 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7541 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7139 | 7542 | if (vScale < 0.01) |
---|
7140 | 7543 | { |
---|
7141 | | - vScale = 0.01; |
---|
| 7544 | + //vScale = 0.01; |
---|
7142 | 7545 | } |
---|
7143 | 7546 | LA.matCopy(startMat, toParent); |
---|
7144 | 7547 | /**/ |
---|
.. | .. |
---|
7149 | 7552 | } |
---|
7150 | 7553 | /**/ |
---|
7151 | 7554 | |
---|
| 7555 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7556 | + |
---|
| 7557 | + if (totalScale < 0.01) |
---|
| 7558 | + { |
---|
| 7559 | + totalScale = 0.01; |
---|
| 7560 | + } |
---|
| 7561 | + |
---|
7152 | 7562 | switch (info.pane.RenderCamera().viewCode) |
---|
7153 | 7563 | { |
---|
7154 | 7564 | case 3: // '\001' |
---|
7155 | | - if (modified) |
---|
| 7565 | + if (modified || opposite) |
---|
7156 | 7566 | { |
---|
7157 | 7567 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7158 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7568 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7159 | 7569 | } // vScale, 1); |
---|
7160 | 7570 | else |
---|
7161 | 7571 | { |
---|
7162 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7572 | + // EXCEPTION! |
---|
| 7573 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7163 | 7574 | } // vScale, 1); |
---|
7164 | 7575 | break; |
---|
7165 | 7576 | |
---|
7166 | 7577 | case 2: // '\002' |
---|
7167 | | - if (modified) |
---|
| 7578 | + if (modified || opposite) |
---|
7168 | 7579 | { |
---|
7169 | 7580 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7170 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7581 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7171 | 7582 | } else |
---|
7172 | 7583 | { |
---|
7173 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7584 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7174 | 7585 | } |
---|
7175 | 7586 | break; |
---|
7176 | 7587 | |
---|
7177 | 7588 | case 1: // '\003' |
---|
7178 | | - if (modified) |
---|
| 7589 | + if (modified || opposite) |
---|
7179 | 7590 | { |
---|
7180 | 7591 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7181 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7592 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7182 | 7593 | } else |
---|
7183 | 7594 | { |
---|
7184 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7595 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7185 | 7596 | } |
---|
7186 | 7597 | break; |
---|
7187 | 7598 | } |
---|
.. | .. |
---|
7314 | 7725 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7315 | 7726 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7316 | 7727 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7728 | + |
---|
| 7729 | + String objname; |
---|
| 7730 | + |
---|
7317 | 7731 | if (false) //parent != null) |
---|
7318 | 7732 | { |
---|
7319 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7733 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7320 | 7734 | } else |
---|
7321 | 7735 | { |
---|
7322 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7736 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7323 | 7737 | } // + super.toString(); |
---|
7324 | 7738 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7739 | + |
---|
| 7740 | + if (!Globals.ADVANCED) |
---|
| 7741 | + return objname; |
---|
| 7742 | + |
---|
| 7743 | + return objname + " " + System.identityHashCode(this); |
---|
7325 | 7744 | } |
---|
7326 | 7745 | |
---|
7327 | 7746 | public int hashCode() |
---|
.. | .. |
---|
7377 | 7796 | objectUI.closeUI(); |
---|
7378 | 7797 | if (editWindow != null) |
---|
7379 | 7798 | { |
---|
| 7799 | + editWindow.ctrlPanel.FlushUI(); |
---|
7380 | 7800 | editWindow.refreshContents(); |
---|
7381 | 7801 | } // ? new |
---|
7382 | 7802 | objectUI = null; |
---|
.. | .. |
---|
7385 | 7805 | { |
---|
7386 | 7806 | editWindow = null; |
---|
7387 | 7807 | } // ? |
---|
| 7808 | + } |
---|
| 7809 | + else |
---|
| 7810 | + { |
---|
| 7811 | + //editWindow.closeUI(); |
---|
7388 | 7812 | } |
---|
7389 | 7813 | } |
---|
7390 | 7814 | |
---|
.. | .. |
---|
7397 | 7821 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7398 | 7822 | |
---|
7399 | 7823 | Object3D /*Composite*/ parent; |
---|
7400 | | - Object3D /*Composite*/ fileparent; |
---|
| 7824 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7401 | 7825 | |
---|
7402 | 7826 | double[][] toParent; // dynamic matrix |
---|
7403 | 7827 | double[][] fromParent; |
---|
.. | .. |
---|
7512 | 7936 | { |
---|
7513 | 7937 | assert(bRep != null); |
---|
7514 | 7938 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7515 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7939 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7516 | 7940 | } |
---|
7517 | 7941 | else |
---|
7518 | 7942 | { |
---|
.. | .. |
---|
7561 | 7985 | private static cVector edge2 = new cVector(); |
---|
7562 | 7986 | //private static cVector norm = new cVector(); |
---|
7563 | 7987 | /*transient private*/ int hitSomething; |
---|
7564 | | - private static final int hitCenter = 1; |
---|
7565 | | - private static final int hitScale = 2; |
---|
7566 | | - private static final int hitRotate = 3; |
---|
| 7988 | + static final int hitCenter = 1; |
---|
| 7989 | + static final int hitScale = 2; |
---|
| 7990 | + static final int hitRotate = 3; |
---|
7567 | 7991 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7568 | 7992 | /*transient*/ private Point centerPt; |
---|
7569 | 7993 | /*transient*/ private int startX; |
---|