fix [#32020] Image will not render in second (any scene other than first) if scene name is longer than 28 characters

This commit is contained in:
2012-07-08 00:04:41 +00:00
parent 8b9977e354
commit 2c8db87897
11 changed files with 26 additions and 31 deletions

View File

@@ -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");

View File

@@ -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)
{

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
@@ -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 ******************** */

View File

@@ -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? */

View File

@@ -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 */

View File

@@ -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];

View File

@@ -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);

View File

@@ -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;