diff options
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index dc3c2a8e55e..153a65d67db 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -33,6 +33,7 @@ #include "BLT_translation.h" +#include "BKE_bpath.h" #include "BKE_brush.h" #include "BKE_colortools.h" #include "BKE_context.h" @@ -218,6 +219,14 @@ static void brush_foreach_id(ID *id, LibraryForeachIDData *data) BKE_texture_mtex_foreach_id(data, &brush->mask_mtex)); } +static void brush_foreach_path(ID *id, BPathForeachPathData *bpath_data) +{ + Brush *brush = (Brush *)id; + if (brush->icon_filepath[0] != '\0') { + BKE_bpath_foreach_path_fixed_process(bpath_data, brush->icon_filepath); + } +} + static void brush_blend_write(BlendWriter *writer, ID *id, const void *id_address) { Brush *brush = (Brush *)id; @@ -414,6 +423,7 @@ IDTypeInfo IDType_ID_BR = { .name_plural = "brushes", .translation_context = BLT_I18NCONTEXT_ID_BRUSH, .flags = IDTYPE_FLAGS_NO_ANIMDATA, + .asset_type_info = NULL, .init_data = brush_init_data, .copy_data = brush_copy_data, @@ -421,6 +431,7 @@ IDTypeInfo IDType_ID_BR = { .make_local = brush_make_local, .foreach_id = brush_foreach_id, .foreach_cache = NULL, + .foreach_path = brush_foreach_path, .owner_get = NULL, .blend_write = brush_blend_write, @@ -503,10 +514,6 @@ static void brush_defaults(Brush *brush) /* Datablock add/copy/free/make_local */ -/** - * \note Resulting brush will have two users: one as a fake user, - * another is assumed to be used by the caller. - */ Brush *BKE_brush_add(Main *bmain, const char *name, const eObjectMode ob_mode) { Brush *brush; @@ -518,7 +525,6 @@ Brush *BKE_brush_add(Main *bmain, const char *name, const eObjectMode ob_mode) return brush; } -/* add grease pencil settings */ void BKE_brush_init_gpencil_settings(Brush *brush) { if (brush->gpencil_settings == NULL) { @@ -546,7 +552,6 @@ void BKE_brush_init_gpencil_settings(Brush *brush) brush->gpencil_settings->curve_rand_value = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } -/* add a new gp-brush */ Brush *BKE_brush_add_gpencil(Main *bmain, ToolSettings *ts, const char *name, eObjectMode mode) { Paint *paint = NULL; @@ -586,7 +591,6 @@ Brush *BKE_brush_add_gpencil(Main *bmain, ToolSettings *ts, const char *name, eO return brush; } -/* Delete a Brush. */ bool BKE_brush_delete(Main *bmain, Brush *brush) { if (brush->id.tag & LIB_TAG_INDIRECT) { @@ -1320,7 +1324,6 @@ static Brush *gpencil_brush_ensure( return brush; } -/* Create a set of grease pencil Drawing presets. */ void BKE_brush_gpencil_paint_presets(Main *bmain, ToolSettings *ts, const bool reset) { bool r_new = false; @@ -1422,7 +1425,6 @@ void BKE_brush_gpencil_paint_presets(Main *bmain, ToolSettings *ts, const bool r } } -/* Create a set of grease pencil Vertex Paint presets. */ void BKE_brush_gpencil_vertex_presets(Main *bmain, ToolSettings *ts, const bool reset) { bool r_new = false; @@ -1469,7 +1471,6 @@ void BKE_brush_gpencil_vertex_presets(Main *bmain, ToolSettings *ts, const bool } } -/* Create a set of grease pencil Sculpt Paint presets. */ void BKE_brush_gpencil_sculpt_presets(Main *bmain, ToolSettings *ts, const bool reset) { bool r_new = false; @@ -1544,7 +1545,6 @@ void BKE_brush_gpencil_sculpt_presets(Main *bmain, ToolSettings *ts, const bool } } -/* Create a set of grease pencil Weight Paint presets. */ void BKE_brush_gpencil_weight_presets(Main *bmain, ToolSettings *ts, const bool reset) { bool r_new = false; @@ -1946,9 +1946,6 @@ void BKE_brush_sculpt_reset(Brush *br) } } -/** - * Library Operations - */ void BKE_brush_curve_preset(Brush *b, eCurveMappingPreset preset) { CurveMapping *cumap = NULL; @@ -1966,10 +1963,6 @@ void BKE_brush_curve_preset(Brush *b, eCurveMappingPreset preset) BKE_curvemapping_changed(cumap, false); } -/* Generic texture sampler for 3D painting systems. point has to be either in - * region space mouse coordinates, or 3d world coordinates for 3D mapping. - * - * rgba outputs straight alpha. */ float BKE_brush_sample_tex_3d(const Scene *scene, const Brush *br, const float point[3], @@ -2362,7 +2355,6 @@ void BKE_brush_weight_set(const Scene *scene, Brush *brush, float value) } } -/* scale unprojected radius to reflect a change in the brush's 2D size */ void BKE_brush_scale_unprojected_radius(float *unprojected_radius, int new_brush_size, int old_brush_size) @@ -2375,7 +2367,6 @@ void BKE_brush_scale_unprojected_radius(float *unprojected_radius, (*unprojected_radius) *= scale; } -/* scale brush size to reflect a change in the brush's unprojected radius */ void BKE_brush_scale_size(int *r_brush_size, float new_unprojected_radius, float old_unprojected_radius) @@ -2426,7 +2417,6 @@ void BKE_brush_randomize_texture_coords(UnifiedPaintSettings *ups, bool mask) } } -/* Uses the brush curve control to find a strength value */ float BKE_brush_curve_strength(const Brush *br, float p, const float len) { float strength = 1.0f; @@ -2474,8 +2464,7 @@ float BKE_brush_curve_strength(const Brush *br, float p, const float len) return strength; } -/* Uses the brush curve control to find a strength value between 0 and 1 */ -float BKE_brush_curve_strength_clamped(Brush *br, float p, const float len) +float BKE_brush_curve_strength_clamped(const Brush *br, float p, const float len) { float strength = BKE_brush_curve_strength(br, p, len); @@ -2517,7 +2506,6 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side, bool use_sec return texcache; } -/**** Radial Control ****/ struct ImBuf *BKE_brush_gen_radial_control_imbuf(Brush *br, bool secondary, bool display_gradient) { ImBuf *im = MEM_callocN(sizeof(ImBuf), "radial control texture"); |