ScriptSpot

Forum topic · Scripts Wanted

Wirecolor Switcher

By Dragan_ilic · 2020-04-25

Description

Hey everyone, it would be cool if a script could save the current wirecolor of the objects and by the state of an checkbutton, it would change the wirecolor of all objects that have the objID=1 to "red", obj=2 to "yellow" and obj=0 to "black".
if you now release the checkbutton the original wirecolor of the objects will come back.

Comments (2)

.

miauu · 2020-04-29

Something like this?


(
	global rol_wirecolorByID
	try(destroyDialog rol_wirecolorByID)catch()
	rollout rol_wirecolorByID "miauu Change Wirecolor"
	(
		local objsWCArr = #()
		checkButton chkBtn_go "Change Wirecolor" width:140
		
		on chkBtn_go changed state do
		(
			if state then
			(
				for o in objects do
				(
					append objsWCArr #(o, o.wirecolor)
					objID = o.gbufferChannel
					case objID of
					(
						0: o.wirecolor = black
						1: o.wirecolor = red
						2: o.wirecolor = yellow						
					)
				)
			)
			else
			(
				for arr in objsWCArr do
				(
					arr[1].wirecolor = arr[2]
				)
			)
			redrawViews()
		)
	)
	createdialog rol_wirecolorByID 

)

Dragan_ilic · 2020-04-29

Thank you miauu, you are the best :D