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

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

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;