Commit Graph

61 Commits

Author SHA1 Message Date
Miguel Pozo
4c314f9a78 GPU: Add --gpu-compilation-subprocesses cmd setting
Allow overriding the `max_parallel_compilations` from the command
line.
Disable compilation subprocesses on RenderDoc sessions.

Pull Request: https://projects.blender.org/blender/blender/pulls/123995
2024-07-01 16:36:01 +02:00
Campbell Barton
67ddb0e1a5 Extensions: detect external changes on startup & loading preferences
Changes to an extensions manifest weren't accounted for.
This was particularly a problem for "System" extensions which aren't
intended to be managed inside Blender however the problem existed for
any changes made outside of Blender.

Now enabled extensions are checked on startup to ensure:

- They are compatible with Blender.
- The Python wheels are synchronized.

Resolves #123645.

Details:

- Any extension incompatibilities prevent the add-on being enabled
  with a message printing the reason for it being disabled.

- Incompatible add-ons are kept enabled in the preferences to avoid
  loosing their own preferences and allow for an upgrade to restore
  compatibility.

- To avoid slowing down Blender's startup:

  - Checks are skipped when no extensions are enabled
    (as is the case for `--factory-startup` & running tests).
  - Compatibility data is cached so in common case,
    the cache is loaded and all enabled extensions `stat` their
    manifests to detect changes without having to parse them.
  - The cache is re-generated if any extensions change or the
    Blender/Python version changes.

- Compatibility data is updated:

  - On startup (when needed).
  - On an explicit "Refresh Local"
    (mainly for developers who may edit the manifest).
  - When refreshing extensions after install/uninstall etc.
    since an incompatible extensions may become compatible
    after an update.
  - When reloading preferences.

- Additional info is shown when the `--debug-python` is enabled,
  if there are ever issues with the extension compatibility cache
  generation not working as expected.

- The behavior for Python wheels has changed so they are only setup
  when the extension is enabled. This was done to simplify startup
  checks and has the benefit that an installed but disabled extension
  never runs code - as the ability to install wheels means it could
  have been imported from other scripts. It also means users can disable
  an extension to avoid wheel version conflicts.

  This does add the complication however that enabling add-on which is
  an extension must first ensure it's wheels are setup.
  See `addon_utils.extensions_refresh(..)`.

See code-comments for further details.
2024-07-01 15:08:14 +10:00
Campbell Barton
3acff7a8a1 Correct help text for system extensions
Group `--env-system-extensions` with related arguments.
2024-06-07 12:16:21 +10:00
Campbell Barton
dc9430c480 Extensions: support system repositories & BLENDER_SYSTEM_EXTENSIONS
Support for "System" extensions as an alternative to the current
"User" extensions repository.

The purpose of this change is to support bundling extensions for
offline work or in environments where users setting up thier own
extensions isn't desirable, see #122512.

Details:

The default "System" repository on Linux will for example use:
- `/usr/share/blender/4.2/extensions/{system}` For system installs.
- `./4.2/extensions/{system}` For portable installs.

- Blender's default startup now has a "System" repository
  which users or administrators may populate.

- Repositories can select between User/System paths,
  setting a custom path overrides overrides this setting.

- Add "BLENDER_SYSTEM_EXTENSIONS" (matching "BLENDER_LOCAL_EXTENSIONS").

Ref !122832
2024-06-07 11:36:20 +10:00
Brecht Van Lommel
f7797a90f6 Core: Make BLENDER_SYSTEM_SCRIPTS always add paths
Originally this would replace scripts that come bundled with Blender,
but it's unclear how this is useful.

Searching for this online mainly leads to people asking how they can
use it to add scripts. For example in a studio environment you might
want to deploy add-ons and startup scripts for all users.

Even if you wanted to use it for replacement though, it wasn't really
doing that and inconsistent for different types of scripts:

* startup: ignored
* modules: replaces bundled scripts
* presets: adds to bundled scripts
* addons (in 4.1): ignored
* addons_core (in 4.2): ignored
* startup/bl_app_templates_system: replaces bundled scripts

This change makes it add scripts from this path for all. This is a
breaking change, though arguably this feature was just broken to
begin with and not used much in practice because of that.

The alternative would be add a new set of environment variables to
avoid breaking existing behavior. But that also means keeping around the
broken behavior or fixing it in another way.

Supporting multiple paths may be used too, but for now just support
a single one as doing this for all BLENDER_SYSTEM variables is
non-trivial. The main use case for that would be add-ons anyway, and
those will mainly be handled through upcoming
BLENDER_SYSTEM_EXTENSIONS instead.

Ref #122512

Pull Request: https://projects.blender.org/blender/blender/pulls/122689
2024-06-06 15:28:44 +02:00
Harley Acheson
3a2ea7828e Fix #122599: Windows Registration/Unregistration Endless Loop
With #120283 the Win32 codepath for registration creates an endless
loop. Command-line arguments are detected for registration that causes
another blender to launch with the same arguments, that repeats
forever. But the only time these arguments is used is when Blender has
already been specifically launched with the permissions needed to
register. So this means it should just do so and then exit.

Pull Request: https://projects.blender.org/blender/blender/pulls/122682
2024-06-03 19:59:31 +02:00
Campbell Barton
e3a6eed5c5 Cleanup: correct function name spelling 2024-05-29 12:49:07 +10:00
Campbell Barton
57c023d580 Preference: add option allow internet access
Add a preference to "Work Offline" system preference as well as command
line options `--offline-mode` & `--online-mode`
(which overrides the preference).
This option is displayed in the initial setup screen too.

This is currently respected by:

- Check for updates on startup
- Disables running an update when enabling extensions.

When Blender is launched with `--offline-mode` the option cannot be
enabled in the preferences. This is intended for environments
where internet access is intentionally disallowed.

Background: with Blender supporting access to online-repositories
as well as 3rd party extensions themselves potentially accessing the
internet. This setting provides a way for users to disable online
functionality.

This prevents error messages when online access fails in environments
without internet access as well as the ability for users who prefer
Blender doesn't access the internet to have one place to turn this off.

While it does not enforce limitations on add-ons, 3rd party scripts
are expected to respect this setting using `bpy.app.internet_offline`.

The details for this will be handled along with other policies scripts
are expected to follow.

Ref !121994
2024-05-23 13:50:06 +10:00
Alaska
9320ee2a36 Print Blender branch when running --version command
Ref: !121769
2024-05-14 14:33:35 +10:00
Campbell Barton
cb93603fb3 Cleanup: remove script-id for Python command line error message
While additional context is typically useful to include,
this is such a corner-case that it's not expected script authors
would run into this during regular development.
2024-04-26 14:04:58 +10:00
Campbell Barton
9cb3a17352 Linux: freedesktop support for file type association
Support freedesktop file association on Linux/Unix via the command line
arguments: `--register{-allusers}` `--unregister{-allusers}` as well
registration actions from the user preferences.

Once registered, the "Blender" application is available from launchers
and `*.blend` files are assoisated with the blender binary used for
registration.

The following operations are performed:

- Setup the desktop file.
- Setup the file association & make it default.
- Copy the icon.
- Setup the thumbnailer (`--register-allusers` only).

Notes:

- Registering/unregistering for all users manipulates files under
  `/usr/local` and requires running Blender as root.
  From the command line this can be done using `sudo`, e.g.
  `sudo ./blender --register-allusers`.
  From the GUI, the `pkexec` command is used.

