.. | .. |
---|
300 | 300 | } |
---|
301 | 301 | |
---|
302 | 302 | boolean live = false; |
---|
| 303 | + boolean dontselect = false; |
---|
303 | 304 | boolean hide = false; |
---|
304 | 305 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 306 | boolean marked = false; // animation node |
---|
.. | .. |
---|
774 | 775 | if (step == 0) |
---|
775 | 776 | step = 1; |
---|
776 | 777 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 778 | + maxcount = 128; // 2048; // 4; |
---|
778 | 779 | // if (acceleration == 0) |
---|
779 | 780 | // acceleration = 10; |
---|
780 | 781 | if (delay == 0) // serial |
---|
.. | .. |
---|
1834 | 1835 | if (obj.name == null) |
---|
1835 | 1836 | continue; // can't be a null one |
---|
1836 | 1837 | |
---|
| 1838 | + // Try perfect match first. |
---|
1837 | 1839 | if (n.equals(obj.name)) |
---|
1838 | 1840 | { |
---|
1839 | 1841 | theobj = obj; |
---|
1840 | 1842 | count++; |
---|
1841 | 1843 | } |
---|
1842 | 1844 | } |
---|
| 1845 | + |
---|
| 1846 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1843 | 1847 | |
---|
1844 | 1848 | if (count != 1) |
---|
1845 | 1849 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
3002 | 3006 | v.fromParent = LA.newMatrix(); |
---|
3003 | 3007 | } |
---|
3004 | 3008 | |
---|
3005 | | - LA.matConcat(v.toParent, toParent, v.toParent); |
---|
3006 | | - LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3009 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3010 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3011 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3012 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
3007 | 3013 | } |
---|
3008 | 3014 | |
---|
3009 | 3015 | toParent = null; // LA.matIdentity(toParent); |
---|
.. | .. |
---|
3236 | 3242 | bRep.support = null; |
---|
3237 | 3243 | BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3238 | 3244 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3239 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3245 | + |
---|
| 3246 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3247 | + |
---|
3240 | 3248 | bRep = temprep; |
---|
3241 | 3249 | bRep.support = sup; |
---|
3242 | 3250 | Touch(); |
---|
.. | .. |
---|
4711 | 4719 | |
---|
4712 | 4720 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4713 | 4721 | { |
---|
4714 | | - if (hide) |
---|
| 4722 | + if (hide || dontselect) |
---|
4715 | 4723 | return null; |
---|
4716 | 4724 | |
---|
4717 | 4725 | if (count <= 0) |
---|
.. | .. |
---|
4737 | 4745 | |
---|
4738 | 4746 | cTreePath Select(int indexcount, boolean deselect) |
---|
4739 | 4747 | { |
---|
4740 | | - if (hide) |
---|
| 4748 | + if (hide || dontselect) |
---|
4741 | 4749 | return null; |
---|
4742 | 4750 | |
---|
4743 | 4751 | if (count <= 0) |
---|
.. | .. |
---|
5407 | 5415 | boolean NeedSupport() |
---|
5408 | 5416 | { |
---|
5409 | 5417 | return |
---|
5410 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5418 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5411 | 5419 | // PROBLEM with CROWD!! |
---|
5412 | 5420 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5413 | 5421 | } |
---|
.. | .. |
---|
5424 | 5432 | } |
---|
5425 | 5433 | |
---|
5426 | 5434 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5427 | | - hide) |
---|
| 5435 | + (hide || dontselect)) |
---|
5428 | 5436 | return; |
---|
5429 | 5437 | |
---|
5430 | 5438 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5666 | 5674 | tex = GetTextures(); |
---|
5667 | 5675 | } |
---|
5668 | 5676 | |
---|
5669 | | - display.BindTextures(tex, texres); |
---|
| 5677 | + boolean failed = false; |
---|
| 5678 | + |
---|
| 5679 | + try |
---|
| 5680 | + { |
---|
| 5681 | + display.BindTextures(tex, texres); |
---|
| 5682 | + } |
---|
| 5683 | + catch (Exception e) |
---|
| 5684 | + { |
---|
| 5685 | + System.err.println("FAILED: " + this); |
---|
| 5686 | + failed = true; |
---|
| 5687 | + } |
---|
5670 | 5688 | |
---|
5671 | 5689 | if (!compiled) |
---|
5672 | 5690 | { |
---|
.. | .. |
---|
5688 | 5706 | } |
---|
5689 | 5707 | } |
---|
5690 | 5708 | |
---|
5691 | | - display.ReleaseTextures(tex); |
---|
| 5709 | + if (!failed) |
---|
| 5710 | + display.ReleaseTextures(tex); |
---|
5692 | 5711 | |
---|
5693 | 5712 | display.PopMaterial(this, selected); |
---|
5694 | 5713 | } |
---|
.. | .. |
---|
5817 | 5836 | |
---|
5818 | 5837 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5819 | 5838 | { |
---|
| 5839 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5840 | + return; |
---|
| 5841 | + |
---|
5820 | 5842 | if (hide) |
---|
5821 | 5843 | return; |
---|
5822 | 5844 | // shadow optimisation |
---|
.. | .. |
---|
5941 | 5963 | { |
---|
5942 | 5964 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5943 | 5965 | return; // no shadow for transparent objects |
---|
| 5966 | + |
---|
| 5967 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5968 | + return; |
---|
5944 | 5969 | |
---|
5945 | 5970 | if (hide) |
---|
5946 | 5971 | return; |
---|
.. | .. |
---|
6925 | 6950 | // { |
---|
6926 | 6951 | // CameraPane.Ymax = spoth; |
---|
6927 | 6952 | // } |
---|
6928 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6929 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 6953 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
| 6954 | + //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
6930 | 6955 | spot.translate(0, -32); |
---|
6931 | 6956 | info.g.setColor(Color.green); |
---|
6932 | 6957 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
6981 | 7006 | startX = info.x; |
---|
6982 | 7007 | startY = info.y; |
---|
6983 | 7008 | |
---|
6984 | | - hitSomething = 0; |
---|
| 7009 | + hitSomething = -1; |
---|
6985 | 7010 | cVector origin = new cVector(); |
---|
6986 | 7011 | //LA.xformPos(origin, toParent, origin); |
---|
6987 | 7012 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7057 | 7082 | //System.out.println("hitSomething = " + hitSomething); |
---|
7058 | 7083 | |
---|
7059 | 7084 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7085 | + |
---|
7060 | 7086 | cVector xlate = new cVector(); |
---|
7061 | 7087 | //cVector xlate2 = new cVector(); |
---|
7062 | 7088 | switch (hitSomething) |
---|
.. | .. |
---|
7205 | 7231 | |
---|
7206 | 7232 | case hitScale: // scale |
---|
7207 | 7233 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7234 | + double sign = 1; |
---|
| 7235 | + if (hScale < 0) |
---|
| 7236 | + { |
---|
| 7237 | + sign = -1; |
---|
| 7238 | + } |
---|
| 7239 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7208 | 7240 | if (hScale < 0.01) |
---|
7209 | 7241 | { |
---|
7210 | | - hScale = 0.01; |
---|
| 7242 | + //hScale = 0.01; |
---|
7211 | 7243 | } |
---|
7212 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7213 | | - if (hScale < 0.01) |
---|
7214 | | - { |
---|
7215 | | - hScale = 0.01; |
---|
7216 | | - } |
---|
| 7244 | + |
---|
7217 | 7245 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7218 | | - if (vScale < 0.01) |
---|
| 7246 | + sign = 1; |
---|
| 7247 | + if (vScale < 0) |
---|
7219 | 7248 | { |
---|
7220 | | - vScale = 0.01; |
---|
| 7249 | + sign = -1; |
---|
7221 | 7250 | } |
---|
7222 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7251 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7223 | 7252 | if (vScale < 0.01) |
---|
7224 | 7253 | { |
---|
7225 | | - vScale = 0.01; |
---|
| 7254 | + //vScale = 0.01; |
---|
7226 | 7255 | } |
---|
7227 | 7256 | LA.matCopy(startMat, toParent); |
---|
7228 | 7257 | /**/ |
---|
.. | .. |
---|
7233 | 7262 | } |
---|
7234 | 7263 | /**/ |
---|
7235 | 7264 | |
---|
| 7265 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7266 | + |
---|
| 7267 | + if (totalScale < 0.01) |
---|
| 7268 | + { |
---|
| 7269 | + totalScale = 0.01; |
---|
| 7270 | + } |
---|
| 7271 | + |
---|
7236 | 7272 | switch (info.pane.RenderCamera().viewCode) |
---|
7237 | 7273 | { |
---|
7238 | 7274 | case 3: // '\001' |
---|
7239 | 7275 | if (modified) |
---|
7240 | 7276 | { |
---|
7241 | 7277 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7242 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7278 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7243 | 7279 | } // vScale, 1); |
---|
7244 | 7280 | else |
---|
7245 | 7281 | { |
---|
7246 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7282 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7247 | 7283 | } // vScale, 1); |
---|
7248 | 7284 | break; |
---|
7249 | 7285 | |
---|
.. | .. |
---|
7251 | 7287 | if (modified) |
---|
7252 | 7288 | { |
---|
7253 | 7289 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7254 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7290 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7255 | 7291 | } else |
---|
7256 | 7292 | { |
---|
7257 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7293 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7258 | 7294 | } |
---|
7259 | 7295 | break; |
---|
7260 | 7296 | |
---|
.. | .. |
---|
7262 | 7298 | if (modified) |
---|
7263 | 7299 | { |
---|
7264 | 7300 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7265 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7301 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7266 | 7302 | } else |
---|
7267 | 7303 | { |
---|
7268 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7304 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7269 | 7305 | } |
---|
7270 | 7306 | break; |
---|
7271 | 7307 | } |
---|
.. | .. |
---|
7406 | 7442 | objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7407 | 7443 | } else |
---|
7408 | 7444 | { |
---|
7409 | | - objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
| 7445 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7410 | 7446 | } // + super.toString(); |
---|
7411 | 7447 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
7412 | 7448 | |
---|
.. | .. |
---|
7654 | 7690 | private static cVector edge2 = new cVector(); |
---|
7655 | 7691 | //private static cVector norm = new cVector(); |
---|
7656 | 7692 | /*transient private*/ int hitSomething; |
---|
7657 | | - private static final int hitCenter = 1; |
---|
7658 | | - private static final int hitScale = 2; |
---|
7659 | | - private static final int hitRotate = 3; |
---|
| 7693 | + static final int hitCenter = 1; |
---|
| 7694 | + static final int hitScale = 2; |
---|
| 7695 | + static final int hitRotate = 3; |
---|
7660 | 7696 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7661 | 7697 | /*transient*/ private Point centerPt; |
---|
7662 | 7698 | /*transient*/ private int startX; |
---|