Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_paint.c
| Show First 20 Lines • Show All 990 Lines • ▼ Show 20 Lines | static void gpencil_stroke_newfrombuffer(tGPsdata *p) | ||||
| gps->thickness = brush->size; | gps->thickness = brush->size; | ||||
| gps->fill_opacity_fac = 1.0f; | gps->fill_opacity_fac = 1.0f; | ||||
| gps->hardeness = brush->gpencil_settings->hardeness; | gps->hardeness = brush->gpencil_settings->hardeness; | ||||
| copy_v2_v2(gps->aspect_ratio, brush->gpencil_settings->aspect_ratio); | copy_v2_v2(gps->aspect_ratio, brush->gpencil_settings->aspect_ratio); | ||||
| gps->flag = gpd->runtime.sbuffer_sflag; | gps->flag = gpd->runtime.sbuffer_sflag; | ||||
| gps->inittime = p->inittime; | gps->inittime = p->inittime; | ||||
| gps->uv_scale = 1.0f; | gps->uv_scale = 1.0f; | ||||
| /* Disable temp caps flag. */ | |||||
| gps->flag &= ~GP_STROKE_USE_FLAT_CAPS; | |||||
| /* Set stroke caps. */ | |||||
| if (brush->gpencil_settings->caps_type == GP_BRUSH_CAPS_ROUNDED) { | |||||
| gps->caps[0] = gps->caps[1] = GP_STROKE_CAP_ROUND; | |||||
| } | |||||
| else { | |||||
| gps->caps[0] = gps->caps[1] = GP_STROKE_CAP_FLAT; | |||||
| } | |||||
| /* allocate enough memory for a continuous array for storage points */ | /* allocate enough memory for a continuous array for storage points */ | ||||
| const int subdivide = brush->gpencil_settings->draw_subdivide; | const int subdivide = brush->gpencil_settings->draw_subdivide; | ||||
| gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); | gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); | ||||
| gps->dvert = NULL; | gps->dvert = NULL; | ||||
| /* drawing batch cache is dirty now */ | /* drawing batch cache is dirty now */ | ||||
| gpencil_update_cache(p->gpd); | gpencil_update_cache(p->gpd); | ||||
| ▲ Show 20 Lines • Show All 1,240 Lines • ▼ Show 20 Lines | else { | ||||
| p->gpd->runtime.sbuffer_sflag &= ~GP_STROKE_ERASER; | p->gpd->runtime.sbuffer_sflag &= ~GP_STROKE_ERASER; | ||||
| } | } | ||||
| /* set special fill stroke mode */ | /* set special fill stroke mode */ | ||||
| if (p->disable_fill == true) { | if (p->disable_fill == true) { | ||||
| p->gpd->runtime.sbuffer_sflag |= GP_STROKE_NOFILL; | p->gpd->runtime.sbuffer_sflag |= GP_STROKE_NOFILL; | ||||
| } | } | ||||
| /* Set the caps type. */ | |||||
| if (p->brush->gpencil_settings->caps_type != GP_BRUSH_CAPS_ROUNDED) { | |||||
| p->gpd->runtime.sbuffer_sflag |= GP_STROKE_USE_FLAT_CAPS; | |||||
| } | |||||
| else { | |||||
| p->gpd->runtime.sbuffer_sflag &= ~GP_STROKE_USE_FLAT_CAPS; | |||||
| } | |||||
| /* set 'initial run' flag, which is only used to denote when a new stroke is starting */ | /* set 'initial run' flag, which is only used to denote when a new stroke is starting */ | ||||
| p->flags |= GP_PAINTFLAG_FIRSTRUN; | p->flags |= GP_PAINTFLAG_FIRSTRUN; | ||||
| /* when drawing in the camera view, in 2D space, set the subrect */ | /* when drawing in the camera view, in 2D space, set the subrect */ | ||||
| p->subrect = NULL; | p->subrect = NULL; | ||||
| if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) { | if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) { | ||||
| if (p->area->spacetype == SPACE_VIEW3D) { | if (p->area->spacetype == SPACE_VIEW3D) { | ||||
| View3D *v3d = p->area->spacedata.first; | View3D *v3d = p->area->spacedata.first; | ||||
| ▲ Show 20 Lines • Show All 1,772 Lines • Show Last 20 Lines | |||||