Fix ContextTempOverride.logging_set missing enable param on 5.0

Blender 5.0's logging_set has no docstring, so introspection produced
an empty param list. Add fallback to inject the enable: bool param
when the method is discovered without params.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph HENRY 2026-04-02 11:46:48 +02:00
parent 760644a2c8
commit 7e1e18d845

View File

@ -2747,7 +2747,20 @@ def introspect_rna_types() -> ModuleData:
result = ctx.temp_override()
result_cls = result.__class__
if result_cls.__name__ not in known:
structs.append(introspect_class(result_cls, "bpy.types"))
hidden = introspect_class(result_cls, "bpy.types")
# Fix logging_set if it was introspected without params
# (older Blender versions lack the docstring)
for method in hidden["methods"]:
if method["name"] == "logging_set" and not method["params"]:
method["params"] = [
{
"name": "enable",
"type": "bool",
"default": None,
"kind": "POSITIONAL_OR_KEYWORD",
},
]
structs.append(hidden)
known.add(result_cls.__name__)
exit_fn = getattr(result, "__exit__", None)
if exit_fn is not None: