简体   繁体   English

在列表中单独选择所有项目

[英]Selecting all items individually in a list

I was wondering if it is possible to re-select each and every item in the rsList? 我想知道是否可以重新选择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 我在下面引用了一个简单的示例,但是我正在查看场景中的数百个项目,因此以下是我能够基于我有限的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. 我尝试使用以下cmds.select但它考虑了我的最后一个选择(在内存中) pSphere1_GenShdr同时忘记了其他两个,即使在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? 这样,我是否可以对每个项目分别执行cmds.select

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. 我认为对于我来说,这是一种特殊情况,在我可以复制之前,我需要为首次创建着色器添加mm.eval("autoUpdateAttrEd;")

Apparently I need this command in order to get it to work 显然我需要此命令才能使其正常工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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