GPv3: Merge Points #113582

Open
opened 2023-10-12 12:04:19 +02:00 by Pratik Borhade · 2 comments
Member

Create new stroke of selected points in active layer

  • Define GREASE_PENCIL_OT_stroke_merge operator in grease_pencil_edit.cc

  • Retrieve geometry of active layer at current frame

    • Get drawing_index from frame number: active_layer->drawing_index_at(scene->r.cfra);
    • Use drawing_index to get active drawing: grease_pencil.drawing(index)
    • Get geometry: bke::CurvesGeometry &act_layer_curves = drawing.strokes_for_write();
  • Iterate through all the drawings at current scene frame (foreach_editable_drawing)

    • Get geometry of current drawing:
    • Handle selection of point/curve modes separately: ED_grease_pencil_selection_domain_get
    • for points mode:
    • Get selected points (maybe curves::retrieve_selected_points?)
    • Include these points in active-layer geometry = act_layer_curves.resize()
    • Update offset value, copy attributes of selected points to act_layer_curves (i.e. offset, position, radius, selection etc.)
    • Do similar for stroke mode.
  • Resize the geometry

Legacy GP has some operator properties: mode, draw on back, cyclic, clear point, clear stroke
We can include them in GPv3.

  • By default new stroke will appear in front. For "draw on back", new stroke should be added at the first offset index
  • For clear stroke, CurvesGeometry::remove_curves
  • For dissolve points: CurvesGeometry::remove_curves (in case we want to delete points, remove_points_and_split defined in #111571 can be used)
Create new stroke of selected points in active layer - Define `GREASE_PENCIL_OT_stroke_merge` operator in `grease_pencil_edit.cc` - Retrieve geometry of active layer at current frame - Get drawing_index from frame number: `active_layer->drawing_index_at(scene->r.cfra);` - Use drawing_index to get active drawing: `grease_pencil.drawing(index)` - Get geometry: `bke::CurvesGeometry &act_layer_curves = drawing.strokes_for_write();` - Iterate through all the drawings at current scene frame (`foreach_editable_drawing`) - Get geometry of current drawing: - Handle selection of point/curve modes separately: `ED_grease_pencil_selection_domain_get` - for points mode: - Get selected points (maybe `curves::retrieve_selected_points`?) - Include these points in active-layer geometry = `act_layer_curves.resize()` - Update offset value, copy attributes of selected points to `act_layer_curves ` (i.e. offset, position, radius, selection etc.) - Do similar for `stroke` mode. - Resize the geometry Legacy GP has some operator properties: `mode`, `draw on back`, `cyclic`, `clear point`, `clear stroke` We can include them in GPv3. - By default new stroke will appear in front. For "draw on back", new stroke should be added at the first offset index - For `clear stroke`, `CurvesGeometry::remove_curves` - For dissolve points: `CurvesGeometry::remove_curves` (in case we want to delete points, `remove_points_and_split` defined in https://projects.blender.org/blender/blender/pulls/111571 can be used)
Pratik Borhade added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2023-10-12 12:04:20 +02:00
Pratik Borhade added this to the Grease Pencil project 2023-10-12 12:08:32 +02:00
Pratik Borhade added
Type
To Do
and removed
Status
Needs Triage
Type
Report
labels 2023-10-12 12:49:30 +02:00
Pratik Borhade added the
Module
Grease Pencil
label 2023-10-12 13:01:59 +02:00

I'd like to work on this if no one else already is. I'm a first-time contributor so it can take a bit.

I'd like to work on this if no one else already is. I'm a first-time contributor so it can take a bit.

Just opened PR with current state. I still have to do the strokes version, and the undo mechanism, and probably there is some bug. But I hope the changes so far match the requirements. Any feedback about the code will be welcome.

Just opened [PR ](https://projects.blender.org/blender/blender/pulls/116726) with current state. I still have to do the strokes version, and the undo mechanism, and probably there is some bug. But I hope the changes so far match the requirements. Any feedback about the code will be welcome.
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
2 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#113582
No description provided.