Script to auto select left eye for focusing camera
Hi
I'm trying to write a script to auto select the left eye, once selected i would the run a second script to focus the camera on the left eye. The second part of the script is done, i managed to modify the script created by By cwichura
"Set focus distance", it originally worked by finding the focal distance of a null object. I modified it so now it will find and set the focal distance of any object selected, example left hand, right eye, foot, etc.... You have to select the body part, then run the script and it works.... I've been using it for a month or so.
As a photographer who takes portraits for a living, 99% of all my portraits will focus on the closest eye to the camera, left eye or the right eye. I do not except the script to figure out which is the closest eye to the camera, (though that would be nice)
What I would like to do is have 2 scripts, that i can run once a figure is selected.
1) focus camera left eye
2) focus camera right eye
what i've been trying to do is to modify the focus camera script, this line in particular
var oTargetNode = Scene.getPrimarySelection()
instead of Scene.getPrimarySelection() i'd like it to always select the left eye of the currently selected figure. (I’ll have a second script for the right eye)
thanks,
Comments
var figList = Scene.getSelectedSkeletonList();
will give you an array containing every figure that is selected (by itself or by a bone). If you want to ignore other figures you could just check that wasn't zero length (that at least oen figure was selected) and then take the zeroth entry
if ( figList.length == 0 ) {
return;
}
targetFig = figList[ 0 ];
then just use the findBoneByLabel member to try to get the eye
var lEye = targetFig.findBoneByLabel( "Left Eye" );