GPv3: Add layer 'pass index' attribute. #118495

Merged
Bastien Montagne merged 4 commits from mont29/blender:tmp-gp-layer-index into main 2024-02-22 14:54:00 +01:00

Add this data as a layer attribute. It's usage was already implemented
by the modifier filtering generic code, but data itself did not yet
exist in GPv3 data.

Also add RNA accessors and handle it in conversion code.

Add this data as a layer attribute. It's usage was already implemented by the modifier filtering generic code, but data itself did not yet exist in GPv3 data. Also add RNA accessors and handle it in conversion code.
Bastien Montagne added this to the Grease Pencil project 2024-02-20 11:57:59 +01:00
Bastien Montagne requested review from Falk David 2024-02-20 11:58:15 +01:00
Bastien Montagne requested review from Hans Goudey 2024-02-20 11:58:15 +01:00
Author
Owner

@blender-bot build

@blender-bot build
Falk David requested changes 2024-02-20 12:59:42 +01:00
Falk David left a comment
Member

Thanks, just one remark.

Thanks, just one remark.
@ -386,0 +389,4 @@
layer_idx = 0;
LISTBASE_FOREACH_INDEX (bGPDlayer *, gpl, &gpd.layers, layer_idx) {
layer_passes.span[layer_idx] = int(gpl->pass_index);
Member

I think it's best to put this in the loop above. E.g. below new_layer.opacity = gpl->opacity;

I think it's best to put this in the loop above. E.g. below `new_layer.opacity = gpl->opacity;`
Author
Owner

Is that possible? AFAICT, the loop above is adding layers one by one, can the attribute data remain valid in that context?

Is that possible? AFAICT, the loop above is _adding_ layers one by one, can the attribute data remain valid in that context?
Member

Ah yea, good point. Technically it would be possible (because the layer data is getting resized when a layer is added), but let's not overcomplicate this :)
Maybe just a comment, something like: /* Write to layer attributes after all layers were created. */, could help.

Ah yea, good point. Technically it would be possible (because the layer data is getting resized when a layer is added), but let's not overcomplicate this :) Maybe just a comment, something like: `/* Write to layer attributes after all layers were created. */`, could help.
mont29 marked this conversation as resolved
Bastien Montagne requested review from Falk David 2024-02-20 14:16:42 +01:00
Bastien Montagne force-pushed tmp-gp-layer-index from 8bf8129c83 to 2ff5b7ed3e 2024-02-20 14:16:42 +01:00 Compare
Falk David approved these changes 2024-02-20 14:19:27 +01:00
Hans Goudey approved these changes 2024-02-20 15:05:36 +01:00
Hans Goudey left a comment
Member

I guess we already used the "pass" name? I find that a bit vague/short for this, but it can be tweaked outside of this PR too.

I guess we already used the "pass" name? I find that a bit vague/short for this, but it can be tweaked outside of this PR too.
@ -138,0 +160,4 @@
bke::SpanAttributeWriter<int> layer_passes =
grease_pencil.attributes_for_write().lookup_or_add_for_write_span<int>(
"pass", bke::AttrDomain::Layer);
layer_passes.span[layer_idx] = max_ii(0, value);
Member

max_ii -> std::max

`max_ii` -> `std::max`
mont29 marked this conversation as resolved
Author
Owner

I guess we already used the "pass" name? I find that a bit vague/short for this, but it can be tweaked outside of this PR too.

@filedescriptor do we actually? AFAICT in current code in main, it's only referenced in the filtering code of modifiers... but there should be no data with that attribute currently existing?

In which case renaming should rather happen now, than later... I guess layer_index would be a better name?

> I guess we already used the "pass" name? I find that a bit vague/short for this, but it can be tweaked outside of this PR too. @filedescriptor do we actually? AFAICT in current code in `main`, it's only referenced in the filtering code of modifiers... but there should be no data with that attribute currently existing? In which case renaming should rather happen now, than later... I guess `layer_index` would be a better name?
Bastien Montagne added 1 commit 2024-02-20 15:17:03 +01:00
Member

@mont29 This feature is meant to allow users to assign a "pass" number to a layer (but multiple layers could use the same "pass") to allow for arbitrary "grouping" of layers. E.g. layers with the same "pass" ID would use the same filtering in a modifier for example. Initially this was also meant to be used by the renderer to allow to render layer by passes (though that never happend).

So with that in mind, I think pass or pass_id or something of that sort could be fine.

@mont29 This feature is meant to allow users to assign a "pass" number to a layer (but multiple layers could use the same "pass") to allow for arbitrary "grouping" of layers. E.g. layers with the same "pass" ID would use the same filtering in a modifier for example. Initially this was also meant to be used by the renderer to allow to render layer by passes (though that never happend). So with that in mind, I think `pass` or `pass_id` or something of that sort could be fine.
Bastien Montagne added 2 commits 2024-02-22 11:18:37 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
69ffa3bdd7
Rename attribute to "pass_index".
"pass" in itself is a bit too generic. Further more, legacy GP data and
RNA property are bopth using `pass index` too. Better be consistent
here.
Author
Owner

@blender-bot build

@blender-bot build
Author
Owner

@filedescriptor renamed to pass_index, since it's also the RNA prop name...

@filedescriptor renamed to `pass_index`, since it's also the RNA prop name...
Bastien Montagne changed title from GPv3: Add 'layer pass index'. to GPv3: Add layer 'pass index' attribute. 2024-02-22 11:19:51 +01:00
Bastien Montagne merged commit f15f57c5ea into main 2024-02-22 14:54:00 +01:00
Bastien Montagne deleted branch tmp-gp-layer-index 2024-02-22 14:54:02 +01:00
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
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#118495
No description provided.