Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_primitive.c
| Show First 20 Lines • Show All 299 Lines • ▼ Show 20 Lines | static void gpencil_primitive_allocate_memory(tGPDprimitive *tgpi) | ||||
| tgpi->points = MEM_reallocN(tgpi->points, sizeof(tGPspoint) * tgpi->point_count); | tgpi->points = MEM_reallocN(tgpi->points, sizeof(tGPspoint) * tgpi->point_count); | ||||
| } | } | ||||
| /* ****************** Primitive Interactive *********************** */ | /* ****************** Primitive Interactive *********************** */ | ||||
| /* Helper: Create internal strokes primitives data */ | /* Helper: Create internal strokes primitives data */ | ||||
| static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) | static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Scene *scene = CTX_data_scene(C); | ||||
| int cfra_eval = (int)DEG_get_ctime(depsgraph); | int cfra_eval = CFRA; | ||||
| bGPDlayer *gpl = CTX_data_active_gpencil_layer(C); | bGPDlayer *gpl = CTX_data_active_gpencil_layer(C); | ||||
| /* if layer doesn't exist, create a new one */ | /* if layer doesn't exist, create a new one */ | ||||
| if (gpl == NULL) { | if (gpl == NULL) { | ||||
| gpl = BKE_gpencil_layer_addnew(tgpi->gpd, DATA_("Primitives"), true); | gpl = BKE_gpencil_layer_addnew(tgpi->gpd, DATA_("Primitives"), true); | ||||
| } | } | ||||
| tgpi->gpl = gpl; | tgpi->gpl = gpl; | ||||
| ▲ Show 20 Lines • Show All 773 Lines • ▼ Show 20 Lines | |||||
| /* Init new temporary primitive data */ | /* Init new temporary primitive data */ | ||||
| static void gpencil_primitive_init(bContext *C, wmOperator *op) | static void gpencil_primitive_init(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| ToolSettings *ts = CTX_data_tool_settings(C); | ToolSettings *ts = CTX_data_tool_settings(C); | ||||
| bGPdata *gpd = CTX_data_gpencil_data(C); | bGPdata *gpd = CTX_data_gpencil_data(C); | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | |||||
| Paint *paint = &ts->gp_paint->paint; | Paint *paint = &ts->gp_paint->paint; | ||||
| int cfra_eval = (int)DEG_get_ctime(depsgraph); | int cfra_eval = CFRA; | ||||
| /* create temporary operator data */ | /* create temporary operator data */ | ||||
| tGPDprimitive *tgpi = MEM_callocN(sizeof(tGPDprimitive), "GPencil Primitive Data"); | tGPDprimitive *tgpi = MEM_callocN(sizeof(tGPDprimitive), "GPencil Primitive Data"); | ||||
| op->customdata = tgpi; | op->customdata = tgpi; | ||||
| tgpi->points = MEM_callocN(sizeof(tGPspoint), "gp primitive points2D"); | tgpi->points = MEM_callocN(sizeof(tGPspoint), "gp primitive points2D"); | ||||
| /* set current scene and window info */ | /* set current scene and window info */ | ||||
| ▲ Show 20 Lines • Show All 719 Lines • Show Last 20 Lines | |||||