Discover bpy.msgbus and other C submodules with short __name__
Fix _discover_submodules_via_dir to also match modules whose __name__ is just the attribute name (e.g. "msgbus" instead of "bpy.msgbus"). This discovers bpy.msgbus with clear_by_owner, publish_rna, subscribe_rna. Also use collections.abc.Sequence instead of _Sequence alias, and add @property with setter for writable mathutils RNA properties. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f1cfc8ccbd
commit
3d0c8f74be
@ -2039,7 +2039,11 @@ def _discover_submodules_via_dir(mod: ModuleType, parent_name: str) -> list[str]
|
|||||||
# Verify the module actually belongs to this parent
|
# Verify the module actually belongs to this parent
|
||||||
# (filter out stray re-exports like 'sys', 'os', etc.)
|
# (filter out stray re-exports like 'sys', 'os', etc.)
|
||||||
obj_name = getattr(obj, "__name__", "")
|
obj_name = getattr(obj, "__name__", "")
|
||||||
if obj_name == submodule_name or obj_name.startswith(parent_name + "."):
|
if (
|
||||||
|
obj_name == submodule_name
|
||||||
|
or obj_name.startswith(parent_name + ".")
|
||||||
|
or obj_name == attr_name
|
||||||
|
):
|
||||||
found.append(submodule_name)
|
found.append(submodule_name)
|
||||||
return found
|
return found
|
||||||
|
|
||||||
@ -2442,11 +2446,16 @@ def _rna_struct_to_data(
|
|||||||
|
|
||||||
properties: list[PropertyData] = []
|
properties: list[PropertyData] = []
|
||||||
for prop in getattr(struct_info, "properties", []):
|
for prop in getattr(struct_info, "properties", []):
|
||||||
|
prop_type = rna_property_to_type(prop)
|
||||||
|
is_readonly = bool(getattr(prop, "is_readonly", False))
|
||||||
|
# Writable mathutils properties also accept Sequence[float] for assignment
|
||||||
|
if not is_readonly and prop_type in _MATHUTILS_ARRAY_TYPES:
|
||||||
|
prop_type = f"{prop_type} | Sequence[float]"
|
||||||
properties.append(
|
properties.append(
|
||||||
{
|
{
|
||||||
"name": str(getattr(prop, "identifier", "")),
|
"name": str(getattr(prop, "identifier", "")),
|
||||||
"type": rna_property_to_type(prop),
|
"type": prop_type,
|
||||||
"is_readonly": bool(getattr(prop, "is_readonly", False)),
|
"is_readonly": is_readonly,
|
||||||
"description": str(getattr(prop, "description", "") or ""),
|
"description": str(getattr(prop, "description", "") or ""),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user