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! :)
This commit is contained in:
Thomas Dinges 2012-04-13 11:58:16 +00:00
parent a1e6e75add
commit 3578a93eb8

@ -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);
}