Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLT_translation.h"
#include "DNA_brush_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_material_types.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_material.h"
#include "BKE_report.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_prototypes.h"
#include "UI_view2d.h"
#include "ED_gpencil.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "gpencil_intern.h"
Go to the source code of this file.
Classes | |
struct | tGP_Grid |
struct | tGP_Selected |
struct | tGP_BrushVertexpaintData |
Macros | |
#define | GP_SELECT_BUFFER_CHUNK 256 |
#define | GP_GRID_PIXEL_SIZE 10.0f |
Typedefs | |
typedef enum eGPDvertex_brush_Flag | eGPDvertex_brush_Flag |
typedef struct tGP_Grid | tGP_Grid |
typedef struct tGP_Selected | tGP_Selected |
typedef struct tGP_BrushVertexpaintData | tGP_BrushVertexpaintData |
Enumerations | |
enum | eGPDvertex_brush_Flag { GP_VERTEX_FLAG_INVERT = (1 << 0) , GP_VERTEX_FLAG_TMP_INVERT = (1 << 1) } |
Brush based operators for editing Grease Pencil strokes.
Definition in file gpencil_vertex_paint.c.
#define GP_GRID_PIXEL_SIZE 10.0f |
Definition at line 48 of file gpencil_vertex_paint.c.
#define GP_SELECT_BUFFER_CHUNK 256 |
Definition at line 47 of file gpencil_vertex_paint.c.
typedef enum eGPDvertex_brush_Flag eGPDvertex_brush_Flag |
typedef struct tGP_BrushVertexpaintData tGP_BrushVertexpaintData |
typedef struct tGP_Selected tGP_Selected |
Enumerator | |
---|---|
GP_VERTEX_FLAG_INVERT | |
GP_VERTEX_FLAG_TMP_INVERT |
Definition at line 51 of file gpencil_vertex_paint.c.
|
static |
Definition at line 559 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::brush, brush_influence_calc(), brush_invert_check(), CLAMP, copy_v3_v3(), BrushGpencilSettings::draw_strength, Brush::gpencil_settings, GPENCIL_TINT_VERTEX_COLOR_FILL, GPENCIL_TINT_VERTEX_COLOR_STROKE, interp_v3_v3v3(), bGPDstroke::points, tGP_BrushVertexpaintData::pressure, bGPDspoint::vert_color, and bGPDstroke::vert_color_fill.
Referenced by gpencil_vertexpaint_brush_do_frame().
|
static |
Definition at line 525 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::brush, brush_influence_calc(), BrushGpencilSettings::draw_strength, get_surrounding_color(), Brush::gpencil_settings, GPENCIL_TINT_VERTEX_COLOR_FILL, GPENCIL_TINT_VERTEX_COLOR_STROKE, interp_v3_v3v3(), bGPDstroke::points, tGP_BrushVertexpaintData::pressure, bGPDspoint::vert_color, and bGPDstroke::vert_color_fill.
Referenced by gpencil_vertexpaint_brush_do_frame().
|
static |
Definition at line 231 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::dvec, float(), tGP_BrushVertexpaintData::mval, tGP_BrushVertexpaintData::mval_prev, and normalize_v2().
Referenced by gpencil_vertexpaint_brush_apply().
|
static |
Definition at line 204 of file gpencil_vertex_paint.c.
References BKE_brush_curve_strength(), tGP_BrushVertexpaintData::brush, blender::math::distance(), BrushGpencilSettings::flag, float(), GP_BRUSH_USE_PRESSURE, Brush::gpencil_settings, len_v2v2_int(), tGP_BrushVertexpaintData::mf_falloff, tGP_BrushVertexpaintData::mval, tGP_BrushVertexpaintData::pressure, round_v2i_v2fl(), and Brush::size.
Referenced by brush_average_apply(), brush_blur_apply(), and brush_tint_apply().
|
static |
Definition at line 190 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::flag, GP_VERTEX_FLAG_INVERT, and invert().
Referenced by brush_average_apply(), and brush_tint_apply().
|
static |
Definition at line 464 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::brush, copy_v3_v3(), GPENCIL_TINT_VERTEX_COLOR_FILL, GPENCIL_TINT_VERTEX_COLOR_STROKE, tGP_BrushVertexpaintData::linear_color, bGPDstroke::points, bGPDspoint::vert_color, and bGPDstroke::vert_color_fill.
Referenced by gpencil_vertexpaint_brush_do_frame().
|
static |
Definition at line 605 of file gpencil_vertex_paint.c.
References ARRAY_SET_ITEMS, tGP_BrushVertexpaintData::brush, CLAMP, col, tGP_Grid::color, blender::math::distance(), BrushGpencilSettings::draw_strength, tGP_BrushVertexpaintData::first, Brush::flag, float(), GP_BRUSH_USE_PRESSURE, gpencil_grid_cell_average_color_idx_get(), gpencil_grid_cell_index_get(), gpencil_grid_colors_calc(), Brush::gpencil_settings, GPENCIL_TINT_VERTEX_COLOR_FILL, GPENCIL_TINT_VERTEX_COLOR_STROKE, tGP_BrushVertexpaintData::grid, tGP_BrushVertexpaintData::grid_len, tGP_BrushVertexpaintData::grid_ready, tGP_BrushVertexpaintData::grid_sample, tGP_BrushVertexpaintData::grid_size, interp_v3_v3v3(), len_v2v2_int(), tGP_BrushVertexpaintData::mval, NULL, tGP_BrushVertexpaintData::pbuffer_used, tGP_Selected::pc, bGPDstroke::points, tGP_BrushVertexpaintData::pressure, round_v2i_v2fl(), Brush::size, bGPDspoint::vert_color, and bGPDstroke::vert_color_fill.
Referenced by gpencil_vertexpaint_brush_do_frame().
|
static |
Definition at line 405 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::brush, brush_influence_calc(), brush_invert_check(), CLAMP, CLAMP_MIN, BrushGpencilSettings::draw_strength, Brush::gpencil_settings, GPENCIL_TINT_VERTEX_COLOR_FILL, GPENCIL_TINT_VERTEX_COLOR_STROKE, interp_v3_v3v3(), tGP_BrushVertexpaintData::linear_color, mul_v3_fl(), bGPDstroke::points, tGP_BrushVertexpaintData::pressure, bGPDspoint::vert_color, and bGPDstroke::vert_color_fill.
Referenced by gpencil_vertexpaint_brush_do_frame().
|
static |
Definition at line 487 of file gpencil_vertex_paint.c.
References add_v3_v3(), tGP_Selected::color, tGP_Selected::gps, mul_v3_fl(), NULL, tGP_BrushVertexpaintData::pbuffer, tGP_BrushVertexpaintData::pbuffer_used, bGPDstroke::points, tGP_Selected::pt_index, bGPDspoint::vert_color, and zero_v3().
Referenced by brush_blur_apply().
|
static |
Definition at line 287 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::dvec.
Referenced by brush_smear_apply().
|
static |
Definition at line 337 of file gpencil_vertex_paint.c.
References add_v2_v2v2(), tGP_Grid::bottom, bottom, tGP_BrushVertexpaintData::grid, tGP_BrushVertexpaintData::grid_len, tGP_BrushVertexpaintData::mval, tGP_Grid::top, and top.
Referenced by brush_smear_apply(), and gpencil_grid_colors_calc().
|
static |
Definition at line 252 of file gpencil_vertex_paint.c.
References tGP_Grid::bottom, bottom, tGP_BrushVertexpaintData::brush_rect, copy_v2_v2(), GP_GRID_PIXEL_SIZE, tGP_BrushVertexpaintData::grid, tGP_BrushVertexpaintData::grid_size, tGP_BrushVertexpaintData::mval, tGP_Grid::top, top, x, rcti::xmin, y, and rcti::ymax.
Referenced by gpencil_vertexpaint_brush_apply().
|
static |
Definition at line 355 of file gpencil_vertex_paint.c.
References add_v3_v3(), tGP_Grid::color, tGP_Selected::color, gpencil_grid_cell_index_get(), tGP_Selected::gps, tGP_BrushVertexpaintData::grid, tGP_BrushVertexpaintData::grid_len, tGP_BrushVertexpaintData::grid_ready, tGP_BrushVertexpaintData::grid_sample, mul_v3_fl(), tGP_BrushVertexpaintData::mval, NULL, tGP_BrushVertexpaintData::pbuffer, tGP_BrushVertexpaintData::pbuffer_used, tGP_Selected::pc, bGPDstroke::points, tGP_Selected::pt_index, round_v2i_v2fl(), tGP_Grid::totcol, and bGPDspoint::vert_color.
Referenced by brush_smear_apply().
void GPENCIL_OT_vertex_paint | ( | wmOperatorType * | ot | ) |
Definition at line 1429 of file gpencil_vertex_paint.c.
References wmOperatorType::cancel, wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, gpencil_vertexpaint_brush_exec(), gpencil_vertexpaint_brush_exit(), gpencil_vertexpaint_brush_invoke(), gpencil_vertexpaint_brush_modal(), gpencil_vertexpaint_brush_poll(), wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_BLOCKING, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_collection_runtime(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by ED_operatortypes_gpencil().
|
static |
Definition at line 785 of file gpencil_vertex_paint.c.
References tGP_Selected::color, copy_v2_v2_int(), copy_v4_v4(), gpencil_select_buffer_ensure(), tGP_Selected::gps, tGP_BrushVertexpaintData::pbuffer, tGP_BrushVertexpaintData::pbuffer_size, tGP_BrushVertexpaintData::pbuffer_used, tGP_Selected::pc, bGPDstroke::points, tGP_Selected::pt_index, and bGPDspoint::vert_color.
Referenced by gpencil_vertexpaint_select_stroke().
|
static |
Definition at line 149 of file gpencil_vertex_paint.c.
References clear(), GP_SELECT_BUFFER_CHUNK, MEM_callocN, MEM_recallocN, and NULL.
Referenced by gpencil_save_selected_point(), and gpencil_vertexpaint_brush_do_frame().
|
static |
Definition at line 1169 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::brush, brush_calc_dvec_2d(), tGP_BrushVertexpaintData::brush_rect, C, wmOperator::customdata, DEG_id_tag_update(), tGP_BrushVertexpaintData::first, tGP_BrushVertexpaintData::flag, Brush::flag, GP_BRUSH_USE_PRESSURE, GP_VERTEX_FLAG_INVERT, tGP_BrushVertexpaintData::gpd, gpencil_grid_cells_init(), gpencil_vertexpaint_brush_apply_to_layers(), bGPdata::id, ID_RECALC_GEOMETRY, tGP_BrushVertexpaintData::mval, tGP_BrushVertexpaintData::mval_prev, NA_EDITED, NC_GPENCIL, ND_DATA, NULL, tGP_BrushVertexpaintData::pressure, tGP_BrushVertexpaintData::pressure_prev, RNA_boolean_get(), RNA_float_get(), RNA_float_get_array(), Brush::size, WM_event_add_notifier(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by gpencil_vertexpaint_brush_apply_event(), and gpencil_vertexpaint_brush_exec().
|
static |
Definition at line 1230 of file gpencil_vertex_paint.c.
References C, CLAMP, wmOperator::customdata, tGP_BrushVertexpaintData::first, gpencil_vertexpaint_brush_apply(), KM_CTRL, wmEvent::modifier, wmOperator::ptr, RNA_boolean_set(), RNA_collection_add(), RNA_float_set(), and RNA_float_set_array().
Referenced by gpencil_vertexpaint_brush_invoke(), and gpencil_vertexpaint_brush_modal().
|
static |
Definition at line 1103 of file gpencil_vertex_paint.c.
References BKE_gpencil_frame_range_selected(), BKE_gpencil_layer_is_editable(), BKE_gpencil_layer_transform_matrix_get(), BKE_gpencil_multiframe_falloff_calc(), C, copy_m4_m4(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_tool_settings(), GP_Sculpt_Settings::cur_falloff, Object::data, DEG_get_evaluated_id(), depsgraph, GP_FRAME_SELECT, ToolSettings::gp_sculpt, gpencil_vertexpaint_brush_do_frame(), Object::id, tGP_BrushVertexpaintData::is_multiframe, bGPdata::layers, LISTBASE_FOREACH, tGP_BrushVertexpaintData::mf_falloff, mul_m4_m4m4(), NULL, tGP_BrushVertexpaintData::object, and tGP_BrushVertexpaintData::use_multiframe_falloff.
Referenced by gpencil_vertexpaint_brush_apply().
|
static |
Definition at line 983 of file gpencil_vertex_paint.c.
References add_v3_v3(), tGP_BrushVertexpaintData::brush, brush_average_apply(), brush_blur_apply(), brush_replace_apply(), brush_smear_apply(), brush_tint_apply(), C, CTX_data_active_object(), ED_gpencil_stroke_can_use(), ED_gpencil_stroke_material_editable(), bGPDstroke::editcurve, Brush::flag, bGPDcurve::flag, GP_BRUSH_USE_PRESSURE, GP_CURVE_NEEDS_STROKE_UPDATE, GPAINT_TOOL_TINT, gpencil_select_buffer_ensure(), Brush::gpencil_tool, Brush::gpencil_vertex_tool, gpencil_vertexpaint_select_stroke(), bGPDstroke_Runtime::gps_orig, GPVERTEX_TOOL_AVERAGE, GPVERTEX_TOOL_BLUR, GPVERTEX_TOOL_DRAW, GPVERTEX_TOOL_REPLACE, GPVERTEX_TOOL_SMEAR, if(), LISTBASE_FOREACH, Object::mode, mul_v3_fl(), NULL, OB_MODE_VERTEX_GPENCIL, tGP_BrushVertexpaintData::pbuffer, tGP_BrushVertexpaintData::pbuffer_size, tGP_BrushVertexpaintData::pbuffer_used, bGPDstroke::points, tGP_BrushVertexpaintData::pressure, bGPDstroke::runtime, Brush::size, bGPDframe::strokes, bGPDspoint::vert_color, and bGPDstroke::vert_color_fill.
Referenced by gpencil_vertexpaint_brush_apply_to_layers().
|
static |
Definition at line 1258 of file gpencil_vertex_paint.c.
References C, gpencil_vertexpaint_brush_apply(), gpencil_vertexpaint_brush_exit(), gpencil_vertexpaint_brush_init(), OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_BEGIN, and RNA_END.
Referenced by GPENCIL_OT_vertex_paint().
|
static |
Definition at line 760 of file gpencil_vertex_paint.c.
References tGP_BrushVertexpaintData::brush, C, wmOperator::customdata, ED_workspace_status_text(), Brush::flag, GP_VERTEX_FLAG_TMP_INVERT, tGP_BrushVertexpaintData::grid, MEM_SAFE_FREE, NULL, and tGP_BrushVertexpaintData::pbuffer.
Referenced by GPENCIL_OT_vertex_paint(), gpencil_vertexpaint_brush_exec(), and gpencil_vertexpaint_brush_modal().
Definition at line 687 of file gpencil_vertex_paint.c.
References C, ED_workspace_status_text(), and TIP_.
Referenced by gpencil_vertexpaint_brush_init().
|
static |
Definition at line 699 of file gpencil_vertex_paint.c.
References BKE_curvemapping_init(), bool, tGP_BrushVertexpaintData::brush, Paint::brush, C, CTX_data_active_object(), CTX_data_scene(), CTX_data_tool_settings(), CTX_wm_region(), GP_Sculpt_Settings::cur_falloff, Brush::curve, wmOperator::customdata, ED_gpencil_data_get_active(), tGP_BrushVertexpaintData::first, GP_Sculpt_Settings::flag, GP_GRID_PIXEL_SIZE, ToolSettings::gp_paint, ToolSettings::gp_sculpt, GP_SCULPT_SETT_FLAG_FRAME_FALLOFF, ToolSettings::gp_vertexpaint, tGP_BrushVertexpaintData::gpd, GPENCIL_MULTIEDIT_SESSIONS_ON, gpencil_point_conversion_init(), ToolSettings::gpencil_selectmode_vertex, gpencil_vertexpaint_brush_header_set(), tGP_BrushVertexpaintData::grid, tGP_BrushVertexpaintData::grid_len, tGP_BrushVertexpaintData::grid_ready, tGP_BrushVertexpaintData::grid_size, tGP_BrushVertexpaintData::gsc, tGP_BrushVertexpaintData::is_multiframe, tGP_BrushVertexpaintData::is_painting, tGP_BrushVertexpaintData::linear_color, tGP_BrushVertexpaintData::mask, MEM_callocN, Object::mode, NULL, OB_MODE_VERTEX_GPENCIL, tGP_BrushVertexpaintData::object, GpPaint::paint, GpVertexPaint::paint, tGP_BrushVertexpaintData::pbuffer, tGP_BrushVertexpaintData::pbuffer_size, tGP_BrushVertexpaintData::pbuffer_used, tGP_BrushVertexpaintData::region, Brush::rgb, scene, tGP_BrushVertexpaintData::scene, Brush::size, srgb_to_linearrgb_v3_v3(), and tGP_BrushVertexpaintData::use_multiframe_falloff.
Referenced by gpencil_vertexpaint_brush_exec(), and gpencil_vertexpaint_brush_invoke().
|
static |
Definition at line 1275 of file gpencil_vertex_paint.c.
References BKE_report(), C, CTX_wm_manager(), CTX_wm_region(), wmOperator::customdata, ED_region_tag_redraw(), ED_screen_animation_playing(), gpencil_vertexpaint_brush_apply_event(), gpencil_vertexpaint_brush_init(), tGP_BrushVertexpaintData::is_painting, NULL, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, wmOperator::ptr, wmOperator::reports, RNA_boolean_get(), RPT_ERROR, and WM_event_add_modal_handler().
Referenced by GPENCIL_OT_vertex_paint().
|
static |
Definition at line 1314 of file gpencil_vertex_paint.c.
References BLI_assert, C, CTX_wm_region(), wmOperator::customdata, DEG_id_tag_update(), ED_region_tag_redraw(), EVT_DOWNARROWKEY, EVT_ESCKEY, EVT_LEFTARROWKEY, EVT_PAD0, EVT_PAD1, EVT_PAD2, EVT_PAD3, EVT_PAD4, EVT_PAD5, EVT_PAD6, EVT_PAD7, EVT_PAD8, EVT_PAD9, EVT_RIGHTARROWKEY, EVT_UPARROWKEY, tGP_BrushVertexpaintData::first, tGP_BrushVertexpaintData::gpd, gpencil_vertexpaint_brush_apply_event(), gpencil_vertexpaint_brush_exit(), bGPdata::id, ID_RECALC_GEOMETRY, INBETWEEN_MOUSEMOVE, tGP_BrushVertexpaintData::is_painting, LEFTMOUSE, MIDDLEMOUSE, MOUSEMOVE, NC_SCENE, ND_TOOLSETTINGS, NULL, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, OPERATOR_RUNNING_MODAL, wmOperator::ptr, RIGHTMOUSE, RNA_boolean_get(), wmEvent::type, and WM_event_add_notifier().
Referenced by GPENCIL_OT_vertex_paint().
Definition at line 778 of file gpencil_vertex_paint.c.
References C, and CTX_DATA_COUNT.
Referenced by GPENCIL_OT_vertex_paint().
|
static |
Definition at line 810 of file gpencil_vertex_paint.c.
References BKE_gpencil_material_settings(), BLI_rcti_isect_pt(), tGP_BrushVertexpaintData::brush, tGP_BrushVertexpaintData::brush_rect, ED_gpencil_stroke_check_collision(), ED_gpencil_stroke_point_is_inside(), ELEM, Brush::flag, bGPDspoint::flag, bGPDstroke::flag, MaterialGPencilStyle::flag, GP_BRUSH_USE_PRESSURE, GP_MATERIAL_FILL_SHOW, GP_SPOINT_SELECT, GP_STROKE_SELECT, GPAINT_TOOL_TINT, GPENCIL_ANY_VERTEX_MASK, gpencil_point_to_parent_space(), gpencil_point_to_xy(), gpencil_save_selected_point(), gpencil_stroke_inside_circle(), bGPDstroke_Runtime::gps_orig, GPVERTEX_TOOL_DRAW, tGP_BrushVertexpaintData::gsc, bGPDspoint_Runtime::idx_orig, if(), len_v2v2_int(), tGP_BrushVertexpaintData::mask, tGP_BrushVertexpaintData::mval, NULL, tGP_BrushVertexpaintData::object, bGPDstroke::points, tGP_BrushVertexpaintData::pressure, bGPDspoint_Runtime::pt_orig, round_v2i_v2fl(), bGPDspoint::runtime, bGPDstroke::runtime, Brush::size, bGPDstroke::totpoints, and V2D_IS_CLIPPED.
Referenced by gpencil_vertexpaint_brush_do_frame().