RNA pointers should always have valid owner IDs. And most structs
using STRUCT_UNDO do not need it because the owner is a UI datablock
which already determines if undo is needed.
With this change, it is possible to have structs used both in UI and scene
datablocks and have undo work depending on the owner. This is needed for
collections storing operator properties for export (#116646).
Pull Request: https://projects.blender.org/blender/blender/pulls/117640
Caused by 3e81f66998
Looks like we need to store the unique verts indices here, this goes in
line to what similar code in this area does (but havent checked the data
layout of an Undo node here in depth).
Pull Request: https://projects.blender.org/blender/blender/pulls/117986
For C it is an opaque pointer, for the C++ it is a class which is
defined in BKE_scene_runtime.hh.
The runtime field ensured to exist after file load, and after new
scene is added. The field is not copied when scene is copied, and
instead the copy of the scene has its own runtime field. If any of
the fields in the runtime are desired to be copied it needs to be
done explicitly.
Currently unused, but is planned to be utilized for the upcoming
compositor timing functionality,
Pull Request: https://projects.blender.org/blender/blender/pulls/117978
Remove ugly/fragile special case in `view2d_masks()` that would clamp
the scrollbar-masks by the scrubbing UI. It's now possible to pass
custom scrollbar-masks to `View2D` via `UI_view2d_scrollers_draw()`. So
use this instead, making region code control its own masks, rather than
relying on special case handling in generic `View2D` code.
Also update comment in `scroller_activate_init()` to make the implicit
relationship explicit.
Alternative to, and based on the investigation in !117685.
Pull Request: https://projects.blender.org/blender/blender/pulls/117984
Ported lattice modifier from GPv2.
The `LatticeDeformData` is no longer stored in the modifier data, but calculated on-the-fly like in the mesh deform modifier. This is quite trivial data and only stores deformed positions of the lattice, so not really worth the effort and complexity of caching it.
Pull Request: https://projects.blender.org/blender/blender/pulls/117955
Add helper functions for creating PyLong sup-types.
In Python 3.12 it's no longer practical to manipulate PyLongObject
values directly. Resolve by creating PyLongObject and copying the
values to a newly created sub-type.
These name fields run out of space for some of the new Grease Pencil
modifiers, like "GreasePencilEnvelopeModifierData". Only one of these
strings is stored for each modifier type, so this should have almost no
impact on size.
Pull Request: https://projects.blender.org/blender/blender/pulls/117980
Take light shape into consideration and do a small
fade to avoid abrupt lighting changes.
This fixes quite a lot of light leak but doesn't
fix all of them since light can still leak
during the fade. We could do this fade on the
lit side but then it break the working cases.
This does however fix the appearant sharp shadowing
that was visible on big light source.
Co-authored-by: Weizhen Huang <weizhen@blender.org>
This adds the processing required to import and export simple material graphs utilizing the UsdUVTexture outputs channels.
If only r, g or b are specified as output, we hook up a `Separate Color` node and connect the appropriate channel from there.
(if a is specified as output, the Alpha output of an image texture node was used already)
On the export side, we traverse from the socket to the image texture node, and if a `Separate Color` on the way, we are using the channel from there to put on the output.
https://openusd.org/release/spec_usdpreviewsurface.html#texture-reader
Pull Request: https://projects.blender.org/blender/blender/pulls/117901
The IME widget drawing code replaces the button's draw string, but it
did this with a C-style const cast which let this go unnoticed in
089c389b5c which changed the string from a C array to a
C++ std::string, where it's UB to just change the length this way.
To fix the crash, just store the string in a temporary array so we
can use the existing unchanged formatting code.
Pull Request: https://projects.blender.org/blender/blender/pulls/117968
Add new "Soft Falloff" option on point and spot light that uses
the old light behavior from Blender versions before 4.0. Blend
files saved with those older versions will use the option.
This option is enabled by default on new lights.
Fix#114241
Co-authored-by: Weizhen Huang <weizhen@blender.org>
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/117832
This implements layer parenting and layer transforms.
* Adds a new "Transform" panel in the object-data properties with the (local) translation, rotation and scale.
* Adds a new "Relations" panel with the parent property (and also bone name in case the parent is an armature).
* When converting from GPv2 to GPv3, the parent and transforms are converted too.
* Bone names are updated if they are renamed in the armature.
Implementation details:
* The positions in the drawings are always in layer space. During extraction, we transform the positions to object space. Note that this could be optimized further and done in the render engine itself.
* This means that e.g. the selection code (which needs to know where the positions are on screen) now takes this transform into account.
* The layer transform is calculated when accessed (from the location, rotation, scale properties).
* Code that needs to know where the positions are on screen now takes this new transform into account.
Pull Request: https://projects.blender.org/blender/blender/pulls/117247
The problem was calling a "for eval" function on an original mesh
in the main data-base. The parameters are already copied anyway,
so the call was unnecessary. Also reorder some changes to happen
before the geometry is moved to the original mesh.
The problem was calling a "for eval" function on an original mesh
in the main data-base. The parameters are already copied anyway,
so the call was unnecessary. Also reorder some changes to happen
before the geometry is moved to the original mesh.
Previously the default constructor ran, then the copy or move
assignment. This resulted in extra creations of runtime data,
including allocations of all the shared caches, only for them
to be immediately replaced by the new ones. Move assignment also
didn't clear the source curves completely, which could result in
higher memory usage or worse, extra users for attribute arrays,
which could lead to unnecessary copying.
In a very simple test repeatedly copying a tiny Curves data-block,
I observed a 30% performance improvement.
This also fixes a memory leak of the offsets in the copy assignment.
Pull Request: https://projects.blender.org/blender/blender/pulls/117932
The main simplification is using return values rather than return
arguments, and the additional semantic clarity from std::optional.
Also use `fmt` for formatting and use lambdas instead of macros
as helpers in a few modal keymap formatting functions.
Similar commits:
- a1792e98a4
- f04bc75f8c
- 6abf43cef5
- 7ca4dcac5a
Pull Request: https://projects.blender.org/blender/blender/pulls/117785
This simple operator set the edge sharpness attribute on edges,
either extending the existing values or replacing them completely.
It's meant to make it more convenient to manually control the
sharpness now that there can be more reason to do that after
auto smooth became a modifier.
Pull Request: https://projects.blender.org/blender/blender/pulls/117918