Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mask/mask_ops.c
| Show First 20 Lines • Show All 435 Lines • ▼ Show 20 Lines | static int masklay_new_exec(bContext *C, wmOperator *op) | ||||
| char name[MAX_ID_NAME - 2]; | char name[MAX_ID_NAME - 2]; | ||||
| RNA_string_get(op->ptr, "name", name); | RNA_string_get(op->ptr, "name", name); | ||||
| BKE_mask_layer_new(mask, name); | BKE_mask_layer_new(mask, name); | ||||
| mask->masklay_act = mask->masklay_tot - 1; | mask->masklay_act = mask->masklay_tot - 1; | ||||
| WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); | WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); | ||||
| DEG_id_tag_update(&mask->id, ID_RECALC_COPY_ON_WRITE); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void MASK_OT_layer_new(wmOperatorType *ot) | void MASK_OT_layer_new(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Add Mask Layer"; | ot->name = "Add Mask Layer"; | ||||
| Show All 17 Lines | |||||
| { | { | ||||
| Mask *mask = CTX_data_edit_mask(C); | Mask *mask = CTX_data_edit_mask(C); | ||||
| MaskLayer *masklay = BKE_mask_layer_active(mask); | MaskLayer *masklay = BKE_mask_layer_active(mask); | ||||
| if (masklay) { | if (masklay) { | ||||
| BKE_mask_layer_remove(mask, masklay); | BKE_mask_layer_remove(mask, masklay); | ||||
| WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); | WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); | ||||
| DEG_id_tag_update(&mask->id, ID_RECALC_COPY_ON_WRITE); | |||||
| } | } | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void MASK_OT_layer_remove(wmOperatorType *ot) | void MASK_OT_layer_remove(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ▲ Show 20 Lines • Show All 1,946 Lines • Show Last 20 Lines | |||||