36 {0,
nullptr, 0,
nullptr,
nullptr},
90 float delta = contrast / 2.0f;
97 if (contrast > 0.0f) {
98 gain = 1.0f - delta * 2.0f;
99 gain = 1.0f /
math::max(gain, FLT_EPSILON);
100 offset = gain * (brightness - delta);
104 gain =
math::max(1.0f - delta * 2.0f, 0.0f);
105 offset = gain * brightness + delta;
108 std::atomic<bool> any_changed;
112 if (
curves.curves_num() == 0) {
120 any_changed.store(any_changed | changed, std::memory_order_relaxed);
133 ot->name =
"Vertex Paint Brightness/Contrast";
134 ot->idname =
"GREASE_PENCIL_OT_vertex_color_brightness_contrast";
135 ot->description =
"Adjust vertex color brightness/contrast";
148 RNA_def_float(
ot->srna,
"brightness", 0.0f, -1.0f, 1.0f,
"Brightness",
"", -1.0f, 1.0f);
149 RNA_def_float(
ot->srna,
"contrast", 0.0f, -1.0f, 1.0f,
"Contrast",
"", -1.0f, 1.0f);
162 std::atomic<bool> any_changed;
166 if (
curves.curves_num() == 0) {
174 hsv[0] += (
hue - 0.5f);
178 else if (hsv[0] < 0.0f) {
188 any_changed.store(any_changed | changed, std::memory_order_relaxed);
201 ot->name =
"Vertex Paint Hue/Saturation/Value";
202 ot->idname =
"GREASE_PENCIL_OT_vertex_color_hsv";
203 ot->description =
"Adjust vertex color HSV values";
216 RNA_def_float(
ot->srna,
"s", 1.0f, 0.0f, 2.0f,
"Saturation",
"", 0.0f, 2.0f);
217 RNA_def_float(
ot->srna,
"v", 1.0f, 0.0f, 2.0f,
"Value",
"", 0.0f, 2.0f);
227 std::atomic<bool> any_changed;
231 if (
curves.curves_num() == 0) {
239 any_changed.store(any_changed | changed, std::memory_order_relaxed);
252 ot->name =
"Vertex Paint Invert";
253 ot->idname =
"GREASE_PENCIL_OT_vertex_color_invert";
254 ot->description =
"Invert RGB values";
277 std::atomic<bool> any_changed;
281 if (
curves.curves_num() == 0) {
289 any_changed.store(any_changed | changed, std::memory_order_relaxed);
302 ot->name =
"Vertex Paint Levels";
303 ot->idname =
"GREASE_PENCIL_OT_vertex_color_levels";
304 ot->description =
"Adjust levels of vertex colors";
318 ot->srna,
"offset", 0.0f, -1.0f, 1.0f,
"Offset",
"Value to add to colors", -1.0f, 1.0f);
320 ot->srna,
"gain", 1.0f, 0.0f,
FLT_MAX,
"Gain",
"Value to multiply colors by", 0.0f, 10.0f);
335 const ColorGeometry4f target_color(color_linear[0], color_linear[1], color_linear[2], 1.0f);
337 std::atomic<bool> any_changed;
341 if (
curves.curves_num() == 0) {
358 any_changed.store(any_changed | changed, std::memory_order_relaxed);
371 ot->name =
"Vertex Paint Set Color";
372 ot->idname =
"GREASE_PENCIL_OT_vertex_color_set";
373 ot->description =
"Set active color to all selected vertex";
385 RNA_def_float(
ot->srna,
"factor", 1.0f, 0.0f, 1.0f,
"Factor",
"Mix Factor", 0.0f, 1.0f);
395 std::atomic<bool> any_changed;
399 if (
curves.curves_num() == 0) {
403 bool changed =
false;
405 changed |=
curves.attributes_for_write().remove(
"vertex_color");
408 changed |=
curves.attributes_for_write().remove(
"fill_color");
410 any_changed.store(any_changed | changed, std::memory_order_relaxed);
423 ot->name =
"Reset Vertex Color";
424 ot->idname =
"GREASE_PENCIL_OT_stroke_reset_vertex_color";
425 ot->description =
"Reset vertex color for all or selected strokes";
const float * BKE_brush_color_get(const Scene *scene, const Paint *paint, const Brush *brush)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Low-level operations for curves.
Low-level operations for grease pencil.
Paint * BKE_paint_get_active_from_context(const bContext *C)
Brush * BKE_paint_brush(Paint *paint)
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 srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
void DEG_id_tag_update(ID *id, unsigned int flags)
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 Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture 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
bool contains(const StringRef attribute_id) const
AttributeAccessor attributes() const
bke::CurvesGeometry & strokes_for_write()
const bke::CurvesGeometry & strokes() const
MutableSpan< ColorGeometry4f > fill_colors_for_write()
MutableSpan< ColorGeometry4f > vertex_colors_for_write()
void foreach_index(Fn &&fn) const
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void ED_operatortypes_grease_pencil_vertex_paint()
static int grease_pencil_vertex_paint_invert_exec(bContext *C, wmOperator *op)
IndexMask retrieve_editable_points(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
static const EnumPropertyItem prop_grease_pencil_vertex_mode[]
static void GREASE_PENCIL_OT_vertex_color_levels(wmOperatorType *ot)
bool grease_pencil_vertex_painting_poll(bContext *C)
static int grease_pencil_vertex_paint_reset_exec(bContext *C, wmOperator *op)
static int grease_pencil_vertex_paint_levels_exec(bContext *C, wmOperator *op)
static int grease_pencil_vertex_paint_hsv_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_stroke_reset_vertex_color(wmOperatorType *ot)
static void GREASE_PENCIL_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
static void GREASE_PENCIL_OT_vertex_color_set(wmOperatorType *ot)
static void GREASE_PENCIL_OT_vertex_color_invert(wmOperatorType *ot)
static int grease_pencil_vertex_paint_set_exec(bContext *C, wmOperator *op)
static void GREASE_PENCIL_OT_vertex_color_hsv(wmOperatorType *ot)
IndexMask retrieve_editable_strokes(Object &object, const bke::greasepencil::Drawing &drawing, int layer_index, IndexMaskMemory &memory)
Vector< MutableDrawingInfo > retrieve_editable_drawings(const Scene &scene, GreasePencil &grease_pencil)
static int grease_pencil_vertex_paint_brightness_contrast_exec(bContext *C, wmOperator *op)
static bool apply_color_operation_for_mode(const VertexColorMode mode, Object &object, MutableDrawingInfo &info, Fn &&fn)
T interpolate(const T &a, const T &b, const FactorT &t)
T max(const T &a, const T &b)
void parallel_for_each(Range &&range, const Function &function)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
float RNA_float_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
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)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
bke::greasepencil::Drawing & drawing
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))