Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_convert_gpencil.c
| Show First 20 Lines • Show All 666 Lines • ▼ Show 20 Lines | if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { | ||||
| if (!is_multiedit) { | if (!is_multiedit) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void createTransGPencil(bContext *C, TransInfo *t) | static void createTransGPencil(bContext *C, TransInfo *t) | ||||
| { | { | ||||
| if (t->data_container_len == 0) { | if (t->data_container_len == 0) { | ||||
| return; | return; | ||||
| } | } | ||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| const Scene *scene = CTX_data_scene(C); | const Scene *scene = CTX_data_scene(C); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | createTransGPencil_strokes(C, | ||||
| is_multiedit, | is_multiedit, | ||||
| use_multiframe_falloff, | use_multiframe_falloff, | ||||
| is_prop_edit, | is_prop_edit, | ||||
| is_prop_edit_connected, | is_prop_edit_connected, | ||||
| is_scale_thickness); | is_scale_thickness); | ||||
| } | } | ||||
| } | } | ||||
| void recalcData_gpencil_strokes(TransInfo *t) | static void recalcData_gpencil_strokes(TransInfo *t) | ||||
| { | { | ||||
| TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); | TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); | ||||
| GHash *strokes = BLI_ghash_ptr_new(__func__); | GHash *strokes = BLI_ghash_ptr_new(__func__); | ||||
| TransData *td = tc->data; | TransData *td = tc->data; | ||||
| bGPdata *gpd = td->ob->data; | bGPdata *gpd = td->ob->data; | ||||
| const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd); | const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd); | ||||
| for (int i = 0; i < tc->data_len; i++, td++) { | for (int i = 0; i < tc->data_len; i++, td++) { | ||||
| bGPDstroke *gps = td->extra; | bGPDstroke *gps = td->extra; | ||||
| if ((gps != NULL) && (!BLI_ghash_haskey(strokes, gps))) { | if ((gps != NULL) && (!BLI_ghash_haskey(strokes, gps))) { | ||||
| BLI_ghash_insert(strokes, gps, gps); | BLI_ghash_insert(strokes, gps, gps); | ||||
| if (is_curve_edit && gps->editcurve != NULL) { | if (is_curve_edit && gps->editcurve != NULL) { | ||||
| BKE_gpencil_editcurve_recalculate_handles(gps); | BKE_gpencil_editcurve_recalculate_handles(gps); | ||||
| gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; | gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; | ||||
| } | } | ||||
| /* Calc geometry data. */ | /* Calc geometry data. */ | ||||
| BKE_gpencil_stroke_geometry_update(gpd, gps); | BKE_gpencil_stroke_geometry_update(gpd, gps); | ||||
| } | } | ||||
| } | } | ||||
| BLI_ghash_free(strokes, NULL, NULL); | BLI_ghash_free(strokes, NULL, NULL); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| TransConvertTypeInfo TransConvertType_GPencil = { | |||||
| /* flags */ (T_EDIT | T_POINTS), | |||||
| /* createTransData */ createTransGPencil, | |||||
| /* recalcData */ recalcData_gpencil_strokes, | |||||
| /* special_aftertrans_update */ NULL, | |||||
| }; | |||||