I18n: extract node group asset sockets
Each node group asset exposes various properties through sockets. Although they can generally be considered user-created data, for built-in assets they are also part of the UI and should be translated--especially since more modifiers should be migrated to Geometry Nodes in the future. This commit allows extraction of such socket names and descriptions. Since the message extraction script already extracted names and descriptions for each asset, this commit only adds the socket in the same loop, so that they are extracted while the asset file is already being read. Properties from sockets are not yet translated in the modifier properties editor, this will be enabled in a follow-up commit.
This commit is contained in:
committed by
Bastien Montagne
parent
1b95e74b8a
commit
772e99b4f7
@@ -941,6 +941,14 @@ def dump_asset_messages(msgs, reports, settings):
|
||||
|
||||
# Parse the asset blend files
|
||||
asset_files = {}
|
||||
# Store assets according to this structure:
|
||||
# {"basename": [
|
||||
# {"name": "Name",
|
||||
# "description": "Description",
|
||||
# "sockets": [
|
||||
# ("Name", "Description"),
|
||||
# ]},
|
||||
# ]}
|
||||
|
||||
bfiles = glob.glob(assets_dir + "/**/*.blend", recursive=True)
|
||||
for bfile in bfiles:
|
||||
@@ -953,11 +961,18 @@ def dump_asset_messages(msgs, reports, settings):
|
||||
if asset.asset_data is None: # Not an asset
|
||||
continue
|
||||
assets = asset_files.setdefault(basename, [])
|
||||
assets.append((asset.name, asset.asset_data.description))
|
||||
asset_data = {"name": asset.name,
|
||||
"description": asset.asset_data.description}
|
||||
for interface in asset.interface.items_tree:
|
||||
if interface.name == "Geometry": # Ignore common socket
|
||||
continue
|
||||
socket_data = asset_data.setdefault("sockets", [])
|
||||
socket_data.append((interface.name, interface.description))
|
||||
assets.append(asset_data)
|
||||
|
||||
for asset_file in sorted(asset_files):
|
||||
for asset in sorted(asset_files[asset_file]):
|
||||
name, description = asset
|
||||
for asset in sorted(asset_files[asset_file], key=lambda a: a["name"]):
|
||||
name, description = asset["name"], asset["description"]
|
||||
msgsrc = "Asset name from file " + asset_file
|
||||
process_msg(msgs, settings.DEFAULT_CONTEXT, name, msgsrc,
|
||||
reports, None, settings)
|
||||
@@ -965,6 +980,15 @@ def dump_asset_messages(msgs, reports, settings):
|
||||
process_msg(msgs, settings.DEFAULT_CONTEXT, description, msgsrc,
|
||||
reports, None, settings)
|
||||
|
||||
if "sockets" in asset:
|
||||
for socket_name, socket_description in asset["sockets"]:
|
||||
msgsrc = f"Socket name from node group {name}, file {asset_file}"
|
||||
process_msg(msgs, settings.DEFAULT_CONTEXT, socket_name, msgsrc,
|
||||
reports, None, settings)
|
||||
msgsrc = f"Socket description from node group {name}, file {asset_file}"
|
||||
process_msg(msgs, settings.DEFAULT_CONTEXT, socket_description, msgsrc,
|
||||
reports, None, settings)
|
||||
|
||||
|
||||
def dump_addon_bl_info(msgs, reports, module, settings):
|
||||
for prop in ('name', 'location', 'description', 'warning'):
|
||||
|
||||
Reference in New Issue
Block a user