Last active
September 10, 2025 15:36
-
-
Save nrtkbb/d701d703ea3f1742107a7cf1cc008f53 to your computer and use it in GitHub Desktop.
MItSelectionList vs Only MSelectionList
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
today = datetime.datetime.today | |
from maya.api import OpenMaya as om2 | |
from maya import cmds | |
start = today() | |
sel_list = om2.MSelectionList() | |
[sel_list.add(m) | |
for m in cmds.ls(dag=True)] | |
sel_it = om2.MItSelectionList(sel_list) | |
dags = [] | |
i = 0 | |
while not sel_it.isDone(): | |
dag_path = sel_it.getDagPath() | |
dags.append(dag_path) | |
sel_it.next() | |
i += 1 | |
#print(dags) | |
print(today() - start) # 0:00:00.691000 | |
print(i) # 8721 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
today = datetime.datetime.today | |
from maya.api import OpenMaya as om2 | |
from maya import cmds | |
start = today() | |
sel_list = om2.MSelectionList() | |
dags = [] | |
i = 0 | |
for mesh in cmds.ls(dag=True): | |
sel_list.clear() | |
sel_list.add(mesh) | |
dag_path = sel_list.getDagPath(0) | |
dags.append(dag_path) | |
i += 1 | |
#print(dags) | |
print(today() - start) # 0:00:00.097000 | |
print(i) # 8721 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Sorry maybe for dumb question... but why wouldn't we just iterate over
MSelectionList.getDagPath(i)
?