Fix: GPv3: Retrieving drawings for layer returns invalid layer index #120722

Merged
Pratik Borhade merged 1 commits from SietseB/blender:gpv3-fix-invalid-layer-index into main 2024-04-17 13:15:58 +02:00
Member

The utility function retrieve_editable_drawings_from_layer() returned
a drawing index instead of a layer index. This PR fixes that.

The utility function `retrieve_editable_drawings_from_layer()` returned a drawing index instead of a layer index. This PR fixes that.
Sietse Brouwer added 1 commit 2024-04-16 22:44:19 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
ba260841d0
Use layer index in `retrieve_editable_drawings_from_layer()`
Sietse Brouwer added this to the Grease Pencil project 2024-04-16 22:44:49 +02:00
Sietse Brouwer requested review from Falk David 2024-04-16 22:45:00 +02:00
Pratik Borhade approved these changes 2024-04-17 12:24:16 +02:00
Pratik Borhade left a comment
Member

Hi, looks correct.
Falk is on holidays this week. Fix is quite straightforward so I think we can merge this directly :)

Hi, looks correct. Falk is on holidays this week. Fix is quite straightforward so I think we can merge this directly :)
Member

@blender-bot build

@blender-bot build
Pratik Borhade merged commit 91e50380d3 into main 2024-04-17 13:15:58 +02:00

@PratikPB2123 @SietseB please revert this. This change breaks Separate by Layer operator (grease_pencil_separate_layer)
The operator needs all the drawings in a particular layer not the layer index.

I think the function name retrieve_editable_drawings_from_layer is clear. it is not?

@PratikPB2123 @SietseB please revert this. This change breaks Separate by Layer operator (grease_pencil_separate_layer) The operator needs all the drawings in a particular layer not the layer index. I think the function name _retrieve_editable_drawings_from_layer_ is clear. it is not?
Author
Member

@mendio I don't have the rights to revert, we need @PratikPB2123 for that.
But what is the issue in grease_pencil_separate_layer?

The definition of MutableDrawingInfo is this:

struct MutableDrawingInfo {
  bke::greasepencil::Drawing &drawing;
  const int layer_index;
  const int frame_number;
  const float multi_frame_falloff;
};

So the second field should be filled with the layer index. E.g. the Tint tool uses that and crashes when the second field is filled with the drawing index.
If grease_pencil_separate_layer is somehow expecting that drawing_info.layer_index holds a drawing index, it should be fixed in there.

@mendio I don't have the rights to revert, we need @PratikPB2123 for that. But what is the issue in `grease_pencil_separate_layer`? The definition of `MutableDrawingInfo` is this: ``` struct MutableDrawingInfo { bke::greasepencil::Drawing &drawing; const int layer_index; const int frame_number; const float multi_frame_falloff; }; ``` So the second field should be filled with the layer index. E.g. the Tint tool uses that and crashes when the second field is filled with the drawing index. If `grease_pencil_separate_layer` is somehow expecting that `drawing_info.layer_index` holds a drawing index, it should be fixed in there.
Member

Hi, I dont understand why we need to revert this. As @SietseB explained, second member of MutableDrawingInfo is layer_index.
On phone right now, as far as I remember grease_pencil_separate_layer did not use layer_index

Hi, I dont understand why we need to revert this. As @SietseB explained, second member of MutableDrawingInfo is layer_index. On phone right now, as far as I remember `grease_pencil_separate_layer` did not use `layer_index`

I'll check grease_pencil_separate_layer tomorrow and let you know

I'll check `grease_pencil_separate_layer` tomorrow and let you know

You were right, it's not an issue generated by this change. Sorry for the confussion.

I get an assert in all the Separate operators (selected, by layer and by material) but only with drawings automatically converted from GPv2. The Separate operators work well for GPv3 objects created from scratch. I'd need to investigate what causes it

You were right, it's not an issue generated by this change. Sorry for the confussion. I get an assert in all the Separate operators (selected, by layer and by material) but only with drawings automatically converted from GPv2. The Separate operators work well for GPv3 objects created from scratch. I'd need to investigate what causes it
Member

No problem. At least we don't have to revert this commit 😃

No problem. At least we don't have to revert this commit 😃
Sietse Brouwer deleted branch gpv3-fix-invalid-layer-index 2024-04-21 21:03:29 +02:00
Member

I get an assert in all the Separate operators (selected, by layer and by material) but only with drawings automatically converted from GPv2. The Separate operators work well for GPv3 objects created from scratch. I'd need to investigate what causes it

@mendio Could you create a bug report for it? Then we don't loose track of the bug and can investigate together :)

> I get an assert in all the Separate operators (selected, by layer and by material) but only with drawings automatically converted from GPv2. The Separate operators work well for GPv3 objects created from scratch. I'd need to investigate what causes it @mendio Could you create a bug report for it? Then we don't loose track of the bug and can investigate together :)
Bug report: [#120926: GPv3: Blender crash using Separate Operators on converted files from GPv2](https://projects.blender.org/blender/blender/issues/120926)
Sign in to join this conversation.
No reviewers
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#120722
No description provided.