The `Plane` brush type calculates its own node mask. The
`IndexMaskMemory` for the corresponding `IndexMask` goes out of scope
inside the inner method, resulting in an ASAN crash. To fix this, use
the `IndexMaskMemory` declared in the larger `do_brush_action` scope and
pass it in by reference to ensure its lifetime lasts appropriately.
Pull Request: https://projects.blender.org/blender/blender/pulls/136209
- The context setup functions now reset the file to factory settings
before setting up the context - for a predictable context.
- Split operator suppression lists into groups based on the reason
for being disabled to avoid having to note this in code-comments.
- The suppression list is validated, warning if items aren't used.
- Disable operators which crash in background-mode which don't have
obvious fixes & aren't useful in background-mode.
Flatten/Fill/Scrape use a different formula for the strength when
inverted, but for Fill and Scrape this is only applied when Invert to
Fill/Scrape is off.
The equivalent logic for the Plane brush is to lower the inversion
strength only when the inversion mode is set to Invert Displacement.
Fill and Scrape don't need an explicit check in `brush_strength`
because `flip` is set to `1.0` in `brush_flip` when
`BRUSH_INVERT_TO_SCRAPE_FILL` is on.
Pull Request: https://projects.blender.org/blender/blender/pulls/136211
This commit edits and adds new tests for missing camera tests bringing
the code coverage for camera projection to basically 100%.
The changes include:
- Adding a test for the central cylindrical camera type
- And editing the other camera tests to include a object with a
`Window` texture coordinate system in view.
- Modifications to these tests were done in the version of Blender
closest to when the original test was made. For most tests this was
Blender 3.1.
Ref: blender/blender-test-data!69
Use the mesh wrapper mechanism from GPU subdivision to get the base mesh.
This can significantly reduce memory usage and render setup time if the
level was not manually set to zero.
Pull Request: https://projects.blender.org/blender/blender/pulls/135895
This makes it possible for Cycles adaptive subdivision to always get the
base mesh, and will enable the same for other external renderers as well.
Metal and Vulkan now support GPU subdivision, so by default the wrapper
will be used most of the time. However this can be disabled in the
preferencesas well. For those cases, the subdiv wrapper is still created
but cached immediately as part of modifier evaluation. This way it can
take advantage of multithreaded depsgraph evaluation, which is not
guaranteed for other cases.
The draw code access the object data through a wrapper that will return
either the base mesh or subdivided mesh depending if GPU subdivision is
enabled or not. Previously Object.data would have the appropriate mesh
already, but now that Cycles may do adaptive subdivision while GPU
subdivision is disabled this is no longer possible.
Pull Request: https://projects.blender.org/blender/blender/pulls/135895
* Fix mesh_copy_data setting the subd wrapper type without copying the
associated tessellated mesh. It's unclear if this currently causes any
issues, but with future changes it would crash.
* Use double checked lock to avoid mutex locks on every call to
BKE_mesh_wrapper_ensure_mdata and BKE_mesh_wrapper_ensure_subdivision.
* Set wrapper type to subd also if subdivision was skipped due to bad
topology or level set to zero. Previous it would do mutex locking and
TBB task isolation on every function call.
* Add assert when BKE_mesh_wrapper_ensure_mdata changes the wrapper type
from subd to mdata. This doesn't really make any sense, it just loses
the subdivision detail. If any code relies on this we need to understand
why and maybe change it.
Pull Request: https://projects.blender.org/blender/blender/pulls/135895
This PR removes a bunch of dead code following #123551 (removal of AMD and Intel GPU support). It is safe to assume that UMA will be available, so a lot of codepaths that dealt with copying between CPU and GPU are now just clutter.
Pull Request: https://projects.blender.org/blender/blender/pulls/136146
This patch adds a new Image Info node which returns information about
compositor images. The node has three sources:
The node returns the following information:
- Pixel Coordinates: The coordinates of the centers of the pixels in the
image. Those are essentially the integer coordinates with half pixels
offsets added.
- Texture Coordinates: Zero centered pixel coordinates normalized along
the greater dimension. Somewhat analogous to Object coordinates in
shader nodes.
- Resolution: The resolution of the image.
- Location: The location of the image in the virtual compositing space.
- Rotation: The rotation of the image in the virtual compositing space.
- Scale: The scale of the image in the virtual compositing space.
This node is very useful to allow greater flexibility and procedural
creations. For instance, coordinates can be used to create procedural
effects like vignette using very simple math nodes. And size can be used
to compute size-relative parameters for pixel-parameter nodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/135104
This patch adds common nodes that are used in Geometry Nodes and Shader
Nodes to the compositor. The following new nodes were added:
- Vector Math.
- Vector Rotate.
- Vector Mix.
- Value Mix.
- Clamp.
- Float Curve.
- Blackbody.
The follow nodes were replaced by common counterparts:
- Value.
- Color Ramp.
- Mix Color.
- Map Range.
- Math.
- Combine XYZ.
- Separate XYZ.
- Vector Curves.
Some new features were gained in the process:
- Mix Color can now clamp both factor and result.
- Map Range can map different types and interpolations.
- Vector Curves gained a new Factor input.
Some behaviors were changed:
- Map Range previously forcibly clamped values whose magnitude is larger
than the arbitrary value of 10000. This is no longer the case.
Some nodes were removed:
- Map Value. This was Map Range without the maximum 10000 limitation
followed by a Clamp node. Both are now available as nodes.
Some common nodes remain separate:
- Separate/Combine Color. Shader counterpart does not yet support all
color modes, and does not support alpha.
- RGB Curves. Shader variant does not support Film-Like curves or
Black/White balancing.
Texture nodes will also be added soon in a separate patch. Nodes that
were replaced are now deprecated but still exist and will later be
removed in v5.0. Backward compatibility code was introduced to convert
from the deprecated nodes to the new nodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/135300
Increasing the error tolerance from 1e-8 to 1e-7 guarantees convergence
before reaching oscillatory behavior. Additionally, using double
precision for all variables involved in the operation prevents
truncation errors, ensuring numerical stability.
Introducing a damping factor might fix oscillatory behavior but will
come at the cost of much more iterations, which does not seem worth it
considering that the suggested error tolerance of 1e-7 for the scale
factor translates to, at most, an error tolerance of 1e-3 for the
standard deviation in practice as can be seen by investigating the
derivative of the variance as a function of the scale factor. Such an
error will be almost impossible to notice in the context of blurring.
Pull Request: https://projects.blender.org/blender/blender/pulls/136149
This commit adds a test file containing a combined rotation,
translation, and scale transformation on a coloured cube,
with motion blur enabled, all with a low motion blur step count.
This test is being added to make sure various backends interpolate
this combined motion correctly.
Ref: blender/blender#135659
Ref: blender/blender-test-data!75
- Remove reference to variable in the function from the doc-string,
- Note that a non-empty marker list always returns a marker.
Some callers assumed but wasn't the case until recently, see #136059.
- Replace null check in the look with an initial assignment to ensure
a marker is always returned.
- Rename argument `x` to `frame`.
For tooltips, use typographical line breaking with hard limit for uses
of the regular font, path wrapping with hard limit for uses of the
monospaced font. Small correction to wrapping code so that hard limit
is not taken if there are optional breaking points.
Pull Request: https://projects.blender.org/blender/blender/pulls/136148
When flexiable spacing clamp the floating point widths to whole pixels
in ui_update_flexible_spacing to remove the random jiggling that can
occur, notable seen on the status bar at the right edge.
Pull Request: https://projects.blender.org/blender/blender/pulls/135899
Currently, no change to an RNA property invoked from the UI while inside
Weight Paint mode creates an undo step. This includes both tool
properties (e.g. brush size, tool settings) as well as mesh properties
(symmetry, active vertex group, selection mode).
This behavior was initially introduced to avoid creating extra undo
steps when painting or sculpting and changing tool settings, however,
it applied to all property changes performed while in any paint mode,
including changes to mesh datablock properties.
To fix this behavior, this commit simply removes Weight Paint from the
list of modes that have their own (legacy) undo system. This means it's
now covered by the regular memfile / global undo system.
This builds on !134548 and !134836.
Ref: #134220, #69760, and many others
Pull Request: https://projects.blender.org/blender/blender/pulls/135758
This PR removes a bunch of dead code following #123551 (removal of AMD and Intel GPU support). It is safe to assume that UMA will be available, so a lot of codepaths that dealt with copying between CPU and GPU are now just clutter.
Pull Request: https://projects.blender.org/blender/blender/pulls/136117
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.
This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.
MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.
NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.
Pull Request: https://projects.blender.org/blender/blender/pulls/136126
The PR allows specifying the method of line breaking. Current functions
gain an optional argument that defaults to "Minimal" which breaks as it
does now, only on space and line feed. "Typographical" breaks on
different types of spaces, backslashes, underscore, forward slash if
not following a number, dashes if not following a space, Chinese,
Japanese, and Korean Ideograms, and Tibetan intersyllabic marks. "Path"
breaks on space, underscore, and per-platform path separators. There is
also a "HardLimit" flag that forces breaking at character boundary at
the wrapping limit.
Pull Request: https://projects.blender.org/blender/blender/pulls/135203
Part of #134755 / #134766.
Replaces the current import method menu in the middle of the Asset
Browser header with a "Import Settings" popover. The import method is
located there now, because it doesn't need to be as prominent as it used
to be, especially with #104686.
Plan is to add further settings to this popover, e.g. see #135996 or
#134943.
Regular "Save As" does not set "incremental" property, either true or
false, which results in a warning message. This PR just handles the
reading of this optional property properly by checking existence first.
Pull Request: https://projects.blender.org/blender/blender/pulls/136127