Results 1 to 5 of 5
  1. #1
    Member Meta-Androcto's Avatar
    Join Date
    Aug 2006
    Location
    australia
    Posts
    3,990

    Reboot Blender Addon

    Hi, this simple addon is very useful for addons devs.
    we tire of restarting Blender to ensure the changed code works.
    basically this addon will shutdown & restart blender automagically.
    Note that it will not save anything. it will simply shut down & restart Blender.

    Huge thanks to saidenka Blender-Scramble-Addon
    as I found this function whilst translating his tools.
    Enjoy.

    Code:
    # Add-on information
    bl_info = {
    	"name" : "Reboot",
    	"author" : "(saidenka) meta-androcto",
    	"version" : (0,1),
    	"blender" : (2, 7),
    	"location" : "File Menu",
    	"description" : "Reboot Blender without save",
    	"warning" : "",
    	"wiki_url" : "",
    	"tracker_url" : "",
    	"category" : "System"
    }
    
    
    import bpy
    import os, sys
    import subprocess
    
    
    class RestartBlender(bpy.types.Operator):
    	bl_idname = "wm.restart_blender"
    	bl_label = "Reboot Blender"
    	bl_description = "Blender Restart"
    	bl_options = {'REGISTER'}
    	
    	def execute(self, context):
    		py = os.path.join(os.path.dirname(__file__), "console_toggle.py")
    		filepath = bpy.data.filepath
    		if (filepath != ""):
    			subprocess.Popen([sys.argv[0], filepath, '-P', py])
    		else:
    			subprocess.Popen([sys.argv[0],'-P', py])
    		bpy.ops.wm.quit_blender()
    		return {'FINISHED'}
    
    
    
    
    
    
    def menu_func(self, context):
        layout = self.layout
        layout.separator()
        layout.operator(RestartBlender.bl_idname, icon="PLUGIN")
        layout.separator()
    
    
    
    
    def register():
        bpy.utils.register_module(__name__)
    
    
        bpy.types.INFO_MT_file.prepend(menu_func)
    
    
    
    
    def unregister():
        bpy.utils.register_module(__name__)
    
    
        bpy.types.INFO_MT_file.remove(menu_func)
    
    
    if __name__ == "__main__":
        register()



  2. #2
    I sort of do the same with the command line option --python my_script.py



  3. #3
    Member Spirou4D's Avatar
    Join Date
    Jul 2010
    Location
    Lille, France
    Posts
    1,208
    Thks Meta-Androcto, always a good idea!
    Needed absolutely when you code...Congrats.
    Words are Images that loosed Light!
    Linux Mint 18.1 Serena Bi-Quad Intel 2.66Ghz x64Bytes - Nvidia OpenGL GT 630 4Go-vram



  4. #4
    Member ctdabomb's Avatar
    Join Date
    Apr 2012
    Location
    Halfway there.
    Posts
    1,782
    Sigh, Why did I think this said Robot Blender Addon? I must be stupid today.
    BCMG | STK | Latest project: ___ | Current wip: Jaguar XKR-S
    "" -Albert Einstein



  5. #5



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •