Blender  V3.3
Classes | Macros | Enumerations | Functions | Variables
paint_ops.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include <stdlib.h>
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "DNA_brush_types.h"
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_image.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "ED_image.h"
#include "ED_paint.h"
#include "ED_screen.h"
#include "WM_api.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "curves_sculpt_intern.h"
#include "paint_intern.h"
#include "sculpt_intern.h"
#include <stddef.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  StencilControlData
 

Macros

#define PIXEL_MARGIN   5
 

Enumerations

enum  StencilControlMode { STENCIL_TRANSLATE , STENCIL_SCALE , STENCIL_ROTATE }
 
enum  StencilTextureMode { STENCIL_PRIMARY = 0 , STENCIL_SECONDARY = 1 }
 
enum  StencilConstraint { STENCIL_CONSTRAINT_X = 1 , STENCIL_CONSTRAINT_Y = 2 }
 

Functions

static int brush_add_exec (bContext *C, wmOperator *UNUSED(op))
 
static void BRUSH_OT_add (wmOperatorType *ot)
 
static eGPBrush_Presets gpencil_get_brush_preset_from_tool (bToolRef *tool, enum eContextObjectMode mode)
 
static int brush_add_gpencil_exec (bContext *C, wmOperator *UNUSED(op))
 
static void BRUSH_OT_add_gpencil (wmOperatorType *ot)
 
static int brush_scale_size_exec (bContext *C, wmOperator *op)
 
static void BRUSH_OT_scale_size (wmOperatorType *ot)
 
static int palette_new_exec (bContext *C, wmOperator *UNUSED(op))
 
static void PALETTE_OT_new (wmOperatorType *ot)
 
static bool palette_poll (bContext *C)
 
static int palette_color_add_exec (bContext *C, wmOperator *UNUSED(op))
 
static void PALETTE_OT_color_add (wmOperatorType *ot)
 
static int palette_color_delete_exec (bContext *C, wmOperator *UNUSED(op))
 
static void PALETTE_OT_color_delete (wmOperatorType *ot)
 
static bool palette_extract_img_poll (bContext *C)
 
static int palette_extract_img_exec (bContext *C, wmOperator *op)
 
static void PALETTE_OT_extract_from_image (wmOperatorType *ot)
 
static int palette_sort_exec (bContext *C, wmOperator *op)
 
static void PALETTE_OT_sort (wmOperatorType *ot)
 
static int palette_color_move_exec (bContext *C, wmOperator *op)
 
static void PALETTE_OT_color_move (wmOperatorType *ot)
 
static int palette_join_exec (bContext *C, wmOperator *op)
 
static void PALETTE_OT_join (wmOperatorType *ot)
 
static int brush_reset_exec (bContext *C, wmOperator *UNUSED(op))
 
static void BRUSH_OT_reset (wmOperatorType *ot)
 
static int brush_tool (const Brush *brush, size_t tool_offset)
 
static void brush_tool_set (const Brush *brush, size_t tool_offset, int tool)
 
static Brushbrush_tool_cycle (Main *bmain, Paint *paint, Brush *brush_orig, const int tool)
 
static Brushbrush_tool_toggle (Main *bmain, Paint *paint, Brush *brush_orig, const int tool)
 
static bool brush_generic_tool_set (bContext *C, Main *bmain, Paint *paint, const int tool, const char *tool_name, const bool create_missing, const bool toggle)
 
static int brush_select_exec (bContext *C, wmOperator *op)
 
static void PAINT_OT_brush_select (wmOperatorType *ot)
 
static void stencil_set_target (StencilControlData *scd)
 
static int stencil_control_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static void stencil_restore (StencilControlData *scd)
 
static void stencil_control_cancel (bContext *UNUSED(C), wmOperator *op)
 
static void stencil_control_calculate (StencilControlData *scd, const int mval[2])
 
static int stencil_control_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static bool stencil_control_poll (bContext *C)
 
static void BRUSH_OT_stencil_control (wmOperatorType *ot)
 
static int stencil_fit_image_aspect_exec (bContext *C, wmOperator *op)
 
static void BRUSH_OT_stencil_fit_image_aspect (wmOperatorType *ot)
 
static int stencil_reset_transform_exec (bContext *C, wmOperator *op)
 
static void BRUSH_OT_stencil_reset_transform (wmOperatorType *ot)
 
void ED_operatormacros_paint (void)
 
void ED_operatortypes_paint (void)
 
void ED_keymap_paint (wmKeyConfig *keyconf)
 

Variables

static const ePaintMode brush_select_paint_modes []
 

Macro Definition Documentation

◆ PIXEL_MARGIN

#define PIXEL_MARGIN   5

Enumeration Type Documentation

◆ StencilConstraint

Enumerator
STENCIL_CONSTRAINT_X 
STENCIL_CONSTRAINT_Y 

Definition at line 982 of file paint_ops.c.

◆ StencilControlMode

Enumerator
STENCIL_TRANSLATE 
STENCIL_SCALE 
STENCIL_ROTATE 

Definition at line 971 of file paint_ops.c.

◆ StencilTextureMode

Enumerator
STENCIL_PRIMARY 
STENCIL_SECONDARY 

Definition at line 977 of file paint_ops.c.

Function Documentation

◆ brush_add_exec()

static int brush_add_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ brush_add_gpencil_exec()

static int brush_add_gpencil_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ brush_generic_tool_set()

static bool brush_generic_tool_set ( bContext C,
Main bmain,
Paint paint,
const int  tool,
const char *  tool_name,
const bool  create_missing,
const bool  toggle 
)
static

◆ BRUSH_OT_add()

static void BRUSH_OT_add ( wmOperatorType ot)
static

◆ BRUSH_OT_add_gpencil()

static void BRUSH_OT_add_gpencil ( wmOperatorType ot)
static

◆ BRUSH_OT_reset()

static void BRUSH_OT_reset ( wmOperatorType ot)
static

◆ BRUSH_OT_scale_size()

static void BRUSH_OT_scale_size ( wmOperatorType ot)
static

◆ BRUSH_OT_stencil_control()

static void BRUSH_OT_stencil_control ( wmOperatorType ot)
static

◆ BRUSH_OT_stencil_fit_image_aspect()

static void BRUSH_OT_stencil_fit_image_aspect ( wmOperatorType ot)
static

◆ BRUSH_OT_stencil_reset_transform()

static void BRUSH_OT_stencil_reset_transform ( wmOperatorType ot)
static

◆ brush_reset_exec()

static int brush_reset_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ brush_scale_size_exec()

static int brush_scale_size_exec ( bContext C,
wmOperator op 
)
static

◆ brush_select_exec()

static int brush_select_exec ( bContext C,
wmOperator op 
)
static

◆ brush_tool()

static int brush_tool ( const Brush brush,
size_t  tool_offset 
)
static

Definition at line 760 of file paint_ops.c.

Referenced by brush_generic_tool_set(), brush_tool_cycle(), and brush_tool_toggle().

◆ brush_tool_cycle()

static Brush* brush_tool_cycle ( Main bmain,
Paint paint,
Brush brush_orig,
const int  tool 
)
static

◆ brush_tool_set()

static void brush_tool_set ( const Brush brush,
size_t  tool_offset,
int  tool 
)
static

Definition at line 765 of file paint_ops.c.

Referenced by brush_generic_tool_set().

◆ brush_tool_toggle()

static Brush* brush_tool_toggle ( Main bmain,
Paint paint,
Brush brush_orig,
const int  tool 
)
static

◆ ED_keymap_paint()

void ED_keymap_paint ( wmKeyConfig keyconf)

◆ ED_operatormacros_paint()

void ED_operatormacros_paint ( void  )

◆ ED_operatortypes_paint()

void ED_operatortypes_paint ( void  )

Definition at line 1399 of file paint_ops.c.

References BRUSH_OT_add(), BRUSH_OT_add_gpencil(), BRUSH_OT_curve_preset(), BRUSH_OT_reset(), BRUSH_OT_scale_size(), BRUSH_OT_stencil_control(), BRUSH_OT_stencil_fit_image_aspect(), BRUSH_OT_stencil_reset_transform(), PAINT_OT_add_simple_uvs(), PAINT_OT_add_texture_paint_slot(), PAINT_OT_brush_colors_flip(), PAINT_OT_brush_select(), PAINT_OT_face_select_all(), PAINT_OT_face_select_hide(), PAINT_OT_face_select_linked(), PAINT_OT_face_select_linked_pick(), PAINT_OT_face_vert_reveal(), PAINT_OT_grab_clone(), PAINT_OT_hide_show(), PAINT_OT_image_from_view(), PAINT_OT_image_paint(), PAINT_OT_mask_box_gesture(), PAINT_OT_mask_flood_fill(), PAINT_OT_mask_lasso_gesture(), PAINT_OT_mask_line_gesture(), PAINT_OT_project_image(), PAINT_OT_sample_color(), PAINT_OT_texture_paint_toggle(), PAINT_OT_vert_select_all(), PAINT_OT_vert_select_hide(), PAINT_OT_vert_select_ungrouped(), PAINT_OT_vertex_color_brightness_contrast(), PAINT_OT_vertex_color_from_weight(), PAINT_OT_vertex_color_hsv(), PAINT_OT_vertex_color_invert(), PAINT_OT_vertex_color_levels(), PAINT_OT_vertex_color_set(), PAINT_OT_vertex_color_smooth(), PAINT_OT_vertex_paint(), PAINT_OT_vertex_paint_toggle(), PAINT_OT_weight_from_bones(), PAINT_OT_weight_gradient(), PAINT_OT_weight_paint(), PAINT_OT_weight_paint_toggle(), PAINT_OT_weight_sample(), PAINT_OT_weight_sample_group(), PAINT_OT_weight_set(), PAINTCURVE_OT_add_point(), PAINTCURVE_OT_cursor(), PAINTCURVE_OT_delete_point(), PAINTCURVE_OT_draw(), PAINTCURVE_OT_new(), PAINTCURVE_OT_select(), PAINTCURVE_OT_slide(), PALETTE_OT_color_add(), PALETTE_OT_color_delete(), PALETTE_OT_color_move(), PALETTE_OT_extract_from_image(), PALETTE_OT_join(), PALETTE_OT_new(), PALETTE_OT_sort(), SCULPT_OT_uv_sculpt_stroke(), and WM_operatortype_append().

