[Sidefx-houdini-list] viewport camera

Dan Schneider eyevex at yahoo.com
Fri Sep 2 02:25:51 EDT 2011


Thanks Ive been playing with the xform but it hadnt occured to me to use it for Identifying the cam.
I think to properly implement this Id need to grab all lights as well since they can also take over the perspective viewpoint.
Not incredibly elegant but would seem to do the trick.


Ive been doing alot of grabbing all of one type and iterating through them lately. Seems that alot of places logically have complimenting methods in hython like setSmoo() complimented by smoo() for query --yet alot of places do not maintain the consistancey.  As with alot of other things involving the viewport it is obvious there is some knowledge of this already since it displays the object you are looking trough name in the yellow overlayed box in the upper right, however it is unnaccesable via scripting.

thanks again for the pointer, hopefully the future will hold a more a robust set of native methods for dealing with the viewport




----- Original Message -----
From: Graham Thompson <captainhammy at gmail.com>
To: sidefx-houdini-list at sidefx.com; Dan Schneider <eyevex at yahoo.com>
Cc: 
Sent: Friday, September 2, 2011 3:16 PM
Subject: Re: [Sidefx-houdini-list] viewport camera

I'd try something like extracting the view transform matrix and the
comparing it to any instances of a camera in the scene.

def findViewCamera(viewport):
    view_xform = viewport.viewTransform()
    cameras = hou.nodeType(hou.objNodeTypeCategory(), "cam").instances()
    for cam in cameras:
        if cam.worldTransform() == view_xform:
            return cam
    else:
        return None

This should work unless of course you have multiple cameras with the
same transform.

On Thu, Sep 1, 2011 at 9:59 PM, Dan Schneider <eyevex at yahoo.com> wrote:
> So I guessing there might be no easy way to do this, as seems to be the theme when I want info from the viewport, but figured it couldnt hurt to throw it out there.....
>
> I want to know if I am looking through a camera and what camera if any.
>
> I can grab the current viewport via python and set it to a cam via setCamera method or similar via hscript, but I see no corresponding method or function in hscript/hython to query..
>
> anyone found a way to do this?
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>




More information about the Sidefx-houdini-list mailing list