Custom Attributes

Hi

I have added custom attributes to an attribute holder using the Parameter Editer. It works well but I want to add extra rollouts and rename them. At the moment I can only have one called 'Custom Attributes'. It looks like the only way to do this is to script it. I have had a look at the help, but couldn't get anything to work. Can anyone please help?

Thanks!

Gram

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gramx's picture

Thanks

I gave that a test and it works great. :)

I dont know why it's so difficult when looking at the max help.

Thanks again

Gram

Hani Tiby's picture

That's true :)

That's true :)

br0t's picture

You can add and redefine

You can add and redefine custom attributes via script. Adding could work like this:

ca=attributes camControls
(
	parameters params rollout:ro_camControls
	(
		pLens type:#float ui:spn_lens
		pFOV type:#float ui:spn_FOV
	)
	rollout ro_camControls "Camera Controls" width:162 height:77
	(
		spinner spn_lens "Lens:" pos:[28,8] width:69 height:16 range:[0,100,45]
		spinner spn_FOV "FOV:" pos:[28,31] width:69 height:16 range:[0,100,45]
 
		on spn_lens changed theValue do
		(
			--do stuff
		)
	)
)--end attributes
 
custAttributes.add $.modifiers[1] ca

It is defining a custom attribute set called "camControls" and adding it to the first modifier of the selected object, which should be an empty attribute holder. If you now want to change something in the code you can simply change some lines at the start and delete the last line:

ca=custAttributes.getDef $.modifiers[1].camControls
attributes camControls
redefine:ca
(
	parameters params rollout:ro_camControls
	(
		pLens type:#float ui:spn_lens
		pFOV type:#float ui:spn_FOV
	)
	rollout ro_camControls "Camera Controls" width:162 height:77
	(
		spinner spn_lens "Lens:" pos:[28,8] width:69 height:16 range:[0,100,45]
		spinner spn_FOV "FOV:" pos:[28,31] width:69 height:16 range:[0,100,45]
 
		on spn_lens changed theValue do
		(
			--do stuff
		)
	)
)--end attributes

It is important to know the name of your custom attribute set. If you are not sure or you forgot it, you can see its name in the track view/curve editor when you expand the attribute holder modifier. In your case the line would be ca=custAttributes.getDef $.modifiers[1].Custom_Attributes
etc.

Cheers

Never get low & slow & out of ideas

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.