Created
May 19, 2014 13:28
-
-
Save sopvop/fc37397dca26ba1e1f29 to your computer and use it in GitHub Desktop.
traverse visible
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
from smmaya.core.api import as_api_dagpath | |
import maya.OpenMaya as om | |
import maya.OpenMayaUI as omu | |
def get_visible(camera, width=800, height=600): | |
if not isinstance(camera, om.MDagPath): | |
camera = as_api_dagpath(camera) | |
trav = omu.MDrawTraversal() | |
trav.setFrustum(camera, width, height) | |
trav.traverse() | |
nitems = trav.numberOfItems() | |
result = [] | |
dagpath = om.MDagPath() | |
for i in xrange(nitems): | |
trav.itemPath(i, dagpath) | |
result.append(dagpath.fullPathName()) | |
return result | |
get_visible('perspShape') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment