Cleanup: Fix header location of color attribute fill function

The function was declared in a BKE header but defined in
the sculpt_paint editors module. Move it to the slightly-less
arbitrary ED_sculpt.hh header instead.
This commit is contained in:
Hans Goudey
2024-05-19 23:23:30 -04:00
parent 5687072223
commit 70b008d18d
5 changed files with 25 additions and 27 deletions

View File

@@ -748,19 +748,6 @@ void BKE_sculpt_sync_face_visibility_to_grids(Mesh *mesh, SubdivCCG *subdiv_ccg)
*/
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d);
/* paint_vertex.cc */
/**
* Fills the object's active color attribute layer with the fill color.
*
* \param only_selected: Limit the fill to selected faces or vertices.
*
* \return #true if successful.
*/
bool BKE_object_attributes_active_color_fill(Object &ob,
const float fill_color[4],
bool only_selected);
/** C accessor for #Object::sculpt::pbvh. */
PBVH *BKE_object_sculpt_pbvh_get(Object *object);
bool BKE_object_sculpt_use_dyntopo(const Object *object);

View File

@@ -44,6 +44,7 @@
#include "ED_geometry.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_sculpt.hh"
#include "geometry_intern.hh"
@@ -383,7 +384,7 @@ static int geometry_color_attribute_add_exec(bContext *C, wmOperator *op)
BKE_id_attributes_default_color_set(id, layer->name);
}
BKE_object_attributes_active_color_fill(*ob, color, false);
sculpt_paint::object_active_color_fill(*ob, color, false);
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_GEOM | ND_DATA, id);

View File

@@ -81,4 +81,13 @@ int active_update_and_get(bContext *C, Object &ob, const float mval_fl[2]);
} // namespace face_set
/**
* Fills the object's active color attribute layer with the fill color.
*
* \param only_selected: Limit the fill to selected faces or vertices.
*
* \return #true if successful.
*/
bool object_active_color_fill(Object &ob, const float fill_color[4], bool only_selected);
} // namespace blender::ed::sculpt_paint

View File

@@ -85,6 +85,7 @@
#include "ED_object.hh"
#include "ED_paint.hh"
#include "ED_screen.hh"
#include "ED_sculpt.hh"
#include "ED_uvedit.hh"
#include "ED_view3d.hh"
#include "ED_view3d_offscreen.hh"
@@ -6569,7 +6570,7 @@ static const char *proj_paint_color_attribute_create(wmOperator *op, Object &ob)
BKE_id_attributes_default_color_set(&mesh->id, layer->name);
}
BKE_object_attributes_active_color_fill(ob, color, false);
ed::sculpt_paint::object_active_color_fill(ob, color, false);
return layer->name;
}

View File

@@ -65,6 +65,7 @@
#include "ED_object_vgroup.hh"
#include "ED_paint.hh"
#include "ED_screen.hh"
#include "ED_sculpt.hh"
#include "ED_view3d.hh"
/* For IMB_BlendMode only. */
@@ -2085,6 +2086,8 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot)
/** \name Set Vertex Colors Operator
* \{ */
namespace blender::ed::sculpt_paint {
template<typename T>
static void fill_bm_face_or_corner_attribute(BMesh &bm,
const T &value,
@@ -2196,13 +2199,10 @@ static void fill_mesh_color(Mesh &mesh,
}
}
/**
* See doc-string for #BKE_object_attributes_active_color_fill.
*/
static bool paint_object_attributes_active_color_fill_ex(Object &ob,
ColorPaint4f fill_color,
bool only_selected = true,
bool affect_alpha = true)
static bool fill_active_color(Object &ob,
ColorPaint4f fill_color,
bool only_selected = true,
bool affect_alpha = true)
{
Mesh *mesh = BKE_mesh_from_object(&ob);
if (!mesh) {
@@ -2222,13 +2222,13 @@ static bool paint_object_attributes_active_color_fill_ex(Object &ob,
return true;
}
bool BKE_object_attributes_active_color_fill(Object &ob,
const float fill_color[4],
bool only_selected)
bool object_active_color_fill(Object &ob, const float fill_color[4], bool only_selected)
{
return paint_object_attributes_active_color_fill_ex(ob, ColorPaint4f(fill_color), only_selected);
return fill_active_color(ob, ColorPaint4f(fill_color), only_selected);
}
} // namespace blender::ed::sculpt_paint
static int vertex_color_set_exec(bContext *C, wmOperator *op)
{
using namespace blender::ed::sculpt_paint;
@@ -2251,7 +2251,7 @@ static int vertex_color_set_exec(bContext *C, wmOperator *op)
undo::push_node(obact, node, undo::Type::Color);
}
paint_object_attributes_active_color_fill_ex(obact, paintcol, true, affect_alpha);
fill_active_color(obact, paintcol, true, affect_alpha);
for (PBVHNode *node : nodes) {
BKE_pbvh_node_mark_update_color(node);