how to make values automatically updated when renderscenedialog get changed?

hi all,
I'm a beginner in 3dsmax scripting, now I need some help from advanced user here :)
here it is my several questions,

1. can i make the values automatically updated when renderscenedialog get changed? with renderscenedialog.update can't do it.
2. how to make my mapbutton able to drag&dropped and has rightclick menu with cut,copy,paste just like usual mapbutton in max?
3. I have no any idea how to make my renderwidth spinner automatically changed when the renderheight spinner changed with imageaspectratio turn on.
4. my imageaspectratio button is damn failed, please help...

would you guys like to help me? :D thanx a lot
here it is my script

 
try (destroydialog testing) catch()
Rollout testing "one"	
(
 
 
	spinner widthres "W:"   
			range:[0,10000,0] 
			width:60 
			type:#integer 
			align:#left
			tooltip: "output width"
 
			on widthres changed val do try 
				(
					(RenderWidth = widthres.value)/(getRendImageAspect())
					renderSceneDialog.update()	 
				) catch()
 
	spinner heightres "H:"   
			range:[0,10000,0] 
			width:60 
			type:#integer 
			align:#right
			tooltip: "output height"
			pos: (widthres.pos+[20,0])
		on heightres changed val do try 
			(
				(Renderheight = heightres.value)/(getRendImageAspect())
				renderSceneDialog.update()	 
			) catch()
 
	checkbutton lockratio ""
			pos: (heightres.pos+[14,0])
			width: 16 height: 16
			tooltip: "lock image aspect ratio"
		on lockratio changed state do try 
			(
				( 	if state == 1 then getRendImageAspect = true
					else ( 	if state == 0 then getRendImageAspect = true) 	
					renderscenedialog.update)
				) catch()
 
	dropdownList areatorender "area to render :"   
			tooltip:"area to render"
			items:#("view","region","crop","blowup")	
			align: #center
			on areatorender selected sell do try 
			(   case areatorender.selection of
				(	1: ( setRenderType #view; EditRenderRegion.IsEditing = false() )
					2: ( setRenderType #region; EditRenderRegion.EditRegion() )
					3: ( setRenderType #crop; EditRenderRegion.EditRegion() )
					4: ( setRenderType #blowup; EditRenderRegion.EditRegion() )
				) 
			)catch()
 
			spinner autobackuptime_SPN ""   
					range:[0,100,15] 
					width:40 
					type:#float				
					tooltip: "autobackup timing in minute"
					enabled: false
				on autobackuptime_SPN changed val do 
				(autosave.Interval = autobackuptime_SPN.value) 
 
			checkbox autobackup_CB "autobackup" 
				checked:false 
				pos: (autobackuptime_SPN.pos+[-115,0])
				on autobackup_CB changed state do try (
					(	autosave.enable = state
						autobackuptime_SPN.enabled = not autobackuptime_SPN.enabled
					)
				) catch ()
 
			mapbutton environment_Mbtn "<<none>>"
				on environment_Mbtn picked texmap do try (
					(
					environmentmap = texmap
					environment_Mbtn.text=classof texmap as string
					)
				) catch ()
 
		on testing open do
		(	
			try (
					widthres.value = renderwidth;
					heightres.value = renderheight
					lockratio.state = getRendImageAspect
					areatorender.selection = getRenderType
					autobackuptime_SPN.value = autosave.interval
					autobackup_CB.state = autosave.enable
				)
			catch()
		)  
 
		on testing mousemove pos do --lbuttondown 
		(	
			try (
					widthres.value = renderwidth; 
					heightres.value = renderheight
					lockratio.state = getRendImageAspect
					areatorender.selection = getRenderType
					autobackuptime_SPN.value = autosave.interval
					autobackup_CB.state = autosave.enable
				)
			catch()	
		)
 
)
createdialog testing  width:170 pos: [10,100]--menu:<RCMenu>

Comments

Comment viewing options

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

thanx again but..

many many thanx pixamoon.. now I'm closer to fully understanding about RCmenu but, I must be stupid cuz I cannot find where is the documentation about applying cut, copy, paste instance, paste, copy.

and about callback, i able call something when file saving is starting to run with #filePreSaveProcess but i need to call something else when file saving is finished.
and once again, how to detect changed value in properties of renderers.current ?
I'm using corona-renderer, and if you're corona user can you help me how to detect when InteractiveRendering is started or stopped using callback ?

really appreciate for your helps, i'll treat you coffee in any chance.

God Bless us everyone

pixamoon's picture

`

Hi,

It depends which parameters from render dialog you want to update...

To update from Common tab use callbacks :

(
global FnRendPChanged
fn FnRendPChanged = (
  -- add code to update your rollout
  print "Render Params Changed"
)
 
callbacks.removescripts id:#PxRenderPChanged
callbacks.addscript #renderParamsChanged "FnRendPChanged()" id:#PxRenderPChanged
)

to update current renderer parameters (Vray, Corona etc) you need to use timer in rollout and check every 1s or 0,5s if anything changed.

take a look on my code form this post:
http://www.scriptspot.com/forums/3ds-max/general-scripting/scripting-the...
or attached file

2. to make map button with drag&drop option - so far I know this function is not exposed to maxscript

3.4. you need to call renderSceneDialog.update() after each change made by script (if you call it after few changes - it will update only last one)

hope it helps a bit

AttachmentSize
vray_render_property_check_v0.10.1.ms 1.16 KB
christa.noel's picture

many thanx pixamoon :)

hi,
thanx for helping :), I don't understand why should I use callbacks wether use timer is a brilliant updating solution (I never thought that it can be so useful).
but yes, i'll learn how to use callbacks soon.
another question, can I use rightclick on mapbutton if drag&drop isn't available for maxscript? is there an example how to create rightclick for mapbutton?

and thanx too for your renderproperty_check script, what a nice idea.

God Bless us everyone

pixamoon's picture

`

hey,

Timer is good too, but timer needs to check all properties every tick (interval time). Callback function will be called only if something was changed.

Right click on map button is possible. from maxscript help:
on <mapbutton> rightclick do <expr>

in expression you need a function call rightclick menu.
To to learn on right click menus you can look on my Quick Pivot:
http://www.scriptspot.com/3ds-max/scripts/quick-pivot

first you need to declare rightclick menu (before declaring rollout):

rcmenu yourRCname (
	menuitem item1 "Item 1" checked:false
	menuitem item2 "Item 2" checked:false
 
	on item1 picked do -- do something here
	on item2 picked do -- do something here
)

and then in rollout call it by:

on <mapbutton> rightclick do popupmenu yourRCname

Hope it helps,
Let me know if you better explanation or how to implement in your code

Best,
Pixamoon

christa.noel's picture

thanx again pixamoon... but

many many thanx pixamoon.. now I'm closer to fully understanding about RCmenu but, I must be stupid cuz I cannot find where is the documentation about applying cut, copy, paste instance, paste, copy.

and about callback, i able call something when file saving is starting to run with #filePreSaveProcess but i need to call something else when file saving is finished. how to detect the end of filesave progress? if there is no parameter availabled by max script, i have an idea with using progressbar on filesave progress and when progressbar finished it call something i need?
and once again, how to detect changed value in properties of renderers.current ?
I'm using corona-renderer, and if you're a corona user can you help me how to detect when InteractiveRendering is started or stopped using callback ?

really appreciate for your helps, i'll treat you coffee in any chance.

God Bless us everyone

Comment viewing options

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