GPv3: Add Assign material menu #114637

Merged
Falk David merged 10 commits from antoniov/blender:GPv3_114190_assign_mat into main 2024-01-12 13:40:09 +01:00

Adds a menu to assign a material from a list as is in GPv2.

Related to #114190

Adds a menu to assign a material from a list as is in GPv2. Related to #114190
Antonio Vazquez added 1 commit 2023-11-08 17:26:40 +01:00
80fed91e12 GPv3: Add Assign material menu
Adds a menu to assign a material from a list as is in GPv2.

Related to #114190
Antonio Vazquez requested review from Falk David 2023-11-08 17:26:48 +01:00
Antonio Vazquez requested review from Matias Mendiola 2023-11-08 17:26:54 +01:00
Antonio Vazquez added this to the Grease Pencil project 2023-11-08 17:27:00 +01:00
Matias Mendiola requested changes 2023-11-15 21:26:46 +01:00
Matias Mendiola left a comment
Member
No description provided.
@ -8062,0 +8075,4 @@
mat = slot.material
if mat:
layout.operator("grease_pencil.stroke_material_set", text=mat.name,
icon='LAYER_ACTIVE' if mat == mat_active else 'BLANK1').material = mat.name

The menu should be grayed out if the Object does not have any material

The menu should be grayed out if the Object does not have any material
antoniov marked this conversation as resolved
@ -8119,0 +8138,4 @@
col.separator()
col.menu("VIEW3D_MT_grease_pencil_assign_material")
col.operator("grease_pencil.set_active_material", text="Set as Active Material")

in Stroke Context Menu, Assign Material and Set as Active Material should be above Mirror menu to follow GPv2

image

in Stroke Context Menu, Assign Material and Set as Active Material should be above Mirror menu to follow GPv2 ![image](/attachments/ab725080-a29c-470a-ae7c-91812d1b6237)
antoniov marked this conversation as resolved
Antonio Vazquez added 2 commits 2023-11-15 23:05:20 +01:00
Antonio Vazquez added 1 commit 2023-11-15 23:11:19 +01:00
f66c5787b6 GPv3: Disable row for empty menu
Now this does not change anything, but maybe in the future
there is a style change and the row must be disabled.
Matias Mendiola approved these changes 2023-11-15 23:15:51 +01:00
Matias Mendiola left a comment
Member

From UI and functionality point of view, it's Ok for me.

From UI and functionality point of view, it's Ok for me.
Falk David requested changes 2023-11-16 11:17:30 +01:00
Falk David left a comment
Member

Some smaller comments

Some smaller comments
@ -820,0 +825,4 @@
int material_index = object->actcol - 1;
if (name[0] != '\0') {
ma = (Material *)BKE_libblock_find_name(bmain, ID_MA, name);
Member

this should use a reinterpret_cast<Material *>(...)

this should use a `reinterpret_cast<Material *>(...)`
antoniov marked this conversation as resolved
@ -820,0 +827,4 @@
if (name[0] != '\0') {
ma = (Material *)BKE_libblock_find_name(bmain, ID_MA, name);
if (ma == nullptr) {
return OPERATOR_CANCELLED;
Member

I think it would be good to add a warning here so that at least the user knows why the operator failed. Something like:

BKE_reportf(op->reports, RPT_WARNING, TIP_("Material '%s' could not be found"), name);
I think it would be good to add a warning here so that at least the user knows why the operator failed. Something like: ``` BKE_reportf(op->reports, RPT_WARNING, TIP_("Material '%s' could not be found"), name); ```
antoniov marked this conversation as resolved
Antonio Vazquez added 1 commit 2023-11-16 13:13:02 +01:00
Antonio Vazquez added 1 commit 2023-11-24 12:18:31 +01:00
f4910a85cd Merge branch 'main' into GPv3_114190_assign_mat
Conflicts:
	source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc
Antonio Vazquez added 1 commit 2023-12-01 19:25:03 +01:00
89885cb1a9 Merge branch 'main' into GPv3_114190_assign_mat
Conflicts:
	scripts/startup/bl_ui/space_view3d.py
	source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc
Falk David approved these changes 2024-01-12 11:22:07 +01:00
Falk David left a comment
Member

This needs a merge with main, but looks good otherwise.

This needs a merge with main, but looks good otherwise.
Antonio Vazquez added 3 commits 2024-01-12 13:13:50 +01:00
Falk David merged commit 814ff41ed5 into main 2024-01-12 13:40:09 +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#114637
No description provided.