Notifications
Clear all

[Closed] can Render command do viewports?

The render command takes a camera parameter, so for example you can say…

render camera:$cam01

And that will render from the camera cam01’s perspective. Is it possible to render from one of the viewports? something like

render camera:#view_top

  • Neil
15 Replies

doesn’t look like it… you’d have to either…
A. switch the active viewport to the viewport of interested, then call render without any camera parameter
B. create a camera to match the viewport of desire, then call render with that camera as its camera parameter, delete when done
C. ?? I had a thought there for a moment but it seems to have been rather ephemeral

A is close to what I’d like, but unfortunately, if you say switch a top view into a perspective view, it won’t just grab the perspective view that may be elsewhere in your 4 viewports, it will make a new perspective view from the position of your top view. At least it does when using viewport.setType.

  • Neil

Never mind, I can use the viewport.activeViewport to set the view to be the one that I want. Doesn’t change the active view into a new view, it just changes which view is active, which probably isn’t that annoying for the viewer. That’s what I need. Thanks Ze!

  • Neil

Shoot. That doesn’t work if your have only a single view maximized. Back to the drawing board.

  • Neil

this all sounds familiar somehow…

didn’t we (not sure if it was you) conclude that you’d have to switch layouts, change view, switch back… and that if none of the views was a/the ‘Perspective’ view, you’d be quite stuck?

Perhaps we should ask what you’re trying to achieve? %)

Don’t think we discussed this before. I’m now having trouble using the max tool maximize command, it seems that when you use it repeatedly, max gets confused. Try this if you may…

myindex = rendViewIndex
if myindex !=0 then
(
if viewport.numViews == 1 and myindex != 1 then
	(
	max tool maximize
	oldview = viewport.activeViewport
	viewport.activeViewport = myindex
	max tool maximize
	)
else viewport.activeViewport = myindex
render vfb:on
if viewport.numViews == 1 then
	(
	max tool maximize
	)
)

Make a rectangular box in your scene. Then open the render dialog, and Lock the view to the perspective view. Then maximize the front viewport. If this code worked correctly, it should render the perspective view, and then return to 4 viewports. But it doesn’t it stays at a single viewport, even though I call the maximize command 3 times. Is the same happening for you?

  • Neil

(Hi Dubbie!)

Can’t say that it does… have you tried putting messageboxes just after the maximize commands to see what the state is at that point, and see if something else might be resetting it afterwards?


myindex = rendViewIndex
if (myindex !=0) do (
	if viewport.numViews == 1 and myindex != 1 then (
		max tool maximize
		messagebox "A"
		oldview = viewport.activeViewport
		viewport.activeViewport = myindex
		max tool maximize
		messagebox "B"
 	)
	else ( viewport.activeViewport = myindex )
	render vfb:on
	if viewport.numViews == 1 then (
		max tool maximize
		messagebox "C"
 	)
)

That is really weird. So this code does what I expect it to, I start and end on the front viewport…

myindex = rendViewIndex
if (myindex !=0) do (
	if viewport.numViews == 1 and myindex != 1 then (
		max tool maximize
		messagebox "A"
		oldview = viewport.activeViewport
		viewport.activeViewport = myindex
		max tool maximize
		messagebox "B"
	 )
	else ( viewport.activeViewport = myindex )
	render vfb:on
	if viewport.numViews == 1 then (
		messagebox "C"
		max tool maximize
		viewport.activeViewport = oldview
		messagebox "D"
		max tool maximize
	 )
)

But if I comment out the message boxes, then I start at the front view and end at the persp view.

myindex = rendViewIndex
if (myindex !=0) do (
	if viewport.numViews == 1 and myindex != 1 then (
		max tool maximize
		--messagebox "A"
		oldview = viewport.activeViewport
		viewport.activeViewport = myindex
		max tool maximize
		--messagebox "B"
	 )
	else ( viewport.activeViewport = myindex )
	render vfb:on
	if viewport.numViews == 1 then (
		--messagebox "C"
		max tool maximize
		viewport.activeViewport = oldview
		--messagebox "D"
		max tool maximize
	 )
)

Could it be some sort of timing issue, where it maximizes too quickly and so max gets confused, but if you put some nice stops in there using a messagebox, it doesn’t get confused. I tried sleeps instead of messageboxes and I still got the wrong results.

  • Neil

could be… I do have a pretty slow machine – have you tried inserting a ‘sleep 0.1’ or so ?

Page 1 / 2