Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_undo.c
| Show All 30 Lines | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "DNA_object_types.h" | |||||
| #include "DNA_listBase.h" | #include "DNA_listBase.h" | ||||
| #include "DNA_windowmanager_types.h" | #include "DNA_windowmanager_types.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BKE_blender_undo.h" | #include "BKE_blender_undo.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_gpencil.h" | #include "BKE_gpencil.h" | ||||
| #include "ED_gpencil.h" | #include "ED_gpencil.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "DEG_depsgraph.h" | |||||
| #include "gpencil_intern.h" | #include "gpencil_intern.h" | ||||
| typedef struct bGPundonode { | typedef struct bGPundonode { | ||||
| struct bGPundonode *next, *prev; | struct bGPundonode *next, *prev; | ||||
| char name[BKE_UNDO_STR_MAX]; | char name[BKE_UNDO_STR_MAX]; | ||||
| struct bGPdata *gpd; | struct bGPdata *gpd; | ||||
| } bGPundonode; | } bGPundonode; | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (gpd_ptr) { | ||||
| for (gpl = new_gpd->layers.first; gpl; gpl = gpl->next) { | for (gpl = new_gpd->layers.first; gpl; gpl = gpl->next) { | ||||
| /* make a copy of source layer and its data */ | /* make a copy of source layer and its data */ | ||||
| gpld = BKE_gpencil_layer_duplicate(gpl); | gpld = BKE_gpencil_layer_duplicate(gpl); | ||||
| BLI_addtail(&gpd->layers, gpld); | BLI_addtail(&gpd->layers, gpld); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* drawing batch cache is dirty now */ | |||||
| DEG_id_tag_update(&new_gpd->id, OB_RECALC_OB | OB_RECALC_DATA); | |||||
| new_gpd->flag |= GP_DATA_CACHE_IS_DIRTY; | |||||
| } | } | ||||
| WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void gpencil_undo_init(bGPdata *gpd) | void gpencil_undo_init(bGPdata *gpd) | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||