I18n: Remove extraction macros from the node socket declarations #107258
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#107258
Loading…
Reference in New Issue
No description provided.
Delete Branch "pioverfour/blender:dp_geo_nodes_remove_extraction_macros"
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?
The node socket declaration uses the
N_()
macro to extract the nameand description of the socket.
This is quite redundant because since the syntax is always the same,
the extraction can be done automatically from the Python translation
module using regexes.
Four new regexes are introduced in bl_i18n_utils.settings:
add_input()
andadd_output()
, the basic socket declarations with the names;through
.translation_context()
;In addition to making the code simpler and more legible, this change
extracts a few dozen messages which were not tagged with the proper
macro.
a3ed424c39
tobc05c95da5
bc05c95da5
to51040b560f
51040b560f
to75cacf6663
75cacf6663
to4026419109
While this change may be fine in current status of node code, I have tow concerns:
First, names like
add_input
are very generic and could easily conflict with future code. Don't really see a good way to address that though.The second one is more a topic for the #Nodes-&-Physics module, but I find it fairly annoying that such a huge part of Blender is not properly available to introspection through RNA?
@ -257,2 +257,4 @@
for it in ("modifier_subpanel_register", "gpencil_modifier_subpanel_register")) +
# Node socket declarations: contextless names
tuple((r"\.{}<decl::.*?>\(\s*" + _msg_re + r"\s*\)").format(it)
I don't think this will handle properly cases with more than one string passed to the constructor, like in
b.add_input<decl::Float>("Value", "Value_001")
?My understanding from this block is that the second string is only an identifier and can always be ignored for translation. Also at present, every instance where
add_(in|out)put()
is called with two arguments, only the first one has aN_()
extraction tag.Yes, that's right
@pioverfour I was not clear enough here, my concern is that the current regex will not match on multi-parameters cases. The
r"\s*\)"
part of the regex requires zero or more 'space-like' chars and a closing)
.See e.g. how
modifier_subpanel_register
& co are handled. You probably need to add something liker"(?:,[^),]+)*\s*\)"
(or+
instead of*
if there can ever only be one additional optional parameter) to match & discard any extra parameter...Ah, yes of course! Thanks.
4026419109
to085a84f9d9
This is an ongoing pain point for us too, but the transition from the static socket array for nodes to the socket declaration is a large one and we don't want to expose it to RNA while it's still changing. It is on our radar though.
085a84f9d9
toa0013d616a
a0013d616a
to6c2c5d2feb
6c2c5d2feb
to5c93654067
5c93654067
to04525f8bcb
While I was rebasing on latest main to resolve conflicts, I noticed that some labels come from the
node_sock_label()
function. So I added a new commit in between the existing ones, with the new regex:@pioverfour looks like this PR needs to be updated by hands ;)
Oh, hehe, looks we have been colliding...
Sorry, surprised we could...
04525f8bcb
toe149997be1
@blender-bot build
e149997be1
to9b313102bb