Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_primitive.c
| Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | static void gpencil_session_validatebuffer(tGPDprimitive *p) | ||||
| ED_gpencil_sbuffer_vertex_color_set(p->depsgraph, | ED_gpencil_sbuffer_vertex_color_set(p->depsgraph, | ||||
| p->ob, | p->ob, | ||||
| p->scene->toolsettings, | p->scene->toolsettings, | ||||
| p->brush, | p->brush, | ||||
| p->material, | p->material, | ||||
| p->random_settings.hsv, | p->random_settings.hsv, | ||||
| 1.0f); | 1.0f); | ||||
| /* Set the caps type. */ | |||||
| if (p->brush->gpencil_settings->caps_type != GP_STROKE_CAP_ROUND) { | |||||
| p->gpd->runtime.sbuffer_sflag |= GP_STROKE_USE_FLAT_CAPS; | |||||
| } | |||||
| else { | |||||
| p->gpd->runtime.sbuffer_sflag &= ~GP_STROKE_USE_FLAT_CAPS; | |||||
| } | |||||
| if (ELEM(p->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) { | if (ELEM(p->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) { | ||||
| gpd->runtime.sbuffer_sflag |= GP_STROKE_CYCLIC; | gpd->runtime.sbuffer_sflag |= GP_STROKE_CYCLIC; | ||||
| } | } | ||||
| } | } | ||||
| static void gpencil_init_colors(tGPDprimitive *p) | static void gpencil_init_colors(tGPDprimitive *p) | ||||
| { | { | ||||
| bGPdata *gpd = p->gpd; | bGPdata *gpd = p->gpd; | ||||
| ▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | static void gpencil_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) | ||||
| bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "Temp bGPDstroke"); | bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "Temp bGPDstroke"); | ||||
| gps->thickness = 2.0f; | gps->thickness = 2.0f; | ||||
| gps->fill_opacity_fac = 1.0f; | gps->fill_opacity_fac = 1.0f; | ||||
| gps->hardeness = 1.0f; | gps->hardeness = 1.0f; | ||||
| copy_v2_fl(gps->aspect_ratio, 1.0f); | copy_v2_fl(gps->aspect_ratio, 1.0f); | ||||
| gps->uv_scale = 1.0f; | gps->uv_scale = 1.0f; | ||||
| gps->inittime = 0.0f; | gps->inittime = 0.0f; | ||||
| /* Set stroke caps. */ | |||||
| gps->caps[0] = gps->caps[1] = brush->gpencil_settings->caps_type; | |||||
| /* Apply the vertex color to fill. */ | /* Apply the vertex color to fill. */ | ||||
| ED_gpencil_fill_vertex_color_set(ts, brush, gps); | ED_gpencil_fill_vertex_color_set(ts, brush, gps); | ||||
| gps->flag &= ~GP_STROKE_SELECT; | gps->flag &= ~GP_STROKE_SELECT; | ||||
| BKE_gpencil_stroke_select_index_reset(gps); | BKE_gpencil_stroke_select_index_reset(gps); | ||||
| /* the polygon must be closed, so enabled cyclic */ | /* the polygon must be closed, so enabled cyclic */ | ||||
| if (ELEM(tgpi->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) { | if (ELEM(tgpi->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) { | ||||
| gps->flag |= GP_STROKE_CYCLIC; | gps->flag |= GP_STROKE_CYCLIC; | ||||
| ▲ Show 20 Lines • Show All 1,795 Lines • Show Last 20 Lines | |||||