51 (
mesh &&
mesh->faces_num && !
mesh->deform_verts().is_empty());
78 if (!
mesh->attributes().contains(
mesh->active_color_attribute)) {
83 const int active_vertex_group_index =
mesh->vertex_group_active_index - 1;
86 if (deform_group ==
nullptr) {
94 mesh->active_color_attribute);
95 if (!color_attribute) {
134 ot->
name =
"Vertex Color from Weight";
135 ot->
idname =
"PAINT_OT_vertex_color_from_weight";
136 ot->
description =
"Convert active weight into gray scale vertex colors";
166 ".select_poly", domain,
false);
171 ".select_vert", domain,
false);
228 ot->
name =
"Smooth Vertex Colors";
229 ot->
idname =
"PAINT_OT_vertex_color_smooth";
257 if (!color_attribute) {
269 for ([[maybe_unused]]
const int i : segment) {
270 if constexpr (std::is_same_v<T, ColorGeometry4f>) {
275 else if constexpr (std::is_same_v<T, ColorGeometry4b>) {
309 pbvh.tag_attribute_changed(node_mask,
mesh.active_color_attribute);
322 brightness /= 100.0f;
323 float delta = contrast / 200.0f;
330 gain = 1.0f - delta * 2.0f;
332 offset = gain * (brightness - delta);
336 gain =
max_ff(1.0f - delta * 2.0f, 0.0f);
337 offset = gain * brightness + delta;
349 for (
int i = 0; i < 3; i++) {
362 ot->
name =
"Vertex Paint Brightness/Contrast";
363 ot->
idname =
"PAINT_OT_vertex_color_brightness_contrast";
364 ot->
description =
"Adjust vertex color brightness/contrast";
374 const float min = -100,
max = +100;
399 hsv[0] += (hue - 0.5f);
403 else if (hsv[0] < 0.0f) {
418 ot->
name =
"Vertex Paint Hue/Saturation/Value";
419 ot->
idname =
"PAINT_OT_vertex_color_hsv";
420 ot->
description =
"Adjust vertex color Hue/Saturation/Value";
449 for (
int i = 0; i < 3; i++) {
460 ot->
name =
"Vertex Paint Invert";
461 ot->
idname =
"PAINT_OT_vertex_color_invert";
487 for (
int i = 0; i < 3; i++) {
500 ot->
name =
"Vertex Paint Levels";
501 ot->
idname =
"PAINT_OT_vertex_color_levels";
502 ot->
description =
"Adjust levels of vertex colors";
513 ot->
srna,
"offset", 0.0f, -1.0f, 1.0f,
"Offset",
"Value to add to colors", -1.0f, 1.0f);
515 ot->
srna,
"gain", 1.0f, 0.0f,
FLT_MAX,
"Gain",
"Value to multiply colors by", 0.0f, 10.0f);
#define BLT_I18NCONTEXT_COLOR
Object is a sort of wrapper for general info.
#define BLI_assert_unreachable()
void to_static_type(Fn &&fn) const
const void * data() const
const CPPType & type() const
void materialize(void *dst) const
void get(int64_t index, void *r_value) const
void set_all(const void *src)
void set_by_copy(int64_t index, const void *value)
static IndexMask from_bools(Span< bool > bools, LinearAllocator<> &memory)
static IndexMask from_bools_inverse(Span< bool > bools, LinearAllocator<> &memory)
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
bool contains(StringRef name) const
GVArray adapt_domain(const GVArray &varray, const AttrDomain from_domain, const AttrDomain to_domain) const
GAttributeReader lookup(const StringRef name) const
GAttributeWriter lookup_for_write(StringRef name)
GSpanAttributeWriter lookup_for_write_span(StringRef name)
void foreach_segment(Fn &&fn, Mode mode=exec_mode::serial) const
pbvh::Tree * pbvh_get(Object &object)
IndexMask all_leaf_nodes(const Tree &pbvh, IndexMaskMemory &memory)
AttrType cpp_type_to_attribute_type(const CPPType &type)
BLI_INLINE ColorSceneLinear4f< Alpha > decode(const ColorSceneLinearByteEncoded4b< Alpha > &color)
BLI_INLINE ColorSceneLinearByteEncoded4b< Alpha > encode(const ColorSceneLinear4f< Alpha > &color)
constexpr ParallelGrainSize grain_size(int grain_size)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static bool vertex_paint_from_weight(Object &ob)
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
static wmOperatorStatus vertex_paint_from_weight_exec(bContext *C, wmOperator *)
static wmOperatorStatus vertex_color_smooth_exec(bContext *C, wmOperator *)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
static void transform_active_color(bContext *C, const FunctionRef< void(ColorGeometry4f &color)> transform_fn)
static wmOperatorStatus vertex_color_levels_exec(bContext *C, wmOperator *op)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static void face_corner_color_equalize_verts(Mesh &mesh, const IndexMask selection)
void PAINT_OT_vertex_color_hsv(wmOperatorType *ot)
void DEG_id_tag_update(ID *id, unsigned int flags)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
BMesh const char void * data
Mesh * BKE_mesh_from_object(Object *ob)
void BKE_mesh_batch_cache_dirty_tag(Mesh *mesh, eMeshBatchDirtyMode mode)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
static void transform_active_color_data(Mesh &mesh, const FunctionRef< void(ColorGeometry4f &color)> transform_fn)
void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot)
void PAINT_OT_vertex_color_levels(wmOperatorType *ot)
static void tag_object_after_update(Object &object)
void PAINT_OT_vertex_color_invert(wmOperatorType *ot)
static bool vertex_color_smooth(Object &ob)
bool ED_mesh_color_ensure(Mesh *mesh, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void PAINT_OT_vertex_color_smooth(wmOperatorType *ot)
static wmOperatorStatus vertex_color_invert_exec(bContext *C, wmOperator *)
bool vertex_paint_mode_poll(bContext *C)
MINLINE float max_ff(float a, float b)
static wmOperatorStatus vertex_color_hsv_exec(bContext *C, wmOperator *op)
void BKE_sculptsession_update_for_edit(Depsgraph *depsgraph, Object *ob_orig, bool is_paint_tool)
static IndexMask get_selected_indices(const Mesh &mesh, const bke::AttrDomain domain, IndexMaskMemory &memory)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
void PAINT_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
@ BKE_MESH_BATCH_DIRTY_ALL
static wmOperatorStatus vertex_color_brightness_contrast_exec(bContext *C, wmOperator *op)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
Object * CTX_data_active_object(const bContext *C)
float RNA_float_get(PointerRNA *ptr, const char *name)
static bool vertex_weight_paint_mode_poll(bContext *C)
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT