Notifications
Clear all

[Closed] CenterPivot in a plugin

For a game I am making I am adding some custom objects to 3dsmax, which are then handled by my exporter. For one of these, I want to center the pivot each time a spinner is changed. The problem is: centerPivot wants a node, how do I get the node of the current object? Using “this” or “delegate” does not work, nor does “(getNodeByName this.name)”, because apparently “this” does not have a “name”. So how do I get the node? This is the code I am talking about (stripped away everything that is not necessary for this question):


plugin Helper CRBoost
	name:"CRBoost"
	classID:#(0x40a5c7ce, 0x24ead9bf)
	category:"CableRacer"
	extends:BoxGizmo
	replaceUI:true
(
	parameters main rollout:params
	(
		heightCustom type:#float ui:heightSpinner default:3
	)
 
	rollout params "Boost Parameters"
	(
		spinner heightSpinner "Height" range:[-10000000, 10000000, 3]
 
		on heightSpinner changed val do
		(
			[b]centerPivot this[/b]
		)
	)
)

2 Replies

Since those spinner controls will only be available when that single object is selected, it’s safe to do it this way:

centerPivot selection[1]

or

centerPivot $

Hmm, strange, I thought I had tried that one and it did not work, but I try it now and now it works. No idea what I did wrong when I tried it previously. Well, it works now, so thanks!