bugfix [#23595] Texture paint with a node based brush produces artifacts
also changed displace modifier not to link object depgraph when not using object texturespace.
This commit is contained in:
@@ -62,7 +62,7 @@ float brush_curve_strength_clamp(struct Brush *br, float p, const float len);
|
|||||||
float brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */
|
float brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */
|
||||||
|
|
||||||
/* sampling */
|
/* sampling */
|
||||||
void brush_sample_tex(struct Brush *brush, float *xy, float *rgba);
|
void brush_sample_tex(struct Brush *brush, float *xy, float *rgba, const int thread);
|
||||||
void brush_imbuf_new(struct Brush *brush, short flt, short texfalloff, int size,
|
void brush_imbuf_new(struct Brush *brush, short flt, short texfalloff, int size,
|
||||||
struct ImBuf **imbuf);
|
struct ImBuf **imbuf);
|
||||||
|
|
||||||
|
@@ -480,7 +480,7 @@ int brush_clone_image_delete(Brush *brush)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Brush Sampling */
|
/* Brush Sampling */
|
||||||
void brush_sample_tex(Brush *brush, float *xy, float *rgba)
|
void brush_sample_tex(Brush *brush, float *xy, float *rgba, const int thread)
|
||||||
{
|
{
|
||||||
MTex *mtex= &brush->mtex;
|
MTex *mtex= &brush->mtex;
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ void brush_sample_tex(Brush *brush, float *xy, float *rgba)
|
|||||||
co[1]= xy[1]/radius;
|
co[1]= xy[1]/radius;
|
||||||
co[2]= 0.0f;
|
co[2]= 0.0f;
|
||||||
|
|
||||||
hasrgb= externtex(mtex, co, &tin, &tr, &tg, &tb, &ta);
|
hasrgb= externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, thread);
|
||||||
|
|
||||||
if (hasrgb) {
|
if (hasrgb) {
|
||||||
rgba[0]= tr;
|
rgba[0]= tr;
|
||||||
@@ -547,12 +547,12 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf
|
|||||||
dstf[3]= alpha*brush_curve_strength_clamp(brush, dist, radius);
|
dstf[3]= alpha*brush_curve_strength_clamp(brush, dist, radius);
|
||||||
}
|
}
|
||||||
else if (texfall == 1) {
|
else if (texfall == 1) {
|
||||||
brush_sample_tex(brush, xy, dstf);
|
brush_sample_tex(brush, xy, dstf, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
|
dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
|
||||||
|
|
||||||
brush_sample_tex(brush, xy, rgba);
|
brush_sample_tex(brush, xy, rgba, 0);
|
||||||
|
|
||||||
dstf[0] = rgba[0]*brush->rgb[0];
|
dstf[0] = rgba[0]*brush->rgb[0];
|
||||||
dstf[1] = rgba[1]*brush->rgb[1];
|
dstf[1] = rgba[1]*brush->rgb[1];
|
||||||
@@ -583,7 +583,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf
|
|||||||
dst[3]= FTOCHAR(alpha*brush_curve_strength(brush, dist, radius));
|
dst[3]= FTOCHAR(alpha*brush_curve_strength(brush, dist, radius));
|
||||||
}
|
}
|
||||||
else if (texfall == 1) {
|
else if (texfall == 1) {
|
||||||
brush_sample_tex(brush, xy, rgba);
|
brush_sample_tex(brush, xy, rgba, 0);
|
||||||
dst[0]= FTOCHAR(rgba[0]);
|
dst[0]= FTOCHAR(rgba[0]);
|
||||||
dst[1]= FTOCHAR(rgba[1]);
|
dst[1]= FTOCHAR(rgba[1]);
|
||||||
dst[2]= FTOCHAR(rgba[2]);
|
dst[2]= FTOCHAR(rgba[2]);
|
||||||
@@ -592,7 +592,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf
|
|||||||
else {
|
else {
|
||||||
dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
|
dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
|
||||||
|
|
||||||
brush_sample_tex(brush, xy, rgba);
|
brush_sample_tex(brush, xy, rgba, 0);
|
||||||
dst[0] = FTOCHAR(rgba[0]*brush->rgb[0]);
|
dst[0] = FTOCHAR(rgba[0]*brush->rgb[0]);
|
||||||
dst[1] = FTOCHAR(rgba[1]*brush->rgb[1]);
|
dst[1] = FTOCHAR(rgba[1]*brush->rgb[1]);
|
||||||
dst[2] = FTOCHAR(rgba[2]*brush->rgb[2]);
|
dst[2] = FTOCHAR(rgba[2]*brush->rgb[2]);
|
||||||
@@ -739,7 +739,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i
|
|||||||
xy[0] = x + xoff;
|
xy[0] = x + xoff;
|
||||||
xy[1] = y + yoff;
|
xy[1] = y + yoff;
|
||||||
|
|
||||||
brush_sample_tex(brush, xy, tf);
|
brush_sample_tex(brush, xy, tf, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bf[0] = tf[0]*mf[0];
|
bf[0] = tf[0]*mf[0];
|
||||||
@@ -770,7 +770,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i
|
|||||||
xy[0] = x + xoff;
|
xy[0] = x + xoff;
|
||||||
xy[1] = y + yoff;
|
xy[1] = y + yoff;
|
||||||
|
|
||||||
brush_sample_tex(brush, xy, rgba);
|
brush_sample_tex(brush, xy, rgba, 0);
|
||||||
t[0]= FTOCHAR(rgba[0]);
|
t[0]= FTOCHAR(rgba[0]);
|
||||||
t[1]= FTOCHAR(rgba[1]);
|
t[1]= FTOCHAR(rgba[1]);
|
||||||
t[2]= FTOCHAR(rgba[2]);
|
t[2]= FTOCHAR(rgba[2]);
|
||||||
|
@@ -3686,7 +3686,7 @@ static void get_cpa_texture(DerivedMesh *dm, Material *ma, int face_index, float
|
|||||||
else
|
else
|
||||||
VECCOPY(texco,orco);
|
VECCOPY(texco,orco);
|
||||||
|
|
||||||
externtex(mtex, texco, &value, rgba, rgba+1, rgba+2, rgba+3);
|
externtex(mtex, texco, &value, rgba, rgba+1, rgba+2, rgba+3, 0);
|
||||||
if((event & mtex->pmapto) & MAP_PA_TIME){
|
if((event & mtex->pmapto) & MAP_PA_TIME){
|
||||||
if((setvars&MAP_PA_TIME)==0){
|
if((setvars&MAP_PA_TIME)==0){
|
||||||
ptex->time=0.0;
|
ptex->time=0.0;
|
||||||
@@ -3740,7 +3740,7 @@ void psys_get_texture(ParticleSimulationData *sim, Material *ma, ParticleData *p
|
|||||||
psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texco, 0);
|
psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texco, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
externtex(mtex, texco, &value, rgba, rgba+1, rgba+2, rgba+3);
|
externtex(mtex, texco, &value, rgba, rgba+1, rgba+2, rgba+3, 0);
|
||||||
|
|
||||||
if((event & mtex->pmapto) & MAP_PA_TIME){
|
if((event & mtex->pmapto) & MAP_PA_TIME){
|
||||||
/* the first time has to set the base value for time regardless of blend mode */
|
/* the first time has to set the base value for time regardless of blend mode */
|
||||||
|
@@ -4450,7 +4450,7 @@ void vertexnoise(Object *obedit, EditMesh *em)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float tin, dum;
|
float tin, dum;
|
||||||
externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum);
|
externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0);
|
||||||
eve->co[2]+= 0.05*tin;
|
eve->co[2]+= 0.05*tin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3757,7 +3757,7 @@ static void *do_projectpaint_thread(void *ph_v)
|
|||||||
|
|
||||||
if (falloff > 0.0f) {
|
if (falloff > 0.0f) {
|
||||||
if (ps->is_texbrush) {
|
if (ps->is_texbrush) {
|
||||||
brush_sample_tex(ps->brush, projPixel->projCoSS, rgba);
|
brush_sample_tex(ps->brush, projPixel->projCoSS, rgba, thread_index);
|
||||||
alpha = rgba[3];
|
alpha = rgba[3];
|
||||||
} else {
|
} else {
|
||||||
alpha = 1.0f;
|
alpha = 1.0f;
|
||||||
|
@@ -724,7 +724,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
|
|||||||
/* Get strength by feeding the vertex
|
/* Get strength by feeding the vertex
|
||||||
location directly into a texture */
|
location directly into a texture */
|
||||||
externtex(mtex, point, &avg,
|
externtex(mtex, point, &avg,
|
||||||
&jnk, &jnk, &jnk, &jnk);
|
&jnk, &jnk, &jnk, &jnk, 0);
|
||||||
}
|
}
|
||||||
else if(ss->texcache) {
|
else if(ss->texcache) {
|
||||||
float rotation = -mtex->rot;
|
float rotation = -mtex->rot;
|
||||||
|
@@ -1306,7 +1306,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
|
|||||||
RNA_def_property_enum_sdna(prop, NULL, "texmapping");
|
RNA_def_property_enum_sdna(prop, NULL, "texmapping");
|
||||||
RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
|
RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
|
||||||
RNA_def_property_ui_text(prop, "Texture Coordinates", "");
|
RNA_def_property_ui_text(prop, "Texture Coordinates", "");
|
||||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
|
||||||
|
|
||||||
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
|
||||||
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
|
||||||
|
@@ -134,7 +134,7 @@ static void updateDepgraph(
|
|||||||
{
|
{
|
||||||
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
|
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
|
||||||
|
|
||||||
if(dmd->map_object) {
|
if(dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
|
||||||
DagNode *curNode = dag_get_node(forest, dmd->map_object);
|
DagNode *curNode = dag_get_node(forest, dmd->map_object);
|
||||||
|
|
||||||
dag_add_relation(forest, curNode, obNode,
|
dag_add_relation(forest, curNode, obNode,
|
||||||
|
@@ -442,11 +442,11 @@ static DerivedMesh *applyModifier(ModifierData *md,
|
|||||||
j= 2;
|
j= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; j>=0; j--) {
|
do {
|
||||||
vidx = *(&mf->v1 + j);
|
vidx = *(&mf->v1 + j);
|
||||||
vert_accum[vidx] += face_angles[j];
|
vert_accum[vidx] += face_angles[j];
|
||||||
vert_angles[vidx]+= shell_angle_to_dist(angle_normalized_v3v3(vert_nors[vidx], face_nors[i])) * face_angles[j];
|
vert_angles[vidx]+= shell_angle_to_dist(angle_normalized_v3v3(vert_nors[vidx], face_nors[i])) * face_angles[j];
|
||||||
}
|
} while(j--);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vertex group support */
|
/* vertex group support */
|
||||||
|
@@ -51,7 +51,7 @@ struct ImBuf;
|
|||||||
//void RE_zbufferall_radio(struct RadView *vw, struct RNode **rg_elem, int rg_totelem, struct Render *re);
|
//void RE_zbufferall_radio(struct RadView *vw, struct RNode **rg_elem, int rg_totelem, struct Render *re);
|
||||||
|
|
||||||
/* particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
|
/* particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
|
||||||
int externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta);
|
int externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta, const int thread);
|
||||||
|
|
||||||
/* particle.c */
|
/* particle.c */
|
||||||
void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg, int blendtype);
|
void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg, int blendtype);
|
||||||
|
@@ -1019,7 +1019,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta);
|
externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0);
|
||||||
|
|
||||||
yn= tin*mtex->colfac;
|
yn= tin*mtex->colfac;
|
||||||
zn= tin*mtex->alphafac;
|
zn= tin*mtex->alphafac;
|
||||||
@@ -1151,7 +1151,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
|||||||
VECCOPY(texvec, orco);
|
VECCOPY(texvec, orco);
|
||||||
}
|
}
|
||||||
|
|
||||||
externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta);
|
externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0);
|
||||||
|
|
||||||
//yn= tin*mtex->colfac;
|
//yn= tin*mtex->colfac;
|
||||||
//zn= tin*mtex->alphafac;
|
//zn= tin*mtex->alphafac;
|
||||||
|
@@ -3016,7 +3016,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int externtex(MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta)
|
int externtex(MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta, const int thread)
|
||||||
{
|
{
|
||||||
Tex *tex;
|
Tex *tex;
|
||||||
TexResult texr;
|
TexResult texr;
|
||||||
@@ -3042,7 +3042,7 @@ int externtex(MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *t
|
|||||||
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb= multitex(tex, texvec, dxt, dyt, 0, &texr, 0, mtex->which_output);
|
rgb= multitex(tex, texvec, dxt, dyt, 0, &texr, thread, mtex->which_output);
|
||||||
|
|
||||||
if(rgb) {
|
if(rgb) {
|
||||||
texr.tin= (0.35*texr.tr+0.45*texr.tg+0.2*texr.tb);
|
texr.tin= (0.35*texr.tr+0.45*texr.tg+0.2*texr.tb);
|
||||||
|
Reference in New Issue
Block a user