Ahah!  Thanks Chad!

On Oct 5, 2:38 pm, Chad Vernon <[email protected]> wrote:
> You'll get an exception if the filter doesn't turn up anything.  Since
> they're aren't any smooth nodes in the scene, the MItDependencyGraph
> constructor throws an exception.  It'll only work if there are actual nodes
> that match your filter.
>
> Chad
>
> On Tue, Oct 5, 2010 at 2:31 PM, JP <[email protected]> wrote:
> > Hey all,
>
> > I'm pretty new to working with the API, and I'm having some trouble
> > getting an MItDependencyGraph node.   I keep getting the good old
> > "(kFailure): Unexpected Internal Failure", and I've been scratching my
> > head for quite a while over it.  Was hoping someone here can publicly
> > point and laugh at whatever I'm doing wrong here.
>
> > This is going to be part of a function that traverses upstream from
> > all meshes under nodes passed to the function and looks for polySmooth
> > nodes
>
> > WARNING - this will create a new empty scene!
>
> > Thanks in advance for the help!!
>
> > import maya.OpenMaya as OM
> > import maya.cmds as MC
>
> > MC.file(new=True, force=True)
> > group = MC.group(em=True, name= "grp")
> > for i in range(3):
> >    sphere = MC.polySphere(name='sphere%i' % i)
> >    MC.parent(sphere, group)
>
> > #get an MItSelectionList object with all meshes parented under "grp"
> > funcArgs = ["grp"]
> > MC.select(MC.listRelatives(funcArgs, pa=1, ad=1, type='mesh'))
> > sel = OM.MSelectionList()
> > OM.MGlobal.getActiveSelectionList(sel)
> > selIt = OM.MItSelectionList(sel, OM.MFn.kMesh)
>
> > #would normally start itering here, but for testing just grab the
> > first item in the selection list
> > meshNode = OM.MObject()
> > selIt.getDependNode(meshNode)
>
> > typeFilter = OM.MFn.kPolySmooth
> > direction = OM.MItDependencyGraph.kUpstream
>
> > dgIt = OM.MItDependencyGraph (meshNode, typeFilter, direction)
>
> > --
> >http://groups.google.com/group/python_inside_maya
>
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to