Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Import artAttrBlendShapeContext don't work

25 views
Skip to first unread message

Yann Genty

unread,
Nov 21, 2024, 4:01:34 AM11/21/24
to Python Programming for Autodesk Maya
Hello everyone! New to this group and glad to have found it :)

I'm currently developing a rig tool and have created an option to open the Paint Weight Tool more simply, depending on the deformer selected.

I've managed to make it work for all deformers except the Paint BlendShape Weight Tool.

My aim is to open this context, open the tool window AND directly select the correct targetShape in the menue provided. But even when I make sure that the “artAttrBlendShapeContext” ctx is loaded, Maya tells me that it “cannot find procedure ‘artBlendShapeSelectTarget’ ”.
And this only happens when Maya is opened or I haven't used any tool yet, otherwise it works fine.
Here's my code:

#import correct context if not loaded
if not cmds.artAttrCtx(“artAttrBlendShapeContext”, q=True, exists=True):
    cmds.artAttrCtx(“artAttrBlendShapeContext”, i1=“paintBlendshape.png”, whichTool=“blendShapeWeights”)
cmds.setToolTo(“artAttrBlendShapeContext”)

cmds.select(mesh)
cmds.ArtPaintBlendShapeWeightsTool()
cmds.toolPropertyWindow()

#select the right target
mel.eval('artBlendShapeSelectTarget artAttrCtx “{}”;'.format(targetShape )  

Thanks for reading!
cya

Yann :)

Tim

unread,
Nov 21, 2024, 9:23:23 AM11/21/24
to Python Programming for Autodesk Maya
I tried to reply by email and it was blocked for some reason, so trying again...

You need to add this code somewhere (maybe converted to Python) to make sure
the correct MEL scripts have been sourced.

if (!`exists artBlendShapeSelectTarget`) {
    // *Properties.mel and *Values.mel are MEL scripts to fill in the tool settings window for a context.
    // The MEL proc you're looking for is defined in one of those files, but none of it has been sourced yet
    // so Maya doesn't yet have it available.  Source the *Properties file and it should source all the other
    // files you need.
    source artAttrBlendShapeProperties;
}

-Tim

Yann Genty

unread,
Nov 21, 2024, 10:59:35 AM11/21/24
to Python Programming for Autodesk Maya

Hello! Thank you so much for your quick reply!

Effectively I had not understood this system of properties. Now there's no error, but the right targetShape is still not selected. This always happens when maya has just been opened and has no tools loaded. As soon as you try a second time, it works (even if it's with an unrelated tool).
I've even tried another way of modifying the targetShape selection, but nothing works.

2024-11-21-16-47-42.gif

cmds.select(mesh)


if not cmds.artAttrCtx(“artAttrBlendShapeContext”, q=True, exists=True):
    cmds.artAttrCtx(“artAttrBlendShapeContext”, i1=“paintBlendshape.png”, whichTool=“blendShapeWeights”)
               
if not cmds.artAttrCtx(“artBlendShapeSelectTarget”, q=True, exists=True):
    mel.eval('source “artAttrBlendShapeProperties”')

shape = cmds.textScrollList(“tsl”, query=True, selectItem=True)[0].split(“.”)[1]
cmds.artAttrCtx(“artAttrBlendShapeContext”, e=True, toolOnProc='artBlendShapeSelectTarget artAttrCtx “{}”;'.format(shape))

cmds.ArtPaintBlendShapeWeightsTool()
cmds.toolPropertyWindow()

It's not a major bug, as it'll only happen in a few cases, but I wanted to try and fix it anyway. 
Reply all
Reply to author
Forward
0 new messages