[Bf-codereview] Blender Dynamic Paint (soc-2011-carrot) (issue 5189041)

brechtvanlommel at gmail.com brechtvanlommel at gmail.com
Wed Oct 26 20:43:44 CEST 2011


http://codereview.appspot.com/5189041/diff/34001/source/blender/blenkernel/intern/dynamicpaint.c
File source/blender/blenkernel/intern/dynamicpaint.c (right):

http://codereview.appspot.com/5189041/diff/34001/source/blender/blenkernel/intern/dynamicpaint.c#newcode103
source/blender/blenkernel/intern/dynamicpaint.c:103: #define
VECMULVAL(v,val) 	{*(v)*=(val); *(v+1)*=(val); *(v+2)*=(val);}
mul_v3_fl can be used for this, and add_v3_fl could be added. Also
general comment, we're trying to switch over from the macro's to math
functions, e.g. VECSUB to sub_v3_v3v3, would be nice if these were used
where possible.

http://codereview.appspot.com/5189041/diff/34001/source/blender/blenkernel/intern/dynamicpaint.c#newcode331
source/blender/blenkernel/intern/dynamicpaint.c:331: strncpy(name,
basename, 62); /* in case basename is surface->name use a copy */
Use BLI_strncpy instead of strncpy, the latter will not null terminate
strings that are too long.

http://codereview.appspot.com/5189041/diff/34001/source/blender/blenkernel/intern/dynamicpaint.c#newcode419
source/blender/blenkernel/intern/dynamicpaint.c:419: t_color[2] =
t_color[2]*invFact + s_color[2]*factor;
interp_v3_v3v3  could be used here.

http://codereview.appspot.com/5189041/diff/34001/source/blender/blenkernel/intern/dynamicpaint.c#newcode975
source/blender/blenkernel/intern/dynamicpaint.c:975:
sprintf(surface->image_output_path, "%sdynamicpaint/", "/tmp/");
Rather than /tmp/, this could use BLI_temporary_dir(), since /tmp/ does
not exist on windows.

http://codereview.appspot.com/5189041/diff/34001/source/blender/blenkernel/intern/dynamicpaint.c#newcode1289
source/blender/blenkernel/intern/dynamicpaint.c:1289: #ifdef _OPENMP
Such #ifdefs aren't needed around #pragma omp, it will simply get
ignored.

http://codereview.appspot.com/5189041/diff/34001/source/blender/blenkernel/intern/dynamicpaint.c#newcode1602
source/blender/blenkernel/intern/dynamicpaint.c:1602: col[i*4+j].r =
(unsigned char)(material->b*255);
For this conversion here and further in the function, use the FTOCHAR()
/ F3TOCHAR3() macro, which does proper clamping and rounding.

http://codereview.appspot.com/5189041/diff/34001/source/blender/blenkernel/intern/dynamicpaint.c#newcode1724
source/blender/blenkernel/intern/dynamicpaint.c:1724: /* check if this
vertex has a weight */
defvert_find_index and defvert_verify_index functions could be used
here.

http://codereview.appspot.com/5189041/


More information about the Bf-codereview mailing list