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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user