[Bf-blender-cvs] [0f95d361b78] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

2021-09-25 Thread YimingWu
Commit: 0f95d361b7863db371e271d7eeaa9e2bf46b0bc3
Author: YimingWu
Date:   Sun Sep 26 13:27:40 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB0f95d361b7863db371e271d7eeaa9e2bf46b0bc3

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fa8195ba559] sculpt-dev: Fix color palette panel

2021-09-25 Thread Joseph Eagar
Commit: fa8195ba559ccce28f164d7f227518179a23ff5c
Author: Joseph Eagar
Date:   Sat Sep 25 14:20:57 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBfa8195ba559ccce28f164d7f227518179a23ff5c

Fix color palette panel

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenkernel/intern/brush_channel_define.h

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 071e3d269c8..95a94a9db95 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -507,6 +507,12 @@ class VIEW3D_PT_tools_brush_swatches(Panel, 
View3DPaintPanel, ColorPalettePanel)
 bl_label = "Color Palette"
 bl_options = {'DEFAULT_CLOSED'}
 
+class VIEW3D_PT_tools_brush_swatches_channels(Panel, View3DPaintPanel, 
ColorPalettePanel):
+bl_context = ".paint_common"
+bl_parent_id = "VIEW3D_PT_tools_brush_settings_channels"
+bl_label = "Color Palette"
+bl_options = {'DEFAULT_CLOSED'}
+
 
 class VIEW3D_PT_tools_brush_clone(Panel, View3DPaintPanel, ClonePanel):
 bl_context = ".paint_common"
