MayaVI: Saving and Applying Views

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MayaVI: Saving and Applying Views

Lorenzo Dimagiba
In my program, I can create up to 2 3d models. Should the user want 2 different models, the program will create 2 instances of my traits dialog box (each one containing one of the 3d models).

I'm trying to implement a function wherein which the user can save the view of one of the models, and then apply it to the other model.

My current method of doing this is by using two buttons. The first button stores the view point of model A and saves it into a global variable. The second button retrieves the saved view point and applies it to model B.

Unfortunately it is not working as seamlessly as I had hoped. When the retrieve function is applied, the camera changes its view, however it is not the exact same view that was saved.

Oddly enough, if I save the view point of model A, and then try and apply that view point to model A, the view will change. Might anyone be able to explain this phenomenon?

To get the view I simply use:

v = mlab.view(figure=self.scene1.mayavi_scene)

and to retrieve the view I use:

mlab.view(*v, figure = self.scene1.mayavi_scene)



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: MayaVI: Saving and Applying Views

Lorenzo Dimagiba
I seemed to have found a solution to the problem. It appears that the roll parameter (mlab.roll()) needs to be obtained and explicitly set in order for the second model to have the exact same view point as the first. I'm not sure why this is, if someone could explain that would be great. Otherwise I hope this is able to help someone in the future!

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev