def channelbox_command_selectFilterSet(box, menuItem, key, *args):
with sysCmd.Undo(0):
state = cmds.menuItem(menuItem, q=1, isOptionBox=1)
f_set_name = cmds.menuItem(menuItem, q=1, label=1)
if not state: # didn't press the option box
channelbox_command_resetFilters(box) # resetting filters before applying a new one cleans everything up
if f_set_name in box.saved_states["savedFilters"][0]:
saved = box.saved_states["savedFilters"][0][f_set_name][
:-2] # [-1] is invertShown boolean and -2 is the type string, exclude from loop
box.saved_states["invertShown"][0] = box.saved_states["savedFilters"][0][f_set_name][
-1] # restoring invert state saved with the filter
# Specific Attribute Filters
if box.saved_states["savedFilters"][0][f_set_name][-2] == "type=attr":
# dict in ["savedFilters"] contains only enabled attributes, so set to 1 always
box.filter_attrs = {k: 1 for k in saved}
channelBox_filterAttrs(box) # attributes restored to box.filter_attrs, now apply the filter
# Pre-defined Filters
else:
for f in saved:
box.filter_items.append(f)
box.saved_states[f][0] = 1 # set each of the checkbox attributes to 1 to update UI
channelBox_Filter_Items(box)
else:
cmds.error(
"Filter set doesn't exist, potential mismatch between data file and current menu state."
" Was something deleted from the drive?")
else:
del_conf = cmds.confirmDialog(t="Delete?", icn="warning", message="Delete filter set \"" + f_set_name +
"\"?", button=["Delete", "Cancel"])
if del_conf == "Delete":
box.saved_states["savedFilters"][0].pop(f_set_name, None)
jtChannelBox_Commands_Default.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录