GPv3: Thickness modifier #117631
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117631
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChengduLittleA/blender:gp3-mod-thickness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Thickness modifier ported to Grease Pencil v3.
Note: Uniform thickness range and UI step changed to better match new thickness of blender unit.
Some cleanup comments
@ -8132,0 +8174,4 @@
RNA_def_property_ui_text(prop, "Weighted", "Use weight to modulate effect");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "use_normalized_thickness", PROP_BOOLEAN, PROP_NONE);
Should be named
use_uniform_thickness
.@ -0,0 +110,4 @@
const VArray<float> vgroup_weights =
attributes
.lookup_or_default<float>(mmd.influence.vertex_group_name, bke::AttrDomain::Point, 1.0f)
.varray;
Instead of using
.varray
you can do= *attributes.lookup_or_default<float>(...);
@ -0,0 +111,4 @@
attributes
.lookup_or_default<float>(mmd.influence.vertex_group_name, bke::AttrDomain::Point, 1.0f)
.varray;
const bool is_normalized = (mmd.flag & MOD_GREASE_PENCIL_THICK_NORMALIZE);
Use
(...) != 0;
@ -0,0 +112,4 @@
.lookup_or_default<float>(mmd.influence.vertex_group_name, bke::AttrDomain::Point, 1.0f)
.varray;
const bool is_normalized = (mmd.flag & MOD_GREASE_PENCIL_THICK_NORMALIZE);
bool is_inverted = ((mmd.flag & MOD_GREASE_PENCIL_THICK_WEIGHT_FACTOR) == 0) &&
Use
const
@ -0,0 +115,4 @@
bool is_inverted = ((mmd.flag & MOD_GREASE_PENCIL_THICK_WEIGHT_FACTOR) == 0) &&
((mmd.influence.flag & GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP) != 0);
for (const int curve : curves.curves_range()) {
We're only writing to the radii, so this should be a
threading::parallel_for
loop over the curves range.@ -0,0 +118,4 @@
for (const int curve : curves.curves_range()) {
for (const int local_point : points_by_curve[curve].index_range()) {
const int point = local_point + points_by_curve[curve].first();
float weight = vgroup_weights[point];
Use
const
@ -0,0 +125,4 @@
if ((!is_normalized) && (mmd.flag & MOD_GREASE_PENCIL_THICK_WEIGHT_FACTOR)) {
radii[point] *= (is_inverted ? 1.0f - weight : weight);
if (radii[point] < 0.0f) {
Use
math::clamp
instead of the if here@ -0,0 +131,4 @@
continue;
}
float curvef = 1.0f;
You can use a lambda here to make this variable
const
. Maybe a better name would beinfluence
too.@ -0,0 +140,4 @@
curvef = BKE_curvemapping_evaluateF(mmd.influence.custom_curve, 0, value);
}
float target;
Same as above
@ -0,0 +150,4 @@
weight *= curvef;
}
float radius = math::interpolate(radii[point], target, weight * curvef);
Use
const
@ -0,0 +151,4 @@
}
float radius = math::interpolate(radii[point], target, weight * curvef);
if (radius < 0.0f) {
Use
math::clamp
instead of the if here@ -8230,0 +8244,4 @@
rna_def_modifier_grease_pencil_layer_filter(srna);
rna_def_modifier_grease_pencil_material_filter(
srna, "rna_GreasePencilSmoothModifier_material_filter_set");
rna_GreasePencilThickModifier_material_filter_set
and also need to include the macro for expansion:RNA_MOD_GREASE_PENCIL_MATERIAL_FILTER_SET
@ -8230,0 +8246,4 @@
rna_def_modifier_grease_pencil_material_filter(
srna, "rna_GreasePencilSmoothModifier_material_filter_set");
rna_def_modifier_grease_pencil_vertex_group(
srna, "rna_GreasePencilSmoothModifier_vertex_group_name_set");
same as above :)
Some cleanup comments
@ -0,0 +114,4 @@
((mmd.influence.flag & GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP) !=
0);
threading::parallel_for(curves.curves_range(), 512, [&](const IndexRange curves_range) {
curves_range
->range
@ -0,0 +116,4 @@
threading::parallel_for(curves.curves_range(), 512, [&](const IndexRange curves_range) {
for (const int curve : curves_range) {
for (const int local_point : points_by_curve[curve].index_range()) {
Since you're looking up the
points_by_curve[curve]
multiple times, better put it in a variable above the inner loop.@blender-bot build