Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-03 18:32:26 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-03 18:32:26 +0400
commite02b23b81ab05579c0ee11ee3a1acb283643e528 (patch)
tree59b14c01bcb4c274d57c89a42e5a5d80c41ff06d /source/blender/editors/space_node/drawnode.c
parent615fe0295fe13c229d7376b02a50ac110b636c47 (diff)
Render API: shader script node for custom shaders.
* Shader script node added, which stores either a link to a text datablock or file on disk, and has functions to add and remove sockets. * Callback RenderEngine.update_script_node(self, node) added for render engines to compile the shader and update the node with new sockets. Thanks to Thomas, Lukas and Dalai for the implementation.
Diffstat (limited to 'source/blender/editors/space_node/drawnode.c')
-rw-r--r--source/blender/editors/space_node/drawnode.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 420f0f1c413..f25fed3f6bb 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1384,6 +1384,34 @@ static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), Point
uiItemR(layout, ptr, "distribution", 0, "", ICON_NONE);
}
+static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiLayout *row;
+
+ row = uiLayoutRow(layout, FALSE);
+ uiItemR(row, ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+ row = uiLayoutRow(layout, TRUE);
+
+ if(RNA_enum_get(ptr, "mode") == NODE_SCRIPT_INTERNAL)
+ uiItemR(row, ptr, "script", 0, "", ICON_NONE);
+ else
+ uiItemR(row, ptr, "filepath", 0,"", ICON_NONE);
+
+ uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update");
+}
+
+static void node_shader_buts_script_details(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiItemS(layout);
+
+ node_shader_buts_script(layout, C, ptr);
+
+ /* not implemented yet
+ if(RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL)
+ uiItemR(layout, ptr, "use_auto_update", 0, NULL, ICON_NONE);*/
+}
+
/* only once called */
static void node_shader_set_butfunc(bNodeType *ntype)
{
@@ -1467,6 +1495,10 @@ static void node_shader_set_butfunc(bNodeType *ntype)
case SH_NODE_BSDF_GLASS:
ntype->uifunc = node_shader_buts_glossy;
break;
+ case SH_NODE_SCRIPT:
+ ntype->uifunc = node_shader_buts_script;
+ ntype->uifuncbut = node_shader_buts_script_details;
+ break;
}
}