31#include "RNA_prototypes.hh"
86 for (
int i = 0; i <
len; i++) {
98 const int start_frame_number,
132 seed += start_frame_number;
140 auto get_weight = [&](
const IndexRange points,
const int point_i) {
141 const float vertex_weight = vgroup_weights[points[point_i]];
143 return vertex_weight;
145 const float value =
float(point_i) /
float(points.size() - 1);
161 const IndexRange points = points_by_curve[stroke_i];
162 const int noise_len =
math::ceil(points.size() * noise_scale) + 2;
165 for (
const int i : points.index_range()) {
166 const int point = points[i];
167 float weight = get_weight(points, i);
170 math::cross(tangents[point], curve_plane_normals[stroke_i]));
172 positions[
point] += bi_normal * (noise * 2.0f - 1.0f) * weight * mmd.
factor * 0.1f;
182 const IndexRange points = points_by_curve[stroke_i];
183 const int noise_len =
math::ceil(points.size() * noise_scale) + 2;
186 for (
const int i : points.index_range()) {
187 const int point = points[i];
188 const float weight = get_weight(points, i);
200 const IndexRange points = points_by_curve[stroke_i];
201 const int noise_len =
math::ceil(points.size() * noise_scale) + 2;
204 for (
const int i : points.index_range()) {
205 const int point = points[i];
206 const float weight = get_weight(points, i);
218 const IndexRange points = points_by_curve[stroke_i];
219 const int noise_len =
math::ceil(points.size() * noise_scale) + 2;
222 for (
const int i : points.index_range()) {
223 const int point = points[i];
224 const float weight = get_weight(points, i);
226 const float delta_rot = (noise * 2.0f - 1.0f) * weight * mmd.
factor_uvs *
M_PI_2;
245 if (!mmd->factor && !mmd->factor_strength && !mmd->factor_thickness && !mmd->factor_uvs) {
250 const int current_frame = grease_pencil.
runtime->eval_frame;
254 grease_pencil, mmd->influence, mask_memory);
290 C, layout,
ptr,
"open_random_panel",
IFACE_(
"Random")))
307 C, layout,
ptr,
"open_influence_panel",
IFACE_(
"Influence")))
326 "GreasePencilNoiseModifier",
328 "GreasePencilNoiseModifierData",
330 &RNA_GreasePencilNoiseModifier,
Low-level operations for curves.
Low-level operations for grease pencil.
void BKE_modifier_copydata_generic(const ModifierData *md, ModifierData *md_dst, int flag)
@ eModifierTypeFlag_AcceptsGreasePencil
@ eModifierTypeFlag_EnableInEditmode
@ eModifierTypeFlag_SupportsEditmode
void(*)(void *user_data, Object *ob, ID **idpoin, int cb_flag) IDWalkFunc
BLI_INLINE float BLI_hash_int_01(unsigned int k)
BLI_INLINE unsigned int BLI_hash_string(const char *str)
BLI_INLINE unsigned int BLI_hash_int_2d(unsigned int kx, unsigned int ky)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define DNA_struct_default_get(struct_name)
@ GP_NOISE_RANDOM_KEYFRAME
@ GREASE_PENCIL_INFLUENCE_USE_CUSTOM_CURVE
@ eModifierType_GreasePencilNoise
struct GreasePencilNoiseModifierData GreasePencilNoiseModifierData
ModifierTypeInfo modifierType_GreasePencilNoise
void modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
void uiLayoutSetActive(uiLayout *layout, bool active)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
PanelLayout uiLayoutPanelProp(const bContext *C, uiLayout *layout, PointerRNA *open_prop_owner, const char *open_prop_name)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
static unsigned long seed
MutableSpan< float3 > positions_for_write()
OffsetIndices< int > points_by_curve() const
MutableAttributeAccessor attributes_for_write()
Span< float3 > evaluated_tangents() const
Span< float3 > curve_plane_normals() const
MutableSpan< float > opacities_for_write()
MutableSpan< float > radii_for_write()
bke::CurvesGeometry & strokes_for_write()
void tag_positions_changed()
void foreach_index(Fn &&fn) const
draw_view in_light_buf[] float
T clamp(const T &a, const T &min, const T &max)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
T interpolate(const T &a, const T &b, const FactorT &t)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
T max(const T &a, const T &b)
void read_influence_data(BlendDataReader *reader, GreasePencilModifierInfluenceData *influence_data)
void init_influence_data(GreasePencilModifierInfluenceData *influence_data, const bool has_custom_curve)
Vector< FrameDrawingInfo > get_drawing_infos_by_frame(GreasePencil &grease_pencil, const IndexMask &layer_mask, const int frame)
static IndexMask get_filtered_layer_mask(const GreasePencil &grease_pencil, const std::optional< StringRef > layer_name_filter, const std::optional< int > layer_pass_filter, const bool layer_filter_invert, const bool layer_pass_filter_invert, IndexMaskMemory &memory)
static IndexMask get_filtered_stroke_mask(const Object *ob, const bke::CurvesGeometry &curves, const Material *material_filter, const std::optional< int > material_pass_filter, const bool material_filter_invert, const bool material_pass_filter_invert, IndexMaskMemory &memory)
void write_influence_data(BlendWriter *writer, const GreasePencilModifierInfluenceData *influence_data)
void draw_vertex_group_settings(const bContext *, uiLayout *layout, PointerRNA *ptr)
VArray< float > get_influence_vertex_weights(const bke::CurvesGeometry &curves, const GreasePencilModifierInfluenceData &influence_data)
void draw_material_filter_settings(const bContext *, uiLayout *layout, PointerRNA *ptr)
void draw_layer_filter_settings(const bContext *, uiLayout *layout, PointerRNA *ptr)
void draw_custom_curve_settings(const bContext *, uiLayout *layout, PointerRNA *ptr)
void free_influence_data(GreasePencilModifierInfluenceData *influence_data)
void foreach_influence_ID_link(GreasePencilModifierInfluenceData *influence_data, Object *ob, IDWalkFunc walk, void *user_data)
void copy_influence_data(const GreasePencilModifierInfluenceData *influence_data_src, GreasePencilModifierInfluenceData *influence_data_dst, const int)
void ensure_no_bezier_curves(Drawing &drawing)
void parallel_for_each(Range &&range, const Function &function)
static bool depends_on_time(Scene *, ModifierData *md)
static void copy_data(const ModifierData *md, ModifierData *target, const int flag)
static void blend_write(BlendWriter *writer, const ID *, const ModifierData *md)
static void init_data(ModifierData *md)
static void foreach_ID_link(ModifierData *md, Object *ob, IDWalkFunc walk, void *user_data)
static void panel_draw(const bContext *C, Panel *panel)
static void modify_geometry_set(ModifierData *md, const ModifierEvalContext *ctx, bke::GeometrySet *geometry_set)
static void deform_drawing(const ModifierData &md, const Object &ob, bke::greasepencil::Drawing &drawing)
static void free_data(ModifierData *md)
static void panel_register(ARegionType *region_type)
static void blend_read(BlendDataReader *reader, ModifierData *md)
static Array< float > noise_table(int len, int offset, int seed)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
struct CurveMapping * custom_curve
GreasePencilModifierInfluenceData influence
GreasePencilRuntimeHandle * runtime
bool has_grease_pencil() const
GreasePencil * get_grease_pencil_for_write()
MutableVArraySpan< T > span
bke::greasepencil::Drawing * drawing