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
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
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
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`).
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
With the new closure approach, the code can be simplified and cleaned up quite
a bit.
This also removes four parameters, which is helpful for future additions (!123616)
since the parameter limit appears to be reached.
Pull Request: https://projects.blender.org/blender/blender/pulls/123643
Port `GPENCIL_OT_layer_duplicate_object` operator to new structure.
New function created to duplicate layer and its frames. This could also
be used in duplicate_layer operator later.
Part of #110056
Pull Request: https://projects.blender.org/blender/blender/pulls/123366
Add definitions for the UI icons that we use in larger sizes, like in
the File Browser or in dialogs. The SVG source files for these are
already in the project, this just allows their use like ICON_FILE_LARGE
or ICON_WARNING_LARGE.
Pull Request: https://projects.blender.org/blender/blender/pulls/123622
Reference identifiers instead of "above" in code comments as these
tends to become outdated. Even when declarations are removed it's at
least clear that the reference no longer exists instead of referring to
whatever is currently above the declaration.
It's also straightforward to search history for a removed identifier.
Corrected 4 cases of references to things that were no longer above
the doc-strings. Noticed other references which look to be incorrect
but need further investigation.
Small (50%) increase in the maximum values for UI resolution scale. UI
max changing from 2 to 3, property max from 4 to 6. Not only to mark
the change to improved icons at larger scale, but also to help with
testing and for better screen captures.
Pull Request: https://projects.blender.org/blender/blender/pulls/123615
Using ICON_NONE causes textures to be referenced even though nothing
is ultimately drawn. This adds an early exit for this value, and also
changes the type of it from ICON_TYPE_COLOR_TEXTURE (used to display
a full-color bitmap) to ICON_TYPE_MONO_TEXTURE (normal one-color type
now coming from SVG).
Pull Request: https://projects.blender.org/blender/blender/pulls/123609
File browser can now show thumbnail view in a larger range of sizes.
Unfortunately there is a lower bound currently set on the icon that is
shown in the middle of the "document" that assumes 64 is the smallest
(the old minimum). This causes these icons to overflow below 64. Just
something that was missed when we allowed smaller sizes. This small
change supports down to 16.
Pull Request: https://projects.blender.org/blender/blender/pulls/122811
Distribute our UI icons as separate SVG files in a folder in the
Blender installation. Rasterize each only when requested at the exact
size needed, and then saved in the text glyph cache for later uses.
Pull Request: https://projects.blender.org/blender/blender/pulls/121718