def channelbox_command_createFilterSet(box, menuItem, key, *args):
with sysCmd.Undo(0):
attrs = len(box.filter_attrs) >= 1
fset = []
if attrs: # checking if we're dealing with specific attributes or pre-defined items
for f in box.filter_attrs: # add the key values in filter_attrs to fset
fset.append(f)
fset.append("type=attr") # append the type to the end of the list, later becomes [-2]
else:
for f in box.filter_items:
fset.append(f)
fset.append("type=item")
if fset:
name_prompt = cmds.promptDialog(t="Save Filter Set", button=["Save", "Cancel"])
# ask user to enter the set name
else:
return
fset.append(
box.saved_states["invertShown"][0]) # append the invertShown state to become [-1] pushing fset to [-2]
if name_prompt == "Save":
name = cmds.promptDialog(q=1, tx=1)
confirm = 0
if name in box.saved_states["savedFilters"][0]: # check if exists, ask to confirm overwrite
confirm = cmds.confirmDialog(t="Confirm Overwrite", icn="warning",
message="Filter set \"" + name + "\" already exists. Overwrite?",
button=["Overwrite", "Cancel"])
if confirm and confirm == "Overwrite" or not confirm:
box.saved_states["savedFilters"][0][name] = fset
else:
return
sysCmd.channelbox_save_state(box)
jtChannelBox_Commands_Default.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录