Calling `MEM_freeN` on data allocated with `MEM_new` is bad, since it
will not call a destructor matching the one invoked as part of
`MEM_new`.
While in practice cases fixed below were 'not a problem' currently, as
they are trivial Cpp types (and therefore their destructor is doing
nothing), `MEM_freeN` has no way to ensure it is dealing with such a
trivial data type, so allowing such mismatch is dirty and dangerous.
Note that almost all fixed cases look more like unintentional mistakes
(mis-usages of `MEM_new` instead of `MEM_cnew`).
NOTE: There is one more (known!) case in the asset code, which fix is
slightly less trivial, and will go through a separate PR.
NOTE: This is a by-product of some work to detect such invalid usages of
`MEM_freeN` on memory chunks allocated with `MEM_new`.
Pull Request: https://projects.blender.org/blender/blender/pulls/123691
This commit adds a new poll function specifically for determining if the
sculpt cursor should be drawn. This function whitelists a hardcoded set
of non-brush operators to display the cursor for.
In testing, this extra check has negligable performance impact. On
average it takes 0.012ms per execution.
Pull Request: https://projects.blender.org/blender/blender/pulls/123570
Mouse and NDOF events are defined in enums that are never used
directly by RNA through RNA_def_property_enum_items. As a result, they
don't get automatically extracted to the translation files and need to
be manually, through N_() macros.
The translation context used is the same as in other places related to
KeyMapItem: "UI_Events_KeyMaps".
Pull Request: https://projects.blender.org/blender/blender/pulls/116390
This adds the `Jitter` draw tool option in the randomize panel.
To make this work in combination with the active smoothing, the jitter of the positions is applied
after active smoothing as an effect on top.
This means that the active smooth will not smooth the jittered points.
In addition, it is also now allowed to raise the `Jitter` factor above 1 for a more extreme effect.
Note: The jittering worked a bit differently in GPv2 (probably because of a bug). In GPv3 we compute the cotangent using the smoothed stroke direction (over time), which is a lot more acurate then using the previous and current position for the direction.
Pull Request: https://projects.blender.org/blender/blender/pulls/123680
The idea is to skip building data-blocks referenced by ID
properties for dependency graphs used by render pipeline and
compositor preview. Those graphs do not use handlers, so it
is not required to have custom references to data-blocks
evaluated.
This solves an initial hicckup and memory usage with file
from #121188 when doing compositor. It also reduces the time
until first pixel when hitting F12 on that file.
Pull Request: https://projects.blender.org/blender/blender/pulls/123439
Only smooth and randomize brush has properties in advanced panel. For
others, panel is empty. Include condition in poll function to skip
drawing of "advanced" panel for rest brushes
Resolves#123536
Pull Request: https://projects.blender.org/blender/blender/pulls/123549
This make texture coordinates properly work with the primitive tools.
This uses the same placement logic as the draw tool.
Note: Placement is determent by the first point placed and will not be updated if that point is moved.
Pull Request: https://projects.blender.org/blender/blender/pulls/123520
Calling os.path.samefile on a repository directory that didn't exist
was raising an exception. Resolve by comparing the directories as
strings, see code comments for details.
STL/PLY (also Collada) use `BKE_mesh_assign_object` to assign a mesh
(already in main, has a usercount of 1) to a fresh object.
That function does a bunch of (unneeded) things (test modifiers/
materials which is not necessary since these are fresh objects) next to
increasing usercount. Collada steers against this by reducing usercount
again. Other importers such as alembic assign the mesh directly to
object data (which is also what this PR proposes).
Pull Request: https://projects.blender.org/blender/blender/pulls/123558
The original paper only considers the minimal distance of the cluster to
the ray, not the interval length, resulting in low weight for distant
lights that have large influence over a long distance.
This commit modifies the measure by considering `theta_b - theta_a` for
local lights and the ray length `t` for distant lights.
Pull Request: https://projects.blender.org/blender/blender/pulls/123537
During ray tracing there is a missing resource. On OpenGL this doesn't
matter as it will reuse the previous binding. But on Metal or Vulkan
each resource needs to be added to update bindings.
Pull Request: https://projects.blender.org/blender/blender/pulls/123655
Internally the image and texture resources where kept in a vector
where the elements were referenced. When using more than 16 images
this vector is reallocated and previous references become invalid.
This is a quick fix and should be changed with something more
stable.
Pull Request: https://projects.blender.org/blender/blender/pulls/123656
`mat4x4f` is not found when loading .blend files which were written
before this struct existed. The buffer-overwrite wrote into the buffer
size of our allocator (`MemHead`).
Ever since the introduction of GPU OIDN denoising on CPU devices,
using the path_tracing_device info to pick the automatic denoiser has
typically led to incorrect results.
This commit fixes this issue by using the denoising device info to pick
the denoiser.
Pull Request: https://projects.blender.org/blender/blender/pulls/123593
The ocean modifier uses its Bake operator for both baking and freeing
the cache, based on the `free` operator property.
There are two bugs here:
1. The "Delete Bake" variant of the button was created using the
`WM_OP_EXEC_DEFAULT` operator context. This skips the `invoke`
callback which is crucial for setting the operator `modifier`
property. Without that the modifier will just exit early.
The "Bake" button is drawn using the `uiItemO` function which uses
the invoke context automatically, so it does not have this issue.
2. The `free` property is set for the "Delete Bake" variant, but was
never reset to its initial `false` value. The "Bake" variant has to
also set this property, otherwise it will always execute the "free"
code path.
Pull Request: https://projects.blender.org/blender/blender/pulls/123506
Due to incompatible binding namespaces between Vulkan and OpenGL we
offset the images in the ubo list. In the previous implementation
this could still go wrong as the images and textures bindings where
sequential. When EEVEE binds resources it can also try to bind resources
that aren't valid for the current shader. In this case it was still
possible that the incorrect binding was chosen.
This is fixed by offsetting the images by a large number.
Pull Request: https://projects.blender.org/blender/blender/pulls/123649