Skip to content

Instantly share code, notes, and snippets.

@justinmeiners
Last active September 15, 2018 05:58
Show Gist options
  • Save justinmeiners/4326dc253a56115c22d6c31521610f80 to your computer and use it in GitHub Desktop.
Save justinmeiners/4326dc253a56115c22d6c31521610f80 to your computer and use it in GitHub Desktop.
# Created By: Justin Meiners (2012)
# This was really useful at one point. I doubt it still is.
from pymel.all import *
import pymel
selection_list = pymel.core.ls(type="transform", selection=True)
for node in selection_list:
node.centerPivots()
point = node.getRotatePivot(space="world")
point_inverse = [-point[0], -point[1], -point[2]]
node.translateBy(point_inverse, space="world")
pymel.core.makeIdentity(node, apply=True, translate=True)
node.setTranslation(point, space="world")
node.zeroTransformPivots()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment