diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-08 04:04:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-08 04:04:41 +0400 |
commit | 2c8db878974a340e14b59a6ed5a61fb195ccc67c (patch) | |
tree | 92816b7e329337d96140e068ee2166acdf22d250 | |
parent | 8b9977e354b0e05c30f8e221a505442c13867f5a (diff) |
fix [#32020] Image will not render in second (any scene other than first) if scene name is longer than 28 characters
11 files changed, 26 insertions, 31 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 92c339d7672..116e155f501 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -372,7 +372,7 @@ static char *slot_menu(void) static char *layer_menu(RenderResult *rr, short *UNUSED(curlay)) { RenderLayer *rl; - int len = 64 + 32 * BLI_countlist(&rr->layers); + int len = 64 + RE_MAXNAME * BLI_countlist(&rr->layers); short a, nr = 0; char *str = MEM_callocN(len, "menu layers"); diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 18957cb8260..f5479bce570 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -665,9 +665,9 @@ void IMB_exr_read_channels(void *handle) } void IMB_exr_multilayer_convert(void *handle, void *base, - void * (*addlayer)(void *base, char *str), - void (*addpass)(void *base, void *lay, char *str, - float *rect, int totchan, char *chan_id)) + void * (*addlayer)(void *base, const char *str), + void (*addpass)(void *base, void *lay, const char *str, + float *rect, int totchan, const char *chan_id)) { ExrHandle *data = (ExrHandle *)handle; ExrLayer *lay; @@ -908,14 +908,6 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) /* ********************************************************* */ -typedef struct RGBA { - float r; - float g; - float b; - float a; -} RGBA; - - /* debug only */ static void exr_print_filecontents(InputFile *file) { diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index 523dc8120c4..78071975c72 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -37,9 +37,9 @@ /* Note: as for now openexr only supports 32 chars in channel names. * This api also supports max 8 channels per pass now. easy to fix! */ -#define EXR_LAY_MAXNAME 19 +#define EXR_LAY_MAXNAME 51 #define EXR_PASS_MAXNAME 11 -#define EXR_TOT_MAXNAME 32 +#define EXR_TOT_MAXNAME 64 #define EXR_PASS_MAXCHAN 8 @@ -62,8 +62,8 @@ void IMB_exrtile_write_channels(void *handle, int partx, int party, int level void IMB_exrtile_clear_channels(void *handle); void IMB_exr_multilayer_convert(void *handle, void *base, - void * (*addlayer)(void *base, char *str), - void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)); + void * (*addlayer)(void *base, const char *str), + void (*addpass)(void *base, void *lay, const char *str, float *rect, int totchan, const char *chan_id)); void IMB_exr_close(void *handle); diff --git a/source/blender/imbuf/intern/openexr/openexr_stub.cpp b/source/blender/imbuf/intern/openexr/openexr_stub.cpp index e896fc58cf3..7262656d4e8 100644 --- a/source/blender/imbuf/intern/openexr/openexr_stub.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_stub.cpp @@ -48,8 +48,8 @@ void IMB_exrtile_write_channels (void *handle, int partx, int party, int level) void IMB_exrtile_clear_channels (void *handle) { (void)handle; } void IMB_exr_multilayer_convert (void *handle, void *base, - void * (*addlayer)(void *base, char *str), - void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)) + void * (*addlayer)(void *base, const char *str), + void (*addpass)(void *base, void *lay, const char *str, float *rect, int totchan, const char *chan_id)) { (void)handle; (void)base; (void)addlayer; (void)addpass; } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 95eadc23ef4..fe2e218637a 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -108,7 +108,7 @@ typedef struct ID { void *next, *prev; struct ID *newid; struct Library *lib; - char name[66]; + char name[66]; /* MAX_ID_NAME */ short pad, us; /** * LIB_... flags report on status of the datablock this ID belongs diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 4e33e4d7e2d..8ca229c1a1b 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -51,8 +51,8 @@ struct EnvMap; /* this include is what is exposed of render to outside world */ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - -#define RE_MAXNAME 32 +/* length of the scene name + passname */ +#define RE_MAXNAME ((MAX_ID_NAME - 2) + 10) /* only used as handle */ typedef struct Render Render; @@ -81,7 +81,7 @@ typedef struct RenderLayer { struct RenderLayer *next, *prev; /* copy of RenderData */ - char name[RE_MAXNAME]; + char name[RE_MAXNAME]; unsigned int lay, lay_zmask, lay_exclude; int layflag, passflag, pass_xor; @@ -144,8 +144,7 @@ typedef struct RenderStats { short curfield, curblur, curpart, partsdone, convertdone, curfsa; double starttime, lastframetime; const char *infostr, *statstr; - char scenename[32]; - + char scene_name[MAX_ID_NAME - 2]; } RenderStats; /* *********************** API ******************** */ diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index cb6a0fd1198..803a9a95571 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5038,7 +5038,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* per second, per object, stats print this */ re->i.infostr= "Preparing Scene data"; re->i.cfra= scene->r.cfra; - BLI_strncpy(re->i.scenename, scene->id.name+2, sizeof(re->i.scenename)); + BLI_strncpy(re->i.scene_name, scene->id.name + 2, sizeof(re->i.scene_name)); /* XXX add test if dbase was filled already? */ diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 75206f10f84..1180e74d391 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -305,7 +305,7 @@ int RE_engine_render(Render *re, int do_all) /* set render info */ re->i.cfra = re->scene->r.cfra; - BLI_strncpy(re->i.scenename, re->scene->id.name + 2, sizeof(re->i.scenename)); + BLI_strncpy(re->i.scene_name, re->scene->id.name + 2, sizeof(re->i.scene_name)); re->i.totface = re->i.totvert = re->i.totstrand = re->i.totlamp = re->i.tothalo = 0; /* render */ diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index e8765b4c3ac..485dd005be7 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -768,6 +768,8 @@ static void vec_add_dir(float r[3], const float v1[3], const float v2[3], const r[2] = v1[2] + fac * (v2[2] - v1[2]); } +/* TODO: exact duplicate of ff_visible_quad() in math_geom.c + * why not de-duplicate? (also above helper func) */ static int occ_visible_quad(const float p[3], const float n[3], const float v0[3], const float v1[3], const float v2[3], float q0[3], float q1[3], float q2[3], float q3[3]) @@ -1129,6 +1131,8 @@ static void normalizef(float *n) } } +/* TODO: exact duplicate of ff_quad_form_factor() in math_geom.c + * why not de-duplicate? (also above helper func) */ static float occ_quad_form_factor(const float p[3], const float n[3], const float q0[3], const float q1[3], const float q2[3], const float q3[3]) { float r0[3], r1[3], r2[3], r3[3], g0[3], g1[3], g2[3], g3[3]; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 3de64996311..77f75caa36a 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -166,9 +166,9 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs) } else { if (rs->tothalo) - fprintf(stdout, "Sce: %s Ve:%d Fa:%d Ha:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->tothalo, rs->totlamp); + fprintf(stdout, "Sce: %s Ve:%d Fa:%d Ha:%d La:%d", rs->scene_name, rs->totvert, rs->totface, rs->tothalo, rs->totlamp); else - fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp); + fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scene_name, rs->totvert, rs->totface, rs->totlamp); } BLI_callback_exec(G.main, NULL, BLI_CB_EVT_RENDER_STATS); diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index ddb24e134df..5da661e7182 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -582,7 +582,7 @@ RenderResult *render_result_new_full_sample(Render *re, ListBase *lb, rcti *part } /* callbacks for render_result_new_from_exr */ -static void *ml_addlayer_cb(void *base, char *str) +static void *ml_addlayer_cb(void *base, const char *str) { RenderResult *rr = base; RenderLayer *rl; @@ -594,7 +594,7 @@ static void *ml_addlayer_cb(void *base, char *str) return rl; } -static void ml_addpass_cb(void *UNUSED(base), void *lay, char *str, float *rect, int totchan, char *chan_id) +static void ml_addpass_cb(void *UNUSED(base), void *lay, const char *str, float *rect, int totchan, const char *chan_id) { RenderLayer *rl = lay; RenderPass *rpass = MEM_callocN(sizeof(RenderPass), "loaded pass"); @@ -618,7 +618,7 @@ static void ml_addpass_cb(void *UNUSED(base), void *lay, char *str, float *rect, /* from imbuf, if a handle was returned we convert this to render result */ RenderResult *render_result_new_from_exr(void *exrhandle, int rectx, int recty) { - RenderResult *rr = MEM_callocN(sizeof(RenderResult), "loaded render result"); + RenderResult *rr = MEM_callocN(sizeof(RenderResult), __func__); RenderLayer *rl; RenderPass *rpass; |