ScriptSpot home

Forum topic · General Scripting

Changing the Area to render via a script.

By Script_Butler · 2012-09-05

Description

Hi all i have the following code

 

<code>

try(DestroyDialog SB_Tools_Region_Render)catch()

Rollout SB_Tools_Region_Render "Render Region"

(

   dropdownlist render_dd "Please select a render type" items:#("View", "Selected", "Region", "Crop", "Blowup")

on render_dd selected i do

setRenderType render_dd.items[i]

 

)

CreateDialog SB_Tools_Region_Render

<code\>

When I run this code, choode one of the options in the dropdown list. I get the following error.......

--Runtime Error: The function needed argument of type: #view | #normal | #selected | #selection | #region | #crop | #regioncrop | #boxselected | #blowup | #regionselected | #cropselected, got: "Selected"

What have i done incorrectly?

 

Comments (10)
pfbelesa

A much simpler question

I need just to create a simple script to run with every scene, making the render area option set to #view

I got it with the following line.
render rendertype #view

BUT it just renders via cmd line, but in the render tab options its still on region.
How do i change it ? without needing to render every scene?

Reply to pfbelesa
Panteleev Sergey

.

from mxs reference

setRenderType <name> 

Sets the render type.

The valid name values are:

#view | #selected | #region | #crop | #blowUp | #boxselected | #regionselected | #cropselected | #normal | #selection | #regionCrop .

#view and #normal are equivalent

#selected and #selection are equivalent

#crop and #regionCrop are equivalent.

if render scene dialog is open it needs to be updated after changes being made


setRenderType #view
if renderSceneDialog.isOpen() do renderSceneDialog.update()
Reply to Panteleev Sergey
Bert Van Eeckhout

setRenderType in render window when using batch rendering

Hi,

I'm having a problem setting the area to render to blowup when using batch rendering.
Is there way to set this in max(script)?

Regards,
Bert

Reply to Panteleev Sergey
Bert Van Eeckhout

setRenderType in render window when using batch rendering

Hi,

I'm having a problem setting the area to render to blowup when using batch rendering.
Is there way to set this in max(script)?

Regards,
Bert

miauu

The problem is that you try to assign a string to the setRenredType.
The render_dd.items[i] return string. Also you have to add # before the name of the render type
This works:


(
	try(DestroyDialog SB_Tools_Region_Render)catch()
	Rollout SB_Tools_Region_Render "Render Region"
	(

	   dropdownlist render_dd "Please select a render type" items:#("View", "Selected", "Region", "Crop", "Blowup")

		on render_dd selected i do
		(
			renderType = execute ("#" + render_dd.items[i])
			setRenderType renderType
		)
	)
	CreateDialog SB_Tools_Region_Render
)
Reply to miauu
Branko Živković

Hi Kostadin

I also try this, it works but don't update "Rendered Frame Window"
if already open.You need to reopen to refresh.

try(DestroyDialog SB_Tools_Region_Render)catch()
Rollout SB_Tools_Region_Render "Render Region"
(
dropdownlist render_dd "Please select a render type" items:#("View", "Selected", "Region", "Crop", "Blowup")
on render_dd selected i do (setRenderType (render_dd.items[i] as name))
)
CreateDialog SB_Tools_Region_Render

Reply to miauu
Script_Butler

Thanks

to both of you...

I knew it would be something ridiculously simple as usual.

Reply to Script_Butler
Branko Živković

solution

I find a simple solution for update the VFB

try(DestroyDialog SB_Tools_Region_Render)catch()
Rollout SB_Tools_Region_Render "Render Region"
(
dropdownlist render_dd "Please select a render type" items:#("View", "Selected", "Region", "Crop", "Blowup")
on render_dd selected i do
(
setRenderType (render_dd.items[i] as name)
if VFB_methods.VFB_IsInitialized() do VFB_methods.Reset()
)
)
CreateDialog SB_Tools_Region_Render

Reply to Branko Živković
Script_Butler

Thanks again barigazy

I've moved on a little from this and am trying to use a checkbutton instead that when checked turns the are to render to region.



rollout SB_Tools_Region_Render "Region Render"
(
checkbutton chk_region "Region" tooltip:"Region Render"
on chk_region changed state do
if state then setRenderType #region else setRenderType #view
)
createDialog SB_Tools_Region_Render
)

But when i drag this to a tool bar, when I click the check button it opens a dialog. Obviously because i am telling it to have a dialog, but ideally i just want the button when checked to render a region but when unchecked to render view. Any ideas how this is achieved?

The script itself works, i just don't want it to have a floating dialog.