Initiliaze global context only once per test suite. Test data relevant
to the respective tests is still allocated and freed with every test
case.
Also, `scene->nodetree` will be deprecated in a future PR, so use
`material->nodetree` to test embedded trees instead.
Pull Request: https://projects.blender.org/blender/blender/pulls/137895
The initial port [0] incorrectly use `sqrt` where `sqr` was used in the
original code. This mistake was made in two places but the second
causes a significant change in behavior, so this has been left as is
noting the difference in a comment.
Resolve the following issues:
- Use square instead of sqrt when calculating the peak value,
besides following the original implementation it avoids the result
being NAN when "Fetch" is below 30.
- Pass in `sqrt(m_omega)` matching the `omega` argument to
`alpha_beta_spectrum` as well as following the upstream code.
In most cases the user visible changes are subtle.
Ref !137607
Co-authored-by: Nicolas Paris <nicolas.paris490@gmail.com>
[0]: 6ce709dceb
There were actually two issues here:
1. The dimension reported for armatures were often wildly incorrect,
including negative values and zero!
2. The dimensions reported for objects are supposed to be invariant with
rotation, representing the dimensions along the object's local axes.
However, armature objects' reported dimensions changed with rotation.
The respective causes were:
1. `BKE_armature_min_max()` was using an incorrect formula (acknowledged
in a comment) for transforming the bounding box between spaces. This
worked fine for some of the places that `BKE_armature_min_max()` was
called, since they just reverse the transform using the same(!)
erroneous formula, but it didn't work for others.
2. `BKE_armature_min_max()` first computed the bounds in world space,
and then transformed them into object space, rather than computing
them in object space directly like the respective functions for other
object types. Even when done correctly, this causes the reported
dimension to vary with rotation.
This PR fixes these issues by simply computing the armature bounding box
in object space directly instead.
There is one place in the code base that was directly using the
world-space bounds: `view3d_calc_minmax_selected()`. However, for every
object type other than armatures, it takes the object-space bounds and
transforms them (with an incorrect formula!) to world space. So this PR
also changes `view3d_calc_minmax_selected()`'s armature code to do the
same, except with a correct formula.
Note that the reason for using the correct transform formula (departing
from other object types) is that the world-space bounds for armatures
were already correct prior to this PR due to being computed in that
space. Therefore using the incorrect formula has the potential to
introduce regressions in this case.
Pull Request: https://projects.blender.org/blender/blender/pulls/137961
Add a new node to the dependency graph, to act as a single entry point
before drivers are evaluated in parallel.
The node will take all the driven RNA properties, and write their
current value to the property again. This ensures that any implicitly
shared data is copied to ensure writability. Subsequent concurrent
writes by the driver evaluation will then be safe, as the
thread-unsafe part has already been performed.
Fixes: #132423
Pull Request: https://projects.blender.org/blender/blender/pulls/135802
Return separately for each node tree type.
This patch originally started as a refactor to change the logic of
iterating through compositing node trees but we ended up choosing
a different solution so only the small cleanup part is submitted here.
Pull Request: https://projects.blender.org/blender/blender/pulls/138205
This patch turns the options of the Bilateral Blur node into inputs.
In the process, the Sigma Space and Iterations were joined into a single
Size input, previously they were just added together then ceiled to get
the blur size. Furthermore, Sigma Color was renamed to threshold and now
represents the average color difference, not the sum, so it was
previously multiplied by 3.
Versioning and RNA compatibility is not perfect due to joining the two
size options.
Reference #137223.
Pull Request: https://projects.blender.org/blender/blender/pulls/138249
Ref: #132179
Renames:
- `Editing.act_seq` -> `Editing.act_strip`
- `SequenceModifierData` -> `StripModifierData`
- Its member `mask_sequence` is now `mask_strip`.
- `MetaStack.parseq` -> `MetaStack.parent_strip`
- Remaining function names/parameters that were not dealt with in #132748
- Various references to `seq` or `sequence` throughout code and docs when
referring to a strip
Also moves `_get` to the end of the renamed function names where
applicable for standardization (unless "by" or "from" are used).
There should be no changes to current behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/138077
This patch turns the options of the Directional Blur node into inputs.
In the process, the node now allows scaling down, not just scaling up.
The transformation options were renamed to Translation, Rotation, and
Scale as opposed to Distance, Spin, and Zoom. Finally, scaling is now
defined as a scale instead of a delta. So 1 is identity, 2 means scale
up two times, and so on. While previously, 0 was an identity scale, 1
means scale up by two types.
Reference #137223.
Pull Request: https://projects.blender.org/blender/blender/pulls/138198
Make GPU_viewport_colorspace_set() const-crrect w.r.t view_settings.
Instead of doing in-place modifications of the view_settings argument
with restoring them later introduce new function for copying view
settings which keeps curve mapping unchanged in the destination.
Should be no functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/138189
This commit reduces the Mesh paint BVH node limit on vertices from
10000 to 2500. In general, a lower value here improves performance for
both raycasting and brush strokes, as smaller leaf nodes mean more nodes
can be filtered in the broad sphere tests instead of needing each
vertex to be processed.
There are a number of considerations that go into profiling this value:
* This change is most impactful for large meshes, where the user is
going to be modifying a small total percentage of the model's area.
* Lower values may improve CPU performance, but overall responsiveness
as perceived by the user goes down with values much smaller than 2500.
This is likely due to GPU overhead, as each BVH node corresponds to a
VBO.
* A lower node limits increase the BVH building time.
The new limit of 2500 corresponds to the following performance changes
as compared to the prior baseline:
* 1.12x ~ 1.52x FPS increase depending on the ratio of brush to mesh
size.
* 1.27x ~ 2.88x performance increase for the brush evaluation.
* 1.31x slower BVH build times on a mesh with 10 million verts
(0.2864s to 0.3761s).
Further performance data and comparison videos can be seen in the
associated PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/137871
Previously, the bundled essential brushes in Sculpt Mode were changed
from the Scrape, Fill, and Flatten types to the Plane brush type. This
commit does the same thing programmatically and removes the now old code
related to these obsolete brushes.
Resolves#134076
Pull Request: https://projects.blender.org/blender/blender/pulls/138022
Allow configuring the inline buffer capacity for the slots array, and
add an inline buffer for the keys vector. Previously there was always
an allocation when adding an element.
The inline capacity is manually configured in a few places as part of
this commit.
Pull Request: https://projects.blender.org/blender/blender/pulls/136461
Two separate fixes are needed to resolve the crash. First is in the
store named attribute node, which incorrectly retrieved an attribute
value validator without checking the field type. The other is various
missing checks for the case when the evaluated positions for a
specific curve are empty.
Pull Request: https://projects.blender.org/blender/blender/pulls/137861
Caused by 06f6d77979.
Legacy curve objects have not taken the radius into account in the
past. Better to stick with that behavior and only affect the new
curve object type. This only affects non-instanced legacy curve
objects; generally generated curves are presented to the depsgraph
iterator as the new object type.
Pull Request: https://projects.blender.org/blender/blender/pulls/137852
- ImBuf reference counting: turn that into just an atomic integer
- Cachefile safety: turn into a mutex, since work under the spinlock
was quite heavy (hashtable creation, other memory allocations)
- Movie clip editor: turn into a mutex, since work under the spinlock
was very heavy (reading files from disk, etc.)
- Mesh intersect: remove the previously commented out spinlock path;
replace BLI mutex with C++ mutex for shorter code
Pull Request: https://projects.blender.org/blender/blender/pulls/137989
Previously spell checker ignored text in single quotes however this
meant incorrect spelling was ignored in text where it shouldn't have
been.
In cases single quotes were used for literal strings
(such as variables, code & compiler flags),
replace these with back-ticks.
In cases they were used for UI labels,
replace these with double quotes.
In cases they were used to reference symbols,
replace them with doxygens symbol link syntax (leading hash).
Apply some spelling corrections & tweaks (for check_spelling_* targets).
**Problem**
When using Sculpt Texture Paint to paint objects in a debug build,
Blender will crash due to an Address Sanitizer exception,
`stack-use-after-free`. This makes development for Sculpt Texture
Paint harder since the feature can't be used in debug builds without
turning off Address Sanitizer.
Code-wise, the issue here happens when extending UV island borders.
When creating and adding UV primitives to extend the UV border, the
primitives are allocated locally and then added to a list. This means
that when these primitives are accessed later from the list, the ASAN
error is triggered since the primitives have been freed. Freed
primitives are generally accessed when checking if a primitive has
already been added to the primitive list belonging to its connected UV
Edges.
**Solution**
The solution here is to change UV Edges to store the index of a UV
primitive, and not use a pointer to the object itself. This is the best
solution since it makes it fast and simple to check if an UV Edge
already has a reference to its connected primitives, while still
allowing access to the primitive objects since primitives can be
accessed using indexes from mesh data objects.
Co-authored-by: T0MIS0N <50230774+T0MIS0N@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/137032
This allows users to implement arbitrary camera models using OSL by writing
shaders that take an image position as input and compute ray origin and
direction.
The obvious applications for this are e.g. panorama modes, lens distortion
models and realistic lens simulation, but the possibilities are endless.
Currently, this is only supported on devices with OSL support, so CPU and
OptiX. However, it is independent from the shading model used, so custom
cameras can be used without getting the performance hit of OSL shading.
A few samples are provided as Text Editor templates.
One notable current limitation (in addition to the limited device support)
is that inverse mapping is not supported, so Window texture coordinates and
the Vector pass will not work with custom cameras.
Pull Request: https://projects.blender.org/blender/blender/pulls/129495
When there is no Action set on an Action constraint, the matrix returned
by the constraint would be uninitialized. In practice, this meant an
all-zeroes matrix. Now, the unit matrix is returned in such a case.
Pull Request: https://projects.blender.org/blender/blender/pulls/137965
While editing text objects a vertical bar is used as a text caret to
indicate the current cursor position within the string. This is drawn
by the overlay engine with a specific shader that changes size with the
object. Unfortunately this is currently too narrow and will become
subpixel and not display while the text is still readable. This PR just
increases the text caret width so that it is still visible at very
small sizes.
Pull Request: https://projects.blender.org/blender/blender/pulls/137975
Blender translates the "Dynamic" setting (`RBO_FLAG_DISABLED`) into a
bullet _kinematic state_ (see `RB_body_set_kinematic_state` /
`CF_KINEMATIC_OBJECT`). This is different from the _activation state_
(done through e.g. `RB_body_set_activation_state`) and also different
from the active/passive type. So we have (at least) three levels to
control this.
And it seems like even though a bullet body is fully intended to be
kinematic (aka animated), it still accumulates forces from the
`RB_body_apply_central_force` call. I have not tracked this down
further, but it _seems_ logical to only apply forces on a body with
the "Dynamic" setting.
Tested this with activation/deactivation (with seems intact), so in my
limited tests I wasnt able to break it
Pull Request: https://projects.blender.org/blender/blender/pulls/137901
This patch turns the options of the Color Spill node into inputs.
In the process, the Ratio option was renamed to Limit Strength, the
unspill option was renamed to Spill Strength.
Reference #137223.
Pull Request: https://projects.blender.org/blender/blender/pulls/137848