View Full Version : virtual viewport

12 December 2008, 06:14 PM

I am trying to find out if anybody knows a way to access the virtual view port in max through max script..
I want to create a simple dialog that will have 3 sliders - zoom in, x, y.
I would like to link the parameters for that to my dialog,



12 December 2008, 11:44 AM
Hi Asa, i have the same question with you..
so, i wil watch this thread

12 December 2008, 12:19 PM
misunderstood the OP, moving on :)

12 December 2008, 12:39 PM
i want 3d viewport in a rollout floater, it's like cartoon car rig that Yassine4D does.
can anyone tell me how to do that in MXS?

12 December 2008, 12:53 PM
AsaMovshovitz: I don't think there is access to the virtual viewport.
For the curious - the 'virtual viewport' is an option that becomes available when you use OpenGL (maybe it's in Direct3D nowadays as well), where the viewport display becomes a sub-region of a full viewport. I've never used it, but it's got its uses.

anggahenggara: Different question, actually - you just want to make something in a rollout that shows a viewport?
Unfortunately you can't actually create your own full-on viewport (you could try, somewhat, but it'd be a lot of work) but you can use something like this to continually keep a viewport representation in a viewport:

-- function to set a bitmap control's bitmap to the currently active viewport image
-- does not retain aspect
fn setViewportBmp bmpControl = (
viewportDib = gw.getViewportDIB()
copy viewportDib bmpControl.bitmap
bmpControl.bitmap = bmpControl.bitmap

rollout test "test" (
bitmap bmp_viewport

on test open do (
bmp_viewport.bitmap = bitmap bmp_viewport.width bmp_viewport.height
createDialog test
callbacks.removeScripts id:#test
callbacks.addScript #viewportChange "setViewportBmp test.bmp_viewport" id:#test

Can fancy that up in all manner of ways.

12 December 2008, 01:32 PM
wow it's little bit approach to what i want, but i want able to select objects in rollout-viewport and able to rotate view in rollout.Is it possible?

12 December 2008, 02:39 PM
wow it's little bit approach to what i want, but i want able to select objects in rollout-viewport and able to rotate view in rollout.Is it possible?
Only with a lot of work, I'm afraid.

Basically you could start out with something like an imgTag, record mouse clicks in that, project that to normal viewport coordinates, create a ray based on that, run an intersectRay, and select the intersected geometry.

Like I said - a lot of work ;) A full interactive viewport - like you have in the main max interface - can't be added to your own dialogs.

12 December 2008, 07:48 PM
thanks ZeBoxx for helping me.

03 March 2009, 06:10 AM
I tried the code use max 8, but I get nothing in the virtual viewport , whats the matter?

03 March 2009, 06:19 AM
ok, it work now
but still I have a question can display the animation in the virtual viewport just like in max viewport

03 March 2009, 07:17 AM
nicely said ZeBoxx2 ( .thanks you

CGTalk Moderation
03 March 2009, 07:17 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.