Documentation: add note on altering data from frame change handlers
Blender can crash while rendering, when scene data is changed from within a `frame_change_pre` or `frame_change_post` callback function. This results in bug reports like T60094, T67627, and T73530. Until this is properly resolved, this limitation should be documented. No functional changes.
This commit is contained in:
parent
757da61606
commit
be8879718e
Notes:
blender-bot
2023-02-14 08:08:56 +01:00
Referenced by issue #77572, Reference image opacity value doesn't work with Blender 2.83+ (Intel HD 630 with Mesa 20, regression from D6729) Referenced by issue #57646, Clip random marker placement in track/mask - not working in 2.8 Referenced by issue #56312, UI elements ignore keyboard layout changes (ex. Swapped CTRL / CAPS)
|
@ -0,0 +1,23 @@
|
|||
"""
|
||||
Note on Altering Data
|
||||
+++++++++++++++++++++
|
||||
|
||||
Altering data from handlers should be done carefully. While rendering the
|
||||
``frame_change_pre`` and ``frame_change_post`` handlers are called from one
|
||||
thread and the viewport updates from a different thread. If the handler changes
|
||||
data that is accessed by the viewport, this can cause a crash of Blender. In
|
||||
such cases, lock the interface (Render → Lock Interface or
|
||||
:data:`bpy.types.RenderSettings.use_lock_interface`) before starting a render.
|
||||
|
||||
Below is an example of a mesh that is altered from a handler:
|
||||
"""
|
||||
|
||||
def frame_change_pre(scene):
|
||||
# A triangle that shifts in the z direction
|
||||
zshift = scene.frame_current * 0.1
|
||||
vertices = [(-1, -1, zshift), (1, -1, zshift), (0, 1, zshift)]
|
||||
triangles = [(0, 1, 2)]
|
||||
|
||||
object = bpy.data.objects["The Object"]
|
||||
object.data.clear_geometry()
|
||||
object.data.from_pydata(vertices, [], triangles)
|
Loading…
Reference in New Issue