Hi all,
I am trying to filter some controllers from current selections.
Currently this is the code I had:
exclude_list = [
"main_global_ctrl",
"main_globalOffset_ctrl",
"main_path_ctrl",
"main_start_ctrl"
]
exclude_ctrls = []
all_ctrls = cmds.ls(selection=True, long=True)
for ctrl in all_ctrls:
# Remove any of the *:<exclude_ctrls> found
if ctrl.endswith(tuple(exclude_list)):
exclude_ctrls.append(ctrl)
# Remove the specified controllers
filtered_ctrls = [c for c in all_ctrls if c not in exclude_ctrls]
It would works if within my list of current selections, the naming is exactly the same as the ones I have in the `exclude_list`.
What is the best way that I can make the items in `exclude_list` to work as a wildcard, eg. if within my selection I had a `M_main_global_ctrl` (see that "M_" is not part of the list)?