Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Viewport 2.0 update bug with setDependentsDirty

Viewport 2.0 update bug with setDependentsDirty

Anonymous
Not applicable
663 Views
2 Replies
Message 1 of 3

Viewport 2.0 update bug with setDependentsDirty

Anonymous
Not applicable

Hello.

I've found a bit strange bug while writing a custom deformer (implementation can be found in the attached file). It's a very simple deformer which just moves points up by an attribute.


When I define attribute dependencies via attributeAffects in initialize function, then everything is alright, that's ok. 

When I use setDependentsDirty to define dependencies between attributes I get unexpected slow down in Viewport 2.0 (see profiler image attached). This bug isn't present in legacy viewport.

I really don't know the reason and this bug occurs in every Maya (I tried 2013-2019). It's annoying and disappointing thing. Help me, please!

 

To reproduce bug:

1. Compile deformer.cpp using clang or vs studio.

2. Load Maya and attach the deformer to a mesh (deformer -type mydeformer).

3. Try both cases (via attributeAffects and setDependentsDirty).

You'll see that attributeAffects version is much faster.

 

PS: I should use setDependencyDirty anyway.

0 Likes
664 Views
2 Replies
Replies (2)
Message 2 of 3

jmreinhart
Advisor
Advisor
  for (int k = 0; k < outGeomPlug.numElements(); k++) // add each element
    affectedPlugs.append(outGeomPlug.elementByPhysicalIndex(k));

This may be part of the issue. If add the outputGeom to the list of affected plugs you shouldn't have to add the individual indices. 

 

Also setDependentsDirty is always going to be slower. It's intended for cases that can't be done with attributeAffects alone, so it has to do some additional work.

0 Likes
Message 3 of 3

Anonymous
Not applicable

@jmreinhart wrote: This may be part of the issue. If add the outputGeom to the list of affected plugs you shouldn't have to add the individual indices. 

 

 

Also setDependentsDirty is always going to be slower. It's intended for cases that can't be done with attributeAffects alone, so it has to do some additional work.


That doesn't work. One must add a parent attribute and all the children ones. (There told in setDependentsDirty documentation).
When I add outputGeom only then the deformer doesn't initiate compute function at all when I change input attributes.