GPv3: Array modifier #117722
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#117722
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChengduLittleA/blender:gp3-mod-array"
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?
Grease Pencil Array modifier migrated to GPv3.
All features working as expected.
First quick pass.
@ -0,0 +152,4 @@
std::optional<blender::Bounds<float3>> bounds = filtered_curves.bounds_min_max();
if (bounds.has_value()) {
size = bounds.value().max - bounds.value().min;
/* Need a minimum size (for flat drawings). */
I'm not sure I understand the comment. Drawings won't have a size that's zero unless everything is in the same point.
This was there in the original modifier. I guess for stuff like the default objects, they are flat on exactly 1 axis so it's gonna have 0 size on that axis. I don't think this is needed, but for consistency with old modifier maybe we keep it here?
@ -0,0 +161,4 @@
float3x3 rand;
for (int j = 0; j < 3; j++) {
const uint3 primes(2, 3, 7);
double3 offset(0.0, 0.0, 0.0);
double3 offset(0.0);
@ -0,0 +180,4 @@
}
}
/* Calculate Random matrix. */
float3 loc, rot;
This whole thing can be written as:
@ -0,0 +192,4 @@
float4x4 current_offset = float4x4::identity();
for (const int elem_id : IndexRange(1, mmd.count)) {
float4x4 mat, mat_offset;
get_array_matrix(ob, mmd, elem_id, mat, mat_offset);
I'm not sure why this function can't just return a single matrix. Either you multiply into
current_offset
or you overwrite it, but you never need these two different matrices.Looking good generally, just have a few comments
@ -0,0 +103,4 @@
offset = float3(0.0f);
}
const float4x4 r_mat = math::from_loc_rot_scale<float4x4, float3, 3>(offset, rot, scale);
from_loc_rot_scale<float4x4>(
should do the trick, the other template parameters can be deduced automaticallyAlso
rot
andscale
are always zero.. better to usefrom_location
then, and not do unnecessary work@ -0,0 +111,4 @@
if (mmd.flag & MOD_GREASE_PENCIL_ARRAY_USE_OFFSET) {
mat_offset[3] += mmd.offset;
}
obinv = math::invert(float4x4(ob.object_to_world));
Declare variables at the same place they're initialized
@ -0,0 +115,4 @@
return mat_offset * obinv * float4x4(mmd.object->object_to_world);
}
else {
else after return is unnecessary
@ -0,0 +162,4 @@
}
}
auto get_rand_matrix = [&](const int elem_id) {
Could this be a separate function rather than a lambda? Seems nicer to get it out of the way. And maybe passing
GreasePencilArrayModifierData
would be enough.Good point. However per-stroke
elem_id
is needed forBLI_halton_3d
like the legacy implementation.Sure, I mean with two arguments, the modifier data and the index
@ -0,0 +241,4 @@
*/
bke::CurvesGeometry copy = bke::CurvesGeometry(src_curves);
drawing.strokes_for_write() = create_array_copies(*ctx.object, mmd, src_curves, copy);
std::move(copy)
@ -0,0 +247,4 @@
bke::CurvesGeometry masked_curves = bke::curves_copy_curve_selection(
src_curves, curves_mask, {});
drawing.strokes_for_write() = create_array_copies(*ctx.object, mmd, src_curves, masked_curves);
std::move(masked_curves)
It will give me this error if I use
std::move
:Ah, in this case the argument to
create_array_copies
doesn't need to be a reference@ChengduLittleA You can open this PR again by either pushing your local
gp3-mod-array
branch to your fork (and then creating a PR) or if you don't have the branch anymore, you can do: