Normand Briere
2019-06-09 cd87df088b1850ba0c90beb6c866c443e4eaf3b9
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
....@@ -797,7 +798,7 @@
797798
798799 if (marked && Globals.isLIVE() && live &&
799800 //TEMP21aug2018
800
- Globals.DrawMode() == iCameraPane.SHADOW &&
801
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
801802 currentframe != Globals.framecount)
802803 {
803804 currentframe = Globals.framecount;
....@@ -912,6 +913,11 @@
912913 fromParent = null; // LA.newMatrix();
913914 bRep = null; // new BoundaryRep();
914915
916
+ if (oname != null && oname.equals("LeftHand"))
917
+ {
918
+ name = oname;
919
+ }
920
+
915921 /*
916922 float hue = (float)Math.random();
917923 Color col;
....@@ -954,7 +960,7 @@
954960
955961 public Object clone()
956962 {
957
- return GrafreeD.clone(this);
963
+ return Grafreed.clone(this);
958964 }
959965
960966 Object3D copyExpand()
....@@ -1470,7 +1476,7 @@
14701476 BoundaryRep.SEUIL = other.material.cameralight;
14711477
14721478 // Set default to 0.1
1473
- BoundaryRep.SEUIL /= 2;
1479
+ BoundaryRep.SEUIL /= 4; // 2;
14741480 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14751481 }
14761482
....@@ -1729,7 +1735,7 @@
17291735 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17301736 o.bRep = transientrep;
17311737 if (clone)
1732
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1738
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17331739 o.CreateMaterial();
17341740 o.SetAttributes(this, -1);
17351741 //parent
....@@ -1742,7 +1748,7 @@
17421748 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17431749 o.bRep = bRep;
17441750 if (clone)
1745
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1751
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17461752 o.CreateMaterial();
17471753 //o.overwriteThis(this, -1);
17481754 o.SetAttributes(this, -1);
....@@ -1829,12 +1835,15 @@
18291835 if (obj.name == null)
18301836 continue; // can't be a null one
18311837
1838
+ // Try perfect match first.
18321839 if (n.equals(obj.name))
18331840 {
18341841 theobj = obj;
18351842 count++;
18361843 }
18371844 }
1845
+
1846
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18381847
18391848 if (count != 1)
18401849 for (int i=Size(); --i>=0;)
....@@ -2983,6 +2992,33 @@
29832992 blockloop = false;
29842993 }
29852994
2995
+ void TransformChildren()
2996
+ {
2997
+ if (toParent != null)
2998
+ {
2999
+ for (int i=Size(); --i>=0;)
3000
+ {
3001
+ Object3D v = get(i);
3002
+
3003
+ if (v.toParent == null)
3004
+ {
3005
+ v.toParent = LA.newMatrix();
3006
+ v.fromParent = LA.newMatrix();
3007
+ }
3008
+
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);
3013
+ }
3014
+
3015
+ toParent = null; // LA.matIdentity(toParent);
3016
+ fromParent = null; // LA.matIdentity(fromParent);
3017
+
3018
+ Touch();
3019
+ }
3020
+ }
3021
+
29863022 void TransformGeometry()
29873023 {
29883024 Object3D obj = this;
....@@ -3204,9 +3240,11 @@
32043240
32053241 BoundaryRep sup = bRep.support;
32063242 bRep.support = null;
3207
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3243
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32083244 // bRep.SplitInTwo(onlyone); // thread...
3209
- temprep.SplitInTwo(reduction34, onlyone);
3245
+
3246
+ while(temprep.SplitInTwo(reduction34, onlyone));
3247
+
32103248 bRep = temprep;
32113249 bRep.support = sup;
32123250 Touch();
....@@ -3728,7 +3766,7 @@
37283766 if (child == null)
37293767 continue;
37303768
3731
- if (GrafreeD.RENDERME > 0)
3769
+ if (Grafreed.RENDERME > 0)
37323770 {
37333771 if (child instanceof Merge)
37343772 ((Merge)child).renderme();
....@@ -3879,7 +3917,7 @@
38793917 if (child == null)
38803918 continue;
38813919
3882
- if (GrafreeD.RENDERME > 0)
3920
+ if (Grafreed.RENDERME > 0)
38833921 {
38843922 if (child instanceof Merge)
38853923 ((Merge)child).renderme();
....@@ -4074,7 +4112,7 @@
40744112 if (child == null)
40754113 continue;
40764114
4077
- if (GrafreeD.RENDERME > 0)
4115
+ if (Grafreed.RENDERME > 0)
40784116 {
40794117 if (child instanceof Merge)
40804118 ((Merge)child).renderme();
....@@ -4681,7 +4719,7 @@
46814719
46824720 cTreePath SelectLeaf(int indexcount, boolean deselect)
46834721 {
4684
- if (hide)
4722
+ if (hide || dontselect)
46854723 return null;
46864724
46874725 if (count <= 0)
....@@ -4707,7 +4745,7 @@
47074745
47084746 cTreePath Select(int indexcount, boolean deselect)
47094747 {
4710
- if (hide)
4748
+ if (hide || dontselect)
47114749 return null;
47124750
47134751 if (count <= 0)
....@@ -5377,9 +5415,9 @@
53775415 boolean NeedSupport()
53785416 {
53795417 return
5380
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5418
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
53815419 // PROBLEM with CROWD!!
5382
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5420
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53835421 }
53845422
53855423 static boolean DEBUG_SELECTION = false;
....@@ -5394,7 +5432,7 @@
53945432 }
53955433
53965434 if (display.DrawMode() == iCameraPane.SELECTION &&
5397
- hide)
5435
+ (hide || dontselect))
53985436 return;
53995437
54005438 if (name != null && name.contains("sclera"))
....@@ -5636,7 +5674,17 @@
56365674 tex = GetTextures();
56375675 }
56385676
5639
- 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
+ }
56405688
56415689 if (!compiled)
56425690 {
....@@ -5658,7 +5706,8 @@
56585706 }
56595707 }
56605708
5661
- display.ReleaseTextures(tex);
5709
+ if (!failed)
5710
+ display.ReleaseTextures(tex);
56625711
56635712 display.PopMaterial(this, selected);
56645713 }
....@@ -5787,6 +5836,9 @@
57875836
57885837 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57895838 {
5839
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5840
+ return;
5841
+
57905842 if (hide)
57915843 return;
57925844 // shadow optimisation
....@@ -5911,6 +5963,9 @@
59115963 {
59125964 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
59135965 return; // no shadow for transparent objects
5966
+
5967
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5968
+ return;
59145969
59155970 if (hide)
59165971 return;
....@@ -7368,14 +7423,22 @@
73687423 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
73697424 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
73707425 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7426
+
7427
+ String objname;
7428
+
73717429 if (false) //parent != null)
73727430 {
7373
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7431
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
73747432 } else
73757433 {
7376
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7434
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
73777435 } // + super.toString();
73787436 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7437
+
7438
+ if (!Globals.ADVANCED)
7439
+ return objname;
7440
+
7441
+ return objname + " " + System.identityHashCode(this);
73797442 }
73807443
73817444 public int hashCode()
....@@ -7567,7 +7630,7 @@
75677630 {
75687631 assert(bRep != null);
75697632 if (!(support instanceof GenericJoint)) // support.bRep != null)
7570
- GrafreeD.Assert(support.bRep == bRep.support);
7633
+ Grafreed.Assert(support.bRep == bRep.support);
75717634 }
75727635 else
75737636 {