For non-COW datablocks like images, there is no need to update when
they just got added to the depsgraph and there is no flag indicating
a specific change that was made to them. Avoiding this helps preserve
the cached image draw data used by the compositor.
Co-authored-by: Sergey Sharybin <sergey@blender.org>
Ref #115511
This adds a new "Active Camera" input geometry node, per #105761.
The node outputs the the scene's current active camera. It is available
from Input > Scene > Active Camera in the geometry nodes Add menu.
Typical usage would be to connect this node to an Object Info node to
obtain its transform. This works as expected when the camera's
transform is animated, and also when there are markers on the timeline
that change the active camera.
In order to support the aforementioned changes in the active camera,
this implementation adds depsgraph relations for all cameras referenced
by timeline markers. This eliminates the complexity of updating the
depsgraph whenever the scene switches to a different active camera,
but of course it comes at the cost of including more objects than
strictly necessary in the depsgraph for scenes that switch cameras.
Dynamically updating the depsgraph upon camera changes could be a
future improvement if there proves to be sufficient need for it.
Pull Request: https://projects.blender.org/blender/blender/pulls/113431
See c4446d7924
When the "fully flat" state comes from "sharp_edge" and "sharp_face"
doesn't exist, we need to check for that for every face when extracting
normals. Eventually these loops should be unrolled so we don't have a
function call per face. That would remove the cost of this check.
There are operators in Blender that allow the user to import multiple
files at the same time, however this functionality is only implemented
when importing with blender's file browser, drag and drop files only
takes first selected file.
The patch adds support for drag and drop multiple files.
Notes:
* The files are filtered according to the extension of the first
selected file.
* Not all operators that import files support importing multiple files,
so they will still import one.
* Changes must be made to allow importers to read all file paths.
This will be used in upcoming drag & drop import.
Pull Request: https://projects.blender.org/blender/blender/pulls/107230
Now instead of trying to potentially handle unlimited amount of
newlines (which might be actual data in a binary file), only
explicitly handle either LF or CRLF line endings. Fixes#116022.
Will add test coverage in a followup commit, for easier backporting
of just the fix if needed.
No functional changes.
This moves the function `update_autoflags_fcurve_direct`
from the editors/animation section to blender/animrig.
This is in an effort to remove the need for editor code in animrig.
Also removes the include of editor code from fcurve.cc
This was only used on a single line for a macro.
Pull Request: https://projects.blender.org/blender/blender/pulls/116100
The build scripts are still referring to gpu tests as being opengl.
Although they can also use Metal or Vulkan. This PR only replaces
the work `opengl` with `gpu` for build options.
Special note is that the windows argument `with_opengl_tests` is
also replaced with `with_gpu_tests` for consistency.
Pull Request: https://projects.blender.org/blender/blender/pulls/116030
There were two issues at play here.
The first is that only enum properties with raw array access were
supported.
The second is that if the item property pointer was found immediately,
`rna_raw_access` could fall back to the slower loop without checking if
the property was an enum property, which the slower loop did not
support. This would cause the code to go through the entire slower loop
without doing anything. In the case of `foreach_get` without a
compatible buffer, this meant that the temporary, uninitialized array
(which was supposed to be set by `rna_raw_access`) would be converted to
Python integers, causing garbage values to be retrieved by
`foreach_get`, since they were created from uninitialized memory.
This patch adds support for enum properties that are not arrays and adds
asserts if an enum array property is encountered because they do not
exist.
Additional unreachable asserts have been added to the default case of
each switch block within the slower loop because there are prior checks
that the property type is supported, so the switch blocks should never
get an unsupported property type.
Pull Request: https://projects.blender.org/blender/blender/pulls/115508
`Vector::remove_if` allows certain elements to be removed based on a predicate.
However `std::remove_if` only shifts the elements that will not be deleted
to the beginning of the container and then `Vector::remove_if` only
updates the pointer to the new last element after using `std::remove_if`.
This works well if `Vector` is used with trivial types that don't have a destructor.
Having a `Vector<std::unique_ptr>` for example, can generate undefined behavior
if the predicate gives `true` to elements that are contiguous at the end, if
`Vector::remove_if` only updates the end pointer in these specific cases, these
makes these smart pointers useless because they will not be freed by themselves.
To prevent that, also destruct the elements being removed.
Pull Request: https://projects.blender.org/blender/blender/pulls/115914
This PR enables shader validation testing on buildbot for Metal.
OpenGL isn't enabled as OpenGL requires an actual driver and GPU
attached to the build bot infrastructure. Also the OpenGL backend
caches data (glsl_patch) globally and requires a restart in order to
create the correct one.
Vulkan isn't enabled as it requires some changes:
* For windows it requires to install more recent vulkan software versions as
part of the buildbot windows configuration
* For Linux it requires to start a GHOST System without any X11/Wayland
This currently fails on the buildbot. We should check if we can use
`GHOST_SystemHeadless` with `GHOST_ContextVK`
Each shaders are compiled twice. Once based on the
actual features of the installed GPU/backend. And once with all
the work-arounds enabled, simulating a platform close to the
minimum requirements of Blender.
Pull Request: https://projects.blender.org/blender/blender/pulls/116040
Due to recent changes a cached patch string in GLShader grew out of
its bounds. This resulted in incorrect shader generation on selected
platforms (Reported was Windows/NVIDIA). The patch string can differ
based on the features that the GPU supports.
This PR replaces the old C-style string generation with CPP-style
string stream, making sure that the allocated memory grows with the
size of the string.
Pull Request: https://projects.blender.org/blender/blender/pulls/116085
The debug assert condition was inverted.
It is expected that we do not find a `FileHandlerType` with the given
`idname` during add. Like Operators being added twice from c code, this
will now assert if one is actually found. Python duplicates are handled
through `register_class` already.
Pull Request: https://projects.blender.org/blender/blender/pulls/116084
In the property context menu, the operator to View in Graph Editor can
apply to a single value or all values of a vector property.
Currently, these two options are presented in this order (Single, then
All), while all other operators (replace, delete, clear, add to keying
set, reset, copy to selected) follow the opposite order (All, then
Single).
This commit inverts this order for consistency's sake.
Pull Request: https://projects.blender.org/blender/blender/pulls/115962
This reverts #110582 - the workaround is no longer needed, as MS have updated
the version of mesa they ship as part of their compatibility pack, which contains
a workaround on that side instead.
This means that the supported version of OpenGL based on the host GPU is now
correct, bar `GL_ARB_texture_view`.
`GL_ARB_texture_view` is faked for ARM64 devices, as the part that is not
implemented (channel casting) is not used in blender.
This means that ARM64 devices (at least) now report compatibility up to OpenGL
4.6 in the system info export.
See: 698344b93c
Pull Request: https://projects.blender.org/blender/blender/pulls/116052
Report suspicious time-stamps as they could cause bugs which are
difficult to troubleshoot.
Currently the time-stamps are only used for double-click detection but
we may want to use them in the future, so ensure they're valid.
Print an error when two events are handled in the last second and the
current event has a time-stamp 5 seconds before or after the current
time.
Update code examples to current C++ style. Change formatting
slightly to use more columns. Rewrite secions to be more explicit
and precise. Avoid cryptic / uncommon code in examples. Finding
real edges in particular is never inlined, we just use the function
for it.
This patch adds an alternative path for devices/OSs
which do not support native texture atomics in Metal.
Support is encapsulated within the backend, ensuring
any allocated texture with the USAGE_ATOMIC flag is
allocated with a backing buffer, upon which atomic
operations happen.
The shader generation is also changed for the atomic
case, which instructs the backend to insert additional
buffer bind-points for the buffer resource. As Metal
also only supports buffer-backed textures for
textureBuffers or 2D textures, TextureArrays and
3D textures are emulated within a 2D texture, with
sample locations being indirected.
All usage of atomic textures MUST now utilise the
correct atomic texture types in the high level shader
and GPUShaderCreateInfo declarations.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/115956
The logic can be much simpler when curves are selected rather than points,
because then we just copy all of the points in each curve. Like some other
operators, implement both cases.
Content cut off by `anim_startofs` is as if it does not exist for
sequencer. But Audaspace seeking relies on having animation buffer
initialized for whole sequence. Initialize pitch of cut content to 1.
This adds a new hybrid mode where the light and lightprobe
textures are bound to the gbuffer pass and used by
shaders that use ShaderToRGBA.
The counterpart is that these shaders have less texture
slots available but still two more than the Blended
materials.
These materials will correctly write to the AOVs and
render passes.
This is not too invasive in terms of implementation. The
only quirk was that we needed another fragment shader to
simplify the dependencies on the resources. But if we ever
get pre-processor support in our include / require system
this could be cleaned up.
Adds new curves support to "Draw Curve" operator. This is a direct copy
and replace of the old code to the new editors directly, with a change to
create the new data structure instead of the old one. There is no attempt
at code deduplication, since that would complicate removing the old
curve type when it comes time.
To replace the "2D curve" option a new operator property is added
for projecting to the Z=0 plane.
Pull Request: https://projects.blender.org/blender/blender/pulls/115864