Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_convert.c
| Show First 20 Lines • Show All 1,268 Lines • ▼ Show 20 Lines | static void gp_layer_to_curve(bContext *C, | ||||
| const bool norm_weights, | const bool norm_weights, | ||||
| const float rad_fac, | const float rad_fac, | ||||
| const bool link_strokes, | const bool link_strokes, | ||||
| tGpTimingData *gtd) | tGpTimingData *gtd) | ||||
| { | { | ||||
| struct Main *bmain = CTX_data_main(C); | struct Main *bmain = CTX_data_main(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Collection *collection = CTX_data_collection(C); | Collection *collection = CTX_data_collection(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Scene *scene = CTX_data_scene(C); | ||||
| int cfra_eval = (int)DEG_get_ctime(depsgraph); | int cfra_eval = CFRA; | ||||
| bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_USE_PREV); | bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_USE_PREV); | ||||
| bGPDstroke *gps, *prev_gps = NULL; | bGPDstroke *gps, *prev_gps = NULL; | ||||
| Object *ob; | Object *ob; | ||||
| Curve *cu; | Curve *cu; | ||||
| Nurb *nu = NULL; | Nurb *nu = NULL; | ||||
| Base *base_new = NULL; | Base *base_new = NULL; | ||||
| float minmax_weights[2] = {1.0f, 0.0f}; | float minmax_weights[2] = {1.0f, 0.0f}; | ||||
| ▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | |||||
| /* --- */ | /* --- */ | ||||
| /* Check a GP layer has valid timing data! Else, most timing options are hidden in the operator. | /* Check a GP layer has valid timing data! Else, most timing options are hidden in the operator. | ||||
| * op may be NULL. | * op may be NULL. | ||||
| */ | */ | ||||
| static bool gp_convert_check_has_valid_timing(bContext *C, bGPDlayer *gpl, wmOperator *op) | static bool gp_convert_check_has_valid_timing(bContext *C, bGPDlayer *gpl, wmOperator *op) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Scene *scene = CTX_data_scene(C); | ||||
| int cfra_eval = (int)DEG_get_ctime(depsgraph); | int cfra_eval = CFRA; | ||||
| bGPDframe *gpf = NULL; | bGPDframe *gpf = NULL; | ||||
| bGPDstroke *gps = NULL; | bGPDstroke *gps = NULL; | ||||
| bGPDspoint *pt; | bGPDspoint *pt; | ||||
| double base_time, cur_time, prev_time = -1.0; | double base_time, cur_time, prev_time = -1.0; | ||||
| int i; | int i; | ||||
| bool valid = true; | bool valid = true; | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | static void gp_convert_set_end_frame(struct Main *UNUSED(main), | ||||
| if (end_frame <= start_frame) { | if (end_frame <= start_frame) { | ||||
| RNA_int_set(ptr, "end_frame", start_frame + 1); | RNA_int_set(ptr, "end_frame", start_frame + 1); | ||||
| } | } | ||||
| } | } | ||||
| static bool gp_convert_poll(bContext *C) | static bool gp_convert_poll(bContext *C) | ||||
| { | { | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Scene *scene = CTX_data_scene(C); | ||||
| int cfra_eval = (int)DEG_get_ctime(depsgraph); | int cfra_eval = CFRA; | ||||
| if ((ob == NULL) || (ob->type != OB_GPENCIL)) { | if ((ob == NULL) || (ob->type != OB_GPENCIL)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| bGPdata *gpd = (bGPdata *)ob->data; | bGPdata *gpd = (bGPdata *)ob->data; | ||||
| bGPDlayer *gpl = NULL; | bGPDlayer *gpl = NULL; | ||||
| bGPDframe *gpf = NULL; | bGPDframe *gpf = NULL; | ||||
| ▲ Show 20 Lines • Show All 281 Lines • Show Last 20 Lines | |||||