Commit Graph

2781 Commits

Author SHA1 Message Date
Campbell Barton
499a2b2b4b Cleanup: remove double-space in exception message 2024-03-13 17:12:51 +11:00
Campbell Barton
5fd64db1cf Merge branch 'blender-v4.1-release' 2024-03-12 16:39:59 +11:00
Campbell Barton
59cba89f1b Merge branch 'blender-v4.1-release' 2024-03-12 16:39:56 +11:00
Campbell Barton
1fa2a1a74d Fix error freeing bpy_struct sub-classes WITH_PYTHON_SECURITY enabled
Python's behavior changed since this feature was added causing the
object to be tracked when freed by Python's subtype_dealloc even
if Blender has not tracked the data. Detect this case and untrack
the object before freeing.
2024-03-12 16:37:36 +11:00
Campbell Barton
658ef7c730 Fix missing call to PyObject_GC_UnTrack WITH_PYTHON_SECURITY
Untrack all newly created objects, although this code-path only runs
when creating the type fails - which is an exceptional case.
2024-03-12 16:36:12 +11:00
Campbell Barton
5bb1c07fea Merge branch 'blender-v4.1-release' 2024-03-11 20:25:14 +11:00
Campbell Barton
e480b6a50c Fix error accessing the "__class__" on removed data
Accessing `__class__` on a removed object raised an exception, making
`isinstance(ob, cls)` unreliable. Always allow class access.

Resolves issue raised by blender/blender-addons!104958.
2024-03-11 20:23:26 +11:00
Campbell Barton
bd58a9fbbb Merge branch 'blender-v4.1-release' 2024-03-11 17:36:40 +11:00
Campbell Barton
7b4fb47298 Merge branch 'blender-v4.1-release' 2024-03-11 17:36:36 +11:00
Campbell Barton
e09f08fa78 Fix #119202: Crash closing the area with a temporary context
When restoring a temporary context, account for changes to the context
made by actions (typically operators) in the script.

There was an incorrect assumption that an override which didn't change
the current context would also be unchanged when restoring the temporary
context's original values.
2024-03-11 17:34:25 +11:00
Campbell Barton
5fe0213659 Fix error that let a temporary context restore a removed region
Missing check from [0] allowed a removed region to be set when exiting
the temporary context.

[0]: 1ec10323ff
2024-03-11 17:13:10 +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
Falk David
a11335d19a Cleanup: Move BKE_fcurve.h to C++
No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/119094
2024-03-05 18:39:08 +01:00
Campbell Barton
d27ddccc60 Cleanup: use macro to avoid repetition in BPY_init_modules 2024-03-05 13:54:17 +11:00
Bastien Montagne
de5451b112 Cleanup: Move BKE_anim_data header to be fully C++. 2024-02-28 11:51:03 +01:00
Campbell Barton
f7927faa34 Extensions: support dropping URL's to install extensions
The dropped URL's must be known to Blender as one of the URL's
referenced by an online repository.
2024-02-21 15:48:46 +11:00
Aras Pranckevicius
f09c7dc4ba Video: Remove non-ffmpeg AVI support
Blender had a very limited (only uncompressed or MJPEG frames) .avi file
support, for both reading and writing. This is something that ffmpeg can
fully do.

This removes all of that. 3500 lines of code gone, primary motivations being:
- ffmpeg can read and write .avi files just fine, including ones with
  uncompressed or MJPEG frames.
- Blender's ffmpeg integration could also be taught to produce uncompressed or
  MJPEG .avi files, but TBH I don't see a particular reason to do that. Modern
  formats like H264 are better in every way, and already support "lossless"
  option if needed.
- The "Lite" blender build configuration was excluding both ffmpeg and avi
  anyway, so that config is something that can't read nor write any movies.

User visible changes:

- In scene image output type, under Video section now there's only Ffmpeg Video
  (AVI Raw and AVI JPEG are gone)
- Whenever loading an existing file, if output was one of AVI Raw / AVI JPEG,
  it is set to Ffmpeg Video.

Pull Request: https://projects.blender.org/blender/blender/pulls/118409
2024-02-20 13:15:50 +01:00
Brecht Van Lommel
0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564.
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
Iliya Katueshenock
9e12a675b5 Cleanup: Merge BKE_node.h into BKE_node.hh
Trivial change, just move all the code from `BKE_node.h` to `BKE_node.hh` header top.
No mixing code from different headers or namespace changes. Part of #117773

Pull Request: https://projects.blender.org/blender/blender/pulls/118407
2024-02-19 15:26:10 +01:00
Campbell Barton
5c87dfd269 Cleanup: use BLI_time_ prefix for time functions
Also use the term "now" instead of "check" for clarity.
2024-02-15 13:15:56 +11:00
Hans Goudey
b9ed6ce0a5 Refactor: Various C++ improvements to collection property search
- Use FunctionRef to avoid passing a separate user_data pointer
- Use std::string in arguments struct
- Add search items in one loop after gathering search items
- Use Vector of unique_ptr for search items instead of linked list
2024-02-14 17:23:01 -05:00
Campbell Barton
51bc826ca1 Cleanup: unused includes in source/blender/python
Remove 72 includes.
2024-02-13 13:09:03 +11: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
Campbell Barton
37327a5d84 Cleanup: use "value_or" for optional types instead of ternary operators 2024-02-10 22:35:32 +11:00
Bastien Montagne
deab8c085a Cleanup: Move BKE_callbacks.h and BKE_cachefile.h to CPP headers. 2024-02-09 19:29:34 +01:00
Bastien Montagne
a9b2cf8ce6 Cleanup: Move BKE_path.h to CPP header. 2024-02-09 19:23:03 +01:00
Bastien Montagne
45e7827898 Clenup: Move BLT headers to Cpp.
Noisy but fairly straight forward.
2024-02-09 18:59:42 +01:00
Bastien Montagne
09a2688684 Refactor BKE_lib_query_unused_ids API.
Add a new `BKE_lib_query_unused_ids_amounts` to query expected amounts
of deleted IDs. This function does not tag IDs in main anymore.

