[Maya-Python] Button attribute

23 views
Skip to first unread message

Marcus Ottosson

unread,
Apr 6, 2016, 4:19:57 AM4/6/16
to python_in...@googlegroups.com
Hi all,

I'm looking to add an attribute to a node, say "printHello", of type "button".

This attribute would appear as a button in the Attribute Editor which, when pressed, would trigger a Python function of sorts.

The problem is, the type "button" doesn't exist. I would preferable *not* use an Attribute Editor XML template, as I'd like to influence my surroundings as little as possible.

Ideally, the workflow would go something like this.

def my_callback():
  print("Hello")

cmds.addAttr("myNode", ln="printHello", dt="button", callback=my_callback)

Any ideas on how to achieve this?

--
Marcus Ottosson
konstr...@gmail.com

Reply all
Reply to author
Forward
0 new messages