Notifications
Clear all

[Closed] Controlling renderwidth / renderheight

A relatively quick one, but I am putting together a script that uses a custom rollout to control the renederer to provide a simplified interaction with the mental ray renderer. In the script I have two spinners to control the final render resolution. I want the spinners to interactively control the outputrenderwidth /height and mutually update each other from either the render dialog or the custom rollout? What is the most efficient means to wire these spinners values? I’m sure its something really simple that I have over looked.

Would really appreciate any advice on this.

Thanks,

D.

5 Replies

set your spinner to be integer.

from your spinner to render dialog:


renderWidth   = spn_renderWidth.value
renderHeight   = spn_renderHeight.value

from render dialog to your spinner


spn_renderWidth.value = renderWidth   
spn_renderHeight.value = renderHeight  

here’s code for adding a callback that runs the update function when you change the resolution in the render dialog:
run the code, then see it print in the listener when you change resolution.


callbacks.removeScripts id:#testCallback
callbacks.addScript #renderParamsChanged "UpdateSpinnerFromRenderDialog()" id:#testCallback

fn UpdateSpinnerFromRenderDialog =
(
	print "Updated spinners"
	--place the code for updating your value in spinner here.
)


The problem I seem to be having is that maxscript will not recognise “.value” as a property of the spinner.

Here is a simple test of the spinner


 
 Rollout Spinnertest "Untitled" width:162 height:300
 (
 	spinner spn_renderWidth "Render width" pos:[40,84] width:72 height:16 type: #integer
 	spn_renderWidth.value = renderWidth
 
 )
 Createdialog Spinnertest
 
 

When I run this i get an error


 -- Syntax error: at ., expected name
 --  In line: 	spn_renderWidth.v
 

I dont seem to be able to manually set any value for the spinners any thoughts on why this is the case?

Thanks,

D.

It does not refresh like I expected.
but that something else we can solve…
I’m still at work, so time is limited.

but this will get you going :

 rollout Spinnertest "Untitled" width:162 height:300
 (
	 spinner spn_renderWidth "Render width" pos:[12,22] width:115 height:16 type:#integer range:[0,999999,0]
	 
 
	on Spinnertest open do
	(
--when we open the UI rollout we get the current renderwidt and show it in spinner
		print "opening UI - setting value to spinner"
		spn_renderWidth.value = renderwidth
	)
	
	
	 on spn_renderWidth changed val do
	 (
--when you change the spinner the value get's put to renderwidth
--does not update the dialog correctly in render dialog.

		print "changing spinner value.."
		renderWidth = val
	
	 )
 )
 Createdialog Spinnertest
 

from the help –

NOTE:

Changing the render scene dialog settings via MAXScript should be done with the actual render scene dialog in a closed state.

Leaving the dialog open will make the attempted MAXScript modifications non-sticky.

however, you can around this by calling renderSceneDialog.update() on the spinner entered event. This is called when text is dialed in and the enter button pressed, or the mouseup on a spinner button.

 rollout Spinnertest "Untitled" width:162 height:300
 (
	 spinner spn_renderWidth "Render width" pos:[12,22] width:115 height:16 type:#integer range:[0,999999,0]
 
	on Spinnertest open do
	(
--when we open the UI rollout we get the current renderwidt and show it in spinner
		print "opening UI - setting value to spinner"
		spn_renderWidth.value = renderwidth
	)

	 on spn_renderWidth changed val do renderWidth = val
	 on spn_renderwidth entered val arg do if renderSceneDialog.isOpen() then renderSceneDialog.update()
 )
 createdialog Spinnertest

Thanks guys, really appreciate the help, this seems to have done the trick.

Regards,

D.