LumaPictures / pymel

Python in Maya Done Right
Other
490 stars 131 forks source link

maybeConvert() returns None for int(0) #448

Closed shunjiAdsk closed 1 year ago

shunjiAdsk commented 3 years ago

pymel uses maybeConvert() to convert some of the return values.

res = _factories.maybeConvert(res, _general.PyNode)

maybeConvert()

def maybeConvert(val, castFunc):
    if isinstance(val, list):
        try:
            return [castFunc(x) for x in val]
        except:
            return val
    elif val:
        try:
            return castFunc(val)
        except Exception:
            return val

If val is int(0),

elif 0:

maybeConvert() does nothing and returns None.

else:

might be better here.

chadrik commented 1 year ago

fixed