Select Objects within Camera Frustum

1,964 views
Skip to first unread message

Jeremy YeoKhoo

unread,
Jul 16, 2012, 12:35:05 AM7/16/12
to python_in...@googlegroups.com
Hi guys,

I am trying to write a simple tool that selects the objects within the cameras frustum. I am pretty sure the tool can be written as a one off python command. But my lack of experience with the maya API is taking me a while to create one.

Would anyone have any experience is creating/building one?

-Jeremy

Jeremy YeoKhoo

unread,
Jul 22, 2012, 9:14:19 PM7/22/12
to python_in...@googlegroups.com
Hi Sudeepth,

Thanks for that, but thats not exactly what I am looking for. Ill need to be able to use this sccript via a batch command.


There is a C++ version of this that will allow the DAG nodes that get selected which I am going to try to convert to python
http://www.danekbarney.com/sample_work.pl?view_frustum_culling




On Monday, 16 July 2012 15:21:51 UTC+10, Sudeepth Patinjarayil wrote:

Dear Jeremy,

I hope this code may help you.

import maya.OpenMaya as om
import maya.OpenMayaUI as mui

activeView = mui.M3dView.active3dView()

om.MGlobal.selectFromScreen(0,0,activeView.portWidth(),activeView.portHeight(),om.MGlobal.kReplaceList)

it selects all the objects in the active view.

Thank and Regards,
Sudeepth Patinjarayil.

ammu0608

unread,
Jul 16, 2012, 1:21:51 AM7/16/12
to python_in...@googlegroups.com

Dear Jeremy,

I hope this code may help you.

import maya.OpenMaya as om
import maya.OpenMayaUI as mui

activeView = mui.M3dView.active3dView()

om.MGlobal.selectFromScreen(0,0,activeView.portWidth(),activeView.portHeight(),om.MGlobal.kReplaceList)

it selects all the objects in the active view.

Thank and Regards,
Sudeepth Patinjarayil.

On Jul 16, 2012 10:05 AM, "Jeremy YeoKhoo" <jyeo...@gmail.com> wrote:
--

sundev...@gmail.com

unread,
Jan 28, 2016, 1:10:26 PM1/28/16
to Python Programming for Autodesk Maya, ammu...@gmail.com
On Sunday, July 15, 2012 at 10:21:51 PM UTC-7, ammu0608 wrote:
> Dear Jeremy,
>
> I hope this code may help you.
>
>
> import maya.OpenMaya as om
>
> import maya.OpenMayaUI as mui
>
> activeView = mui.M3dView.active3dView()
>
> om.MGlobal.selectFromScreen(0,0,activeView.portWidth(),activeView.portHeight(),om.MGlobal.kReplaceList)
>
>
> it selects all the objects in the active view.
>
>
> Thank and Regards,
>
> Sudeepth Patinjarayil.
>
> On Jul 16, 2012 10:05 AM, "Jeremy YeoKhoo" <jyeo...@gmail.com> wrote:

That actually helps me very much. Thank you Sudeepth!

Reply all
Reply to author
Forward
0 new messages