67 int size = int(scalar * old_size);
69 if (
abs(old_size - size) <
U.pixelsize) {
73 else if (scalar < 1) {
85 unprojected_size = std::max(unprojected_size, 0.001f);
99 ot->
name =
"Scale Sculpt/Paint Brush Size";
101 ot->
idname =
"BRUSH_OT_scale_size";
109 RNA_def_float(ot->
srna,
"scalar", 1, 0, 2,
"Scalar",
"Factor to scale brush size by", 0, 2);
202 scd = MEM_new<StencilControlData>(__func__);
237#define PIXEL_MARGIN 5
240 const float mvalf[2] = {
float(mval[0]),
float(mval[1])};
301 switch (event->
type) {
369 {0,
nullptr, 0,
nullptr,
nullptr},
375 {0,
nullptr, 0,
nullptr,
nullptr},
378 ot->
name =
"Stencil Brush Control";
380 ot->
idname =
"BRUSH_OT_stencil_control";
406 MTex *mtex =
nullptr;
415 float orig_area, stencil_area, factor;
419 aspx *= mtex->
size[0];
420 aspy *= mtex->
size[1];
428 orig_area =
fabsf(aspx * aspy);
437 factor =
sqrtf(stencil_area / orig_area);
458 ot->
name =
"Image Aspect";
460 "When using an image texture, adjust the stencil size to fit the image aspect ratio";
461 ot->
idname =
"BRUSH_OT_stencil_fit_image_aspect";
473 ot->
srna,
"mask",
false,
"Modify Mask Stencil",
"Modify either the primary or mask stencil");
514 ot->
name =
"Reset Transform";
515 ot->
description =
"Reset the stencil transformation to the default";
516 ot->
idname =
"BRUSH_OT_stencil_reset_transform";
526 ot->
srna,
"mask",
false,
"Modify Mask Stencil",
"Modify either the primary or mask stencil");
537 "Add Curve Point and Slide",
538 "Add new curve point and slide it",
540 ot->
description =
"Add new curve point and slide it";
664 static const char *name =
"Paint Stroke Modal";
Read Blender memory allocation and freeing.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
void modal_keymap(wmKeyConfig *keyconf)
void PAINT_OT_hide_show_polyline_gesture(wmOperatorType *ot)
void PAINT_OT_hide_show_masked(wmOperatorType *ot)
void PAINT_OT_hide_show_line_gesture(wmOperatorType *ot)
void PAINT_OT_visibility_invert(wmOperatorType *ot)
void PAINT_OT_hide_show_lasso_gesture(wmOperatorType *ot)
void PAINT_OT_visibility_filter(wmOperatorType *ot)
void PAINT_OT_hide_show_all(wmOperatorType *ot)
void PAINT_OT_hide_show(wmOperatorType *ot)
void PAINT_OT_mask_polyline_gesture(wmOperatorType *ot)
void PAINT_OT_mask_line_gesture(wmOperatorType *ot)
void PAINT_OT_mask_box_gesture(wmOperatorType *ot)
void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
void PAINT_OT_mask_flood_fill(wmOperatorType *ot)
bool curves_sculpt_poll(bContext *C)
void BRUSH_OT_asset_save(wmOperatorType *ot)
void PAINT_OT_sample_color(wmOperatorType *ot)
bool paint_supports_texture(PaintMode mode)
void BRUSH_OT_asset_delete(wmOperatorType *ot)
void BRUSH_OT_asset_edit_metadata(wmOperatorType *ot)
bool sculpt_mode_poll(bContext *C)
void BRUSH_OT_asset_load_preview(wmOperatorType *ot)
void BRUSH_OT_asset_revert(wmOperatorType *ot)
void BRUSH_OT_asset_save_as(wmOperatorType *ot)
void BRUSH_OT_asset_activate(wmOperatorType *ot)
void WM_main_add_notifier(uint type, void *reference)
@ STENCIL_CONSTRAINT_NONE
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
void PAINT_OT_face_select_linked(wmOperatorType *ot)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void PAINT_OT_image_paint(wmOperatorType *ot)
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
static void BRUSH_OT_scale_size(wmOperatorType *ot)
void PAINT_OT_vert_select_ungrouped(wmOperatorType *ot)
void PAINT_OT_project_image(wmOperatorType *ot)
void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
void PAINT_OT_vertex_color_set(wmOperatorType *ot)
bool image_texture_paint_poll(bContext *C)
MINLINE void copy_v2_v2(float r[2], const float a[2])
void PAINT_OT_weight_sample_group(wmOperatorType *ot)
static wmOperatorStatus stencil_reset_transform_exec(bContext *C, wmOperator *op)
void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot)
void PALETTE_OT_new(wmOperatorType *ot)
void PAINT_OT_face_vert_reveal(wmOperatorType *ot)
void SCULPT_OT_uv_sculpt_relax(wmOperatorType *ot)
void PAINT_OT_vertex_paint(wmOperatorType *ot)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void PAINT_OT_vert_select_linked(wmOperatorType *ot)
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
static void BRUSH_OT_stencil_reset_transform(wmOperatorType *ot)
void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
void PAINT_OT_weight_paint(wmOperatorType *ot)
void ED_region_tag_redraw(ARegion *region)
static wmOperatorStatus brush_scale_size_exec(bContext *C, wmOperator *op)
static wmOperatorStatus stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool stencil_control_poll(bContext *C)
static wmOperatorStatus stencil_fit_image_aspect_exec(bContext *C, wmOperator *op)
bool paint_curve_poll(bContext *C)
void PAINT_OT_vert_select_more(wmOperatorType *ot)
void PAINTCURVE_OT_new(wmOperatorType *ot)
static void stencil_control_cancel(bContext *, wmOperator *op)
void PALETTE_OT_extract_from_image(wmOperatorType *ot)
void BKE_brush_tag_unsaved_changes(Brush *brush)
void BKE_brush_unprojected_size_set(Paint *paint, Brush *brush, float unprojected_size)
static void stencil_restore(StencilControlData *scd)
bool vert_paint_poll(bContext *C)
static void stencil_set_target(StencilControlData *scd)
void PAINT_OT_grab_clone(wmOperatorType *ot)
static wmKeyMap * paint_stroke_modal_keymap(wmKeyConfig *keyconf)
void PAINT_OT_vertex_color_hsv(wmOperatorType *ot)
void PAINT_OT_face_select_loop(wmOperatorType *ot)
void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *r_aspx, float *r_aspy)
void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot)
void PAINT_OT_vertex_color_levels(wmOperatorType *ot)
void SCULPT_OT_uv_sculpt_pinch(wmOperatorType *ot)
void ED_operatormacros_paint()
void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
void SCULPT_OT_uv_sculpt_grab(wmOperatorType *ot)
void PAINT_OT_vert_select_loop(wmOperatorType *ot)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
int BKE_brush_size_get(const Paint *paint, const Brush *brush)
void PAINTCURVE_OT_add_point(wmOperatorType *ot)
void PAINT_OT_weight_paint_toggle(wmOperatorType *ot)
void PAINT_OT_vertex_color_invert(wmOperatorType *ot)
void PAINT_OT_image_from_view(wmOperatorType *ot)
void PAINT_OT_face_select_all(wmOperatorType *ot)
void PAINT_OT_weight_sample(wmOperatorType *ot)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void BKE_brush_size_set(Paint *paint, Brush *brush, int size)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void PAINTCURVE_OT_cursor(wmOperatorType *ot)
void PAINT_OT_vertex_color_smooth(wmOperatorType *ot)
void PAINT_OT_face_select_less(wmOperatorType *ot)
void ED_keymap_paint(wmKeyConfig *keyconf)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)
void PAINTCURVE_OT_slide(wmOperatorType *ot)
static wmOperatorStatus stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *event)
void PALETTE_OT_sort(wmOperatorType *ot)
static void stencil_control_calculate(StencilControlData *scd, const int mval[2])
void PAINT_OT_brush_colors_flip(wmOperatorType *ot)
void PAINT_OT_weight_set(wmOperatorType *ot)
bool vertex_paint_mode_poll(bContext *C)
void PAINTCURVE_OT_draw(wmOperatorType *ot)
void PALETTE_OT_color_add(wmOperatorType *ot)
Paint * BKE_paint_get_active_from_context(const bContext *C)
MINLINE void clamp_v2(float vec[2], float min, float max)
void PALETTE_OT_color_move(wmOperatorType *ot)
void PAINT_OT_weight_from_bones(wmOperatorType *ot)
void PAINT_OT_vert_select_all(wmOperatorType *ot)
void PAINT_OT_weight_gradient(wmOperatorType *ot)
float BKE_brush_unprojected_size_get(const Paint *paint, const Brush *brush)
void PAINT_OT_face_select_more(wmOperatorType *ot)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
Brush * BKE_paint_brush(Paint *paint)
void PAINT_OT_vert_select_hide(wmOperatorType *ot)
void PALETTE_OT_join(wmOperatorType *ot)
void PAINT_OT_add_simple_uvs(wmOperatorType *ot)
bool facemask_paint_poll(bContext *C)
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
void PAINT_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
void PAINT_OT_vert_select_less(wmOperatorType *ot)
void ED_operatortypes_paint()
void PAINT_OT_face_select_hide(wmOperatorType *ot)
MINLINE float len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
static void BRUSH_OT_stencil_control(wmOperatorType *ot)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void PALETTE_OT_color_delete(wmOperatorType *ot)
int WM_userdef_event_type_from_keymap_type(int kmitype)
static void BRUSH_OT_stencil_fit_image_aspect(wmOperatorType *ot)
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)
ARegion * CTX_wm_region(const bContext *C)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
bool weight_paint_mode_poll(bContext *C)
void PAINTCURVE_OT_select(wmOperatorType *ot)
void PAINTCURVE_OT_delete_point(wmOperatorType *ot)
float RNA_float_get(PointerRNA *ptr, const char *name)
void PAINT_OT_vert_select_linked_pick(wmOperatorType *ot)
#define PAINT_STROKE_MODAL_CANCEL
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
float mask_stencil_dimension[2]
float stencil_dimension[2]
float mask_stencil_pos[2]
eMTex_BrushMapMode brush_map_mode
StencilConstraint constrain_mode
bool(*) poll(struct bContext *)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT