GPv3: Lock material layer property #119913

Open
Pratik Borhade wants to merge 6 commits from PratikPB2123/blender:gpv3-lock-material-layer-prop into main

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

Port lock_material layer level property to gpv3.
For this, layer_index is also required to choose strokes based on lock_material
property. Hence include extra argument in editable_strokes/points functions.

Port `lock_material` layer level property to gpv3. For this, `layer_index` is also required to choose strokes based on `lock_material` property. Hence include extra argument in `editable_strokes/points` functions.
Pratik Borhade added 1 commit 2024-03-26 12:10:07 +01:00
Pratik Borhade changed title from GPv3: Lock material layer property to WIP: GPv3: Lock material layer property 2024-03-26 12:10:22 +01:00
Pratik Borhade added 1 commit 2024-03-26 12:31:08 +01:00
Pratik Borhade changed title from WIP: GPv3: Lock material layer property to GPv3: Lock material layer property 2024-03-26 12:33:07 +01:00
Pratik Borhade requested review from Falk David 2024-03-26 12:33:13 +01:00
Pratik Borhade added the
Module
Grease Pencil
label 2024-03-26 12:33:20 +01:00
Pratik Borhade added this to the Grease Pencil project 2024-03-26 12:33:35 +01:00
Falk David requested changes 2024-03-28 13:03:49 +01:00
Falk David left a comment
Member

I have some concerns with the names. GP_LAYER_TREE_NODE_LOCK_MATERIAL is confusing because it's a flag on the layer that seems to lock a layer. I'd name it something like GP_LAYER_TREE_NODE_USE_LOCKED_MATERIAL. Same for the RNA property ("use_locked_material"). This should be documented in #114419.

I have some concerns with the names. `GP_LAYER_TREE_NODE_LOCK_MATERIAL` is confusing because it's a flag on the layer that seems to lock a layer. I'd name it something like `GP_LAYER_TREE_NODE_USE_LOCKED_MATERIAL`. Same for the RNA property (`"use_locked_material"`). This should be documented in #114419.
@ -474,1 +474,4 @@
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
prop = RNA_def_property(srna, "lock_material", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(
Member

Seems incorrect to use RNA_def_property_boolean_negative_sdna for GP_LAYER_TREE_NODE_LOCK_MATERIAL when the property is also lock_material

Seems incorrect to use `RNA_def_property_boolean_negative_sdna` for `GP_LAYER_TREE_NODE_LOCK_MATERIAL` when the property is also `lock_material`
Author
Member

Thanks for the review. Done, renamed the property/flag. Now by default this property will be off for each layer.

Thanks for the review. Done, renamed the property/flag. Now by default this property will be off for each layer.
Pratik Borhade added 1 commit 2024-04-06 09:21:44 +02:00
Pratik Borhade added 1 commit 2024-04-06 13:40:35 +02:00
Falk David requested changes 2024-04-08 11:08:17 +02:00
Falk David left a comment
Member

Did another pass on this. It would be better if the layer was passed as a const reference so that the functions don't need to get the layer() span.

Did another pass on this. It would be better if the `layer` was passed as a const reference so that the functions don't need to get the `layer()` span.
@ -565,3 +568,3 @@
curves_range, GrainSize(4096), memory, [&](const int64_t curve_i) {
const int material_index = materials[curve_i];
return editable_material_indices.contains(material_index);
return editable_material_indices.contains(material_index) ||
Member

Shouldn't this use && ?

Shouldn't this use `&&` ?
Author
Member

No. We want points/strokes to be visible in edit mode for following 2 cases:

  • When material assigned to that stroke is not locked
  • When layer has "use_locked_material" property set
No. We want points/strokes to be visible in edit mode for following 2 cases: - When material assigned to that stroke is not locked - When layer has "use_locked_material" property set
filedescriptor marked this conversation as resolved
@ -632,3 +639,3 @@
points_range, GrainSize(4096), memory, [&](const int64_t point_i) {
const int material_index = materials[point_i];
return editable_material_indices.contains(material_index);
return editable_material_indices.contains(material_index) ||
Member

Shouldn't this use && ?

Shouldn't this use `&&` ?
filedescriptor marked this conversation as resolved
@ -204,6 +204,7 @@ Vector<DrawingInfo> retrieve_visible_drawings(const Scene &scene,
IndexMask retrieve_editable_strokes(Object &grease_pencil_object,
const bke::greasepencil::Drawing &drawing,
int layer_index,
Member

This should be const bke::greasepencil::Layer &layer instead.

This should be `const bke::greasepencil::Layer &layer` instead.
@ -211,9 +212,10 @@ IndexMask retrieve_editable_strokes_by_material(Object &object,
IndexMaskMemory &memory);
IndexMask retrieve_editable_points(Object &object,
const bke::greasepencil::Drawing &drawing,
int layer_index,
Member

Same as above.

Same as above.
@ -214,3 +216,3 @@
IndexMaskMemory &memory);
IndexMask retrieve_editable_elements(Object &object,
const bke::greasepencil::Drawing &drawing,
const MutableDrawingInfo &info,
Member

Like above, pass the drawing and const bke::greasepencil::Layer &layer instead.

Like above, pass the `drawing` and `const bke::greasepencil::Layer &layer` instead.
@ -223,3 +225,3 @@
IndexMask retrieve_editable_and_selected_strokes(Object &grease_pencil_object,
const bke::greasepencil::Drawing &drawing,
const MutableDrawingInfo &info,
Member

Same as above.

Same as above.
@ -226,3 +228,3 @@
IndexMaskMemory &memory);
IndexMask retrieve_editable_and_selected_points(Object &object,
const bke::greasepencil::Drawing &drawing,
const MutableDrawingInfo &info,
Member

Same as above.

Same as above.
@ -229,3 +231,3 @@
IndexMaskMemory &memory);
IndexMask retrieve_editable_and_selected_elements(Object &object,
const bke::greasepencil::Drawing &drawing,
const MutableDrawingInfo &info,
Member

Same as above.

Same as above.
Author
Member

Hi, thanks for the review.

It would be better if the layer was passed as a const reference so that the functions don't need to get the layer() span.

If we're passing layer instead of index, we still require layer span because we can't obtain the current layer without layer_index and layer span.

Only difference would be: adding extra lines of code to get current layer each time before calling retrieve_editable_strokes/points

Hi, thanks for the review. > It would be better if the layer was passed as a const reference so that the functions don't need to get the layer() span. If we're passing layer instead of index, we still require layer span because we can't obtain the current layer without `layer_index` and `layer span`. Only difference would be: adding extra lines of code to get current layer each time before calling `retrieve_editable_strokes/points`
Pratik Borhade added 1 commit 2024-04-26 13:24:03 +02:00
Pratik Borhade added 1 commit 2024-04-26 13:31:44 +02:00
Author
Member

Hi, not sure if you saw previous comment about passing layer_index ^

Hi, not sure if you saw previous comment about passing `layer_index` ^
Merge conflict checking is in progress. Try again in few moments.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u gpv3-lock-material-layer-prop:PratikPB2123-gpv3-lock-material-layer-prop
git checkout PratikPB2123-gpv3-lock-material-layer-prop
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
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#119913
No description provided.