Skip to content

Commit

Permalink
dagmenu: fix error when noting is selected #357
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcampos committed Dec 15, 2023
1 parent a2c63f3 commit 0408e73
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions release/scripts/mgear/core/dagmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ def __space_transfer_callback(*args):
print(search_token)
target_control = None


# control_01 attr don't standard name ane need to be check
attr_split_name = switch_attr.split("_")
if len(attr_split_name) <= 2:
Expand Down Expand Up @@ -538,7 +537,7 @@ def __space_transfer_callback(*args):
switch_control,
stripNamespace(switch_control),
switch_attr,
target_control_list[0]
target_control_list[0],
)

if autokey:
Expand All @@ -549,6 +548,7 @@ def __space_transfer_callback(*args):
time=(cmds.currentTime(query=True)),
)


def __switch_xray_ctl_callback(*args):
rig_root = None
if pm.selected():
Expand Down Expand Up @@ -632,12 +632,13 @@ def mgear_dagmenu_callback(*args, **kwargs): # @UnusedVariable

# if second argument if not a bool then means that we are running
# the override
if type(args[1]) != bool:
if not isinstance(args[1], bool):
sel = cmds.ls(selection=True, long=True, type="transform")

isCtl = cmds.objExists("{}.isCtl".format(sel[0]))
isGuide = cmds.objExists("{}.rig_name".format(sel[0]))
isGearGuide = cmds.objExists("{}.isGearGuide".format(sel[0]))
if sel:
isCtl = cmds.objExists("{}.isCtl".format(sel[0]))
isGuide = cmds.objExists("{}.rig_name".format(sel[0]))
isGearGuide = cmds.objExists("{}.isGearGuide".format(sel[0]))

if sel and isCtl:
# cleans menu
Expand Down Expand Up @@ -843,11 +844,11 @@ def mgear_dagmenu_fill(parent_menu, current_control):
)

resetOption = cmds.menuItem(
parent=parent_menu,
subMenu=True,
tearOff=False,
label="Reset Option",
)
parent=parent_menu,
subMenu=True,
tearOff=False,
label="Reset Option",
)

# reset all
selection_set = cmds.ls(
Expand Down Expand Up @@ -1000,7 +1001,9 @@ def mgear_dagmenu_fill(parent_menu, current_control):
cmds.menuItem(
parent=_p_switch_menu,
label="++ Space Transfer ++",
command=partial(__space_transfer_callback, ui_host, attr, combo_box)
command=partial(
__space_transfer_callback, ui_host, attr, combo_box
),
)

# select all rig controls
Expand Down

0 comments on commit 0408e73

Please sign in to comment.