[Bf-blender-cvs] [bcf2ab95ccc] temp-T96708-brush-texture-refactoring: Merge branch 'master' into temp-T96708-brush-texture-refactoring
Jeroen Bakker
noreply at git.blender.org
Mon Sep 19 14:57:36 CEST 2022
Commit: bcf2ab95ccc2aefd2e9c73dd8ade1e313c503d69
Author: Jeroen Bakker
Date: Mon Sep 19 14:57:31 2022 +0200
Branches: temp-T96708-brush-texture-refactoring
https://developer.blender.org/rBbcf2ab95ccc2aefd2e9c73dd8ade1e313c503d69
Merge branch 'master' into temp-T96708-brush-texture-refactoring
===================================================================
===================================================================
diff --cc source/blender/blenkernel/BKE_blender_version.h
index 1651ea243f2,ee9c7a964d9..a80f46a440d
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@@ -25,7 -25,7 +25,7 @@@ extern "C"
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
- #define BLENDER_FILE_SUBVERSION 10
-#define BLENDER_FILE_SUBVERSION 0
++#define BLENDER_FILE_SUBVERSION 1
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
diff --cc source/blender/blenloader/intern/versioning_300.c
index 12c7652a95b,244f74cfe59..6b45917fad0
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@@ -2574,5 -3346,37 +3347,49 @@@ void blo_do_versions_300(FileData *fd,
*/
{
/* Keep this block, even when empty. */
+
+ /* Image generation information transferred to tiles. */
+ if (!DNA_struct_elem_find(fd->filesdna, "ImageTile", "int", "gen_x")) {
+ for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
+ for (ImageTile *tile = ima->tiles.first; tile; tile = tile->next) {
+ tile->gen_x = ima->gen_x;
+ tile->gen_y = ima->gen_y;
+ tile->gen_type = ima->gen_type;
+ tile->gen_flag = ima->gen_flag;
+ tile->gen_depth = ima->gen_depth;
+ copy_v4_v4(tile->gen_color, ima->gen_color);
+ }
+ }
+ }
+
+ /* Convert mix rgb node to new mix node and add storage. */
+ {
+ FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
+ versioning_replace_legacy_mix_rgb_node(ntree);
+ }
+ FOREACH_NODETREE_END;
+ }
+
+ /* Face sets no longer store whether the corresponding face is hidden. */
+ LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
+ int *face_sets = (int *)CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
+ if (face_sets) {
+ for (int i = 0; i < mesh->totpoly; i++) {
+ face_sets[i] = abs(face_sets[i]);
+ }
+ }
+ }
++
++ /* Sculpting brushes used mtex for masking, image brushes used mtex for coloring and mask_mtex
++ * for masking. Converting sculpting brushes to use mask_tex for masking to make brushes more
++ * compatible with each other. */
++ // TODO(jbakker): this needs a version bump.
++ MTex default_texture = _DNA_DEFAULT_MTex;
++ LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
++ if (brush->sculpt_tool != 0) {
++ memcpy(&brush->mask_mtex, &brush->mtex, sizeof(MTex));
++ memcpy(&brush->mtex, &default_texture, sizeof(MTex));
++ }
++ }
}
}
diff --cc source/blender/editors/sculpt_paint/sculpt.c
index fe172d5e7ae,1f64a2445aa..74639ce1ee0
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@@ -4926,10 -5082,10 +5082,10 @@@ bool SCULPT_stroke_get_location(bContex
return hit;
}
- static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
+ static void sculpt_brush_init_tex(Sculpt *sd, SculptSession *ss)
{
Brush *brush = BKE_paint_brush(&sd->paint);
- MTex *mtex = &brush->mtex;
+ MTex *mtex = &brush->mask_mtex;
/* Init mtex nodes. */
if (mtex->tex && mtex->tex->nodetree) {
diff --cc source/blender/editors/sculpt_paint/sculpt_expand.c
index b5eec705283,53972709a3e..ef4f1ce4d9d
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@@ -167,14 -170,16 +170,16 @@@ static bool sculpt_expand_is_face_in_ac
*/
static float sculpt_expand_falloff_value_vertex_get(SculptSession *ss,
ExpandCache *expand_cache,
- const int v)
+ const PBVHVertRef v)
{
+ int v_i = BKE_pbvh_vertex_to_index(ss->pbvh, v);
+
if (expand_cache->texture_distortion_strength == 0.0f) {
- return expand_cache->vert_falloff[v];
+ return expand_cache->vert_falloff[v_i];
}
- if (!expand_cache->brush->mtex.tex) {
+ if (!expand_cache->brush->mask_mtex.tex) {
- return expand_cache->vert_falloff[v];
+ return expand_cache->vert_falloff[v_i];
}
float rgba[4];
@@@ -2000,10 -2058,10 +2058,10 @@@ static void sculpt_expand_cache_initial
BKE_curvemapping_init(expand_cache->brush->curve);
copy_v4_fl(expand_cache->fill_color, 1.0f);
copy_v3_v3(expand_cache->fill_color, BKE_brush_color_get(ss->scene, expand_cache->brush));
- IMB_colormanagement_srgb_to_scene_linear_v3(expand_cache->fill_color);
+ IMB_colormanagement_srgb_to_scene_linear_v3(expand_cache->fill_color, expand_cache->fill_color);
expand_cache->scene = CTX_data_scene(C);
- expand_cache->mtex = &expand_cache->brush->mtex;
+ expand_cache->mtex = &expand_cache->brush->mask_mtex;
expand_cache->texture_distortion_strength = 0.0f;
expand_cache->blend_mode = expand_cache->brush->blend;
}
More information about the Bf-blender-cvs
mailing list