Skip to content

Commit

Permalink
parent place holder to selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Zaccaria authored and ClementHector committed Feb 8, 2022
1 parent bd6bc62 commit 86588b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openpype/hosts/maya/api/lib_template_builder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import maya.cmds as cmds
from avalon.maya.lib import imprint
from avalon.vendor import qargparse
from avalon.tools.widgets import OptionDialog
from openpype.tools.utils.widgets import OptionDialog
from avalon.maya.pipeline import get_main_window


Expand Down Expand Up @@ -100,9 +100,14 @@ def create_placeholder():
# custom arg parse to force empty data query
# and still imprint them on placeholder
# and getting items when arg is of type Enumerator
# get maya selection
selection = cmds.ls(selection=True)
options = {str(arg): arg._data.get("items") or arg.read()
for arg in args if not type(arg) == qargparse.Separator}
placeholder = cmds.spaceLocator(name="_TEMPLATE_PLACEHOLDER_")[0]
# if something is selected parent the placeholder to the first selection
if selection:
cmds.parent(placeholder, selection[0])
imprint(placeholder, options)

# Some tweaks because imprint force enums to to default value so we get
Expand Down

0 comments on commit 86588b7

Please sign in to comment.