/* This function frees any MEM_calloc'ed copy/paste buffer data */ void free_gpcopybuf () { free_gpencil_layers(&gpcopybuf); gpcopybuf.first= gpcopybuf.last= NULL; gpcopy_firstframe= 999999999; }
/* This function frees any MEM_calloc'ed copy/paste buffer data */ void ED_gpencil_anim_copybuf_free(void) { free_gpencil_layers(&gp_anim_copybuf); BLI_listbase_clear(&gp_anim_copybuf); gp_anim_copy_firstframe = 999999999; gp_anim_copy_lastframe = -999999999; gp_anim_copy_cfra = 0; }
/* Free all of GPencil datablock's related data, but not the block itself */ void BKE_gpencil_free(bGPdata *gpd) { /* free layers */ free_gpencil_layers(&gpd->layers); /* free animation data */ if (gpd->adt) { BKE_animdata_free(&gpd->id); gpd->adt = NULL; } }
int ED_undo_gpencil_step(bContext *C, int step, const char *name) { bGPdata **gpd_ptr = NULL, *new_gpd = NULL; gpd_ptr = gpencil_data_get_pointers(C, NULL); if (step == 1) { /* undo */ //printf("\t\tGP - undo step\n"); if (cur_node->prev) { if (!name || strcmp(cur_node->name, name) == 0) { cur_node = cur_node->prev; new_gpd = cur_node->gpd; } } } else if (step == -1) { //printf("\t\tGP - redo step\n"); if (cur_node->next) { if (!name || strcmp(cur_node->name, name) == 0) { cur_node = cur_node->next; new_gpd = cur_node->gpd; } } } if (new_gpd) { if (gpd_ptr) { if (*gpd_ptr) { bGPdata *gpd = *gpd_ptr; bGPDlayer *gpl, *gpld; free_gpencil_layers(&gpd->layers); /* copy layers */ gpd->layers.first = gpd->layers.last = NULL; for (gpl = new_gpd->layers.first; gpl; gpl = gpl->next) { /* make a copy of source layer and its data */ gpld = gpencil_layer_duplicate(gpl); BLI_addtail(&gpd->layers, gpld); } } } } WM_event_add_notifier(C, NC_SCREEN | ND_GPENCIL | NA_EDITED, NULL); return OPERATOR_FINISHED; }
/* Free all of GPencil datablock's related data, but not the block itself */ void BKE_gpencil_free(bGPdata *gpd) { /* free layers */ free_gpencil_layers(&gpd->layers); }
static void rna_GPencil_clear(bGPdata *gpd) { free_gpencil_layers(&gpd->layers); WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); }