Ok, quick follow up:

First of all, this error only seems to occur if you have added a
dynamic compound attribute, and then looked at it in the attribute
editor.

Ie, if you execute this (taken straight from the maya docs):

http://pastebin.com/m2c019dfe

cmds.sphere( name='earth' )
cmds.addAttr( longName='sampson', numberOfChildren=5,
attributeType='compound' )
cmds.addAttr( longName='homeboy', attributeType='matrix',
parent='sampson' )
cmds.addAttr( longName='midge', attributeType='message',
parent='sampson' )
cmds.addAttr( longName='damien', attributeType='double',
parent='sampson' )
cmds.addAttr( longName='elizabeth', attributeType='double',
parent='sampson' )
cmds.addAttr( longName='sweetpea', attributeType='double',
parent='sampson' )

...then open up the attribute editor, and look at your pretty new
compound attribute (side note - 'homeboy' is displayed as 'sampson'.
Odd...), and THEN do:

cmds.addAttr(longName="msgAttr", attributeType="message")

...you'll get the annoying warning.

The second point is that I found a way around the warning, though it's
a huge hack - basically, just temporarily rebind AEreplaceCompound.
So, a function such as:

http://pastebin.com/m2a0ce632

def addMsgAttrNoWarning(node, attr, *args, **kwargs):
        import maya.mel as mel
        import maya.cmds as cmds

        mel.eval(r'''
global proc AEreplaceCompound ( string $controlName, string $plugName,
string $changedCommand )
{
    evalDeferred("source AEreplaceCompound");
}
''')
        cmds.addAttr(node, longName=attr, attributeType="message",
*args, **kwargs)


... will avoid the warning.  But it seems like such a potentially
messy solution, I think I'd rather just change my script to not use
compound attributes (they're not as useful as I'd hoped, anyway), and
hope the user doesn't add any themselves either.

- Paul

On Sep 30, 9:41 am, barnabas79 <[EMAIL PROTECTED]> wrote:
> Hey all - I was wondering if there was a way to add a dynamic message
> attribute without receiving a warning - ie, if I do:
>
> import maya.cmds as cmds
> cmds.addAttr(longName="msgAttr", attributeType="message")
>
> ... I receive:
>
> // Warning: file: C:/3D/Maya2008/scripts/AETemplates/
> AEreplaceCompound.mel line 97: Message attributes have no data
> values. //
>
> Anyone know a way to get around this, ie add a message attribute
> without receiving an error? Or some way to temporarily disable the
> error?
>
> I know I could do this from the API, but then I would lose the ability
> to undo, which I'd rather be able to keep.
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to