Notifications
Clear all

[Closed] Deselecting objects by specyfied modyfiers

I have huge problem because I get so far but I stuck in this:
how to deselect objects in selection which contain specyfied modyfiers.
For instance:
check if there is objects in my selection with turbosmooth modyfiers, if yes then deselect this object from my selection if no then do nothing

I have such a script:

for o in selection do
for m in o.modifiers where classof m == meshsmooth do
(
deselect o
)

but it works only for one object, I need it to unselect all object with specyfied modyfier(s).
I would be v. gratefulfor any help.

3 Replies

You have a couple problems in your code.
The first one is that you are looping a list that gets changed during the loop and this causes the script to do funny things. So, instead of looping “selection”, you better off first storing the selected objects in an array and then loop this array.
The second one is that you are looking for the wrong modifier type, “meshsmooth” is for the MeshSmooth modifier, you should be looking for “TurboSmooth”.


   s = for o in selection collect o
   for o in s do (
   	for m in o.modifiers where classof m == TurboSmooth do deselect o
   )
   

it work, another problem solved. Thankyou

You can also check out modifierUtilities here:

http://www.neilblevins.com/cg_tools/soulburnscripts/soulburnscripts.htm

Which does this and a lot of other similar operations.

  • Neil