Commit: 1b06e3378a750774cd7da76ab61f86476f7087cc
Author: Miguel Porces
Date:   Mon Mar 18 11:16:34 2019 +0100
Branches: master
https://developer.blender.org/rB1b06e3378a750774cd7da76ab61f86476f7087cc

Fix T62670: insert_link() method not working for ShaderNodeCustomGroup.

Allow Python to override this method.

Differential Revision: https://developer.blender.org/D4537

===================================================================

M       source/blender/nodes/composite/nodes/node_composite_common.c
M       source/blender/nodes/shader/nodes/node_shader_common.c

===================================================================

diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c 
b/source/blender/nodes/composite/nodes/node_composite_common.c
index f9a6961c47b..480b9f1e989 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.c
+++ b/source/blender/nodes/composite/nodes/node_composite_common.c
@@ -59,6 +59,14 @@ void register_node_type_cmp_group(void)
 
 void register_node_type_cmp_custom_group(bNodeType *ntype)
 {
-       ntype->insert_link = node_insert_link_default;
-       ntype->update_internal_links = node_update_internal_links_default;
+       /* These methods can be overriden but need a default implementation 
otherwise. */
+       if (ntype->poll == NULL) {
+               ntype->poll = cmp_node_poll_default;
+       }
+       if (ntype->insert_link == NULL) {
+               ntype->insert_link = node_insert_link_default;
+       }
+       if (ntype->update_internal_links == NULL) {
+               ntype->update_internal_links = 
node_update_internal_links_default;
+       }
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c 
b/source/blender/nodes/shader/nodes/node_shader_common.c
index 0c2b8d939f5..8596c770c62 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.c
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -242,8 +242,17 @@ void register_node_type_sh_group(void)
 
 void register_node_type_sh_custom_group(bNodeType *ntype)
 {
-       ntype->insert_link = node_insert_link_default;
-       ntype->update_internal_links = node_update_internal_links_default;
+       /* These methods can be overriden but need a default implementation 
otherwise. */
+       if (ntype->poll == NULL) {
+               ntype->poll = sh_node_poll_default;
+       }
+       if (ntype->insert_link == NULL) {
+               ntype->insert_link = node_insert_link_default;
+       }
+       if (ntype->update_internal_links == NULL) {
+               ntype->update_internal_links = 
node_update_internal_links_default;
+       }
+
        node_type_exec(ntype, group_initexec, group_freeexec, group_execute);
        node_type_gpu(ntype, gpu_group_execute);
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to