Extensions: correct last commit (tsk!)
[blender-addons-contrib.git] / bl_pkg / readme.rst
blob003ddd6fde60c8830d419c8a597ea57011ce0777
2 ##################
3 Blender Extensions
4 ##################
6 Directory Layout
7 ================
9 ``./blender_addon/bl_pkg/cli/``
10    The stand-alone command line utility to manage extensions.
12 ``./blender_addon/bl_pkg/``
13    The Blender add-on which wraps the command line utility
14    (abstracts details of interacting with the package manager & repositories).
16 ``./tests/``
17    Automated tests.
19    To run tests via the ``Makefile``.
21    Test the command line application.
23    .. code-block::
25       make test PYTHON_BIN=/path/to/bin/python3.11
27    If your system Python is v3.11 or newer you may omit ``PYTHON_BIN``.
29    .. code-block::
31       make test_blender BLENDER_BIN=/path/to/blender
34 GUI
35 ===
37 This GUI is work-in-progress, currently it's been made to work with an un-modified Blender 4.1.
39 - Link ``blender_addon/bl_pkg`` into your add-ons directly.
40 - Enable the blender extensions add-on from Blender.
41 - Enable the blender extensions checkbox in the add-ons preference (this is a temporary location).
42 - Repositories can be added/removed from the "Files" section in the preferences.
45 Hacking
46 =======
48 Some useful hints.
50 When developing the command line interface, these tests can be setup to run on file-change, run:
52 .. code-block::
54    make watch_test
56 To run Blender tests.
58 .. code-block::
60    make watch_test_blender BLENDER_BIN=/path/to/blender
62 How to Setup a Test Environment
63 ===============================
65 Most of the options here are using the command-line tools. For a comprehensive list of commands check the help:
67 .. code-block::
69    ./blender_addon/bl_pkg/cli/blender_ext.py --help
72 Dummy server
73 ------------
75 The simple way to get started is by creating a dummy asset library.
77 .. code-block::
79    ./blender_addon/bl_pkg/cli/blender_ext.py dummy-repo \
80       --repo-dir=/path/to/host/my/repo/files \
81       --package-names="blue,red,green,purple,orange"
83 This will populate the directory specified as ``--repo-dir`` with dummy assets packages (``.zip``),
84 and an index (``bl_ext_repo.json``).
87 Setup an Extensions Repository
88 ==============================
90 First you need to create individual packages for the individual extension:
92 - Go to the directory of the extension you want to package.
93 - Create a ``bl_ext_pkg.toml`` file with your configuration.
94 - Run the command ``blender_ext.py build``.
96 You can look at an example of a dummy extension in the ``example_extension`` directory.
98 .. code-block::
100    cd ./example_extension
101    ../blender_addon/bl_pkg/cli/blender_ext.py build
103 This will create a ``my_example_package.zip`` (as specified in the .toml file).
105 Now you can move all your ``*.zip`` packages to where they will be hosted in the server.
106 The final step is to create an index file to serve all your packages.
108 .. code-block::
110    mkdir -p /path/to/host/my/repo/files
111    cp ./example_extension/my_example_package.zip /path/to/host/my/repo/files
112    ./blender_addon/bl_pkg/cli/blender_ext.py server-generate --repo-dir /path/to/host/my/repo/files
114 This will generate a new file ``bl_ext_repo.json`` in your repository directory.
115 This file is to be used the entry point to your remote server.
117 Alternatively, if you are doing tests locally,
118 you can point the directory containing this file as the ``Remote Path`` to your Extensions Repository.
121 .. This section could go elsewhere, for now there is only a single note.
123 Requirement: Add-Ons
124 ====================
126 Add-ons packaged as extensions must use relative imports when importing its own sub-modules.
127 This is a requirement of Python module name-spacing.
130 Requirement: Blender 4.2
131 ========================
133 This add-on requires an yet-to-be released version of Blender.
135 You can download a `daily build <https://builder.blender.org>`__ of Blender 4.2 for testing and development purposes.