Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_convert_gpencil.c
| Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { | ||||
| for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) { | for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) { | ||||
| if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { | if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { | ||||
| LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { | LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { | ||||
| /* skip strokes that are invalid for current view */ | /* skip strokes that are invalid for current view */ | ||||
| if (ED_gpencil_stroke_can_use(C, gps) == false) { | if (ED_gpencil_stroke_can_use(C, gps) == false) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Check if the color is editable. */ | /* Check if the color is editable. */ | ||||
| if (ED_gpencil_stroke_color_use(obact, gpl, gps) == false) { | if (ED_gpencil_stroke_material_editable(obact, gpl, gps) == false) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Check if stroke has an editcurve */ | /* Check if stroke has an editcurve */ | ||||
| if (gps->editcurve == NULL) { | if (gps->editcurve == NULL) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| bGPDcurve *gpc = gps->editcurve; | bGPDcurve *gpc = gps->editcurve; | ||||
| ▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!is_multiedit) { | if (!is_multiedit) { | ||||
| init_gpf = gpf; | init_gpf = gpf; | ||||
| } | } | ||||
| } | } | ||||
| /* Calculate difference matrix. */ | /* Calculate difference matrix. */ | ||||
| BKE_gpencil_parent_matrix_get(depsgraph, obact, gpl, diff_mat); | BKE_gpencil_layer_transform_matrix_get(depsgraph, obact, gpl, diff_mat); | ||||
| copy_m3_m4(mtx, diff_mat); | copy_m3_m4(mtx, diff_mat); | ||||
| pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON); | pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON); | ||||
| for (gpf = init_gpf; gpf; gpf = gpf->next) { | for (gpf = init_gpf; gpf; gpf = gpf->next) { | ||||
| if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { | if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { | ||||
| /* If multi-frame and falloff, recalculate and save value. */ | /* If multi-frame and falloff, recalculate and save value. */ | ||||
| float falloff = 1.0f; /* by default no falloff */ | float falloff = 1.0f; /* by default no falloff */ | ||||
| if ((is_multiedit) && (use_multiframe_falloff)) { | if ((is_multiedit) && (use_multiframe_falloff)) { | ||||
| /* Falloff depends on distance to active frame | /* Falloff depends on distance to active frame | ||||
| * (relative to the overall frame range). */ | * (relative to the overall frame range). */ | ||||
| falloff = BKE_gpencil_multiframe_falloff_calc( | falloff = BKE_gpencil_multiframe_falloff_calc( | ||||
| gpf, gpl->actframe->framenum, f_init, f_end, ts->gp_sculpt.cur_falloff); | gpf, gpl->actframe->framenum, f_init, f_end, ts->gp_sculpt.cur_falloff); | ||||
| } | } | ||||
| LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { | LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { | ||||
| /* skip strokes that are invalid for current view */ | /* skip strokes that are invalid for current view */ | ||||
| if (ED_gpencil_stroke_can_use(C, gps) == false) { | if (ED_gpencil_stroke_can_use(C, gps) == false) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Check if the color is editable. */ | /* Check if the color is editable. */ | ||||
| if (ED_gpencil_stroke_color_use(obact, gpl, gps) == false) { | if (ED_gpencil_stroke_material_editable(obact, gpl, gps) == false) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Check if stroke has an editcurve */ | /* Check if stroke has an editcurve */ | ||||
| if (gps->editcurve == NULL) { | if (gps->editcurve == NULL) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| TransData *head, *tail; | TransData *head, *tail; | ||||
| head = tail = td; | head = tail = td; | ||||
| ▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { | ||||
| for (gpf = init_gpf; gpf; gpf = gpf->next) { | for (gpf = init_gpf; gpf; gpf = gpf->next) { | ||||
| if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { | if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { | ||||
| for (gps = gpf->strokes.first; gps; gps = gps->next) { | for (gps = gpf->strokes.first; gps; gps = gps->next) { | ||||
| /* skip strokes that are invalid for current view */ | /* skip strokes that are invalid for current view */ | ||||
| if (ED_gpencil_stroke_can_use(C, gps) == false) { | if (ED_gpencil_stroke_can_use(C, gps) == false) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Check if the color is editable. */ | /* Check if the color is editable. */ | ||||
| if (ED_gpencil_stroke_color_use(obact, gpl, gps) == false) { | if (ED_gpencil_stroke_material_editable(obact, gpl, gps) == false) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (is_prop_edit) { | if (is_prop_edit) { | ||||
| /* Proportional Editing... */ | /* Proportional Editing... */ | ||||
| if (is_prop_edit_connected) { | if (is_prop_edit_connected) { | ||||
| /* Connected only - so only if selected. */ | /* Connected only - so only if selected. */ | ||||
| if (gps->flag & GP_STROKE_SELECT) { | if (gps->flag & GP_STROKE_SELECT) { | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { | ||||
| int f_init = 0; | int f_init = 0; | ||||
| int f_end = 0; | int f_end = 0; | ||||
| if (use_multiframe_falloff) { | if (use_multiframe_falloff) { | ||||
| BKE_gpencil_frame_range_selected(gpl, &f_init, &f_end); | BKE_gpencil_frame_range_selected(gpl, &f_init, &f_end); | ||||
| } | } | ||||
| /* Calculate difference matrix. */ | /* Calculate difference matrix. */ | ||||
| BKE_gpencil_parent_matrix_get(depsgraph, obact, gpl, diff_mat); | BKE_gpencil_layer_transform_matrix_get(depsgraph, obact, gpl, diff_mat); | ||||
| /* Undo matrix. */ | /* Undo matrix. */ | ||||
| invert_m4_m4(inverse_diff_mat, diff_mat); | invert_m4_m4(inverse_diff_mat, diff_mat); | ||||
| /* Make a new frame to work on if the layer's frame | /* Make a new frame to work on if the layer's frame | ||||
| * and the current scene frame don't match up. | * and the current scene frame don't match up. | ||||
| * | * | ||||
| * - This is useful when animating as it saves that "uh-oh" moment when you realize you've | * - This is useful when animating as it saves that "uh-oh" moment when you realize you've | ||||
| * spent too much time editing the wrong frame... | * spent too much time editing the wrong frame... | ||||
| Show All 27 Lines | if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { | ||||
| TransData *tail = td; | TransData *tail = td; | ||||
| bool stroke_ok; | bool stroke_ok; | ||||
| /* skip strokes that are invalid for current view */ | /* skip strokes that are invalid for current view */ | ||||
| if (ED_gpencil_stroke_can_use(C, gps) == false) { | if (ED_gpencil_stroke_can_use(C, gps) == false) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* check if the color is editable */ | /* check if the color is editable */ | ||||
| if (ED_gpencil_stroke_color_use(obact, gpl, gps) == false) { | if (ED_gpencil_stroke_material_editable(obact, gpl, gps) == false) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* What we need to include depends on proportional editing settings... */ | /* What we need to include depends on proportional editing settings... */ | ||||
| if (is_prop_edit) { | if (is_prop_edit) { | ||||
| if (is_prop_edit_connected) { | if (is_prop_edit_connected) { | ||||
| /* A) "Connected" - Only those in selected strokes */ | /* A) "Connected" - Only those in selected strokes */ | ||||
| stroke_ok = (gps->flag & GP_STROKE_SELECT) != 0; | stroke_ok = (gps->flag & GP_STROKE_SELECT) != 0; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines | |||||