Last active
May 21, 2023 18:38
-
-
Save p2or/f07a7d51e7fd067ab1c593375a529ed8 to your computer and use it in GitHub Desktop.
Image Opactity Handler #Blender
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for http://blender.stackexchange.com/q/65143/3710 | |
bl_info = { | |
"name": "Test", | |
"description": "Set Background Image Opacity in 3D View to 1 at Startup", | |
"author": "poor", | |
"version": (0, 0, 1), | |
"blender": (2, 70, 0), | |
"location": "3D View", | |
"warning": "", # used for warning icon and text in addons panel | |
"wiki_url": "", | |
"tracker_url": "", | |
"category": "Development" | |
} | |
import bpy | |
from bpy.app.handlers import persistent | |
@persistent | |
def load_handler(dummy): | |
# only apply to startup | |
if not bpy.data.filepath: | |
return | |
for area in bpy.context.screen.areas: | |
if area.type == 'VIEW_3D': | |
space_data = area.spaces.active | |
bg_imgs = space_data.background_images | |
for img in bg_imgs: | |
img.opacity = 1 | |
break | |
def register(): | |
bpy.app.handlers.load_post.append(load_handler) | |
def unregister(): | |
bpy.app.handlers.load_post.remove(load_handler) | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment