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,
137 const MutableDrawingInfo &info = drawings[i];
138 const AutoMaskingInfo &auto_mask_info = this->auto_masking_info_per_drawing[i];
139 BLI_assert(info.layer_index >= 0);
140 PointWeights &data = this->drawing_data[i];
142 const bke::greasepencil::Layer &layer = grease_pencil.layer(info.layer_index);
143 BLI_assert(grease_pencil.get_drawing_at(layer, info.frame_number) == &info.drawing);
145 GreasePencilStrokeParams params = {*scene.toolsettings,
154 info.multi_frame_falloff,
165 info.multi_frame_falloff,
166 auto_mask_info.point_mask,
171 if (point_mask.is_empty()) {
173 data.point_mask = {};
176 data.layer_index = info.layer_index;
177 data.frame_number = info.frame_number;
178 data.multi_frame_falloff = info.multi_frame_falloff;
180 layer.to_object_space(ob_eval);
181 data.point_mask = std::move(point_mask);
182 data.weights = std::move(weights);
200 mask.foreach_index(
GrainSize(4096), [&](
const int point_i,
const int index) {
203 projection_fn, deformation, point_i, mouse_delta_win * weights[index]);
206 params.drawing.tag_positions_changed();
214 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)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
BMesh const char void * data
BPy_StructRNA * depsgraph
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
GreasePencilStrokeOperationCommon()=default
void on_stroke_done(const bContext &) override
blender::ed::greasepencil::MutableDrawingInfo MutableDrawingInfo
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)
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 > calculate_view_positions(const GreasePencilStrokeParams ¶ms, const IndexMask &selection)
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
void parallel_for_each(Range &&range, const Function &function)
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
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)