.. | .. |
---|
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 | + return; |
---|
| 170 | + |
---|
| 171 | + Object3D o = new Object3D(); |
---|
| 172 | + o.bRep = this.bRep; |
---|
| 173 | + if (this.bRep != null) |
---|
| 174 | + { |
---|
| 175 | + o.transientrep = this.bRep.support; |
---|
| 176 | + o.bRep.support = null; |
---|
| 177 | + } |
---|
| 178 | + |
---|
| 179 | +// o.support = this.support; |
---|
| 180 | +// o.fileparent = this.fileparent; |
---|
| 181 | +// if (this.bRep != null) |
---|
| 182 | +// o.bRep = this.bRep.support; |
---|
| 183 | + |
---|
| 184 | + hashtable.put(GetUUID(), o); |
---|
| 185 | + |
---|
| 186 | + this.bRep = null; |
---|
| 187 | +// if (this.bRep != null) |
---|
| 188 | +// this.bRep.support = null; |
---|
| 189 | +// this.support = null; |
---|
| 190 | +// this.fileparent = null; |
---|
| 191 | + |
---|
| 192 | + for (int i=0; i<Size(); i++) |
---|
| 193 | + { |
---|
| 194 | + get(i).ExtractBigData(hashtable); |
---|
| 195 | + } |
---|
| 196 | +} |
---|
| 197 | + |
---|
| 198 | +void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 199 | +{ |
---|
| 200 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 201 | + return; |
---|
| 202 | + |
---|
| 203 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 204 | + |
---|
| 205 | + this.bRep = o.bRep; |
---|
| 206 | + if (this.bRep != null) |
---|
| 207 | + this.bRep.support = o.transientrep; |
---|
| 208 | +// this.support = o.support; |
---|
| 209 | +// this.fileparent = o.fileparent; |
---|
| 210 | + |
---|
| 211 | + hashtable.remove(GetUUID()); |
---|
| 212 | + |
---|
| 213 | + for (int i=0; i<Size(); i++) |
---|
| 214 | + { |
---|
| 215 | + get(i).RestoreBigData(hashtable); |
---|
159 | 216 | } |
---|
160 | 217 | } |
---|
161 | 218 | |
---|
.. | .. |
---|
300 | 357 | } |
---|
301 | 358 | |
---|
302 | 359 | boolean live = false; |
---|
| 360 | + boolean dontselect = false; |
---|
303 | 361 | boolean hide = false; |
---|
304 | 362 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 363 | boolean marked = false; // animation node |
---|
.. | .. |
---|
774 | 832 | if (step == 0) |
---|
775 | 833 | step = 1; |
---|
776 | 834 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 835 | + maxcount = 128; // 2048; // 4; |
---|
778 | 836 | // if (acceleration == 0) |
---|
779 | 837 | // acceleration = 10; |
---|
780 | 838 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 855 | |
---|
798 | 856 | if (marked && Globals.isLIVE() && live && |
---|
799 | 857 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 858 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
801 | 859 | currentframe != Globals.framecount) |
---|
802 | 860 | { |
---|
803 | 861 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
912 | 970 | fromParent = null; // LA.newMatrix(); |
---|
913 | 971 | bRep = null; // new BoundaryRep(); |
---|
914 | 972 | |
---|
| 973 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 974 | + { |
---|
| 975 | + name = oname; |
---|
| 976 | + } |
---|
| 977 | + |
---|
915 | 978 | /* |
---|
916 | 979 | float hue = (float)Math.random(); |
---|
917 | 980 | Color col; |
---|
.. | .. |
---|
954 | 1017 | |
---|
955 | 1018 | public Object clone() |
---|
956 | 1019 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1020 | + return Grafreed.clone(this); |
---|
958 | 1021 | } |
---|
959 | 1022 | |
---|
960 | 1023 | Object3D copyExpand() |
---|
.. | .. |
---|
1470 | 1533 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1534 | |
---|
1472 | 1535 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1536 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1537 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1538 | } |
---|
1476 | 1539 | |
---|
.. | .. |
---|
1729 | 1792 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1793 | o.bRep = transientrep; |
---|
1731 | 1794 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1795 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1796 | o.CreateMaterial(); |
---|
1734 | 1797 | o.SetAttributes(this, -1); |
---|
1735 | 1798 | //parent |
---|
.. | .. |
---|
1742 | 1805 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1806 | o.bRep = bRep; |
---|
1744 | 1807 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1808 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1809 | o.CreateMaterial(); |
---|
1747 | 1810 | //o.overwriteThis(this, -1); |
---|
1748 | 1811 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1892 | if (obj.name == null) |
---|
1830 | 1893 | continue; // can't be a null one |
---|
1831 | 1894 | |
---|
| 1895 | + // Try perfect match first. |
---|
1832 | 1896 | if (n.equals(obj.name)) |
---|
1833 | 1897 | { |
---|
1834 | 1898 | theobj = obj; |
---|
1835 | 1899 | count++; |
---|
1836 | 1900 | } |
---|
1837 | 1901 | } |
---|
| 1902 | + |
---|
| 1903 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1904 | |
---|
1839 | 1905 | if (count != 1) |
---|
1840 | 1906 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2300 | 2366 | { |
---|
2301 | 2367 | if (newWindow) |
---|
2302 | 2368 | { |
---|
| 2369 | + new Exception().printStackTrace(); |
---|
2303 | 2370 | System.exit(0); |
---|
2304 | 2371 | if (parent != null) |
---|
2305 | 2372 | { |
---|
.. | .. |
---|
2476 | 2543 | return retval; |
---|
2477 | 2544 | } |
---|
2478 | 2545 | |
---|
2479 | | - void doEditDrag(ClickInfo info) |
---|
| 2546 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2480 | 2547 | { |
---|
2481 | 2548 | switch (doSomething) |
---|
2482 | 2549 | { |
---|
2483 | 2550 | case 1: // '\001' |
---|
2484 | 2551 | //super. |
---|
2485 | | - doEditDrag0(info); |
---|
| 2552 | + doEditDrag0(info, opposite); |
---|
2486 | 2553 | break; |
---|
2487 | 2554 | |
---|
2488 | 2555 | case 2: // '\002' |
---|
.. | .. |
---|
2495 | 2562 | { |
---|
2496 | 2563 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2497 | 2564 | //childToDrag.doEditDrag(info); |
---|
2498 | | - sel.doEditDrag(info); |
---|
| 2565 | + sel.doEditDrag(info, opposite); |
---|
2499 | 2566 | } else |
---|
2500 | 2567 | { |
---|
2501 | 2568 | //super. |
---|
2502 | | - doEditDrag0(info); |
---|
| 2569 | + doEditDrag0(info, opposite); |
---|
2503 | 2570 | } |
---|
2504 | 2571 | } |
---|
2505 | 2572 | break; |
---|
.. | .. |
---|
2982 | 3049 | blockloop = false; |
---|
2983 | 3050 | } |
---|
2984 | 3051 | |
---|
| 3052 | + void TransformChildren() |
---|
| 3053 | + { |
---|
| 3054 | + if (toParent != null) |
---|
| 3055 | + { |
---|
| 3056 | + for (int i=Size(); --i>=0;) |
---|
| 3057 | + { |
---|
| 3058 | + Object3D v = get(i); |
---|
| 3059 | + |
---|
| 3060 | + if (v.toParent == null) |
---|
| 3061 | + { |
---|
| 3062 | + v.toParent = LA.newMatrix(); |
---|
| 3063 | + v.fromParent = LA.newMatrix(); |
---|
| 3064 | + } |
---|
| 3065 | + |
---|
| 3066 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3067 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3068 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3069 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3070 | + } |
---|
| 3071 | + |
---|
| 3072 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3073 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3074 | + |
---|
| 3075 | + Touch(); |
---|
| 3076 | + } |
---|
| 3077 | + } |
---|
| 3078 | + |
---|
2985 | 3079 | void TransformGeometry() |
---|
2986 | 3080 | { |
---|
2987 | 3081 | Object3D obj = this; |
---|
.. | .. |
---|
3203 | 3297 | |
---|
3204 | 3298 | BoundaryRep sup = bRep.support; |
---|
3205 | 3299 | bRep.support = null; |
---|
3206 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3300 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3207 | 3301 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3208 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3302 | + |
---|
| 3303 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3304 | + |
---|
3209 | 3305 | bRep = temprep; |
---|
3210 | 3306 | bRep.support = sup; |
---|
3211 | 3307 | Touch(); |
---|
.. | .. |
---|
3727 | 3823 | if (child == null) |
---|
3728 | 3824 | continue; |
---|
3729 | 3825 | |
---|
3730 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3826 | + if (Grafreed.RENDERME > 0) |
---|
3731 | 3827 | { |
---|
3732 | 3828 | if (child instanceof Merge) |
---|
3733 | 3829 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3878 | 3974 | if (child == null) |
---|
3879 | 3975 | continue; |
---|
3880 | 3976 | |
---|
3881 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3977 | + if (Grafreed.RENDERME > 0) |
---|
3882 | 3978 | { |
---|
3883 | 3979 | if (child instanceof Merge) |
---|
3884 | 3980 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4073 | 4169 | if (child == null) |
---|
4074 | 4170 | continue; |
---|
4075 | 4171 | |
---|
4076 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4172 | + if (Grafreed.RENDERME > 0) |
---|
4077 | 4173 | { |
---|
4078 | 4174 | if (child instanceof Merge) |
---|
4079 | 4175 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4680 | 4776 | |
---|
4681 | 4777 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4682 | 4778 | { |
---|
4683 | | - if (hide) |
---|
| 4779 | + if (hide || dontselect) |
---|
4684 | 4780 | return null; |
---|
4685 | 4781 | |
---|
4686 | 4782 | if (count <= 0) |
---|
.. | .. |
---|
4706 | 4802 | |
---|
4707 | 4803 | cTreePath Select(int indexcount, boolean deselect) |
---|
4708 | 4804 | { |
---|
4709 | | - if (hide) |
---|
| 4805 | + if (hide || dontselect) |
---|
4710 | 4806 | return null; |
---|
4711 | 4807 | |
---|
4712 | 4808 | if (count <= 0) |
---|
.. | .. |
---|
5158 | 5254 | |
---|
5159 | 5255 | // System.out.println("Fullname = " + fullname); |
---|
5160 | 5256 | |
---|
5161 | | - if (fullname.name.indexOf(":") == -1) |
---|
5162 | | - return fullname.name; |
---|
| 5257 | + // Does not work on Windows due to C: |
---|
| 5258 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5259 | +// return fullname.name; |
---|
| 5260 | +// |
---|
| 5261 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5163 | 5262 | |
---|
5164 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5263 | + String[] split = fullname.name.split(":"); |
---|
| 5264 | + |
---|
| 5265 | + if (split.length == 0) |
---|
| 5266 | + { |
---|
| 5267 | + return ""; |
---|
| 5268 | + } |
---|
| 5269 | + |
---|
| 5270 | + if (split.length <= 2) |
---|
| 5271 | + { |
---|
| 5272 | + if (fullname.name.endsWith(":")) |
---|
| 5273 | + { |
---|
| 5274 | + // Windows |
---|
| 5275 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5276 | + } |
---|
| 5277 | + |
---|
| 5278 | + return split[0]; |
---|
| 5279 | + } |
---|
| 5280 | + |
---|
| 5281 | + // Windows |
---|
| 5282 | + assert(split.length == 4); |
---|
| 5283 | + |
---|
| 5284 | + return split[0] + ":" + split[1]; |
---|
5165 | 5285 | } |
---|
5166 | 5286 | |
---|
5167 | 5287 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5170 | 5290 | return ""; |
---|
5171 | 5291 | |
---|
5172 | 5292 | // 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()); |
---|
| 5293 | + // Does not work on Windows due to C: |
---|
| 5294 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5295 | +// return ""; |
---|
| 5296 | +// |
---|
| 5297 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5298 | + String[] split = fullname.name.split(":"); |
---|
| 5299 | + |
---|
| 5300 | + if (split.length == 0) |
---|
| 5301 | + { |
---|
| 5302 | + return ""; |
---|
| 5303 | + } |
---|
| 5304 | + |
---|
| 5305 | + if (split.length == 1) |
---|
| 5306 | + { |
---|
| 5307 | + return ""; |
---|
| 5308 | + } |
---|
| 5309 | + |
---|
| 5310 | + if (split.length == 2) |
---|
| 5311 | + { |
---|
| 5312 | + if (fullname.name.endsWith(":")) |
---|
| 5313 | + { |
---|
| 5314 | + // Windows |
---|
| 5315 | + return ""; |
---|
| 5316 | + } |
---|
| 5317 | + |
---|
| 5318 | + return split[1]; |
---|
| 5319 | + } |
---|
| 5320 | + |
---|
| 5321 | + // Windows |
---|
| 5322 | + assert(split.length == 4); |
---|
| 5323 | + |
---|
| 5324 | + return split[2] + ":" + split[3]; |
---|
5177 | 5325 | } |
---|
5178 | 5326 | |
---|
5179 | 5327 | String GetPigmentTexture() |
---|
.. | .. |
---|
5247 | 5395 | System.out.print("; textures = " + textures); |
---|
5248 | 5396 | System.out.println("; usedtextures = " + usedtextures); |
---|
5249 | 5397 | |
---|
5250 | | - if (GetTextures() == null) |
---|
| 5398 | + if (GetTextures() == null) // What is that?? |
---|
5251 | 5399 | GetTextures().name = ":"; |
---|
5252 | 5400 | |
---|
5253 | 5401 | String texname = tex; |
---|
.. | .. |
---|
5278 | 5426 | child.ResetPigmentTexture(); |
---|
5279 | 5427 | blockloop = false; |
---|
5280 | 5428 | } |
---|
| 5429 | + } |
---|
| 5430 | + |
---|
| 5431 | + UUID GetUUID() |
---|
| 5432 | + { |
---|
| 5433 | + if (uuid == null) |
---|
| 5434 | + { |
---|
| 5435 | + // Serial |
---|
| 5436 | + uuid = UUID.randomUUID(); |
---|
| 5437 | + } |
---|
| 5438 | + |
---|
| 5439 | + return uuid; |
---|
| 5440 | + } |
---|
| 5441 | + |
---|
| 5442 | + Object3D GetObject(UUID uid) |
---|
| 5443 | + { |
---|
| 5444 | + if (blockloop) |
---|
| 5445 | + return null; |
---|
| 5446 | + |
---|
| 5447 | + if (GetUUID().equals(uid)) |
---|
| 5448 | + return this; |
---|
| 5449 | + |
---|
| 5450 | + int nb = Size(); |
---|
| 5451 | + for (int i = 0; i < nb; i++) |
---|
| 5452 | + { |
---|
| 5453 | + Object3D child = (Object3D) get(i); |
---|
| 5454 | + |
---|
| 5455 | + if (child == null) |
---|
| 5456 | + continue; |
---|
| 5457 | + |
---|
| 5458 | + blockloop = true; |
---|
| 5459 | + Object3D obj = child.GetObject(uid); |
---|
| 5460 | + blockloop = false; |
---|
| 5461 | + if (obj != null) |
---|
| 5462 | + return obj; |
---|
| 5463 | + } |
---|
| 5464 | + |
---|
| 5465 | + return null; |
---|
5281 | 5466 | } |
---|
5282 | 5467 | |
---|
5283 | 5468 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5324 | 5509 | boolean NeedSupport() |
---|
5325 | 5510 | { |
---|
5326 | 5511 | return |
---|
5327 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5512 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5328 | 5513 | // PROBLEM with CROWD!! |
---|
5329 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5514 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5330 | 5515 | } |
---|
5331 | 5516 | |
---|
5332 | 5517 | static boolean DEBUG_SELECTION = false; |
---|
.. | .. |
---|
5341 | 5526 | } |
---|
5342 | 5527 | |
---|
5343 | 5528 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5344 | | - hide) |
---|
| 5529 | + (hide || dontselect)) |
---|
5345 | 5530 | return; |
---|
5346 | 5531 | |
---|
5347 | 5532 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5583 | 5768 | tex = GetTextures(); |
---|
5584 | 5769 | } |
---|
5585 | 5770 | |
---|
5586 | | - display.BindTextures(tex, texres); |
---|
| 5771 | + boolean failed = false; |
---|
| 5772 | + |
---|
| 5773 | + try |
---|
| 5774 | + { |
---|
| 5775 | + display.BindTextures(tex, texres); |
---|
| 5776 | + } |
---|
| 5777 | + catch (Exception e) |
---|
| 5778 | + { |
---|
| 5779 | + System.err.println("FAILED: " + this); |
---|
| 5780 | + failed = true; |
---|
| 5781 | + } |
---|
5587 | 5782 | |
---|
5588 | 5783 | if (!compiled) |
---|
5589 | 5784 | { |
---|
.. | .. |
---|
5605 | 5800 | } |
---|
5606 | 5801 | } |
---|
5607 | 5802 | |
---|
5608 | | - display.ReleaseTextures(tex); |
---|
| 5803 | + if (!failed) |
---|
| 5804 | + display.ReleaseTextures(tex); |
---|
5609 | 5805 | |
---|
5610 | 5806 | display.PopMaterial(this, selected); |
---|
5611 | 5807 | } |
---|
.. | .. |
---|
5734 | 5930 | |
---|
5735 | 5931 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5736 | 5932 | { |
---|
| 5933 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5934 | + return; |
---|
| 5935 | + |
---|
5737 | 5936 | if (hide) |
---|
5738 | 5937 | return; |
---|
5739 | 5938 | // shadow optimisation |
---|
.. | .. |
---|
5858 | 6057 | { |
---|
5859 | 6058 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5860 | 6059 | return; // no shadow for transparent objects |
---|
| 6060 | + |
---|
| 6061 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6062 | + return; |
---|
5861 | 6063 | |
---|
5862 | 6064 | if (hide) |
---|
5863 | 6065 | return; |
---|
.. | .. |
---|
6842 | 7044 | // { |
---|
6843 | 7045 | // CameraPane.Ymax = spoth; |
---|
6844 | 7046 | // } |
---|
6845 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6846 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7047 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
| 7048 | + //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
6847 | 7049 | spot.translate(0, -32); |
---|
6848 | 7050 | info.g.setColor(Color.green); |
---|
6849 | 7051 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
6898 | 7100 | startX = info.x; |
---|
6899 | 7101 | startY = info.y; |
---|
6900 | 7102 | |
---|
6901 | | - hitSomething = 0; |
---|
| 7103 | + hitSomething = -1; |
---|
6902 | 7104 | cVector origin = new cVector(); |
---|
6903 | 7105 | //LA.xformPos(origin, toParent, origin); |
---|
6904 | 7106 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6931 | 7133 | } |
---|
6932 | 7134 | |
---|
6933 | 7135 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6934 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7136 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6935 | 7137 | //System.out.println("modified = " + modified); |
---|
6936 | 7138 | //new Exception().printStackTrace(); |
---|
6937 | 7139 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
6959 | 7161 | return true; |
---|
6960 | 7162 | } |
---|
6961 | 7163 | |
---|
6962 | | - void doEditDrag0(ClickInfo info) |
---|
| 7164 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
6963 | 7165 | { |
---|
6964 | 7166 | if (hitSomething == 0) |
---|
6965 | 7167 | { |
---|
.. | .. |
---|
6974 | 7176 | //System.out.println("hitSomething = " + hitSomething); |
---|
6975 | 7177 | |
---|
6976 | 7178 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7179 | + |
---|
6977 | 7180 | cVector xlate = new cVector(); |
---|
6978 | 7181 | //cVector xlate2 = new cVector(); |
---|
6979 | 7182 | switch (hitSomething) |
---|
.. | .. |
---|
6986 | 7189 | |
---|
6987 | 7190 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
6988 | 7191 | |
---|
6989 | | - if (modified) |
---|
| 7192 | + if (modified || opposite) |
---|
6990 | 7193 | { |
---|
6991 | 7194 | //assert(false); |
---|
6992 | 7195 | /* |
---|
.. | .. |
---|
7080 | 7283 | |
---|
7081 | 7284 | if (modified) |
---|
7082 | 7285 | { |
---|
| 7286 | + // Rotate 90 degrees |
---|
7083 | 7287 | angle /= (Math.PI / 4); |
---|
7084 | 7288 | angle = Math.floor(angle + 0.5); |
---|
7085 | 7289 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7121 | 7325 | |
---|
7122 | 7326 | case hitScale: // scale |
---|
7123 | 7327 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7328 | + double sign = 1; |
---|
| 7329 | + if (hScale < 0) |
---|
| 7330 | + { |
---|
| 7331 | + sign = -1; |
---|
| 7332 | + } |
---|
| 7333 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7124 | 7334 | if (hScale < 0.01) |
---|
7125 | 7335 | { |
---|
7126 | | - hScale = 0.01; |
---|
| 7336 | + //hScale = 0.01; |
---|
7127 | 7337 | } |
---|
7128 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7129 | | - if (hScale < 0.01) |
---|
7130 | | - { |
---|
7131 | | - hScale = 0.01; |
---|
7132 | | - } |
---|
| 7338 | + |
---|
7133 | 7339 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7134 | | - if (vScale < 0.01) |
---|
| 7340 | + sign = 1; |
---|
| 7341 | + if (vScale < 0) |
---|
7135 | 7342 | { |
---|
7136 | | - vScale = 0.01; |
---|
| 7343 | + sign = -1; |
---|
7137 | 7344 | } |
---|
7138 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7345 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7139 | 7346 | if (vScale < 0.01) |
---|
7140 | 7347 | { |
---|
7141 | | - vScale = 0.01; |
---|
| 7348 | + //vScale = 0.01; |
---|
7142 | 7349 | } |
---|
7143 | 7350 | LA.matCopy(startMat, toParent); |
---|
7144 | 7351 | /**/ |
---|
.. | .. |
---|
7149 | 7356 | } |
---|
7150 | 7357 | /**/ |
---|
7151 | 7358 | |
---|
| 7359 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7360 | + |
---|
| 7361 | + if (totalScale < 0.01) |
---|
| 7362 | + { |
---|
| 7363 | + totalScale = 0.01; |
---|
| 7364 | + } |
---|
| 7365 | + |
---|
7152 | 7366 | switch (info.pane.RenderCamera().viewCode) |
---|
7153 | 7367 | { |
---|
7154 | 7368 | case 3: // '\001' |
---|
7155 | 7369 | if (modified) |
---|
7156 | 7370 | { |
---|
7157 | 7371 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7158 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7372 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7159 | 7373 | } // vScale, 1); |
---|
7160 | 7374 | else |
---|
7161 | 7375 | { |
---|
7162 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7376 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7163 | 7377 | } // vScale, 1); |
---|
7164 | 7378 | break; |
---|
7165 | 7379 | |
---|
.. | .. |
---|
7167 | 7381 | if (modified) |
---|
7168 | 7382 | { |
---|
7169 | 7383 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7170 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7384 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7171 | 7385 | } else |
---|
7172 | 7386 | { |
---|
7173 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7387 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7174 | 7388 | } |
---|
7175 | 7389 | break; |
---|
7176 | 7390 | |
---|
.. | .. |
---|
7178 | 7392 | if (modified) |
---|
7179 | 7393 | { |
---|
7180 | 7394 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7181 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7395 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7182 | 7396 | } else |
---|
7183 | 7397 | { |
---|
7184 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7398 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7185 | 7399 | } |
---|
7186 | 7400 | break; |
---|
7187 | 7401 | } |
---|
.. | .. |
---|
7314 | 7528 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7315 | 7529 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7316 | 7530 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7531 | + |
---|
| 7532 | + String objname; |
---|
| 7533 | + |
---|
7317 | 7534 | if (false) //parent != null) |
---|
7318 | 7535 | { |
---|
7319 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7536 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7320 | 7537 | } else |
---|
7321 | 7538 | { |
---|
7322 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7539 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7323 | 7540 | } // + super.toString(); |
---|
7324 | 7541 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7542 | + |
---|
| 7543 | + if (!Globals.ADVANCED) |
---|
| 7544 | + return objname; |
---|
| 7545 | + |
---|
| 7546 | + return objname + " " + System.identityHashCode(this); |
---|
7325 | 7547 | } |
---|
7326 | 7548 | |
---|
7327 | 7549 | public int hashCode() |
---|
.. | .. |
---|
7377 | 7599 | objectUI.closeUI(); |
---|
7378 | 7600 | if (editWindow != null) |
---|
7379 | 7601 | { |
---|
| 7602 | + editWindow.ctrlPanel.FlushUI(); |
---|
7380 | 7603 | editWindow.refreshContents(); |
---|
7381 | 7604 | } // ? new |
---|
7382 | 7605 | objectUI = null; |
---|
.. | .. |
---|
7397 | 7620 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7398 | 7621 | |
---|
7399 | 7622 | Object3D /*Composite*/ parent; |
---|
7400 | | - Object3D /*Composite*/ fileparent; |
---|
| 7623 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7401 | 7624 | |
---|
7402 | 7625 | double[][] toParent; // dynamic matrix |
---|
7403 | 7626 | double[][] fromParent; |
---|
.. | .. |
---|
7512 | 7735 | { |
---|
7513 | 7736 | assert(bRep != null); |
---|
7514 | 7737 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7515 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7738 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7516 | 7739 | } |
---|
7517 | 7740 | else |
---|
7518 | 7741 | { |
---|
.. | .. |
---|
7561 | 7784 | private static cVector edge2 = new cVector(); |
---|
7562 | 7785 | //private static cVector norm = new cVector(); |
---|
7563 | 7786 | /*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; |
---|
| 7787 | + static final int hitCenter = 1; |
---|
| 7788 | + static final int hitScale = 2; |
---|
| 7789 | + static final int hitRotate = 3; |
---|
7567 | 7790 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7568 | 7791 | /*transient*/ private Point centerPt; |
---|
7569 | 7792 | /*transient*/ private int startX; |
---|