Commit Graph

550 Commits

Author SHA1 Message Date
Campbell Barton
1563ba7e6c Fix #128175: Updating extension can remove the extension on WIN32
On Windows an entire directory may be locked when any files inside it
are opened by another process. This can cause operations that
recursively remove a directory (uninstalling & updating) to fail
with a partially removed extension.

The case of uninstalling was already handled, where failure to remove
a directory would stage the extension for later removal.
In the case of updating however, the user could be left with a broken
(partially removed) extension where some files were removed, as the
directory was locked, the update would fail to extract new files.

Address this issue by renaming the directory before recursive removal.

The following logic has been implemented:

- If any files in the directory are locked, renaming will fail.
  So even though the operation fails the extension is left intact.

- If renaming succeeds, it's possible to apply the update.

  While it's possible (albeit unlikely) recursive removal fails,
  which could be caused by file-system permissions issues corruption or
  a process could open a file between rename & removal.

  In this case the renamed directory is staged for later removal.

Other changes:

- Resolve a related problem where the user could install an
  extension previously staged for removal, now installing an extension
  ensured it's not removed later.

  This would occur if uninstalling failed, the user resolves
  directory-lock, uninstalls again, then re-installs the extension.

- When an extension fails to be removed, don't attempt to remove
  user configuration for that extension.

  Prefer to keep the extension & it's settings in their "current state"
  if it can't be removed.
2024-10-03 12:15:27 +10:00
Campbell Barton
0b69e1d6f5 Cleanup: double quotes for strings, replace f-string with str.format 2024-10-02 15:46:11 +10:00
Campbell Barton
729004390d Cleanup: quiet pylint warnings for extensions 2024-10-01 16:07:05 +10:00
Campbell Barton
38c30c5c43 Extensions: resolve test failing
Enable the extensions add-on by default, without this, it's enabled
on startup, causing the preferences to be tagged as modified.
2024-10-01 15:36:54 +10:00
Campbell Barton
22cdf8da1e Extensions: only apply SSL workaround for Python older than 3.12.6
Skip the workaround for versions of Python that contain the fix.
2024-10-01 13:06:05 +10:00
Campbell Barton
0afce08c20 Cleanup: use Python format specifiers 2024-10-01 10:14:48 +10:00
Campbell Barton
6cbdf0223b Cleanup: defer imports on startup 2024-10-01 10:01:16 +10:00
Campbell Barton
a9dee36974 Cleanup: remove unused variables, imports 2024-09-27 23:37:18 +10:00
Julien Duroure
3cfeebe7c7 glTF exporter: fix crash managing shader node groups
Happen when multiple link on the same socket
2024-09-26 15:22:13 +02:00
Julien Duroure
98a7aa2c41 glTF importer: Fix #127829: Importing Vertex Color on points / edges primitives 2024-09-26 15:11:43 +02:00
Julien Duroure
0208582c16 glTF exporter: Fix exporting Vertex Color on point/edge 2024-09-26 15:02:47 +02:00
Julien Duroure
d5f1ff250b glTF exporter: fix crash using full collection hierarchy export 2024-09-26 14:51:15 +02:00
notrudyyy
1939eb03a7 Refactor: Mesh: Normalize input normals in set custom normals
To reduce code duplication in importers, modifies the C++
set_custom_normals API functions to normalize the input normals.

Reverts !124336, !124267, and !124261 as the normalization now
occurs in the API call.

Resolves #124358.

Pull Request: https://projects.blender.org/blender/blender/pulls/127814
2024-09-19 20:12:40 +02:00
Jesse Yurkovich
b8f236510d Fix: error in node wrangler format string 2024-09-16 04:50:18 +02:00
Jacques Lucke
92febd5fb2 Fix: error in node wrangler format string 2024-09-14 13:29:45 +02:00
Mateusz Grzeliński
6822e61c6f Fix #126792: "extension install" sub-command fails to install
Do not report error when local repo does not have manifest and we are
asking for remote repositories.
If the errors list is filled with any error the operation is considered
failure.

Ref: !127360
2024-09-13 16:43:49 +10:00
Julien Duroure
00bc059894 glTF: Fix typo in a previous commit 2024-09-12 15:50:58 +02:00
Julien Duroure
a9bfca5483 glTF exporter: fix missing hook parameters leading to crash 2024-09-12 15:41:00 +02:00
Julien Duroure
0169abd220 glTF exporter: account for library when gathering image URI
When using "keep original" option
2024-09-12 15:19:32 +02:00
Julien Duroure
044d20fe46 glTF importer: Fix light spot default values check 2024-09-12 12:05:48 +02:00
Julien Duroure
4c441c1c64 glTF exporter: fix accessor min/max float check 2024-09-12 12:02:51 +02:00
Julien Duroure
936ca7636a glTF exporter: Removes a duplicate lookup 2024-09-12 11:49:16 +02:00
Julien Duroure
89c389c465 glTF: hook UI, distinct import & export draw code 2024-09-12 11:42:22 +02:00
Campbell Barton
54153629f4 Fix #127329: Keyboard interrupt doesn't work from Python 2024-09-11 14:30:51 +10:00
Julien Duroure
780721de19 glTF exporter: fix error message if hook failed 2024-09-01 15:16:27 +02:00
Julien Duroure
c132bd896f glTF exporter: children type check refactoring 2024-08-30 06:56:34 +02:00
Julien Duroure
11451a2082 glTF export: Add logging level control for export
This was already the case at import
2024-08-30 06:48:07 +02:00
Julien Duroure
4dad2a567d glTF: Use wait cursor instead of empty % cursor 2024-08-30 06:43:52 +02:00
Julien Duroure
8d575d3c85 glTF exporter: Enable exporting joint leaf at tail of leaf bones 2024-08-30 06:42:26 +02:00
Julien Duroure
5122255739 glTF: Manage Quaternion and Matrix attribute types for custom attributes 2024-08-30 06:39:52 +02:00
Julien Duroure
58141b7396 glTF exporter: set udim material names with tile number 2024-08-30 06:37:34 +02:00
Julien Duroure
69ab986370 glTF exporter: Regression: RGB to Shader socket unlit management 2024-08-30 06:29:42 +02:00
Julien Duroure
7c6975f6c8 glTF exporter: avoid double export
Make sure to not check instances inside instances collection when GN instance is enable.
2024-08-30 06:26:47 +02:00
Julien Duroure
6191eb1e9d glTF exporter: Fix custom prop when apply modifier
Since 4.2, props are Statically Typed
so no need to copy them in that case, because overwriting them will crash
2024-08-30 06:23:11 +02:00
Julien Duroure
42840ded01 glTF exporter: Fix UI after Blender changes 2024-08-30 06:20:04 +02:00
Julien Duroure
4e5093130c Fix #126920 glTF: Cleanup - file renaming
Long filepaths cannot be unzipped (by default) on Windows, so cleaning filenames to avoid too long paths
2024-08-30 06:00:10 +02:00
Alaska
2fd2af86e8 Fix incorrect export FBX time
Ref: !125717
2024-08-28 12:30:56 +10:00
Andrej730
798fbe7dbd Fix: Typo in extensions repository lock info message
`Fore` -> `Force`

Pull Request: https://projects.blender.org/blender/blender/pulls/126778
2024-08-26 12:28:52 +02:00
Bastien Montagne
c1aef6b4b0 Cleanup: make format 2024-08-19 14:26:53 +02:00
Bastien Montagne
d3589270d4 I18N tools: disable multi-processing for the time being.
Not sure why, but today I got almost systematic deadlocks in the
ProcessPoolExecutor calls (and similar issues with direct usage of
multiprocessing)... For now synchronous single process will do.
2024-08-19 13:52:48 +02:00
Campbell Barton
8a7ff41a85 Cleanup: wrap long lines in Python scripts 2024-08-19 10:48:07 +10:00
Bastien Montagne
473456323f I18N: Extraction tools: Add timeout to async multi-processing.
Once in a while these get (dead)locked for some reason, at least avoid
having to kill the whole Blender then.
2024-08-12 13:00:46 +02:00
Bastien Montagne
7d52265771 Fix several issues with i18n tools on non-linux platforms.
- Paths of C++-parsed files were not properly 'unixified' on Windows.
  This was bad both for changes noisyness in PO files, and broke on
  the un-escaping of `\n` and `\t` sequences.
