Illogical Dirty Propagation

85 views
Skip to first unread message

Marcus Ottosson

unread,
Feb 4, 2025, 6:30:36 AMFeb 4
to Python Programming for Autodesk Maya
Hi all,

Both me and the gpt's of the world are confused about why this evaluation isn't happening like we'd expect. 

1 node, 3 plugs.

shapeType -> outputMesh -> state

Reading from `state` should pull and compute `outputMesh`, which in turn pulls and reads from `shapeType`. And it does, but only once.

Changing `shapeType` should cause both `outputMesh` and state to become dirty, such that the next time I read from `state`, it should compute it once more.

But it does not. :( Why?

I've put together a reproducible here, can anyone spot the problem? Help!

Marcelo

unread,
Feb 4, 2025, 10:43:09 AMFeb 4
to python_in...@googlegroups.com
I’d assume you wouldn’t need this as well… but if you were to also add the following to the initialize:

status = attributeAffects(aShapeType, aState);

Would that change anything?


--
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 visit https://groups.google.com/d/msgid/python_inside_maya/1b63e13c-1a5b-4566-92b3-ebab5a061dd9n%40googlegroups.com.

Marcus Ottosson

unread,
Feb 4, 2025, 11:31:49 AMFeb 4
to python_in...@googlegroups.com
Yes, that does work and is what I've been doing, but it feels like a hack.

Any whenever I need to debug the evaluation of my plug-ins (which is more often than I'd like) I always look suspiciously at this type of duplicate-connection. I thought the idea of propagating the dirty state of any attribute was to handle cases like this, and it would set my mind at ease knowing I'm understanding it right, or alternatively to know what I'm missing.

Marcelo

unread,
Feb 5, 2025, 12:33:00 AMFeb 5
to python_in...@googlegroups.com
I found this email thread here from 2008 where the relevant piece of code is:

staticDynamicTest.attributeAffects(staticDynamicTest.aCreateDynamic, staticDynamicTest.aInput)

staticDynamicTest.attributeAffects(staticDynamicTest.aInput, staticDynamicTest.aStaticOutput)

And then on a reply from Dean Edmonds:

Your attributeAffects() calls show aCreateDynamic affecting aInput and aInput affecting aStaticOutput.

That's a transitive relationship (A affects B affects C) however Maya only follows the first step in the chain.
So if a new value appears on aCreateDynamic then aInput will be marked dirty, but that will not ripple on to dirty aStaticOutput.

So maybe that could be why.

Perhaps it's by design, to avoid unexpected cyclical dirtying?

Link to the email thread:


Marcus Ottosson

unread,
Feb 5, 2025, 4:26:45 AMFeb 5
to Python Programming for Autodesk Maya
Thanks for finding that! It's not 100% clear this is relevant as that user appears to be creating dynamic attributes from within the compute() block, and it's possible that what Dean is referring to is this specific case. But still, it's a good clue.
Reply all
Reply to author
Forward
0 new messages