//import java.util.Vector; class SwitchNode extends Object3D implements java.io.Serializable { static final long serialVersionUID = 6330600721103324217L; Object3D switchobject; Object3D parent; // erreur!! int mask; SwitchNode(Object3D object, int mask) { this.switchobject = object; this.mask = mask; name = "Switch:" + switchobject.name; // + mask; if (switchobject.get(0).bRep != null) // june 2014 { CreateMaterial(); switchobject.get(0).bRep.SaveSupports(); bRep = (BoundaryRep) Grafreed.clone(switchobject.get(0).bRep); switchobject.get(0).bRep.RestoreSupports(); } for (int i=0; i 1) switchobject.count = 1; // hide } //transient boolean restarted; transient int countspeed; transient boolean toggleneutral; void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) { //System.err.println("Frame # " + frame); if (switchobject == null) { // grosse patch!! switchobject = parent; parent = super.parent; } if (live && Globals.isLIVE() && display.DrawMode() == display.SHADOW) { if (countspeed <= 0) { countspeed = speed; if (toggleneutral || !link2support) { do { if (random) child = (int)(Math.random() * switchobject.Size()); else { child++; child %= switchobject.Size(); } } while(switchobject.get(child).hide); } else { child = 0; // jump to neutral if (Math.random() < 0.5 && name.contains("Faces") && switchobject.Size() > 16) { child = 16; // blink eyes countspeed /= 2; } } toggleneutral ^= true; } else { if (CameraPane.FAST) countspeed -= CameraPane.STEP; else countspeed--; } } if (bRep == null) { // The switch mesh will be used to interpolate poaes (maybe). bRep = (BoundaryRep)Grafreed.clone(switchobject.get(0).bRep); } if (CameraPane.SUPPORT && display.DrawMode() == display.SHADOW) { Update(); } super.DrawNode(display, root, selected); } void Update() { if (mask == 0) mask = Object3D.GEOMETRY; if (mask == Object3D.GEOMETRY) switchobject.get(child).resetMaster(false); // for mocap overwriteThis(switchobject.get(child), mask); } // for slider int getNumFrames() { return switchobject.Size(); } Object3D deepCopy() { SwitchNode e = new SwitchNode(switchobject, mask); deepCopySelf(e); return e; } protected void deepCopyNode(Object3D other) { super.deepCopyNode(other); SwitchNode bp = (SwitchNode)other; bp.child = child; } void createEditWindow(GroupEditor callee, boolean newWindow) { //editWindow = (new SphereEditor(this, deepCopy(), callee)).GetEditor(); if (newWindow) { objectUI = new SwitchEditor(this, deepCopy(), callee); } else { objectUI = new SwitchEditor(this, callee); } editWindow = objectUI.GetEditor(); } void Reset() { child = 0; } void Step() { child += 1; child %= switchobject.Size(); } int child; int speed; }