diff options
author | Thomas Dinges <blender@dingto.org> | 2012-04-13 15:58:16 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2012-04-13 15:58:16 +0400 |
commit | 3578a93eb830002b41925a769e180bad77764ed2 (patch) | |
tree | 2f598188d59bf7098f98de50a3bdac06814e1a1f /source/blender/editors/space_node | |
parent | a1e6e75adda2499cb1dc2f7102b79a9927c7bdef (diff) |
Node Editor / Properties Region:
* Improved checks for Grease Pencil and Active Node panel, so the panel only gets shown when there is valid data, rather than showing the empty panel.
Thanks to Lukas Tönne for some help! :)
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/node_buttons.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 49151cc5dcd..c67cb5f7c71 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -65,13 +65,20 @@ /* ******************* node space & buttons ************** */ +/* poll for active nodetree */ +static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt)) +{ + SpaceNode *snode= CTX_wm_space_node(C); + + return (snode && snode->nodetree); +} + /* poll callback for active node */ static int active_node_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode= CTX_wm_space_node(C); - // TODO: include check for whether there is an active node... - return (snode && snode->nodetree); + return (snode && snode->edittree && nodeGetActive(snode->edittree)); } /* active node */ @@ -160,7 +167,7 @@ void node_buttons_register(ARegionType *art) strcpy(pt->idname, "NODE_PT_gpencil"); strcpy(pt->label, "Grease Pencil"); pt->draw= gpencil_panel_standard; - pt->poll= active_node_poll; + pt->poll= active_nodetree_poll; BLI_addtail(&art->paneltypes, pt); } |