Bonsai - ifcpatch description to include arguments descriptions

Also fix a bug with broken patch descriptions if some argument had more than one line for the description.

Example - https://i.imgur.com/1syL4gJ.png
Notcied working on #6227
This commit is contained in:
Andrej730
2025-02-27 17:37:32 +05:00
parent 497542d7a0
commit 0bd608b6cb
2 changed files with 145 additions and 31 deletions
+13 -2
View File
@@ -36,7 +36,7 @@ from bpy.props import (
from typing import TYPE_CHECKING, Literal, Union
ifcpatchrecipes_enum = []
ifcpatchrecipes_enum: list[tuple[str, str, str]] = []
def purge():
@@ -57,7 +57,18 @@ def get_ifcpatch_recipes(self: "BIMPatchProperties", context: bpy.types.Context)
if f == "__init__":
continue
docs = ifcpatch.extract_docs(f, "Patcher", "__init__", ("src", "file", "logger", "args"))
ifcpatchrecipes_enum.append((f, f, docs.get("description", "") if docs else ""))
if docs is None:
description = ""
else:
description = docs["description"]
inputs = docs["inputs"]
if inputs:
if description:
description += "\n\n"
description += "Parameters:"
for param, input_data in inputs.items():
description += f"\n\n- {param}: {input_data['description']}"
ifcpatchrecipes_enum.append((f, f, description))
ifcpatchrecipes_enum.sort(key=lambda x: x[0])
return ifcpatchrecipes_enum