diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-08 13:31:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-08 13:31:47 +0300 |
commit | e511f9fac4f0d8ef9f596fbbddd7c4fc1158b947 (patch) | |
tree | f6264e650cdd2df9fe67b469bbcb92880acaac25 /source/blender | |
parent | 71ec3f03fbff0b3d21e7f33c86b08870810ec2b3 (diff) |
add back options for loading a renderlayer to offset the image when copying the buffer to a smaller renderlayer.
This was reverted by Brecht r22541 because its inefficient but there is no way to work around this with povray at the moment so adding it back as optional args.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 4 | ||||
-rw-r--r-- | source/blender/render/extern/include/RE_pipeline.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 6 |
3 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 6344ddca06e..3d97e38e3a4 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -334,7 +334,9 @@ static void rna_def_render_layer(BlenderRNA *brna) RNA_def_function_flag(func, FUNC_USE_REPORTS); prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller then the renderlayer"); RNA_def_property_flag(prop, PROP_REQUIRED); - + prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); + prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); + RNA_define_verify_sdna(0); rna_def_render_layer_common(srna, 0); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index d1c9e949963..fa71101cbe8 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -287,7 +287,7 @@ typedef struct RenderEngine { ListBase fullresult; } RenderEngine; -void RE_layer_load_from_file(RenderLayer *layer, struct ReportList *reports, const char *filename); +void RE_layer_load_from_file(RenderLayer *layer, struct ReportList *reports, const char *filename, int x, int y); void RE_result_load_from_file(RenderResult *result, struct ReportList *reports, const char *filename); struct RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index bdca5c315c2..26edf99b8e3 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -3277,7 +3277,7 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char /* loads in image into a result, size must match * x/y offsets are only used on a partial copy when dimensions dont match */ -void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char *filename) +void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char *filename, int x, int y) { ImBuf *ibuf = IMB_loadiffname(filename, IB_rect); @@ -3288,7 +3288,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char memcpy(layer->rectf, ibuf->rect_float, sizeof(float)*4*layer->rectx*layer->recty); } else { - if ((ibuf->x >= layer->rectx) && (ibuf->y >= layer->recty)) { + if ((ibuf->x - x >= layer->rectx) && (ibuf->y - y >= layer->recty)) { ImBuf *ibuf_clip; if(ibuf->rect_float==NULL) @@ -3296,7 +3296,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat); if(ibuf_clip) { - IMB_rectcpy(ibuf_clip, ibuf, 0,0, 0,0, layer->rectx, layer->recty); + IMB_rectcpy(ibuf_clip, ibuf, 0,0, x,y, layer->rectx, layer->recty); memcpy(layer->rectf, ibuf_clip->rect_float, sizeof(float)*4*layer->rectx*layer->recty); IMB_freeImBuf(ibuf_clip); |