Normand Briere
2019-06-09 79d0f9a45d36656051a77a7b0837aa0318f81ee5
Object3D.java
....@@ -300,6 +300,7 @@
300300 }
301301
302302 boolean live = false;
303
+ boolean dontselect = false;
303304 boolean hide = false;
304305 boolean link2master = false; // performs reset support/master at each frame
305306 boolean marked = false; // animation node
....@@ -774,7 +775,7 @@
774775 if (step == 0)
775776 step = 1;
776777 if (maxcount == 0)
777
- maxcount = 2048; // 4;
778
+ maxcount = 128; // 2048; // 4;
778779 // if (acceleration == 0)
779780 // acceleration = 10;
780781 if (delay == 0) // serial
....@@ -1834,12 +1835,15 @@
18341835 if (obj.name == null)
18351836 continue; // can't be a null one
18361837
1838
+ // Try perfect match first.
18371839 if (n.equals(obj.name))
18381840 {
18391841 theobj = obj;
18401842 count++;
18411843 }
18421844 }
1845
+
1846
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18431847
18441848 if (count != 1)
18451849 for (int i=Size(); --i>=0;)
....@@ -3002,8 +3006,10 @@
30023006 v.fromParent = LA.newMatrix();
30033007 }
30043008
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);
30073013 }
30083014
30093015 toParent = null; // LA.matIdentity(toParent);
....@@ -3236,7 +3242,9 @@
32363242 bRep.support = null;
32373243 BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32383244 // bRep.SplitInTwo(onlyone); // thread...
3239
- temprep.SplitInTwo(reduction34, onlyone);
3245
+
3246
+ while(temprep.SplitInTwo(reduction34, onlyone));
3247
+
32403248 bRep = temprep;
32413249 bRep.support = sup;
32423250 Touch();
....@@ -4711,7 +4719,7 @@
47114719
47124720 cTreePath SelectLeaf(int indexcount, boolean deselect)
47134721 {
4714
- if (hide)
4722
+ if (hide || dontselect)
47154723 return null;
47164724
47174725 if (count <= 0)
....@@ -4737,7 +4745,7 @@
47374745
47384746 cTreePath Select(int indexcount, boolean deselect)
47394747 {
4740
- if (hide)
4748
+ if (hide || dontselect)
47414749 return null;
47424750
47434751 if (count <= 0)
....@@ -5407,7 +5415,7 @@
54075415 boolean NeedSupport()
54085416 {
54095417 return
5410
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5418
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
54115419 // PROBLEM with CROWD!!
54125420 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
54135421 }
....@@ -5424,7 +5432,7 @@
54245432 }
54255433
54265434 if (display.DrawMode() == iCameraPane.SELECTION &&
5427
- hide)
5435
+ (hide || dontselect))
54285436 return;
54295437
54305438 if (name != null && name.contains("sclera"))
....@@ -5666,7 +5674,17 @@
56665674 tex = GetTextures();
56675675 }
56685676
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
+ }
56705688
56715689 if (!compiled)
56725690 {
....@@ -5688,7 +5706,8 @@
56885706 }
56895707 }
56905708
5691
- display.ReleaseTextures(tex);
5709
+ if (!failed)
5710
+ display.ReleaseTextures(tex);
56925711
56935712 display.PopMaterial(this, selected);
56945713 }
....@@ -5817,6 +5836,9 @@
58175836
58185837 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
58195838 {
5839
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5840
+ return;
5841
+
58205842 if (hide)
58215843 return;
58225844 // shadow optimisation
....@@ -5941,6 +5963,9 @@
59415963 {
59425964 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
59435965 return; // no shadow for transparent objects
5966
+
5967
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5968
+ return;
59445969
59455970 if (hide)
59465971 return;
....@@ -6925,8 +6950,8 @@
69256950 // {
69266951 // CameraPane.Ymax = spoth;
69276952 // }
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);
69306955 spot.translate(0, -32);
69316956 info.g.setColor(Color.green);
69326957 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -6981,7 +7006,7 @@
69817006 startX = info.x;
69827007 startY = info.y;
69837008
6984
- hitSomething = 0;
7009
+ hitSomething = -1;
69857010 cVector origin = new cVector();
69867011 //LA.xformPos(origin, toParent, origin);
69877012 Rectangle spot = new Rectangle();
....@@ -7057,6 +7082,7 @@
70577082 //System.out.println("hitSomething = " + hitSomething);
70587083
70597084 double scale = 0.005f * info.camera.Distance();
7085
+
70607086 cVector xlate = new cVector();
70617087 //cVector xlate2 = new cVector();
70627088 switch (hitSomething)
....@@ -7205,24 +7231,27 @@
72057231
72067232 case hitScale: // scale
72077233 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);
72087240 if (hScale < 0.01)
72097241 {
7210
- hScale = 0.01;
7242
+ //hScale = 0.01;
72117243 }
7212
- hScale = Math.pow(hScale, scale * 50);
7213
- if (hScale < 0.01)
7214
- {
7215
- hScale = 0.01;
7216
- }
7244
+
72177245 double vScale = (double) (info.y - centerPt.y) / 32;
7218
- if (vScale < 0.01)
7246
+ sign = 1;
7247
+ if (vScale < 0)
72197248 {
7220
- vScale = 0.01;
7249
+ sign = -1;
72217250 }
7222
- vScale = Math.pow(vScale, scale * 50);
7251
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
72237252 if (vScale < 0.01)
72247253 {
7225
- vScale = 0.01;
7254
+ //vScale = 0.01;
72267255 }
72277256 LA.matCopy(startMat, toParent);
72287257 /**/
....@@ -7233,17 +7262,24 @@
72337262 }
72347263 /**/
72357264
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
+
72367272 switch (info.pane.RenderCamera().viewCode)
72377273 {
72387274 case 3: // '\001'
72397275 if (modified)
72407276 {
72417277 //LA.matScale(toParent, 1, hScale, vScale);
7242
- LA.matScale(toParent, vScale, 1, 1);
7278
+ LA.matScale(toParent, totalScale, 1, 1);
72437279 } // vScale, 1);
72447280 else
72457281 {
7246
- LA.matScale(toParent, vScale, vScale, vScale);
7282
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
72477283 } // vScale, 1);
72487284 break;
72497285
....@@ -7251,10 +7287,10 @@
72517287 if (modified)
72527288 {
72537289 //LA.matScale(toParent, hScale, 1, vScale);
7254
- LA.matScale(toParent, 1, vScale, 1);
7290
+ LA.matScale(toParent, 1, totalScale, 1);
72557291 } else
72567292 {
7257
- LA.matScale(toParent, vScale, 1, vScale);
7293
+ LA.matScale(toParent, totalScale, 1, totalScale);
72587294 }
72597295 break;
72607296
....@@ -7262,10 +7298,10 @@
72627298 if (modified)
72637299 {
72647300 //LA.matScale(toParent, hScale, vScale, 1);
7265
- LA.matScale(toParent, 1, 1, vScale);
7301
+ LA.matScale(toParent, 1, 1, totalScale);
72667302 } else
72677303 {
7268
- LA.matScale(toParent, vScale, vScale, 1);
7304
+ LA.matScale(toParent, totalScale, totalScale, 1);
72697305 }
72707306 break;
72717307 }
....@@ -7406,7 +7442,7 @@
74067442 objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
74077443 } else
74087444 {
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) ":"") */ "";
74107446 } // + super.toString();
74117447 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
74127448
....@@ -7654,9 +7690,9 @@
76547690 private static cVector edge2 = new cVector();
76557691 //private static cVector norm = new cVector();
76567692 /*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;
76607696 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
76617697 /*transient*/ private Point centerPt;
76627698 /*transient*/ private int startX;