GPv3: Menu to Select Material using U
key #114694
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#114694
Loading…
Reference in New Issue
No description provided.
Delete Branch "antoniov/blender:GPv3_114203_active_mat"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
GPv3: Menu to Select color using `U` keyto GPv3: Menu to Select Material using `U` keyAdded some comments
@ -147,2 +156,4 @@
}
/* Retry enum items with object materials. */
const EnumPropertyItem *material_enum_itemf(bContext *C,
This function can just be a static function in
grease_pencil_edit.cc
.@ -149,0 +171,4 @@
}
/* Existing materials */
for (i = 1; i <= ob->totcol; i++) {
A bit nicer to use an index range here so that
i
can beconst
.for (const int i : IndexRange(ob->totcol) {
@ -149,0 +173,4 @@
/* Existing materials */
for (i = 1; i <= ob->totcol; i++) {
Material *ma = BKE_object_material_get(ob, i);
if (ma) {
if (Material *ma = BKE_object_material_get(ob, i + 1)) {
@ -149,0 +176,4 @@
if (ma) {
item_tmp.identifier = ma->id.name + 2;
item_tmp.name = ma->id.name + 2;
item_tmp.value = i;
With the changes above, this becomes
item_tmp.value = i + 1;
Some comments on the UI:
Could it be possible to mark the current active material in blue as all lists do since recently?
I would also suggest using just "Active Material" for the menu title.
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
Seems like there was some unresolved conflict here. Please resolve.
@ -1451,0 +1467,4 @@
EnumPropertyItem *item = nullptr, item_tmp = {0};
int totitem = 0;
if (ELEM(nullptr, C, ob)) {
We only need to check for
ob
here:if (ob == nullptr) {
@ -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");
Use
const
.LGTM