Notifications
Clear all

[Closed] access layer property inside an attribute

I’m trying to access a layer property from a custom attributes using a local variable.


BtnProps = attributes controls
 --redefine:ca
 (
	local LayerBags=LayerManager.GetLayerFromName "Layer001"
	 
	 parameters main rollout:cbt
	(
		BagsBtn type:#Boolean ui:(bags)
	 )
	 
 	rollout cbt "Checki"
 	(
		
 			button bags "bags"  
			on bags pressed do
			(				
				print  LayerBags.on
			)
   
 	)
 )

When I evaluate this code I get my button + the printed state when I pressed the button but when I re-open the scene after closing max I get a:
– Unknown property: “on” in undefined <<

ok… so I guessing my variable LayerBags isnt stored… so I added the local var… still not working. I tried defining the variable as a global in the scene but I get a – Runtime error: Attempt to access deleted <MixinInterface> later on

What is exactly the problem… is it how I called in the local variable, how I’m trying to access the layermanager inside a custom attributes or both of them?

1 Reply

nvm got it working

declaring the local var inside the button/chckbox/checker changed state did it


            checkbox bags "bags"  
			on bags changed state do
			(				
			test=layermanager.getLayerFromName "Layer001"
			test.ishidden=state
			)