Scene index chain question


I was wondering what are the best practices with a scene index chain in the following case :
SceneIndexA -->FilteringSceneIndexB -->FilteringSceneIndexC
So scene index A provides some Rprims, and Scene index B and C are filtering scene indices.
So the only one having been added to the render index is FilteringSceneIndexC as it’s the end of the chain.

And, say FilteringSceneIndexB is provided by a custom maya node from an HdSceneIndexPlugin::_AppendSceneIndex callback.
When my maya node gets deleted, I would expect not to see any impact any more from it in the rendering. So FilteringSceneIndexB should be disabled or deleted/null’ed.
But what happens if I delete/null it ? I think it will break the chain, right.
And if in another case I delete FilteringSceneIndexC everything will be removed from from the renderin index, right ?
So, is that a rule of thumb to say we should rather disable FilteringScene Indices but never remove them from a chain ?
Thank you.

  1. Working on this and trying to disable a filtering scene index with a custom bool member variable.
    How when it’s enabled/disabled can I tell the scene index that everything that is filtered needs to be dirtied ? I can store the filtered prims list but which locator should I use for the _DirtyPrims call ?
    I am not supposed to know the prim type though I could store it as well.

  2. Kind of a similar question to the first post in this thread. If instead of a filtering scene index I have a maya node that holds a retained scene index which injects new prims in the rendering. When it gets deleted, in term of performance : what is the best way to disable/remove the prims from it ?
    a) Remove the scene index from the render index ?
    b) Set its prims as invisible with an attribute ?
    c) Remove the prims from the scene index but leave the scene index in the render index ? As if the user does an undo on the deleted maya node, I will have to re-enable everything in the rendering.
    d) Any other option you can see ?

Thank you.