add back options for loading a renderlayer to offset the image when copying the buffe...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 8 Feb 2011 10:31:47 +0000 (10:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 8 Feb 2011 10:31:47 +0000 (10:31 +0000)
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.

source/blender/makesrna/intern/rna_render.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/source/pipeline.c

index 6344ddca06e3506c9d322e44de8bd3912de222f1..3d97e38e3a47d2c31da6cc8ba4d18e8bd325797d 100644 (file)
@@ -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);
index d1c9e9499631a058552433b9b7616a528d19a5df..fa71101cbe8213f6e504fcae630a155859939c97 100644 (file)
@@ -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);
index bdca5c315c2a65ba602a5d5f614c0cea4900be21..26edf99b8e388f01e629225e4d2c798410896e0b 100644 (file)
@@ -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);