23 Commits

Author SHA1 Message Date
Bastien Montagne
b8febd87e1 Fix #121712: outdated mapping between UI translations and Doc languages.
Both lists got heavily out of sync over the years.

Some day would be nice to have this managed in a single place.
2024-05-14 16:53:00 +02:00
Campbell Barton
5088b0154d Cleanup: replace %-formatting with str.format in scripts/modules/
The "bl_i18n_utils" module has been excluded I'm not sure how best
to run it with reasonable code coverage.
2024-04-27 16:06:51 +10:00
Campbell Barton
dd864603f1 Cleanup: minor change to string formatting & __file__
Use __repr__ for formatting file instead of __str__ because non-standard
characters will be escaped and the string will be properly quoted.

Also, a modules __file__ is not *guaranteed* to be a string
(although it almost always is), nevertheless, __repr__ generally
results more more humanly readable results.

Note that __repr__ was already used to format __file__ in most places.
2024-04-27 11:58:02 +10:00
Campbell Barton
44defbd2c7 Extensions: add BLENDER_USER_EXTENSIONS user directory
Replace: `{BLENDER_RESOURCE_PATH_USER}/extensions`
With:    `{BLENDER_USER_EXTENSIONS}`

This follows BLENDER_USER_CONFIG & BLENDER_USER_SCRIPTS conventions.
Reading the environment variable and accessible via
`bpy.utils.user_resource('SCRIPTS')`
2024-03-22 16:08:25 +11:00
Campbell Barton
6bfc8612bf Cleanup: remove BLENDER_USER_AUTOSAVE
This was only used on WIN32 when the temporary directory didn't exist.
When the check was added [0] this made some sense because it relied on
`U.tempdir` existing, since then additional checks have been added to
ensure a temporary directory can be used. Further, this fall-back
location isn't documented in the user manual.

[0]: 615db01b01c4ad96d8e712aa5469d9eb3ada0d07
2024-03-22 16:08:25 +11:00
Campbell Barton
9372e0dfe0 CLI: support defining custom commands via C++ & Python API
Add support for add-ons to define commands using the new argument
`-c` or `--command`.

Commands behave as follows:

- Passing in a command enables background mode without the need to pass
  in `--background`.
- All arguments following the command are passed to the command
  (without the need to use the `--` argument).
- Add-ons can define their own commands via
  `bpy.utils.register_cli_command` (see examples in API docs).
- Passing in `--command help` lists all available commands.

Ref !119115
2024-03-08 11:10:13 +11:00
Campbell Barton
a8e73616b9 Cleanup: rename add-on related variables for clarity
- Rename info to bl_info, to avoid confusion with extensions manifest,
  which should eventually be accessible in a similar way.
- Rename module_name to addon_module_name to avoid confusion with
  extension repositories name-spaced modules.
- Clarify naming for TOML manifest.
2024-02-01 17:03:40 +11:00
Campbell Barton
06705c5864 PyAPI: support bpy.utils.register_tool without a keyconfig set 2023-12-20 13:05:20 +11:00
Campbell Barton
08e5f94a70 Fix #113309: Broken key-map after "Reload Scripts"
Regression caused by [0]. Resolve by adding a 'keep_properties' argument
to KeyConfig.update so the key-map items can be restored after the
operators have been reloaded.

[0]: 88a875ec3ae89b7a6d31b398aad02a415b519694
2023-10-13 14:37:48 +11:00
Campbell Barton
8d62b7c01c Fix fast-path addon_utils._initialize_once not being used on startup
Changes to initialization from [0] accidentally reverted renaming
_initialize to _initialize_once.

[0] 6de294a1915217c4711def25532d3d4b728b84d1
2023-09-15 17:00:46 +10:00
nutti
e55599c120 Python API: Fix docstring about bpy.utils.load_scripts
Document layout of `bpy.utils.load_scripts` is collapsed due to the invalid format of docstring.
This PR fix it.

Pull Request: https://projects.blender.org/blender/blender/pulls/112127
2023-09-08 14:16:01 +02:00
Campbell Barton
7df693b70d Fix crash loading Blender when the key-configuration fails to load
An error in the key-map could cause the default keymap to be removed
leaving Blender without a default keymap.

Prevent the crash, even though Blender wont be usable in this state.
2023-09-06 14:23:05 +10:00
Campbell Barton
a191e113c4 Cleanup: remove redundant preset lookup loading the default key-config 2023-09-06 14:23:02 +10:00
Campbell Barton
6de294a191 PyAPI: postpone loading add-ons until after key-maps have been defined
Loading add-ons after key-maps resolves a problem where add-ons would
setup shortcuts before Blender had created the key-maps.
Making add-ons have to declare the key-maps using region & window types
matching Blender's internal values.

This PR a pitfall pointed out in #110030.

Ref !110092
2023-09-05 11:35:14 +10:00
Campbell Barton
88a875ec3a Fix #111702: Crash accessing KeyMapItem.properties on script reload 2023-08-31 12:04:30 +10:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Campbell Barton
49f342d742 Cleanup: rename addon_utils._initiazlize to _initiazlize_once
Make it clear this is only intended to be called once.
2023-08-09 20:29:33 +10:00
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Campbell Barton
c4c1cc7cd3 Cleanup: double quotes for non-enum strings
Also use back-ticks for code-references in comments.
2023-04-18 10:51:32 +10:00
Julian Eisel
ac09d18e4e Fix #106840: Add-ons not loading from custom script directories
`script_paths()` wasn't updated correctly, but that was hidden by some
compabtibility logic that was in the patch earlier. Only with my last
change to the PR before merging it that was removed and the error became
quite visible.
2023-04-12 13:02:31 +02:00
Julian Eisel
ba25023d22 Python: Support multiple custom script directories in Preferences
Makes it possible to select multiple custom script directories in Preferences >
File Paths, replacing the single Scripts path option. Each of these directories
supports the regular script directory layout with a startup file (or files?),
add-ons, modules and presets.
When installing an add-on, the script directory can be chosen.

NOTE: Deprecates the `bpy.types.PreferencesFilePaths.script_directory`
property, and replaces `bpy.utils.script_path_pref` with
`bpy.utils.script_paths_pref`.

Pull Request: https://projects.blender.org/blender/blender/pulls/104876
2023-04-11 15:20:52 +02:00
Hans Goudey
cef82a1d39 Cleanup: Grammar: "it's" vs "its" 2023-03-24 08:34:21 -04:00
Sergey Sharybin
03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00