GPv3: Mirror modifier #117637

Merged
Lukas Tönne merged 16 commits from LukasTonne/blender:gp3-mirror-modifier into main 2024-01-30 12:10:42 +01:00
Member

Implements the mirror modifier from GPv2.

Implements the mirror modifier from GPv2.
Lukas Tönne added 5 commits 2024-01-29 16:25:55 +01:00
Lukas Tönne requested review from Falk David 2024-01-29 16:26:32 +01:00
Falk David reviewed 2024-01-29 16:39:08 +01:00
@ -822,6 +822,7 @@ class NodeTreeMainUpdater {
bNodeSocket &input = *node->input_sockets()[0];
BLI_assert(input.is_available() && input.type == SOCK_MENU);
this->set_enum_ptr(*input.default_value_typed<bNodeSocketValueMenu>(), enum_items);
enum_items->remove_user_and_delete_if_last();
Member

Looks like this slipped in by accident

Looks like this slipped in by accident
Author
Member

oops, fixed.

oops, fixed.
LukasTonne marked this conversation as resolved
Lukas Tönne added 1 commit 2024-01-29 16:40:53 +01:00
Lukas Tönne added 1 commit 2024-01-29 16:43:14 +01:00
Lukas Tönne added 1 commit 2024-01-29 18:19:11 +01:00
Lukas Tönne added 1 commit 2024-01-29 18:26:38 +01:00
Hans Goudey approved these changes 2024-01-29 19:57:16 +01:00
Hans Goudey left a comment
Member

Really nice now, thanks for looking into using the realize instances function.

Really nice now, thanks for looking into using the realize instances function.
@ -151,6 +151,8 @@ class OBJECT_MT_modifier_add_generate(ModifierAddMenu, Menu):
self.operator_modifier_add(layout, 'WIREFRAME')
if ob_type == 'GREASEPENCIL':
self.operator_modifier_add(layout, 'GREASE_PENCIL_SUBDIV')
if ob_type == 'GREASEPENCIL':
Member

Could put this inside the previous if statement

Could put this inside the previous if statement
LukasTonne marked this conversation as resolved
@ -2670,0 +2672,4 @@
ModifierData modifier;
GreasePencilModifierInfluenceData influence;
struct Object *object;
/** Flags. */
Member

Flags -> #GreasePencilMirrorModifierFlag

`Flags` -> `#GreasePencilMirrorModifierFlag`
LukasTonne marked this conversation as resolved
@ -0,0 +6,4 @@
* \ingroup modifiers
*/
#include "BLI_array_utils.hh"
Member

Some unused includes here now I think

Some unused includes here now I think
LukasTonne marked this conversation as resolved
@ -0,0 +178,4 @@
}
else {
/* Create masked geometry, then mirror it. */
bke::AnonymousAttributePropagationInfo propagation_info;
Member

I think just passing {} to the function directly is a simpler way to do the same thing. Same above IMO

I think just passing `{}` to the function directly is a simpler way to do the same thing. Same above IMO
LukasTonne marked this conversation as resolved
@ -179,3 +179,3 @@
IDPropertyUIDataEnumItem *idprop_items = nullptr;
if (value->enum_items) {
if (value->enum_items && !value->enum_items->items.is_empty()) {
Member

Unrelated change

Unrelated change
LukasTonne marked this conversation as resolved
Lukas Tönne reviewed 2024-01-30 09:18:21 +01:00
@ -2670,0 +2678,4 @@
} GreasePencilMirrorModifierData;
typedef enum GreasePencilMirrorModifierFlag {
MOD_GREASE_PENCIL_MIRROR_CLIPPING = (1 << 0),
Author
Member

I copied this from the original GP2 modifier, but it doesn't appear to actually be used for anything. There is a use_clip RNA property for it, but neither does the modifier display that property nor does it use the flag. Should probably remove.

I copied this from the original GP2 modifier, but it doesn't appear to actually be used for anything. There is a `use_clip` RNA property for it, but neither does the modifier display that property nor does it use the flag. Should probably remove.
LukasTonne marked this conversation as resolved
Lukas Tönne added 1 commit 2024-01-30 09:45:42 +01:00
Lukas Tönne added 4 commits 2024-01-30 10:03:35 +01:00
Lukas Tönne added 1 commit 2024-01-30 10:08:14 +01:00
f4c54d5af8 Removed the MOD_GREASE_PENCIL_MIRROR_CLIPPING flag.
This was copied from the old modifier DNA/RNA, but isn't actually used
in the old modifier at all.
Falk David requested changes 2024-01-30 10:40:37 +01:00
Falk David left a comment
Member

Just one comment

Just one comment
@ -151,6 +151,8 @@ class OBJECT_MT_modifier_add_generate(ModifierAddMenu, Menu):
self.operator_modifier_add(layout, 'WIREFRAME')
if ob_type == 'GREASEPENCIL':
self.operator_modifier_add(layout, 'GREASE_PENCIL_SUBDIV')
if ob_type == 'GREASEPENCIL':
Member

I guess this line is not necessary.

I guess this line is not necessary.
filedescriptor marked this conversation as resolved
@ -0,0 +162,4 @@
const IndexMask curves_mask = modifier::greasepencil::get_filtered_stroke_mask(
ctx.object, src_curves, mmd.influence, curve_mask_memory);
bke::CurvesGeometry result;
Member

To avoid the operator= assigment, I'd write it like this:

bke::CurvesGeometry result = [&]() {
  if (curves_mask.size() == src_curves.curve_num) {
    /* All geometry gets mirrored. */
    return create_mirror_copies(*ctx.object, mmd, src_curves, src_curves);
  }
  else {
    /* Create masked geometry, then mirror it. */
    bke::CurvesGeometry masked_curves = bke::curves_copy_curve_selection(
        src_curves, curves_mask, {});
    return create_mirror_copies(*ctx.object, mmd, src_curves, masked_curves);
  }
}();
To avoid the `operator=` assigment, I'd write it like this: ``` bke::CurvesGeometry result = [&]() { if (curves_mask.size() == src_curves.curve_num) { /* All geometry gets mirrored. */ return create_mirror_copies(*ctx.object, mmd, src_curves, src_curves); } else { /* Create masked geometry, then mirror it. */ bke::CurvesGeometry masked_curves = bke::curves_copy_curve_selection( src_curves, curves_mask, {}); return create_mirror_copies(*ctx.object, mmd, src_curves, masked_curves); } }(); ```
Author
Member

I just moved the assignment into each branch, no need for a local variable.

I just moved the assignment into each branch, no need for a local variable.
LukasTonne marked this conversation as resolved
Lukas Tönne added 1 commit 2024-01-30 11:06:01 +01:00
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
c9076199dc
Avoid local variable for result by assigning directly to the drawing.
Author
Member

@blender-bot build

@blender-bot build
Falk David approved these changes 2024-01-30 12:10:02 +01:00
Lukas Tönne merged commit 0daa426739 into main 2024-01-30 12:10:42 +01:00
Lukas Tönne deleted branch gp3-mirror-modifier 2024-01-30 12:10:44 +01:00
Lukas Tönne added this to the Grease Pencil project 2024-01-30 12:30:35 +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#117637
No description provided.