diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-06-10 16:19:39 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-06-10 16:19:39 +0400 |
commit | 4a8f71fc1d3707d3d6abcc5d8528a87339d429ba (patch) | |
tree | a36d48483d289511eed64f0429fa4dde0410f48a /intern/cycles | |
parent | 31e74d00c184960994701950d11287dce13e18df (diff) |
Custom Group Node type for extending existing nodes from python scripts. This is a sort of workaround for the lack of APIs in our existing node systems (compositor, cycles, BI, textures). These systems
don't have any way to deal with scripted node types yet, which could in principle by added with pynodes. The NodeCustomGroup type adds a way of scripting nodes by automating node groups which the
hardcoded system can then interpret like regular groups.
The new NodeCustomGroup type has the basic node_tree pointer property like the regular group node types and also uses the same socket interface system as regular groups. This means that input/output
sockets can be mapped to internal nodes in the same way as regular node groups in renderers and the compositor. On top of that, however, the NodeCustomGroup type can be subclassed in python scripts to flesh out
scripted node types with own draw functions, properties, updates and so on.
NB: Only cycles currently supports this node type and its derivatives, other systems may follow later.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 4fcba2f9021..722b3919580 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -705,10 +705,13 @@ static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, Sha graph->add(proxy); } } - else if (b_node->is_a(&RNA_ShaderNodeGroup)) { + else if (b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup)) { - BL::NodeGroup b_gnode(*b_node); - BL::ShaderNodeTree b_group_ntree(b_gnode.node_tree()); + BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL); + if (b_node->is_a(&RNA_ShaderNodeGroup)) + b_group_ntree = BL::ShaderNodeTree(((BL::NodeGroup)(*b_node)).node_tree()); + else + b_group_ntree = BL::ShaderNodeTree(((BL::NodeCustomGroup)(*b_node)).node_tree()); ProxyMap group_proxy_input_map, group_proxy_output_map; /* Add a proxy node for each socket |