Is it possible to add a new button to an existing panel or an existing node that runs a custom operator?
How can I do this?
Yes. You need to find the class that defines that panel (usually pretty easy to do by right-clicking a button or setting in the panel and choosing Edit Source). From there, you just need to define a function and append it to that class. As an example, I do this in my Render Music add-on (in __init__.py, starting at line 82). Below is the relevant example that adds two checkboxes (properties defined by the add-on) to the Render Panel (RENDER_PT_render):
def render_panel(self, context):
user_prefs = context.user_preferences
addon_prefs = user_prefs.addons[__package__].preferences
layout = self.layout
layout.prop(addon_prefs, "use_play")
layout.prop(addon_prefs, "use_end")
# Registration
def register():
bpy.types.RENDER_PT_render.append(render_panel)
# Unregistration
def unregister():
bpy.types.RENDER_PT_render.remove(render_panel)
removeinstead ofappend. – JakeD Nov 16 '16 at 03:27