There is a case where the active image index could be placed on an
non-existing tile. This PR fixes this by keeping track of the active
tile when looping over all tiles.
Pull Request: https://projects.blender.org/blender/blender/pulls/131789
The GPU compositor and the new CPU compositor return zero for the Speed
pass, that's because the output identifier was used as the pass name
which is not guaranteed to work for existing files. To fix this, use the
socket data pass name instead.
As characters were evaluated, the VFontData was set.
This was then used to calculate text alignment.
Resolve by always using the "Regular" font metrics.
Tidy up:
- Use blender::Map and blender::Vector for newly created `prim_map`
- Leave bread-crumb comment for moving map creation outside of loop
- Expand UI tooltip for newly added export option
Pull Request: https://projects.blender.org/blender/blender/pulls/131770
When processing volume names for the File Browser sidebar lists we are
properly handling Windows "wide" characters (UTF-16) as long as they
are single wide characters, so below U+FFFF. For characters above this
value we get a pair of UTF-16, and end up trying to convert each to
UTF-8 as separate UTF-32 values. The result is blank output and a
console error that "surrogates not allowed." This PR just does this
conversion correctly using utfconv.
Pull Request: https://projects.blender.org/blender/blender/pulls/131763
When importing an USD, the Blender object names do not necessarily match
Prim names:
```
#usda 1.0
def Xform "xform1"
{
def Mesh "MyObject" # Will be imported as "MyObject"
}
def Xform "xform2"
{
def Mesh "MyObject" # Will be imported as "MyObject.001"
}
def Xform "xform2"
{
def Mesh "MyObject" # Will be imported as "MyObject.002"
}
```
This makes it difficult in the [USD Import Hooks]
(https://docs.blender.org/api/current/bpy.types.USDHook.html) to link a
Blender object back to its source Prim for additional processing. A
typical use cases for games is to generate UVs, create and apply a
material on the fly when importing a collision shape that does not have
a visual representation (hence no materials) based on some Prim
attributes, but that the artist needs to differenciate in Blender's
viewport.
The Import context exposes a new method `get_prim_map()` that returns a
`dict` of `prim path` / `list of Blender ID`.
For example, given the following USD scene,
```
/
|--XformThenCube [def Xform]
| `--Cube [def Cube]
|--XformThenXformCube [def Xform]
| `--XformIntermediate [def Xform]
| `--Cube [def Mesh]
|--Cube [def Cube]
`--Material [def Material]
`--Principled_BSDF [def Shader]
```
the `get_prim_map()` method will return a map as:
```python
@static_method
def on_import(import_context):
pprint(import_context.get_prim_map())
```
```json
{
"/Cube": [bpy.data.objects["Cube.002"], bpy.data.meshes["Cube.002"]],
"/XformThenCube": [bpy.data.objects["XformThenCube"]],
"/XformThenCube/Cube": [bpy.data.objects["Cube"], bpy.data.meshes["Cube"]],
"/XformThenXformCube": [bpy.data.objects["XformThenXformCube"]],
"/XformThenXformCube/XformIntermediate": [bpy.data.objects["XformIntermediate"]],
"/XformThenXformCube/XformIntermediate/Cube": [bpy.data.objects["Cube.001"], bpy.data.meshes["Cube.001"]],
"/Material": [bpy.data.materials["Material"]],
}
```
Co-authored-by: Odréanne Breton <odreanne.breton@ubisoft.com>
Co-authored-by: Sttevan Carnali Joga <sttevan.carnali-joga@ubisoft.com>
Co-authored-by: Charles Flèche <charles.fleche@ubisoft.com>
Change name of OBJECT_OT_editmode_toggle to "Edit Mode" and name of
PAINT_OT_texture_paint_toggle to "Texture Paint Mode" to display in a
more consistent manner in Undo History.
Pull Request: https://projects.blender.org/blender/blender/pulls/112703
Currently each node's position is stored in the coordinate space of
its parent. To find the location of a node on the canvas, we have to
apply the translation of each of its parents. Also, nodes have hidden
"offset" values used while transforming frame nodes. Together,
those made the system much more complicated than necessary,
and they made the Python API ineffective.
This commit removes usage of the offset values and moves nodes
to be stored in the "global" space of the node canvas. It also resolves
some weird behavior when resizing frame nodes, and fixes a few bugs.
The change is forward compatible, so we still write files with nodes in
the old parent-space format. In 5.0 the conversion when writing can be
removed. The existing Python API also stays the same. A new
"location_absolute" property gives node locations in global space,
and changing the old property also moves the child nodes of frames.
Resolves#92458, #72904.
Pull Request: https://projects.blender.org/blender/blender/pulls/131335
In Blender 4.4 (since commit 00a8d006fe), polyline shaders stopped
using geometry shaders and now rely on SSBOs.
In C++, workarounds allow these shaders to function as before, albeit
with some limitations.
To address these known limitations, error messages are now raised when
a polyline shader is used with unsupported configurations.
Pull Request: https://projects.blender.org/blender/blender/pulls/131055
In Blender 4.4 (since commit 00a8d006fe), polyline shaders stopped
using geometry shaders and now rely on SSBOs.
In C++, workarounds allow these shaders to function as before, albeit
with some limitations.
However, this change broke the `batch_for_shader` function in Python,
as `GPUShader.attrs_info_get()` only reads attributes and does not
support SSBOs.
To address this, the method now treats polyline shaders differently,
accessing SSBO inputs instead of attributes.
fix
This was caused by a bad state where a texture (likely the viewport)
texture, could be bound as texture by the viewport blit function
and kept bound as texture input during the subsequent redraw.
This would provoke a feedback loop which is UB.
It is still unknown why this is not catched by our GL layer
and why it isn't an issue in Vulkan or Metal nor other GL
implementations.
Add back all missing calls from previous `DRW_state_reset` to
avoid more regressions.
In the File Browser the "Cancel" button always has a tooltip hint of
"Cancel loading of selected file", even when you are saving. This PR
changes that to a more generic "Cancel file operation". Similarly the
save/load button always shows "Execute selected file", even when
loading. This PR instead uses the description of the operator that is
called when that button is pressed. When opening a file it shows "Open
a Blender file", saving shows "Save the current file in the desired
location", etc.
Pull Request: https://projects.blender.org/blender/blender/pulls/131703
This enables moving elements form one vector to another.
Usually this is being doing by extending a vector with the content
from the secondary vector and then clearing the secondary vector.
However sometimes this being performed to transfer ownership of managed elements,
if elements are copied from the secondary vector, but not cleared, this could
lead to 2 vectors to share ownership of objects.
Pull Request: https://projects.blender.org/blender/blender/pulls/131560
Mistake in f6a4d01703. This refactored the lookup for a named string context
member to avoid code duplication.
Intention was to construct a StringRef referencing the string stored in
context. But the refactored lookup returned an unintentional string copy, so
the reference would be constructed from a temporary string object that would
get destructed immediately.
Renaming attributes in the property editor didn't take into account
the required domains and types for builtin attributes. It might be
possible to trigger crashes by using a builtin name with the wrong
metadata. At the very least it would be confusing.
This commit extends the attribute provider check for builtin
attributes to give the required domain and type. We check that in
the attribute rename function to make sure the new name is valid.
Pull Request: https://projects.blender.org/blender/blender/pulls/131702
When releasing the pen the pressure would always go back to zero,
undoing the effect of the brush. To fix this, don't take pressure into
account for the strength, and don't display it in the UI. The grab brush
in mesh sculpt mode works the same way.
Pull Request: https://projects.blender.org/blender/blender/pulls/131744
The default wasn't in the list of static enum items which means the
value was reset to 0 instead of the proper default. Even though the
list is dynamically generated, the possible enum items should be
part of the static list anyway.
The property actually had a default, but defined via
`RNA_def_property_float_default` [**RNA** defaults handle highlevel (UI)
stuff like "Reset to Default", but is not in effect when creating new
data/editors].
For this to work, we now define the default in **DNA**
(Also corrects the mismatch in value in this particular case)
NOTE: other editors also handle "defaults" in `SpaceLink` creation functions
in their respective space_XXX.cc files, so that is another system to look at.
NOTE: there might be many more cases that could benefit from moving the
default from RNA (or `SpaceLink` creation functions) to DNA, or possibly even
doing this via other alternatives like supporting C++ in-class member initializers
in makesdna, goal is the same: having a single "source of truth".
But going over these will be for another time...
Pull Request: https://projects.blender.org/blender/blender/pulls/131735
Pass the session UID to the identity comparison callback directly,
instead of passing the ID pointer and accessing the session UID inside
the function. This way the dangling ID pointer is avoided.
Makes use of the support for passing named integers via context, which
was added in the previous commit.
Pull Request: https://projects.blender.org/blender/blender/pulls/131676
Similar to 2fbf206491, but for integers (not strings). Essentially this
allows passing named integer values through UI abstractions in a clean
way.
I used 64 bit integers here, since space isn't an issue here, and it
fits common integer types (so we don't have to add APIs for multiple
integer types).
Planned to be used to fix#111463 (following commit).
The Keying node leaks memory when only the edges output is used. That's
because tweaked matte is computed in that case, but is never used nor
released because the other two outputs are not needed. To fix this,
release the tweaked matte if it is not used.
The GPU and new CPU compositors leak memory when an output is connected
to multiple inputs inside the same pixel operation. That's because nodes
do not know that their multiple outgoing links are in fact going to the
same operation, so their initial reference count is more than the actual
reference count.
To fix this, we keep track of the reference count of pixel operation
inputs and release the inputs based on that reference count.