Home Website Youtube GitHub

Is there a way to fix this warning message "// Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. // "?

Hi!

First of all I’m new to the forum and mGear Framework and I would like to congratulate you guys for this fantastic tool. I have no idea of programming so it is great to be able to create my own Rigs in an easy way with Shifter.

Having said that, I’ve done a rig for a character and when shifter is genereting the controls this warning message appears "// Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. // "

The rig works perfect once is generated but I don´t know what this message means and if it´s important to fix.

Thanks in advance and good job with mGear.

Are you using deltaMush?

I’m paraphrasing from someone who answered me, but the deltaMush class isn’t implemented properly in the Maya API, so when you try to call it using PyMEL, it results in a generic dag node. But it still works. You can just ignore the warning.

No, I’m not using deltaMush. I use ngSkintools for the skinning, could be related? And I started with the biped template guide althow I modified the settings a little bit.

I haven’t seen it happen in relation to ngSkinTools. But there might be other nodes that have the same problem as deltaMush.

I wouldn’t worry about it. (Edit: Except I do access my deltaMush deformers as a string name instead of as a PyNode, when I am using reorderDeformers() in my post scripts. Otherwise, that particular command fails, if I recall correctly.)

But if you did want to find out what nodes are causing it, you might be able to do something like this. It’s a bit of a hacky script. I use it to count all the various types of nodes in a scene. And the last line is extra for you. It tries to pm.PyNode(foo) a single node of one each of the nodetypes:

### SNIPPET: GET COUNT FOR ALL TYPES ################
import pymel.core as pm
allColl = pm.ls('*')
typeColl = list(set([x.type() for x in allColl]))
counter = 0

typeCollCount = [[len(pm.ls(type=x)), x] for x in typeColl]
typeCollCount.sort(key=lambda x: x[0])

for typeCount, eachType in typeCollCount:
    if typeCount > 0:
        print('{:<5} {}'.format(typeCount, str(eachType)))
        
        ### Try to instantiate one as a PyNode, and see if it causes a warning. ###
        pm.PyNode(pm.ls(type=eachType)[0])

Any that fail to instantiate the MFn should give that warning. Then you just have to look at the line above to see which nodetype caused the warning. In my example, deltaMush causes it.
image

2 Likes

Thanks for the script! I have use it and this is the the log:

On programmer of my company told me the the highlighted line is the one that causes the warning in that case.

And in this second image you can se the warnings in the shifter log when it’s generating the rig (maybe I should have uploaded this image from the beginning)

allColl = pm.ls('*')
typeColl = list(set([x.type() for x in allColl]))

It is true that this calls the warnings. pm.ls() already wraps the nodes as a PyNode.
What you could do to prevent this is just use the plain python commands instead of pymel to list the types.

import pymel.core as pm
import maya.cmds as cmds

allColl = cmds.ls("*")
typeColl = list(set([cmds.objectType(x) for x in allColl]))

counter = 0

typeCollCount = [[len(cmds.ls(type=x)), x] for x in typeColl]
typeCollCount.sort(key=lambda x: x[0])

for typeCount, eachType in typeCollCount:
    if typeCount > 0:
        print('{:<5} {}'.format(typeCount, eachType))
        
        ### Try to instantiate one as a PyNode, and see if it causes a warning. ###
        pm.PyNode(cmds.ls(type=eachType)[0])  # << first time we wrap it using pymel.

Jeroen, I am not trying to avoid the warning. I’m trying to cause the warning to happen to find out what node it is! :slight_smile:

Mac, yes the line your co-worker specified is causing the warning when I first ls() everything. But somewhere further down the output, it should happen again, during the loop when it checks each type one at a time.

I see, then this is the complete log and the warning doesn’t appear in any other place, only at the begining.

If it’s not a big problem for the RIG as you mentioned, then I don’t want to bother you more. Thanks a lot for your help!

SNIPPET: GET COUNT FOR ALL TYPES

import pymel.core as pm
allColl = pm.ls(’*’)
typeColl = list(set([x.type() for x in allColl]))
counter = 0

typeCollCount = [[len(pm.ls(type=x)), x] for x in typeColl]
typeCollCount.sort(key=lambda x: x[0])

for typeCount, eachType in typeCollCount:
if typeCount > 0:
print(’{:<5} {}’.format(typeCount, str(eachType)))

    ### Try to instantiate one as a PyNode, and see if it causes a warning. ###
    pm.PyNode(pm.ls(type=eachType)[0])
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 
# Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDagNode. # 

1 strokeGlobals
1 defaultRenderUtilityList
1 colorManagementGlobals
1 shapeEditorManager
1 displayLayerManager
1 defaultShaderList
1 particleCloud
1 lightLinker
1 poseInterpolatorManager
1 hardwareRenderingGlobals
1 ikSplineSolver
1 sequenceManager
1 shaderGlow
1 ikRPsolver
1 renderGlobalsList
1 aiOptions
1 script
1 renderLayerManager
1 postProcessList
1 ikSystem
1 globalCacheControl
1 defaultRenderingList
1 hwRenderGlobals
1 lightList
1 viewColorManager
1 renderLayer
1 geomBind
1 renderQuality
1 renderGlobals
1 dynController
1 hyperGraphInfo
1 defaultTextureList
1 hardwareRenderGlobals
1 hyperLayout
1 dof
1 defaultLightList
1 time
1 resolution
1 aiAOVFilter
2 curveInfo
2 ikSCsolver
2 mgear_slideCurve2
2 aiAOVDriver
2 partition
3 lambert
3 nodeGraphEditorInfo
3 materialInfo
3 dagPose
4 shadingEngine
4 scaleConstraint
4 mgear_ikfk2Bone
4 displayLayer
4 mgear_inverseRotOrder
4 skinCluster
5 camera
8 locator
8 motionPath
8 orientConstraint
8 pairBlend
8 mesh
9 clamp
9 gameFbxExporter
10 poleVectorConstraint
10 distanceBetween
12 animCurveUU
13 mgear_intMatrix
19 aimConstraint
19 ikHandle
19 ikEffector
20 mgear_rollSplineKine
28 mgear_squashStretch2
38 addDoubleLinear
38 mgear_curveCns
44 tweak
47 pointConstraint
47 blendColors
64 reverse
81 parentConstraint
88 groupId
88 groupParts
88 multiplyDivide
99 objectSet
139 condition
157 joint
178 unitConversion
235 mgear_mulMatrix
321 decomposeMatrix
570 controller
1081 nurbsCurve
1438 transform