Get List of NonOccluded/PartiallyOccluded objects in current viewport

27 views
Skip to first unread message

dgovil

unread,
Oct 15, 2013, 5:03:35 PM10/15/13
to python_in...@googlegroups.com

Hi guys,
I was hoping someone could point me in the right direction for this.

I’m trying to get a list of objects that are visible from the camera, so this includes objects that are within the viewport/cameraFrustrum that are either completely or partially visible. ie I want to remove objects that are completely hidden by other objects.

I thought the API would have some easy methods for this, but I seem to be failing at finding anything useful.
The closest I could find was:

import maya.OpenMaya as om
import maya.OpenMayaUI as omu
import maya.cmds as mc

view = omu.M3dView.active3dView()
om.MGlobal.selectFromScreen(0, 0, view.portWidth(), view.portHeight(), om.MGlobal.kReplaceList)

print "OM code: ",mc.ls(sl=1)

but that still returns a list of objects that are fully occluded.

Any ideas? It's much appreciated. Thanks

Reply all
Reply to author
Forward
0 new messages