109 ImBuf *ibuf,
int x,
int y,
int w,
int h,
int *tx,
int *ty,
int *tw,
int *th)
111 int srcx = 0, srcy = 0;
124 int tilex, tiley, tilew, tileh, tx, ty;
125 int srcx = 0, srcy = 0;
129 if (
w == 0 || h == 0) {
141 for (ty = tiley; ty <= tileh; ty++) {
142 for (tx = tilex; tx <= tilew; tx++) {
178 BlurKernel *kernel = MEM_new<BlurKernel>(
"BlurKernel");
187 side = kernel->
side = 2;
199 side = kernel->
side = radius * 2 + 1;
208 kernel->
wdata[i] = 1.0;
214 float standard_dev = radius / 3.0f;
217 standard_dev = -standard_dev * standard_dev * 2;
219 for (i = 0; i < side; i++) {
220 for (j = 0; j < side; j++) {
221 float idist = radius - i;
222 float jdist = radius - j;
223 float value =
exp((idist * idist + jdist * jdist) / standard_dev);
225 kernel->
wdata[i + j * side] = value;
233 printf(
"unidentified kernel type, aborting\n");
245 MEM_delete(kernel->
wdata);
270 if (sima->image !=
nullptr &&
315 if (image_paint_settings.
clone) {
352 std::optional<float3> &initial_hsv_jitter,
362 const std::optional<BrushColorJitterSettings> color_jitter_settings =
382 else if (color_jitter_settings) {
389 *color_jitter_settings, *initial_hsv_jitter,
distance, pressure,
color);
407 mtex = &
brush->mask_mtex;
421 mtex = &
brush->mask_mtex;
470 bool enabled =
false;
533 cmv->
startx =
event->xy[0];
534 cmv->
starty =
event->xy[1];
549 float startfx, startfy, fx, fy, delta[2];
552 switch (event->
type) {
561 ®ion->
v2d, cmv->
startx - xmin, cmv->
starty - ymin, &startfx, &startfy);
564 delta[0] = fx - startfx;
565 delta[1] = fy - startfy;
589 ot->
name =
"Grab Clone";
590 ot->
idname =
"PAINT_OT_grab_clone";
611 "Delta offset of clone image in 0.0 to 1.0 coordinates",
624 Depsgraph &depsgraph,
627 Image *ima =
nullptr;
641 if (ma && ma->texpaintslot) {
642 ima = ma->texpaintslot[ma->paint_active_slot].ima;
733 const bool is_mode_set = (ob.
mode & mode_flag) != 0;
741 if (ob.
mode & mode_flag) {
759 ot->
name =
"Texture Paint Mode";
760 ot->
idname =
"PAINT_OT_texture_paint_toggle";
761 ot->
description =
"Toggle texture paint mode in 3D view";
828 ot->
name =
"Swap Colors";
829 ot->
idname =
"PAINT_OT_brush_colors_flip";
830 ot->
description =
"Swap primary and secondary brush colors";
850 if (sima && sima->
image) {
855 const float mouse_init[2] = {
float(mouse[0]),
float(mouse[1])};
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
Object is a sort of wrapper for general info.
#define IMAGEPAINT_MODE_IMAGE
#define IMAGEPAINT_MODE_MATERIAL
#define USER_EXPERIMENTAL_TEST(userdef, member)
#define ED_IMAGE_UNDO_TILE_BITS
Read Blender memory allocation and freeing.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static RandomNumberGenerator from_random_seed()
float distance(float, float) RET
float2x2 invert(float2x2 mat)
ccl_device_inline float2 fmod(const float2 a, const float b)
void cursor_reinitialize_textures(Paint &paint)
bool grease_pencil_vertex_painting_poll(bContext *C)
bool grease_pencil_painting_poll(bContext *C)
bool mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports)
void mode_exit_generic(Scene &scene, Object &ob, const eObjectMode mode_flag)
void mode_enter_generic(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob, const eObjectMode mode_flag)
void view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
void WM_main_add_notifier(uint type, void *reference)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
struct bNodeTreeExec * ntreeTexBeginExecTree(struct bNodeTree *ntree)
ScrArea * CTX_wm_area(const bContext *C)
static bool texture_paint_object_toggle_poll(bContext *C)
bool get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
static ImagePaintPartialRedraw imapaintpartial
MINLINE void copy_v3_v3(float r[3], const float a[3])
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void ED_imapaint_clear_partial_redraw()
void paint_2d_bucket_fill(const bContext *C, const float color[3], Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps)
void ED_space_image_sync(Main *bmain, Image *image, bool ignore_render_viewer)
void ED_image_undo_push_end()
@ BRUSH_GRADIENT_SPACING_CLAMP
@ BRUSH_GRADIENT_SPACING_REPEAT
@ BRUSH_GRADIENT_PRESSURE
void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
bool image_texture_paint_poll(bContext *C)
MINLINE void copy_v2_v2(float r[2], const float a[2])
Material * BKE_object_material_get(Object *ob, short act)
void ED_image_undo_push_begin(const char *name, PaintMode paint_mode)
static wmOperatorStatus brush_colors_flip_exec(bContext *C, wmOperator *)
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
bool mask_paint_poll(bContext *C)
static bool image_paint_poll_ex(bContext *C, bool check_tool)
void IMB_mark_dirty(ImBuf *ibuf)
void BLI_rcti_init_minmax(struct rcti *rect)
static void toggle_paint_cursor(Scene &scene, bool enable)
void imapaint_image_update(ImBuf *ibuf)
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
void ED_region_tag_redraw(ARegion *region)
PaintTileMap * ED_image_paint_tile_map_get()
void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain)
void ED_paint_cursor_start(Paint *paint, bool(*poll)(bContext *C))
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void BKE_brush_tag_unsaved_changes(Brush *brush)
void ED_object_texture_paint_mode_enter_ex(Main &bmain, Scene &scene, Depsgraph &depsgraph, Object &ob)
static wmOperatorStatus texture_paint_toggle_exec(bContext *C, wmOperator *op)
bool vert_paint_poll(bContext *C)
static Brush * image_paint_brush(bContext *C)
static wmOperatorStatus grab_clone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void PAINT_OT_grab_clone(wmOperatorType *ot)
static bool image_paint_2d_clone_poll(bContext *C)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
MINLINE void add_v2_v2(float r[2], const float a[2])
void paint_brush_color_get(const Paint *paint, Brush *br, std::optional< float3 > &initial_hsv_jitter, bool invert, float distance, float pressure, float r_color[3])
void DEG_id_tag_update(ID *id, unsigned int flags)
MINLINE void swap_v3_v3(float a[3], float b[3])
Mesh * BKE_mesh_from_object(Object *ob)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void ED_object_texture_paint_mode_exit_ex(Main &bmain, Scene &scene, Object &ob)
bool BKE_paint_select_elem_test(const Object *ob)
void ED_object_texture_paint_mode_exit(bContext *C)
float3 BKE_paint_seed_hsv_jitter()
void BKE_paint_init(Main *bmain, Scene *sce, PaintMode mode, bool ensure_brushes=true)
void WM_toolsystem_update_from_context_view3d(bContext *C)
@ IMAGE_PAINT_BRUSH_TYPE_SOFTEN
@ IMAGE_PAINT_BRUSH_TYPE_SMEAR
@ IMAGE_PAINT_BRUSH_TYPE_DRAW
@ IMAGE_PAINT_BRUSH_TYPE_FILL
@ IMAGE_PAINT_BRUSH_TYPE_CLONE
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
void IMB_rectclip(ImBuf *dbuf, const ImBuf *sbuf, int *destx, int *desty, int *srcx, int *srcy, int *width, int *height)
bool ED_paint_proj_mesh_data_check(Scene &scene, Object &ob, bool *r_has_uvs, bool *r_has_mat, bool *r_has_tex, bool *r_has_stencil)
void IMB_partial_update_mark_region(ImBuf *ibuf, const rcti ®ion)
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
void IMB_partial_update_mark_full(ImBuf *ibuf)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
bool BKE_paint_select_face_test(const Object *ob)
void BKE_brush_color_sync_legacy(Brush *brush)
bool BLI_rcti_is_empty(const struct rcti *rect)
void paint_brush_exit_tex(Brush *brush)
void ED_imapaint_bucket_fill(bContext *C, const float color[3], wmOperator *op, const int mouse[2])
bool paint_use_opacity_masking(const Paint *paint, const Brush *brush)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
void imapaint_region_tiles(ImBuf *ibuf, int x, int y, int w, int h, int *tx, int *ty, int *tw, int *th)
static bool texture_paint_object_poll(bContext *C)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
void ED_imapaint_dirty_region(Image *ima, ImBuf *ibuf, ImageUser *iuser, int x, int y, int w, int h)
static bool brush_colors_flip_poll(bContext *C)
SpaceImage * CTX_wm_space_image(const bContext *C)
static void grab_clone_cancel(bContext *, wmOperator *op)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void PAINT_OT_brush_colors_flip(wmOperatorType *ot)
Main * CTX_data_main(const bContext *C)
const ImBuf * ED_image_paint_tile_push(PaintTileMap *paint_tile_map, Image *image, ImBuf *ibuf, ImageUser *iuser, int x_tile, int y_tile, unsigned short **r_mask, bool **r_valid)
bool WM_toolsystem_active_tool_is_brush(const bContext *C)
void ED_object_texture_paint_mode_enter(bContext *C)
Paint * BKE_paint_get_active_from_context(const bContext *C)
void paint_init_pivot(Object *ob, Scene *scene, Paint *paint)
ImagePaintPartialRedraw * get_imapaintpartial()
void paint_delete_blur_kernel(BlurKernel *kernel)
bool ED_image_tools_paint_poll(bContext *C)
std::optional< BrushColorJitterSettings > BKE_brush_color_jitter_get_settings(const Paint *paint, const Brush *brush)
void ED_space_image_get_zoom(SpaceImage *sima, const ARegion *region, float *r_zoomx, float *r_zoomy)
static void grab_clone_apply(bContext *C, wmOperator *op)
Brush * BKE_paint_brush(Paint *paint)
void BKE_texpaint_slots_refresh_object(Scene *scene, Object *ob)
Scene * CTX_data_scene(const bContext *C)
float3 BKE_brush_color_get(const Paint *paint, const Brush *brush)
bool facemask_paint_poll(bContext *C)
void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene)
VecBase< float, 3 > float3
bool BKE_paint_select_vert_test(const Object *ob)
void BKE_paint_brushes_validate(Main *bmain, Paint *paint)
float3 BKE_paint_randomize_color(const BrushColorJitterSettings &color_jitter, const float3 &initial_hsv_jitter, const float distance, const float pressure, const float3 &color)
bScreen * WM_window_get_active_screen(const wmWindow *win)
Object * CTX_data_active_object(const bContext *C)
void set_imapaintpartial(ImagePaintPartialRedraw *ippr)
ARegion * CTX_wm_region(const bContext *C)
void BLI_rcti_do_minmax_rcti(struct rcti *rect, const struct rcti *other)
bool image_paint_poll_ignore_tool(bContext *C)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void paint_brush_init_tex(Brush *brush)
static wmOperatorStatus grab_clone_modal(bContext *C, wmOperator *op, const wmEvent *event)
bool WM_paint_cursor_end(wmPaintCursor *handle)
bool BKE_brush_use_unified_color(const Paint *paint, const Brush *brush)
static wmOperatorStatus grab_clone_exec(bContext *C, wmOperator *op)
float3 BKE_brush_secondary_color_get(const Paint *paint, const Brush *brush)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct ColorBand * gradient
eBrushImagePaintType image_brush_type
eBlurKernelType blur_mode
eBrushGradientSourceStroke gradient_stroke_mode
bke::PaintRuntime * runtime
struct ToolSettings * toolsettings
ListBaseT< SpaceLink > spacedata
struct bNodeTree * nodetree
bke::bNodeTreeRuntime * runtime
ListBaseT< struct ScrArea > areabase
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
struct ReportList * reports
struct wmOperatorType * type
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)