Right Click for custom default value

How do you do this when you have the code for the spinner button like so:

spinner spn_output_width "" pos:[48,64] width:56 height:16 range:[2,32768,1]

I've tried:

on spn_output_width rightclick do
(
print "btn_A was rightclicked"
)

I want the lowest value to be 2 for the spinner but when I right click I want it to be a different value.

Thanks in advance.

Comments

Comment viewing options

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

I've changed the title of this thread..

as to not complicate things and I sometimes find it easier to see the progression of the learning process in one place so all the learning I do will be in one place (here). I do have experience with scripting but there's a long way to go before I get to where I want. Anyway. I'm blabbering, back to the task at hand.

With regard dotNet and to be precise the "System.Windows.Forms.ComboBox"

Here's my code so far minus the other functionality which is striped out for clarity proposes: (I've dragged the dotNet from varies places and modified slightly to suit.

try (destroyDialog rolMainRR) catch()
global DialogIniFile = getDir #plugcfg + "/RegionRenderSaveDialogRoll_Pos.ini"
if renderSceneDialog.isOpen() == true do messagebox "The Render Dialog needs to close and say closed for any changes to take effect.\n\n\nYou don't really need it for test rendering anyway (◣_◢)\n\nIf you open the render dialog and make changes, click the 'U!' button to update the UI." title:"RegionRender v1.01 by 3dwannab (◣_◢)"  beep:true
if renderSceneDialog.isOpen() == true do renderSceneDialog.close()
--------------------------------------------------------------------------------
rollout rolMainRR "RegionRender v1.01 by 3dwannab (◣_◢)"
(
	on rolMainRR moved pos do
	(
	setIniSetting DialogIniFile "RegionRenderSaveDialogRoll" "Position" (pos as string)
	)
    subRollout scriptBin width:252 height:268 pos:[-1,-1]
--------------------------------------------------------------------------------
    rollout rolSub_1 "Settings" width:252 height:254
 
    (
    	checkbutton chk_region "Region" pos:[8,32] width:76 height:20 toolTip:"Toggle Region ON/OFF"
		checkbutton chk_blowup "Blowup" pos:[8,52] width:76 height:20 toolTip:"Toggle Blowup ON/OFF"
    	checkbutton chk_displacement "Displace" pos:[84,32] width:72 height:20 toolTip:"Toggle Displacement ON/OFF\n\nHelpful to speed up test renders when you're in an area where there is no displacement and don't need to parse the scene."
    	button btn_Render "RENDER" pos:[156,32] width:76 height:40 toolTip:"Start Render"
 
		spinner spn_output_width "" pos:[48,96] width:56 height:16 range:[2,32768,1] type:#integer scale:1 toolTip:"Output width (px)"
    	spinner spn_output_height "" pos:[136,96] width:56 height:16 range:[2,32768,1] type:#integer scale:1 toolTip:"Output height (px)"
    	spinner spn_giaa "" pos:[48,120] width:56 height:16 range:[1,1024,16] type:#integer scale:1 toolTip:"Sampling balance: GI/AA\n\nThe amount of GI samples per each Anti-Aliasing sample.\n\nHigher values will increase sampling of Global Illumination, resulting in cleaner indirect lighting, glossy reflections, refractions and translucency. Lower values will increase sampling of Anti-Aliasing and therefore improve quality of fine geometry edges, Depth of Field, and Motion Blur.\n\nSetting this value under 2 or above 64 is not recommended.\n\nDEFAULT: 16"
    	spinner spn_lsm "" pos:[48,144] width:56 height:16 range:[0.0001,100,2] type:#float toolTip:"Sampling balance: Light samples multiplier\n\nThe amount of direct lights samples per each GI sample.\n\nIncrease this value in scenes where there is visible noise in the direct lighting. Default value of 2.0 works well in most cases.\n\nDEFAULT: 2.0"
    	spinner spn_msi "" pos:[136,120] width:56 height:16 range:[0,1000,20] type:#float scale:0.01 toolTip:"Speed/Accuracy balance: Max sample intensity\n\nThe ratio between rendering performance and physical accuracy.\n\nLowering it will result in clamping of the reflection and refraction caustics brightness, significantly reducing noise at the expense of bias. Increasing this value will reduce amount of clamping but also increase amount of noise. Default value of 20 works well in most scenes.\n\nSetting this value to 0 enables special unbiased mode where no clamping will occur. This mode will however often introduce fireflies that may never converge when using Progressive or Bucket render engine.\n\nDEFAULT: 20.0"
    	spinner spn_mrd "" pos:[136,144] width:56 height:16 range:[1,100,25] type:#integer scale:10 toolTip:"Speed/Accuracy balance: Max ray depth\n\nThe maximum possible number of light bounces.\n\nLowering this value slightly improves performance, increasing it slightly improves accuracy. The change in Corona is however very small compared to other renderer's, so keeping the default value is advised.\n\nDEFAULT: 25"
		spinner spn_pass_limit "" pos:[136,168] width:56 height:16 range:[0,1000,50] type:#integer scale:10 toolTip:"The number of passes after which the rendering will stop. Each pass performs one anti-aliasing sample per pixel and a variable amount of secondary samples set by the GI/AA balance parameter.\n\nDEFAULT 0 = Infinity"
 
		button btn_res_width_mul "x" pos:[8,72] width:76 height:16 toolTip:"Width resolution:\n\nx 2 = Left click\n/ 2 = Right click"
    	button btn_res_height_mul "x" pos:[156,72] width:76 height:16 toolTip:"Height resolution:\n\nx 2 = Left click\n/ 2 = Right click"
		button btn_res_overall_mul "x" pos:[112,96] width:16 height:16 toolTip:"Overall resolution:\n\nx 2 = Left click\n/ 2 = Right click"
 
		button btn_about "(◣_◢)" pos:[84,72] width:72 height:16 toolTip:"About"
 
    	button btn_render_setup_dialog "S" pos:[112,120] width:16 height:16 toolTip:"Left click: Open Render Setup\n\nRight click: Close Render Setup"
    	button btn_update_ui "U!" pos:[112,144] width:16 height:16 toolTip:"Click here to update UI from render dialog settings"
    	button btn_render_resume "Resume" pos:[84,52] width:72 height:20 toolTip:"Resume Last Render"
 
    	label lb_output_width "W px:" pos:[8,96] width:32 height:16
    	label lb_output_height ":H px" pos:[200,96] width:32 height:16
		label lbl_giaa "GI/AA:" pos:[8,120] width:32 height:16		
    	label lbl_lsm "LSM:" pos:[8,144] width:32 height:16    	
		label lbl_msi ":MSI" pos:[200,120] width:32 height:16
		label lbl_mrd ":MRD" pos:[200,144] width:32 height:16
		label lbl_pass_limit ":PLimit" pos:[200,168] width:32 height:16
    	label lbl_mat_override "Use Mtl. override:" pos:[8,168] width:96 height:16
    	label lbl_renderstamp_use "Use Render Stamp:" pos:[8,192] width:96 height:16
 
    	checkbox chk_override_mat_checkbox "" pos:[112,168] width:16 height:16 toolTip:"When checked, all scene materials will be overridden with a single specified material"
 
		checkbox chk_renderstamp_use_checkbox "" pos:[112,192] width:16 height:16 toolTip:"Use Render Stamp"
 
    	HyperLink scriptspotlink "3dwannab (◣_◢) on scriptspot.com" pos:[40,216] width:224 height:16 address:"http://www.scriptspot.com/users/3dwannab" color:(color 200 0 255) hovercolor:(color 255 255 255) visitedcolor:(color 0 0 0)
--------------------------------------------------------------------------------
 
    	on rolSub_1 open do
    	(
 
 
    	)
 
    	on rolSub_1 rolledUp bState do
    	(
    	    if (bState == true) then
    	    (
    	        rolMainRR.height += rolSub_1.height
    	        rolMainRR.height += 4
    	    )
    	    else
    	    (
    	        rolMainRR.height -= rolSub_1.height
    	        rolMainRR.height -= 4
    	    )
    	)
 
		dotNetControl obj_dd "System.Windows.Forms.ComboBox" pos:[8,8] width:224 height:22		
		-- When the ComboBox selection is changed change do something
		fn dd_fill =
		(
			-- Collect the Cameras into an array
			camArray = for i in cameras where superclassof i == Camera collect i.name
			-- Clear the ComboBox list
			obj_dd.items.clear()
			-- Build a new ComboBox list using the view array
 
 
			--obj_dd.items.addRange (#("Choose"))
			--obj_dd.SelectedIndex = 1
 
			obj_dd.items.addrange camArray
 
		)
		on drop_roll open do
		(
			dd_fill()
			--Fill on open
		)
		on obj_dd DropDown do
		(
			--Fill on expanding the list
			dd_fill()
		)
 
		on obj_dd SelectedIndexChanged do
		(
			--Command to execute on selecting the entry
			select (getNodeByName obj_dd.text)
			viewport.setCamera (getNodeByName obj_dd.text)
		)
 
    )
--------------------------------------------------------------------------------
	on rolMainRR open do
	(
		addSubRollout scriptBin rolSub_1
	)
 
)
    DialogPos = execute (getIniSetting DialogIniFile "RegionRenderSaveDialogRoll" "Position")
    if DialogPos == OK do DialogPos = [75,75]
createDialog rolMainRR 248 268 DialogPos.x DialogPos.y style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

What I'm missing from the functionality is:

- I want the default text of the Combobox to be 'Choose Camera...' with a list of camera which I already have below.
- Renaming of the selected camera directly inside the ComboBox. Tabbing or hitting return will rename the camera.
- If I change a spinner/s it will rename the selected camera. (See screenshot of script)
- If I tab out of the ComboBox then it will go over to a spinner
- When a camera with correct formatted name i.e 'cam name 1000x600' whereby cam name is what you think and the 1000x600 is the dimensions of the output inside max. (not VRays framebuffer)

My future plans for the script are mainly allowing to render out the preselected cameras but for now I'm happy to get the above to work.

AttachmentSize
script_layout.jpg 36.69 KB
victorgilbert's picture

.NET makes this more feasible

.NET makes this more feasible and understandable. .NET made the programming language so easy. I think second example is best suitable for this.

miauu's picture

.

Use the dotNet spinners
Default 3dsma spinners do not have rightclick evenet.
Or place small button next to the spinner's arrows and tell the users to press that button instead of rightclick over the arrows. When the button is pressed change the range properlty to desired value.

3dwannab's picture

Thanks

I was thinking that it needed to be by dotNet. I can't seem to find any good examples, least for what I require. The only added function I need over default max spinners is the right click to default value. Have you a snippet of example code that could help me get started? Thanks.

miauu's picture
3dwannab's picture

.

Thank you Miauu.. I've since came across those. For now it's seems like a lot of extra work to incorporate that into all the spinners for this script.

I keep note for the next script where I can start afresh.

Comment viewing options

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