Files
test/source/blender/makesdna/DNA_userdef_defaults.h
Campbell Barton 31cb31d736 PyAPI: add-on name-spacing for extension repositories
Support name-spaced add-ons, exposed via user configurable extension
repositories.

Directories for add-ons can be added at run-time and are name-spaced to
avoid name-collisions with Python modules or add-ons from other
repositories.

This is exposed as an experimental feature "Extension Repositories".

Details:

- A `bUserExtensionRepo` type which represents a repository which is
  listed in the add-ons repository.

- `JunctionModuleHandle` class to manage a package with sub-modules
  which can point to arbitrary locations.

- `bpy.app.handlers._extension_repos_update_{pre/post}` internal
  callbacks run before/after changes to extension repositories,
  callbacks are used to sync the changes to the Python package that
  exposes these to add-ons.

- The size of an add-on name has been increased so a user-defined package
  prefix can be included without enforcing shorter add-on names.

- Functionality relating to package management has been left out of this
  change and will be developed separately.

Further work:

- While a repository can be renamed, enabled add-ons aren't renamed.
  Eventually we might want to support this although we could also
  disallow renaming repositories with add-ons enabled as the name isn't
  all that significant.

- Removing a repository should remove all the add-ons located in this
  repository.

- Sub-module names are currently restricted to `[A-Za-z]+[A-Za-z0-9_]*`
  we might want to relax this to allow unicode characters (we might
  still want to disallow `-` or any characters that would prevent
  attribute access in code).

Ref !110869.

Reviewed By: brecht
2023-08-09 20:24:24 +10:00

44 lines
836 B
C

/* SPDX-FileCopyrightText: 2023 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup DNA
*/
#pragma once
#include "DNA_asset_types.h"
/* Struct members on own line. */
/* clang-format off */
/* -------------------------------------------------------------------- */
/** \name bUserAssetLibrary Struct
* \{ */
#define _DNA_DEFAULT_bUserAssetLibrary \
{ \
.import_method = ASSET_IMPORT_APPEND_REUSE, \
.flag = ASSET_LIBRARY_RELATIVE_PATH, \
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name bUserExtensionRepo Struct
* \{ */
#define _DNA_DEFAULT_bUserExtensionRepo \
{ \
.name = {'\0'}, \
.module = {'\0'}, \
.dirpath = {'\0'}, \
.remote_path = {'\0'}, \
.flag = 0, \
}
/** \} */
/* clang-format on */