You can also use MFnComponent.

selection = OpenMaya.MSelectionList()
softSelection = OpenMaya.MRichSelection()
OpenMaya.MGlobal.getRichSelection(softSelection)
softSelection.getSelection(selection)
pathDag = OpenMaya.MDagPath()
oComp = OpenMaya.MObject()
selection.getDagPath(0, pathDag, oComp)
fnComp = OpenMaya.MFnSingleIndexedComponent(oComp)
for i in range(fnComp.elementCount()):
    print fnComp.element(i), fnComp.weight(i).influence()


On Wed, Nov 18, 2009 at 12:11 PM, Brandon Harris <[email protected]>wrote:

> Bleh. Once again posted a little too soon. Can use MItGeometry to grab
> the weights. apologies! thanks!
>
> Brandon L. harris
>
> On Nov 18, 2:06 pm, Brandon Harris <[email protected]> wrote:
> > OK, It may be that the documentation isn't as on par as the rest of
> > the API, but there isn't much in the way of information regarding the
> > newer classes for 2009.
> >
> > So here is what I have so far regarding the MRichSelection
> >
> > import maya.OpenMaya as openMaya
> >
> > selection = openMaya.MSelectionList()
> > softSelection = openMaya.MRichSelection()
> >
> > openMaya.MGlobal.getRichSelection(softSelection)
> > softSelection.getSelection()
> >
> > Now that's all well and good, but when it comes to grabbing the
> > current influence weight using the new MWeight() class, there isn't
> > much to go on.
> >
> > So far the class doesn't seem to take anything into itself except
> > other MWeight classes for copies and such, but it can return an
> > influence so
> >
> > openMaya.MWeight().influence()
> >
> > There's nothing telling me that I can pass anything into this class to
> > get information back or anything. Has anyone played with this more and
> > may have an idea how to use it properly?
> >
> > Thanks!
> >
> > On Nov 17, 4:27 pm, Brandon Harris <[email protected]> wrote:
> >
> > > Bleh, How embarrassing. Didn't even consider that. Docs just said a
> > > SelectionList and I ran with it. Thanks!!
> >
> > > On Nov 17, 2:02 pm, Makoto <[email protected]> wrote:
> >
> > > > To use MRichSelection class, you need to get current selection using
> > > > MGlobal like this,
> >
> > > > import maya.OpenMaya as OpenMaya
> >
> > > > richSelectList = OpenMaya.MRichSelection()
> > > > OpenMaya.MGlobal.getRichSelection(richSelectList)
> >
> > > > then, you can do something like...
> >
> > > > richSelectList.getSymmetryMatrix()
> > > > richSelectList.getSymmetryPlane()
> >
> > > > Thanks,
> > > > Makoto
> >
> > > > On 17 Nov, 16:04, Brandon Harris <[email protected]> wrote:
> >
> > > > > OK. Trying to use MRichSelection to get a hold on soft selection
> Data.
> > > > > Here is my process
> >
> > > > > import maya.OpenMaya as openMaya
> >
> > > > > #attempt  1
> > > > > softSelection = openMaya.MRichSelection()
> > > > > richSelection =
> softSelection.getSelection(openMaya.MSelectionList())
> >
> > > > > #attempt 2
> > > > > selection = openMaya.MSelectionList()
> > > > > softSelection = openMaya.MRichSelection()
> > > > > softSelection.getSelection(selection)
> >
> > > > > either way I do this it returns
> >
> > > > > # Error: (kFailure): Object does not exist
> > > > > # Traceback (most recent call last):
> > > > > #   File "<maya console>", line 4, in <module>
> > > > > # RuntimeError: (kFailure): Object does not exist #
> >
> > > > > Just to note, I do have soft selection turned on and I have
> vertices
> > > > > selected on a mesh, so this should work if the documentation is
> > > > > correct.
> >
> >
>
> --
> http://groups.google.com/group/python_inside_maya
>

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

Reply via email to