GPv3: Autolock inactive layers #118323

Merged
Pratik Borhade merged 5 commits from PratikPB2123/blender:gpv3-autolock-layers into main 2024-02-18 07:33:08 +01:00
Member

Port legacy autolock_layers property to gpv3

Port legacy `autolock_layers` property to gpv3
Pratik Borhade added 1 commit 2024-02-15 13:04:48 +01:00
b6ee282100 GPv3: Autolock inactive layers
Port legacy `autolock_layers` property to gpv3
Pratik Borhade requested review from Falk David 2024-02-15 13:05:31 +01:00
Pratik Borhade added the
Module
Grease Pencil
label 2024-02-15 13:05:38 +01:00
Pratik Borhade added this to the Grease Pencil project 2024-02-15 13:06:20 +01:00
Falk David requested changes 2024-02-16 11:14:10 +01:00
Falk David left a comment
Member

Added some comments. I think the double use of autolock_layers_set (clearing the locked state for all layers and locking everything but the active layer) makes the code a bit less readable.

Added some comments. I think the double use of `autolock_layers_set` (clearing the locked state for all layers and locking everything but the active layer) makes the code a bit less readable.
@ -2189,0 +2199,4 @@
layer->set_locked(false);
continue;
}
layer->set_locked(is_autolock);
Member

Instead of checking the flag, always use false.

Instead of checking the flag, always use `false`.
Author
Member

Hmm, then no layers will be locked 🙂
What the code doing is:
when autolock inactive layers property is enabled. is_autolock=true (lock other layers): layer->set_locked(true);

when property is disabled, is_autolock=flase (unlock all layers): layer->set_locked(false);

Hmm, then no layers will be locked 🙂 What the code doing is: when `autolock inactive layers` property is enabled. `is_autolock=true` (lock other layers): `layer->set_locked(true);` when property is disabled, `is_autolock=flase` (unlock all layers): `layer->set_locked(false);`
Member

Sorry, I meant true

Sorry, I meant `true`
filedescriptor marked this conversation as resolved
@ -488,6 +489,7 @@ typedef struct GreasePencil {
blender::bke::greasepencil::Layer *get_active_layer();
void set_active_layer(const blender::bke::greasepencil::Layer *layer);
bool is_layer_active(const blender::bke::greasepencil::Layer *layer) const;
void autolock_layers_set();
Member

I think it's better to call this autolock_inactive_layers();

I think it's better to call this `autolock_inactive_layers();`
PratikPB2123 marked this conversation as resolved
@ -43,0 +43,4 @@
static void rna_grease_pencil_autolock(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
GreasePencil *grease_pencil = rna_grease_pencil(ptr);
grease_pencil->autolock_layers_set();
Member

Instead, check the status of the flag, and if it's true, call the autolock, otherwise iterate over all layers and set the locked to false.

Instead, check the status of the flag, and if it's true, call the autolock, otherwise iterate over all layers and set the locked to `false`.
Author
Member

Didn't understand this 😅

Didn't understand this 😅
Author
Member

Hi, thanks for the review :)

I think the double use of autolock_layers_set (clearing the locked state for all layers and locking everything but the active layer) makes the code a bit less readable.

We're not really clearing the lock state of all layer before locking them

Hi, thanks for the review :) > I think the double use of `autolock_layers_set` (clearing the locked state for all layers and locking everything but the active layer) makes the code a bit less readable. We're not really clearing the lock state of all layer before locking them
Pratik Borhade added 1 commit 2024-02-16 12:04:39 +01:00
Member

@PratikPB2123 The update function of the property calls autolock_inactive_layers() in case the autolock flag is true and when it's false. Basically, I'm suggesting to only call autolock_inactive_layers() when GREASE_PENCIL_AUTOLOCK_LAYERS is set, otherwise just unlock all layers.

@PratikPB2123 The update function of the property calls `autolock_inactive_layers()` in case the autolock flag is true and when it's false. Basically, I'm suggesting to only call `autolock_inactive_layers()` when `GREASE_PENCIL_AUTOLOCK_LAYERS` is set, otherwise just unlock all layers.
Author
Member

I see what you mean. In autolock_inactive_layers() function, set lock=true for non-active layers (and remove is_autolock variable)

And in property update function, check for the "autolock" flag to lock/unlock non-active layers. but that would be some additional lines which we can avoid 😅

But anyways, I'll update the PR.

I see what you mean. In `autolock_inactive_layers()` function, set lock=true for non-active layers (and remove `is_autolock` variable) And in property update function, check for the "autolock" flag to lock/unlock non-active layers. but that would be some additional lines which we can avoid 😅 But anyways, I'll update the PR.
Pratik Borhade added 1 commit 2024-02-16 12:55:19 +01:00
Falk David approved these changes 2024-02-16 13:56:46 +01:00
Falk David left a comment
Member

Thanks for making the changes :) Looks good

Thanks for making the changes :) Looks good
Pratik Borhade added 1 commit 2024-02-17 07:13:51 +01:00
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-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
2cd9e8edb9
Merge branch 'main' into gpv3-autolock-layers and resolve conflicts
Author
Member

@blender-bot build

@blender-bot build
Pratik Borhade added 1 commit 2024-02-17 13:42:46 +01:00
buildbot/vexp-code-patch-lint 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-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
b12a44fb91
Cleanup: format
Author
Member

@blender-bot build

@blender-bot build
Pratik Borhade merged commit 203f5f9f09 into main 2024-02-18 07:33:08 +01:00
Pratik Borhade deleted branch gpv3-autolock-layers 2024-02-18 07:33:10 +01:00
Author
Member

Merged, thanks for reviewing :)

Merged, thanks for reviewing :)
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#118323
No description provided.