Factorize most parameters (and output data) into a new struct
`LibQueryUnusedIDsData`.

Part of PR https://projects.blender.org/blender/blender/pulls/117304.
2024-02-09 17:01:31 +01:00
Hans Goudey
91e54fdd83 Cleanup: Move BLO_readfile.h to C++
I added a new BLO_userdef_default.h header to contain declarations of
two global variables that are still defined in C files. Use of designated
initializers for large structs make those files harder to change.
Arguably this is a better header for them anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/118015
2024-02-09 13:41:30 +01:00
Bastien Montagne
7ca62fa54e Refactor: Turn main USD public header into full Cpp one.
Rename `usd.h` to `usd.hh`, and put its declarations in the
`blender::io::usd` namespace.

Pull Request: https://projects.blender.org/blender/blender/pulls/117897
2024-02-07 09:42:23 +01:00
Damien Picard
5b9c176b68 I18n: extract and disambiguate a few messages
Extract:
- Operators' poll messages, including Python-defined ones.
- Use default translation context for the region toggle pie menu.
- Newly created F-Curve modifiers.
- Newly created video tracker track.
- Grease Pencil UV area status message
- Status messages in the graph slider operators.
- Status message "Text <text.py>" when opening .blend with
  auto-executing Python file.

Disambiguate:
- Track: can mean NLA track, video tracking, a tracking marker, or
  a track constraint.
- Tracking: can mean video tracking, or a track constraint.

Issue reported by Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/117855
2024-02-06 17:06:30 +01:00
Campbell Barton
f282c6a3ad Extensions: add handlers for synchronizing & downloading updates
The actual implementation is currently in the add-on.
2024-02-06 18:51:01 +11: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
Campbell Barton
77b49e1373 Fix text editor exceptions showing twice in the console 2024-02-04 15:16:47 +11:00
Eric Cosky
4842625902 Fix: Crash when expected method on Python class is None
Check for class methods dynamically changing type after initial registration.
This was found to happen in an add-on causing Blender to crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/117660
2024-02-02 19:10:25 +01:00
Hans Goudey
f04bc75f8c Cleanup: Use std::string for some RNA function return values
This significantly simplifies memory management, mostly by avoiding
the need to free the memory manually. It may also improve performance,
since std::string has an inline buffer that can prevent heap
allocations and it stores the size.

Pull Request: https://projects.blender.org/blender/blender/pulls/117695
2024-01-31 17:08:09 +01:00
Campbell Barton
948e806a1a Cleanup: add PyC_UnicodeFromStdStr utility function
Add a std::string wrapper for PyC_UnicodeFromBytesAndSize.
2024-01-30 15:56:08 +11:00
Hans Goudey
61fb2b17c8 Cleanup: Use std::string for WM API function return values 2024-01-29 16:33:49 -05:00
Campbell Barton
7436b578dd Cleanup: force wrapping all uses of PyDoc_STRVAR
Without this, minor edits can re-indent the whole doc-string at a
different level, causing diffs to be unnecessary noisy.
2024-01-25 10:22:16 +11:00
Brecht Van Lommel
e0ff7731e0 Core: make BKE_appdir functions thread safe, using optional<string>
The static variables can cause the wrong path to be used, for example
when asset indexing in a thread affects loading toolbar icons.

Fix #117416: toolbar icon randomly missing

Pull Request: https://projects.blender.org/blender/blender/pulls/117419
2024-01-23 18:38:15 +01:00
Hans Goudey
0618de49ad Cleanup: Replace MIN/MAX macros with C++ functions
Use `std::min` and `std::max` instead. Though keep MIN2 and MAX2
just for C code that hasn't been moved to C++ yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/117384
2024-01-22 15:58:18 +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
Bastien Montagne
af5731ce03 Cleanup: Move BKE_idtype.h to Cpp header BKE_idtype.hh 2024-01-20 19:17:36 +01:00
Aras Pranckevicius
d2e4da0f5b Cleanup: reduce C-isms in imbuf headers
Pull Request: https://projects.blender.org/blender/blender/pulls/117327
2024-01-19 20:29:43 +01:00
Aras Pranckevicius
a705259b4b Cleanup: move imbuf .h files to .hh 2024-01-19 20:29:38 +01:00
Jacques Lucke
4b47b46f9c Cleanup: rename PIL to BLI
The term `PIL` stands for "platform independent library." It exists since the `Initial Revision`
commit from 2002. Nowadays, we generally just use the `BLI` (blenlib) prefix for such code
and the `PIL` prefix feels more confusing then useful. Therefore, this patch renames the
`PIL` to `BLI`.

Pull Request: https://projects.blender.org/blender/blender/pulls/117325
2024-01-19 14:32:28 +01:00
Campbell Barton
a5794b3caa PyAPI: include the handler type when printing an exception
The extra information can help when debugging.
2024-01-19 15:44:27 +11:00
Christoph Lendenfeld
f0f1afd250 Refactor: remove driver dependency in keying code
No functional changes expected.

Before this PR the keyframing code was aware of driver specifics
and changed the frame where a key is inserted to the current driver value.

This is now changed so that the calling code needs to know where on the
FCurve the key should be inserted. This removes the need for the
`INSERTKEY_DRIVER` flag.

Pull Request: https://projects.blender.org/blender/blender/pulls/116823
2024-01-18 15:40:07 +01:00