Previously, the vector type in the compositor had 4-components to
accommodated float4 types, while the last component was ignored for the
rest of the vector types. But now that we have a dedicated type for
float4 in #134486. We can reduce that vector type to 3-components.
Pull Request: https://projects.blender.org/blender/blender/pulls/134570
This change migrates the first 2 subdiv shaders to use the ShaderCreateInfo.
Other shaders will follow in separate PRs.
- Should compile when using `WITH_GPU_SHADER_CPP_COMPILATION`
- A `subdiv_` prefix is added only to the functions related to `PosNorLoop`.
But eventually the prefix should also be added to other lib functions.
- Due to Metal restrictions `subdiv_set_vertex_*` is implemented using a
functional paradigma. Our Metal backend only supports `inout` qualifier
on thead local data structures.
Pull Request: https://projects.blender.org/blender/blender/pulls/134218
Fix an issue where the versioning of Action & slot assignments did not
use RNA properties to do the slot assignment. This caused certain
on-update callbacks to be missed, which in turn meant that an Action
constraint could remain disabled even though its action slot assignment
had been corrected.
This is now resolved by actually using RNA to set the assigned slot in
the versioning code.
Unfortunately that does mean that any reporting done will be by the
generic RNA code as well, and won't be specific to versioning. This
shouldn't be much of an issue in practice, as any warning was only shown
in the rare case of mis-matched `action.idroot` properties.
Pull Request: https://projects.blender.org/blender/blender/pulls/134759
This avoids computing the bounding box later (if the positions are not changed).
Since the positions are are zero, the bounding box is just the origin point too.
This switches clang to be the default compiler on Windows ARM64, allowing for an override to MSVC.
Turns out MSVC builds have been broken for months, but nobody checked, so I'm just switching them off for now and setting clang as the default.
These updated scripts allow for the msbuild generator to use an external (ie, non-MSVC) clang installation properly, otherwise they failed.
They also allow for users to specify their own desired clang compiler via an environment variable.
An update to the docs will come seperately.
Pull Request: https://projects.blender.org/blender/blender/pulls/134566
EEVEE crashes when it is not able to allocate buffers. Previously we had a
message showing to the user that it tries to allocate a texture larger than
supported by the GPU. But was not implemented for EEVEE-next. This fix will
add back this error message.

