[MaxScript] Possible bug - can't access parameters in CA in a callback


#1

Hi,
I believe this might be a bug introduced in 3dsmax 2020 or 2021. The code below works in version 2019:

customFlags = attributes custFlags attribID:#(0x281c9c82, 0x33ddf1b5)
(
	parameters params rollout:controls
	(
		value type:#integer default:123
	)
	
	rollout controls "Flags"
	(		
		button reset "Reset" 
		
		fn Update = 
		(
			print value
		)

		on reset pressed do
		(
			Update()
		)
		
		on controls open do 
		(
			Update()
			RegisterTimeCallback Update
		)
		
		on controls close do
		(
			UnregisterTimeCallback Update
		)
	)
)

cube = Box()
custAttributes.add cube customFlags

What it’s doing doesn’t make much sense, of course. But the problem is that the Time Change callback will fail in Max 2021, whereas it works in 2019 and earlier versions. (I didn’t have a chance to test it in 2020).

See the screengrab for details:

image

Does anyone have experienced this? Is there a workaround?

And if this is a bug indeed, how do I report it to Autodesk, so they can actually consider this for a fix?
Thanks.


#2

this should work

customFlags = attributes custFlags attribID:#(0x281c9c82, 0x33ddf1b5)
(	

	parameters params rollout:controls
	(
		value type:#integer default:123
	)
	
	fn Update = (print value)
	
	rollout controls "Flags"
	(		
		button reset "Reset" 
		
		

		on reset pressed do
		(
			Update()
		)
		
		on controls open do 
		(
			Update()
			RegisterTimeCallback Update
		)
		
		on controls close do
		(
			UnregisterTimeCallback Update
		)
	)
)

cube = Box()
custAttributes.add cube customFlags

#3

Hi,
Thanks very much - it works indeed!

In my real scenario, I actually had to update some controls from the rollout, based on the parameter, but I was able to access the rollout through this.controls, so that’s fine.

Still, I’m hearing from folks around, that a lot of stuff in MaxScript had broken in the latest version. Glad to know there’s a workaround for my case.

Thanks again.


#4

dunno, never had big problems so far.
i always defined the functions outside the rollouts for CAs

you can also get set the parameter using cube.value