Created
September 20, 2023 21:24
-
-
Save defTechAndrew/5fbf867f57b6ffbf15f257261cea2494 to your computer and use it in GitHub Desktop.
PyMel makes your code pretty and slow.
This file contains 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 timeit | |
pymel_setup = ''' | |
import pymel.core as pm | |
def create_sphere(): | |
s = pm.polySphere()[0] | |
for vertex in s.vtx: | |
vertex.setPosition((10, 10, 10)) | |
pm.delete(s)''' | |
cmds_setup = ''' | |
import maya.cmds as cmds | |
def create_sphere(): | |
s = cmds.polySphere()[0] | |
for vert_index in range(cmds.polyEvaluate(s, vertex=True)): | |
cmds.xform('{0}.vtx[{1}]'.format(s, vert_index), translation=(10,10,10)) | |
cmds.delete(s)''' | |
print('PyMel', timeit.timeit('create_sphere()', setup=pymel_setup, number=10)) | |
print('Maya Cmds', timeit.timeit('create_sphere()', setup=cmds_setup, number=10)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment