Jump to content
sipi

Viewport | no cam position

Recommended Posts

Hey everyone,

Can I get somehow the position of the current look view when I'm in `no cam` mode in the viewport?

Share this post


Link to post
Share on other sites

you can do something like this for example:

import toolutils as tu
view = tu.sceneViewer().curViewport()
view_xform = view.viewTransform()
view_position = view_xform.extractTranslates()

 

  • Thanks 2

Share this post


Link to post
Share on other sites
10 hours ago, anim said:

you can do something like this for example:


import toolutils as tu
view = tu.sceneViewer().curViewport()
view_xform = view.viewTransform()
view_position = view_xform.extractTranslates()

 

It is really nice, thank you!!!
 
But now I'm facing another problem. My main goal is that these values update a vec3 parameter on the interface of an asset, and I actually managed to do this by pushing a button (using your script in a callback script), but I realized I don't want to always push that button.
So I wonder, is it possible to update these values automatically for example on every change of the viewport, or somehow?

Share this post


Link to post
Share on other sites

__import__("toolutils").sceneViewer().curViewport().viewTransform().extractTranslates().x()

__import__("toolutils").sceneViewer().curViewport().viewTransform().extractTranslates().y()

__import__("toolutils").sceneViewer().curViewport().viewTransform().extractTranslates().z()

 

Map them in vector3 parm respectively (x,y,z). It will update automatically

Share this post


Link to post
Share on other sites
5 hours ago, ftaswin said:

__import__("toolutils").sceneViewer().curViewport().viewTransform().extractTranslates().x()

__import__("toolutils").sceneViewer().curViewport().viewTransform().extractTranslates().y()

__import__("toolutils").sceneViewer().curViewport().viewTransform().extractTranslates().z()

 

Map them in vector3 parm respectively (x,y,z). It will update automatically

Well, I tried to use this code in a parameter as python expression, but it only updates if I select or deselect the node. What am I doing wrong?

image.thumb.png.cc744223144899b671b3145bacc4af68.png 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×