84 const PointWeights &data = this->drawing_data[i];
85 if (data.point_mask.is_empty()) {
88 const Layer &layer = grease_pencil.layer(data.layer_index);
91 if (drawing ==
nullptr) {
103 data.multi_frame_falloff,
106 if (fn(
params, projection_fn, data.point_mask, data.weights)) {
139 const MutableDrawingInfo &info = drawings[i];
140 BLI_assert(info.layer_index >= 0);
141 PointWeights &data = this->drawing_data[i];
143 const bke::greasepencil::Layer &layer = grease_pencil.layer(info.layer_index);
144 BLI_assert(grease_pencil.get_drawing_at(layer, info.frame_number) == &info.drawing);
146 GreasePencilStrokeParams params = {*scene.toolsettings,
155 info.multi_frame_falloff,
168 info.multi_frame_falloff,
176 data.point_mask = {};
179 data.layer_index = info.layer_index;
180 data.frame_number = info.frame_number;
181 data.multi_frame_falloff = info.multi_frame_falloff;
183 layer.to_object_space(ob_eval);
184 data.point_mask = std::move(point_mask);
185 data.weights = std::move(weights);
191 this->foreach_grabbed_drawing(
198 const float2 mouse_delta_win = this->mouse_delta(extension_sample);
203 mask.foreach_index(
GrainSize(4096), [&](
const int point_i,
const int index) {
205 positions[point_i] = projection_fn(deformation.positions[point_i],
206 mouse_delta_win * weights[index]);
209 params.drawing.tag_positions_changed();
212 this->stroke_extended(extension_sample);
217 return std::make_unique<GrabOperation>(stroke_mode);
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
Low-level operations for curves.
Low-level operations for grease pencil.
Paint * BKE_paint_get_active_from_context(const bContext *C)
Brush * BKE_paint_brush(Paint *paint)
void DEG_id_tag_update(ID *id, unsigned int flags)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
#define GPENCIL_ANY_SCULPT_MASK(flag)
eGP_Sculpt_SelectMaskFlag
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
IndexRange index_range() const
void reinitialize(const int64_t new_size)
IndexRange index_range() const
void foreach_grabbed_drawing(const bContext &C, FunctionRef< bool(const GreasePencilStrokeParams ¶ms, const DeltaProjectionFunc &projection_fn, const IndexMask &mask, Span< float > weights)> fn) const
void on_stroke_done(const bContext &) override
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
GreasePencilStrokeOperationCommon()
const Depsgraph * depsgraph
std::unique_ptr< GreasePencilStrokeOperation > new_grab_operation(BrushStrokeMode stroke_mode)
Vector< ed::greasepencil::MutableDrawingInfo > get_drawings_for_painting(const bContext &C)
void init_brush(Brush &brush)
IndexMask point_selection_mask(const GreasePencilStrokeParams ¶ms, const bool use_masking, IndexMaskMemory &memory)
Array< float2 > calculate_view_positions(const GreasePencilStrokeParams ¶ms, const IndexMask &selection)
IndexMask brush_point_influence_mask(const Scene &scene, 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)
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)
std::function< float3(const float3 position, const float2 &screen_delta)> DeltaProjectionFunc
void parallel_for_each(Range &&range, const Function &function)
float multi_frame_falloff
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)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)