--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/894123b8-674c-48be-85d1-d1e5affed42fo%40googlegroups.com.
from maya import cmds, OpenMaya
msl = OpenMaya.MSelectionList()
def get_object(s): mo = OpenMaya.MObject() msl.clear() msl.add(s) msl.getDependNode(0, mo) return mo
def cb(*args, **kwargs): msg = args[0] plug = args[1] other_plug = args[2]
print msg print '----- Attribute {0} Change'.format(plug.name())
s_attr = 'className'
s_node_1 = cmds.createNode('transform', name='Node1')mo_node_1 = get_object(s_node_1)cmds.addAttr(s_node_1, longName=s_attr, dataType='string')
s_node_2 = cmds.createNode('transform', name='Node2')cmds.addAttr(s_node_2, longName=s_attr, dataType='string')i_call_back_id = OpenMaya.MNodeMessage().addAttributeChangedCallback(get_object(s_node_2), cb)
cmds.connectAttr('{0}.{1}'.format(s_node_1, s_attr), '{0}.{1}'.format(s_node_2, s_attr))--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ea9ed7a9-2ef2-4fbd-a813-ecd219d6ece8o%40googlegroups.com.
from maya import cmds, OpenMaya, utils
def handle_attr(attr):
print '-- Attribute {0} Changed: {1}'.format(attr, cmds.getAttr(attr))
def cb(msg, plug, *args, **kwargs):
print '-- Attribute {0} Dirty'.format(plug.name())
utils.executeDeferred(handle_attr, plug.name())
In fact I recive the value before attribute change.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/cbc3c517-a9a4-4877-a54a-e6f533fbd924o%40googlegroups.com.
Hi !
I reiterate because in fact the problem is not completely resolved.
```
from maya import cmds, OpenMaya, utils
def qd_handle_attr_cb(mp):print mp.adString()def qd_dirty_plug_cb(mo, mp, *args, **kwargs):if OpenMaya.MFnAttribute(mp.attribute()).name() != 'fileName':returnprint mp.adString()utils.executeDeferred(qd_handle_attr_cb, OpenMaya.MPlug(mp.node(), mp.attribute()))cmds.addExtension(nodeType='transform', longName='fileName', dataType='string')s_node_1 = cmds.createNode('transform')s_node_2 = cmds.createNode('transform')cmds.connectAttr('{0}.fileName'.format(s_node_1), '{0}.fileName'.format(s_node_2))msl = OpenMaya.MSelectionList()msl.add(s_node_2)mo = OpenMaya.MObject()msl.getDependNode(0, mo)i_call_back = OpenMaya.MNodeMessage.addNodeDirtyPlugCallback(mo, qd_dirty_plug_cb)# OpenMaya.MNodeMessage.removeCallback(i_call_back)```
If I set s_node_1.fileName my callback is append but the value setted on s_node_2.fileName is not valid. The attribute s_node_2.fileName has a delay value.
You have solution for this case ?
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/6dd44781-3a7a-4281-b323-049c607acd1dn%40googlegroups.com.