@@ -2601,6 +2607,7 @@ classes = (
 VIEW3D_PT_tools_grease_pencil_brush_vertex_color,
 VIEW3D_PT_tools_grease_pencil_brush_vertex_palette,
 VIEW3D_PT_tools_grease_pencil_brush_vertex_falloff,
+VIEW3D_PT_tools_brush_swatches_channels,
 VIEW3D_PT_sculpt_dyntopo_advanced,
 SCULPT_OT_set_dyntopo_mode
 )
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index eee51e5a9c3..57a1d4e598a 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -235,7 +235,7 @@ MAKE_BOOL(invert_to_scrape_fill,"Invert to Scrape or Fill",
 MAKE_FLOAT(area_radius_factor, "Area Radius", "Ratio between the brush radius 
and the radius that is going to be "
 "used to sample the area center", 0.5f, 0.0f, 2.0f)
 MAKE_BOOL(use_multiplane_scrape_dynamic, "Dynamic Mode",  "The angle between 
the planes changes during the stroke to fit the "
-"surface under the cursor", true)
+"surface under the cursor", true) 
 MAKE_BOOL(show_multiplane_scrape_planes_preview, "Show Cursor Preview", 
"Preview the scrape planes in the cursor during the stroke", true)
 MAKE_FLOAT(multiplane_scrape_angle, "Plane Angle", "Angle between the planes 
of the crease", 60.0f, 0.0f, 160.0f)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [560e015a5b3] soc-2021-uv-editor-improvements: Fix and cleanup: Pack to correct/Specified UDIM

2021-09-25 Thread Siddhartha Jejurkar
Commit: 560e015a5b36a953e160dd2dd3a9c32ab74637c1
Author: Siddhartha Jejurkar
Date:   Sun Sep 26 00:40:51 2021 +0530
Branches: soc-2021-uv-editor-improvements
https://developer.blender.org/rB560e015a5b36a953e160dd2dd3a9c32ab74637c1

Fix and cleanup: Pack to correct/Specified UDIM

After recent changes made in master branch, it is now possible to display
UDIM grid and tiled images simultaneously in the UV Editor.
This commit updates the pack islands to correct/specified UDIM
implementation to work with the new behavior. Also includes some code
and comment cleanups.

===

M   source/blender/editors/include/ED_uvedit.h
M   source/blender/editors/uvedit/uvedit_islands.c
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/editors/include/ED_uvedit.h 
b/source/blender/editors/include/ED_uvedit.h
index 269590197ee..cd89620fe64 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -247,10 +247,11 @@ struct UVPackIsland_Params {
   uint correct_aspect : 1;
 };
 void ED_uvedit_pack_islands_multi(const struct Scene *scene,
+  const struct SpaceImage *sima,
   Object **objects,
   const uint objects_len,
-  const struct SpaceImage *sima,
-  bool use_target,
+  const bool use_target_udim,
+  int target_udim,
   const struct UVPackIsland_Params *params);
 
 bool ED_uvedit_pack_islands_to_area_multi(const struct Scene *scene,
diff --git a/source/blender/editors/uvedit/uvedit_islands.c 
b/source/blender/editors/uvedit/uvedit_islands.c
index ef990080ec1..370e0176298 100644
--- a/source/blender/editors/uvedit/uvedit_islands.c
+++ b/source/blender/editors/uvedit/uvedit_islands.c
@@ -359,10 +359,11 @@ static int bm_mesh_calc_uv_islands(const Scene *scene,
  * \{ */
 
 void ED_uvedit_pack_islands_multi(const Scene *scene,
+  const SpaceImage *sima,
   Object **objects,
   const uint objects_len,
-  const SpaceImage *sima,
-  bool use_target,
+  const bool use_target_udim,
+  int target_udim,
   const struct UVPackIsland_Params *params)
 {
   /* Align to the Y axis, could make this configurable. */
@@ -370,18 +371,6 @@ void ED_uvedit_pack_islands_multi(const Scene *scene,
   ListBase island_list = {NULL};
   int island_list_len = 0;
 
-  const Image *image;
-  bool is_tiled_image = false;
-  int udim_grid[2] = {1, 1};
-
-  /* To handle cases where sima=NULL - Smart UV project */
-  if (sima) {
-image = sima->image;
-is_tiled_image = image && (image->source == IMA_SRC_TILED);
-udim_grid[0] = sima->tile_grid_shape[0];
-udim_grid[1] = sima->tile_grid_shape[1];
-  }
-
   for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
 Object *obedit = objects[ob_index];
 BMEditMesh *em = BKE_editmesh_from_object(obedit);
@@ -423,26 +412,25 @@ void ED_uvedit_pack_islands_multi(const Scene *scene,
   BoxPack *boxarray = MEM_mallocN(sizeof(*boxarray) * island_list_len, 
__func__);
 
   int index;
-  /* Coordinates for the center of the all the selected islands */
-  float selection_center[2] = {0.0f, 0.0f};
-  float selection_min[2], selection_max[2];
-  INIT_MINMAX2(selection_min, selection_max);
+  float selection_min_co[2], selection_max_co[2];
+  INIT_MINMAX2(selection_min_co, selection_max_co);
 
   LISTBASE_FOREACH_INDEX (struct FaceIsland *, island, &island_list, index) {
 
-/* Calculate bounding box of all selected islands */
-float bounds_min[2], bounds_max[2];
-INIT_MINMAX2(bounds_min, bounds_max);
-for (int i = 0; i < island->faces_len; i++) {
-  BMFace *f = island->faces[i];
-  BM_face_uv_minmax(f, bounds_min, bounds_max, island->cd_loop_uv_offset);
-}
-
-selection_min[0] = MIN2(bounds_min[0], selection_min[0]);
-selection_min[1] = MIN2(bounds_min[1], selection_min[1]);
-selection_max[0] = MAX2(bounds_max[0], selection_max[0]);
-selection_max[1] = MAX2(bounds_max[1], selection_max[1]);
+/* Skip calculation if not using Specified UDIM option */
+if (!use_target_udim) {
+  float bounds_min[2], bounds_max[2];
+  INIT_MINMAX2(bounds_min, bounds_max);
+  for (int i = 0; i < island->faces_len; i++) {
+BMFace *f = island->faces[i];
+BM_face_uv_minmax(f, bounds_min, bounds_max, 
island->cd_loop_uv_offset);
+  }
 
+  selection_min_co[0] = MIN2(boun

[Bf-blender-cvs] [8a652aac01c] tracking_tools: Clip Editor: Add Clip Tools to Footage Settings

2021-09-25 Thread Sebastian Koenig
Commit: 8a652aac01c92011ee42dfab1c8d1cd5928084de
Author: Sebastian Koenig
Date:   Sat Sep 25 11:05:15 2021 +0200
Branches: tracking_tools
https://developer.blender.org/rB8a652aac01c92011ee42dfab1c8d1cd5928084de

Clip Editor: Add Clip Tools to Footage Settings

Since the old toolshelf is gone Prefetch and Set Scene Frames was only
avaible via the menu. I have now moved the old Clip Tools panel over to
the UI area in the Footage category. This is the category that is open
when a user opens a new clip, so now these opertors are quickly availble
from the sidebar for the user to set the scene frames and prefetch the
footage.
The Reload button is a bit redundant, since we have a button for that
in the footage settings panel as well, but this way the panel looks the
same as in 2.93.

===

M   release/scripts/startup/bl_ui/space_clip.py

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 77d7efa898f..9ed9b56b525 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -422,10 +422,10 @@ class CLIP_PT_reconstruction_panel:
 
 class CLIP_PT_tools_clip(Panel):
 bl_space_type = 'CLIP_EDITOR'
-bl_region_type = 'TOOLS'
+bl_region_type = 'UI'
 bl_label = "Clip"
 bl_translation_context = bpy.app.translations.contexts.id_movieclip
-bl_category = "Track"
+bl_category = "Footage"
 
 @classmethod
 def poll(cls, context):
@@ -1992,6 +1992,7 @@ classes = (
 CLIP_PT_marker,
 CLIP_PT_proxy,
 CLIP_PT_footage,
+CLIP_PT_tools_clip,
 CLIP_PT_stabilization,
 CLIP_PT_2d_cursor,
 CLIP_PT_mask,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7b615a2dfb0] tracking_tools: Merge branch 'master' into tracking_tools

2021-09-25 Thread Sebastian Koenig
Commit: 7b615a2dfb09e26e000c8f3ab194681e1ef7c610
Author: Sebastian Koenig
Date:   Sat Sep 25 09:37:10 2021 +0200
Branches: tracking_tools
https://developer.blender.org/rB7b615a2dfb09e26e000c8f3ab194681e1ef7c610

Merge branch 'master' into tracking_tools

===



===

diff --cc release/scripts/startup/bl_ui/space_clip.py
index 09926998a37,c18d77987ad..77d7efa898f
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@@ -219,10 -138,6 +219,10 @@@ class CLIP_HT_header(Header)
  
  layout.separator_spacer()
  
 +if not show_region_tool_header:
- if not sc.view == 'CLIP':
++if sc.view == 'CLIP':
 +CLIP_HT_header.draw_xform_template(layout, context)
 +
  row = layout.row()
  if sc.view == 'CLIP':
  row.template_ID(sc, "clip", open="clip.open")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c1b8049adf8] sculpt-dev: Fix a few defaults for sculpt paint brush

2021-09-25 Thread Joseph Eagar
Commit: c1b8049adf869d632f033502fc2d89d9a4b9b03c
Author: Joseph Eagar
Date:   Sat Sep 25 01:49:52 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBc1b8049adf869d632f033502fc2d89d9a4b9b03c

Fix a few defaults for sculpt paint brush

===

M   source/blender/blenkernel/intern/brush_channel_define.h
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_paint_color.c

===

diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index a654eebe8a2..eee51e5a9c3 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -172,7 +172,7 @@ places in rna_engine_codebase are relevent:
   MAKE_FLOAT(normal_radius_factor, "Normal Radius", "Ratio between the brush 
radius and the radius that is going to be "
 "used to sample the normal", 0.5f, 0.0f, 1.0f)
   MAKE_FLOAT(hardness, "Hardness", "Brush falloff hardness", 0.0f, 0.0f, 1.0f)
-  MAKE_FLOAT(tip_roundness, "Tip Roundness", "", 0.0f, 0.0f, 1.0f)
+  MAKE_FLOAT(tip_roundness, "Tip Roundness", "", 1.0f, 0.0f, 1.0f)
   MAKE_BOOL(accumulate, "Accumulate", "", false)
   MAKE_ENUM(direction, "Direction", "", 0, _({
 {0, "ADD", "ADD", "Add", "Add effect of brush"},
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index 2b398ff053b..13812067140 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -317,6 +317,8 @@ static BrushSettingsMap brush_settings_map[] = {
   DEF(pose_deform_type, pose_deform_type, INT, INT)
   DEF(pose_origin_type, pose_origin_type, INT, INT)
   DEF(snake_hook_deform_type, snake_hook_deform_type, INT, INT)
+  DEF(tip_roundness, tip_roundness, FLOAT, FLOAT)
+  DEF(tip_scale_x, tip_scale_x, FLOAT, FLOAT)
 };
 
 static const int brush_settings_map_len = ARRAY_SIZE(brush_settings_map);
@@ -1123,6 +1125,7 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
   BRUSHSET_SET_FLOAT(chset, hardness, 0.4f);
   BRUSHSET_SET_FLOAT(chset, spacing, 10.0f);
   BRUSHSET_SET_FLOAT(chset, strength, 0.6f);
+  BRUSHSET_LOOKUP(chset, strength)->flag &= ~BRUSH_MAPPING_INHERIT;
   break;
 case SCULPT_TOOL_CLAY:
   GETCH(radius)->mappings[BRUSH_MAPPING_PRESSURE].flag |= 
BRUSH_MAPPING_ENABLED;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 5f5bccc1545..a49f72fc273 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -145,19 +145,19 @@ float SCULPT_get_float_intern(const SculptSession *ss,
   const Sculpt *sd,
   const Brush *br)
 {
+  BrushMappingData *mapdata = ss->cache ? &ss->cache->input_mapping : NULL;
+
   if (ss->cache && ss->cache->channels_final) {
-return BKE_brush_channelset_get_float(
-ss->cache->channels_final, idname, &ss->cache->input_mapping);
+return BKE_brush_channelset_get_float(ss->cache->channels_final, idname, 
mapdata);
   }
   else if (br && sd && br->channels && sd->channels) {
-return BKE_brush_channelset_get_final_float(
-br->channels, sd->channels, idname, &ss->cache->input_mapping);
+return BKE_brush_channelset_get_final_float(br->channels, sd->channels, 
idname, mapdata);
   }
   else if (br && br->channels) {
-return BKE_brush_channelset_get_float(br->channels, idname, 
&ss->cache->input_mapping);
+return BKE_brush_channelset_get_float(br->channels, idname, mapdata);
   }
   else if (sd && sd->channels) {
-return BKE_brush_channelset_get_float(sd->channels, idname, 
&ss->cache->input_mapping);
+return BKE_brush_channelset_get_float(sd->channels, idname, mapdata);
   }
   else {
 // eek!
@@ -170,19 +170,43 @@ int SCULPT_get_int_intern(const SculptSession *ss,
   const Sculpt *sd,
   const Brush *br)
 {
+  BrushMappingData *mapdata = ss->cache ? &ss->cache->input_mapping : NULL;
+
   if (ss->cache && ss->cache->channels_final) {
-return BKE_brush_channelset_get_int(
-ss->cache->channels_final, idname, &ss->cache->input_mapping);
+return BKE_brush_channelset_get_int(ss->cache->channels_final, idname, 
mapdata);
+  }
+  else if (br && br->channels && sd && sd->channels) {
+return BKE_brush_channelset_get_final_int(br->channels, sd->channels, 
idname, mapdata);
+  }
+  else if (br && br->channels) {
+return BKE_brush_channelset_get_int(br->channels, idname, mapdata);
+  }

[Bf-blender-cvs] [49e64d4e26a] sculpt-dev: Fix dyntopo undo crash

2021-09-25 Thread Joseph Eagar
Commit: 49e64d4e26af860213bd1320ceb6ba27b2f8050e
Author: Joseph Eagar
Date:   Sat Sep 25 01:36:23 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB49e64d4e26af860213bd1320ceb6ba27b2f8050e

Fix dyntopo undo crash

===

M   source/blender/blenkernel/BKE_brush_engine.h
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/bmesh/intern/bmesh_log.h
M   source/blender/editors/sculpt_paint/sculpt_undo.c

===

diff --git a/source/blender/blenkernel/BKE_brush_engine.h 
b/source/blender/blenkernel/BKE_brush_engine.h
index bfd29b559ae..2f6ebe1d740 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -143,7 +143,7 @@ typedef struct BrushTex {
   char idname[64], name[64];
 
   BrushChannelSet *channels;
-  MTex *__mtex;  // do not access directly. except for the actual evaluation 
code.
+  MTex __mtex;  // do not access directly. except for the actual evaluation 
code.
 } BrushTex;
 
 BrushTex *BKE_brush_tex_create();
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index bdc7cd638c0..2b398ff053b 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -947,8 +947,21 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
   SHOWWRK(radius_unit);
   SHOWWRK(use_frontface);
 
-  SHOWWRK(autosmooth);
-  SHOWWRK(topology_rake);
+  if (!ELEM(tool, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR)) {
+SHOWWRK(autosmooth);
+SHOWWRK(topology_rake);
+  }
+
+  if (ELEM(tool, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR)) {
+SHOWWRK(vcol_boundary_factor);
+SHOWWRK(vcol_boundary_exponent);
+SHOWWRK(vcol_boundary_radius_scale);
+SHOWWRK(vcol_boundary_spacing);
+  }
+  else if (tool == SCULPT_TOOL_VCOL_BOUNDARY) {
+SHOWWRK(vcol_boundary_exponent);
+  }
+
   SHOWWRK(normal_radius_factor);
   SHOWWRK(hardness);
 
@@ -1092,6 +1105,14 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
   GETCH(strength)->fvalue = 1.0f;
   GETCH(dyntopo_disabled)->ivalue = 1;
   break;
+case SCULPT_TOOL_SMEAR:
+  BRUSHSET_SET_FLOAT(chset, spacing, 5.0f);
+  BRUSHSET_SET_FLOAT(chset, strength, 1.0f);
+  BRUSHSET_LOOKUP(chset, strength)->mappings[BRUSH_MAPPING_PRESSURE].flag 
&=
+  ~BRUSH_MAPPING_ENABLED;
+  BRUSHSET_SET_BOOL(chset, dyntopo_disabled, true);
+  break;
+
 case SCULPT_TOOL_SLIDE_RELAX:
   GETCH(spacing)->fvalue = 10;
   GETCH(strength)->fvalue = 1.0f;
diff --git a/source/blender/bmesh/intern/bmesh_log.c 
b/source/blender/bmesh/intern/bmesh_log.c
index deb735c8cf3..573383447d6 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -57,6 +57,34 @@
 
 #define CUSTOMDATA
 
+#ifdef DEBUG_LOG_REFCOUNTNG
+static struct {
+  char tag[4192];
+} namestack[256] = {0};
+int namestack_i = 1;
+
+void _namestack_push(const char *name)
+{
+  namestack_i++;
+
+  strcpy(namestack[namestack_i].tag, namestack[namestack_i - 1].tag);
+  strcat(namestack[namestack_i].tag, ".");
+  strcat(namestack[namestack_i].tag, name);
+}
+
+#  define namestack_push() _namestack_push(__func__)
+
+void namestack_pop()
+{
+  namestack_i--;
+}
+
+#  define namestack_head_name namestack[namestack_i].tag
+#else
+#  define namestack_push()
+#  define namestack_pop()
+#  define namestack_head_name ""
+#endif
 //#define DO_LOG_PRINT
 
 #ifdef DO_LOG_PRINT
@@ -187,6 +215,30 @@ struct BMLog {
   bool dead;
 };
 
+//#define PRINT_LOG_REF_COUNTING
+
+static void _bm_log_addref(BMLog *log, const char *func)
+{
+  log->refcount++;
+
+#ifdef PRINT_LOG_REF_COUNTING
+  printf("%d %s: bm_log_addref: %p\n", log->refcount, namestack_head_name, 
log);
+  fflush(stdout);
+#endif
+}
+
+static void _bm_log_decref(BMLog *log, const char *func)
+{
+  log->refcount--;
+#ifdef PRINT_LOG_REF_COUNTING
+  printf("%d %s: bm_log_decref: %p\n", log->refcount, namestack_head_name, 
log);
+  fflush(stdout);
+#endif
+}
+
+#define bm_log_addref(log) _bm_log_addref(log, __func__)
+#define bm_log_decref(log) _bm_log_decref(log, __func__)
+
 typedef struct BMLogVert {
 #ifdef DO_LOG_PRINT
   char msg[64];
@@ -246,7 +298,7 @@ static void full_copy_load(BMesh *bm, BMLog *log, 
BMLogEntry *entry);
 
 BMLogEntry *bm_log_entry_add_ex(
 BMesh *bm, BMLog *log, bool combine_with_last, BMLogEntryType type, 
BMLogEntry *last_entry);
-static void bm_log_entry_free(BMLogEntry *entry);
+static bool bm_log_entry_free(BMLogEntry *entry);
 static bool bm_log_free_direct(BMLog *log, bool safe_mode);
 
 static void *log_ghash_lookup(BMLog *log, GHash *gh, const void *key)
@@ -1172,13 +1224,15 @@ static void bm_log_entry_free_direct(BMLogEntry *entry)
 /* Free the data in a

[Bf-blender-cvs] [63044a696bb] sculpt-dev: Sculpt: fix paint brush defaults

2021-09-25 Thread Joseph Eagar
Commit: 63044a696bb321cf92553562a39e5211890cd58e
Author: Joseph Eagar
Date:   Sat Sep 25 00:38:54 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB63044a696bb321cf92553562a39e5211890cd58e

Sculpt: fix paint brush defaults

===

M   source/blender/blenkernel/intern/brush_channel_define.h
M   source/blender/blenkernel/intern/brush_engine.c
M   source/blender/blenkernel/intern/brush_engine_presets.c

===

diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index eda2d66f4be..a654eebe8a2 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -187,12 +187,12 @@ MAKE_INT(jitter_absolute, "Absolute Jitter", "", 0, 0.0f, 
1000.0f)
 MAKE_FLOAT(smooth_stroke_radius, "Smooth Stroke Radius", "Minimum distance 
from last point before stroke continues", 10.0f, 10.0f, 200.0f)
 MAKE_FLOAT(smooth_stroke_factor, "Smooth Stroke Factor", "", 0.5f, 0.5f, 0.99f)
 MAKE_FLOAT_EX(rate, "Rate", "", 0.5, 0.0001f, 1.0f, 0.01f, 1.0f, false)
-MAKE_FLOAT(flow, "Flow", "Amount of paint that is applied per stroke sample", 
0.0f, 0.0f, 1.0f)
+MAKE_FLOAT(flow, "Flow", "Amount of paint that is applied per stroke sample", 
1.0f, 0.0f, 1.0f)
 MAKE_FLOAT(wet_mix, "Wet Mix", "Amount of paint that is picked from the 
surface into the brush color", 0.0f, 0.0f, 1.0f)
 MAKE_FLOAT(wet_persistence, "Wet Persistence", "Amount of wet paint that stays 
in the brush after applying paint to the surface", 0.0f, 0.0f, 1.0f)
-MAKE_FLOAT(density, "Density", "Amount of random elements that are going to be 
affected by the brush", 0.0f, 0.0f, 1.0f)
-MAKE_FLOAT(tip_scale_x, "Tip Scale X", "Scale of the brush tip in the X axis", 
0.0f, 0.0f, 1.0f)
-MAKE_FLOAT(dash_ratio, "Dash Ratio", "Ratio of samples in a cycle that the 
brush is enabled", 0.0f, 0.0f, 1.0f)
+MAKE_FLOAT(density, "Density", "Amount of random elements that are going to be 
affected by the brush", 1.0f, 0.0f, 1.0f)
+MAKE_FLOAT(tip_scale_x, "Tip Scale X", "Scale of the brush tip in the X axis", 
1.0f, 0.0f, 1.0f)
+MAKE_FLOAT(dash_ratio, "Dash Ratio", "Ratio of samples in a cycle that the 
brush is enabled", 1.0f, 0.0f, 1.0f)
 MAKE_FLOAT_EX(plane_offset, "Plane Offset", "Adjust plane on which the brush 
acts towards or away from the object surface", 0.0f, -2.0f, 2.0f, -0.5f, 0.5f, 
false)
 MAKE_BOOL(original_normal, "Original Normal", "When locked keep using normal 
of surface where stroke was initiated", false)
 MAKE_BOOL(original_plane, "Original Plane", "When locked keep using the plane 
origin of surface where stroke was initiated", false)
diff --git a/source/blender/blenkernel/intern/brush_engine.c 
b/source/blender/blenkernel/intern/brush_engine.c
index 954bec58090..7f80f366e3b 100644
--- a/source/blender/blenkernel/intern/brush_engine.c
+++ b/source/blender/blenkernel/intern/brush_engine.c
@@ -363,6 +363,7 @@ void BKE_brush_channel_init(BrushChannel *ch, 
BrushChannelType *def)
   ch->curve.preset = def->curve_preset;
   ch->fvalue = def->fvalue;
   ch->ivalue = def->ivalue;
+  copy_v4_v4(ch->vector, def->vector);
 
   ch->type = def->type;
   ch->def = def;
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index d2b43ee47da..bdc7cd638c0 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -825,6 +825,7 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
   ADDCH(wet_persistence);
   ADDCH(density);
   ADDCH(tip_scale_x);
+  ADDCH(tip_roundness);
   ADDCH(flow);
   ADDCH(rate);
 
@@ -1005,6 +1006,20 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
   SHOWWRK(crease_pinch_factor);
   SHOWWRK(rake_factor);
   SHOWWRK(snake_hook_deform_type);
+  break;
+case SCULPT_TOOL_PAINT:
+  SHOWWRK(color);
+  SHOWWRK(secondary_color);
+  SHOWWRK(wet_mix);
+  SHOWWRK(wet_persistence);
+  SHOWWRK(density);
+  SHOWWRK(tip_scale_x);
+  SHOWWRK(hardness);
+  SHOWWRK(wet_mix);
+  SHOWWRK(tip_roundness);
+  SHOWWRK(flow);
+  SHOWWRK(rate);
+
   break;
 case SCULPT_TOOL_POSE:
   SHOWWRK(pose_ik_segments);
@@ -1063,7 +1078,7 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
   break;
 }
 case SCULPT_TOOL_DRAW_SHARP:
-  BRUSHSET_LOOKUP(chset, spacing)->ivalue = 5;
+  BRUSHSET_LOOKUP(chset, spacing)->fvalue = 5;
   BRUSHSET_SET_INT(chset, direction, 1);
   BRUSHSET_LOOKUP(chset, radius)->mappings[BRUSH_MAPPING_PRESSURE].flag |=
   BRUSH_MAPPING_ENABLED;
@@ -1073,19 +1088,24 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
 case SCULPT_TOOL_DISPLACEMENT_ERASER:
 case SCULPT_TOOL_FAIRI

[Bf-blender-cvs] [028a0770f18] sculpt-dev: fix small but significant typo

2021-09-25 Thread Joseph Eagar
Commit: 028a0770f18b183aa8d8f5ed83e232be6fd09dd5
Author: Joseph Eagar
Date:   Sat Sep 25 00:21:24 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB028a0770f18b183aa8d8f5ed83e232be6fd09dd5

fix small but significant typo

===

M   source/blender/blenkernel/intern/brush_channel_define.h

===

diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index 014f17d0c45..eda2d66f4be 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -253,8 +253,8 @@ MAKE_ENUM(cloth_deform_type, "Deformation", "Deformation 
type that is used in th
   {-1}
 }))
 
-MAKE_ENUM(cloth_simulation_area_type, "Simulation Area", "Part of the mesh 
that is going to be simulated when the stroke is active", 
BRUSH_CLOTH_SIMULATION_AREA_LOCAL, _({
-  {BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC,
+MAKE_ENUM(cloth_simulation_area_type, "Simulation Area", "Part of the mesh 
that is going to be simulated when the stroke is active", 
BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC, _({
+  {BRUSH_CLOTH_SIMULATION_AREA_LOCAL,
 "LOCAL",
 "NONE",
 "Local",

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6b382e7fb02] sculpt-dev: Fix a few regressions in other paint modes.

2021-09-25 Thread Joseph Eagar
Commit: 6b382e7fb025e4df4f608f81e56fafd748c89aae
Author: Joseph Eagar
Date:   Sat Sep 25 00:19:31 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB6b382e7fb025e4df4f608f81e56fafd748c89aae

Fix a few regressions in other paint modes.

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   source/blender/blenkernel/BKE_brush_engine.h
M   source/blender/blenkernel/intern/brush_channel_define.h
M   source/blender/blenkernel/intern/brush_engine.c
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/blenlib/BLI_utildefines.h
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index be3e115b9a8..39c918ac5fa 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1353,31 +1353,38 @@ def brush_shared_settings(layout, context, brush, 
popover=False):
 
 if size or size_mode:
 if size:
-UnifiedPaintPanel.channel_unified(
+UnifiedPaintPanel.prop_unified(
 layout,
 context,
 brush,
 size_prop,
+unified_name="use_unified_size",
+pressure_name="use_pressure_size",
 text="Radius",
 slider=True,
 )
 if size_mode:
 #layout.row().prop(size_owner, "use_locked_size", expand=True)
-UnifiedPaintPanel.channel_unified(
+UnifiedPaintPanel.prop_unified(
 layout.row(),
 context,
 brush,
 "use_locked_size",
-expand=True
+unified_name="use_unified_size",
+pressure_name="use_pressure_size",
+expand=True,
+slider=True
 )
 layout.separator()
 
 if strength:
-UnifiedPaintPanel.channel_unified(
+UnifiedPaintPanel.prop_unified(
 layout,
 context,
 brush,
 "strength",
+unified_name="use_unified_strength",
+pressure_name="use_pressure_strength",
 slider=True
 )
 layout.separator()
diff --git a/source/blender/blenkernel/BKE_brush_engine.h 
b/source/blender/blenkernel/BKE_brush_engine.h
index f1fcbf80610..bfd29b559ae 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -46,6 +46,7 @@ This should completely replace UnifiedPaintSettings.
 */
 
 #include "DNA_sculpt_brush_types.h"
+#include "DNA_texture_types.h"
 
 struct BrushChannel;
 struct BlendWriter;
@@ -76,6 +77,7 @@ struct Sculpt;
   BKE_brush_channelset_set_float(chset, MAKE_BUILTIN_CH_NAME(channel), val)
 #define BRUSHSET_SET_INT(chset, channel, val) \
   BKE_brush_channelset_set_int(chset, MAKE_BUILTIN_CH_NAME(channel), val)
+#define BRUSHSET_SET_BOOL(chset, channel, val) BRUSHSET_SET_INT(chset, 
channel, (val) ? 1 : 0)
 
 //#define DEBUG_CURVE_MAPPING_ALLOC
 #ifdef DEBUG_CURVE_MAPPING_ALLOC
@@ -128,12 +130,40 @@ typedef struct BrushChannelType {
   bool user_defined;
 } BrushChannelType;
 
+/* since MTex is going away lets'
+   keep the texture abstraction
+   and simple.  From the brush engine's
+   point of view it's just a bunch of
+   BrushChannels.
+
+   This will eventually end up in DNA.*/
+
+typedef struct BrushTex {
+  struct BrushTex *next, *prev;
+  char idname[64], name[64];
+
+  BrushChannelSet *channels;
+  MTex *__mtex;  // do not access directly. except for the actual evaluation 
code.
+} BrushTex;
+
+BrushTex *BKE_brush_tex_create();
+void BKE_brush_tex_free(BrushTex *btex);
+void BKE_brush_tex_patch_channels(BrushTex *btex);
+void BKE_brush_tex_from_mtex(BrushTex *btex, MTex *mtex);
+
+// initializes the internal mtex struct
+void BKE_brush_tex_start(BrushTex *btex, BrushChannelSet *chset);
+
+#define MAKE_BRUSHTEX_SLOTS 5
+
 typedef struct BrushCommand {
   int tool;
-  float last_spacing_t[512];  // for different symmetry passes
+  float last_spacing_t[512];  // this is an array for different symmetry passes
   struct BrushChannelSet *params;
-  struct BrushChannelSet *params_final;
-  struct BrushChannelSet *params_mapped;
+  struct BrushChannelSet *params_final;   // with inheritence applied
+  struct BrushChannelSet *params_mapped;  // with pressure etc applied
+
+  BrushTex *texture_slots[MAKE_BRUSHTEX_SLOTS];
 } BrushCommand;
 
 typedef struct BrushCommandList {
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index 3f239487cd6..014f17d0c45 100644
-