From 87f75299e1b07fd026ecdfa1c993130a60d65280 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Fri, 11 Jul 2014 16:51:04 +0900 Subject: Implemented a basic framework for node-based shaders. Shader nodes will be used to define materials for stroke rendering, so as to allow users to interactively configure textures. --- source/blender/nodes/CMakeLists.txt | 4 ++++ source/blender/nodes/SConscript | 3 +++ source/blender/nodes/shader/node_shader_tree.c | 11 +++++++++++ 3 files changed, 18 insertions(+) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index e09a0892370..b485d7d86d2 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -277,4 +277,8 @@ if(WITH_COMPOSITOR) add_definitions(-DWITH_COMPOSITOR) endif() +if(WITH_FREESTYLE) + add_definitions(-DWITH_FREESTYLE) +endif() + blender_add_lib(bf_nodes "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript index 683a1c475e4..becf6e79d44 100644 --- a/source/blender/nodes/SConscript +++ b/source/blender/nodes/SConscript @@ -72,6 +72,9 @@ if env['WITH_BF_COMPOSITOR']: incs += ' ../compositor ' defs.append("WITH_COMPOSITOR") +if env['WITH_BF_FREESTYLE']: + defs.append('WITH_FREESTYLE') + env.BlenderLib ( libname = 'bf_nodes', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [190,105] ) env.BlenderLib ( libname = 'bf_cmpnodes', sources = cmpsources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [175,101] ) env.BlenderLib ( libname = 'bf_shdnodes', sources = shdsources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [175,101] ) diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 4288b8fbcdc..629bd7eeea6 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -38,6 +38,7 @@ #include "DNA_scene_types.h" #include "DNA_space_types.h" #include "DNA_world_types.h" +#include "DNA_linestyle_types.h" #include "BLI_listbase.h" #include "BLI_math.h" @@ -97,6 +98,16 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre } } } +#ifdef WITH_FREESTYLE + else if (snode->shaderfrom == SNODE_SHADER_LINESTYLE) { + FreestyleLineStyle *linestyle = CTX_data_linestyle_from_scene(scene); + if (linestyle) { + *r_from = NULL; + *r_id = &linestyle->id; + *r_ntree = linestyle->nodetree; + } + } +#endif else { /* SNODE_SHADER_WORLD */ if (scene->world) { *r_from = NULL; -- cgit v1.2.3