GPv3: Switch Direction operator #114007

Merged
Antonio Vazquez merged 9 commits from mendio/blender:GPv3_Switch_Direction into main 2023-11-08 16:06:04 +01:00

This Operator is similar to GPv2 GPENCIL_OT_stroke_flip to switch the stroke direction.

Related to: 113590

This Operator is similar to GPv2 GPENCIL_OT_stroke_flip to switch the stroke direction. Related to: [113590](113590)
Matias Mendiola added 1 commit 2023-10-21 17:14:21 +02:00
28bbcbfb10 GPv3: Switch Direction operator
This Operator is similar to GPv2 GPENCIL_OT_stroke_flip to switch the stroke curve direction.
Matias Mendiola added this to the Grease Pencil project 2023-10-21 17:14:34 +02:00
Matias Mendiola requested review from Falk David 2023-10-21 17:16:41 +02:00
Matias Mendiola requested review from Antonio Vazquez 2023-10-21 17:17:09 +02:00
Antonio Vazquez requested changes 2023-10-21 17:19:50 +02:00
Antonio Vazquez left a comment
Member

Don't think you need bke::MutableAttributeAccessor attributes = curves.attributes_for_write(); here.

Don't think you need `bke::MutableAttributeAccessor attributes = curves.attributes_for_write();` here.
Falk David requested changes 2023-10-21 17:21:27 +02:00
Falk David left a comment
Member

Thanks :) Added some comments

Thanks :) Added some comments
@ -951,0 +968,4 @@
if (!ed::curves::has_anything_selected(curves)) {
return;
}
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
Member

This line is not needed :)

This line is not needed :)
mendio marked this conversation as resolved
@ -951,0 +973,4 @@
IndexMaskMemory memory;
IndexMask selected_curves = ed::curves::retrieve_selected_curves(curves, memory);
selected_curves.foreach_index([&](const int curve_index) {
Member

The loop here is not needed.
curves.reverse_curves(selected_curves); will do the trick!

The loop here is not needed. `curves.reverse_curves(selected_curves);` will do the trick!
mendio marked this conversation as resolved
Matias Mendiola added 1 commit 2023-10-21 18:06:57 +02:00
Author
Member

Since we still don't have Grease Pencil overlays yet, a simple GN can be used to test the operator

image

Since we still don't have Grease Pencil overlays yet, a simple GN can be used to test the operator ![image](/attachments/2891c628-8130-4488-85b0-40db44e0a03a)
Matias Mendiola added 1 commit 2023-10-23 13:07:55 +02:00
Antonio Vazquez approved these changes 2023-10-23 19:07:49 +02:00
Antonio Vazquez left a comment
Member

LGTM, but I'm not an expert in C++ new code.

LGTM, but I'm not an expert in C++ new code.
Hans Goudey requested changes 2023-10-25 21:14:23 +02:00
@ -951,0 +970,4 @@
}
IndexMaskMemory memory;
IndexMask selected_curves = ed::curves::retrieve_selected_curves(curves, memory);
Member

To simplify this, you can remove the previous two early return checks and just have this instead:

if (selected_curves.is_empty()) {
  return;
}
To simplify this, you can remove the previous two early return checks and just have this instead: ``` if (selected_curves.is_empty()) { return; } ```
mendio marked this conversation as resolved
Matias Mendiola added 1 commit 2023-10-25 21:48:14 +02:00
Hans Goudey approved these changes 2023-10-25 22:24:04 +02:00
Author
Member

I was wondering if now that there will be API changes in Grease Pencil it's not the right time to change the operator name to GREASE_PENCIL_OT_stroke_switch_direction like in Curves and Armatures

I was wondering if now that there will be API changes in Grease Pencil it's not the right time to change the operator name to GREASE_PENCIL_OT_stroke_switch_direction like in Curves and Armatures

I agree with the operator name change.

I agree with the operator name change.
Falk David approved these changes 2023-10-31 17:23:01 +01:00
Falk David left a comment
Member

Looks good.

Looks good.
Matias Mendiola added 1 commit 2023-10-31 17:58:39 +01:00
Matias Mendiola requested review from Falk David 2023-10-31 17:59:24 +01:00
Falk David requested changes 2023-10-31 18:01:16 +01:00
Falk David left a comment
Member

One last thing :)

One last thing :)
@ -951,0 +964,4 @@
bke::CurvesGeometry &curves = drawing.strokes_for_write();
IndexMaskMemory memory;
IndexMask selected_curves = ed::curves::retrieve_selected_curves(curves, memory);
Member

This could be const

This could be `const`
mendio marked this conversation as resolved
Matias Mendiola added 1 commit 2023-10-31 18:19:22 +01:00
Matias Mendiola added 2 commits 2023-11-02 18:49:46 +01:00
Falk David approved these changes 2023-11-08 15:10:05 +01:00
Matias Mendiola added 1 commit 2023-11-08 16:04:36 +01:00
Antonio Vazquez merged commit e5704d37de into main 2023-11-08 16:06:04 +01:00
Matias Mendiola deleted branch GPv3_Switch_Direction 2023-11-08 18:11:14 +01:00
Sign in to join this conversation.
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
4 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#114007
No description provided.