The changes:
1. Add `group_name` to the `channelbag.fcurves.new()` and
`action.fcurve_ensure_for_datablock()` RNA functions.
2. Add `anim_utils.action_ensure_channelbag_for_slot(action, slot)`.
3. Add `channelbag.fcurves.ensure()` RNA function.
This makes it possible to replace this legacy code:
```py
fcurve = action.fcurves.new("location", index=2, action_group="Name")
```
with this code:
```py
channelbag = action_ensure_channelbag_for_slot(action, action_slot)
fcurve = channelbag.fcurves.new("location", index=2, group_name="Name")
```
or replace this legacy code:
```py
fcurve = action.fcurves.find("location", index=2, action_group="Name")
if not fcurve:
fcurve = action.fcurves.new("location", index=2, action_group="Name")
```
with this code:
```py
channelbag = action_ensure_channelbag_for_slot(action, action_slot)
fcurve = channelbag.fcurves.ensure("location", index=2, group_name="Name")
```
Note that the parameter name is different (`action_group` became
`group_name`). This clarifies that this is the name of the group, and
not a reference to the group itself.
This is part of #146586
Pull Request: https://projects.blender.org/blender/blender/pulls/146977
Node sockets could already be declared using:
```cpp
add_input<decl::<SOCKET TYPE>>("NAME")
```
They can now additionally be declared with:
```cpp
add_input(socket_type, "NAME")
```
This commit adds the later form to the message extraction regex. Since
they are mutually exclusive, they are now in a non-capturing group
with an | operator.
Reported by Ye Gui in #43295.
This extracts the names and descriptions for displays, views, and
colorspaces. They are all used in the different parts of the UI.
The views' descriptions are used for the displays'.
The extraction uses the built-in PyOpenColorIO module. This ensures
only data that is actually used is extracted (not ignored in the
config).
"Use Nodes" was removed in the compositor to simplify the compositing
workflow. This introduced a slight inconsistency with the Shader Node
Editor.
This PR removes "Use Nodes" for object materials.
For Line Style, no changes are planned (not sure how to preserve
compatibility yet).
This simplifies the state of objects; either they have a material or
they don't.
Backward compatibility:
- If Use Nodes is turned Off, new nodes are added to the node tree to
simulate the same material:
- DNA: Only `use_nodes` is marked deprecated
- Python API:
- `material.use_nodes` is marked deprecated and will be removed in
6.0. Reading it always returns `True` and setting it has no effect.
- `material.diffuse_color`, `material.specular` etc.. Are not used by
EEVEE anymore but are kept because they are used by Workbench.
Forward compatibility:
Always enable 'Use Nodes' when writing blend files.
Known Issues:
Some UI tests are failing on macOS
Pull Request: https://projects.blender.org/blender/blender/pulls/141278
This makes the shader node inlining from #141936 available to external renderers
which use the Python API. Existing external renderer add-ons need to be updated
to get the inlined node tree from a material like below instead of using the
original node tree of the material directly.
The main contribution are these three methods: `Material.inline_shader_nodes()`,
`Light.inline_shader_nodes()` and `World.inline_shader_nodes()`.
In theory, there could be an inlining API for node trees more generally, but
some aspects of the inlining are specific to shader nodes currently. For example
the detection of output nodes and implicit input handling. Furthermore, having
the method on e.g. `Material` instead of on the node tree might be more future
proof for the case when we want to store input properties of the material on the
`Material` which are then passed into the shader node tree.
Example from API docs:
```python
import bpy
# The materials should be retrieved from the evaluated object to make sure that
# e.g. edits of Geometry Nodes are applied.
depsgraph = bpy.context.view_layer.depsgraph
ob = bpy.context.active_object
ob_eval = depsgraph.id_eval_get(ob)
material_eval = ob_eval.material_slots[0].material
# Compute the inlined shader nodes.
# Important: Do not loose the reference to this object while accessing the inlined
# node tree. Otherwise there will be a crash due to a dangling pointer.
inline_shader_nodes = material_eval.inline_shader_nodes()
# Get the actual inlined `bpy.types.NodeTree`.
tree = inline_shader_nodes.node_tree
for node in tree.nodes:
print(node.name)
```
Pull Request: https://projects.blender.org/blender/blender/pulls/145811
Always enforce tiling of some size, up to the 8k tile size.
Rendering very big images without tiles have a lot of challenges.
While solving those challenges is not impossible, it does not seem to
be a practical time investment.
The internals of the way how Cycles work, including Cycles Standalone
is not affected by this change.
A possible downside is that path guiding might not work exactly how one
would expect it to due to lack of information sharing across multiple
tiles. This is something that never worked nicely, and camera animation
and border render has the same issues, so it is not considered a stopper
for this change.
Fixes#145900
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/146031
This adds the `Pen` tool to Grease Pencil Edit Mode.
With the pen tool you can:
- Extrude points by `Left Click`.
- Move the handles by dragging the mouse.
- Snap handles to 45 degree increments with `Shift`.
- Cycle through the handle types by `Double Clicking`.
- Add new point on segments by `Ctrl Clicking`.
- Remove existing point by `Ctrl Clicking`.
- Close a curve by clicking on one end while having the other selected.
- Move existing segment by clicking and dragging on the edge.
- Move points by clicking and dragging the mouse.
Some changes have been made compared to the legacy
curve object's pen tool:
- `Angle locking` with `Alt` was replaced with `Angle Snapping`
using `Shift`. This was done to match the behavior of Grease Pencil
primitive tools.
- `Move Entire Point` was changed from the `Space` key to `Alt`. This
was done because some laptops can't move the mouse while
`Space` is held.
- `Link Handles` and `Free Align Toggle` were not implemented.
- `Toggle Vector` and `Close Spline Method` were removed.
- `Close Spline` was removed and set to always be true.
- `Extrude Handle` type was removed as a option and was replaced
by the `shift` modifier key when clicking.
- Newly created points are placed on the drawing plane, instead of
the view plane.
When a new curve is created, the material will be the active material
and the radius will be set from the `radius` property.
Note: This tool is added to edit mode because it uses handle selection
and bézier overlays which currently don't exist in draw mode.
A future PR will implement a draw mode version.
Pull Request: https://projects.blender.org/blender/blender/pulls/142646
Point Caches (used by particle system, cloth, boids etc.) are now
always compressed, uzing zstd coupled with lossless data filtering.
- This is both smaller cache files _and_ faster than the old
"Heavy" compression mode,
- And smaller data files and same or slightly faster speed than
using no compression at all,
- There was not much difference between compression levels once
data filtering got added, so option to pick them was removed.
- So there's no downside to just always using the compression,
which makes for a simpler UI.
- RNA change: removes PointCache.compression property.
More details and cache size / performance numbers in the PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/144356
Introduced in 4434a30d40
The above commit changed many of the `wm.radial_control` default
keybinds used in various paint modes to support accessing the "unified"
properties on a per-mode basis. While the base Blender keymap and the
industry compatible keymap were updated, this change was not applied
to custom keymaps, leading to confusing behavior for the users.
Pull Request: https://projects.blender.org/blender/blender/pulls/143872
Ensure that `__main__.__file__` is not set to "<blender string>" when
spawning the subprocess for the background downloader. Blender sets this
value when executing a Python string from C++ code. However, this value
causes issues with Python's `multiprocessing` module, as it expects that
IF the attribute is set, it contains the actual file of the actual main
module. Clearing it works fine, as `__file__` is optional anyway.
Pull Request: https://projects.blender.org/blender/blender/pulls/143985
Add a [Python code generator][1] that takes an OpenAPI definition and
outputs the corresponding data model as [dataclasses][2]
This is intended to be used in the Remote Asset Library project, to
create, download, parse, and validate information of a remote asset
library.
[1]: https://koxudaxi.github.io/datamodel-code-generator/
[2]: https://docs.python.org/3/library/dataclasses.html
## Running the Generator
The generator is a Python script, which creates its own Python
virtualenv, installs the dependencies it needs, and then runs the
generator within that virtualenv.
The script is intended to run via the `generate_datamodels` CMake
target. For example, `ninja generate_datamodels` in the build
directory.
## Details
The virtualenv is created in Blender's build directory, and is not
cleaned up after running. This means that subsequent runs will just
use it directly, instead of reinstalling dependencies on every run.
## Generated Code & Interaction with Build System
It is my intention that the code generation _only_ happens when the
OpenAPI specification changes. This means that the generated code will
be committed to Git like any hand-written code. Building Blender will
therefore _not_ require the code generator to run. Only people working
on the area that uses the generated code will have to deal with this.
Pull Request: https://projects.blender.org/blender/blender/pulls/139495
Add a new package `scripts/modules/_bpy_internal/http`, containing
classes to download files via HTTP.
The code is intentionally put into the `_bpy_internal` package, as I
don't intend it to be the end-all-be-all of downloaders for general
use in add-ons. It's been written to support the Remote Asset Library
project (#134495), where it will be used to download JSON files (to
get the list of assets on the server) as well as the asset files
themselves.
The module consists of several parts. The main ones are:
`class ConditionalDownloader`
: File downloader, which downloads a URL to a file on disk.
It supports conditional requests via `ETag`/`If-None-Match` and
`Last-Modified`/`If-Modified-Since` HTTP headers (RFC 7273, section 3.
Precondition Header Fields). A `304 Not Modified` response is
treated as a succesful download.
Metadata of the request (the response length in bytes, and the above
headers) are stored on disk, in a location that is determined by the
user of the class. Probably in the future it would be nice to have a
single sqlite database for this (there's a TODO in the code about
this).
The downloader uses the Requests library, and manages its own HTTP
session object. This way it can handle TCP/IP connection reuse,
automatically retry failing connections, and in the future
HTTP-level authentication.
`class BackgroundDownloader`
: Wrapper for a `ConditionalDownloader` that manages a background
process for the actual downloading.
It runs the downloader in a background process, while ensuring that
its reporters (see below) get called on the main process. This way
it's possible to do background downloading, while still receiving
progress reports in a modal operator, which in turn can directly
call Blender's Python API. Care was taken to [not use Python
threads][1]
`class DownloadReporter`
: Protocol class. Objects adhering to the protocol can be given to a
`ConditionalDownloader` or `BackgroundDownloader`. The protocol has
functions like `download_starts(…)`, `download_progress(…)`,
`download_error(…)`, which will be called by the downloader to
report on what it's doing.
I chose to make this a protocol, rather than an abstract superclass,
because then it's possible to make an Operator a DownloadReporter
without requiring multi-classing.
[1]: https://docs.blender.org/api/main/info_gotchas_threading.html
Pull Request: https://projects.blender.org/blender/blender/pulls/138327
Deprecation meta-data support for RNA properties.
- Properties may have a deprecated note and version.
- Warnings shown when these are accessed from Python.
- A note is included in the generated documentation.
Support for marking functions as deprecated can be added in the future.
Ref !139487
"Strip" generally is a sequencer or animation strip, but in this
context it is a string manipulation action for file names. It is
defined as part of the Path Mode defined in the FBX and OBJ exporters.
Those exporters are defined in Python and C++, respectively. This
commit changes both exporters to use the "File browser" translation
context.
In addition, the tooltip for "Relative" from the FBX exporter was
changed to match its OBJ counterpart, and the "Strip Path" mode was
also matched to the other version which reads better as an enum item.
Reported by Ye Gui in #43295.
Commit 9ce0a2d1d5 added the ability to specify translation contexts to
node UI panels, but it failed to update the regex that extracts them.
This commit solves that by adding the proper `add_panel` function to
the extraction regex.
Reported by Satoshi Yamasaki in #43295.
Job names displayed in the status bar were not extracted or
translated. This commit adds a regex to the bl_i18n_utils settings to
detect `WM_jobs_get()`, and the `RPT_` translation macro to translate
the message in the UI.
About 30 new messages are translated.
Reported by Ye Gui in #43295.