- Recent versions of GNOME execute the thumbnailer in a restricted
  environment (`bwrap`) requiring `blender-thumbnailer` to be copied
  into `/usr/local/bin` (synlinks don't work).
  So thumbnailing copies the binary rather than linking and only works
  when registering for all users.

Ref !120283
2024-04-18 11:19:00 +10:00
Jeroen Bakker
c15e5116ab Vulkan: MoltenVK Support for Developers
MoltenVK original intent was to let developers work on a mac system developing
for the vulkan eco-system. MoltenVK doesn't support all the features that we
require and would require additional workarounds to be actually supported.

It is not expected that we will release Blender with MoltenVK for this reason.
But it still has value for shader developers to validate shaders on metal and
vulkan on a single platform.

![image](/attachments/9a4a9904-a5f6-4922-896d-744dfb78244c)

Pull Request: https://projects.blender.org/blender/blender/pulls/117940
2024-04-11 11:04:43 +02:00
Campbell Barton
d3ae39571e Fix crash using "--command" on Windows
Use after free error accessing command line arguments on windows.
Resolve by duplicating the arguments when a "--command" is passed in.
2024-04-10 11:52:54 +10:00
Campbell Barton
800e470ced Fix crash running a script without any context data
While calling into scripts with an empty `Main` shouldn't be possible
under normal circumstances, I ran into this during development.

This situation is meant to print an error, add a null check so it works
as expected.
2024-04-05 11:43:00 +11:00
Campbell Barton
204d282c75 Refactor: generalize deferred command line argument execution
Making arguments call into Python was impractical because Python
is only initialized for ARG_PASS_FINAL.

Replace "--command" specific logic with a general method of arguments
requesting to be executed once all sub-systems have been initialized.

Without this, the `main()` function needs hard coded logic to support
any time an argument needs to use Python internally.
2024-04-05 11:31:56 +11:00
Campbell Barton
82904454b4 Docs: tweak help text & correct punctuation 2024-04-04 11:18:56 +11:00
Hans Goudey
8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01: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
8ac9b4ca46 Cleanup: use full sentences for code-comments
Also correct references source files.
2024-03-19 13:57:00 +11:00
Campbell Barton
eabff7334d Merge branch 'blender-v4.1-release' 2024-03-08 20:58:33 +11:00
Campbell Barton
738c1b6ca9 Docs: correct typo & terms in --help text 2024-03-08 20:57:56 +11:00
Campbell Barton
8cbb57ee0a CLI: suppress noisy prints when running commands
Messages such as "Blender quit" get in the way of custom commands,
add G.quiet to suppress noisy "info" prints.
2024-03-08 13:27:29 +11:00
Campbell Barton
ba3c9e1661 Cleanup: de-duplicate logic for setting background mode 2024-03-08 12:57:34 +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
5fdd684550 Merge branch 'blender-v4.1-release' 2024-03-05 10:20:52 +11:00
Campbell Barton
8842982dbd Docs: note the temporary directory will be ignored unless it exists
Other minor changes:

- Remove reference to `TMP` environment variable in the `--help` text
  as this isn't a posix standard and is noted as something that may be
  removed in the future.
- Show WIN32 `TEMP` when showing all help text so it will be included
  in the user manual.
2024-03-05 10:19:16 +11:00
Brecht Van Lommel
0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564ad2.
2024-02-19 15:59:59 +01:00
Hans Goudey
81a63153d0 Despgraph: Rename "copy-on-write" to "copy-on-evaluation"
The depsgraph CoW mechanism is a bit of a misnomer. It creates an
evaluated copy for data-blocks regardless of whether the copy will
actually be written to. The point is to have physical separation between
original and evaluated data. This is in contrast to the commonly used
performance improvement of keeping a user count and copying data
implicitly when it needs to be changed. In Blender code we call this
"implicit sharing" instead. Importantly, the dependency graph has no
idea about the _actual_ CoW behavior in Blender.

Renaming this functionality in the despgraph removes some of the
confusion that comes up when talking about this, and will hopefully
make the depsgraph less confusing to understand initially too. Wording
like "the evaluated copy" (as opposed to the original data-block) has
also become common anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/118338
2024-02-19 15:54:08 +01:00
Campbell Barton
7582b15c4c Cleanup: spelling in comments 2024-02-16 14:26:46 +11:00
Campbell Barton
55adfdc7af Merge branch 'blender-v4.1-release' 2024-02-15 21:22:52 +11:00
Jeroen Bakker
f72fdcf4ae GPU: Validate All Statically Defined Shaders As Argument
This PR adds a new command line argument to validate all statically
defined shaders. It is useful for platform support to understand
what isn't working.

It only checks statically defined shaders. Dynamic shaders (EEVEE/Compositor)
can still be fail.

The report is printed to console. After checking with windows platform and
triaging we could also add it to gpu debug script. There is a risk of adding it there
as it might crash and don't store any output.

Pull Request: https://projects.blender.org/blender/blender/pulls/117326
2024-02-15 08:13:44 +01:00
Campbell Barton
7c90018f23 CLI: make "-noaudio" implicit with "-b/--background"
Running background mode now behaves as if the "-noaudio" was passed in.

The -setaudio command now has a "Default" option which can be used
in the rare cases audio playback is desired in background mode. e.g.

  blender --background -setaudio Default

Ref !118192
2024-02-14 00:13:37 +11:00
Campbell Barton
903a76031a Cleanup: unused includes in source/creator
Remove 7 includes.
2024-02-13 19:14:48 +11:00
Bastien Montagne
5aaadebbe4 Cleanup: Make BKE_scene.h a full Cpp header. 2024-02-10 19:16:25 +01:00
Bastien Montagne
29fe777445 Cleanup: Make BKE_report.h a full Cpp header. 2024-02-10 18:34:29 +01:00
Bastien Montagne
54618dbae3 Cleanup: Make BKE_global.h a Cpp header. 2024-02-10 18:25:14 +01:00
Damien Picard
fa77e9142d UI: fix and improve a few messages
- "can not" -> "cannot" in many places (ambiguous, also see
  Writing Style guide).
- "Bezier" -> "Bézier": proper spelling of the eponym.
- Tool keymaps: make "Uv" all caps.
- "FFMPEG" -> "FFmpeg" (official spelling)
- Use MULTIPLICATION SIGN U+00D7 instead of MULTIPLICATION X U+2715.
- "LClick" -> "LMB", "RClick" -> "RMB": this convention is used
  everywhere else.
- "Save rendered the image..." -> "Save the rendered image...": typo.
- "Preserve Current retiming": title case for property.
- Bend status message: punctuation.
- "... class used to define the panel" -> "header": copy-paste error.
- "... class used to define the menu" -> "asset": copy-paste error.
- "Lights user to display objects..." -> "Lights used...": typo.
- "-setaudio require one argument" -> "requires": typo.

Some issues reported by Joan Pujolar and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/117856
2024-02-05 17:08:17 +01:00
Jacques Lucke
311ca3e6af Core: rename Session UUID to Session UID
`UUID` generally stands for "universally unique identifier". The session identifier that
we use is neither universally unique, nor does it follow the standard. Therefor, the term
"session uuid" is confusing and should be replaced.

In #116888 we briefly talked about a better name and ended up with "session uid".
The reason for "uid" instead of "id" is that the latter is a very overloaded term in Blender
already.

This patch changes all uses of "uuid" to "uid" where it's used in the context of a
"session uid". It's not always trivial to see whether a specific mention of "uuid" refers
to an actual uuid or something else. Therefore, I might have missed some renames.
I can't think of an automated way to differentiate the case.

BMesh also uses the term "uuid" sometimes in a the wrong context (e.g. `UUIDFaceStepItem`)
but there it also does not mean "session uid", so it's *not* changed by this patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/117350
2024-01-22 13:47:13 +01:00
Bastien Montagne
d8d44a62f7 Cleanup: Move BKE_appdir.h to full Cpp header BKE_appdir.hh. 2024-01-21 19:42:13 +01:00
Aras Pranckevicius
a705259b4b Cleanup: move imbuf .h files to .hh 2024-01-19 20:29:38 +01:00
Hans Goudey
3e76a1a6c2 Cleanup: Move BKE_lib_id.h to C++ 2024-01-15 12:44:14 -05:00
Damien Picard
a1efde2727 Creator: update image formats shown in the CLI help
Update the command line help message to reflect the actual image output
formats available.  Remove  mention of IRIZ and DDS, rename MPEG to
FFMPEG. HDR and TIFF are always valid now.

Pull Request: https://projects.blender.org/blender/blender/pulls/115987
2024-01-09 01:49:16 +01:00
Brecht Van Lommel
d377ef2543 Clang Format: bump to version 17
Along with the 4.1 libraries upgrade, we are bumping the clang-format
version from 8-12 to 17. This affects quite a few files.

If not already the case, you may consider pointing your IDE to the
clang-format binary bundled with the Blender precompiled libraries.
2024-01-03 13:38:14 +01:00
Bastien Montagne
f01bc93bcf Cleanup: Move BKE_blendfile headers to CPP. 2023-12-13 12:36:45 +01:00
Campbell Barton
9898602e9d Cleanup: clarify #ifndef checks in trailing #endif comments 2023-12-07 10:38:54 +11:00
Bastien Montagne
3acb64e7ac BKE_main: move header to be a fully CPP one.
Pull Request: https://projects.blender.org/blender/blender/pulls/115681
2023-12-01 20:38:54 +01:00
Hans Goudey
3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Campbell Barton
704985152e Refactor: initialize IMB after parsing settings
Avoid awkward kludges with IMB_init/exit & IMB_ffmpeg_init calls.

The animation player was responsible for calling IMB_exit, not IMB_init,
this complicated drag & drop which needed to re-internalize IMB before
returning.

Delay initializing IMB since none of the other argument handlers
depend on it, make wm_main_playanim_intern responsible for calling
both initialization & exit calls for IMB.

Also expand code comments for ARG_PASS_SETTINGS.
2023-11-09 13:58:00 +11:00
Campbell Barton
e23cb0c743 Cleanup: simplify animation player argument handling
The first argument was always ignored, this added a minor complication
to drag & drop as the new argument needed to have a dummy first argument.
2023-10-14 16:00:54 +11:00
Bastien Montagne
9859622a66 BKE_reports: make the API thread-safe.
This commit makes using (most of) `BKE_report` API safe in
multi-threaded situation.

This is achieved by adding a `std::mutex` lock to the `ReportList`
struct (in a slightly convoluted way unfortunately, due to this being a
DNA struct). This lock is then used to make most operations on
`Reportlist` data thread-safe.

Note that while working on this, a few other minor issues aroze in
existing usages of Reportlist by the WM code, mainly the fact that
`wm_init_reports` and `wm_free_reports` were both useless:
  - init was called in a context where there is not yet any WM, so it
    was doing nothing.
  - free was called on a WM that would be later freed (as part of Main
    freeing), which would also call cleanup code for its `reports` data.
Both have been removed.

Further more, `wm_add_default` (which is the only place where a WM ID is
created) did not initialize properly it reports data, this has been
fixed.

This change is related to the wmJob thread-safety tasks and PRs (#112537,
!113548).

Pull Request: https://projects.blender.org/blender/blender/pulls/113561
2023-10-13 11:29:59 +02:00