GPv3: Edit mode overlay curve lines and bézier handles. #122966

Merged
Falk David merged 27 commits from casey-bianco-davis/blender:GPv3-Curve-Overlay into main 2024-07-20 13:30:43 +02:00

In edit mode this display lines with curves, i.e this can show bézier curves and bézier handles.

This is edit mode only and does not apply for rendered geometry; for rendered geometry see #122985

In edit mode this display lines with curves, i.e this can show bézier curves and bézier handles. This is edit mode only and does not apply for rendered geometry; for rendered geometry see #122985
casey-bianco-davis added the
Interest
Grease Pencil
Module
Grease Pencil
labels 2024-06-09 19:41:17 +02:00
casey-bianco-davis added 2 commits 2024-06-09 19:41:23 +02:00
casey-bianco-davis added this to the Grease Pencil project 2024-06-09 19:41:30 +02:00
casey-bianco-davis requested review from Falk David 2024-06-09 19:43:03 +02:00
casey-bianco-davis added 8 commits 2024-06-10 03:08:51 +02:00
casey-bianco-davis changed title from GPv3: Edit mode overlay display non-polyline type curves. to GPv3: Edit mode overlay curve lines and bézier handles. 2024-06-10 03:13:37 +02:00
casey-bianco-davis added 1 commit 2024-06-30 01:34:11 +02:00
Member

Haven't looked closely at the code yet, but tested this PR locally. Workes great overall. I think one thing to improve would be the edit lines for the NURBS curve type. It would be better if we render the edit lines the same way as for the curve object. Instead of the edit line following the NURBS, it would just connect the edit points together.

Haven't looked closely at the code yet, but tested this PR locally. Workes great overall. I think one thing to improve would be the edit lines for the NURBS curve type. It would be better if we render the edit lines the same way as for the curve object. Instead of the edit line following the NURBS, it would just connect the edit points together.
casey-bianco-davis added 10 commits 2024-07-09 07:11:54 +02:00
Falk David requested changes 2024-07-09 15:49:06 +02:00
Dismissed
Falk David left a comment
Member

Thanks for the updates! Tested it again and now the "wire" edit line (the one that connects the edit points) is there, awesome, but additionally there is the line on the nurbs itself. I think for the edit line we should only have one (the wire line) because the geometry will have the shape of the nurbs, if you see what I mean.

Thanks for the updates! Tested it again and now the "wire" edit line (the one that connects the edit points) is there, awesome, but additionally there is the line on the nurbs itself. I think for the edit line we should only have one (the wire line) because the geometry will have the shape of the nurbs, if you see what I mean.
@ -391,0 +474,4 @@
IndexMaskMemory &memory)
{
const bke::CurvesGeometry &curves = drawing.strokes();
const IndexRange points_range = curves.points_range();
Member

This variable is unused.

This variable is unused.
casey-bianco-davis marked this conversation as resolved
Member

To clarify:
curve-editing-gpv3-nurbs.png

To clarify: ![curve-editing-gpv3-nurbs.png](/attachments/41f76145-e858-431e-bc15-9e3a816bc5bc)
Clément Foucault requested review from Clément Foucault 2024-07-09 16:02:27 +02:00
casey-bianco-davis added 3 commits 2024-07-09 21:41:42 +02:00
casey-bianco-davis requested review from Falk David 2024-07-09 21:42:55 +02:00
casey-bianco-davis added 1 commit 2024-07-11 05:02:43 +02:00
casey-bianco-davis added 1 commit 2024-07-12 06:43:04 +02:00
Falk David requested changes 2024-07-12 11:45:19 +02:00
Dismissed
Falk David left a comment
Member

Added some cleanup comments to match our styleguide.

Added some cleanup comments to match our styleguide.
@ -388,6 +402,295 @@ static void grease_pencil_weight_batch_ensure(Object &object,
cache->is_dirty = false;
}
static IndexMask grease_pencil_get_visible_Bezier_points(Object &object,
Member

snake_case -> grease_pencil_get_visible_bezier_points

snake_case -> `grease_pencil_get_visible_bezier_points`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +437,4 @@
return IndexMask::from_intersection(editable_points, selected_points, memory);
}
static IndexMask grease_pencil_get_visible_NURBS_points(Object &object,
Member

grease_pencil_get_visible_nurbs_points

`grease_pencil_get_visible_nurbs_points`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +466,4 @@
return nurbs_points;
}
static IndexMask grease_pencil_get_visible_NURBS_curves(Object &object,
Member

grease_pencil_get_visible_nurbs_curves

`grease_pencil_get_visible_nurbs_curves`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +491,4 @@
return IndexMask::from_intersection(selected_editable_strokes, nurbs_curves, memory);
}
static IndexMask grease_pencil_get_visible_non_NURBS_curves(
Member

grease_pencil_get_visible_non_nurbs_curves

`grease_pencil_get_visible_non_nurbs_curves`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +507,4 @@
return IndexMask::from_intersection(visible_strokes, non_nurbs_curves, memory);
}
static void grease_pencil_cache_add_NURBS(Object &object,
Member

grease_pencil_cache_add_nurbs

`grease_pencil_cache_add_nurbs`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +554,4 @@
*r_total_line_ids_num += nurbs_curves.size();
}
static void IndexBuf_add_line_points(Object &object,
Member

index_buffer_add_line_points

`index_buffer_add_line_points`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +587,4 @@
*r_drawing_line_start_offset += curves.evaluated_points_num();
}
static void IndexBuf_add_NURBS_lines(Object &object,
Member

index_buffer_add_nurbs_lines

`index_buffer_add_nurbs_lines`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +616,4 @@
});
}
static void IndexBuf_add_Bezier_lines(Object &object,
Member

index_buffer_add_bezier_lines

`index_buffer_add_bezier_lines`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +644,4 @@
*r_drawing_line_start_offset += bezier_points.size() * 3;
}
static void IndexBuf_add_points(Object &object,
Member

index_buffer_add_points

`index_buffer_add_points`
casey-bianco-davis marked this conversation as resolved
@ -391,0 +669,4 @@
*r_drawing_start_offset += curves.points_num();
}
static void IndexBuf_add_Bezier_line_points(Object &object,
Member

index_buffer_add_bezier_line_points

`index_buffer_add_bezier_line_points`
casey-bianco-davis marked this conversation as resolved
casey-bianco-davis added 1 commit 2024-07-12 18:31:35 +02:00
Cleanup: Use snake case.
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
c5d84df116
casey-bianco-davis requested review from Falk David 2024-07-12 18:32:20 +02:00
Iliya Katushenock reviewed 2024-07-12 18:42:45 +02:00
@ -391,0 +423,4 @@
const VArray<bool> selected_right = *curves.attributes().lookup_or_default<bool>(
".selection_handle_right", bke::AttrDomain::Point, true);
const IndexMask editable_points = ed::greasepencil::retrieve_editable_points(

Just to note: i do not know real life time of result of function, but its seems less clear to create tempolaral index mask in memory for result one.

Just to note: i do not know real life time of result of function, but its seems less clear to create tempolaral index mask in memory for result one.
Falk David approved these changes 2024-07-19 10:21:35 +02:00
Falk David left a comment
Member

Code looks good to me and is working as expected. Thanks.

Code looks good to me and is working as expected. Thanks.
Clément Foucault approved these changes 2024-07-20 01:06:47 +02:00
Clément Foucault left a comment
Member

I do not see anything wrong with this patch. But I only focused on the GPU part. I have nothing to say about the usage of the attribute API. So from my perspective it is good to go.

I do not see anything wrong with this patch. But I only focused on the GPU part. I have nothing to say about the usage of the attribute API. So from my perspective it is good to go.
@ -53,3 +51,4 @@
/* Indices of visible points. */
gpu::IndexBuf *edit_points_indices;
/* Crazy-space point positions for all line points. */

I don't understand why this references crazy space.

I don't understand why this references crazy space.
Author
Member

The comment at line 47 calls the deformed points Crazy-space and so I copy it.
If you preferred I could change both to Deformed-space?

The comment at line 47 calls the deformed points `Crazy-space` and so I copy it. If you preferred I could change both to `Deformed-space`?

Then I am confused by both. Either it is original (before modifier stack) or evaluated (after modifier stack). As far as I know, Crazyspace is the mapping between both.

@JacquesLucke It seems you introduced this comment, can you give more info why?

As for the patch itself, this is not a blocker.

Then I am confused by both. Either it is original (before modifier stack) or evaluated (after modifier stack). As far as I know, Crazyspace is the mapping between both. @JacquesLucke It seems you introduced this comment, can you give more info why? As for the patch itself, this is not a blocker.
Member

Either it is original (before modifier stack) or evaluated (after modifier stack).

Not necessarily true. Typically it's the original points with some additional transform applied. As such, it's a mix of information from original and evaluated data.

In this specific case, the original positions are transformed by layer transforms, but it's possible that more transforms will have to be taken into account in the future. (see how copy_transformed_positions is used in this file)

> Either it is original (before modifier stack) or evaluated (after modifier stack). Not necessarily true. Typically it's the original points with some additional transform applied. As such, it's a mix of information from original and evaluated data. In this specific case, the original positions are transformed by layer transforms, but it's possible that more transforms will have to be taken into account in the future. (see how `copy_transformed_positions` is used in this file)

Fine then. I am too dumb to understand.

Fine then. I am too dumb to understand.
Member

@blender-bot build

@blender-bot build
Falk David merged commit 0e442c2090 into main 2024-07-20 13:30:43 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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
5 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#122966
No description provided.