UI/I18N: Fix a couple of issues in new 'Add Modifiers' menu. #112252

Merged
Bastien Montagne merged 1 commits from mont29/blender:tmp-modifiers-menu-fix into main 2023-09-13 22:44:54 +02:00

The recent change to the 'Add Modifier' created at least two issues:

  • A complete duplicate of UI info for each modifier (its name and icon),
    now existing in both the RNA enum definition of modifiers types, and
    in the Python UI code.
  • An implicit duplication of these UI names in two different translation
    contexts, since the ones from the enum use the default one, while
    explicit labels passed to the layout.operator UI API get assigned a
    default 'operator' context. See PR !112246 for details about this.

Both issues can be easily solved by making the new python code for these
menus a bit smarter. Adding a helper function that adds the add_modifier
operator with the right parameters, just based on the operator type.

Both names (labels) and icons can be found in the enum property
bl_rna definition itself then.

This change:

  • Avoids duplicating UI info.
  • Fixes translation context mismatch, by forcing the usage of the
    default one also from the python code.
  • Makes code less verbose and overall more readable.

NOTE: An attempt has been made to use the get_name callback of
operator types to automatically return the right name based on the
defined type, but this is currently utterly failing with regular
layout-based UI code. This will be reported and handled separately.

The recent change to the 'Add Modifier' created at least two issues: * A complete duplicate of UI info for each modifier (its name and icon), now existing in both the RNA enum definition of modifiers types, and in the Python UI code. * An implicit duplication of these UI names in two different translation contexts, since the ones from the enum use the default one, while explicit labels passed to the `layout.operator` UI API get assigned a default 'operator' context. See PR !112246 for details about this. Both issues can be easily solved by making the new python code for these menus a bit smarter. Adding a helper function that adds the `add_modifier` operator with the right parameters, just based on the operator type. Both names (labels) and icons can be found in the enum property `bl_rna` definition itself then. This change: * Avoids duplicating UI info. * Fixes translation context mismatch, by forcing the usage of the default one also from the python code. * Makes code less verbose and overall more readable. NOTE: An attempt has been made to use the `get_name` callback of operator types to automatically return the right name based on the defined type, but this is currently utterly failing with regular layout-based UI code. This will be reported and handled separately.
Bastien Montagne requested review from Campbell Barton 2023-09-11 20:15:18 +02:00
Bastien Montagne requested review from Julian Eisel 2023-09-11 20:15:19 +02:00
Bastien Montagne requested review from Hans Goudey 2023-09-11 20:15:19 +02:00
Author
Owner

@pioverfour FYI :)

@pioverfour FYI :)
Bastien Montagne force-pushed tmp-modifiers-menu-fix from 7188a19e4b to 5cdf8d06a0 2023-09-11 20:17:12 +02:00 Compare
Hans Goudey approved these changes 2023-09-11 20:23:59 +02:00
Bastien Montagne merged commit 6fcdcd4108 into main 2023-09-13 22:44:54 +02:00
Bastien Montagne deleted branch tmp-modifiers-menu-fix 2023-09-13 22:44:55 +02: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
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#112252
No description provided.