From f924d3e00db476c06f55f3d5aaef307e17575340 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 13 May 2019 07:29:08 -0400 Subject: [PATCH] Transform children --- Object3D.java | 148 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 120 insertions(+), 28 deletions(-) diff --git a/Object3D.java b/Object3D.java index 2cb44d8..9c74924 100644 --- a/Object3D.java +++ b/Object3D.java @@ -797,7 +797,7 @@ if (marked && Globals.isLIVE() && live && //TEMP21aug2018 - Globals.DrawMode() == iCameraPane.SHADOW && + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && currentframe != Globals.framecount) { currentframe = Globals.framecount; @@ -912,6 +912,11 @@ fromParent = null; // LA.newMatrix(); bRep = null; // new BoundaryRep(); + if (oname != null && oname.equals("LeftHand")) + { + name = oname; + } + /* float hue = (float)Math.random(); Color col; @@ -954,7 +959,7 @@ public Object clone() { - return GrafreeD.clone(this); + return Grafreed.clone(this); } Object3D copyExpand() @@ -1470,7 +1475,7 @@ BoundaryRep.SEUIL = other.material.cameralight; // Set default to 0.1 - BoundaryRep.SEUIL /= 2; + BoundaryRep.SEUIL /= 4; // 2; System.out.println("SEUIL = " + BoundaryRep.SEUIL); } @@ -1729,7 +1734,7 @@ Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); o.bRep = transientrep; if (clone) - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); o.CreateMaterial(); o.SetAttributes(this, -1); //parent @@ -1742,7 +1747,7 @@ Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); o.bRep = bRep; if (clone) - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); + o.bRep = (BoundaryRep) Grafreed.clone(bRep); o.CreateMaterial(); //o.overwriteThis(this, -1); o.SetAttributes(this, -1); @@ -2477,13 +2482,13 @@ return retval; } - void doEditDrag(ClickInfo info) + void doEditDrag(ClickInfo info, boolean opposite) { switch (doSomething) { case 1: // '\001' //super. - doEditDrag0(info); + doEditDrag0(info, opposite); break; case 2: // '\002' @@ -2496,11 +2501,11 @@ { //sel.hitSomething = childToDrag.hitSomething; //childToDrag.doEditDrag(info); - sel.doEditDrag(info); + sel.doEditDrag(info, opposite); } else { //super. - doEditDrag0(info); + doEditDrag0(info, opposite); } } break; @@ -2983,6 +2988,31 @@ blockloop = false; } + void TransformChildren() + { + if (toParent != null) + { + for (int i=Size(); --i>=0;) + { + Object3D v = get(i); + + if (v.toParent == null) + { + v.toParent = LA.newMatrix(); + v.fromParent = LA.newMatrix(); + } + + LA.matConcat(v.toParent, toParent, v.toParent); + LA.matConcat(fromParent, v.fromParent, v.fromParent); + } + + toParent = null; // LA.matIdentity(toParent); + fromParent = null; // LA.matIdentity(fromParent); + + Touch(); + } + } + void TransformGeometry() { Object3D obj = this; @@ -3204,7 +3234,7 @@ BoundaryRep sup = bRep.support; bRep.support = null; - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); // bRep.SplitInTwo(onlyone); // thread... temprep.SplitInTwo(reduction34, onlyone); bRep = temprep; @@ -3728,7 +3758,7 @@ if (child == null) continue; - if (GrafreeD.RENDERME > 0) + if (Grafreed.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -3879,7 +3909,7 @@ if (child == null) continue; - if (GrafreeD.RENDERME > 0) + if (Grafreed.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -4074,7 +4104,7 @@ if (child == null) continue; - if (GrafreeD.RENDERME > 0) + if (Grafreed.RENDERME > 0) { if (child instanceof Merge) ((Merge)child).renderme(); @@ -5159,10 +5189,34 @@ // System.out.println("Fullname = " + fullname); - if (fullname.name.indexOf(":") == -1) - return fullname.name; + // Does not work on Windows due to C: +// if (fullname.name.indexOf(":") == -1) +// return fullname.name; +// +// return fullname.name.substring(0,fullname.name.indexOf(":")); - return fullname.name.substring(0,fullname.name.indexOf(":")); + String[] split = fullname.name.split(":"); + + if (split.length == 0) + { + return ""; + } + + if (split.length <= 2) + { + if (fullname.name.endsWith(":")) + { + // Windows + return fullname.name.substring(0, fullname.name.length()-1); + } + + return split[0]; + } + + // Windows + assert(split.length == 4); + + return split[0] + ":" + split[1]; } static String GetBump(cTexture fullname) @@ -5171,10 +5225,38 @@ return ""; // System.out.println("Fullname = " + fullname); - if (fullname.name.indexOf(":") == -1) - return ""; - - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); + // Does not work on Windows due to C: +// if (fullname.name.indexOf(":") == -1) +// return ""; +// +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); + String[] split = fullname.name.split(":"); + + if (split.length == 0) + { + return ""; + } + + if (split.length == 1) + { + return ""; + } + + if (split.length == 2) + { + if (fullname.name.endsWith(":")) + { + // Windows + return ""; + } + + return split[1]; + } + + // Windows + assert(split.length == 4); + + return split[2] + ":" + split[3]; } String GetPigmentTexture() @@ -5248,7 +5330,7 @@ System.out.print("; textures = " + textures); System.out.println("; usedtextures = " + usedtextures); - if (GetTextures() == null) + if (GetTextures() == null) // What is that?? GetTextures().name = ":"; String texname = tex; @@ -5327,7 +5409,7 @@ return CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null // PROBLEM with CROWD!! - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); } static boolean DEBUG_SELECTION = false; @@ -6932,7 +7014,7 @@ } //System.out.println("info.modifiers = " + info.modifiers); - modified = (info.modifiers & CameraPane.META) != 0; + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META //System.out.println("modified = " + modified); //new Exception().printStackTrace(); //viewCode = info.pane.renderCamera.viewCode; @@ -6960,7 +7042,7 @@ return true; } - void doEditDrag0(ClickInfo info) + void doEditDrag0(ClickInfo info, boolean opposite) { if (hitSomething == 0) { @@ -6987,7 +7069,7 @@ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); - if (modified) + if (modified || opposite) { //assert(false); /* @@ -7081,6 +7163,7 @@ if (modified) { + // Rotate 90 degrees angle /= (Math.PI / 4); angle = Math.floor(angle + 0.5); angle *= (Math.PI / 4); @@ -7315,14 +7398,22 @@ //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); + + String objname; + if (false) //parent != null) { - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; } else { - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; } // + super.toString(); //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); + + if (!Globals.ADVANCED) + return objname; + + return objname + " " + System.identityHashCode(this); } public int hashCode() @@ -7378,6 +7469,7 @@ objectUI.closeUI(); if (editWindow != null) { + editWindow.ctrlPanel.FlushUI(); editWindow.refreshContents(); } // ? new objectUI = null; @@ -7513,7 +7605,7 @@ { assert(bRep != null); if (!(support instanceof GenericJoint)) // support.bRep != null) - GrafreeD.Assert(support.bRep == bRep.support); + Grafreed.Assert(support.bRep == bRep.support); } else { -- Gitblit v1.6.2