diff options
Diffstat (limited to 'source/blender/nodes/texture')
5 files changed, 11 insertions, 60 deletions
diff --git a/source/blender/nodes/texture/CMakeLists.txt b/source/blender/nodes/texture/CMakeLists.txt index 5bed54ebfd7..2ccdf4c0bc9 100644 --- a/source/blender/nodes/texture/CMakeLists.txt +++ b/source/blender/nodes/texture/CMakeLists.txt @@ -15,6 +15,7 @@ set(INC ../../render ../../windowmanager ../../../../intern/guardedalloc + ../../bmesh # RNA_prototypes.h ${CMAKE_BINARY_DIR}/source/blender/makesrna ) diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 903e293a962..3f8ff85306d 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -18,6 +18,7 @@ #include "BLT_translation.h" #include "BKE_context.h" +#include "BKE_layer.h" #include "BKE_linestyle.h" #include "BKE_node.h" #include "BKE_paint.h" @@ -46,7 +47,7 @@ static void texture_get_from_context(const bContext *C, SpaceNode *snode = CTX_wm_space_node(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); Tex *tx = NULL; if (snode->texfrom == SNODE_TEX_BRUSH) { @@ -140,6 +141,7 @@ void register_node_tree_type_tex(void) tt->type = NTREE_TEXTURE; strcpy(tt->idname, "TextureNodeTree"); + strcpy(tt->group_idname, "TextureNodeGroup"); strcpy(tt->ui_name, N_("Texture Node Editor")); tt->ui_icon = ICON_NODE_TEXTURE; /* Defined in `drawnode.c`. */ strcpy(tt->ui_description, N_("Texture nodes")); @@ -324,7 +326,6 @@ int ntreeTexExecTree(bNodeTree *ntree, MTex *mtex) { TexCallData data; - float *nor = target->nor; int retval = TEX_INT; bNodeThreadStack *nts = NULL; bNodeTreeExec *exec = ntree->execdata; @@ -356,14 +357,7 @@ int ntreeTexExecTree(bNodeTree *ntree, ntreeExecThreadNodes(exec, nts, &data, thread); ntreeReleaseThreadStack(nts); - if (target->nor) { - retval |= TEX_NOR; - } retval |= TEX_RGB; - /* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was - * set however, the texture code checks this for other reasons - * (namely, a normal is required for material). */ - target->nor = nor; return retval; } diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index cf5e32cb486..b300ba9ef77 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -13,7 +13,6 @@ /* **************** COMPOSITE ******************** */ static bNodeSocketTemplate inputs[] = { {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION}, {-1, ""}, }; @@ -32,12 +31,7 @@ static void exec(void *data, TexParams params; params_from_cdata(¶ms, cdata); - if (in[1] && in[1]->hasinput && !in[0]->hasinput) { - tex_input_rgba(target->trgba, in[1], ¶ms, cdata->thread); - } - else { - tex_input_rgba(target->trgba, in[0], ¶ms, cdata->thread); - } + tex_input_rgba(target->trgba, in[0], ¶ms, cdata->thread); } else { /* 0 means don't care, so just use first */ @@ -49,15 +43,6 @@ static void exec(void *data, target->tin = (target->trgba[0] + target->trgba[1] + target->trgba[2]) / 3.0f; target->talpha = true; - - if (target->nor) { - if (in[1] && in[1]->hasinput) { - tex_input_vec(target->nor, in[1], ¶ms, cdata->thread); - } - else { - target->nor = NULL; - } - } } } } diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c index fd7e6fdfc7f..d925c9f3554 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.c +++ b/source/blender/nodes/texture/nodes/node_texture_proc.c @@ -14,10 +14,8 @@ * In this file: wrappers to use procedural textures as nodes */ -static bNodeSocketTemplate outputs_both[] = { - {SOCK_RGBA, N_("Color"), 1.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION}, - {-1, ""}}; +static bNodeSocketTemplate outputs_both[] = {{SOCK_RGBA, N_("Color"), 1.0f, 0.0f, 0.0f, 1.0f}, + {-1, ""}}; static bNodeSocketTemplate outputs_color_only[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}}; /* Inputs common to all, #defined because nodes will need their own inputs too */ @@ -34,27 +32,15 @@ static void do_proc(float *result, TexParams *p, const float col1[4], const float col2[4], - char is_normal, Tex *tex, const short thread) { TexResult texres; int textype; - if (is_normal) { - texres.nor = result; - } - else { - texres.nor = NULL; - } - textype = multitex_nodes( tex, p->co, p->dxt, p->dyt, p->osatex, &texres, thread, 0, p->mtex, NULL); - if (is_normal) { - return; - } - if (textype & TEX_RGB) { copy_v4_v4(result, texres.trgba); } @@ -66,13 +52,8 @@ static void do_proc(float *result, typedef void (*MapFn)(Tex *tex, bNodeStack **in, TexParams *p, const short thread); -static void texfn(float *result, - TexParams *p, - bNode *node, - bNodeStack **in, - char is_normal, - MapFn map_inputs, - short thread) +static void texfn( + float *result, TexParams *p, bNode *node, bNodeStack **in, MapFn map_inputs, short thread) { Tex tex = *((Tex *)(node->storage)); float col1[4], col2[4]; @@ -81,7 +62,7 @@ static void texfn(float *result, map_inputs(&tex, in, p, thread); - do_proc(result, p, col1, col2, is_normal, &tex, thread); + do_proc(result, p, col1, col2, &tex, thread); } static int count_outputs(bNode *node) @@ -106,12 +87,7 @@ static int count_outputs(bNode *node) static void name##_colorfn( \ float *result, TexParams *p, bNode *node, bNodeStack **in, short thread) \ { \ - texfn(result, p, node, in, 0, &name##_map_inputs, thread); \ - } \ - static void name##_normalfn( \ - float *result, TexParams *p, bNode *node, bNodeStack **in, short thread) \ - { \ - texfn(result, p, node, in, 1, &name##_map_inputs, thread); \ + texfn(result, p, node, in, &name##_map_inputs, thread); \ } \ static void name##_exec(void *data, \ int UNUSED(thread), \ @@ -124,9 +100,6 @@ static int count_outputs(bNode *node) if (outs >= 1) { \ tex_output(node, execdata, in, out[0], &name##_colorfn, data); \ } \ - if (outs >= 2) { \ - tex_output(node, execdata, in, out[1], &name##_normalfn, data); \ - } \ } /* --- VORONOI -- */ diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index 2d2b4e06665..79cd8bbb1df 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -45,13 +45,11 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor else if (nodetex) { TexResult texres; int textype; - float nor[] = {0, 0, 0}; float col1[4], col2[4]; tex_input_rgba(col1, in[0], p, thread); tex_input_rgba(col2, in[1], p, thread); - texres.nor = nor; textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex, &texres, thread, 0, p->mtex, NULL); if (textype & TEX_RGB) { |