ScriptSpot

Forum topic · Scripts Wanted

Macro for changing display of multiple vray proxies

By alexbls · 2017-01-23

Description

Hi guys,

Does anybody knows if there is a macro to change display options of multiple Vray Proxy, I am loosing time when I have to change my display options. Sometimes I have a lot of different Proxies and it takes time as I said. If you know a macro that already exist or can somebody make it? It would be very appreciated.

Thank you,
Have a nice day.
Alessandro

Comments (4)

I mean...

alexbls · 2017-01-31

Hi Fajar,

in my scene i have a different proxies, not istances. when I click show as preview or bounding box it changes all of them. when I select the proxies i want to change it still changes all of them, even if I click only on selected.

thanks again.

fajar · 2017-01-27

what do you mean by that ? are those proxy instanced or not ? if its instanced then theres should be no abnormal behavior ? could you give me sample scene or video/gif ?

or try to add this line


local allArray = #()
freeTheArr allArray -- add this line
		--case objs of 

-- on "setDisplayVrayObject" function

Thanks for trying my code

fajar · 2017-01-26

Hope this help

http://www.daveandgoliath.com/v-ray-proxy-tools/

or you could try mine


macroScript MineTools
category:"Vray Tools"
tooltip:"Proxy Display Tools"
buttontext:"Proxy Display Tools"
silentErrors:True

(
	local theArr =  #()
	local kindOf = isKindOf , find = findItem, jn = join , fr = free
	local closeDialog  = DestroyDialog, openDialog = CreateDialog
	local getInst = InstanceMgr.GetInstances , getClassInst = getClassInstances
	local DispSet = 1 
	
	mapped fn setVrayProxyMode obj &arr disMod:0 selOnly:true = 
		(
			if selOnly then  
			(
				if (kindOf obj VRayProxy and (find arr obj  == 0)) do 
				(
					getInst obj &inst 
					jn arr inst
					obj.display = disMod 
				)
			)
			else
			(
				obj.display = disMod 
			)
 		)

	fn freeTheArr arr = 
	(
		if arr.count!=0 do (fr arr)
	)		
		
	fn setDisplayVrayObject objs:#selection disMod:0  =
	(
		local allArray = #()
		case objs of 
		(
			#selection : (
							allArray = selection as Array
							if allArray.count!=0 do  
								(
									with undo off with redraw off
									(
									setVrayProxyMode allArray &theArr disMod:disMod 
									fr allArray
									)
								)
							freeTheArr theArr
						 ) 
						 
			#all    : (
							allArray = getClassInst VRayProxy processAllAnimatables:true processChildren:true
							if allArray.count!=0 do  
								(
									with undo off with redraw off
									(
									setVrayProxyMode allArray &theArr disMod:disMod selOnly:false
									fr allArray
									)
								)
							freeTheArr theArr
						 )
		)
	)

	fn ShowChoiceDialog = 
	(
		try (closeDialog prxDisplay) catch()
		
		rollout prxDisplay "V-Ray ProxyDisplay" width:176 height:118
		(
			local theLabels = #("Bounding Box", "Preview From File", "Point","Preview from File {Faces}", "Show Whole Mesh")
			radioButtons rdo1 "RadioButtons" pos:[18,18] width:146 height:94 labels:theLabels default:5 columns:1
			groupBox grp1 "V-Proxy Display" pos:[2,3] width:171 height:111
			
			on rdo1 changed stat do
			(
				DispSet = stat-1
				if selection.count!= 0 then 
				(
					setDisplayVrayObject objs:#selection disMod:DispSet
				)
				else 
				(
					setDisplayVrayObject objs:#all disMod:DispSet
				)
				format "Vray proxy displayed as = {%} : %\n" DispSet (theLabels[stat])
			)
		)
		openDialog prxDisplay style:#(#style_sysmenu,#style_toolwindow)
	)

	on execute do  
	(
		clearListener()
		ShowChoiceDialog()
	)
)

copy all those code in the notepad , save it to "your file name.mcr" and place it on "3ds max install dir\MacroScripts" ex : "C:\Program Files\Autodesk\3ds Max 2014\MacroScripts" if you use max lower than that you ask me to put it where.

Script

alexbls · 2017-01-27

Hi Fajar,

thank you so much for your respond, and thanks for the script!
it works well, but just one thing doesn't work, when I click only selected proxies it's still changing all the proxies.
do you have any suggestions?
Thank you

Regard