Editor Type Switch 3

Hi this is simple addon i made maybe 1 extra change to.
It adds an icon in:
1/ the 3d view header: switch 3dview with Uv/Image editor & back to 3d view.
2/ the Timeline header: switch to Node editor & back to timeline.
3/ the User preferences: Switch to Text editor& back to User prefs.

(the last one I did :wink: )


Easy stuff, but great for quick change editors if your used to editing files & rendering & need to switch quickly between common editors. This could be extended of course but atm it’s all I need for switching & developing.
Huge thanks to Dustractor, great job & concept, all i did was copy & add the prefs/text editor.
none the less, this is cool for quick dev & switch.

code:



bl_info = {
        "name": "Areatype Toggle Switch",
        "description":"Timeline/Node Editor, 3d View/Image Editor, Prefs/Text Editor",
        "author":"dustractor, meta-androcto",
        "version":(0,1),
        "blender":(2,78,0),
        "location":"First button on the header.",
        "warning":"",
        "wiki_url":"",
        "category": "3D view"
        }

import bpy

class AREATYPE_OT_switch(bpy.types.Operator):
    bl_idname = "areatype.switch"
    bl_label = "areatype.switch"
    switchto = bpy.props.StringProperty()
    def execute(self,context):
        context.area.type = self.switchto
        return {"FINISHED"}

def timedraw(self,context):
    layout = self.layout
    layout.operator("areatype.switch",text="",icon="NODETREE").switchto = "NODE_EDITOR"

def nodedraw(self,context):
    layout = self.layout
    layout.operator("areatype.switch",text="",icon="TIME").switchto = "TIMELINE"

def prefsdraw(self,context):
    layout = self.layout
    layout.operator("areatype.switch",text="",icon="TEXT").switchto = "TEXT_EDITOR"

def textdraw(self,context):
    layout = self.layout
    layout.operator("areatype.switch",text="",icon="PREFERENCES").switchto = "USER_PREFERENCES"

def viewdraw(self,context):
    layout = self.layout
    layout.operator("areatype.switch",text="",icon="IMAGE_COL").switchto = "IMAGE_EDITOR"

def uvdraw(self,context):
    layout = self.layout
    layout.operator("areatype.switch",text="",icon="MESH_CUBE").switchto = "VIEW_3D"

def register():
    bpy.types.TIME_HT_header.prepend(timedraw)
    bpy.types.NODE_HT_header.prepend(nodedraw)
    bpy.types.USERPREF_HT_header.prepend(prefsdraw)
    bpy.types.TEXT_HT_header.prepend(textdraw)
    bpy.types.IMAGE_HT_header.prepend(uvdraw)
    bpy.types.VIEW3D_HT_header.prepend(viewdraw)
    bpy.utils.register_module(__name__)

def unregister():
    bpy.types.TIME_HT_header.remove(timedraw)
    bpy.types.NODE_HT_header.remove(nodedraw)
    bpy.types.USERPREF_HT_header.remove(prefsdraw)
    bpy.types.TEXT_HT_header.remove(textdraw)
    bpy.types.IMAGE_HT_header.remove(uvdraw)
    bpy.types.VIEW3D_HT_header.remove(viewdraw)
 
    bpy.utils.unregister_module(__name__)
    
# The End
if __name__ == "__main__":
    register()



Have fun.

Hello :eyebrowlift2:

Your addon is not bad . . . but for me, I think adding new buttons is not very “productive” !!
Where they are placed, it is even better to use those already present. . . Besides that one can have that part of the header hidden.

Without questioning the usefulness of your addon, for my part I use since version 2.7.1, an addon developed by Pitiwazou (Cedric Lepillier).

On his GitHub (https://github.com/pitiwazou/Scripts-Blender), you will find an addon named “Wazou_View_Menu”.

Again, thanks for sharing that can adapt to other users :yes: