96 const PointWeights &data = this->drawing_data[i];
97 if (data.point_mask.is_empty()) {
103 if (drawing ==
nullptr) {
115 data.multi_frame_falloff,
121 data.point_mask_left,
122 data.point_mask_right,
157 const MutableDrawingInfo &info = drawings[i];
158 const AutoMaskingInfo &auto_mask_info = this->auto_masking_info_per_drawing[i];
159 BLI_assert(info.layer_index >= 0);
160 PointWeights &data = this->drawing_data[i];
162 const bke::greasepencil::Layer &layer = grease_pencil.layer(info.layer_index);
163 BLI_assert(grease_pencil.get_drawing_at(layer, info.frame_number) == &info.drawing);
165 GreasePencilStrokeParams params = {*scene.toolsettings,
174 info.multi_frame_falloff,
178 auto_mask_info.point_mask);
180 params, auto_mask_info.point_mask);
182 params, auto_mask_info.point_mask);
192 info.multi_frame_falloff,
193 auto_mask_info.point_mask,
201 info.multi_frame_falloff,
202 auto_mask_info.point_mask,
210 info.multi_frame_falloff,
211 auto_mask_info.point_mask,
212 view_positions_right,
216 if (point_mask.is_empty()) {
218 data.point_mask = {};
221 data.layer_index = info.layer_index;
222 data.frame_number = info.frame_number;
223 data.multi_frame_falloff = info.multi_frame_falloff;
225 layer.to_object_space(ob_eval);
226 data.point_mask = std::move(point_mask);
227 data.point_mask_left = std::move(point_mask_left);
228 data.point_mask_right = std::move(point_mask_right);
229 data.weights = std::move(weights);
230 data.weights_left = std::move(weights_left);
231 data.weights_right = std::move(weights_right);
254 [&](
const int point_i,
const int index) {
257 projection_fn, deformation, point_i, mouse_delta_win * weights[
index]);
268 projection_fn, deformation, point_i, mouse_delta_win * weights_left[
index]);
274 projection_fn, deformation, point_i, mouse_delta_win * weights_right[
index]);
278 curves.calculate_bezier_auto_handles();
279 curves.calculate_bezier_aligned_handles();
290 return std::make_unique<GrabOperation>(stroke_mode);
Low-level operations for curves.
Low-level operations for grease pencil.
IndexRange index_range() const
void reinitialize(const int64_t new_size)
IndexRange index_range() const
bke::CurvesGeometry & strokes_for_write()
void tag_positions_changed()
GreasePencilStrokeOperationCommon()=default
ed::greasepencil::MutableDrawingInfo MutableDrawingInfo
void on_stroke_done(const bContext &) override
void foreach_grabbed_drawing(const bContext &C, FunctionRef< bool(const GreasePencilStrokeParams ¶ms, const DeltaProjectionFunc &projection_fn, const IndexMask &mask, const IndexMask &mask_left, const IndexMask &mask_right, Span< float > weights, Span< float > weights_left, Span< float > weights_right)> fn) const
Array< PointWeights > drawing_data
void on_stroke_begin(const bContext &C, const InputSample &start_sample) override
void on_stroke_extended(const bContext &C, const InputSample &extension_sample) override
float2 prev_mouse_position
GreasePencilStrokeOperationCommon()=default
float2 mouse_delta(const InputSample &input_sample) const
void stroke_extended(const InputSample &extension_sample)
void init_auto_masking(const bContext &C, const InputSample &start_sample)
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
Array< float2 > view_positions_left_from_point_mask(const GreasePencilStrokeParams ¶ms, const IndexMask &selection)
Array< float2 > view_positions_right_from_point_mask(const GreasePencilStrokeParams ¶ms, const IndexMask &selection)
std::unique_ptr< GreasePencilStrokeOperation > new_grab_operation(BrushStrokeMode stroke_mode)
void init_brush(Brush &brush)
IndexMask brush_point_influence_mask(const Paint &paint, const Brush &brush, const float2 &mouse_position, float pressure, float multi_frame_falloff, const IndexMask &selection, Span< float2 > view_positions, Vector< float > &influences, IndexMaskMemory &memory)
Array< float2 > view_positions_from_point_mask(const GreasePencilStrokeParams ¶ms, const IndexMask &point_mask)
Vector< ed::greasepencil::MutableDrawingInfo > get_drawings_with_masking_for_stroke_operation(const bContext &C)
bke::crazyspace::GeometryDeformation get_drawing_deformation(const GreasePencilStrokeParams ¶ms)
DeltaProjectionFunc get_screen_projection_fn(const GreasePencilStrokeParams ¶ms, const Object &object, const bke::greasepencil::Layer &layer)
float3 compute_orig_delta(const DeltaProjectionFunc &projection_fn, const bke::crazyspace::GeometryDeformation &deformation, int index, const float2 &screen_delta)
std::function< float3(const float3 position, const float2 &screen_delta)> DeltaProjectionFunc
constexpr ParallelGrainSize grain_size(int grain_size)
void parallel_for_each(Range &&range, const Function &function)
float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
void DEG_id_tag_update(ID *id, unsigned int flags)
BMesh const char void * data
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
Paint * BKE_paint_get_active_from_context(const bContext *C)
Brush * BKE_paint_brush(Paint *paint)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
Vector< float > weights_left
IndexMask point_mask_left
float multi_frame_falloff
Vector< float > weights_right
IndexMask point_mask_right
static GreasePencilStrokeParams from_context(const Scene &scene, Depsgraph &depsgraph, ARegion ®ion, RegionView3D &rv3d, Object &object, int layer_index, int frame_number, float multi_frame_falloff, bke::greasepencil::Drawing &drawing)
bke::greasepencil::Drawing & drawing