Pull Request: https://projects.blender.org/blender/blender/pulls/134725
When compiling shaders using GCC there are warnings about functions
being declared twice. This PR will remove those warnings as they are
false positives. The warnings exists to identify typing errors.
Pull Request: https://projects.blender.org/blender/blender/pulls/134832
Use the new `action.fcurve_ensure_for_datablock()` function to ensure
the opacity F-Curve exists.
This function also ensures that the Action itself is ready for keying
(it has a layer and a keyframe strip), and ensures the slot for the
Scene exists and is assigned.
Co-authored-by: Pratik Borhade <pratikborhade302@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/134753
The position attribute was not initialized in parallel. Also there was an accidental
single threaded copy of each attribute because a `std::move` didn't work because
the variable was `const`.
The compositor previously overloaded the vector type to represent
multiple dimensions that are always stored in a 4D float vector. This
patch introduce a dedicated type for float4, leaving the vector type to
always represent a 3D vector, which will be done in a later commit.
This is not exposed to the user as a separate socket type with a
different color, it is only an internal type that uses the same vector
socket shape and color.
Since the vector socket represents both 4D and 3D vectors, code
generally assumes that such sockets represents 3D vectors, and the
developer is expected to set it to a 4D vector if needed in the node
operation constructor, or use the newly added skip_type_conversion flag
for nodes that do not care about types, like the File Output node.
Though this should be redundant once we add a dimension property for
vector sockets.
Pull Request: https://projects.blender.org/blender/blender/pulls/134486
The main goal of these changes are to improve static (i.e. build-time)
checks on whether a given data can be allocated and freed with `malloc`
and `free` (C-style), or requires proper C++-style construction and
destruction (`new` and `delete`).
* Add new `MEM_malloc_arrayN_aligned` API.
* Make `MEM_freeN` a template function in C++, which does static assert on
type triviality.
* Add `MEM_SAFE_DELETE`, similar to `MEM_SAFE_FREE` but calling
`MEM_delete`.
The changes to `MEM_freeN` was painful and useful, as it allowed to fix a bunch
of invalid calls in existing codebase already.
It also highlighted a fair amount of places where it is called to free incomplete
type pointers, which is likely a sign of badly designed code (there should
rather be an API to destroy and free these data then, if the data type is not fully
publicly exposed). For now, these are 'worked around' by explicitly casting the
freed pointers to `void *` in these cases - which also makes them easy to search for.
Some of these will be addressed separately (see blender/blender!134765).
Finally, MSVC seems to consider structs defining new/delete operators (e.g. by
using the `MEM_CXX_CLASS_ALLOC_FUNCS` macro) as non-trivial. This does not
seem to follow the definition of type triviality, so for now static type checking in
`MEM_freeN` has been disabled for Windows. We'll likely have to do the same
with type-safe `MEM_[cm]allocN` API being worked on in blender/blender!134771
Based on ideas from Brecht in blender/blender!134452
Pull Request: https://projects.blender.org/blender/blender/pulls/134463
The File Output node crashes when saving a 16-bit vector image in an
RGBA image. That's because the OIIO writer assumes 4-channel buffer
while the buffer provided by the node is only 3-channel. To fix this,
the OIIO writer is extended to support all possible combination of
source and target channels.
Pull Request: https://projects.blender.org/blender/blender/pulls/134789
In the past, around the time that 2.80 was released, 4a08b974f4
introduced the idea of filtering out certain editor changes inside
the paint modes and edit mode (e.g. changing brush sizes in the editor).
This commit is the first in a series to attempt to refine this behavior
so that only certain editor settings are filtered out from the undo
stack.
In total, it does the following:
* Adds the Brush datablock to the list of IDs that do not have undo
pushes.
* Adds support to filter out RNA structs that do not have the
`STRUCT_UNDO` property applied (currently, just the 3D Cursor).
This has the following effects:
* Changing brush settings inside the Image Editor no longer causes
undo pushes, becoming consistent with the other paint modes.
* Changing brush settings while in object mode in the outliner data
block view no longer causes undo pushes.
Co-authored-by: Campbell Barton <campbell@blender.org>
When a text string is longer than the available space it can be at a
scrolled offset, so that you can edit text that is wider than its
container. When selected text is deleted we don't update this offset,
so it is possible to have newly pasted text scrolled out of view. This
PR decreases the offset by the amount of the selected string that is
currently out of view.
Pull Request: https://projects.blender.org/blender/blender/pulls/134815
These were reading in "widths" and not adjusting the values when setting
Blender's "radius" properties.
Found while cleaning up the radius API usage as part of another change.
Pull Request: https://projects.blender.org/blender/blender/pulls/134709
Right now this code is only used to convert boolean arrays to bits (e.g. for
faster `IndexMask` generation). This patch extracts a more general function that
converts bytes to bits using a rule that is passed in as parameter. This may
become useful to speedup parsing e.g. CSV files to speedup detection of
delimiters and other special byte values.
This code is already covered by unit tests, so no new tests have been added.
Pull Request: https://projects.blender.org/blender/blender/pulls/134798
This commit moves the initialization of the node-sized accumulation
array out of the parallel loop to avoid odd optimization errors when
differing between debug and release builds as well as errors due to
integer overflow in both builds.
Additionally it only accumulates results from affected nodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/134720
The `init_positions` variable that the `ss.sculpt_persistent_co` member
gets set to was not passed into the corresponding calculation function,
resulting in a no-op.
Pull Request: https://projects.blender.org/blender/blender/pulls/134781
With the brush assets project, brushes were moved from being local to
the working blendfile to being linked from asset libraries. This breaks
the Image Paint 'Clone' brush, as it has a brush property that links to
other Image datablocks.
To support this functionality, this commit adds the corresponding
properties into the `ImagePaintSettings` struct so that it is stored
locally with the images that will be used by the tool, inside the main
blendfile.
The source image property is shared with the 3D version of the 'Clone'
brush instead of adding a separate field to preserve old behavior.
Notably, this has the following limitations:
* If clone brush assets have been made and shared with external packs,
they would not work out of the box with linked image assets.
* Despite these settings being stored on the scene, they are populated
inside the tool window under "Brush Settings" which is potentially
misleading. However, this is already the case for the 3D version of
the brush, so further UI refinement will happen outside of this PR.
* Users will be unable to use separate images simultaneously for the
Image editor and the 3D viewport, unlike in pre-4.3 versions. This
can be adjusted in the future if it is a critical workflow.
Because the intended design and functionality of this tool is currently
questionable, this commit opts to make these changes instead of doing
further design to support both accessing data on the brush and on the
scene.
Pull Request: https://projects.blender.org/blender/blender/pulls/134474
The previous attempt to restore this behavior was in
0a2d5d5801
That commit introduced clearing the related `SculptSession` variables
when the paint BVH was freed to avoid bad behaviors seen in 4.2 and
prior. However, this solution is somewhat incorrect, as the prior state
of this data is not necessarily restored when the BVH is recreated,
unlike other temporary mapping data.
This results in the persistent base data being cleared occasionally with
no indication to the user that this is happening, causing the setting to
appear to be inactive.
To fix this, this commit makes a few changes:
* Removes clearing this data in the `BKE_sculptsession_free_pbvh`
function.
* Initializes the displacement arrays to the same size as the position
and normal array.
* Introduce new variables to track the saved multires grid size so
that it is not deleted, only considered invalid when the topology
changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/134780
The playhead is redrawn as an overlay, so instead of a full region
redraw using `ARegionType.draw()`, at least an overlay only redraw using
`ARegion.draw_overlay()` needs to be triggered.
Any redrawing within a window is skipped if neither the screen, nor any
of its areas or regions are tagged for redraw. So since there are no
other areas or regions to be fully redrawn in this window, no redrawing
will happen. The screen needs to be tagged for redraw, which will skip
most drawing in this case, and just draw the overlays as wanted.
Pull Request: https://projects.blender.org/blender/blender/pulls/134579
When using the Error theme color for widget text color, this has to be
altered to provide sufficient contrast with other content. This was
done with label text color, before recent changes to make these colors
themeable, by blending with text color. This PR makes similar changes
and gives similar results.
Pull Request: https://projects.blender.org/blender/blender/pulls/134807
When changing editors within an area we are currently always setting
the subtype if there are modes. This causes problems when returning to
a previous editor versus starting with the correct one. We have tried
various ways of returning to the old editor, but never quite works.
This PR only sets the subtype if we are creating a new area. If not
just leave it as it was so we naturally return to its old state.
Pull Request: https://projects.blender.org/blender/blender/pulls/134642
During idle time, just moving your mouse into an editor, the Status Bar
only shows operations attached to mouse events. Hovering into
Properties shows an item on the left mouse called "Set Active
Modifier". This is always shown because it is an internal operator
always running in that area. This PR just skips OPTYPE_INTERNAL
operators for this idle display.
Pull Request: https://projects.blender.org/blender/blender/pulls/134782
Move the mask_random function to BLI_index_mask.hh, so it can be shared between curves, grease pencil and point cloud.
Copied/inspired by the curves select code.
Pull Request: https://projects.blender.org/blender/blender/pulls/134624
Though "Point Cloud" written as two words is technically correct and should be used in the UI, as one word it's typically easier to write and parse when reading. We had a mix of both before this patch, so better to unify this as well.
This commit also renames the editor/intern/ files to remove pointcloud_ prefix.
point_cloud was only preserved on the user facing strings:
* is_type_point_cloud
* use_new_point_cloud_type
Pull Request: https://projects.blender.org/blender/blender/pulls/134803
Previously, the code would assert in `BLI_fopen` when the path is relative.
There are two main options to make the path absolute:
1. Always use the path of the current .blend file as base.
2. Is the path of the .blend file "owns" the current node as base. So when
the Import node is part of a linked node tree, the path of the linked .blend
file is used as base.
Both options are useful depending on the specific use-case, but the latter
seems more consistent with other places in Blender. For more advanced
functionality, we might need nodes that give the current .blend file path
and one node to join paths.
Pull Request: https://projects.blender.org/blender/blender/pulls/134794