Notifications
Clear all

[Closed] user to Perspective

hello all
i’m looking for a really stupid function but i must be stupider i dunno but i cant get it right
basically i wish to eradicate the crapy, “move an iso view to user” and change it to perspectice. kinda like maya does
here what i got ( wich doesnt work btw)

fn VPpersp =

(
if viewport.view_Iso_user

then  setviewport.view_persp_user

)

registerRedrawViewCallback VPpersp

if someone have an idea or already achieved this i would be happy to know.
I look on scriptspot but i founded nothing… maybe i’m blind anyways .

-D-

3 Replies

The correct syntax would be

unregisterRedrawViewsCallback VPpersp
fn VPpersp =
(
if viewport.getType() == #view_Iso_user then
	viewport.setType #view_persp_user
)
registerRedrawViewsCallback VPpersp

But it does not work as expected when turning a Front viewport to User by Oribiting with the Alt+Mouse for example. The mouse control overrides the complete viewport transformation matrix and resets its .ROW4 back to the value of the original user view and this zooms at the home grid so you have to zoom out to see what you are working on.

On the other hand, if you would switch to User view by pressing the U button, the view will be correctly switched to Perspective view without side effects.

There are some hacky ways to work around this, but in general there is not much control over what the mouse controls are doing. So you better hit that P button instead…

thank for your help Bobo.
you lost me with the .ROW4 but anyways i get the point. its too much work for such a simple thing
why does every project i’m trying to learn with are insanely huge !!
anyways , like i said it was mainly to play with MXS so i think i’ll play with this code a bite more just to learn some more trick.
Nest step; saving myself some money for the Matrix:explained DVD by some obscure and unknown author…

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

I just added some prints to the function to watch what TM the viewport is set to before and after the change…
It looks like the values inside the function are correct and as expected, but the moment the function exits, the mouse viewport controls get confused by the change and return the viewport to a transformation matrix that does not have the same translation values (stored in the last row of the matrix), so the perspective remains correct, but it zooms into the grid.