Following up from Part 1 I'm looking to see about making this persistent when (re)loading up blender 3.6.7, Much thanks to Chris for writing something that works when inside the text editor.
bl_info = {
"name": "Active Background",
"author": "Blender.Fun",
"version": (0, 1),
"blender": (2, 80, 0),
"location": "View3D",
"description": "Changes background when animation is playing.",
"warning": "",
"doc_url": "",
"category": "Themes",
}
import bpy
def start(scene):
bpy.context.preferences.themes[0].view_3d.space.gradients.high_gradient = (1.0, 0.0, 0.0)
def stop(scene):
bpy.context.preferences.themes[0].view_3d.space.gradients.high_gradient = (0.2, 0.2, 0.2)
def register():
bpy.app.handlers.animation_playback_post.append(stop)
bpy.app.handlers.animation_playback_pre.append(start)
def unregister():
bpy.app.handlers.animation_playback_post.remove(stop)
bpy.app.handlers.animation_playback_pre.remove(start)
if __name__ == "__main__":
register()