Commit Graph

6639 Commits

Author SHA1 Message Date
Sybren A. Stüvel 30711d1398 Fix #119623: Anim: unintended API change in keyframe_insert() function
Bring back the `INSERTKEY_XYZ_TO_RGB` enum item for the
`keyframe_insert()` function (it was removed in 30b0c5b225). This way
any Python code that targets Blender 4.x can safely pass this flag,
without having to check specific Blender versions.

Note that the flag is implemented as a no-op, as the behaviour change
introduced in 30b0c5b225 (just looking at the user preference) is still
retained. The purpose of this commit is simply to avoid the `ValueError`
exception that would otherwise be raised.

This should also fix Rigify report blender/blender-addons#105241.

Pull Request: https://projects.blender.org/blender/blender/pulls/119625
2024-03-19 10:05:22 +01:00
Brecht Van Lommel 7a395e2e7f Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was f57e4c5b98.

After this one more fix was committed, this one is preserved as well:
67bd678887.
2024-03-18 15:04:12 +01:00
Campbell Barton 0b9ef9ee2a Fix missing newline from bpy.utils.register_cli_command doc-string 2024-03-15 13:45:06 +11:00
Campbell Barton 499a2b2b4b Cleanup: remove double-space in exception message 2024-03-13 17:12:51 +11:00
Hans Goudey daa1739953 Merge branch 'blender-v4.1-release' 2024-03-12 10:54:14 -04:00
Hans Goudey 91466f71f1 Fix #91256, #112646: IDProperty UI data lost when changing type
With some data-type conversions we can do a best-effort conversion of
UI data like default values and min and max to the new data type.
This can help to make Python scripts simpler and to avoid bugs like
#105965.

Pull Request: https://projects.blender.org/blender/blender/pulls/106161
2024-03-12 15:49:20 +01: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
Hans Goudey f6f767b879 Cleanup: Rename "me_eval" to "mesh_eval"
Similar to 854cdd1180
2024-03-11 11:21:18 -04: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
Hans Goudey 1e1d7034ec Cleanup: Move GPU_uniform_buffer.h to C++ 2024-03-06 21:54:28 -05: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
Omar Emara eb91828aab GPU: Add maximum image units to GPU capabilities
This patch adds the maximum number of supported image units to the GPU
capabilities module. Currently, the GPU module assume a maximum of 8
units, so the patch is not currently particularly useful, but we can
consider committing it for the future anyways.

Pull Request: https://projects.blender.org/blender/blender/pulls/119057
2024-03-05 07:25:20 +01:00
Campbell Barton d27ddccc60 Cleanup: use macro to avoid repetition in BPY_init_modules 2024-03-05 13:54:17 +11:00
Prakhar Singh Chouhan 4ce13fe198 Python: Add deprecation warnings to GPUBatch program usage
Calls to `gpu.types.GPUBatch.draw#program` without a program parameter,
or a None as value of the program parameter now raises a deprecation warning.

Implements #103978
2024-03-04 08:32:51 +01:00
Bastien Montagne de5451b112 Cleanup: Move `BKE_anim_data` header to be fully C++. 2024-02-28 11:51:03 +01:00
Campbell Barton 66a8cb6f72 Merge branch 'blender-v4.1-release' 2024-02-27 21:32:08 +11:00
Campbell Barton 3d18896e4b Fix #102526: Fix crash performing nested viewport drawing
Performing an off-screen draw call while drawing the viewport isn't
supported, add a check that raises an exception when called from Python
instead of crashing.

Ref: !118780
2024-02-27 21:29:38 +11: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 3f8cd44485 Cleanup: move BLI_strict_flags.h last, not that it should be kept last
Also add a note in the header why it should be kept last.
2024-02-14 13:40:31 +11:00
Campbell Barton 51bc826ca1 Cleanup: unused includes in source/blender/python
Remove 72 includes.
2024-02-13 13:09:03 +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
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
Andrej730 8144252aa9 Fix return types in docs for matrix.zero, quat's .negate and .identity
Noticed in mathutils docs (and in python type hinter for mathutils) some methods doesn't return anything though docs stated that they return themselves and fixed the docs.
Related to 9c81833430

Pull Request: https://projects.blender.org/blender/blender/pulls/118011
2024-02-09 10:24:44 +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