41 #include "RNA_prototypes.h"
104 bool *
UNUSED(r_sort_depsgraph))
127 bool sort_depsgraph =
false;
146 bool sort_depsgraph =
false;
204 if (md_index < index) {
206 for (; md_index < index; md_index++) {
214 for (; md_index > index; md_index--) {
266 BKE_report(reports,
RPT_ERROR,
"Modifiers cannot be applied in paint, sculpt or edit mode");
270 if (((
ID *)ob->
data)->us > 1) {
275 else if (((
ID *)ob->
data)->us > 1) {
281 BKE_report(reports,
RPT_INFO,
"Applied modifier was not first, result may not be as expected");
367 group_item = md_item;
392 ot->
name =
"Add Modifier";
393 ot->
description =
"Add a procedural operation/effect to the active grease pencil object";
394 ot->
idname =
"OBJECT_OT_gpencil_modifier_add";
430 if (obtype_flag && ((1 << ob->
type) & obtype_flag) == 0) {
439 C,
"Cannot edit modifiers coming from linked data in a library override");
468 ot->
srna,
"report",
false,
"Report",
"Create a notification after the operation");
506 if (r_retval !=
NULL) {
513 if (r_retval !=
NULL) {
554 strcpy(name, md->
name);
580 ot->
name =
"Remove Grease Pencil Modifier";
581 ot->
description =
"Remove a modifier from the active grease pencil object";
582 ot->
idname =
"OBJECT_OT_gpencil_modifier_remove";
622 ot->
name =
"Move Up Modifier";
624 ot->
idname =
"OBJECT_OT_gpencil_modifier_move_up";
663 ot->
name =
"Move Down Modifier";
665 ot->
idname =
"OBJECT_OT_gpencil_modifier_move_down";
701 ot->
name =
"Move Active Modifier to Index";
702 ot->
idname =
"OBJECT_OT_gpencil_modifier_move_to_index";
704 "Change the modifier's position in the list so it evaluates after the set number of "
715 ot->
srna,
"index", 0, 0, INT_MAX,
"Index",
"The index to move the modifier to", 0, INT_MAX);
737 strcpy(name, md->
name);
773 "Apply deform-only modifier to a new shape on this object"},
779 ot->
name =
"Apply Modifier";
780 ot->
description =
"Apply modifier and remove from the stack";
781 ot->
idname =
"OBJECT_OT_gpencil_modifier_apply";
795 "How to apply the modifier to the geometry");
828 ot->
name =
"Copy Modifier";
829 ot->
description =
"Duplicate modifier at the same position in the stack";
830 ot->
idname =
"OBJECT_OT_gpencil_modifier_copy";
855 "Source object '%s' is not a grease pencil object",
868 "Destination object '%s' is not a grease pencil object",
902 bool found_supported_objects =
false;
909 found_supported_objects =
true;
915 if (!found_supported_objects) {
924 ot->
name =
"Copy Modifier to Selected";
925 ot->
description =
"Copy the modifier from the active object to all selected objects";
926 ot->
idname =
"OBJECT_OT_gpencil_modifier_copy_to_selected";
972 memcpy(new_segments + new_active_index + 1,
1007 ot->
name =
"Add Segment";
1009 ot->
idname =
"GPENCIL_OT_segment_add";
1045 memcpy(new_segments,
1079 ot->
name =
"Remove Dash Segment";
1080 ot->
description =
"Remove the active segment from the dash modifier";
1081 ot->
idname =
"GPENCIL_OT_segment_remove";
1093 ot->
srna,
"index", 0, 0, INT_MAX,
"Index",
"Index of the segment to remove", 0, INT_MAX);
1166 ot->
name =
"Move Dash Segment";
1167 ot->
description =
"Move the active dash segment up or down";
1168 ot->
idname =
"GPENCIL_OT_segment_move";
struct Scene * CTX_data_scene(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg)
struct Main * CTX_data_main(const bContext *C)
void BKE_gpencil_modifier_free(struct GpencilModifierData *md)
bool BKE_gpencil_modifier_unique_name(struct ListBase *modifiers, struct GpencilModifierData *gmd)
@ eGpencilModifierTypeFlag_Single
@ eGpencilModifierTypeFlag_SupportsEditmode
@ eGpencilModifierTypeFlag_NoUserAdd
struct GpencilModifierData * BKE_gpencil_modifiers_findby_name(struct Object *ob, const char *name)
bool BKE_gpencil_modifier_is_nonlocal_in_liboverride(const struct Object *ob, const struct GpencilModifierData *gmd)
struct GpencilModifierData * BKE_gpencil_modifiers_findby_type(struct Object *ob, GpencilModifierType type)
void BKE_gpencil_modifier_copydata(struct GpencilModifierData *md, struct GpencilModifierData *target)
const GpencilModifierTypeInfo * BKE_gpencil_modifier_get_info(GpencilModifierType type)
struct GpencilModifierData * BKE_gpencil_modifier_new(int type)
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
General operations, lookup, etc. for blender objects.
bool BKE_object_copy_gpencil_modifier(struct Object *ob_dst, struct GpencilModifierData *gmd_src)
void BKE_object_free_derived_caches(struct Object *ob)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
bool BLI_uniquename_cb(UniquenameCheckCallback unique_check, void *arg, const char *defname, char delim, char *name, size_t name_len)
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
#define DNA_struct_default_get(struct_name)
@ eGpencilModifierMode_Editmode
@ eGpencilModifierFlag_OverrideLibrary_Local
@ eGpencilModifierType_Dash
@ eGpencilModifierType_Thick
Object is a sort of wrapper for general info.
struct Object * ED_object_active_context(const struct bContext *C)
bool ED_operator_object_active_editable(struct bContext *C)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
struct PointerRNA * UI_region_panel_custom_data_under_cursor(const struct bContext *C, const struct wmEvent *event)
const Depsgraph * depsgraph
static const char * modifier_name[LS_MODIFIER_NUM]
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void OBJECT_OT_gpencil_modifier_copy(wmOperatorType *ot)
void ED_object_gpencil_modifier_copy_to_object(Object *ob_dst, GpencilModifierData *md)
void OBJECT_OT_gpencil_modifier_add(wmOperatorType *ot)
static int gpencil_modifier_remove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void OBJECT_OT_gpencil_modifier_move_up(wmOperatorType *ot)
void OBJECT_OT_gpencil_modifier_move_down(wmOperatorType *ot)
static int dash_segment_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static bool gpencil_modifier_apply_obdata(ReportList *reports, Main *bmain, Depsgraph *depsgraph, Object *ob, GpencilModifierData *md)
static bool dash_segment_name_exists_fn(void *arg, const char *name)
static int gpencil_modifier_copy_to_selected_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int gpencil_modifier_move_to_index_exec(bContext *C, wmOperator *op)
GpencilModifierData * ED_object_gpencil_modifier_add(ReportList *reports, Main *bmain, Scene *UNUSED(scene), Object *ob, const char *name, int type)
static const EnumPropertyItem gpencil_modifier_apply_as_items[]
static int dash_segment_add_exec(bContext *C, wmOperator *op)
static int gpencil_modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void gpencil_edit_modifier_report_property(wmOperatorType *ot)
static int dash_segment_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void ED_object_gpencil_modifier_clear(Main *bmain, Object *ob)
static int gpencil_modifier_apply_exec(bContext *C, wmOperator *op)
bool ED_object_gpencil_modifier_remove(ReportList *reports, Main *bmain, Object *ob, GpencilModifierData *md)
bool ED_object_gpencil_modifier_move_to_index(ReportList *reports, Object *ob, GpencilModifierData *md, const int index)
static int dash_segment_move_exec(bContext *C, wmOperator *op)
void GPENCIL_OT_segment_move(wmOperatorType *ot)
static int gpencil_modifier_add_exec(bContext *C, wmOperator *op)
static int gpencil_modifier_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void OBJECT_OT_gpencil_modifier_copy_to_selected(wmOperatorType *ot)
static GpencilModifierData * gpencil_edit_modifier_property_get(wmOperator *op, Object *ob, int type)
static void gpencil_edit_modifier_properties(wmOperatorType *ot)
static int gpencil_modifier_move_up_exec(bContext *C, wmOperator *op)
static int gpencil_modifier_copy_exec(bContext *C, wmOperator *op)
static int gpencil_modifier_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int gpencil_modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool dash_segment_poll(bContext *C)
void OBJECT_OT_gpencil_modifier_move_to_index(wmOperatorType *ot)
bool ED_object_gpencil_modifier_move_down(ReportList *UNUSED(reports), Object *ob, GpencilModifierData *md)
static int gpencil_modifier_copy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int gpencil_modifier_move_down_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem * gpencil_modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static bool gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag, const bool is_liboverride_allowed)
void GPENCIL_OT_segment_add(wmOperatorType *ot)
static bool gpencil_edit_modifier_liboverride_allowed_poll(bContext *C)
static int dash_segment_move_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
bool ED_object_gpencil_modifier_copy(ReportList *reports, Object *ob, GpencilModifierData *md)
static int dash_segment_remove_exec(bContext *C, wmOperator *op)
static bool gpencil_edit_modifier_invoke_properties(bContext *C, wmOperator *op, const wmEvent *event, int *r_retval)
void OBJECT_OT_gpencil_modifier_remove(wmOperatorType *ot)
bool ED_object_gpencil_modifier_apply(Main *bmain, ReportList *reports, Depsgraph *depsgraph, Object *ob, GpencilModifierData *md, int UNUSED(mode))
static bool gpencil_modifier_copy_to_selected_poll(bContext *C)
static bool gpencil_object_modifier_remove(Main *bmain, Object *ob, GpencilModifierData *md, bool *UNUSED(r_sort_depsgraph))
void GPENCIL_OT_segment_remove(wmOperatorType *ot)
static int gpencil_modifier_copy_to_selected_exec(bContext *C, wmOperator *op)
void OBJECT_OT_gpencil_modifier_apply(wmOperatorType *ot)
static int gpencil_modifier_remove_exec(bContext *C, wmOperator *op)
bool ED_object_gpencil_modifier_move_up(ReportList *UNUSED(reports), Object *ob, GpencilModifierData *md)
static bool gpencil_edit_modifier_poll(bContext *C)
void edit_modifier_properties(struct wmOperatorType *ot)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_pointer_is_null(const PointerRNA *ptr)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[]
DashGpencilModifierSegment * segments
struct DashGpencilModifierData * dmd
struct GpencilModifierData * next
struct GpencilModifierData * prev
void(* bakeModifier)(struct Main *bmain, struct Depsgraph *depsgraph, struct GpencilModifierData *md, struct Object *ob)
GpencilModifierTypeFlag flags
bool(* isDisabled)(struct GpencilModifierData *md, int userRenderParams)
ListBase greasepencil_modifiers
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
ccl_device_inline int mod(int x, int m)
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))