Fix T74899: Add Draw Face Sets brush to versioning defaults

Brushes are created automatically when the tools is enabled, but this
way it gets correct defaults and it is accesible from scripts.

Reviewed By: jbakker

Maniphest Tasks: T74899

Differential Revision: https://developer.blender.org/D7199
This commit is contained in:
Pablo Dobarro 2020-03-20 19:49:20 +01:00
parent 32bb848838
commit c286fa309e
Notes: blender-bot 2023-02-14 18:59:57 +01:00
Referenced by issue blender/blender-addons#74899, "Draw Face Sets"-brush not in bpy.data.brushes until it has been the active tool once
1 changed files with 8 additions and 0 deletions

View File

@ -582,6 +582,14 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
brush->sculpt_tool = SCULPT_TOOL_SIMPLIFY;
}
brush_name = "Draw Face Sets";
brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
if (!brush) {
brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
id_us_min(&brush->id);
brush->sculpt_tool = SCULPT_TOOL_DRAW_FACE_SETS;
}
/* Use the same tool icon color in the brush cursor */
for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->ob_mode & OB_MODE_SCULPT) {