Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_gpencil_modifier.c
| Show First 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | else { | ||||
| /* Move modifier up in list. */ | /* Move modifier up in list. */ | ||||
| for (; md_index > index; md_index--) { | for (; md_index > index; md_index--) { | ||||
| if (!ED_object_gpencil_modifier_move_up(reports, ob, md)) { | if (!ED_object_gpencil_modifier_move_up(reports, ob, md)) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | |||||
| WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); | |||||
| return true; | return true; | ||||
| } | } | ||||
| static int gpencil_modifier_apply_obdata( | static int gpencil_modifier_apply_obdata( | ||||
| ReportList *reports, Main *bmain, Depsgraph *depsgraph, Object *ob, GpencilModifierData *md) | ReportList *reports, Main *bmain, Depsgraph *depsgraph, Object *ob, GpencilModifierData *md) | ||||
| { | { | ||||
| const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type); | const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type); | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | int ED_object_gpencil_modifier_copy(ReportList *reports, Object *ob, GpencilModifierData *md) | ||||
| nmd = BKE_gpencil_modifier_new(md->type); | nmd = BKE_gpencil_modifier_new(md->type); | ||||
| BKE_gpencil_modifier_copydata(md, nmd); | BKE_gpencil_modifier_copydata(md, nmd); | ||||
| BLI_insertlinkafter(&ob->greasepencil_modifiers, md, nmd); | BLI_insertlinkafter(&ob->greasepencil_modifiers, md, nmd); | ||||
| BKE_gpencil_modifier_unique_name(&ob->greasepencil_modifiers, nmd); | BKE_gpencil_modifier_unique_name(&ob->greasepencil_modifiers, nmd); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| void ED_object_gpencil_modifier_copy_to_object(Object *ob_dst, GpencilModifierData *md) | |||||
| { | |||||
| BKE_object_copy_gpencil_modifier(ob_dst, md); | |||||
| WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob_dst); | |||||
| DEG_id_tag_update(&ob_dst->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); | |||||
| } | |||||
| /************************ add modifier operator *********************/ | /************************ add modifier operator *********************/ | ||||
| static int gpencil_modifier_add_exec(bContext *C, wmOperator *op) | static int gpencil_modifier_add_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| int type = RNA_enum_get(op->ptr, "type"); | int type = RNA_enum_get(op->ptr, "type"); | ||||
| ▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | static int gpencil_modifier_move_to_index_exec(bContext *C, wmOperator *op) | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| GpencilModifierData *md = gpencil_edit_modifier_property_get(op, ob, 0); | GpencilModifierData *md = gpencil_edit_modifier_property_get(op, ob, 0); | ||||
| int index = RNA_int_get(op->ptr, "index"); | int index = RNA_int_get(op->ptr, "index"); | ||||
| if (!ED_object_gpencil_modifier_move_to_index(op->reports, ob, md, index)) { | if (!ED_object_gpencil_modifier_move_to_index(op->reports, ob, md, index)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | |||||
| WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int gpencil_modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int gpencil_modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| int retval; | int retval; | ||||
| if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) { | if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) { | ||||
| return gpencil_modifier_move_to_index_exec(C, op); | return gpencil_modifier_move_to_index_exec(C, op); | ||||
| ▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines | |||||