Jump to content

Viewport | no cam position


sipi

Recommended Posts

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?
Link to comment
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

Link to comment
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 

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...