82 if (active_color_layer ==
nullptr) {
90 if (deform_group ==
nullptr) {
98 if (!color_attribute) {
137 ot->
name =
"Vertex Color from Weight";
138 ot->
idname =
"PAINT_OT_vertex_color_from_weight";
139 ot->
description =
"Convert active weight into gray scale vertex colors";
170 [&](
const int i) { return faces[i].flag & ME_FACE_SEL; }),
194 if (active_color_layer ==
nullptr) {
210 color_attribute_corner.
materialize(selection, active_color_layer->
data);
244 ot->
name =
"Smooth Vertex Colors";
245 ot->
idname =
"PAINT_OT_vertex_color_smooth";
262 template<
typename TransformFn>
268 if (active_color_layer ==
nullptr) {
276 if (!color_attribute) {
285 using T = decltype(dummy);
286 threading::parallel_for(selection.index_range(), 1024, [&](IndexRange range) {
287 for ([[maybe_unused]] const int i : selection.slice(range)) {
288 if constexpr (std::is_same_v<T, ColorGeometry4f>) {
289 ColorGeometry4f color = color_attribute.varray.get<ColorGeometry4f>(i);
291 color_attribute.varray.set_by_copy(i, &color);
293 else if constexpr (std::is_same_v<T, ColorGeometry4b>) {
294 ColorGeometry4f color = color_attribute.varray.get<ColorGeometry4b>(i).decode();
296 ColorGeometry4b color_encoded = color.encode();
297 color_attribute.varray.set_by_copy(i, &color_encoded);
303 color_attribute.finish();
318 brightness /= 100.0f;
319 float delta = contrast / 200.0f;
326 gain = 1.0f - delta * 2.0f;
327 gain = 1.0f /
max_ff(gain, FLT_EPSILON);
328 offset = gain * (brightness - delta);
332 gain =
max_ff(1.0f - delta * 2.0f, 0.0f);
333 offset = gain * brightness + delta;
344 for (
int i = 0; i < 3; i++) {
359 ot->
name =
"Vertex Paint Brightness/Contrast";
360 ot->
idname =
"PAINT_OT_vertex_color_brightness_contrast";
371 const float min = -100,
max = +100;
395 hsv[0] += (
hue - 0.5f);
399 else if (hsv[0] < 0.0f) {
416 ot->
name =
"Vertex Paint Hue Saturation Value";
417 ot->
idname =
"PAINT_OT_vertex_color_hsv";
444 for (
int i = 0; i < 3; i++) {
457 ot->
name =
"Vertex Paint Invert";
458 ot->
idname =
"PAINT_OT_vertex_color_invert";
483 for (
int i = 0; i < 3; i++) {
496 ot->
name =
"Vertex Paint Levels";
497 ot->
idname =
"PAINT_OT_vertex_color_levels";
509 ot->
srna,
"offset", 0.0f, -1.0f, 1.0f,
"Offset",
"Value to add to colors", -1.0f, 1.0f);
511 ot->
srna,
"gain", 1.0f, 0.0f, FLT_MAX,
"Gain",
"Value to multiply colors by", 0.0f, 10.0f);
struct CustomDataLayer * BKE_id_attributes_active_color_get(const struct ID *id)
struct Object * CTX_data_active_object(const bContext *C)
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
#define BLI_assert_unreachable()
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float 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.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its hue
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
const CPPType & type() const
void materialize(void *dst) const
void set_all(const void *src)
GVArray adapt_domain(const GVArray &varray, const eAttrDomain from_domain, const eAttrDomain to_domain) const
int domain_size(const eAttrDomain domain) const
std::optional< AttributeMetaData > lookup_meta_data(const AttributeIDRef &attribute_id) const
GAttributeReader lookup(const AttributeIDRef &attribute_id) const
GAttributeWriter lookup_for_write(const AttributeIDRef &attribute_id)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_gpu_kernel_postfix int ccl_global int * indices
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
AttributeAccessor mesh_attributes(const Mesh &mesh)
eCustomDataType cpp_type_to_custom_data_type(const blender::CPPType &type)
MutableAttributeAccessor mesh_attributes_for_write(Mesh &mesh)
IndexMask find_indices_from_virtual_array(IndexMask indices_to_check, const VArray< bool > &virtual_array, int64_t parallel_grain_size, Vector< int64_t > &r_indices)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
bool vertex_paint_mode_poll(struct bContext *C)
static bool vertex_color_smooth(Object *ob)
static IndexMask get_selected_indices(const Mesh &mesh, const eAttrDomain domain, Vector< int64_t > &indices)
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 tag_object_after_update(Object *object)
static int vertex_color_hsv_exec(bContext *C, wmOperator *op)
void PAINT_OT_vertex_color_levels(wmOperatorType *ot)
static bool transform_active_color(Mesh &mesh, const TransformFn &transform_fn)
void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot)
static void face_corner_color_equalize_vertices(Mesh &mesh, const IndexMask selection)
static bool vertex_paint_from_weight(Object *ob)
void PAINT_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
static int vertex_color_brightness_contrast_exec(bContext *C, wmOperator *op)
static int vertex_color_invert_exec(bContext *C, wmOperator *UNUSED(op))
void PAINT_OT_vertex_color_invert(wmOperatorType *ot)
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 MDeformVert * dvert
ListBase vertex_group_names
int vertex_group_active_index
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)