GPv3: Lock and Unlock all materials operators #115041

Merged
Antonio Vazquez merged 6 commits from antoniov/blender:GPv3_lockall_mat into main 2023-11-23 15:36:13 +01:00

This is the conversion of existing operators in GPv2.

Related to #114997

This is the conversion of existing operators in GPv2. Related to #114997
Antonio Vazquez added 1 commit 2023-11-17 13:25:52 +01:00
Antonio Vazquez requested review from Hans Goudey 2023-11-17 13:26:41 +01:00
Antonio Vazquez requested review from Falk David 2023-11-17 13:26:47 +01:00
Antonio Vazquez added this to the Grease Pencil project 2023-11-17 13:26:53 +01:00
Hans Goudey reviewed 2023-11-19 00:04:49 +01:00
@ -66,0 +121,4 @@
for (const int i : IndexRange(object->totcol)) {
if (Material *ma = BKE_gpencil_material(object, i + 1)) {
MaterialGPencilStyle *gp_style = ma->gp_style;
BLI_assert(gp_style != nullptr);
Member

This assert doesn't say anything that isn't obvious in the next line (the memory is immediately dereferenced). Using references is a better way to show a pointer is expected to be non-null in C++.

This assert doesn't say anything that isn't obvious in the next line (the memory is immediately dereferenced). Using references is a better way to show a pointer is expected to be non-null in C++.
Author
Member

I added this line because @filedescriptor advised me to do it. In theory, the material always must have Style, but this assert was only to filter any very weird cases.

I added this line because @filedescriptor advised me to do it. In theory, the material always must have Style, but this assert was only to filter any very weird cases.
Member

This gets the point across better:

MaterialGPencilStyle &gp_style = *ma->gp_style;
This gets the point across better: ```cpp MaterialGPencilStyle &gp_style = *ma->gp_style;
antoniov marked this conversation as resolved
Hans Goudey reviewed 2023-11-19 00:05:23 +01:00
@ -66,0 +84,4 @@
}
if (changed) {
DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
Member

Is ID_RECALC_GEOMETRY necessary? Not sure why this would need to cause a modifier reevaluation.

Is `ID_RECALC_GEOMETRY` necessary? Not sure why this would need to cause a modifier reevaluation.
Author
Member

When you lock a material the Draw Engine must redraw all, and if you are in Edit mode the information can be different. I don't know if GPv3 Draw Engine added an option to only "update" but afaik this is the way to refresh.

When you lock a material the Draw Engine must redraw all, and if you are in Edit mode the information can be different. I don't know if GPv3 Draw Engine added an option to only "update" but afaik this is the way to refresh.
Member

I think that's what ID_RECALC_SHADING is meant for. It causes a redraw (with the new version of the material) but not a reevaluation.

I think that's what `ID_RECALC_SHADING` is meant for. It causes a redraw (with the new version of the material) but not a reevaluation.
Member

Unfortunately, that doesn't work AFAIK with how grease pencil is rendered right now. I think ID_RECALC_SHADING is not handled for grease pencil if I'm reading things right. We could probably set it up that way at some point.

Unfortunately, that doesn't work AFAIK with how grease pencil is rendered right now. I think `ID_RECALC_SHADING` is not handled for grease pencil if I'm reading things right. We could probably set it up that way at some point.
antoniov marked this conversation as resolved
Antonio Vazquez added 1 commit 2023-11-19 16:18:53 +01:00
Hans Goudey approved these changes 2023-11-19 16:48:36 +01:00
Antonio Vazquez added 2 commits 2023-11-21 15:58:01 +01:00
Author
Member

The ID_RECALC_SHADING Tag was never supported and is something that would be supported in the future.

The ID_RECALC_SHADING Tag was never supported and is something that would be supported in the future.
Falk David requested changes 2023-11-22 17:29:55 +01:00
Falk David left a comment
Member

I think we need to use BKE_object_material_get here as well

I think we need to use `BKE_object_material_get` here as well
@ -66,0 +74,4 @@
bool changed = false;
for (const int i : IndexRange(object->totcol)) {
if (Material *ma = BKE_gpencil_material(object, i + 1)) {
Member

Should be BKE_object_material_get

Should be `BKE_object_material_get`
antoniov marked this conversation as resolved
@ -66,0 +118,4 @@
bool changed = false;
for (const int i : IndexRange(object->totcol)) {
if (Material *ma = BKE_gpencil_material(object, i + 1)) {
Member

Should be BKE_object_material_get

Should be `BKE_object_material_get`
antoniov marked this conversation as resolved
Antonio Vazquez added 1 commit 2023-11-22 18:01:36 +01:00
Falk David approved these changes 2023-11-23 14:03:00 +01:00
Antonio Vazquez added 1 commit 2023-11-23 15:35:17 +01:00
abd062f683 Merge branch 'main' into GPv3_lockall_mat
Conflicts:
	scripts/startup/bl_ui/properties_material_gpencil.py
	source/blender/editors/grease_pencil/intern/grease_pencil_material.cc
Antonio Vazquez merged commit 1d6a617aa2 into main 2023-11-23 15:36:13 +01:00
Antonio Vazquez deleted branch GPv3_lockall_mat 2023-11-23 15:36:15 +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#115041
No description provided.