79 for (
int i = 0; i < me->
totpoly; i++, mp++) {
90 *(
int *)lcol = paintcol;
94 }
while (j < mp->totloop);
121 ot->
name =
"Set Vertex Colors";
122 ot->
idname =
"PAINT_OT_vertex_color_set";
123 ot->
description =
"Fill the active vertex color layer with the current paint color";
152 vgroup_active = ob->
actdef - 1;
153 for (
int i = 0; i < me->
totpoly; i++, mp++) {
159 const uchar grayscale = weight * 255;
165 }
while (j < mp->totloop);
186 ot->
name =
"Vertex Color from Weight";
187 ot->
idname =
"PAINT_OT_vertex_color_from_weight";
188 ot->
description =
"Convert active weight into gray scale vertex colors";
211 bool has_shared =
false;
223 for (i = 0, mp = me->
mpoly; i < me->totpoly; i++, mp++) {
227 for (
int j = 0; j < mp->
totloop; j++, ml++, lcol++) {
228 scol[ml->
v][0] += lcol->
r;
229 scol[ml->
v][1] += lcol->
g;
230 scol[ml->
v][2] += lcol->
b;
238 for (i = 0; i < me->
totvert; i++) {
239 if (scol[i][3] != 0) {
246 for (i = 0, mp = me->
mpoly; i < me->totpoly; i++, mp++) {
250 for (
int j = 0; j < mp->
totloop; j++, ml++, lcol++) {
252 lcol->
r = scol[ml->
v][0];
253 lcol->
g = scol[ml->
v][1];
254 lcol->
b = scol[ml->
v][2];
283 for (i = 0; i < me->
totpoly; i++, mp++) {
297 }
while (j < mp->totloop);
325 ot->
name =
"Smooth Vertex Colors";
326 ot->
idname =
"PAINT_OT_vertex_color_smooth";
355 for (
int i = 0; i < 3; i++) {
368 brightness /= 100.0f;
369 float delta = contrast / 200.0f;
376 gain = 1.0f - delta * 2.0f;
404 ot->
name =
"Vertex Paint Brightness/Contrast";
405 ot->
idname =
"PAINT_OT_vertex_color_brightness_contrast";
416 const float min = -100,
max = +100;
434 hsv[0] += (
data->hue - 0.5f);
438 else if (hsv[0] < 0.0f) {
467 ot->
name =
"Vertex Paint Hue Saturation Value";
468 ot->
idname =
"PAINT_OT_vertex_color_hsv";
486 for (
int i = 0; i < 3; i++) {
487 r_col[i] = 1.0f -
col[i];
505 ot->
name =
"Vertex Paint Invert";
506 ot->
idname =
"PAINT_OT_vertex_color_invert";
525 for (
int i = 0; i < 3; i++) {
549 ot->
name =
"Vertex Paint Levels";
550 ot->
idname =
"PAINT_OT_vertex_color_levels";
562 ot->
srna,
"offset", 0.0f, -1.0f, 1.0f,
"Offset",
"Value to add to colors", -1.0f, 1.0f);
564 ot->
srna,
"gain", 1.0f, 0.0f, FLT_MAX,
"Gain",
"Value to multiply colors by", 0.0f, 10.0f);
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
void BKE_mesh_tessface_clear(struct Mesh *mesh)
struct Mesh * BKE_mesh_from_object(struct Object *ob)
void BKE_mesh_batch_cache_dirty_tag(struct Mesh *me, eMeshBatchDirtyMode mode)
@ BKE_MESH_BATCH_DIRTY_ALL
MINLINE float max_ff(float a, float b)
MINLINE int divide_round_i(int a, int b)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_COPY_ON_WRITE
Object is a sort of wrapper for general info.
bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
Read Guarded memory(de)allocation.
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
bool vertex_paint_mode_poll(struct bContext *C)
unsigned int vpaint_get_current_col(struct Scene *scene, struct VPaint *vp, bool secondary)
bool ED_vpaint_color_transform(struct Object *ob, VPaintTransform_Callback vpaint_tx_fn, const void *user_data)
void PAINT_OT_vertex_color_set(wmOperatorType *ot)
static bool vertex_color_smooth(Object *ob)
void PAINT_OT_vertex_color_smooth(wmOperatorType *ot)
static bool vertex_weight_paint_mode_poll(bContext *C)
void PAINT_OT_vertex_color_hsv(wmOperatorType *ot)
static int vertex_paint_from_weight_exec(bContext *C, wmOperator *UNUSED(op))
static int vertex_color_levels_exec(bContext *C, wmOperator *op)
static int vertex_color_smooth_exec(bContext *C, wmOperator *UNUSED(op))
static void vpaint_tx_invert(const float col[3], const void *UNUSED(user_data), float r_col[3])
static void tag_object_after_update(Object *object)
static int vertex_color_hsv_exec(bContext *C, wmOperator *op)
static void vpaint_tx_brightness_contrast(const float col[3], const void *user_data, float r_col[3])
void PAINT_OT_vertex_color_levels(wmOperatorType *ot)
void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot)
static bool vertex_paint_from_weight(Object *ob)
static void vertex_color_smooth_looptag(Mesh *me, const bool *mlooptag)
void PAINT_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
static int vertex_color_brightness_contrast_exec(bContext *C, wmOperator *op)
static void vpaint_tx_levels(const float col[3], const void *user_data, float r_col[3])
static int vertex_color_invert_exec(bContext *C, wmOperator *UNUSED(op))
static bool vertex_color_set(Object *ob, uint paintcol)
static void vpaint_tx_hsv(const float col[3], const void *user_data, float r_col[3])
void PAINT_OT_vertex_color_invert(wmOperatorType *ot)
static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op))
float RNA_float_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
struct MLoopCol * mloopcol
struct MDeformVert * dvert
struct ToolSettings * toolsettings
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
void WM_event_add_notifier(const bContext *C, uint type, void *reference)