Referenced by ED_spacetypes_init().

◆ gpencil_get_brush_preset_from_tool()

static eGPBrush_Presets gpencil_get_brush_preset_from_tool ( bToolRef tool,
enum eContextObjectMode  mode 
)
static

◆ PAINT_OT_brush_select()

static void PAINT_OT_brush_select ( wmOperatorType ot)
static

◆ palette_color_add_exec()

static int palette_color_add_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ palette_color_delete_exec()

static int palette_color_delete_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ palette_color_move_exec()

static int palette_color_move_exec ( bContext C,
wmOperator op 
)
static

◆ palette_extract_img_exec()

static int palette_extract_img_exec ( bContext C,
wmOperator op 
)
static

◆ palette_extract_img_poll()

static bool palette_extract_img_poll ( bContext C)
static

◆ palette_join_exec()

static int palette_join_exec ( bContext C,
wmOperator op 
)
static

◆ palette_new_exec()

static int palette_new_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ PALETTE_OT_color_add()

static void PALETTE_OT_color_add ( wmOperatorType ot)
static

◆ PALETTE_OT_color_delete()

static void PALETTE_OT_color_delete ( wmOperatorType ot)
static

◆ PALETTE_OT_color_move()

static void PALETTE_OT_color_move ( wmOperatorType ot)
static

◆ PALETTE_OT_extract_from_image()

static void PALETTE_OT_extract_from_image ( wmOperatorType ot)
static

◆ PALETTE_OT_join()

static void PALETTE_OT_join ( wmOperatorType ot)
static

◆ PALETTE_OT_new()

static void PALETTE_OT_new ( wmOperatorType ot)
static

◆ PALETTE_OT_sort()

static void PALETTE_OT_sort ( wmOperatorType ot)
static

◆ palette_poll()

static bool palette_poll ( bContext C)
static

◆ palette_sort_exec()

static int palette_sort_exec ( bContext C,
wmOperator op 
)
static

◆ stencil_control_calculate()

static void stencil_control_calculate ( StencilControlData scd,
const int  mval[2] 
)
static

◆ stencil_control_cancel()

static void stencil_control_cancel ( bContext UNUSEDC,
wmOperator op 
)
static

◆ stencil_control_invoke()

static int stencil_control_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ stencil_control_modal()

static int stencil_control_modal ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ stencil_control_poll()

static bool stencil_control_poll ( bContext C)
static

◆ stencil_fit_image_aspect_exec()

static int stencil_fit_image_aspect_exec ( bContext C,
wmOperator op 
)
static

◆ stencil_reset_transform_exec()

static int stencil_reset_transform_exec ( bContext C,
wmOperator op 
)
static

◆ stencil_restore()

static void stencil_restore ( StencilControlData scd)
static

◆ stencil_set_target()

static void stencil_set_target ( StencilControlData scd)
static

Variable Documentation

◆ brush_select_paint_modes

const ePaintMode brush_select_paint_modes[]
static
Initial value:
= {
}
@ PAINT_MODE_SCULPT_CURVES
Definition: BKE_paint.h:83
@ PAINT_MODE_GPENCIL
Definition: BKE_paint.h:77
@ PAINT_MODE_VERTEX_GPENCIL
Definition: BKE_paint.h:79
@ PAINT_MODE_TEXTURE_3D
Definition: BKE_paint.h:73
@ PAINT_MODE_WEIGHT_GPENCIL
Definition: BKE_paint.h:81
@ PAINT_MODE_SCULPT
Definition: BKE_paint.h:68
@ PAINT_MODE_SCULPT_GPENCIL
Definition: BKE_paint.h:80
@ PAINT_MODE_WEIGHT
Definition: BKE_paint.h:71
@ PAINT_MODE_VERTEX
Definition: BKE_paint.h:70

Definition at line 884 of file paint_ops.c.

Referenced by brush_select_exec(), and PAINT_OT_brush_select().