diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-03-19 17:40:16 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-03-19 17:40:16 +0400 |
commit | bbac76ee2669481132f69fee45b9086a5bd4c695 (patch) | |
tree | 193f03631a900b3e3d4d1cc20f6e18be1c7c72ca /source/blender/editors/space_node/node_buttons.c | |
parent | c9d981c86da7b3a580410a27afdec1e67f446a48 (diff) |
Nicer handling of undefined node, tree and socket types.
When nodes are loaded from a .blend file they can potentially have undefined types. This can happen if a type has been deprecated and removed, or if node types were defined in a python script that has not been loaded correctly. Previously all such nodes would automatically be removed from a node tree, assuming that their types were deprecated and no longer in use (more commonly caused by loading new nodes in an older Blender version). Due to the possibility of dynamic registration it is no longer feasible to simply delete such nodes.
Display and handling of node trees was simply disabled before this patch, so that a node tree where any node or socket type was undefined would not be displayed at all. To give more information and avoid problems caused by necessary checks for the typeinfo pointer, there is now a 'Undefined' fallback type for trees, nodes and sockets. These types are used as placeholders in case the real type is not registered and can provide useful visual feedback on undefined nodes.
Diffstat (limited to 'source/blender/editors/space_node/node_buttons.c')
-rw-r--r-- | source/blender/editors/space_node/node_buttons.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 688377c7f3b..efdb7c0d85d 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -62,7 +62,7 @@ static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode = CTX_wm_space_node(C); - return (snode && ntreeIsValid(snode->nodetree)); + return (snode && snode->nodetree); } /* poll callback for active node */ @@ -70,7 +70,7 @@ static int active_node_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode = CTX_wm_space_node(C); - return (snode && ntreeIsValid(snode->edittree) && nodeGetActive(snode->edittree)); + return (snode && snode->edittree && nodeGetActive(snode->edittree)); } /* active node */ |