Fix: GPv3: Interpolate tool uses selection in paint mode

Follow-up fix for #128769.

Selection is now taken into account for interpolation tool, but should
be ignored in paint mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/129150
This commit is contained in:
Lukas Tönne
2024-10-17 14:09:48 +02:00
committed by Falk David
parent a80bb83bff
commit d2210df6af
2 changed files with 18 additions and 14 deletions

View File

@@ -3774,9 +3774,11 @@ def km_grease_pencil_paint_mode(params):
"ctrl": True, "shift": True}, {"properties": [("mode", 'ACTIVE')]}),
op_tool_optional(
("grease_pencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True}, None),
("grease_pencil.interpolate", {"type": 'E', "value": 'PRESS',
"ctrl": True}, {"properties": [("use_selection", False)]}),
(op_tool_cycle, "builtin.interpolate"), params),
("grease_pencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None),
("grease_pencil.interpolate_sequence", {"type": 'E', "value": 'PRESS',
"shift": True, "ctrl": True}, None),
op_asset_shelf_popup(
"VIEW3D_AST_brush_gpencil_paint",
@@ -3932,9 +3934,11 @@ def km_grease_pencil_edit_mode(params):
("grease_pencil.set_handle_type", {"type": 'V', "value": 'PRESS'}, None),
op_tool_optional(
("grease_pencil.interpolate", {"type": 'E', "value": 'PRESS', "ctrl": True}, None),
("grease_pencil.interpolate", {"type": 'E', "value": 'PRESS',
"ctrl": True}, {"properties": [("use_selection", True)]}),
(op_tool_cycle, "builtin.interpolate"), params),
("grease_pencil.interpolate_sequence", {"type": 'E', "value": 'PRESS', "shift": True, "ctrl": True}, None),
("grease_pencil.interpolate_sequence", {"type": 'E', "value": 'PRESS',
"shift": True, "ctrl": True}, None),
])
return keymap
@@ -8133,7 +8137,7 @@ def km_3d_view_tool_edit_grease_pencil_interpolate(params):
{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
{"items": [
("grease_pencil.interpolate", params.tool_maybe_tweak_event,
None),
{"properties": [("use_selection", True)]}),
]},
)
@@ -8144,7 +8148,7 @@ def km_3d_view_tool_paint_grease_pencil_interpolate(params):
{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
{"items": [
("grease_pencil.interpolate", params.tool_maybe_tweak_event,
None),
{"properties": [("use_selection", False)]}),
]},
)

View File

@@ -308,6 +308,7 @@ InterpolateOpData *InterpolateOpData::from_operator(const bContext &C, const wmO
data->smooth_factor = RNA_float_get(op.ptr, "smooth_factor");
data->smooth_steps = RNA_int_get(op.ptr, "smooth_steps");
data->active_layer_index = *grease_pencil.get_layer_index(active_layer);
const bool use_selection = RNA_boolean_get(op.ptr, "use_selection");
const auto layer_mode = InterpolateLayerMode(RNA_enum_get(op.ptr, "layers"));
switch (layer_mode) {
@@ -329,12 +330,11 @@ InterpolateOpData *InterpolateOpData::from_operator(const bContext &C, const wmO
InterpolateOpData::LayerData &layer_data = data->layer_data[layer_index];
/* Pair from/to curves by index. */
const bool only_selected = true;
find_curve_mapping_from_index(grease_pencil,
layer,
current_frame,
data->exclude_breakdowns,
only_selected,
use_selection,
layer_data.curve_pairs);
});
@@ -906,6 +906,12 @@ static void GREASE_PENCIL_OT_interpolate(wmOperatorType *ot)
"Exclude Breakdowns",
"Exclude existing Breakdowns keyframes as interpolation extremes");
RNA_def_boolean(ot->srna,
"use_selection",
false,
"Use Selection",
"Use only selected strokes for interpolating");
RNA_def_enum(ot->srna,
"flip",
grease_pencil_interpolate_flip_mode_items,
@@ -1280,12 +1286,6 @@ static void GREASE_PENCIL_OT_interpolate_sequence(wmOperatorType *ot)
"Layer",
"Layers included in the interpolation");
RNA_def_boolean(ot->srna,
"interpolate_selected_only",
false,
"Only Selected",
"Interpolate only selected strokes");
RNA_def_boolean(ot->srna,
"exclude_breakdowns",
false,