This is hardcoded to set the persp camera, but is it the effect you're
looking for?

global proc setCameraTumblePivot()
{
    string $sel[] = `ls -sl`;
    if (0 == `size $sel`)
        return;

    float $bbox[] = `xform -q -ws -boundingBox $sel`;
    float $cp[];
    $cp[2] = $bbox[2] + 0.5*($bbox[5] - $bbox[2]);
    $cp[1] = $bbox[1] + 0.5*($bbox[4] - $bbox[1]);
    $cp[0] = $bbox[0] + 0.5*($bbox[3] - $bbox[0]);

    setAttr perspShape.tumblePivot $cp[0] $cp[1] $cp[2];

    tumbleCtx -e -localTumble 0 tumbleContext;
}
scriptJob -e "SelectionChanged" "setCameraTumblePivot";

I think it's the combination of setting the camera's tumble pivot, and
telling the tumbleCtx to use that pivot (-localTumble 0)
that you want?


On Jun 30, 2:49 am, Sebastian Schoellhammer
<[email protected]> wrote:
> Hello!
>
> I would love to get the focus point of the camera to stay on the selection
> so that I can avoid hitting "f" all the time during modeling..
> (like "local focus" in mudbox, zbrush or 3dsmax)
>
> I tried doing it on a scriptjob with MFnCamera::centerOfInterestPoint (I
> tried the mel version too)
> but both seem to move the position of the camera as well - or there is a pop
> anyway which is annoying.
>
> Has anybody seen/made a script like this?
>
> Thanks!!
> seb

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to