Select all by type: Geometry. Equivalent Python script? -
i trying find right code make maya select geometry objects in scene. tried echo command while doing operation , this:
selectallgeometry; select -r `listtransforms -geometry`;
(edit > select type > geometry)
could translate python?
what you're seeing procedure selectallgeometry
, , contents:
select -r `listtransforms -geometry`;
that command several parts. part in backquotes:
listtransforms -geometry
is mel procedure. run command help listtransforms
see path .mel file. reading that, command actually
listrelatives("-p", "-path", eval("ls", $flags));
the output of argument to:
select -r the_list_of_geometry_transforms
so check out maya's mel , python command reference select
, listrelatives
, , ls
, research how 1 command translates other:
combining together, equivalent mel being called is:
select -r `listrelatives("-p", "-path", eval("ls", $flags))`
and python, be:
from maya import cmds cmds.select(cmds.listrelatives(cmds.ls(geometry=true), p=true, path=true), r=true)
expanded out tad more readable:
from maya import cmds geometry = cmds.ls(geometry=true) transforms = cmds.listrelatives(geometry, p=true, path=true) cmds.select(transforms, r=true)
Comments
Post a Comment