- The `ProcessPoolExecutor` starts sub-processes differently on Linux
  than on Windows or OSX. While Linux's `fork` keeps the same
  environment (i.e. all Blender stuff remains available in workers
  subprocesses), the 'spawn' used on Windows (and reportedly OSX) starts
  a new bare python interpreter. This means that code executed by these
  needs to be Blender-agnostic to be portable.

The only thing that is currently known broken on non-Linux platforms is
the RTL processing of some languages like Arabic or Hebrew.
2024-08-10 17:35:28 +02:00
Campbell Barton
f8e06a5f5f Fix #125763: Uninitialized extension repos printing warnings on startup
Since [0] missing repository directories printed a warning on startup.

When checking for blocked extensions on startup, skip directories
that don't exist & don't print any warnings if the repository data
hasn't been downloaded.

[0]: 656fe6d3e4
2024-08-06 20:53:41 +10:00
Campbell Barton
fc6a99e0d2 Fix #77837: Error removing addons/extension/wheels on WIN32
When deleting files on WIN32, open files cannot be removed.
This is especially a problem for compiled Python modules which
remain open once imported.

Previously it was not as common for add-ons to include compiled Python
modules however with extensions supporting Python-wheels,
it's increasingly likely users run into this.

Workaround the problem by:
- Scheduling the files for removal next time Blender starts.
- Rename paths that cannot be removed to avoid collisions when
  the paths is reused (re-installing for example).

This is supported for:
- Extensions.
- Python wheels.
- Legacy user add-ons.
- App-templates.

Details:
- On startup, a file exists that indicates cleanup is needed.
  In the common case the file doesn't exist.
  Otherwise module paths are scanned for files to remove.
- Since errors resolving paths to remove could result in user data loss,
  ensure the paths are always within the (extension/addon/app-template)
  directory.
- File locking isn't used, if multiple Blender instances start at the
  same time and try to remove the same files, this won't cause errors.
  Even so, remove the checking file immediately avoid unnecessary
  file-system access overhead for other Blender instances.

Also resolves #125049.
2024-08-05 09:49:14 +10:00
Campbell Barton
805f66c5c4 Extensions: restore fix for removing extensions with symlinks
Regression from [0], removed the fix for #123827.

[0]: 08b75549e3
2024-08-04 20:52:00 +10:00
Campbell Barton
ef505727c6 Fix error where upgrading an extension always enabled it
Upgrading disabled extensions should never enable them.
2024-07-31 13:50:22 +10:00
Campbell Barton
14b03fca3c PyAPI: add bpy.app.python_args, use when calling Python from Blender
Expose arguments to use when creating a Python sub-process.

Python could fail to start when loaded in a customized environment,
with PYTHONPATH set for e.g. Blender ignores these and loads but a
Python sub-process attempts to use these environment variables which
may point to incompatible Python versions.

Resolve the root cause of #124731.
2024-07-31 11:59:23 +10:00
Sybren A. Stüvel
ba1f7caffa Fix #125226: Anim: Rigify limbs.spline_tentacle doesn't generate correctly
A template string was accidentally turned into an f-string in
78b9218c98, which changes the way it is
evaluated. Easy enough to roll back that one change.
2024-07-30 16:13:27 +02:00
Campbell Barton
3a88af5402 Fix #125660: Extensions fail to sync HTTPS repositories on WIN32
Workaround: `[ASN1] nested asn1 error` error when making HTTPS
connections on systems with certificates that OpenSSL cannot parse
are installed.

This is a general issue with Python, resolve by applying a proposed
fix [0] to the extensions Python process at run-time.
(this doesn't impact Blender's Python run-time).

The down side is HTTPS connections will only work for extensions
on systems with this problem so this needs to be resolved by Python
long term.

While any changes to Python's SSL checks is worth avoiding,
this simply skips SSL certificates in the windows store that OpenSSL
can't parse instead of failing all SSL connections.

See related issues:

- https://github.com/python/cpython/issues/79846
- https://github.com/openssl/openssl/issues/25023

[0]: https://github.com/python/cpython/pull/91740

Ref !124943.
2024-07-30 22:49:21 +10:00