Created
May 3, 2017 05:33
-
-
Save TMPxyz/01686464d06a86dcb7a0ab0d950151b9 to your computer and use it in GitHub Desktop.
simple blender addon to reload all images
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
bl_info = { | |
"name": "Reload All Images", | |
"author": "tmpxyz", | |
"version": (1, 0), | |
"blender": (2, 72, 2), | |
#"location": "View3D > Toolbar and View3D > Specials (W-key)", | |
"warning": "", | |
"description": "reload all images", | |
"category": "image", | |
} | |
import bpy | |
class ReloadAllImages(bpy.types.Operator): | |
"""Reload All images""" # blender will use this as a tooltip for menu items and buttons. | |
bl_idname = "image.reload_all_images" # unique identifier for buttons and menu items to reference. | |
bl_label = "Reload All Images" # display name in the interface. | |
bl_options = {'REGISTER', 'UNDO'} # enable undo for the operator. | |
def execute(self, context): # execute() is called by blender when running the operator. | |
# The original script | |
for i in bpy.data.images: | |
i.reload() | |
return {'FINISHED'} # this lets blender know the operator finished successfully. | |
def register(): | |
bpy.utils.register_class(ReloadAllImages) | |
bpy.types.IMAGE_MT_image.append(menu_func) | |
def menu_func(self, context): | |
self.layout.operator(ReloadAllImages.bl_idname) | |
def unregister(): | |
bpy.utils.unregister_class(ReloadAllImages) | |
bpy.types.IMAGE_MT_image.remove(menu_func) | |
# This allows you to run the script directly from blenders text editor | |
# to test the addon without having to install it. | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment