Skip to content

Commit aa86f40

Browse files
committed
Add docs and example for standalone model rendering
1 parent 18d3504 commit aa86f40

File tree

8 files changed

+232
-0
lines changed

8 files changed

+232
-0
lines changed

examples/model_rendering/.gitignore

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# hexdoc
2+
out/
3+
.hexdoc*/
4+
out.png
5+
6+
# Python
7+
8+
.ruff_cache/
9+
10+
# Byte-compiled / optimized / DLL files
11+
__pycache__/
12+
*.py[cod]
13+
*$py.class
14+
15+
# C extensions
16+
*.so
17+
18+
# Distribution / packaging
19+
.Python
20+
build/
21+
develop-eggs/
22+
dist/
23+
downloads/
24+
eggs/
25+
.eggs/
26+
lib/
27+
lib64/
28+
parts/
29+
sdist/
30+
var/
31+
wheels/
32+
share/python-wheels/
33+
*.egg-info/
34+
.installed.cfg
35+
*.egg
36+
MANIFEST
37+
38+
# PyInstaller
39+
# Usually these files are written by a python script from a template
40+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
41+
*.manifest
42+
*.spec
43+
44+
# Installer logs
45+
pip-log.txt
46+
pip-delete-this-directory.txt
47+
48+
# Unit test / coverage reports
49+
htmlcov/
50+
.tox/
51+
.nox/
52+
.coverage
53+
.coverage.*
54+
.cache
55+
nosetests.xml
56+
coverage.xml
57+
*.cover
58+
*.py,cover
59+
.hypothesis/
60+
.pytest_cache/
61+
cover/
62+
63+
# Translations
64+
*.mo
65+
*.pot
66+
67+
# Django stuff:
68+
*.log
69+
local_settings.py
70+
db.sqlite3
71+
db.sqlite3-journal
72+
73+
# Flask stuff:
74+
instance/
75+
.webassets-cache
76+
77+
# Scrapy stuff:
78+
.scrapy
79+
80+
# Sphinx documentation
81+
docs/_build/
82+
83+
# PyBuilder
84+
.pybuilder/
85+
target/
86+
87+
# Jupyter Notebook
88+
.ipynb_checkpoints
89+
90+
# IPython
91+
profile_default/
92+
ipython_config.py
93+
94+
# pyenv
95+
# For a library or package, you might want to ignore these files since the code is
96+
# intended to run in multiple environments; otherwise, check them in:
97+
# .python-version
98+
99+
# pipenv
100+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
101+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
102+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
103+
# install all needed dependencies.
104+
#Pipfile.lock
105+
106+
# poetry
107+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108+
# This is especially recommended for binary packages to ensure reproducibility, and is more
109+
# commonly ignored for libraries.
110+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111+
#poetry.lock
112+
113+
# pdm
114+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
115+
#pdm.lock
116+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
117+
# in version control.
118+
# https://pdm.fming.dev/#use-with-ide
119+
.pdm.toml
120+
121+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122+
__pypackages__/
123+
124+
# Celery stuff
125+
celerybeat-schedule
126+
celerybeat.pid
127+
128+
# SageMath parsed files
129+
*.sage.py
130+
131+
# Environments
132+
.env
133+
.venv
134+
env/
135+
venv/
136+
ENV/
137+
env.bak/
138+
venv.bak/
139+
140+
# Spyder project settings
141+
.spyderproject
142+
.spyproject
143+
144+
# Rope project settings
145+
.ropeproject
146+
147+
# mkdocs documentation
148+
/site
149+
150+
# mypy
151+
.mypy_cache/
152+
.dmypy.json
153+
dmypy.json
154+
155+
# Pyre type checker
156+
.pyre/
157+
158+
# pytype static type analyzer
159+
.pytype/
160+
161+
# Cython debug symbols
162+
cython_debug/

examples/model_rendering/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Model Rendering
2+
3+
https://hexdoc.hexxy.media/docs/guides/standalone/model-rendering

examples/model_rendering/hexdoc.toml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#:schema https://hexdoc.hexxy.media/schema/hexdoc/core/Properties.json
2+
3+
modid = "hexdoc"
4+
5+
resource_dirs = [
6+
"resources",
7+
{ glob="mods/*.jar" },
8+
{ modid="minecraft" },
9+
{ modid="hexdoc" },
10+
]
11+
12+
export_dir = "out/export"
13+
14+
[textures]
15+
strict = false
16+
missing = [
17+
"emi:*",
18+
]
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hexdoc~=1!0.1.0a15
2+
hexdoc-minecraft~=1.19.2.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"parent": "minecraft:block/stone"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Model Rendering
2+
3+
hexdoc includes a fairly advanced module for rendering block models. It runs by default when building a web book, but you can also use it as a standalone tool with a bit of configuration.
4+
5+
For a complete example, see [examples/model_rendering](https://github.com/hexdoc-dev/hexdoc/tree/main/examples/model_rendering) in hexdoc's GitHub repo.
6+
7+
## Steps
8+
9+
1. In a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#create-and-use-virtual-environments), install the following Python packages:
10+
* `hexdoc>=1!0.1.0a15`
11+
* `hexdoc-minecraft~={GAME_VERSION}.0` (eg. `hexdoc-minecraft~=1.19.2.0`)
12+
2. Create a [`hexdoc.toml` config file](../configuration):
13+
14+
```toml title="hexdoc.toml"
15+
#:schema https://hexdoc.hexxy.media/schema/hexdoc/core/Properties.json
16+
17+
# for standalone model rendering, just leave this as "hexdoc"
18+
modid = "hexdoc"
19+
20+
resource_dirs = [
21+
# path(s) to "resources" folders, resource packs, and/or mod jars where your models and textures are located
22+
"resources",
23+
{ glob="mods/*.jar" },
24+
# required if your models depend on vanilla resources
25+
{ modid="minecraft" },
26+
{ modid="hexdoc" },
27+
]
28+
29+
# folder where loaded resources (not rendered models) should be copied to
30+
export_dir = "out/export"
31+
32+
[textures]
33+
strict = false
34+
missing = [
35+
# add item/block/model IDs to ignore missing or broken models
36+
"emi:*",
37+
]
38+
```
39+
40+
3. To render all available models, run this command: `hexdoc render-models --all`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
label: Standalone Usage
2+
link:
3+
type: generated-index
4+
description: How to use hexdoc as a standalone tool without setting up a Patchouli web book.

0 commit comments

Comments
 (0)