.. | .. |
---|
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(); |
---|
22 | 26 | |
---|
23 | 27 | ScriptNode scriptnode; |
---|
24 | 28 | |
---|
.. | .. |
---|
156 | 160 | blockloop = true; |
---|
157 | 161 | child.RestoreSupports(); |
---|
158 | 162 | blockloop = false; |
---|
| 163 | + } |
---|
| 164 | +} |
---|
| 165 | + |
---|
| 166 | +void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 167 | +{ |
---|
| 168 | + if (hashtable.containsKey(GetUUID())) |
---|
| 169 | + { |
---|
| 170 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 171 | + |
---|
| 172 | + assert(this.bRep == o.bRep); |
---|
| 173 | + if (this.bRep != null) |
---|
| 174 | + assert(this.bRep.support == o.transientrep); |
---|
| 175 | + |
---|
| 176 | + return; |
---|
| 177 | + } |
---|
| 178 | + |
---|
| 179 | + Object3D o = new Object3D(); |
---|
| 180 | + o.bRep = this.bRep; |
---|
| 181 | + if (this.bRep != null) |
---|
| 182 | + { |
---|
| 183 | + o.transientrep = this.bRep.support; |
---|
| 184 | + o.bRep.support = null; |
---|
| 185 | + } |
---|
| 186 | + |
---|
| 187 | +// o.support = this.support; |
---|
| 188 | +// o.fileparent = this.fileparent; |
---|
| 189 | +// if (this.bRep != null) |
---|
| 190 | +// o.bRep = this.bRep.support; |
---|
| 191 | + |
---|
| 192 | + hashtable.put(GetUUID(), o); |
---|
| 193 | + |
---|
| 194 | + this.bRep = null; |
---|
| 195 | +// if (this.bRep != null) |
---|
| 196 | +// this.bRep.support = null; |
---|
| 197 | +// this.support = null; |
---|
| 198 | +// this.fileparent = null; |
---|
| 199 | + |
---|
| 200 | + for (int i=0; i<Size(); i++) |
---|
| 201 | + { |
---|
| 202 | + get(i).ExtractBigData(hashtable); |
---|
| 203 | + } |
---|
| 204 | +} |
---|
| 205 | + |
---|
| 206 | +void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 207 | +{ |
---|
| 208 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 209 | + return; |
---|
| 210 | + |
---|
| 211 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 212 | + |
---|
| 213 | + this.bRep = o.bRep; |
---|
| 214 | + if (this.bRep != null) |
---|
| 215 | + this.bRep.support = o.transientrep; |
---|
| 216 | +// this.support = o.support; |
---|
| 217 | +// this.fileparent = o.fileparent; |
---|
| 218 | + |
---|
| 219 | + hashtable.remove(GetUUID()); |
---|
| 220 | + |
---|
| 221 | + for (int i=0; i<Size(); i++) |
---|
| 222 | + { |
---|
| 223 | + get(i).RestoreBigData(hashtable); |
---|
159 | 224 | } |
---|
160 | 225 | } |
---|
161 | 226 | |
---|
.. | .. |
---|
300 | 365 | } |
---|
301 | 366 | |
---|
302 | 367 | boolean live = false; |
---|
| 368 | + boolean dontselect = false; |
---|
303 | 369 | boolean hide = false; |
---|
304 | 370 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 371 | boolean marked = false; // animation node |
---|
.. | .. |
---|
774 | 840 | if (step == 0) |
---|
775 | 841 | step = 1; |
---|
776 | 842 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 843 | + maxcount = 128; // 2048; // 4; |
---|
778 | 844 | // if (acceleration == 0) |
---|
779 | 845 | // acceleration = 10; |
---|
780 | 846 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 863 | |
---|
798 | 864 | if (marked && Globals.isLIVE() && live && |
---|
799 | 865 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 866 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
801 | 867 | currentframe != Globals.framecount) |
---|
802 | 868 | { |
---|
803 | 869 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
912 | 978 | fromParent = null; // LA.newMatrix(); |
---|
913 | 979 | bRep = null; // new BoundaryRep(); |
---|
914 | 980 | |
---|
| 981 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 982 | + { |
---|
| 983 | + name = oname; |
---|
| 984 | + } |
---|
| 985 | + |
---|
915 | 986 | /* |
---|
916 | 987 | float hue = (float)Math.random(); |
---|
917 | 988 | Color col; |
---|
.. | .. |
---|
954 | 1025 | |
---|
955 | 1026 | public Object clone() |
---|
956 | 1027 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1028 | + return Grafreed.clone(this); |
---|
958 | 1029 | } |
---|
959 | 1030 | |
---|
960 | 1031 | Object3D copyExpand() |
---|
.. | .. |
---|
1470 | 1541 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1542 | |
---|
1472 | 1543 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1544 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1545 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1546 | } |
---|
1476 | 1547 | |
---|
.. | .. |
---|
1729 | 1800 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1801 | o.bRep = transientrep; |
---|
1731 | 1802 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1803 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1804 | o.CreateMaterial(); |
---|
1734 | 1805 | o.SetAttributes(this, -1); |
---|
1735 | 1806 | //parent |
---|
.. | .. |
---|
1742 | 1813 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1814 | o.bRep = bRep; |
---|
1744 | 1815 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1816 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1817 | o.CreateMaterial(); |
---|
1747 | 1818 | //o.overwriteThis(this, -1); |
---|
1748 | 1819 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1900 | if (obj.name == null) |
---|
1830 | 1901 | continue; // can't be a null one |
---|
1831 | 1902 | |
---|
| 1903 | + // Try perfect match first. |
---|
1832 | 1904 | if (n.equals(obj.name)) |
---|
1833 | 1905 | { |
---|
1834 | 1906 | theobj = obj; |
---|
1835 | 1907 | count++; |
---|
1836 | 1908 | } |
---|
1837 | 1909 | } |
---|
| 1910 | + |
---|
| 1911 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1912 | |
---|
1839 | 1913 | if (count != 1) |
---|
1840 | 1914 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2300 | 2374 | { |
---|
2301 | 2375 | if (newWindow) |
---|
2302 | 2376 | { |
---|
| 2377 | + new Exception().printStackTrace(); |
---|
2303 | 2378 | System.exit(0); |
---|
2304 | 2379 | if (parent != null) |
---|
2305 | 2380 | { |
---|
.. | .. |
---|
2476 | 2551 | return retval; |
---|
2477 | 2552 | } |
---|
2478 | 2553 | |
---|
2479 | | - void doEditDrag(ClickInfo info) |
---|
| 2554 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2480 | 2555 | { |
---|
2481 | 2556 | switch (doSomething) |
---|
2482 | 2557 | { |
---|
2483 | 2558 | case 1: // '\001' |
---|
2484 | 2559 | //super. |
---|
2485 | | - doEditDrag0(info); |
---|
| 2560 | + doEditDrag0(info, opposite); |
---|
2486 | 2561 | break; |
---|
2487 | 2562 | |
---|
2488 | 2563 | case 2: // '\002' |
---|
.. | .. |
---|
2495 | 2570 | { |
---|
2496 | 2571 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2497 | 2572 | //childToDrag.doEditDrag(info); |
---|
2498 | | - sel.doEditDrag(info); |
---|
| 2573 | + sel.doEditDrag(info, opposite); |
---|
2499 | 2574 | } else |
---|
2500 | 2575 | { |
---|
2501 | 2576 | //super. |
---|
2502 | | - doEditDrag0(info); |
---|
| 2577 | + doEditDrag0(info, opposite); |
---|
2503 | 2578 | } |
---|
2504 | 2579 | } |
---|
2505 | 2580 | break; |
---|
.. | .. |
---|
2906 | 2981 | { |
---|
2907 | 2982 | if (bRep != null) |
---|
2908 | 2983 | { |
---|
2909 | | - bRep.GenUV(); |
---|
| 2984 | + bRep.GenUV(); //1); |
---|
| 2985 | + //bRep.UnfoldUV(); |
---|
2910 | 2986 | Touch(); |
---|
2911 | 2987 | } |
---|
2912 | 2988 | } |
---|
.. | .. |
---|
2981 | 3057 | blockloop = false; |
---|
2982 | 3058 | } |
---|
2983 | 3059 | |
---|
| 3060 | + void TransformChildren() |
---|
| 3061 | + { |
---|
| 3062 | + if (toParent != null) |
---|
| 3063 | + { |
---|
| 3064 | + for (int i=Size(); --i>=0;) |
---|
| 3065 | + { |
---|
| 3066 | + Object3D v = get(i); |
---|
| 3067 | + |
---|
| 3068 | + if (v.toParent == null) |
---|
| 3069 | + { |
---|
| 3070 | + v.toParent = LA.newMatrix(); |
---|
| 3071 | + v.fromParent = LA.newMatrix(); |
---|
| 3072 | + } |
---|
| 3073 | + |
---|
| 3074 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3075 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3076 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3077 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3078 | + } |
---|
| 3079 | + |
---|
| 3080 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3081 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3082 | + |
---|
| 3083 | + Touch(); |
---|
| 3084 | + } |
---|
| 3085 | + } |
---|
| 3086 | + |
---|
2984 | 3087 | void TransformGeometry() |
---|
2985 | 3088 | { |
---|
2986 | 3089 | Object3D obj = this; |
---|
.. | .. |
---|
3202 | 3305 | |
---|
3203 | 3306 | BoundaryRep sup = bRep.support; |
---|
3204 | 3307 | bRep.support = null; |
---|
3205 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3308 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3206 | 3309 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3207 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3310 | + |
---|
| 3311 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3312 | + |
---|
3208 | 3313 | bRep = temprep; |
---|
3209 | 3314 | bRep.support = sup; |
---|
3210 | 3315 | Touch(); |
---|
.. | .. |
---|
3726 | 3831 | if (child == null) |
---|
3727 | 3832 | continue; |
---|
3728 | 3833 | |
---|
3729 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3834 | + if (Grafreed.RENDERME > 0) |
---|
3730 | 3835 | { |
---|
3731 | 3836 | if (child instanceof Merge) |
---|
3732 | 3837 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3877 | 3982 | if (child == null) |
---|
3878 | 3983 | continue; |
---|
3879 | 3984 | |
---|
3880 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3985 | + if (Grafreed.RENDERME > 0) |
---|
3881 | 3986 | { |
---|
3882 | 3987 | if (child instanceof Merge) |
---|
3883 | 3988 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4072 | 4177 | if (child == null) |
---|
4073 | 4178 | continue; |
---|
4074 | 4179 | |
---|
4075 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4180 | + if (Grafreed.RENDERME > 0) |
---|
4076 | 4181 | { |
---|
4077 | 4182 | if (child instanceof Merge) |
---|
4078 | 4183 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4679 | 4784 | |
---|
4680 | 4785 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4681 | 4786 | { |
---|
4682 | | - if (hide) |
---|
| 4787 | + if (hide || dontselect) |
---|
4683 | 4788 | return null; |
---|
4684 | 4789 | |
---|
4685 | 4790 | if (count <= 0) |
---|
.. | .. |
---|
4705 | 4810 | |
---|
4706 | 4811 | cTreePath Select(int indexcount, boolean deselect) |
---|
4707 | 4812 | { |
---|
4708 | | - if (hide) |
---|
| 4813 | + if (hide || dontselect) |
---|
4709 | 4814 | return null; |
---|
4710 | 4815 | |
---|
4711 | 4816 | if (count <= 0) |
---|
.. | .. |
---|
5157 | 5262 | |
---|
5158 | 5263 | // System.out.println("Fullname = " + fullname); |
---|
5159 | 5264 | |
---|
5160 | | - if (fullname.name.indexOf(":") == -1) |
---|
5161 | | - return fullname.name; |
---|
| 5265 | + // Does not work on Windows due to C: |
---|
| 5266 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5267 | +// return fullname.name; |
---|
| 5268 | +// |
---|
| 5269 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5162 | 5270 | |
---|
5163 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5271 | + String[] split = fullname.name.split(":"); |
---|
| 5272 | + |
---|
| 5273 | + if (split.length == 0) |
---|
| 5274 | + { |
---|
| 5275 | + return ""; |
---|
| 5276 | + } |
---|
| 5277 | + |
---|
| 5278 | + if (split.length <= 2) |
---|
| 5279 | + { |
---|
| 5280 | + if (fullname.name.endsWith(":")) |
---|
| 5281 | + { |
---|
| 5282 | + // Windows |
---|
| 5283 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5284 | + } |
---|
| 5285 | + |
---|
| 5286 | + return split[0]; |
---|
| 5287 | + } |
---|
| 5288 | + |
---|
| 5289 | + // Windows |
---|
| 5290 | + assert(split.length == 4); |
---|
| 5291 | + |
---|
| 5292 | + return split[0] + ":" + split[1]; |
---|
5164 | 5293 | } |
---|
5165 | 5294 | |
---|
5166 | 5295 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5169 | 5298 | return ""; |
---|
5170 | 5299 | |
---|
5171 | 5300 | // System.out.println("Fullname = " + fullname); |
---|
5172 | | - if (fullname.name.indexOf(":") == -1) |
---|
5173 | | - return ""; |
---|
5174 | | - |
---|
5175 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5301 | + // Does not work on Windows due to C: |
---|
| 5302 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5303 | +// return ""; |
---|
| 5304 | +// |
---|
| 5305 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5306 | + String[] split = fullname.name.split(":"); |
---|
| 5307 | + |
---|
| 5308 | + if (split.length == 0) |
---|
| 5309 | + { |
---|
| 5310 | + return ""; |
---|
| 5311 | + } |
---|
| 5312 | + |
---|
| 5313 | + if (split.length == 1) |
---|
| 5314 | + { |
---|
| 5315 | + return ""; |
---|
| 5316 | + } |
---|
| 5317 | + |
---|
| 5318 | + if (split.length == 2) |
---|
| 5319 | + { |
---|
| 5320 | + if (fullname.name.endsWith(":")) |
---|
| 5321 | + { |
---|
| 5322 | + // Windows |
---|
| 5323 | + return ""; |
---|
| 5324 | + } |
---|
| 5325 | + |
---|
| 5326 | + return split[1]; |
---|
| 5327 | + } |
---|
| 5328 | + |
---|
| 5329 | + // Windows |
---|
| 5330 | + assert(split.length == 4); |
---|
| 5331 | + |
---|
| 5332 | + return split[2] + ":" + split[3]; |
---|
5176 | 5333 | } |
---|
5177 | 5334 | |
---|
5178 | 5335 | String GetPigmentTexture() |
---|
.. | .. |
---|
5246 | 5403 | System.out.print("; textures = " + textures); |
---|
5247 | 5404 | System.out.println("; usedtextures = " + usedtextures); |
---|
5248 | 5405 | |
---|
5249 | | - if (GetTextures() == null) |
---|
| 5406 | + if (GetTextures() == null) // What is that?? |
---|
5250 | 5407 | GetTextures().name = ":"; |
---|
5251 | 5408 | |
---|
5252 | 5409 | String texname = tex; |
---|
.. | .. |
---|
5277 | 5434 | child.ResetPigmentTexture(); |
---|
5278 | 5435 | blockloop = false; |
---|
5279 | 5436 | } |
---|
| 5437 | + } |
---|
| 5438 | + |
---|
| 5439 | + UUID GetUUID() |
---|
| 5440 | + { |
---|
| 5441 | + if (uuid == null) |
---|
| 5442 | + { |
---|
| 5443 | + // Serial |
---|
| 5444 | + uuid = UUID.randomUUID(); |
---|
| 5445 | + } |
---|
| 5446 | + |
---|
| 5447 | + return uuid; |
---|
| 5448 | + } |
---|
| 5449 | + |
---|
| 5450 | + Object3D GetObject(UUID uid) |
---|
| 5451 | + { |
---|
| 5452 | + if (blockloop) |
---|
| 5453 | + return null; |
---|
| 5454 | + |
---|
| 5455 | + if (GetUUID().equals(uid)) |
---|
| 5456 | + return this; |
---|
| 5457 | + |
---|
| 5458 | + int nb = Size(); |
---|
| 5459 | + for (int i = 0; i < nb; i++) |
---|
| 5460 | + { |
---|
| 5461 | + Object3D child = (Object3D) get(i); |
---|
| 5462 | + |
---|
| 5463 | + if (child == null) |
---|
| 5464 | + continue; |
---|
| 5465 | + |
---|
| 5466 | + blockloop = true; |
---|
| 5467 | + Object3D obj = child.GetObject(uid); |
---|
| 5468 | + blockloop = false; |
---|
| 5469 | + if (obj != null) |
---|
| 5470 | + return obj; |
---|
| 5471 | + } |
---|
| 5472 | + |
---|
| 5473 | + return null; |
---|
5280 | 5474 | } |
---|
5281 | 5475 | |
---|
5282 | 5476 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5323 | 5517 | boolean NeedSupport() |
---|
5324 | 5518 | { |
---|
5325 | 5519 | return |
---|
5326 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5520 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5327 | 5521 | // PROBLEM with CROWD!! |
---|
5328 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5522 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5329 | 5523 | } |
---|
5330 | 5524 | |
---|
5331 | 5525 | static boolean DEBUG_SELECTION = false; |
---|
.. | .. |
---|
5340 | 5534 | } |
---|
5341 | 5535 | |
---|
5342 | 5536 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5343 | | - hide) |
---|
| 5537 | + (hide || dontselect)) |
---|
5344 | 5538 | return; |
---|
5345 | 5539 | |
---|
5346 | 5540 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5582 | 5776 | tex = GetTextures(); |
---|
5583 | 5777 | } |
---|
5584 | 5778 | |
---|
5585 | | - display.BindTextures(tex, texres); |
---|
| 5779 | + boolean failed = false; |
---|
| 5780 | + |
---|
| 5781 | + try |
---|
| 5782 | + { |
---|
| 5783 | + display.BindTextures(tex, texres); |
---|
| 5784 | + } |
---|
| 5785 | + catch (Exception e) |
---|
| 5786 | + { |
---|
| 5787 | + System.err.println("FAILED: " + this); |
---|
| 5788 | + failed = true; |
---|
| 5789 | + } |
---|
5586 | 5790 | |
---|
5587 | 5791 | if (!compiled) |
---|
5588 | 5792 | { |
---|
.. | .. |
---|
5604 | 5808 | } |
---|
5605 | 5809 | } |
---|
5606 | 5810 | |
---|
5607 | | - display.ReleaseTextures(tex); |
---|
| 5811 | + if (!failed) |
---|
| 5812 | + display.ReleaseTextures(tex); |
---|
5608 | 5813 | |
---|
5609 | 5814 | display.PopMaterial(this, selected); |
---|
5610 | 5815 | } |
---|
.. | .. |
---|
5733 | 5938 | |
---|
5734 | 5939 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5735 | 5940 | { |
---|
| 5941 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5942 | + return; |
---|
| 5943 | + |
---|
5736 | 5944 | if (hide) |
---|
5737 | 5945 | return; |
---|
5738 | 5946 | // shadow optimisation |
---|
.. | .. |
---|
5858 | 6066 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5859 | 6067 | return; // no shadow for transparent objects |
---|
5860 | 6068 | |
---|
| 6069 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6070 | + return; |
---|
| 6071 | + |
---|
5861 | 6072 | if (hide) |
---|
5862 | 6073 | return; |
---|
5863 | 6074 | |
---|
.. | .. |
---|
5898 | 6109 | return; |
---|
5899 | 6110 | } |
---|
5900 | 6111 | |
---|
| 6112 | + //bRep.GenUV(1/material.diffuseness); |
---|
5901 | 6113 | // bRep.lock = true; |
---|
5902 | 6114 | |
---|
5903 | 6115 | //javax.media.opengl.GL gl = display.GetGL(); |
---|
.. | .. |
---|
6840 | 7052 | // { |
---|
6841 | 7053 | // CameraPane.Ymax = spoth; |
---|
6842 | 7054 | // } |
---|
6843 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6844 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7055 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
| 7056 | + //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
6845 | 7057 | spot.translate(0, -32); |
---|
6846 | 7058 | info.g.setColor(Color.green); |
---|
6847 | 7059 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
6896 | 7108 | startX = info.x; |
---|
6897 | 7109 | startY = info.y; |
---|
6898 | 7110 | |
---|
6899 | | - hitSomething = 0; |
---|
| 7111 | + hitSomething = -1; |
---|
6900 | 7112 | cVector origin = new cVector(); |
---|
6901 | 7113 | //LA.xformPos(origin, toParent, origin); |
---|
6902 | 7114 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6929 | 7141 | } |
---|
6930 | 7142 | |
---|
6931 | 7143 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6932 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7144 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6933 | 7145 | //System.out.println("modified = " + modified); |
---|
6934 | 7146 | //new Exception().printStackTrace(); |
---|
6935 | 7147 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
6957 | 7169 | return true; |
---|
6958 | 7170 | } |
---|
6959 | 7171 | |
---|
6960 | | - void doEditDrag0(ClickInfo info) |
---|
| 7172 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
6961 | 7173 | { |
---|
6962 | 7174 | if (hitSomething == 0) |
---|
6963 | 7175 | { |
---|
.. | .. |
---|
6972 | 7184 | //System.out.println("hitSomething = " + hitSomething); |
---|
6973 | 7185 | |
---|
6974 | 7186 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7187 | + |
---|
6975 | 7188 | cVector xlate = new cVector(); |
---|
6976 | 7189 | //cVector xlate2 = new cVector(); |
---|
6977 | 7190 | switch (hitSomething) |
---|
.. | .. |
---|
6984 | 7197 | |
---|
6985 | 7198 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
6986 | 7199 | |
---|
6987 | | - if (modified) |
---|
| 7200 | + if (modified || opposite) |
---|
6988 | 7201 | { |
---|
6989 | 7202 | //assert(false); |
---|
6990 | 7203 | /* |
---|
.. | .. |
---|
7078 | 7291 | |
---|
7079 | 7292 | if (modified) |
---|
7080 | 7293 | { |
---|
| 7294 | + // Rotate 90 degrees |
---|
7081 | 7295 | angle /= (Math.PI / 4); |
---|
7082 | 7296 | angle = Math.floor(angle + 0.5); |
---|
7083 | 7297 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7119 | 7333 | |
---|
7120 | 7334 | case hitScale: // scale |
---|
7121 | 7335 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7336 | + double sign = 1; |
---|
| 7337 | + if (hScale < 0) |
---|
| 7338 | + { |
---|
| 7339 | + sign = -1; |
---|
| 7340 | + } |
---|
| 7341 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7122 | 7342 | if (hScale < 0.01) |
---|
7123 | 7343 | { |
---|
7124 | | - hScale = 0.01; |
---|
| 7344 | + //hScale = 0.01; |
---|
7125 | 7345 | } |
---|
7126 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7127 | | - if (hScale < 0.01) |
---|
7128 | | - { |
---|
7129 | | - hScale = 0.01; |
---|
7130 | | - } |
---|
| 7346 | + |
---|
7131 | 7347 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7132 | | - if (vScale < 0.01) |
---|
| 7348 | + sign = 1; |
---|
| 7349 | + if (vScale < 0) |
---|
7133 | 7350 | { |
---|
7134 | | - vScale = 0.01; |
---|
| 7351 | + sign = -1; |
---|
7135 | 7352 | } |
---|
7136 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7353 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7137 | 7354 | if (vScale < 0.01) |
---|
7138 | 7355 | { |
---|
7139 | | - vScale = 0.01; |
---|
| 7356 | + //vScale = 0.01; |
---|
7140 | 7357 | } |
---|
7141 | 7358 | LA.matCopy(startMat, toParent); |
---|
7142 | 7359 | /**/ |
---|
.. | .. |
---|
7147 | 7364 | } |
---|
7148 | 7365 | /**/ |
---|
7149 | 7366 | |
---|
| 7367 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7368 | + |
---|
| 7369 | + if (totalScale < 0.01) |
---|
| 7370 | + { |
---|
| 7371 | + totalScale = 0.01; |
---|
| 7372 | + } |
---|
| 7373 | + |
---|
7150 | 7374 | switch (info.pane.RenderCamera().viewCode) |
---|
7151 | 7375 | { |
---|
7152 | 7376 | case 3: // '\001' |
---|
7153 | 7377 | if (modified) |
---|
7154 | 7378 | { |
---|
7155 | 7379 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7156 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7380 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7157 | 7381 | } // vScale, 1); |
---|
7158 | 7382 | else |
---|
7159 | 7383 | { |
---|
7160 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7384 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7161 | 7385 | } // vScale, 1); |
---|
7162 | 7386 | break; |
---|
7163 | 7387 | |
---|
.. | .. |
---|
7165 | 7389 | if (modified) |
---|
7166 | 7390 | { |
---|
7167 | 7391 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7168 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7392 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7169 | 7393 | } else |
---|
7170 | 7394 | { |
---|
7171 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7395 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7172 | 7396 | } |
---|
7173 | 7397 | break; |
---|
7174 | 7398 | |
---|
.. | .. |
---|
7176 | 7400 | if (modified) |
---|
7177 | 7401 | { |
---|
7178 | 7402 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7179 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7403 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7180 | 7404 | } else |
---|
7181 | 7405 | { |
---|
7182 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7406 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7183 | 7407 | } |
---|
7184 | 7408 | break; |
---|
7185 | 7409 | } |
---|
.. | .. |
---|
7312 | 7536 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7313 | 7537 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7314 | 7538 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7539 | + |
---|
| 7540 | + String objname; |
---|
| 7541 | + |
---|
7315 | 7542 | if (false) //parent != null) |
---|
7316 | 7543 | { |
---|
7317 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7544 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7318 | 7545 | } else |
---|
7319 | 7546 | { |
---|
7320 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7547 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7321 | 7548 | } // + super.toString(); |
---|
7322 | 7549 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7550 | + |
---|
| 7551 | + if (!Globals.ADVANCED) |
---|
| 7552 | + return objname; |
---|
| 7553 | + |
---|
| 7554 | + return objname + " " + System.identityHashCode(this); |
---|
7323 | 7555 | } |
---|
7324 | 7556 | |
---|
7325 | 7557 | public int hashCode() |
---|
.. | .. |
---|
7375 | 7607 | objectUI.closeUI(); |
---|
7376 | 7608 | if (editWindow != null) |
---|
7377 | 7609 | { |
---|
| 7610 | + editWindow.ctrlPanel.FlushUI(); |
---|
7378 | 7611 | editWindow.refreshContents(); |
---|
7379 | 7612 | } // ? new |
---|
7380 | 7613 | objectUI = null; |
---|
.. | .. |
---|
7395 | 7628 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7396 | 7629 | |
---|
7397 | 7630 | Object3D /*Composite*/ parent; |
---|
7398 | | - Object3D /*Composite*/ fileparent; |
---|
| 7631 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7399 | 7632 | |
---|
7400 | 7633 | double[][] toParent; // dynamic matrix |
---|
7401 | 7634 | double[][] fromParent; |
---|
.. | .. |
---|
7510 | 7743 | { |
---|
7511 | 7744 | assert(bRep != null); |
---|
7512 | 7745 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7513 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7746 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7514 | 7747 | } |
---|
7515 | 7748 | else |
---|
7516 | 7749 | { |
---|
.. | .. |
---|
7559 | 7792 | private static cVector edge2 = new cVector(); |
---|
7560 | 7793 | //private static cVector norm = new cVector(); |
---|
7561 | 7794 | /*transient private*/ int hitSomething; |
---|
7562 | | - private static final int hitCenter = 1; |
---|
7563 | | - private static final int hitScale = 2; |
---|
7564 | | - private static final int hitRotate = 3; |
---|
| 7795 | + static final int hitCenter = 1; |
---|
| 7796 | + static final int hitScale = 2; |
---|
| 7797 | + static final int hitRotate = 3; |
---|
7565 | 7798 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7566 | 7799 | /*transient*/ private Point centerPt; |
---|
7567 | 7800 | /*transient*/ private int startX; |
---|