GPv3: Frame delete operator (edit mode) #110938

Closed
casey-bianco-davis wants to merge 7 commits from casey-bianco-davis/blender:GPv3-delete-frame into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

This operator is a combination of the delete operator's frame mode and the active_frames_delete_all operator.

This also add the delete menu and key binds.

This operator is a combination of the delete operator's `frame` mode and the `active_frames_delete_all` operator. This also add the delete menu and key binds.
casey-bianco-davis added 1 commit 2023-08-08 22:54:38 +02:00
1a80926074 GPv3: Frame delete operator (edit mode).
This operator is a combination of the delete operator's `frame` mode and the `active_frames_delete_all` operator.

This also add the delete menu and key binds.
Pratik Borhade reviewed 2023-08-09 09:18:58 +02:00
@ -560,0 +609,4 @@
{
PropertyRNA *prop;
static const EnumPropertyItem prop_greasepencil_delete_types[] = {
Member

move enum-list out of operator function? :)

move enum-list out of operator function? :)
casey-bianco-davis marked this conversation as resolved
casey-bianco-davis added 1 commit 2023-08-09 18:28:05 +02:00
Member

Thanks. In future, make sure you add correct tags/project so modules devs can easily find the PR :)

Thanks. In future, make sure you add correct tags/project so modules devs can easily find the PR :)
Pratik Borhade requested review from Falk David 2023-08-10 09:10:17 +02:00
Pratik Borhade requested review from Amélie Fondevilla 2023-08-10 09:10:17 +02:00
Pratik Borhade added the
Module
Grease Pencil
label 2023-08-10 09:10:33 +02:00
Pratik Borhade added this to the Grease Pencil project 2023-08-10 09:10:42 +02:00
Falk David requested changes 2023-08-10 10:52:58 +02:00
Falk David left a comment
Member

Thank you for working on this :)
Added some comments.

Thank you for working on this :) Added some comments.
@ -560,0 +562,4 @@
/** \name Delete Frame Operator
* \{ */
enum eGREASEPENCIL_DeleteFrameMode {
Member

Since this enum is already defined in the ed::greasepencil namespace, it should just be named DeleteFrameMode.
And the values just ACTIVE_FRAME and ALL_FRAMES.

Since this enum is already defined in the `ed::greasepencil` namespace, it should just be named `DeleteFrameMode`. And the values just `ACTIVE_FRAME` and `ALL_FRAMES`.
casey-bianco-davis marked this conversation as resolved
@ -560,0 +591,4 @@
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(object->data);
const int current_frame = scene->r.cfra;
eGREASEPENCIL_DeleteFrameMode mode = eGREASEPENCIL_DeleteFrameMode(
Member

can be const

can be `const`
casey-bianco-davis marked this conversation as resolved
@ -560,0 +595,4 @@
RNA_enum_get(op->ptr, "type"));
bool changed = false;
if (mode == GREASEPENCIL_DELETEFRAMEOP_ACTIVE_FRAME) {
Member

&& grease_pencil.has_active_layer()

` && grease_pencil.has_active_layer()`
casey-bianco-davis marked this conversation as resolved
@ -560,0 +598,4 @@
if (mode == GREASEPENCIL_DELETEFRAMEOP_ACTIVE_FRAME) {
bke::greasepencil::Layer &layer = *grease_pencil.get_active_layer_for_write();
if (layer.is_editable()) {
changed |= layer.remove_frame(layer.frame_key_at(current_frame));
Member

Instead of using the layer.remove_frame API, which does not handled deletion of drawings, this should use grease_pencil.remove_frames(layer, {current_frame})

Instead of using the `layer.remove_frame` API, which does not handled deletion of drawings, this should use `grease_pencil.remove_frames(layer, {current_frame})`
casey-bianco-davis marked this conversation as resolved
@ -560,0 +604,4 @@
else if (mode == GREASEPENCIL_DELETEFRAMEOP_ALL_FRAMES) {
for (bke::greasepencil::Layer *layer : grease_pencil.layers_for_write()) {
if (layer->is_editable()) {
changed |= layer->remove_frame(layer->frame_key_at(current_frame));
Member

Same as above.

Same as above.
casey-bianco-davis marked this conversation as resolved
Author
Member

Thanks. In future, make sure you add correct tags/project so modules devs can easily find the PR :)

Thanks. But if I am not mistaking I would need commit access to add tags/project?

> Thanks. In future, make sure you add correct tags/project so modules devs can easily find the PR :) Thanks. But if I am not mistaking I would need commit access to add tags/project?
casey-bianco-davis added 2 commits 2023-08-10 22:20:55 +02:00
casey-bianco-davis requested review from Falk David 2023-08-10 22:21:42 +02:00
Member

@casey-bianco-davis I think you just need to be part of the contributors group. I'll ask

@casey-bianco-davis I think you just need to be part of the contributors group. I'll ask
Falk David approved these changes 2023-08-11 10:41:39 +02:00
Falk David left a comment
Member

One remaining comment, otherwise this looks ready :)

One remaining comment, otherwise this looks ready :)
@ -561,0 +605,4 @@
DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA | NA_EDITED, &grease_pencil);
}
else {
Member

This else case can be removed. We usually don't report errors in case the operator doesn't have something to operate on.

This else case can be removed. We usually don't report errors in case the operator doesn't have something to operate on.
casey-bianco-davis marked this conversation as resolved
casey-bianco-davis added 1 commit 2023-08-11 18:20:20 +02:00
casey-bianco-davis requested review from Falk David 2023-08-11 18:23:34 +02:00
casey-bianco-davis added 1 commit 2023-08-25 01:59:21 +02:00
casey-bianco-davis changed title from GPv3: Frame delete operator (edit mode). to GPv3: Frame delete operator (edit mode) 2023-08-25 02:07:11 +02:00
casey-bianco-davis added 1 commit 2023-08-25 02:07:36 +02:00
Falk David approved these changes 2023-09-11 11:23:38 +02:00
Falk David left a comment
Member

LGTM. Will commit with some cleanup changes.

LGTM. Will commit with some cleanup changes.
Member

Committed by 5870ffa570

Committed by https://projects.blender.org/blender/blender/commit/5870ffa5707c1795499a8c428521eb8691460b5a
Falk David closed this pull request 2023-09-11 11:41:43 +02:00

Pull request closed

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
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#110938
No description provided.