Given a list of possible values for a single context option, is it possible to loop over these using Python, running hou.setContextOption() with each value, have the scenegraph update accordingly with whatever mutation is triggered by the new context option value, do something (like retrieve some information from the SG in that particular mutation, then rinse and repeat with the next value?
I can loop over a list of values with hou.setContextOption(), and I can confirm that internally Houdini is indeed setting the value on each iteration (hou.contextOption returns the expected result), but the scenegraph mutations don't resolve on each iteration.
I'm guessing I'm doing something I'm not supposed to be doing. And clearly I'm not expecting an instantaneous result as the mutations need to cook each time. But I thought I would ask anyway on the chance there is some method I can call in my loop that forces a scenegraph update before proceeding to the next contextOption-driven mutation. Essentially I want to query some aspect of the scenegraph for different mutation states, and I figured the most direct (naive?) route was to loop over each mutation and run the query.
(So far my result is the same whether run from a Python LOP or a Python shelf tool: the context options change correctly but seem to have no effect when they do.)