ScriptSpot

Forum topic · General Scripting

Attribute Holder controlling hide unhide commands!

By AtillaMentes · 2015-08-11

Description

hi,
I'm really in trouble about this rig I'm building. I need to make an on off button that hides and shows specific objects within an attribute holder of another object. I searched for 3 hours and couldn't come up with something.

it can be a name tag that can differ them from other objects. Like $hhh*

the closest I achieved was this and it didn't work.


ca=attributes EXPRESSIONCTRL
(

	parameters EXPRESSIONParameter rollout:EXPRESSIONrollout
	(
	)
	rollout EXPRESSIONrollout "Expressions I/O"
	(
	button btn_I "On" align: #left across:3
	button btn_O "OFF" align: #right across:3
	)
	
	on btn_I pressed do
	(
		global unhide $hhh*
	)
	
	on btn_O pressed do
	(
		global hide $hhh*
	)


)
custAttributes.add $.modifiers[1] ca

I'm on my babysteps however I need this to be done due to the deadline

I would appriciate if anyone could help.

Thanks.

Comments (3)

`

pixamoon · 2015-08-11

i found 2 things:

1. ")" in wrong place - handles "on btn_I pressed ...." should be also in rollout (....)
2. why

global  unhide $hhh*

? try just

unhide $hhh*

so it can look like this:


ca=attributes EXPRESSIONCTRL
(
 
	parameters EXPRESSIONParameter rollout:EXPRESSIONrollout
	(
	)
	rollout EXPRESSIONrollout "Expressions I/O"
	(
		button btn_I "On" align: #left across:3
		button btn_O "OFF" align: #right across:3
		
	 
		on btn_I pressed do
		(
			unhide $hhh*
		)
	 
		on btn_O pressed do
		(
			hide $hhh*
		)
	 
	)
)

--this will remove all other custom parameters
--for i = custAttributes.count $.modifiers[1] to 1 by -1 do custAttributes.delete $.modifiers[1] i
	
custAttributes.add $.modifiers[1] ca

hope it helps

AtillaMentes · 2015-08-11

Much thanks!
thanks for your definitive, detailed and helpful answer works like a charm.

`

pixamoon · 2015-08-12

no problem, glad it helped :)