Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/annotate_paint.c
| Show First 20 Lines • Show All 1,426 Lines • ▼ Show 20 Lines | static bool annotation_session_initdata(bContext *C, tGPsdata *p) | ||||
| } | } | ||||
| /* clear out buffer (stored in gp-data), in case something contaminated it */ | /* clear out buffer (stored in gp-data), in case something contaminated it */ | ||||
| annotation_session_validatebuffer(p); | annotation_session_validatebuffer(p); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| /* Enable the annotations in the current space. */ | |||||
| static void annotation_visible_on_space(tGPsdata *p) | |||||
| { | |||||
| ScrArea *area = p->area; | |||||
| switch (area->spacetype) { | |||||
| case SPACE_VIEW3D: { | |||||
| View3D *v3d = (View3D *)area->spacedata.first; | |||||
| v3d->flag2 |= V3D_SHOW_ANNOTATION; | |||||
| break; | |||||
| } | |||||
| case SPACE_SEQ: { | |||||
| SpaceSeq *sseq = (SpaceSeq *)area->spacedata.first; | |||||
| sseq->flag |= SEQ_SHOW_GPENCIL; | |||||
| break; | |||||
| } | |||||
| case SPACE_IMAGE: { | |||||
| SpaceImage *sima = (SpaceImage *)area->spacedata.first; | |||||
| sima->flag |= SI_SHOW_GPENCIL; | |||||
| break; | |||||
| } | |||||
| case SPACE_NODE: { | |||||
| SpaceNode *snode = (SpaceNode *)area->spacedata.first; | |||||
| snode->flag |= SNODE_SHOW_GPENCIL; | |||||
| break; | |||||
| } | |||||
| case SPACE_CLIP: { | |||||
| SpaceClip *sclip = (SpaceClip *)area->spacedata.first; | |||||
| sclip->flag |= SC_SHOW_ANNOTATION; | |||||
| break; | |||||
| } | |||||
| default: | |||||
| break; | |||||
| } | |||||
| } | |||||
| /* init new painting session */ | /* init new painting session */ | ||||
| static tGPsdata *annotation_session_initpaint(bContext *C) | static tGPsdata *annotation_session_initpaint(bContext *C) | ||||
| { | { | ||||
| tGPsdata *p = NULL; | tGPsdata *p = NULL; | ||||
| /* create new context data */ | /* create new context data */ | ||||
| p = MEM_callocN(sizeof(tGPsdata), "Annotation Drawing Data"); | p = MEM_callocN(sizeof(tGPsdata), "Annotation Drawing Data"); | ||||
| Show All 10 Lines | static tGPsdata *annotation_session_initpaint(bContext *C) | ||||
| } | } | ||||
| /* Radius for eraser circle is defined in userprefs */ | /* Radius for eraser circle is defined in userprefs */ | ||||
| /* NOTE: we do this here, so that if we exit immediately, | /* NOTE: we do this here, so that if we exit immediately, | ||||
| * erase size won't get lost | * erase size won't get lost | ||||
| */ | */ | ||||
| p->radius = U.gp_eraser; | p->radius = U.gp_eraser; | ||||
| /* Annotations must be always visible when use it. */ | |||||
| annotation_visible_on_space(p); | |||||
| /* return context data for running paint operator */ | /* return context data for running paint operator */ | ||||
| return p; | return p; | ||||
| } | } | ||||
| /* cleanup after a painting session */ | /* cleanup after a painting session */ | ||||
| static void annotation_session_cleanup(tGPsdata *p) | static void annotation_session_cleanup(tGPsdata *p) | ||||
| { | { | ||||
| bGPdata *gpd = (p) ? p->gpd : NULL; | bGPdata *gpd = (p) ? p->gpd : NULL; | ||||
| ▲ Show 20 Lines • Show All 1,395 Lines • Show Last 20 Lines | |||||