PDA

View Full Version : list objects in viewport


FraserRobertson
10-11-2010, 04:45 AM
is it possible to list objects in viewport through a camera with MEL?

Thanks

Robert Bateman
10-11-2010, 06:07 PM
Whilst not an answer to your actual question, you can do this trivially in the API via these two lines:


M3dView view = M3dView::active3dView();
MGlobal::selectFromScreen( 0, 0, view.portWidth(), view.portHeight(), MGlobal::kReplaceList );

Not much help to you though (unless some kind forum user re-writes it in python for you....)

NaughtyNathan
10-11-2010, 09:56 PM
which would look something like this (Rob's C++ code converted into python):

import maya.OpenMaya as om
import maya.OpenMayaUI as omUI
view = omUI.M3dView.active3dView()
om.MGlobal.selectFromScreen( 0, 0, view.portWidth(), view.portHeight(), om.MGlobal.kReplaceList)
actually very similar for something this simple. you could call this from MEL using the python command if necessary.
:nathaN

FraserRobertson
10-11-2010, 10:57 PM
Thanks guys! just what i needed, I am a python man anyway.

Where is the best place to get info on the API moduls for python? like the one's you listed?

Would be a great help for future reference.

Thanks Guys!

NaughtyNathan
10-12-2010, 10:05 AM
well all the API documentation is in Maya's help:

Maya > Help (F1) > Developer Resources > API Guide

and:

Maya > Help (F1) > Technical Documentation > API Reference

for the classes. Maya also ships with a load of python scripted plugins for working example code which you can find here:

C:\Program Files\Autodesk\Maya20XX\devkit\plug-ins\scripted\

(or wherever equivalent path you installed Maya to on your OS)
:nathaN

CGTalk Moderation
10-12-2010, 10:05 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.