简体   繁体   中英

Selecting all items individually in a list

I was wondering if it is possible to re-select each and every item in the rsList? I am citing a simple example below but I am looking at hundreds of items in the scene and hence below are the simplest form of coding I am able to come up with base on my limited knowledge of Python

rsList = cmds.ls(type='resShdrSrf')
# Output: [u'pCube1_GenShdr', u'pPlane1_GenShdr', u'pSphere1_GenShdr']

I tried using the following cmds.select but it is taking my last selection (in memory) - pSphere1_GenShdr into account while forgetting the other 2 even though all three items are seen selected in the UI.

Tried using a list and append, but it also does not seems to be working and the selection remains the same...

list = []
for item in rsList:
    list.append(item)
    cmds.select(items)
    #cmds.select(list)

As such, will it be possible for me to perform a cmds.select on each of the item individually?

if your trying to just select each item:

import pymel.core as pm
for i in pm.ls(sl=True):
    i.select()

but this should have no effect in your rendering

I think for mine, it is a special case in which I would need to add in mm.eval("autoUpdateAttrEd;") for the first creation of my shader before I can duplicate.

Apparently I need this command in order to get it to work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM