Skip to content

Commit

Permalink
tweak naming
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Sep 16, 2024
1 parent 633ea5f commit ea8bc74
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ jobs:
- name: Build docs using blender
run: |
blender -b --python tests/python.py -- -m pip install .
cd docs
blender -b --python build_node_docs.py
blender -b --python generate_node_docs.py
- name: Build Docs
run: quarto render docs
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,13 @@ To build the documentation, [`Quarto`](https://quarto.org) is used. The docs can

```bash
conda activate mn
python docs/build_node_docs.py
python docs/generate_node_docs.py
quarto preview
```

The long-form written documentation is all inside of `docs/`. Documentation is written in markdown (`.md`) or quarto-flavored markdown (`.qmd`) which allows to execute code when building the docs.

The documentation for individual nodes which are shown [here](https://bradyajohnston.github.io/MolecularNodes/nodes/) are built by running the `docs/build_node_docs.py`, which extracts information from the relevent `.blend` data files inside of `molecularnodes/assets/`. Combining the information for the input / output types & tooltips with the summaries described in `molecularnodes/ui/node_info.py` we can then generate nice HTML documentation for each of the nodes.
The documentation for individual nodes which are shown [here](https://bradyajohnston.github.io/MolecularNodes/nodes/) are built by running the `docs/generate_node_docs.py`, which extracts information from the relevent `.blend` data files inside of `molecularnodes/assets/`. Combining the information for the input / output types & tooltips with the summaries described in `molecularnodes/ui/node_info.py` we can then generate nice HTML documentation for each of the nodes.

This isn't currently the best implementation for this. I would prefer to just pull from those nodes which are defined in the `.blend` file, but we aren't able to include descriptions for the node groups currently inside of the `.blend`. `node_info.py` is also used for building the add menus as well as the documentation. To update the descriptions of inputs, outputs and data types the nodes themselves need to be updated inside of the `.blend` files. Relevant example videos should be updated when nodes are changed.

Expand Down
2 changes: 1 addition & 1 deletion docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project:
output-dir: _build
# render:
# - "*.qmd"
# pre-render: build_node_docs.py
# pre-render: generate_node_docs.py

filters:
- preview-colour
Expand Down
20 changes: 9 additions & 11 deletions docs/build_node_docs.py → docs/generate_node_docs.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import bpy
import sys

sys.path.insert(0, "./")

from noodlenotes.documenter import documenter
import pathlib

try:
from bl_ext.user_default import molecularnodes as mn
Expand All @@ -13,13 +10,14 @@
except ImportError:
import molecularnodes as mn

import os
import sys
import pathlib
DOCS_FOLDER = pathlib.Path(__file__).resolve().parent

# import the scripts for building documentation
sys.path.insert(0, str(DOCS_FOLDER))
import noodlenotes


folder = pathlib.Path(__file__).resolve().parent
file_output_qmd = os.path.join(folder, "nodes/index.qmd")
# load the data file which contains all of the nodes to build docs for
bpy.ops.wm.open_mainfile(filepath=mn.blender.nodes.MN_DATA_FILE)


Expand All @@ -31,7 +29,7 @@
"""

for submenu in mn.ui.node_menu.menu_items.submenus:
with open(os.path.join(folder, f"nodes/{submenu.name}.qmd"), "w") as file:
with open(DOCS_FOLDER / f"nodes/{submenu.name}.qmd", "w") as file:
file.write(header)
file.write(f"# {submenu.title}\n\n")
if submenu.description:
Expand All @@ -44,7 +42,7 @@
name = item.backup
else:
name = item.name
doc = documenter(item)
doc = noodlenotes.MenuItemDocumenter(item)

file.write(doc.as_markdown())
file.write("\n\n")
2 changes: 1 addition & 1 deletion docs/noodlenotes/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .documenter import TreeDocumenter
from .documenter import TreeDocumenter, MenuItemDocumenter
2 changes: 1 addition & 1 deletion docs/noodlenotes/documenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def as_markdown(self) -> str:
return text


def documenter(menu_item) -> TreeDocumenter:
def MenuItemDocumenter(menu_item) -> TreeDocumenter:
if menu_item.backup:
tree = bpy.data.node_groups[menu_item.backup]
else:
Expand Down

0 comments on commit ea8bc74

Please sign in to comment.