PyMEL's listHistory method works well:
PyNode('myMesh').listHistory(type="skinCluster")
-jason
On Feb 3, 4:31 pm, stephenkmann <
stephenkm...@gmail.com> wrote:
> I'm barely starting to dip my toes into python, but I thought I'd throw this
> out there. you might be able to get what you want using the python
> equivalent of listConnections.
>
> MEL:
> listConnections -type "skinCluster" boundObjectShape;
>
> ( there is a python equivalent to "listConnections" right? )
>
> hth
>
> -=smann
>
> On Thu, Feb 3, 2011 at 6:19 PM, Gerard Van Ommen <
gerard...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Thanks for the info Paul. Yeah this mel script is too simplistic to use
> > through pyMel, and warrants writing in pymel (as Ted has kindly done) but I
> > will certainly keep it in mind for situations where I need to eval a mel
> > script in pymel.
>
> > On Thu, Feb 3, 2011 at 7:57 PM, Paul Molodowitch <
elron...@gmail.com>wrote:
>
> >> Unless there's a reason why the mel function doesn't fit your needs (ie,
> >> it doesn't return unique names, or you need to customize it in some way), or
> >> you're using it as a learning exercise, I'd advise just using the mel.
> >> Whether it's "dirty" is a matter of opinion, but using mel in python is
> >> something you'll have to get used to. A lot of maya is built on mel, and I
> >> don't see that changing anytime soon; and as long as that is the case, there
> >> will always be situations where you'll need to call out to mel scripts.
> >> If you're worried about things looking untidy, pymel can handle some of
> >> the string processing to make mel functions seem more pythonic:
>
> >> import pymel.core as pm
> >> res = pm.mel.findRelatedSkinCluster()
>
> >> That's a pretty simplistic example, since there's no args, but it will
> >> also automatically convert args, keyword args, lists, and other things - see
> >> the docs for more info:
>
> >>
http://www.luma-pictures.com/tools/pymel/docs/1.0/generated/classes/p...
>
> >> <
http://www.luma-pictures.com/tools/pymel/docs/1.0/generated/classes/p...>Of
> >> course, under the hood, it's still doing string processing, then calling
> >> mel.eval, so the 'dirtiness' is still there; it's just sort of swept under
> >> the carpet. =)
>
> >> - Paul
>
> >> PS - Oh, and if you need access to mel global variables, there's also a
> >> melGlobals dictionary-like object:
>
> >>
http://www.luma-pictures.com/tools/pymel/docs/1.0/generated/classes/p...
>
> >> On Wed, Feb 2, 2011 at 11:40 PM, Ted Charlton <
ted.charl...@gmail.com>wrote:
>
> >>> little weak...
>
> >>> shps = mc_.listRelatives(s=True, ni=True)
> >>> for sh in shps:
> >>> scs = mc_.ls(type='skinCluster')
> >>> for sc in scs:
> >>> mesh = mc_.skinCluster(sc, q=True, g=True)
> >>> if mesh[0] == sh:
> >>> relatedSkinCluster = sc
> >>> print relatedSkinCluster
>
> >>> Better.
>
> >>> On Wed, Feb 2, 2011 at 11:36 PM, Ted Charlton <
ted.charl...@gmail.com>wrote:
>
> >>>> shps = mc_.listRelatives(s=True, ni=True)
> >>>> for sh in shps:
> >>>> scs = mc_.ls(type='skinCluster')
> >>>> for sc in scs:
> >>>> mesh = mc_.skinCluster(sc, q=True, g=True)
> >>>> if mesh[0] == shps[0]:
> >>>> relatedSkinCluster = sc
> >>>> print relatedSkinCluster
>
> >>>> GVOK,
>
> >>>> Maybe this can help.
> >>>> Cheers.
>
> >>>> On Wed, Feb 2, 2011 at 10:52 PM, Gerard van Ommen Kloeke <
> >>>>
gerard...@gmail.com> wrote:
>
> >>>>> I'll probably go that route due to time and experience, but I will
> >>>>> write something in py eventually (and post)
> >>>>> Thanks for the help
>
> >>>>> You can run mel from python:
> >>>>> import maya.mel as mel
> >>>>> mel.eval('findRelatedSkinCluster '+name_of_mesh)
>