Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/gpencil.c
| Context not available. | |||||
| /* --------- Memory Management ------------ */ | /* --------- Memory Management ------------ */ | ||||
| /* Free strokes belonging to a gp-frame */ | /* Free strokes belonging to a gp-frame */ | ||||
| void free_gpencil_strokes(bGPDframe *gpf) | bool free_gpencil_strokes(bGPDframe *gpf) | ||||
| { | { | ||||
| bGPDstroke *gps, *gpsn; | bGPDstroke *gps, *gpsn; | ||||
| bool modified = gpf->strokes.first != NULL; | |||||
| /* error checking */ | /* error checking */ | ||||
| if (gpf == NULL) return; | if (gpf == NULL) | ||||
| return false; | |||||
| /* free strokes */ | /* free strokes */ | ||||
| for (gps = gpf->strokes.first; gps; gps = gpsn) { | for (gps = gpf->strokes.first; gps; gps = gpsn) { | ||||
| Context not available. | |||||
| if (gps->points) MEM_freeN(gps->points); | if (gps->points) MEM_freeN(gps->points); | ||||
| BLI_freelinkN(&gpf->strokes, gps); | BLI_freelinkN(&gpf->strokes, gps); | ||||
| } | } | ||||
| return modified; | |||||
| } | } | ||||
| /* Free all of a gp-layer's frames */ | /* Free all of a gp-layer's frames */ | ||||
| Context not available. | |||||
| } | } | ||||
| /* delete the given frame from a layer */ | /* delete the given frame from a layer */ | ||||
| void gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf) | bool gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf) | ||||
| { | { | ||||
| bool modified = false; | |||||
| /* error checking */ | /* error checking */ | ||||
| if (ELEM(NULL, gpl, gpf)) | if (ELEM(NULL, gpl, gpf)) | ||||
| return; | return false; | ||||
| /* free the frame and its data */ | /* free the frame and its data */ | ||||
| free_gpencil_strokes(gpf); | modified = free_gpencil_strokes(gpf); | ||||
| BLI_freelinkN(&gpl->frames, gpf); | BLI_freelinkN(&gpl->frames, gpf); | ||||
| gpl->actframe = NULL; | gpl->actframe = NULL; | ||||
| return modified; | |||||
| } | } | ||||
| /* get the active gp-layer for editing */ | /* get the active gp-layer for editing */ | ||||
| Context not available. | |||||