Notifications
Clear all

[Closed] Listbox to display render presets

Im trying to create a listbox to display a directory of my render preset files
and on double click to execute the rps file

can someone help me with the script?

4 Replies

rollout VrayRenderSetting "VrayRenderSetting" width:200 height:296
(
	listBox lbxRPS "RenderPresets" pos:[8,8] width:270 height:6 
	items:(for o in objects collect o.name)
	
	on lbxRPS selected sel do
(
	
	)
	on lbxRPS doubleClicked sel do
(
	renderpresets.Load 0 (GetDir #renderPresets + "The Filename")
	)
)

theNewFloater = newRolloutFloater "ListboxRND" 300 220
addRollout VrayRenderSetting theNewFloater

this is all I have for now

	items:(Getfiles (GetDir #renderPresets + "\\*.rps") ) 

it display the whole directory path. how do I code to display only file name?

Try this:


rollout VrayRenderSetting "VrayRenderSetting" width:200 height:296
(
	local presetsArr = (Getfiles (GetDir #renderPresets + "\\*.rps") )
	local presetsNamesArr = for f in presetsArr collect (getFilenameFile f)
	listBox lbxRPS "RenderPresets" pos:[8,8] width:270 height:6 items:presetsNamesArr
	
	
	
	on lbxRPS selected sel do
	(	
	
	)
	on lbxRPS doubleClicked sel do
	(
		renderpresets.LoadAll 0 presetsArr[sel]
	)
)

theNewFloater = newRolloutFloater "ListboxRND" 300 220
addRollout VrayRenderSetting theNewFloater

It works
thank you very much!