// StereoAnimWorkingViews // by Etienne Monneret // This script can't run out of the AnaBuilder's context // See http://anabuilder.free.fr for more info setAccessibility(true); //Search for camera 1 and camera 2 aScene = window.getScene(); aFound = false; ObjectInfo aCamera1 = null,aCamera2 = null; for(i = 0;i < aScene.getNumObjects() && !aFound;i++) { if(aScene.getObject(i).object instanceof SceneCamera) { if(aScene.getObject(i).name.equals("Camera 1")) { aCamera1 = aScene.getObject(i); } if(aScene.getObject(i).name.equals("Camera 2")) { aCamera2 = aScene.getObject(i); } if(aCamera1 != null && aCamera2 != null) { aFound = true; } } } if(aFound == false) { return; } //localShift = aCamera1.coords.toLocal().timesDirection(aCamera2.coords.getOrigin()); //Ask for time datas nbViewsField = new ValueField(50, ValueField.POSITIVE+ValueField.INTEGER); endTimeField = new ValueField(1.0, ValueField.POSITIVE); dlg = new ComponentsDialog(window, "Select parameters for rendered animation", new Component [] {nbViewsField, endTimeField}, new String [] {"Nb views", "End time"}); if (!dlg.clickedOk()) return; nbViews = (int) nbViewsField.getValue(); endTime = (double) endTimeField.getValue(); //Calc working views and build the stereo with AnaBuilder for(i = 0;i < nbViews;i++) { window.setTime(endTime * i / nbViews ); // aCoords = aCamera1.coords.duplicate(); // aCoords.setOrigin(aCoords.getOrigin().plus(localShift)); // aCamera2.coords = aCoords; window.theView[0].updateImage(); window.theView[0].update(window.theView[0].getGraphics()); window.theView[1].updateImage(); window.theView[1].update(window.theView[1].getGraphics()); AnaBuilder.ABTakeWorkingViews(); }