Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_primitive.c
| Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) | ||||
| gps->flag &= ~GP_STROKE_SELECT; | gps->flag &= ~GP_STROKE_SELECT; | ||||
| /* 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; | ||||
| } | } | ||||
| gps->flag |= GP_STROKE_3DSPACE; | gps->flag |= GP_STROKE_3DSPACE; | ||||
| gps->mat_nr = BKE_gpencil_object_material_get_index(tgpi->ob, tgpi->mat); | gps->mat_nr = BKE_gpencil_object_material_get_index_from_brush(tgpi->ob, tgpi->brush); | ||||
| if (gps->mat_nr < 0) { | |||||
| if (tgpi->ob->actcol - 1 < 0) { | |||||
| gps->mat_nr = 0; | |||||
| } | |||||
| else { | |||||
| gps->mat_nr = tgpi->ob->actcol - 1; | |||||
| } | |||||
| } | |||||
| /* allocate memory for storage points, but keep empty */ | /* allocate memory for storage points, but keep empty */ | ||||
| gps->totpoints = 0; | gps->totpoints = 0; | ||||
| gps->points = MEM_callocN(sizeof(bGPDspoint), "gp_stroke_points"); | gps->points = MEM_callocN(sizeof(bGPDspoint), "gp_stroke_points"); | ||||
| /* initialize triangle memory to dummy data */ | /* initialize triangle memory to dummy data */ | ||||
| gps->tot_triangles = 0; | gps->tot_triangles = 0; | ||||
| gps->triangles = NULL; | gps->triangles = NULL; | ||||
| gps->flag |= GP_STROKE_RECALC_GEOMETRY; | gps->flag |= GP_STROKE_RECALC_GEOMETRY; | ||||
| ▲ Show 20 Lines • Show All 1,488 Lines • Show Last 20 Lines | |||||