diff options
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_composite.c | 6 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_curves.c | 7 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_defocus.c | 2 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_image.c | 7 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c | 26 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_texture.c | 10 | ||||
-rw-r--r-- | source/blender/nodes/intern/TEX_nodes/TEX_curves.c | 9 | ||||
-rw-r--r-- | source/blender/nodes/intern/TEX_util.c | 5 | ||||
-rw-r--r-- | source/blender/nodes/intern/TEX_util.h | 3 |
9 files changed, 40 insertions, 35 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c index 89bd8e43694..8e47e17d868 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c @@ -46,9 +46,11 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i /* stack order input sockets: col, alpha, z */ if(node->flag & NODE_DO_OUTPUT) { /* only one works on out */ + Scene *scene= (Scene *)node->id; RenderData *rd= data; - if(rd->scemode & R_DOCOMP) { - RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name)); /* G.scene is WEAK! */ + + if(scene && (rd->scemode & R_DOCOMP)) { + RenderResult *rr= RE_GetResult(RE_GetRender(scene->id.name)); /* G.scene is WEAK! */ if(rr) { CompBuf *outbuf, *zbuf=NULL; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c index 01af0e1db1d..3d536788263 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c @@ -40,11 +40,12 @@ static bNodeSocketType cmp_node_time_out[]= { static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { + RenderData *rd= data; /* stack order output: fac */ float fac= 0.0f; if(node->custom1 < node->custom2) - fac= (G.scene->r.cfra - node->custom1)/(float)(node->custom2-node->custom1); + fac= (rd->cfra - node->custom1)/(float)(node->custom2-node->custom1); fac= curvemapping_evaluateF(node->storage, 0, fac); out[0]->vec[0]= CLAMPIS(fac, 0.0f, 1.0f); @@ -53,8 +54,8 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack * static void node_composit_init_curves_time(bNode* node) { - node->custom1= G.scene->r.sfra; - node->custom2= G.scene->r.efra; + node->custom1= 1; + node->custom2= 250; node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c index 6f175671296..b9a4f4c0cc5 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c @@ -253,7 +253,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // get some required params from the current scene camera // (ton) this is wrong, needs fixed - Object* camob = G.scene->camera; + Object* camob = NULL; // XXX G.scene->camera; if (camob && camob->type==OB_CAMERA) { Camera* cam = (Camera*)camob->data; cam_lens = cam->lens; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index be5a1d7241b..396df4ff402 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -330,11 +330,12 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - Scene *sce= node->id?(Scene *)node->id:G.scene; /* G.scene is WEAK! */ + Scene *sce= (Scene *)node->id; RenderData *rd= data; - RenderResult *rr; + RenderResult *rr= NULL; - rr= RE_GetResult(RE_GetRender(sce->id.name)); + if(sce) + rr= RE_GetResult(RE_GetRender(sce->id.name)); if(rr) { SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c index 722b00d57a9..8c63c348b57 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c @@ -62,9 +62,9 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * } } - BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype); + BKE_makepicstring((Scene *)node->id, string, nif->name, rd->cfra, nif->imtype); - if(0 == BKE_write_ibuf(ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality)) + if(0 == BKE_write_ibuf((Scene *)node->id, ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality)) printf("Cannot save Node File Output to %s\n", string); else printf("Saved: %s\n", string); @@ -81,15 +81,19 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * static void node_composit_init_output_file(bNode *node) { - NodeImageFile *nif= MEM_callocN(sizeof(NodeImageFile), "node image file"); - node->storage= nif; - BLI_strncpy(nif->name, G.scene->r.pic, sizeof(nif->name)); - nif->imtype= G.scene->r.imtype; - nif->subimtype= G.scene->r.subimtype; - nif->quality= G.scene->r.quality; - nif->sfra= G.scene->r.sfra; - nif->efra= G.scene->r.efra; -}; + Scene *scene= (Scene *)node->id; + NodeImageFile *nif= MEM_callocN(sizeof(NodeImageFile), "node image file"); + node->storage= nif; + + if(scene) { + BLI_strncpy(nif->name, scene->r.pic, sizeof(nif->name)); + nif->imtype= scene->r.imtype; + nif->subimtype= scene->r.subimtype; + nif->quality= scene->r.quality; + nif->sfra= scene->r.sfra; + nif->efra= scene->r.efra; + } +} bNodeType cmp_node_output_file= { /* *next,*prev */ NULL, NULL, diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c index c1f1948dba1..b4d04076032 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c @@ -91,19 +91,13 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, if(node->id) { RenderData *rd= data; - RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name)); /* G.scene is WEAK! */ short sizex, sizey; /* first make the preview image */ CompBuf *prevbuf= alloc_compbuf(140, 140, CB_RGBA, 1); /* alloc */ - if (rr) { - sizex = rr->rectx; - sizey = rr->recty; - } else { - sizex = rd->xsch; - sizey = rd->ysch; - } + sizex = rd->xsch; + sizey = rd->ysch; prevbuf->rect_procedural= texture_procedural; prevbuf->node= node; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c index 8c86656b4f3..7d1366b5b18 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c @@ -41,8 +41,9 @@ static void time_colorfn(float *out, float *coord, bNode *node, bNodeStack **in, /* stack order output: fac */ float fac= 0.0f; - if(node->custom1 < node->custom2) - fac = (G.scene->r.cfra - node->custom1)/(float)(node->custom2-node->custom1); + // XXX SOLVE! these functions should get the TexCallData pointer +// if(node->custom1 < node->custom2) +// fac = (scene->r.cfra - node->custom1)/(float)(node->custom2-node->custom1); fac = curvemapping_evaluateF(node->storage, 0, fac); out[0] = CLAMPIS(fac, 0.0f, 1.0f); @@ -56,8 +57,8 @@ static void time_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out static void time_init(bNode* node) { - node->custom1= G.scene->r.sfra; - node->custom2= G.scene->r.efra; + node->custom1= 1; + node->custom2= 250; node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c index 562072328a8..2ff9717afa6 100644 --- a/source/blender/nodes/intern/TEX_util.c +++ b/source/blender/nodes/intern/TEX_util.c @@ -185,7 +185,7 @@ void ntreeTexCheckCyclics(struct bNodeTree *ntree) } } -void ntreeTexExecTree(bNodeTree *nodes, TexResult *texres, float *coord, char do_preview, short thread, Tex *tex, short which_output) +void ntreeTexExecTree(bNodeTree *nodes, TexResult *texres, float *coord, char do_preview, short thread, Tex *tex, short which_output, int cfra) { TexResult dummy_texres; TexCallData data; @@ -196,6 +196,7 @@ void ntreeTexExecTree(bNodeTree *nodes, TexResult *texres, float *coord, char do data.do_preview = do_preview; data.thread = thread; data.which_output = which_output; + data.cfra= cfra; ntreeExecTree(nodes, &data, thread); } @@ -213,7 +214,7 @@ void ntreeTexUpdatePreviews(bNodeTree* nodetree) dummy_texres.nor = 0; ntreeBeginExecTree(nodetree); - ntreeTexExecTree(nodetree, &dummy_texres, coord, 1, 0, tex, 0); + ntreeTexExecTree(nodetree, &dummy_texres, coord, 1, 0, tex, 0, 0); ntreeEndExecTree(nodetree); } diff --git a/source/blender/nodes/intern/TEX_util.h b/source/blender/nodes/intern/TEX_util.h index 9203b950364..e560aa57921 100644 --- a/source/blender/nodes/intern/TEX_util.h +++ b/source/blender/nodes/intern/TEX_util.h @@ -74,6 +74,7 @@ typedef struct TexCallData { char do_preview; short thread; short which_output; + int cfra; } TexCallData; typedef void(*TexFn) (float *out, float *coord, bNode *node, bNodeStack **in, short thread); @@ -95,6 +96,6 @@ void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn); void tex_do_preview(bNode *node, bNodeStack *ns, TexCallData *cdata); void ntreeTexUpdatePreviews( bNodeTree* nodetree ); -void ntreeTexExecTree(bNodeTree *nodes, TexResult *texres, float *coord, char do_preview, short thread, struct Tex *tex, short which_output); +void ntreeTexExecTree(bNodeTree *nodes, TexResult *texres, float *coord, char do_preview, short thread, struct Tex *tex, short which_output, int cfra); #endif |