Page MenuHome

Node Wrangler - limit access for built-in tree types
ClosedPublic

Authored by Christian Brinkmann (poor) on Sep 28 2016, 4:28 PM.

Details

Summary

There are a few operators and menus (Merge Selected Node, Switch Node Type, etc.) which don't work well with custom node tree add-ons like Animation nodes or Sverchok - reported here. This patch avoids that the panel and the operators are accessible within custom node trees.


Another approach would be adding a check to all menu items as well as adding poll methods to the operators in order to provide at least all basic functionality like Swap Links, Add Reroutes, Link Active to Selected and so on, but I'm not sure whether it's worth it :)

Mockup

Implementation proposal

#
#  P A N E L
#

def drawlayout(context, layout, mode='non-panel'):
    tree_type = context.space_data.tree_type
    valid_trees = ["ShaderNodeTree", "CompositorNodeTree", "TextureNodeTree"]
    supported = bool([i for i in valid_trees if tree_type in valid_trees])

    if supported:
        col = layout.column(align=True)
        col.menu(NWMergeNodesMenu.bl_idname)
        col.separator()

        col = layout.column(align=True)
        col.menu(NWSwitchNodeTypeMenu.bl_idname, text="Switch Node Type")
        col.separator()

    if tree_type == 'ShaderNodeTree' and context.scene.render.engine == 'CYCLES':
        col = layout.column(align=True)
        col.operator(NWAddTextureSetup.bl_idname, text="Add Texture Setup", icon='NODE_SEL')
        col.separator()

Diff Detail

Event Timeline

Christian Brinkmann (poor) retitled this revision from to Node Wrangler - Limit panel visibility to built-in tree types.Sep 28 2016, 4:28 PM
Christian Brinkmann (poor) updated this object.
Christian Brinkmann (poor) set the repository for this revision to rBA Blender Add-ons.
Christian Brinkmann (poor) updated this revision to Diff 7526.
Christian Brinkmann (poor) retitled this revision from Node Wrangler - Limit panel visibility to built-in tree types to Node Wrangler - limit access for built-in tree types.Sep 28 2016, 9:12 PM
Christian Brinkmann (poor) updated this object.
Christian Brinkmann (poor) removed rBA Blender Add-ons as the repository for this revision.
Christian Brinkmann (poor) updated this revision to Diff 7527.

I'm sorry, I just noticed that you can still access the operators and shortcuts - moved the lines to nw_check().

Greg Zaal (gregzaal) accepted this revision.
This revision is now accepted and ready to land.Sep 30 2016, 10:27 AM