void TextureBaseOperation::initExecution() { this->m_inputOffset = getInputSocketReader(0); this->m_inputSize = getInputSocketReader(1); this->m_pool = BKE_image_pool_new(); if (this->m_texture != NULL && this->m_texture->nodetree != NULL && this->m_texture->use_nodes) { ntreeTexBeginExecTree(this->m_texture->nodetree); } NodeOperation::initExecution(); }
static void *group_initexec(bNode *node) { bNodeTree *ngroup= (bNodeTree*)node->id; void *exec; /* initialize the internal node tree execution */ exec = ntreeTexBeginExecTree(ngroup, 0); return exec; }
int ntreeTexExecTree( 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) { TexCallData data; float *nor = texres->nor; int retval = TEX_INT; bNodeThreadStack *nts = NULL; bNodeTreeExec *exec = nodes->execdata; data.co = co; data.dxt = dxt; data.dyt = dyt; data.osatex = osatex; data.target = texres; data.do_preview = preview; data.do_manage = (shi) ? shi->do_manage : true; data.thread = thread; data.which_output = which_output; data.cfra = cfra; data.mtex = mtex; data.shi = shi; /* ensure execdata is only initialized once */ if (!exec) { BLI_lock_thread(LOCK_NODES); if (!nodes->execdata) ntreeTexBeginExecTree(nodes); BLI_unlock_thread(LOCK_NODES); exec = nodes->execdata; } nts = ntreeGetThreadStack(exec, thread); ntreeExecThreadNodes(exec, nts, &data, thread); ntreeReleaseThreadStack(nts); if (texres->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) */ texres->nor = nor; return retval; }
/* check if texture nodes need exec or end */ static void ntree_composite_texnode(bNodeTree *ntree, int init) { bNode *node; for (node= ntree->nodes.first; node; node= node->next) { if (node->type==CMP_NODE_TEXTURE && node->id) { Tex *tex= (Tex *)node->id; if (tex->nodetree && tex->use_nodes) { /* has internal flag to detect it only does it once */ if (init) { if (!tex->nodetree->execdata) tex->nodetree->execdata = ntreeTexBeginExecTree(tex->nodetree, 1); } else ntreeTexEndExecTree(tex->nodetree->execdata, 1); tex->nodetree->execdata = NULL; } } } }