2011-10-23 17:52:20 +00:00
|
|
|
/*
|
2011-09-05 21:01:50 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2012-10-15 23:11:59 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2011-09-05 21:01:50 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file blender/nodes/texture/node_texture_tree.c
|
|
|
|
* \ingroup nodes
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "DNA_texture_types.h"
|
|
|
|
#include "DNA_node_types.h"
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "DNA_space_types.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
#include "BLI_listbase.h"
|
|
|
|
#include "BLI_threads.h"
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2011-11-09 15:00:11 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "BKE_context.h"
|
2014-07-16 13:36:39 +09:00
|
|
|
#include "BKE_linestyle.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "BKE_node.h"
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "BKE_paint.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2012-08-06 18:49:28 +00:00
|
|
|
#include "node_common.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "node_exec.h"
|
|
|
|
#include "node_util.h"
|
|
|
|
#include "NOD_texture.h"
|
|
|
|
#include "node_texture_util.h"
|
|
|
|
|
2018-02-06 17:28:00 +11:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "RE_shader_ext.h"
|
|
|
|
|
2018-02-06 17:28:00 +11:00
|
|
|
static void texture_get_from_context(
|
|
|
|
const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2013-03-18 16:34:57 +00:00
|
|
|
SpaceNode *snode = CTX_wm_space_node(C);
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
Object *ob = OBACT(view_layer);
|
2013-03-18 16:34:57 +00:00
|
|
|
Tex *tx = NULL;
|
|
|
|
|
|
|
|
if (snode->texfrom == SNODE_TEX_OBJECT) {
|
|
|
|
if (ob) {
|
|
|
|
tx = give_current_object_texture(ob);
|
|
|
|
if (tx) {
|
|
|
|
if (ob->type == OB_LAMP)
|
2013-05-27 08:04:07 +00:00
|
|
|
*r_from = (ID *)ob->data;
|
2013-03-18 16:34:57 +00:00
|
|
|
else
|
2013-05-27 08:04:07 +00:00
|
|
|
*r_from = (ID *)give_current_material(ob, ob->actcol);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
/* from is not set fully for material nodes, should be ID + Node then */
|
|
|
|
*r_id = &tx->id;
|
|
|
|
*r_ntree = tx->nodetree;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (snode->texfrom == SNODE_TEX_WORLD) {
|
2013-03-19 10:42:33 +00:00
|
|
|
if (scene->world) {
|
2013-03-18 16:34:57 +00:00
|
|
|
*r_from = (ID *)scene->world;
|
2013-03-19 10:42:33 +00:00
|
|
|
tx = give_current_world_texture(scene->world);
|
|
|
|
if (tx) {
|
|
|
|
*r_id = &tx->id;
|
|
|
|
*r_ntree = tx->nodetree;
|
|
|
|
}
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
}
|
2014-05-03 18:51:53 +09:00
|
|
|
else if (snode->texfrom == SNODE_TEX_BRUSH) {
|
2013-03-18 16:34:57 +00:00
|
|
|
struct Brush *brush = NULL;
|
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
if (ob && (ob->mode & OB_MODE_SCULPT))
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
brush = BKE_paint_brush(&scene->toolsettings->sculpt->paint);
|
2013-03-18 16:34:57 +00:00
|
|
|
else
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
brush = BKE_paint_brush(&scene->toolsettings->imapaint.paint);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
if (brush) {
|
|
|
|
*r_from = (ID *)brush;
|
|
|
|
tx = give_current_brush_texture(brush);
|
|
|
|
if (tx) {
|
|
|
|
*r_id = &tx->id;
|
|
|
|
*r_ntree = tx->nodetree;
|
2014-05-03 18:51:53 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (snode->texfrom == SNODE_TEX_LINESTYLE) {
|
2014-07-16 15:13:40 +10:00
|
|
|
FreestyleLineStyle *linestyle = BKE_linestyle_active_from_scene(scene);
|
2014-05-03 18:51:53 +09:00
|
|
|
if (linestyle) {
|
|
|
|
*r_from = (ID *)linestyle;
|
|
|
|
tx = give_current_linestyle_texture(linestyle);
|
|
|
|
if (tx) {
|
|
|
|
*r_id = &tx->id;
|
|
|
|
*r_ntree = tx->nodetree;
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-16 17:15:03 -02:00
|
|
|
static void foreach_nodeclass(ViewRender *UNUSED(view_render), void *calldata, bNodeClassCallback func)
|
2011-11-07 22:14:48 +00:00
|
|
|
{
|
2012-05-16 15:01:46 +00:00
|
|
|
func(calldata, NODE_CLASS_INPUT, N_("Input"));
|
|
|
|
func(calldata, NODE_CLASS_OUTPUT, N_("Output"));
|
|
|
|
func(calldata, NODE_CLASS_OP_COLOR, N_("Color"));
|
|
|
|
func(calldata, NODE_CLASS_PATTERN, N_("Patterns"));
|
|
|
|
func(calldata, NODE_CLASS_TEXTURE, N_("Textures"));
|
|
|
|
func(calldata, NODE_CLASS_CONVERTOR, N_("Convertor"));
|
|
|
|
func(calldata, NODE_CLASS_DISTORT, N_("Distort"));
|
|
|
|
func(calldata, NODE_CLASS_GROUP, N_("Group"));
|
2013-03-18 16:34:57 +00:00
|
|
|
func(calldata, NODE_CLASS_INTERFACE, N_("Interface"));
|
2012-05-16 15:01:46 +00:00
|
|
|
func(calldata, NODE_CLASS_LAYOUT, N_("Layout"));
|
2011-11-07 22:14:48 +00:00
|
|
|
}
|
|
|
|
|
2014-08-12 12:41:26 +02:00
|
|
|
/* XXX muting disabled in previews because of threading issues with the main execution
|
|
|
|
* it works here, but disabled for consistency
|
|
|
|
*/
|
2014-09-17 18:27:05 +02:00
|
|
|
#if 1
|
2012-02-27 17:38:16 +00:00
|
|
|
static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree))
|
|
|
|
{
|
|
|
|
bNode *node, *node_next;
|
|
|
|
|
2012-06-01 12:38:03 +00:00
|
|
|
/* replace muted nodes and reroute nodes by internal links */
|
2012-09-03 02:41:12 +00:00
|
|
|
for (node = localtree->nodes.first; node; node = node_next) {
|
2012-02-27 17:38:16 +00:00
|
|
|
node_next = node->next;
|
|
|
|
|
2012-06-01 12:38:03 +00:00
|
|
|
if (node->flag & NODE_MUTED || node->type == NODE_REROUTE) {
|
2012-02-27 17:38:16 +00:00
|
|
|
nodeInternalRelink(localtree, node);
|
|
|
|
nodeFreeNode(localtree, node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-08-12 12:41:26 +02:00
|
|
|
#else
|
|
|
|
static void localize(bNodeTree *UNUSED(localtree), bNodeTree *UNUSED(ntree))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
2012-02-27 17:38:16 +00:00
|
|
|
|
2013-03-22 10:34:52 +00:00
|
|
|
static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2013-03-22 10:34:52 +00:00
|
|
|
BKE_node_preview_sync_tree(ntree, localtree);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
BKE_node_preview_merge_tree(ntree, localtree, true);
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 18:49:28 +00:00
|
|
|
static void update(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
ntree_update_reroute_nodes(ntree);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
if (ntree->update & NTREE_UPDATE_NODES) {
|
|
|
|
/* clean up preview cache, in case nodes have been removed */
|
|
|
|
BKE_node_preview_remove_unused(ntree);
|
|
|
|
}
|
2012-08-06 18:49:28 +00:00
|
|
|
}
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeTreeType *ntreeType_Texture;
|
|
|
|
|
2013-03-18 18:25:05 +00:00
|
|
|
void register_node_tree_type_tex(void)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
|
|
|
bNodeTreeType *tt = ntreeType_Texture = MEM_callocN(sizeof(bNodeTreeType), "texture node tree type");
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->type = NTREE_TEXTURE;
|
|
|
|
strcpy(tt->idname, "TextureNodeTree");
|
|
|
|
strcpy(tt->ui_name, "Texture");
|
2013-05-27 08:04:07 +00:00
|
|
|
tt->ui_icon = 0; /* defined in drawnode.c */
|
2013-05-28 08:58:27 +00:00
|
|
|
strcpy(tt->ui_description, "Texture nodes");
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->foreach_nodeclass = foreach_nodeclass;
|
|
|
|
tt->update = update;
|
|
|
|
tt->localize = localize;
|
|
|
|
tt->local_sync = local_sync;
|
2013-03-22 10:34:52 +00:00
|
|
|
tt->local_merge = local_merge;
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->get_from_context = texture_get_from_context;
|
|
|
|
|
|
|
|
tt->ext.srna = &RNA_TextureNodeTree;
|
|
|
|
|
|
|
|
ntreeTypeAdd(tt);
|
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
int ntreeTexTagAnimated(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
bNode *node;
|
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
if (ntree == NULL) return 0;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
|
|
|
if (node->type == TEX_NODE_CURVE_TIME) {
|
2011-10-19 17:08:35 +00:00
|
|
|
nodeUpdate(ntree, node);
|
2011-09-05 21:01:50 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2012-09-03 02:41:12 +00:00
|
|
|
else if (node->type == NODE_GROUP) {
|
|
|
|
if (ntreeTexTagAnimated((bNodeTree *)node->id) ) {
|
2011-09-05 21:01:50 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeTreeExec *ntreeTexBeginExecTree_internal(bNodeExecContext *context, bNodeTree *ntree, bNodeInstanceKey parent_key)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
|
|
|
bNodeTreeExec *exec;
|
|
|
|
bNode *node;
|
|
|
|
|
|
|
|
/* common base initialization */
|
2013-03-18 16:34:57 +00:00
|
|
|
exec = ntree_exec_begin(context, ntree, parent_key);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
/* allocate the thread stack listbase array */
|
2015-06-08 13:46:33 +02:00
|
|
|
exec->threadstack = MEM_callocN(BLENDER_MAX_THREADS * sizeof(ListBase), "thread stack array");
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
for (node = exec->nodetree->nodes.first; node; node = node->next)
|
|
|
|
node->need_exec = 1;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
return exec;
|
|
|
|
}
|
|
|
|
|
|
|
|
bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
bNodeExecContext context;
|
|
|
|
bNodeTreeExec *exec;
|
|
|
|
|
|
|
|
/* XXX hack: prevent exec data from being generated twice.
|
|
|
|
* this should be handled by the renderer!
|
|
|
|
*/
|
|
|
|
if (ntree->execdata)
|
|
|
|
return ntree->execdata;
|
|
|
|
|
|
|
|
context.previews = ntree->previews;
|
|
|
|
|
|
|
|
exec = ntreeTexBeginExecTree_internal(&context, ntree, NODE_INSTANCE_KEY_BASE);
|
|
|
|
|
|
|
|
/* XXX this should not be necessary, but is still used for cmp/sha/tex nodes,
|
|
|
|
* which only store the ntree pointer. Should be fixed at some point!
|
|
|
|
*/
|
|
|
|
ntree->execdata = exec;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
return exec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free texture delegates */
|
|
|
|
static void tex_free_delegates(bNodeTreeExec *exec)
|
|
|
|
{
|
|
|
|
bNodeThreadStack *nts;
|
|
|
|
bNodeStack *ns;
|
|
|
|
int th, a;
|
|
|
|
|
2015-06-08 13:46:33 +02:00
|
|
|
for (th = 0; th < BLENDER_MAX_THREADS; th++)
|
2012-09-03 02:41:12 +00:00
|
|
|
for (nts = exec->threadstack[th].first; nts; nts = nts->next)
|
|
|
|
for (ns = nts->stack, a = 0; a < exec->stacksize; a++, ns++)
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ns->data && !ns->is_copy)
|
2011-09-05 21:01:50 +00:00
|
|
|
MEM_freeN(ns->data);
|
|
|
|
}
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
void ntreeTexEndExecTree_internal(bNodeTreeExec *exec)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeThreadStack *nts;
|
|
|
|
int a;
|
|
|
|
|
|
|
|
if (exec->threadstack) {
|
|
|
|
tex_free_delegates(exec);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2015-06-08 13:46:33 +02:00
|
|
|
for (a = 0; a < BLENDER_MAX_THREADS; a++) {
|
2013-03-18 16:34:57 +00:00
|
|
|
for (nts = exec->threadstack[a].first; nts; nts = nts->next)
|
|
|
|
if (nts->stack) MEM_freeN(nts->stack);
|
|
|
|
BLI_freelistN(&exec->threadstack[a]);
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
MEM_freeN(exec->threadstack);
|
|
|
|
exec->threadstack = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ntree_exec_end(exec);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ntreeTexEndExecTree(bNodeTreeExec *exec)
|
|
|
|
{
|
|
|
|
if (exec) {
|
2013-07-27 08:21:43 +00:00
|
|
|
/* exec may get freed, so assign ntree */
|
|
|
|
bNodeTree *ntree = exec->nodetree;
|
2013-03-18 16:34:57 +00:00
|
|
|
ntreeTexEndExecTree_internal(exec);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
|
2013-07-27 08:21:43 +00:00
|
|
|
ntree->execdata = NULL;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int ntreeTexExecTree(
|
2012-10-15 23:11:59 +00:00
|
|
|
bNodeTree *nodes,
|
|
|
|
TexResult *texres,
|
|
|
|
float co[3],
|
|
|
|
float dxt[3], float dyt[3],
|
|
|
|
int osatex,
|
|
|
|
const short thread,
|
|
|
|
Tex *UNUSED(tex),
|
|
|
|
short which_output,
|
|
|
|
int cfra,
|
|
|
|
int preview,
|
|
|
|
ShadeInput *shi,
|
|
|
|
MTex *mtex)
|
|
|
|
{
|
2011-09-05 21:01:50 +00:00
|
|
|
TexCallData data;
|
2012-09-03 02:41:12 +00:00
|
|
|
float *nor = texres->nor;
|
2011-09-05 21:01:50 +00:00
|
|
|
int retval = TEX_INT;
|
|
|
|
bNodeThreadStack *nts = NULL;
|
2012-09-03 02:41:12 +00:00
|
|
|
bNodeTreeExec *exec = nodes->execdata;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
data.co = co;
|
|
|
|
data.dxt = dxt;
|
|
|
|
data.dyt = dyt;
|
|
|
|
data.osatex = osatex;
|
|
|
|
data.target = texres;
|
|
|
|
data.do_preview = preview;
|
2015-05-03 15:06:17 +02:00
|
|
|
data.do_manage = (shi) ? shi->do_manage : true;
|
2011-09-05 21:01:50 +00:00
|
|
|
data.thread = thread;
|
|
|
|
data.which_output = which_output;
|
2012-09-03 02:41:12 +00:00
|
|
|
data.cfra = cfra;
|
|
|
|
data.mtex = mtex;
|
|
|
|
data.shi = shi;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2011-10-31 17:00:59 +00:00
|
|
|
/* ensure execdata is only initialized once */
|
|
|
|
if (!exec) {
|
2018-02-16 01:13:46 +11:00
|
|
|
BLI_thread_lock(LOCK_NODES);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!nodes->execdata)
|
2013-03-18 16:34:57 +00:00
|
|
|
ntreeTexBeginExecTree(nodes);
|
2018-02-16 01:13:46 +11:00
|
|
|
BLI_thread_unlock(LOCK_NODES);
|
2011-10-31 17:00:59 +00:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
exec = nodes->execdata;
|
2011-10-31 17:00:59 +00:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2012-09-03 02:41:12 +00:00
|
|
|
nts = ntreeGetThreadStack(exec, thread);
|
2011-09-05 21:01:50 +00:00
|
|
|
ntreeExecThreadNodes(exec, nts, &data, thread);
|
|
|
|
ntreeReleaseThreadStack(nts);
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (texres->nor) retval |= TEX_NOR;
|
2011-09-05 21:01:50 +00:00
|
|
|
retval |= TEX_RGB;
|
|
|
|
/* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set
|
2012-06-30 22:49:33 +00:00
|
|
|
* however, the texture code checks this for other reasons (namely, a normal is required for material) */
|
2012-09-03 02:41:12 +00:00
|
|
|
texres->nor = nor;
|
2011-09-05 21:01:50 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|