HI there, I’m working on the crowdrender addon which distributes scene data as the user changes it in real time. One of the issues we’ve had since we started work on this project ( I think we started in 2.69) was discovering what data had changed due to user edits to their scene. Using the python API, we can only discovery some changes.
Its important to our system that we can detect the user’s edits in real time so we can update other computers on their network and ensure they are in a ready to render state.
To date, we’ve used the following methods to discovery user edits
Used the ‘is_updated’ flag, which we checked in a handler appended to bpy.app.handlers.scene_update_post
Checking the window_manager.operators collection to see if there is a new operator that just ran.
These methods have their drawbacks since there is inconsistent use of “is_updated”, some dateblocks don’t update it when there is a change to the appearance of the scene at render time. We had to poll some data blocks in order to be sure that we’d capture user edits.
Now, in 2.8, scene_updated_post has been removed, so we can no longer use the first method above. Campbell B mentioned the magnus as a potential replacement, but the example code provided for that didn’t work.
It would be awesome if the devs could let us know how we could integrate better with blender to discover the users’ edits in real time :D. Being totally self centred for a moment, it would be awesome if there was a system where we could append a handler which is called when the user changes data, the handler accepting an argument of the changed data block. This would of course make our life much easier, but not so sure about yours
The API for this in Blender 2.8 is not finished yet, and only works for render engines. But it will be covering more datablocks as almost all of them are part of the dependency graph now, which wasn’t the case before.
Note that Cycles relies purely on is_updated flags for detecting updates also in 2.7, so in principle it should cover everything already. Though some of the dependencies between datablocks are not so obvious.
Hi Brecht, thanks for the update, very kind of you to fill me in with the details :). While on the topic of the render engine part of the API, can you confirm and explain why the render function now gets passed the depsgraph rather than the scene? That change was quite unexpected and I am puzzled why it was done and if it will stay this way?
We no longer modify the original scene when evaluating modifiers, constraints, etc. Rather we create a dependency graph that copies a subset of the datablocks of the original scene, and do the evaluation on those copies.
This is done so that we can for example render while the users works on the original scene, or to do animation playback in one window while the user edits in another. It will also allow for more flexible node based systems.
So this is by design, a renderer now is expected to get its data from the evaluated datablocks of a dependency graph, rather than the original scenes.