Merge branch 'blender-v4.5-release'

This commit is contained in:
Campbell Barton
2025-06-30 17:21:10 +10:00
2 changed files with 18 additions and 6 deletions

View File

@@ -1331,6 +1331,7 @@ def pycontext2sphinx(basepath):
type_descr = prop.get_type_description(
class_fmt=":class:`bpy.types.{:s}`",
mathutils_fmt=":class:`mathutils.{:s}`",
literal_fmt="``{:s}``",
collection_id=_BPY_PROP_COLLECTION_ID,
enum_descr_override=enum_descr_override,
)
@@ -1501,6 +1502,7 @@ def pyrna2sphinx(basepath):
kwargs["class_fmt"] = ":class:`{:s}`"
kwargs["mathutils_fmt"] = ":class:`mathutils.{:s}`"
kwargs["literal_fmt"] = "``{:s}``"
kwargs["collection_id"] = _BPY_PROP_COLLECTION_ID
@@ -1621,6 +1623,7 @@ def pyrna2sphinx(basepath):
type_descr = prop.get_type_description(
class_fmt=":class:`{:s}`",
mathutils_fmt=":class:`mathutils.{:s}`",
literal_fmt="``{:s}``",
collection_id=_BPY_PROP_COLLECTION_ID,
enum_descr_override=enum_descr_override,
)
@@ -1703,6 +1706,7 @@ def pyrna2sphinx(basepath):
type_descr = prop.get_type_description(
as_ret=True, class_fmt=":class:`{:s}`",
mathutils_fmt=":class:`mathutils.{:s}`",
literal_fmt="``{:s}``",
collection_id=_BPY_PROP_COLLECTION_ID,
enum_descr_override=enum_descr_override,
)

View File

@@ -360,7 +360,7 @@ class InfoPropertyRNA:
# self.default_str = repr(self.default) # repr or set()
self.default_str = "{{{:s}}}".format(repr(list(sorted(self.default)))[1:-1])
else:
self.default_str = "'{:s}'".format(self.default)
self.default_str = self.default
elif self.array_length:
if self.array_dimensions[1] == 0: # single dimension array, we already took care of multi-dimensions ones.
# special case for floats
@@ -388,6 +388,7 @@ class InfoPropertyRNA:
as_arg=False,
class_fmt="{:s}",
mathutils_fmt="{:s}",
literal_fmt="'{:s}'",
collection_id="Collection",
enum_descr_override=None,
):
@@ -437,9 +438,9 @@ class InfoPropertyRNA:
enum_descr = enum_descr_override
if not enum_descr:
if self.is_enum_flag:
enum_descr = "{{{:s}}}".format(", ".join(("'{:s}'".format(s[0])) for s in self.enum_items))
enum_descr = "{{{:s}}}".format(", ".join((literal_fmt.format(s[0])) for s in self.enum_items))
else:
enum_descr = "[{:s}]".format(", ".join(("'{:s}'".format(s[0])) for s in self.enum_items))
enum_descr = "[{:s}]".format(", ".join((literal_fmt.format(s[0])) for s in self.enum_items))
if self.is_enum_flag:
type_str += " set in {:s}".format(enum_descr)
else:
@@ -447,9 +448,16 @@ class InfoPropertyRNA:
del enum_descr
if not (as_arg or as_ret):
# write default property, ignore function args for this
if self.type != "pointer":
# write default property, ignore function args for this.
match self.type:
case "pointer":
pass
case "enum":
# Empty enums typically only occur for enums which are dynamically generated.
# In that case showing a default isn't helpful.
if self.default_str:
type_str += ", default {:s}".format(literal_fmt.format(self.default_str))
case _:
type_str += ", default {:s}".format(self.default_str)
else: