Fix #105011: Cannot remove user preset when its name is translated
The preset names were translated before building the UI. This meant that the translated name was passed to the operator responsible for deleting the preset file, instead of the original name. Pull Request #105155
This commit is contained in:
@@ -997,6 +997,7 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
|
||||
import os
|
||||
import re
|
||||
import bpy.utils
|
||||
from bpy.app.translations import pgettext_iface as iface_
|
||||
|
||||
layout = self.layout
|
||||
|
||||
@@ -1031,7 +1032,7 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
|
||||
name = display_name(filepath) if display_name else bpy.path.display_name(f)
|
||||
props = row.operator(
|
||||
operator,
|
||||
text=name,
|
||||
text=iface_(name),
|
||||
translate=False,
|
||||
)
|
||||
|
||||
@@ -1073,7 +1074,6 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
|
||||
- preset_operator_defaults (dict of keyword args)
|
||||
"""
|
||||
import bpy
|
||||
from bpy.app.translations import pgettext_iface as iface_
|
||||
ext_valid = getattr(self, "preset_extensions", {".py", ".xml"})
|
||||
props_default = getattr(self, "preset_operator_defaults", None)
|
||||
add_operator = getattr(self, "preset_add_operator", None)
|
||||
@@ -1083,8 +1083,7 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
|
||||
props_default=props_default,
|
||||
filter_ext=lambda ext: ext.lower() in ext_valid,
|
||||
add_operator=add_operator,
|
||||
display_name=lambda name: iface_(
|
||||
bpy.path.display_name(name, title_case=False))
|
||||
display_name=lambda name: bpy.path.display_name(name, title_case=False)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user