Ok thanks for your test Justin !

It's possible top considerate that a bug of attribute string ?

Le jeudi 13 août 2020 à 10:32:42 UTC+2, justin...@gmail.com a écrit :

> I have no explanation, but it seems that once you connect the 
> addNodeDirtyPlugCallback, it causes the connected attribute of the second 
> node to not update its value until the second time you set it. I've tried 2 
> versions of maya and it is the same behaviour.
>
>
> On Wed, Aug 12, 2020 at 9:23 PM Rémi Deletrain <remi.de...@gmail.com> 
> wrote:
>
>> 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':
>>         return
>>     print 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 ?
>>
>> Le jeudi 6 août 2020 à 09:20:13 UTC+2, Rémi Deletrain a écrit :
>>
>>> Thanks Justin ! Your solution works.
>>>
>>> I did not know the utils module and the executeDeferred method ...
>>>
>>> Thank you again !
>>>
>> -- 
>>
> 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
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/6dd44781-3a7a-4281-b323-049c607acd1dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/d4192a97-56ee-4acc-bb7b-aed13794a123n%40googlegroups.com.

Reply via email to