Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_intern.h
| Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
| void gp_point_to_xy(GP_SpaceConversion *settings, struct bGPDstroke *gps, struct bGPDspoint *pt, | void gp_point_to_xy(GP_SpaceConversion *settings, struct bGPDstroke *gps, struct bGPDspoint *pt, | ||||
| int *r_x, int *r_y); | int *r_x, int *r_y); | ||||
| void gp_point_to_xy_fl(GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt, | void gp_point_to_xy_fl(GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt, | ||||
| float *r_x, float *r_y); | float *r_x, float *r_y); | ||||
| void gp_point_to_parent_space(bGPDspoint *pt, float diff_mat[4][4], bGPDspoint *r_pt); | void gp_point_to_parent_space(bGPDspoint *pt, float diff_mat[4][4], bGPDspoint *r_pt); | ||||
| /** | |||||
| void gp_apply_parent(bGPDlayer *gpl, bGPDstroke *gps); | * Change points position relative to parent object | ||||
| */ | |||||
| void gp_apply_parent_point(bGPDlayer *gpl, bGPDspoint *pt); | void gp_apply_parent(struct Object *obact, bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps); | ||||
| /** | |||||
| * Change point position relative to parent object | |||||
| */ | |||||
| void gp_apply_parent_point(struct Object *obact, bGPdata *gpd, bGPDlayer *gpl, bGPDspoint *pt); | |||||
| bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3]); | bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3]); | ||||
| /* Poll Callbacks ------------------------------------ */ | /* Poll Callbacks ------------------------------------ */ | ||||
| /* gpencil_utils.c */ | /* gpencil_utils.c */ | ||||
| int gp_add_poll(struct bContext *C); | int gp_add_poll(struct bContext *C); | ||||
| int gp_active_layer_poll(struct bContext *C); | int gp_active_layer_poll(struct bContext *C); | ||||
| int gp_active_brush_poll(struct bContext *C); | int gp_active_brush_poll(struct bContext *C); | ||||
| int gp_active_palette_poll(struct bContext *C); | |||||
| int gp_active_palettecolor_poll(struct bContext *C); | |||||
| int gp_brush_crt_presets_poll(bContext *C); | int gp_brush_crt_presets_poll(bContext *C); | ||||
| /* Copy/Paste Buffer --------------------------------- */ | /* Copy/Paste Buffer --------------------------------- */ | ||||
| /* gpencil_edit.c */ | /* gpencil_edit.c */ | ||||
| extern ListBase gp_strokes_copypastebuf; | extern ListBase gp_strokes_copypastebuf; | ||||
| /* Build a map for converting between old colornames and destination-color-refs */ | /* Build a map for converting between old colornames and destination-color-refs */ | ||||
| struct GHash *gp_copybuf_validate_colormap(bGPdata *gpd); | struct GHash *gp_copybuf_validate_colormap(struct bContext *C); | ||||
| /* Stroke Editing ------------------------------------ */ | /* Stroke Editing ------------------------------------ */ | ||||
| void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, int tag_flags); | void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, int tag_flags); | ||||
| bool gp_smooth_stroke(bGPDstroke *gps, int i, float inf, bool affect_pressure); | bool gp_smooth_stroke(bGPDstroke *gps, int i, float inf, bool affect_pressure); | ||||
| bool gp_smooth_stroke_strength(bGPDstroke *gps, int i, float inf); | bool gp_smooth_stroke_strength(bGPDstroke *gps, int i, float inf); | ||||
| Show All 36 Lines | |||||
| } eGPencil_PaintModes; | } eGPencil_PaintModes; | ||||
| /* maximum sizes of gp-session buffer */ | /* maximum sizes of gp-session buffer */ | ||||
| #define GP_STROKE_BUFFER_MAX 5000 | #define GP_STROKE_BUFFER_MAX 5000 | ||||
| /* stroke editing ----- */ | /* stroke editing ----- */ | ||||
| void GPENCIL_OT_editmode_toggle(struct wmOperatorType *ot); | void GPENCIL_OT_editmode_toggle(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_paintmode_toggle(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_sculptmode_toggle(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_weightmode_toggle(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_selection_opacity_toggle(struct wmOperatorType *ot); | void GPENCIL_OT_selection_opacity_toggle(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_multiedit_toggle(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_select(struct wmOperatorType *ot); | void GPENCIL_OT_select(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_all(struct wmOperatorType *ot); | void GPENCIL_OT_select_all(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_circle(struct wmOperatorType *ot); | void GPENCIL_OT_select_circle(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_border(struct wmOperatorType *ot); | void GPENCIL_OT_select_border(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_lasso(struct wmOperatorType *ot); | void GPENCIL_OT_select_lasso(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_linked(struct wmOperatorType *ot); | void GPENCIL_OT_select_linked(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_grouped(struct wmOperatorType *ot); | void GPENCIL_OT_select_grouped(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_more(struct wmOperatorType *ot); | void GPENCIL_OT_select_more(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_less(struct wmOperatorType *ot); | void GPENCIL_OT_select_less(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_first(struct wmOperatorType *ot); | void GPENCIL_OT_select_first(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_last(struct wmOperatorType *ot); | void GPENCIL_OT_select_last(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_select_alternate(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_duplicate(struct wmOperatorType *ot); | void GPENCIL_OT_duplicate(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_delete(struct wmOperatorType *ot); | void GPENCIL_OT_delete(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_dissolve(struct wmOperatorType *ot); | void GPENCIL_OT_dissolve(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_copy(struct wmOperatorType *ot); | void GPENCIL_OT_copy(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_paste(struct wmOperatorType *ot); | void GPENCIL_OT_paste(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_move_to_layer(struct wmOperatorType *ot); | void GPENCIL_OT_move_to_layer(struct wmOperatorType *ot); | ||||
| Show All 30 Lines | |||||
| void GPENCIL_OT_layer_merge(struct wmOperatorType *ot); | void GPENCIL_OT_layer_merge(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_blank_frame_add(struct wmOperatorType *ot); | void GPENCIL_OT_blank_frame_add(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_active_frame_delete(struct wmOperatorType *ot); | void GPENCIL_OT_active_frame_delete(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_active_frames_delete_all(struct wmOperatorType *ot); | void GPENCIL_OT_active_frames_delete_all(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_convert(struct wmOperatorType *ot); | void GPENCIL_OT_convert(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_convert_scene_to_object(struct wmOperatorType *ot); | |||||
| enum { | enum { | ||||
| GP_STROKE_JOIN = -1, | GP_STROKE_JOIN = -1, | ||||
| GP_STROKE_JOINCOPY = 1 | GP_STROKE_JOINCOPY = 1 | ||||
| }; | }; | ||||
| /* move strokes to new palette */ | |||||
| enum { | |||||
| GP_MOVE_PALETTE_SELECT = -1, | |||||
| GP_MOVE_PALETTE_ALL = 1, | |||||
| GP_MOVE_PALETTE_BEFORE = 2, | |||||
| GP_MOVE_PALETTE_AFTER = 3, | |||||
| GP_MOVE_PALETTE_CURRENT = 4 | |||||
| }; | |||||
| enum { | |||||
| GP_STROKE_BOX = -1, | |||||
| GP_STROKE_CIRCLE = 1 | |||||
| }; | |||||
| void GPENCIL_OT_stroke_arrange(struct wmOperatorType *ot); | void GPENCIL_OT_stroke_arrange(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_stroke_change_palette(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_stroke_change_color(struct wmOperatorType *ot); | void GPENCIL_OT_stroke_change_color(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_stroke_lock_color(struct wmOperatorType *ot); | void GPENCIL_OT_stroke_lock_color(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_stroke_apply_thickness(struct wmOperatorType *ot); | void GPENCIL_OT_stroke_apply_thickness(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot); | void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_stroke_join(struct wmOperatorType *ot); | void GPENCIL_OT_stroke_join(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot); | void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_stroke_subdivide(struct wmOperatorType *ot); | void GPENCIL_OT_stroke_subdivide(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_stroke_simplify(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_brush_add(struct wmOperatorType *ot); | void GPENCIL_OT_brush_add(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_brush_remove(struct wmOperatorType *ot); | void GPENCIL_OT_brush_remove(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_brush_change(struct wmOperatorType *ot); | void GPENCIL_OT_brush_change(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_brush_move(struct wmOperatorType *ot); | void GPENCIL_OT_brush_move(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_brush_presets_create(struct wmOperatorType *ot); | void GPENCIL_OT_brush_presets_create(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_brush_copy(struct wmOperatorType *ot); | void GPENCIL_OT_brush_copy(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_brush_select(struct wmOperatorType *ot); | void GPENCIL_OT_brush_select(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_palette_add(struct wmOperatorType *ot); | void GPENCIL_OT_sculpt_select(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_palette_remove(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palette_change(struct wmOperatorType *ot); | void GPENCIL_OT_palette_slot_add(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_palette_lock_layer(struct wmOperatorType *ot); | void GPENCIL_OT_palette_slot_remove(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_palettecolor_add(struct wmOperatorType *ot); | void GPENCIL_OT_convert_old_palettes(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_palettecolor_remove(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palettecolor_isolate(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palettecolor_hide(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palettecolor_reveal(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palettecolor_lock_all(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palettecolor_unlock_all(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palettecolor_move(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palettecolor_select(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_palettecolor_copy(struct wmOperatorType *ot); | |||||
| /* undo stack ---------- */ | /* undo stack ---------- */ | ||||
| void gpencil_undo_init(struct bGPdata *gpd); | void gpencil_undo_init(struct bGPdata *gpd); | ||||
| void gpencil_undo_push(struct bGPdata *gpd); | void gpencil_undo_push(struct bGPdata *gpd); | ||||
| void gpencil_undo_finish(void); | void gpencil_undo_finish(void); | ||||
| /* interpolation ---------- */ | /* interpolation ---------- */ | ||||
| void GPENCIL_OT_interpolate(struct wmOperatorType *ot); | void GPENCIL_OT_interpolate(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_interpolate_sequence(struct wmOperatorType *ot); | void GPENCIL_OT_interpolate_sequence(struct wmOperatorType *ot); | ||||
| void GPENCIL_OT_interpolate_reverse(struct wmOperatorType *ot); | void GPENCIL_OT_interpolate_reverse(struct wmOperatorType *ot); | ||||
| /* primitves ---------- */ | |||||
| void GPENCIL_OT_primitive(struct wmOperatorType *ot); | |||||
| /* vertex groups ------------ */ | |||||
| void GPENCIL_OT_vertex_group_assign(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_vertex_group_remove_from(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_vertex_group_select(struct wmOperatorType *ot); | |||||
| void GPENCIL_OT_vertex_group_deselect(struct wmOperatorType *ot); | |||||
| /* ****************************************************** */ | /* ****************************************************** */ | ||||
| /* FILTERED ACTION DATA - TYPES ---> XXX DEPRECEATED OLD ANIM SYSTEM CODE! */ | /* FILTERED ACTION DATA - TYPES ---> XXX DEPRECEATED OLD ANIM SYSTEM CODE! */ | ||||
| /* XXX - TODO: replace this with the modern bAnimListElem... */ | /* XXX - TODO: replace this with the modern bAnimListElem... */ | ||||
| /* This struct defines a structure used for quick access */ | /* This struct defines a structure used for quick access */ | ||||
| typedef struct bActListElem { | typedef struct bActListElem { | ||||
| struct bActListElem *next, *prev; | struct bActListElem *next, *prev; | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| * | * | ||||
| * \param gpl The identifier to use for the layer of the stroke being processed. | * \param gpl The identifier to use for the layer of the stroke being processed. | ||||
| * Choose a suitable value to avoid name clashes. | * Choose a suitable value to avoid name clashes. | ||||
| * \param gps The identifier to use for current stroke being processed. | * \param gps The identifier to use for current stroke being processed. | ||||
| * Choose a suitable value to avoid name clashes. | * Choose a suitable value to avoid name clashes. | ||||
| */ | */ | ||||
| #define GP_EDITABLE_STROKES_BEGIN(C, gpl, gps) \ | #define GP_EDITABLE_STROKES_BEGIN(C, gpl, gps) \ | ||||
| { \ | { \ | ||||
| Object *obact_ = CTX_data_active_object(C); \ | |||||
| bGPdata *gpd_ = CTX_data_gpencil_data(C); \ | |||||
| bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_); \ | |||||
| CTX_DATA_BEGIN(C, bGPDlayer*, gpl, editable_gpencil_layers) \ | CTX_DATA_BEGIN(C, bGPDlayer*, gpl, editable_gpencil_layers) \ | ||||
| { \ | { \ | ||||
| if (gpl->actframe == NULL) \ | bGPDframe *init_gpf = gpl->actframe; \ | ||||
| continue; \ | if (is_multiedit) { \ | ||||
| /* calculate difference matrix if parent object */ \ | init_gpf = gpl->frames.first; \ | ||||
| } \ | |||||
| for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) { \ | |||||
| if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { \ | |||||
| /* calculate difference matrix */ \ | |||||
| float diff_mat[4][4]; \ | float diff_mat[4][4]; \ | ||||
| ED_gpencil_parent_location(gpl, diff_mat); \ | ED_gpencil_parent_location(obact_, gpd_, gpl, diff_mat); \ | ||||
| /* loop over strokes */ \ | /* loop over strokes */ \ | ||||
| for (bGPDstroke *gps = gpl->actframe->strokes.first; gps; gps = gps->next) { \ | for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { \ | ||||
| /* skip strokes that are invalid for current view */ \ | /* skip strokes that are invalid for current view */ \ | ||||
| if (ED_gpencil_stroke_can_use(C, gps) == false) \ | if (ED_gpencil_stroke_can_use(C, gps) == false) \ | ||||
| continue; \ | continue; \ | ||||
| /* check if the color is editable */ \ | /* check if the color is editable */ \ | ||||
| if (ED_gpencil_stroke_color_use(gpl, gps) == false) \ | if (ED_gpencil_stroke_color_use(gpl, gps) == false) \ | ||||
| continue; \ | continue; \ | ||||
| /* ... Do Stuff With Strokes ... */ | /* ... Do Stuff With Strokes ... */ | ||||
| #define GP_EDITABLE_STROKES_END \ | #define GP_EDITABLE_STROKES_END \ | ||||
| } \ | } \ | ||||
| } \ | } \ | ||||
| if (!is_multiedit) { \ | |||||
| break; \ | |||||
| } \ | |||||
| } \ | |||||
| } \ | |||||
| CTX_DATA_END; \ | CTX_DATA_END; \ | ||||
| } (void)0 | } (void)0 | ||||
| /* ****************************************************** */ | /* ****************************************************** */ | ||||
| #endif /* __GPENCIL_INTERN_H__ */ | #endif /* __GPENCIL_INTERN_H__ */ | ||||