GPv3: Offset modifier #117446

Merged
Lukas Tönne merged 15 commits from LukasTonne/blender:gp3-offset-modifier into main 2024-01-24 16:58:07 +01:00
Member

Ported the Offset modifier from GPv2.

Ported the Offset modifier from GPv2.
Lukas Tönne added 2 commits 2024-01-23 13:49:00 +01:00
Lukas Tönne added 1 commit 2024-01-23 13:49:50 +01:00
Falk David added this to the Grease Pencil project 2024-01-23 13:59:30 +01:00
Falk David requested review from Falk David 2024-01-23 13:59:37 +01:00
Falk David requested changes 2024-01-23 14:16:59 +01:00
Falk David left a comment
Member

Looks very solid overall, just a few cleanup remarks.

Looks very solid overall, just a few cleanup remarks.
@ -0,0 +43,4 @@
namespace blender {
using bke::greasepencil::Drawing;
Member

I think this should be moved into the functions that need it (and it's fine if the parameters of a function use the full bke::greasepencil)

I think this should be moved into the functions that need it (and it's fine if the parameters of a function use the full `bke::greasepencil`)
LukasTonne marked this conversation as resolved
@ -0,0 +88,4 @@
const MutableSpan<float3> positions,
const MutableSpan<float> radii,
const VArray<float> &weights,
const IndexRange &range,
Member

Would be better to name this points since the type already tells us it's a range.

Would be better to name this `points` since the type already tells us it's a range.
LukasTonne marked this conversation as resolved
@ -0,0 +132,4 @@
static void modify_stroke_random(Object &ob,
const GreasePencilOffsetModifierData &omd,
bke::CurvesGeometry &curves,
const IndexMask curves_mask)
Member

Pass the mask by const reference, same for the other functions

Pass the mask by const reference, same for the other functions
LukasTonne marked this conversation as resolved
@ -0,0 +316,4 @@
break;
case MOD_GREASE_PENCIL_OFFSET_LAYER:
BLI_assert(layer_index);
BLI_assert(layers_num);
Member

Since you always call the function for the case MOD_GREASE_PENCIL_OFFSET_LAYER with the optionals, I think it's better to turn this into its own static function modify_drawing_by_layer that calls modify_stroke_by_layer.

Since you always call the function for the case `MOD_GREASE_PENCIL_OFFSET_LAYER` with the optionals, I think it's better to turn this into its own static function `modify_drawing_by_layer` that calls `modify_stroke_by_layer`.
LukasTonne marked this conversation as resolved
Hans Goudey requested changes 2024-01-23 19:24:39 +01:00
@ -0,0 +6,4 @@
* \ingroup modifiers
*/
#include "MEM_guardedalloc.h"
Member

Some unused includes:

// #include "MEM_guardedalloc.h"
// #include "DEG_depsgraph_query.hh"
// #include "RNA_enum_types.hh"
Some unused includes: ``` // #include "MEM_guardedalloc.h" // #include "DEG_depsgraph_query.hh" // #include "RNA_enum_types.hh" ```
LukasTonne marked this conversation as resolved
@ -0,0 +86,4 @@
static void apply_stroke_transform(const GreasePencilOffsetModifierData &omd,
const MutableSpan<float3> positions,
const MutableSpan<float> radii,
Member

Return arguments, including MutableSpan usually come last. That helps to show what the function's goal is, and is especially useful with the const in front of MutableSpan

Return arguments, including `MutableSpan` usually come last. That helps to show what the function's goal is, and is especially useful with the `const` in front of `MutableSpan`
LukasTonne marked this conversation as resolved
@ -0,0 +129,4 @@
}
/** Randomized offset per stroke. */
static void modify_stroke_random(Object &ob,
Member

const Object &, then move the curves last so the const arguments come first.

`const Object &`, then move the `curves` last so the const arguments come first.
LukasTonne marked this conversation as resolved
@ -67,0 +71,4 @@
Vector<LayerDrawingInfo> get_drawing_infos_by_layer(GreasePencil &grease_pencil,
const IndexMask &layer_mask,
const int frame);
Member

const is meaningless for by-value parameters in declarations in headers, typically it's not included

`const` is meaningless for by-value parameters in declarations in headers, typically it's not included
LukasTonne marked this conversation as resolved
Lukas Tönne added 1 commit 2024-01-24 14:04:13 +01:00
Lukas Tönne added 4 commits 2024-01-24 14:21:38 +01:00
Lukas Tönne added 4 commits 2024-01-24 14:30:08 +01:00
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
61555c9a6b
Remove const int parameter declaration.
Author
Member

@blender-bot build

@blender-bot build
Hans Goudey approved these changes 2024-01-24 15:57:16 +01:00
Hans Goudey left a comment
Member

Besides the clang format thing mentioned by the buildbot, LGTM

Besides the clang format thing mentioned by the buildbot, LGTM
@ -0,0 +224,4 @@
}
/** Offset proportional to material index. */
static void modify_stroke_by_material(Object &ob,
Member

Object & -> const Object &

`Object &` -> `const Object &`
LukasTonne marked this conversation as resolved
@ -0,0 +317,4 @@
}
}
static void modify_drawing_by_layer(ModifierData &md,
Member

ModifierData & -> const ModifierData &

In other places too

`ModifierData &` -> `const ModifierData &` In other places too
LukasTonne marked this conversation as resolved
Lukas Tönne added 2 commits 2024-01-24 16:05:55 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
4207b8e490
Use const refs.
Author
Member

@blender-bot build

@blender-bot build
Falk David approved these changes 2024-01-24 16:14:22 +01:00
Falk David left a comment
Member

Looks good. Make sure to resolve the merge confict :)

Looks good. Make sure to resolve the merge confict :)
Lukas Tönne added 1 commit 2024-01-24 16:18:04 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
a3c84d22ed
Merge branch 'main' into gp3-offset-modifier
Author
Member

@blender-bot build

@blender-bot build
Lukas Tönne merged commit 7e87513368 into main 2024-01-24 16:58:07 +01:00
Lukas Tönne referenced this issue from a commit 2024-01-24 16:58:08 +01:00
Lukas Tönne deleted branch gp3-offset-modifier 2024-01-24 16:58:09 +01:00
Sign in to join this conversation.
No reviewers
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117446
No description provided.