kiteh
2018-10-05 21:57:31 UTC
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)?
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)?
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/382eb1c5-4350-4942-822d-5f17105528e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/382eb1c5-4350-4942-822d-5f17105528e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.