forked from bartvdbraak/blender
- fix for access past the buffer size (paint / sculpt used some 2d vecs as 3d)
- remove redundant NULL checks on old code where it would crash if the result was NULL later on. - add some missing NULL checks.
This commit is contained in:
parent
862aababb3
commit
0abe1911d5
@ -1235,7 +1235,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
ysize= block->maxy - block->miny+4;
|
||||
/*aspect/= (float)xsize;*/ /*UNUSED*/
|
||||
|
||||
if(but) {
|
||||
{
|
||||
int left=0, right=0, top=0, down=0;
|
||||
int winx, winy;
|
||||
// int offscreen;
|
||||
|
@ -724,7 +724,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob = ED_object_active_context(C);
|
||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||
int mode_orig = ob->mode;
|
||||
int mode_orig = ob ? ob->mode : 0;
|
||||
|
||||
if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -749,7 +749,7 @@ static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], floa
|
||||
|
||||
static int project_paint_occlude_ptv_clip(
|
||||
const ProjPaintState *ps, const MFace *mf,
|
||||
float pt[3], float v1[3], float v2[3], float v3[3],
|
||||
float pt[3], float v1[4], float v2[4], float v3[4],
|
||||
const int side )
|
||||
{
|
||||
float w[3], wco[3];
|
||||
|
@ -683,7 +683,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
|
||||
/* TODO: as sculpt and other paint modes are unified, this
|
||||
separation will go away */
|
||||
if(stroke->vc.obact->sculpt) {
|
||||
float delta[3];
|
||||
float delta[2];
|
||||
|
||||
brush_jitter_pos(brush, mouse_in, mouse);
|
||||
|
||||
@ -691,13 +691,14 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
|
||||
brush_jitter_pos isn't written in the best way to
|
||||
be reused here */
|
||||
if(brush->flag & BRUSH_JITTER_PRESSURE) {
|
||||
sub_v3_v3v3(delta, mouse, mouse_in);
|
||||
mul_v3_fl(delta, pressure);
|
||||
add_v3_v3v3(mouse, mouse_in, delta);
|
||||
sub_v2_v2v2(delta, mouse, mouse_in);
|
||||
mul_v2_fl(delta, pressure);
|
||||
add_v2_v2v2(mouse, mouse_in, delta);
|
||||
}
|
||||
}
|
||||
else
|
||||
copy_v3_v3(mouse, mouse_in);
|
||||
else {
|
||||
copy_v2_v2(mouse, mouse_in);
|
||||
}
|
||||
|
||||
/* TODO: can remove the if statement once all modes have this */
|
||||
if(stroke->get_location)
|
||||
|
@ -2996,7 +2996,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
|
||||
copy_v3_v3(cache->true_location, cache->orig_grab_location);
|
||||
|
||||
sd->draw_anchored = 1;
|
||||
copy_v3_v3(sd->anchored_initial_mouse, cache->initial_mouse);
|
||||
copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
|
||||
sd->anchored_size = cache->pixel_radius;
|
||||
}
|
||||
}
|
||||
|
@ -164,22 +164,26 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
|
||||
SpaceFile *sfile= CTX_wm_space_file(C);
|
||||
FileSelectParams *params = ED_fileselect_get_params(sfile);
|
||||
int numfiles = filelist_numfiles(sfile->files);
|
||||
struct direntry* file;
|
||||
|
||||
/* make the selected file active */
|
||||
if ( (selected_idx >= 0) && (selected_idx < numfiles)) {
|
||||
struct direntry* file = filelist_file(sfile->files, selected_idx);
|
||||
if ( (selected_idx >= 0) &&
|
||||
(selected_idx < numfiles) &&
|
||||
(file= filelist_file(sfile->files, selected_idx)))
|
||||
{
|
||||
params->active_file = selected_idx;
|
||||
|
||||
if(file && S_ISDIR(file->type)) {
|
||||
if(S_ISDIR(file->type)) {
|
||||
/* the path is too long and we are not going up! */
|
||||
if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX )
|
||||
{
|
||||
if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) {
|
||||
// XXX error("Path too long, cannot enter this directory");
|
||||
} else {
|
||||
if (strcmp(file->relname, "..")==0) {
|
||||
/* avoids /../../ */
|
||||
BLI_parent_dir(params->dir);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (strcmp(file->relname, "..")==0) {
|
||||
/* avoids /../../ */
|
||||
BLI_parent_dir(params->dir);
|
||||
}
|
||||
else {
|
||||
BLI_cleanup_dir(G.main->name, params->dir);
|
||||
strcat(params->dir, file->relname);
|
||||
BLI_add_slash(params->dir);
|
||||
@ -189,8 +193,7 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
|
||||
retval = FILE_SELECT_DIR;
|
||||
}
|
||||
}
|
||||
else if (file)
|
||||
{
|
||||
else {
|
||||
if (file->relname) {
|
||||
BLI_strncpy(params->file, file->relname, FILE_MAXFILE);
|
||||
}
|
||||
|
@ -514,8 +514,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
|
||||
if (pixels)
|
||||
MEM_freeN(pixels);
|
||||
|
||||
if (tex)
|
||||
GPU_texture_unbind(tex);
|
||||
GPU_texture_unbind(tex);
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
|
||||
hbuf= ibuf->mipmap[curmap];
|
||||
hbuf->miplevel= curmap+1;
|
||||
|
||||
if(!hbuf || (hbuf->x <= 2 && hbuf->y <= 2))
|
||||
if(hbuf->x <= 2 && hbuf->y <= 2)
|
||||
break;
|
||||
|
||||
curmap++;
|
||||
|
@ -515,14 +515,15 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
|
||||
|
||||
}
|
||||
|
||||
ibuf->ftype = IMAGIC;
|
||||
ibuf->profile = IB_PROFILE_SRGB;
|
||||
|
||||
test_endian_zbuf(ibuf);
|
||||
|
||||
if (ibuf) {
|
||||
if (ibuf->rect)
|
||||
ibuf->ftype = IMAGIC;
|
||||
ibuf->profile = IB_PROFILE_SRGB;
|
||||
|
||||
test_endian_zbuf(ibuf);
|
||||
|
||||
if (ibuf->rect) {
|
||||
IMB_convert_rgba_to_abgr(ibuf);
|
||||
}
|
||||
}
|
||||
|
||||
return(ibuf);
|
||||
|
@ -68,7 +68,7 @@ void clear_envmap(struct EnvMap *env, bContext *C)
|
||||
}
|
||||
}
|
||||
|
||||
void texture_evaluate(struct Tex *tex, float value[3], float color_r[3])
|
||||
void texture_evaluate(struct Tex *tex, float value[3], float color_r[4])
|
||||
{
|
||||
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||
multitex_ext(tex, value, NULL, NULL, 1, &texres);
|
||||
|
@ -1165,8 +1165,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
|
||||
shi->vcol[2]= 1.0f;
|
||||
shi->vcol[3]= 1.0f;
|
||||
}
|
||||
if(tface && tface->tpage)
|
||||
if(tface->tpage) {
|
||||
render_realtime_texture(shi, tface->tpage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -239,7 +239,7 @@ static short cliptestf(float p, float q, float *u1, float *u2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int testclip(const float v[3])
|
||||
int testclip(const float v[4])
|
||||
{
|
||||
float abs4; /* WATCH IT: this function should do the same as cliptestf, otherwise troubles in zbufclip()*/
|
||||
short c=0;
|
||||
|
Loading…
Reference in New Issue
Block a user