Reputation: 12175
Is there a way to center the pivot of an object without the use of xform
?
I really would like to try and find a pyMel version of this, or the maya api, as xform is generally 10x slower than a pymel or api solution.
Obviously you can achieve it with xform like so:
xform(obj, cp=1)
But I'm trying to find another way, does anyone know anything?
Upvotes: 0
Views: 7945
Reputation: 492
Would you like to find a PyMEL version? Or an object oriented way of doing this? xform(obj, cp=1)
is within PyMEL. However the object oriented method to produce the same result is quite similar to theodox's response in which you would do the following:
obj.setScalePivot(obj.c.get())
obj.setRotatePivot(obj.c.get())
Centering an objects pivot is based on the center of the bounding box. obj.c.get
will return to you just that. Just plug that into the methods above.
Upvotes: 1
Reputation: 12208
In the API it would be calling mfnTransform.setRotatePivotTranslation and setScalePivotTranslation with 'balance' turned on. There's not enough overhead to warrant a workaround - it's hard to see how this could be a bottleneck.
Upvotes: 1