Changing the Area to render via a script.

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pfbelesa's picture

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?

jahman's picture

.

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()
miauu's picture

The problem is that you try

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
)
Script_Butler's picture

Thanks

to both of you...

I knew it would be something ridiculously simple as usual.

Cheers.

Script_Butler

barigazy's picture

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

barigazy

Script_Butler's picture

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.

Cheers.

Script_Butler

barigazy's picture

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

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.