Created
May 12, 2020 12:52
-
-
Save yamahigashi/afbaaeedf4cf2a111e2627b72a41a002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import cmds | |
def __swap_selection_for_ikrot_job(): | |
sel = cmds.ls(sl=True) or [] | |
for i, s in enumerate(sel): | |
ctx = cmds.currentCtx() | |
new = None | |
if "move" in ctx.lower() and s.endswith("_ikRot_ctl"): | |
new = s.replace("_ikRot_ctl", "_ik_ctl") | |
if "rotate" in ctx.lower() and s.endswith("_ik_ctl"): | |
new = s.replace("_ik_ctl", "_ikRot_ctl") | |
if new and cmds.ls(new): | |
sel[i] = new | |
cmds.select(sel) | |
_ = cmds.scriptJob(event=("ToolChanged", __swap_selection_for_ikrot_job)) | |
_ = cmds.scriptJob(event=("SelectionChanged", __swap_selection_for_ikrot_job)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment