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:
Diffstat (limited to 'source/blender/blenkernel/intern/node.c')
-rw-r--r--source/blender/blenkernel/intern/node.c105
1 files changed, 57 insertions, 48 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index ced88b7e818..838ec24391c 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -36,42 +36,16 @@
#include <string.h>
#include "DNA_anim_types.h"
-#include "DNA_ID.h"
-#include "DNA_image_types.h"
-#include "DNA_node_types.h"
-#include "DNA_material_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_text_types.h"
-#include "DNA_scene_types.h"
#include "RNA_access.h"
-#include "BKE_blender.h"
-#include "BKE_colortools.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_node.h"
-#include "BKE_texture.h"
-#include "BKE_text.h"
-#include "BKE_utildefines.h"
#include "BKE_animsys.h" /* BKE_free_animdata only */
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_rand.h"
-#include "BLI_threads.h"
#include "PIL_time.h"
#include "MEM_guardedalloc.h"
-#include "IMB_imbuf.h"
-
-#include "RE_pipeline.h"
-#include "RE_shader_ext.h" /* <- TexResult */
-#include "RE_render_ext.h" /* <- ibuf_sample() */
#include "CMP_node.h"
#include "intern/CMP_util.h" /* stupid include path... */
@@ -80,7 +54,6 @@
#include "TEX_node.h"
#include "intern/TEX_util.h"
-#include "GPU_extensions.h"
#include "GPU_material.h"
static ListBase empty_list = {NULL, NULL};
@@ -141,7 +114,8 @@ void ntreeInitTypes(bNodeTree *ntree)
}
}
node->typeinfo= stype;
- node->typeinfo->initfunc(node);
+ if(node->typeinfo)
+ node->typeinfo->initfunc(node);
} else {
node->typeinfo= node_get_type(ntree, node->type, (bNodeTree *)node->id, NULL);
}
@@ -1075,11 +1049,11 @@ bNodeTree *ntreeAddTree(int type)
ntree->alltypes.last = NULL;
/* this helps RNA identify ID pointers as nodetree */
- if(ntree->type==NTREE_SHADER)
+ if(ntree->type==NTREE_SHADER)
BLI_strncpy(ntree->id.name, "NTShader Nodetree", sizeof(ntree->id.name));
- else if(ntree->type==NTREE_COMPOSIT)
+ else if(ntree->type==NTREE_COMPOSIT)
BLI_strncpy(ntree->id.name, "NTCompositing Nodetree", sizeof(ntree->id.name));
- else if(ntree->type==NTREE_TEXTURE)
+ else if(ntree->type==NTREE_TEXTURE)
BLI_strncpy(ntree->id.name, "NTTexture Nodetree", sizeof(ntree->id.name));
ntreeInitTypes(ntree);
@@ -1381,9 +1355,9 @@ void ntreeMakeLocal(bNodeTree *ntree)
int local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(ntree->id.lib==NULL) return;
if(ntree->id.us==1) {
@@ -1574,7 +1548,7 @@ bNode *nodeGetActiveID(bNodeTree *ntree, short idtype)
if(ntree==NULL) return NULL;
/* check for group edit */
- for(node= ntree->nodes.first; node; node= node->next)
+ for(node= ntree->nodes.first; node; node= node->next)
if(node->flag & NODE_GROUP_EDIT)
break;
@@ -1598,7 +1572,7 @@ int nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id)
if(ntree==NULL) return ok;
/* check for group edit */
- for(node= ntree->nodes.first; node; node= node->next)
+ for(node= ntree->nodes.first; node; node= node->next)
if(node->flag & NODE_GROUP_EDIT)
break;
@@ -2460,7 +2434,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
bNode *node;
ListBase threads;
ThreadData thdata;
- int totnode, rendering= 1;
+ int totnode, curnode, rendering= 1;
if(ntree==NULL) return;
@@ -2481,7 +2455,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
BLI_srandom(rd->cfra);
/* sets need_exec tags in nodes */
- totnode= setExecutableNodes(ntree, &thdata);
+ curnode = totnode= setExecutableNodes(ntree, &thdata);
BLI_init_threads(&threads, exec_composite_node, rd->threads);
@@ -2491,14 +2465,14 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
node= getExecutableNode(ntree);
if(node) {
- if(ntree->timecursor)
- ntree->timecursor(ntree->tch, totnode);
+ if(ntree->progress && totnode)
+ ntree->progress(ntree->prh, (1.0 - curnode/(float)totnode));
if(ntree->stats_draw) {
char str[64];
- sprintf(str, "Compositing %d %s", totnode, node->name);
+ sprintf(str, "Compositing %d %s", curnode, node->name);
ntree->stats_draw(ntree->sdh, str);
}
- totnode--;
+ curnode--;
node->threaddata = &thdata;
node->exec= NODE_PROCESSING;
@@ -2546,10 +2520,39 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
/* local tree then owns all compbufs */
bNodeTree *ntreeLocalize(bNodeTree *ntree)
{
- bNodeTree *ltree= ntreeCopyTree(ntree, 0);
+ bNodeTree *ltree;
bNode *node;
bNodeSocket *sock;
+ bAction *action_backup= NULL, *tmpact_backup= NULL;
+
+ /* Workaround for copying an action on each render!
+ * set action to NULL so animdata actions dont get copied */
+ AnimData *adt= BKE_animdata_from_id(&ntree->id);
+
+ if(adt) {
+ action_backup= adt->action;
+ tmpact_backup= adt->tmpact;
+
+ adt->action= NULL;
+ adt->tmpact= NULL;
+ }
+
+ /* node copy func */
+ ltree= ntreeCopyTree(ntree, 0);
+
+ if(adt) {
+ AnimData *ladt= BKE_animdata_from_id(&ltree->id);
+
+ adt->action= ladt->action= action_backup;
+ adt->tmpact= ladt->tmpact= tmpact_backup;
+
+ if(action_backup) action_backup->id.us++;
+ if(tmpact_backup) tmpact_backup->id.us++;
+
+ }
+ /* end animdata uglyness */
+
/* move over the compbufs */
/* right after ntreeCopyTree() oldsock pointers are valid */
for(node= ntree->nodes.first; node; node= node->next) {
@@ -2571,6 +2574,8 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
for(sock= node->outputs.first; sock; sock= sock->next) {
sock->new_sock->ns.data= sock->ns.data;
+ compbuf_set_node(sock->new_sock->ns.data, node->new_node);
+
sock->ns.data= NULL;
sock->new_sock->new_sock= sock;
}
@@ -2668,7 +2673,7 @@ static void gpu_from_node_stack(ListBase *sockets, bNodeStack **ns, GPUNodeStack
for (sock=sockets->first, i=0; sock; sock=sock->next, i++) {
memset(&gs[i], 0, sizeof(gs[i]));
- QUATCOPY(gs[i].vec, ns[i]->vec);
+ QUATCOPY(gs[i].vec, ns[i]->vec);
gs[i].link= ns[i]->data;
if (sock->type == SOCK_VALUE)
@@ -2761,7 +2766,7 @@ void ntreeGPUMaterialNodes(bNodeTree *ntree, GPUMaterial *mat)
if(node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
data_from_gpu_stack(&node->outputs, nsout, gpuout);
}
- else if(node->type==NODE_GROUP && node->id) {
+ else if(node->type==NODE_GROUP && node->id) {
node_get_stack(node, stack, nsin, nsout);
gpu_node_group_execute(stack, mat, node, nsin, nsout);
}
@@ -2809,12 +2814,16 @@ static void force_hidden_passes(bNode *node, int passflag)
if(!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_REFRACT);
if(!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL;
- sock= BLI_findlink(&node->outputs, RRES_OUT_RADIO);
- if(!(passflag & SCE_PASS_RADIO)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_INDIRECT);
+ if(!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB);
if(!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_MIST);
if(!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_EMIT);
+ if(!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_ENV);
+ if(!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL;
}
@@ -3017,7 +3026,7 @@ void nodeRegisterType(ListBase *typelist, const bNodeType *ntype)
bNodeType *ntypen= MEM_callocN(sizeof(bNodeType), "node type");
*ntypen= *ntype;
BLI_addtail(typelist, ntypen);
- }
+ }
}
static void registerCompositNodes(ListBase *ntypelist)