Created
July 7, 2016 07:10
-
-
Save sambler/47a505c1029f7926753e8ce50ff752b2 to your computer and use it in GitHub Desktop.
Sample test addon to show using unregister() to remove changes by the addon
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 = {"version": (1, 0), "blender": (2, 75, 0), "author": "myname", | |
"name": "testing addon", "location": "blender", "description": "test a new addon" , | |
"warning": "only for testing", "category": "test", } | |
import bpy | |
# add your operators, panels ..... | |
def register() : | |
bpy.types.scene.my_int_storage = bpy.props.IntProperty() | |
bpy.utils.register_class(myOperator) | |
bpy.types.VIEW3D_MT_object.append(add_my_menu_item) | |
def unregister() : | |
# remove all changes made in register() | |
bpy.types.VIEW3D_MT_object.remove(add_my_menu_item) | |
bpy.utils.unregister_class(myOperator) | |
del bpy.types.scene.my_int_storage | |
if __name__ == "__main__": | |
try: | |
# by running unregister here we can run this script | |
# in blenders text editor | |
# the first time we run this script inside blender | |
# we get an error that removing the changes fails | |
unregister() | |
except: | |
pass | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment