GPv3: Menu to Select Material using U key #114694

Merged
Antonio Vazquez merged 10 commits from antoniov/blender:GPv3_114203_active_mat into main 2023-12-01 13:12:18 +01:00

This PR includes the popup menu used to select a material pressing U key.

The menu is used in Draw, Sculpt and Vertex paint mode in GPv2 but this patch only includes Draw mode because other modes are not avaliable in GPv3 yet.

Related to #114203

This PR includes the popup menu used to select a material pressing `U` key. The menu is used in Draw, Sculpt and Vertex paint mode in GPv2 but this patch only includes Draw mode because other modes are not avaliable in GPv3 yet. Related to #114203
Antonio Vazquez added 1 commit 2023-11-10 09:46:09 +01:00
Antonio Vazquez changed title from GPv3: Menu to Select color using `U` key to GPv3: Menu to Select Material using `U` key 2023-11-10 09:46:19 +01:00
Antonio Vazquez requested review from Falk David 2023-11-10 09:46:45 +01:00
Antonio Vazquez requested review from Matias Mendiola 2023-11-10 09:46:52 +01:00
Antonio Vazquez added this to the Grease Pencil project 2023-11-10 09:46:59 +01:00
Falk David requested changes 2023-11-16 11:41:47 +01:00
Falk David left a comment
Member

Added some comments

Added some comments
@ -147,2 +156,4 @@
}
/* Retry enum items with object materials. */
const EnumPropertyItem *material_enum_itemf(bContext *C,
Member

This function can just be a static function in grease_pencil_edit.cc.

This function can just be a static function in `grease_pencil_edit.cc`.
antoniov marked this conversation as resolved
@ -149,0 +171,4 @@
}
/* Existing materials */
for (i = 1; i <= ob->totcol; i++) {
Member

A bit nicer to use an index range here so that i can be const.
for (const int i : IndexRange(ob->totcol) {

A bit nicer to use an index range here so that `i` can be `const`. `for (const int i : IndexRange(ob->totcol) {`
antoniov marked this conversation as resolved
@ -149,0 +173,4 @@
/* Existing materials */
for (i = 1; i <= ob->totcol; i++) {
Material *ma = BKE_object_material_get(ob, i);
if (ma) {
Member

if (Material *ma = BKE_object_material_get(ob, i + 1)) {

`if (Material *ma = BKE_object_material_get(ob, i + 1)) {`
antoniov marked this conversation as resolved
@ -149,0 +176,4 @@
if (ma) {
item_tmp.identifier = ma->id.name + 2;
item_tmp.name = ma->id.name + 2;
item_tmp.value = i;
Member

With the changes above, this becomes item_tmp.value = i + 1;

With the changes above, this becomes `item_tmp.value = i + 1;`
antoniov marked this conversation as resolved
Antonio Vazquez added 1 commit 2023-11-16 13:30:27 +01:00
e844dbe488 GPv3: Changes after first review
* Move function as static
* Style changes
Antonio Vazquez added 1 commit 2023-11-16 13:32:05 +01:00
Antonio Vazquez added 2 commits 2023-11-24 12:50:31 +01:00
4587b4b19e Merge branch 'main' into GPv3_114203_active_mat
Conflicts:
	source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc

Some comments on the UI:

Could it be possible to mark the current active material in blue as all lists do since recently?

image

I would also suggest using just "Active Material" for the menu title.

Some comments on the UI: Could it be possible to mark the current active material in blue as all lists do since recently? ![image](/attachments/741ebd60-8546-4e1c-99e5-05e602321293) I would also suggest using just "Active Material" for the menu title.
Antonio Vazquez added 2 commits 2023-11-30 16:41:59 +01:00
c72981f06f Merge branch 'main' into GPv3_114203_active_mat
Conflicts:
	scripts/presets/keyconfig/keymap_data/blender_default.py
Falk David requested changes 2023-11-30 16:57:05 +01:00
Falk David left a comment
Member

Another pass.

Another pass.
@ -4575,9 +4575,14 @@ def km_grease_pencil_paint(_params):
{"properties": [("mode", 'INVERT')]}),
("grease_pencil.brush_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
{"properties": [("mode", 'SMOOTH')]}),
<<<<<<< HEAD
Member

Seems like there was some unresolved conflict here. Please resolve.

Seems like there was some unresolved conflict here. Please resolve.
antoniov marked this conversation as resolved
@ -1451,0 +1467,4 @@
EnumPropertyItem *item = nullptr, item_tmp = {0};
int totitem = 0;
if (ELEM(nullptr, C, ob)) {
Member

We only need to check for ob here: if (ob == nullptr) {

We only need to check for `ob` here: `if (ob == nullptr) {`
antoniov marked this conversation as resolved
@ -1451,0 +1492,4 @@
{
Object *object = CTX_data_active_object(C);
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(object->data);
int slot = RNA_enum_get(op->ptr, "slot");
Member

Use const.

Use `const`.
antoniov marked this conversation as resolved
Antonio Vazquez added 2 commits 2023-11-30 17:04:03 +01:00
2abd5f72d1 GPv3: Fix conflict not solved
The merge crashed in the previous commit and the conflict was not
updated as expected.
Falk David approved these changes 2023-11-30 19:03:13 +01:00
Falk David left a comment
Member

LGTM

LGTM
Antonio Vazquez added 1 commit 2023-12-01 13:03:16 +01:00
fdd09696d1 Merge branch 'main' into GPv3_114203_active_mat
Conflicts:
	source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc
Matias Mendiola approved these changes 2023-12-01 13:11:44 +01:00
Antonio Vazquez merged commit 11f606f88f into main 2023-12-01 13:12:18 +01:00
Antonio Vazquez deleted branch GPv3_114203_active_mat 2023-12-01 13:12:20 +01:00
Sign in to join this conversation.
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#114694
No description provided.