Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate why some Mesh functions not currently wrapped #428

Open
pmolodo opened this issue May 7, 2020 · 0 comments
Open

Investigate why some Mesh functions not currently wrapped #428

pmolodo opened this issue May 7, 2020 · 0 comments

Comments

@pmolodo
Copy link
Contributor

pmolodo commented May 7, 2020

There are a number of api functions which are currently disabled, but there doesn't seem to be a clear reason why. A large number of them are on Mesh.

Investigate whether more of these functions could / should be enabled.

I got a list by running this code:

import pymel.core as pm
import maya.cmds as cmds
import pymel.internal.factories as fac
import pymel.internal.factories as factories

fac.loadCmdCache()

couldBeEnabled = {}

numMethods = 0
for mayaType, parents, _ in factories.nodeHierarchy:
    pyNodeTypeName = factories.getPymelTypeName(mayaType)
    existingCls = getattr(pm.nt, pyNodeTypeName)
    apicls = factories.toApiFunctionSet(mayaType)
    if not apicls:
        continue
    apiClsName = apicls.__name__
    classInfo = fac.apiClassInfo[apiClsName]

    methInfo = classInfo['methods']
    for methodName, overloads in methInfo.items():
        basePymelName = classInfo.get('pymelMethods', {}).get(methodName, methodName)
        pymelName, overrideData, renamed = factories._getApiOverrideNameAndData(
                            pyNodeTypeName, basePymelName)
        if overrideData.get('enabled', True):
            continue
        if hasattr(existingCls, pymelName):
            continue
        validOverloads = []
        for i, overload in enumerate(overloads):
            argHelper = fac.ApiArgUtil(apiClsName, methodName, i)
            if argHelper.canBeWrapped() and not overload.get('deprecated'):
                validOverloads.append(i)
        if validOverloads:
            data = {'overloads': validOverloads}
            if pymelName != methodName:
                data['pymelName'] = pymelName
            numMethods += 1
            couldBeEnabled.setdefault(pyNodeTypeName, {})[methodName] = data

from pprint import pprint
pprint(couldBeEnabled)
print(numMethods)

...which output this:

{'AnimClip': {'getTrack': {'overloads': [0]}, 'setTrack': {'overloads': [0]}},
 'AnimCurve': {'addKey': {'overloads': [0, 1, 2, 3]},
               'evaluate': {'overloads': [0, 1, 2, 3, 4]},
               'findClosest': {'overloads': [0, 1]}},
 'DagNode': {'dagPath': {'overloads': [0]},
             'getPath': {'overloads': [0]},
             'removeChild': {'overloads': [0]},
             'removeChildAt': {'overloads': [0]},
             'setObject': {'overloads': [0, 1]}},
 'DependNode': {'findAlias': {'overloads': [0]},
                'findPlug': {'overloads': [0, 1]},
                'getAffectedAttributes': {'overloads': [0]},
                'getAffectedByAttributes': {'overloads': [0]},
                'getAliasList': {'overloads': [0]},
                'getConnections': {'overloads': [0]},
                'plugsAlias': {'overloads': [0]},
                'reorderedAttribute': {'overloads': [0]},
                'setAlias': {'overloads': [0]}},
 'Mesh': {'addPolygon': {'overloads': [0, 1, 2]},
          'binaryBlindDataComponentId': {'overloads': [0]},
          'cachedIntersectionAcceleratorInfo': {'overloads': [0]},
          'clearBlindData': {'overloads': [0, 1, 2, 3, 4]},
          'clearGlobalIntersectionAcceleratorInfo': {'overloads': [0]},
          'collapseEdges': {'overloads': [0]},
          'collapseFaces': {'overloads': [0]},
          'copy': {'overloads': [0]},
          'copyInPlace': {'overloads': [0]},
          'copyUVSetWithName': {'overloads': [0]},
          'createBlindDataType': {'overloads': [0]},
          'createInPlace': {'overloads': [0]},
          'deleteEdge': {'overloads': [0]},
          'deleteFace': {'overloads': [0]},
          'deleteVertex': {'overloads': [0]},
          'duplicateFaces': {'overloads': [0]},
          'extractFaces': {'overloads': [0]},
          'extrudeEdges': {'overloads': [0]},
          'extrudeFaces': {'overloads': [0]},
          'freeCachedIntersectionAccelerator': {'overloads': [0]},
          'generateSmoothMesh': {'overloads': [0]},
          'getBinaryBlindData': {'overloads': [0]},
          'getBlindDataAttrNames': {'overloads': [0, 1]},
          'getBlindDataFaceVertexIndices': {'overloads': [0]},
          'getBlindDataTypes': {'overloads': [0]},
          'getBoolBlindData': {'overloads': [0, 1]},
          'getColorIndex': {'overloads': [0]},
          'getConnectedShaders': {'overloads': [0]},
          'getDoubleBlindData': {'overloads': [0, 1]},
          'getFaceVertexBlindDataIndex': {'overloads': [0]},
          'getFloatBlindData': {'overloads': [0, 1]},
          'getIntBlindData': {'overloads': [0, 1]},
          'getRawDoublePoints': {'overloads': [0]},
          'getRawNormals': {'overloads': [0]},
          'getRawPoints': {'overloads': [0]},
          'getStringBlindData': {'overloads': [0]},
          'globalIntersectionAcceleratorsInfo': {'overloads': [0]},
          'hasBlindData': {'overloads': [0, 1]},
          'hasBlindDataComponentId': {'overloads': [0, 1]},
          'isBlindDataTypeUsed': {'overloads': [0]},
          'setBinaryBlindData': {'overloads': [0, 1, 2, 3]},
          'setBoolBlindData': {'overloads': [0, 1, 2]},
          'setDoubleBlindData': {'overloads': [0, 1, 2]},
          'setFaceVertexColors': {'overloads': [0]},
          'setFaceVertexNormals': {'overloads': [0]},
          'setFloatBlindData': {'overloads': [0, 1, 2]},
          'setIntBlindData': {'overloads': [0, 1, 2]},
          'setStringBlindData': {'overloads': [0, 1, 2]},
          'setVertexColors': {'overloads': [0]},
          'setVertexNormals': {'overloads': [0]},
          'sortIntersectionFaceTriIds': {'overloads': [0]},
          'stringBlindDataComponentId': {'overloads': [0]},
          'subdivideEdges': {'overloads': [0]},
          'subdivideFaces': {'overloads': [0]}},
 'NurbsCurve': {'cv': {'overloads': [0]}},
 'NurbsSurface': {'cv': {'overloads': [0]},
                  'getUV': {'overloads': [0]},
                  'getUVs': {'overloads': [0]},
                  'setUV': {'overloads': [0]},
                  'setUVs': {'overloads': [0]}},
 'RadialField': {'type': {'overloads': [0], 'pymelName': 'getType'}},
 'Transform': {'getRotationQuaternion': {'overloads': [0]},
               'setRotationQuaternion': {'overloads': [0]}},
 'Wire': {'getDropoffLocator': {'overloads': [0]},
          'setDropoffLocator': {'overloads': [0]}}}
84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant