Normand Briere
2019-05-13 f924d3e00db476c06f55f3d5aaef307e17575340
Object3D.java
....@@ -797,7 +797,7 @@
797797
798798 if (marked && Globals.isLIVE() && live &&
799799 //TEMP21aug2018
800
- Globals.DrawMode() == iCameraPane.SHADOW &&
800
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
801801 currentframe != Globals.framecount)
802802 {
803803 currentframe = Globals.framecount;
....@@ -912,6 +912,11 @@
912912 fromParent = null; // LA.newMatrix();
913913 bRep = null; // new BoundaryRep();
914914
915
+ if (oname != null && oname.equals("LeftHand"))
916
+ {
917
+ name = oname;
918
+ }
919
+
915920 /*
916921 float hue = (float)Math.random();
917922 Color col;
....@@ -954,7 +959,7 @@
954959
955960 public Object clone()
956961 {
957
- return GrafreeD.clone(this);
962
+ return Grafreed.clone(this);
958963 }
959964
960965 Object3D copyExpand()
....@@ -1470,7 +1475,7 @@
14701475 BoundaryRep.SEUIL = other.material.cameralight;
14711476
14721477 // Set default to 0.1
1473
- BoundaryRep.SEUIL /= 2;
1478
+ BoundaryRep.SEUIL /= 4; // 2;
14741479 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14751480 }
14761481
....@@ -1729,7 +1734,7 @@
17291734 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17301735 o.bRep = transientrep;
17311736 if (clone)
1732
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1737
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17331738 o.CreateMaterial();
17341739 o.SetAttributes(this, -1);
17351740 //parent
....@@ -1742,7 +1747,7 @@
17421747 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17431748 o.bRep = bRep;
17441749 if (clone)
1745
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1750
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17461751 o.CreateMaterial();
17471752 //o.overwriteThis(this, -1);
17481753 o.SetAttributes(this, -1);
....@@ -2477,13 +2482,13 @@
24772482 return retval;
24782483 }
24792484
2480
- void doEditDrag(ClickInfo info)
2485
+ void doEditDrag(ClickInfo info, boolean opposite)
24812486 {
24822487 switch (doSomething)
24832488 {
24842489 case 1: // '\001'
24852490 //super.
2486
- doEditDrag0(info);
2491
+ doEditDrag0(info, opposite);
24872492 break;
24882493
24892494 case 2: // '\002'
....@@ -2496,11 +2501,11 @@
24962501 {
24972502 //sel.hitSomething = childToDrag.hitSomething;
24982503 //childToDrag.doEditDrag(info);
2499
- sel.doEditDrag(info);
2504
+ sel.doEditDrag(info, opposite);
25002505 } else
25012506 {
25022507 //super.
2503
- doEditDrag0(info);
2508
+ doEditDrag0(info, opposite);
25042509 }
25052510 }
25062511 break;
....@@ -2983,6 +2988,31 @@
29832988 blockloop = false;
29842989 }
29852990
2991
+ void TransformChildren()
2992
+ {
2993
+ if (toParent != null)
2994
+ {
2995
+ for (int i=Size(); --i>=0;)
2996
+ {
2997
+ Object3D v = get(i);
2998
+
2999
+ if (v.toParent == null)
3000
+ {
3001
+ v.toParent = LA.newMatrix();
3002
+ v.fromParent = LA.newMatrix();
3003
+ }
3004
+
3005
+ LA.matConcat(v.toParent, toParent, v.toParent);
3006
+ LA.matConcat(fromParent, v.fromParent, v.fromParent);
3007
+ }
3008
+
3009
+ toParent = null; // LA.matIdentity(toParent);
3010
+ fromParent = null; // LA.matIdentity(fromParent);
3011
+
3012
+ Touch();
3013
+ }
3014
+ }
3015
+
29863016 void TransformGeometry()
29873017 {
29883018 Object3D obj = this;
....@@ -3204,7 +3234,7 @@
32043234
32053235 BoundaryRep sup = bRep.support;
32063236 bRep.support = null;
3207
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3237
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32083238 // bRep.SplitInTwo(onlyone); // thread...
32093239 temprep.SplitInTwo(reduction34, onlyone);
32103240 bRep = temprep;
....@@ -3728,7 +3758,7 @@
37283758 if (child == null)
37293759 continue;
37303760
3731
- if (GrafreeD.RENDERME > 0)
3761
+ if (Grafreed.RENDERME > 0)
37323762 {
37333763 if (child instanceof Merge)
37343764 ((Merge)child).renderme();
....@@ -3879,7 +3909,7 @@
38793909 if (child == null)
38803910 continue;
38813911
3882
- if (GrafreeD.RENDERME > 0)
3912
+ if (Grafreed.RENDERME > 0)
38833913 {
38843914 if (child instanceof Merge)
38853915 ((Merge)child).renderme();
....@@ -4074,7 +4104,7 @@
40744104 if (child == null)
40754105 continue;
40764106
4077
- if (GrafreeD.RENDERME > 0)
4107
+ if (Grafreed.RENDERME > 0)
40784108 {
40794109 if (child instanceof Merge)
40804110 ((Merge)child).renderme();
....@@ -5159,10 +5189,34 @@
51595189
51605190 // System.out.println("Fullname = " + fullname);
51615191
5162
- if (fullname.name.indexOf(":") == -1)
5163
- return fullname.name;
5192
+ // Does not work on Windows due to C:
5193
+// if (fullname.name.indexOf(":") == -1)
5194
+// return fullname.name;
5195
+//
5196
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51645197
5165
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5198
+ String[] split = fullname.name.split(":");
5199
+
5200
+ if (split.length == 0)
5201
+ {
5202
+ return "";
5203
+ }
5204
+
5205
+ if (split.length <= 2)
5206
+ {
5207
+ if (fullname.name.endsWith(":"))
5208
+ {
5209
+ // Windows
5210
+ return fullname.name.substring(0, fullname.name.length()-1);
5211
+ }
5212
+
5213
+ return split[0];
5214
+ }
5215
+
5216
+ // Windows
5217
+ assert(split.length == 4);
5218
+
5219
+ return split[0] + ":" + split[1];
51665220 }
51675221
51685222 static String GetBump(cTexture fullname)
....@@ -5171,10 +5225,38 @@
51715225 return "";
51725226
51735227 // System.out.println("Fullname = " + fullname);
5174
- if (fullname.name.indexOf(":") == -1)
5175
- return "";
5176
-
5177
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5228
+ // Does not work on Windows due to C:
5229
+// if (fullname.name.indexOf(":") == -1)
5230
+// return "";
5231
+//
5232
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5233
+ String[] split = fullname.name.split(":");
5234
+
5235
+ if (split.length == 0)
5236
+ {
5237
+ return "";
5238
+ }
5239
+
5240
+ if (split.length == 1)
5241
+ {
5242
+ return "";
5243
+ }
5244
+
5245
+ if (split.length == 2)
5246
+ {
5247
+ if (fullname.name.endsWith(":"))
5248
+ {
5249
+ // Windows
5250
+ return "";
5251
+ }
5252
+
5253
+ return split[1];
5254
+ }
5255
+
5256
+ // Windows
5257
+ assert(split.length == 4);
5258
+
5259
+ return split[2] + ":" + split[3];
51785260 }
51795261
51805262 String GetPigmentTexture()
....@@ -5248,7 +5330,7 @@
52485330 System.out.print("; textures = " + textures);
52495331 System.out.println("; usedtextures = " + usedtextures);
52505332
5251
- if (GetTextures() == null)
5333
+ if (GetTextures() == null) // What is that??
52525334 GetTextures().name = ":";
52535335
52545336 String texname = tex;
....@@ -5327,7 +5409,7 @@
53275409 return
53285410 CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
53295411 // PROBLEM with CROWD!!
5330
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5412
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53315413 }
53325414
53335415 static boolean DEBUG_SELECTION = false;
....@@ -6932,7 +7014,7 @@
69327014 }
69337015
69347016 //System.out.println("info.modifiers = " + info.modifiers);
6935
- modified = (info.modifiers & CameraPane.META) != 0;
7017
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
69367018 //System.out.println("modified = " + modified);
69377019 //new Exception().printStackTrace();
69387020 //viewCode = info.pane.renderCamera.viewCode;
....@@ -6960,7 +7042,7 @@
69607042 return true;
69617043 }
69627044
6963
- void doEditDrag0(ClickInfo info)
7045
+ void doEditDrag0(ClickInfo info, boolean opposite)
69647046 {
69657047 if (hitSomething == 0)
69667048 {
....@@ -6987,7 +7069,7 @@
69877069
69887070 scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
69897071
6990
- if (modified)
7072
+ if (modified || opposite)
69917073 {
69927074 //assert(false);
69937075 /*
....@@ -7081,6 +7163,7 @@
70817163
70827164 if (modified)
70837165 {
7166
+ // Rotate 90 degrees
70847167 angle /= (Math.PI / 4);
70857168 angle = Math.floor(angle + 0.5);
70867169 angle *= (Math.PI / 4);
....@@ -7315,14 +7398,22 @@
73157398 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
73167399 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
73177400 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7401
+
7402
+ String objname;
7403
+
73187404 if (false) //parent != null)
73197405 {
7320
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7406
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
73217407 } else
73227408 {
7323
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7409
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
73247410 } // + super.toString();
73257411 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7412
+
7413
+ if (!Globals.ADVANCED)
7414
+ return objname;
7415
+
7416
+ return objname + " " + System.identityHashCode(this);
73267417 }
73277418
73287419 public int hashCode()
....@@ -7378,6 +7469,7 @@
73787469 objectUI.closeUI();
73797470 if (editWindow != null)
73807471 {
7472
+ editWindow.ctrlPanel.FlushUI();
73817473 editWindow.refreshContents();
73827474 } // ? new
73837475 objectUI = null;
....@@ -7513,7 +7605,7 @@
75137605 {
75147606 assert(bRep != null);
75157607 if (!(support instanceof GenericJoint)) // support.bRep != null)
7516
- GrafreeD.Assert(support.bRep == bRep.support);
7608
+ Grafreed.Assert(support.bRep == bRep.support);
75177609 }
75187610 else
75197611 {