Notifications
Clear all

[Closed] Custom new attributes?

Hi,

So is there a way to set some new attributes to a node? Eg. $.newAttribute = “owesome”

4 Replies

Adding Custom Attributes to nodes.

From the help files.

Yeah I know about that. But it does not worrk for me, I always get error:

-- Type error: custAttributes.add requires MSCustAttribDef, got: undefined
1 Reply
(@aaandres)
Joined: 10 months ago

Posts: 0

Perhaps you are not assigning your CA definition to a variable?
Try next code:


	the_weaponData = attributes weaponData
	(
		parameters main rollout:params
		(
			hitPoints type:#integer ui:spn_hits default:10
		)
		rollout params "Weapon Parameters"
		( 
			spinner spn_hits "hitPoints:" range:[0,100,10] type:#integer
		)
	)
	
	sp = sphere()
	custAttributes.add sp the_weaponData
	
	the_weaponData2 = attributes weaponData2
	(
		parameters main rollout:params
		(
			hitPoints2 type:#integer ui:spn_hits2 default:10
		)
		rollout params "Weapon Parameters 2"
		( 
			spinner spn_hits2 "hitPoints2:" range:[0,100,10] type:#integer
		)
	)
	
	custAttributes.add sp the_weaponData2

well you asked if there is a way to add new attributes and not that the way it exists is not working for you.
If you post a test script we can fix it for you, but what aaandres showed will work.