67 #define GP_SELECT_BUFFER_CHUNK 256
159 if (*buffer_used + 1 > *buffer_size) {
160 if ((*buffer_size == 0) || (buffer_array ==
NULL)) {
170 *buffer_size = *buffer_used = 0;
179 if (buffer_array !=
NULL) {
180 memset(buffer_array, 0,
sizeof(
tGP_Selected) * *buffer_size);
195 float influence = brush->
alpha;
210 influence *= brush_falloff;
253 if ((ob_armature !=
NULL)) {
255 if (actbone !=
NULL) {
404 const float diff_mat[4][4],
405 const float bound_mat[4][4])
421 bool include_last =
false;
442 if (pt_active !=
NULL) {
452 for (i = 0; (i + 1) < gps->
totpoints; i++) {
455 pt2 = gps->
points + i + 1;
476 if (pt_active !=
NULL) {
492 if (pt_active !=
NULL) {
495 include_last =
false;
502 else if (include_last) {
510 if (pt_active !=
NULL) {
514 include_last =
false;
527 const float diff_mat[4][4],
528 const float bound_mat[4][4])
560 bool changed =
false;
567 brush_draw_apply(gso, selected->gps, selected->pt_index, radius, selected->pc);
572 printf(
"ERROR: Unknown type of GPencil Weight Paint brush\n");
589 bool changed =
false;
602 float diff_mat[4][4], bound_mat[4][4];
605 mul_m4_m4m4(diff_mat, diff_mat, gpl->layer_invmat);
638 if (gpl->actframe !=
NULL) {
642 C, gso, gpl, gpl->actframe, diff_mat, bound_mat);
659 bool changed =
false;
663 gso->
mval[0] = mouse[0] = (int)(mousef[0]);
664 gso->
mval[1] = mouse[1] = (int)(mousef[1]);
710 mouse[0] =
event->mval[0] + 1;
711 mouse[1] =
event->mval[1] + 1;
721 float pressure =
event->tablet.pressure;
722 CLAMP(pressure, 0.0f, 1.0f);
771 if (is_modal ==
false) {
790 bool redraw_region =
false;
791 bool redraw_toolsettings =
false;
796 switch (event->
type) {
804 redraw_region =
true;
834 switch (event->
type) {
857 redraw_region =
true;
893 if (redraw_toolsettings) {
904 ot->
name =
"Stroke Weight Paint";
905 ot->
idname =
"GPENCIL_OT_weight_paint";
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
float BKE_brush_curve_strength(const struct Brush *br, float p, const float len)
struct Scene * CTX_data_scene(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
#define CTX_DATA_COUNT(C, member)
struct ARegion * CTX_wm_region(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct ToolSettings * CTX_data_tool_settings(const bContext *C)
float BKE_gpencil_multiframe_falloff_calc(struct bGPDframe *gpf, int actnum, int f_init, int f_end, struct CurveMapping *cur_falloff)
void BKE_gpencil_dvert_ensure(struct bGPDstroke *gps)
bool BKE_gpencil_layer_is_editable(const struct bGPDlayer *gpl)
void BKE_gpencil_frame_range_selected(struct bGPDlayer *gpl, int *r_initframe, int *r_endframe)
void BKE_gpencil_layer_transform_matrix_get(const struct Depsgraph *depsgraph, struct Object *obact, struct bGPDlayer *gpl, float diff_mat[4][4])
struct Object * BKE_modifiers_is_deformed_by_armature(struct Object *ob)
void BKE_report(ReportList *reports, ReportType type, const char *message)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE float interpf(float a, float b, float t)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
MINLINE void round_v2i_v2fl(int r[2], const float a[2])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_v2v2_int(const int v1[2], const int v2[2])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE float normalize_v2(float r[2])
bool BLI_rcti_isect_pt(const struct rcti *rect, const int x, const int y)
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
#define GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)
@ GP_SCULPT_SETT_FLAG_FRAME_FALLOFF
bScreen * ED_screen_animation_playing(const struct wmWindowManager *wm)
void ED_region_tag_redraw(struct ARegion *region)
void ED_workspace_status_text(struct bContext *C, const char *str)
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
Group RGB to Bright Vector Camera CLAMP
#define RNA_BEGIN(sptr, itemptr, propname)
StructRNA RNA_OperatorStrokeElement
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
const Depsgraph * depsgraph
void gpencil_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc)
void gpencil_point_to_parent_space(const bGPDspoint *pt, const float diff_mat[4][4], bGPDspoint *r_pt)
bool gpencil_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1)
void gpencil_point_to_xy(const GP_SpaceConversion *gsc, const struct bGPDstroke *gps, const struct bGPDspoint *pt, int *r_x, int *r_y)
bool ED_gpencil_stroke_material_editable(Object *ob, const bGPDlayer *gpl, const bGPDstroke *gps)
bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc, bGPDstroke *gps, const float mouse[2], const int radius, const float diff_mat[4][4])
bool ED_gpencil_stroke_can_use(const bContext *C, const bGPDstroke *gps)
bGPdata * ED_gpencil_data_get_active(const bContext *C)
static void gpencil_weightpaint_brush_header_set(bContext *C)
static bool brush_draw_apply(tGP_BrushWeightpaintData *gso, bGPDstroke *gps, int pt_index, const int radius, const int co[2])
static int gpencil_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int gpencil_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void gpencil_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
static bool gpencil_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpaintData *gso)
static float brush_influence_calc(tGP_BrushWeightpaintData *gso, const int radius, const int co[2])
static void gpencil_save_selected_point(tGP_BrushWeightpaintData *gso, bGPDstroke *gps, int index, int pc[2])
void GPENCIL_OT_weight_paint(wmOperatorType *ot)
static tGP_Selected * gpencil_select_buffer_ensure(tGP_Selected *buffer_array, int *buffer_size, int *buffer_used, const bool clear)
static void gpencil_weightpaint_brush_exit(bContext *C, wmOperator *op)
struct tGP_BrushWeightpaintData tGP_BrushWeightpaintData
static bool gpencil_weightpaint_brush_poll(bContext *C)
#define GP_SELECT_BUFFER_CHUNK
static bool gpencil_weightpaint_brush_do_frame(bContext *C, tGP_BrushWeightpaintData *gso, bGPDlayer *gpl, bGPDframe *gpf, const float diff_mat[4][4], const float bound_mat[4][4])
static bool gpencil_weightpaint_brush_init(bContext *C, wmOperator *op)
static void gpencil_weightpaint_brush_apply_event(bContext *C, wmOperator *op, const wmEvent *event)
static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, bGPDstroke *gps, const float diff_mat[4][4], const float bound_mat[4][4])
static int gpencil_weightpaint_brush_exec(bContext *C, wmOperator *op)
static void brush_calc_dvec_2d(tGP_BrushWeightpaintData *gso)
struct tGP_Selected tGP_Selected
void *(* MEM_callocN)(size_t len, const char *str)
static void clear(Message *msg)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_collection_runtime(StructOrFunctionRNA *cont_, const char *identifier, StructRNA *type, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct CurveMapping * curve
struct BrushGpencilSettings * gpencil_settings
struct CurveMapping * cur_falloff
struct bGPDspoint * pt_orig
bGPDspoint_Runtime runtime
struct bGPDstroke * gps_orig
bGPDstroke_Runtime runtime
struct MDeformVert * dvert
bool use_multiframe_falloff
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* cancel)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
ccl_device_inline float distance(const float2 &a, const float2 &b)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)