Fix #112683: Removing the last Annotations layer produces a warning. #113274
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#113274
Loading…
Reference in New Issue
No description provided.
Delete Branch "MilanDavidovic/blender:fix-gpencil-remove-last-layer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After removing the last Annotations layer, the current GPencil block
needs to be freed.
Hi, thanks for the PR. Bug remains when annotation channel is deleted from animation editors.
You can do similar change in
BKE_gpencil_layer_delete
when annoation data is deleted:gpd->flag & GP_DATA_ANNOTATIONS
cc @antoniov
Hi Pratik, thanks for noting that. I'll make the change.
BKE_gpencil_layer_delete
is called fromgpencil_layer_remove_exec
, where I've made the change. It seems to me that moving the change toBKE_gpencil_layer_delete
(i.e. deleting gpd there) wouldn't make sense, since it deals with deleting layers only.It might be better to do the similar change in
animchannels_delete_exec
for animation channel typeANIMTYPE_GPLAYER
. What do you think @PratikPB2123 ?I see,
BKE_gpencil_layer_delete
is called from both the operations. In that case, it make sense to move your fix inBKE_gpencil_layer_delete
function, this will avoid code duplication too. And this function seems correct place to deal with layers.I think original code was written by @antoniov so his opinion will be more valuable.
Avoiding code duplication sounds good.
BKE_gpencil_layer_delete
would then have to takebGPdata **gpd
though, so that it can null the correct pointer (&scene->gpd
inanimchannels_delete_exec
and the one returned byED_annotation_data_get_pointers
ingpencil_layer_remove_exec
).We also need context for
ED_annotation_data_get_pointers
So I think it make sense to not move your code inBKE_gpencil_layer_delete
Best to do it separately in
gpencil_layer_remove_exec
,animchannels_delete_exec
(as you said earlier) 🙂@ -2241,2 +2241,4 @@
BKE_gpencil_layer_delete(gpd, gpl);
ale->update = ANIM_UPDATE_DEPS;
/* If we removed the last layer for annotations, free the scene's GPencil block. */
Thanks. I think comment can be improved. For example:
/* Free Grease Pencil data block when last annotation layer is removed, see: #112683. */
Thanks Pratik, I'll make the change. Should I also change the comment in the other file?
yes, both :)
Thanks. Looks correct now. Would be good to have this in 4.0
Could you rebase the PR from main branch to 4.0: refer Rebase Onto
Fix #112683: Removing the last Annotations layer produces a warning.to Fix #112683: Removing the last Annotations layer produces a warning.fc2375d8f6
to989113c5b6
Thanks :)
@antoniov , can you give final look before merging?