Deselecting objects by specyfied modyfiers

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 11 November 2013   #1
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.
 
Old 11 November 2013   #2
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
   )
   

Last edited by Codi : 11 November 2013 at 02:57 PM.
 
Old 11 November 2013   #3
work:)

it work, another problem solved. Thankyou
 
Old 11 November 2013   #4
You can also check out modifierUtilities here:

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

Which does this and a lot of other similar operations.

- Neil
 
Old 11 November 2013   #5
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:56 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.