GPv3: Weight proximity modifier #118363
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#118363
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChengduLittleA/blender:gp3-mod-wproximity"
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?
Weight proximity modifier migrated to GPv3.
First pass. Generally, this looks really good already.
@ -2870,0 +2884,4 @@
struct Object *object;
} GreasePencilWeightProximityModifierData;
typedef enum eGreasePencilWeightProximityFlag {
There is no need for the
e
prefix anymore.@ -0,0 +111,4 @@
float3 target_pos, float4x4 obmat, float3 pos, const float dist_min, const float dist_max)
{
float weight;
const float3 gvert = (obmat * float4(pos, 1.0f)).xyz();
Use
math::transform_point(obmat, pos);
@ -0,0 +112,4 @@
{
float weight;
const float3 gvert = (obmat * float4(pos, 1.0f)).xyz();
const float dist = math::length(target_pos - gvert);
Use
math::distance(traget_pos, gvert);
@ -0,0 +115,4 @@
const float dist = math::length(target_pos - gvert);
if (dist > dist_max) {
weight = 1.0f;
Instead of setting
weight
, just return the value directly.@ -0,0 +117,4 @@
if (dist > dist_max) {
weight = 1.0f;
}
else if (dist <= dist_max && dist > dist_min) {
else if
->if
(with changes above)@ -0,0 +120,4 @@
else if (dist <= dist_max && dist > dist_min) {
weight = 1.0f - ((dist_max - dist) / math::max((dist_max - dist_min), 0.0001f));
}
else {
->
return 0.0f
@ -0,0 +179,4 @@
const VArray<float> vgroup_weights = modifier::greasepencil::get_influence_vertex_weights(
curves, mmd.influence);
const Span<float3> positions = curves.positions_for_write();
Since we're not writing to the positions, use
curves.positions();
@ -0,0 +184,4 @@
const float3 target_pos = mmd.object ? mmd.object->object_to_world().location() : float3(0.0f);
threading::parallel_for(positions.index_range(), 1024, [&](const IndexRange range) {
for (const int point : range) {
point
->point_i
@ -0,0 +185,4 @@
threading::parallel_for(positions.index_range(), 1024, [&](const IndexRange range) {
for (const int point : range) {
const float vgroup_fac = vgroup_weights[point];
vgroup_fac
->weight
@ -0,0 +195,4 @@
target_pos, obmat, positions[point], mmd.dist_start, mmd.dist_end) :
1.0f;
if (mmd.flag & MOD_GREASE_PENCIL_WEIGHT_PROXIMITY_INVERT_OUTPUT) {
To make this a bit cleaner, I'd move this out of the loop and just use
if (invert) ...
here.@ -0,0 +199,4 @@
dist_fac = 1.0f - dist_fac;
}
dst_weights.span[point] = (mmd.flag & MOD_GREASE_PENCIL_WEIGHT_PROXIMITY_MULTIPLY_DATA) ?
Same as above.
One more comment, rest looks good to me.
@ -0,0 +141,4 @@
{
const int def_nr = BLI_findstringindex(
&vertex_group_names, name.c_str(), offsetof(bDeformGroup, name));
if (def_nr < 0)
Always use
{ ... }
@LukasTonne Could you take a quick look too?
@blender-bot build
@ -0,0 +290,4 @@
ModifierTypeInfo modifierType_GreasePencilWeightProximity = {
/*idname*/ "GreasePencilWeightProximityModifier",
/*name*/ N_("Weight Angle"),
While testing I noticed the name was not correct.
Once the name is changed, I think this is ready.
Looks good!
@ -0,0 +64,4 @@
modifier::greasepencil::free_influence_data(&mmd->influence);
}
static bool is_disabled(const Scene * /*scene*/, ModifierData *md, bool /*use_render_params*/)
I'm assuming the GPv2 modifier also worked with the object being null? Otherwise might want to disable the modifier when the object is null.
Huh... The one in v2 does seems to disable when object is not present, but the logic in
deform_stroke
does takeobject==null
into account, which is kinda weird.I'll add that check in
is_disabled
then.@blender-bot build
@blender-bot build