PDA

View Full Version : CenterPivot in a plugin


Oogst
02-04-2006, 12:31 PM
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
(
centerPivot this
)
)
)

vScourge
02-04-2006, 01:01 PM
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 $

Oogst
02-04-2006, 02:18 PM
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! :)

CGTalk Moderation
02-04-2006, 02:18 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.