Extend slice get/set on Vector, Color, Euler, Quaternion, Matrix and
MatrixAccess to support extended slices with arbitrary step
(`obj[::2]`, `obj[::-1]`, etc.), matching Python list semantics,
with the exception that resizing isn't supported.
This also add support for MatrixAccess slice assignment
(mat.row[i:j] = ..., mat.col[i:j] = ...) previously raised TypeError.
Tests extended with checks that steps work as intended.
Ref !158183
Row and column access used `BaseMath_ReadCallback_ForWrite`
which fails on frozen matrices, returning NULL.
Use the read-only `BaseMath_ReadCallback`, rely on the write
checks on the vectors to ensure the frozen matrix isn't modified.
Also correct invalid ROW/COL comments.
Ref !158183
- Parsing zero length arrays entered a while loop starting at index -1
mathutils_array_parse_fast, writing into negative indices (crashing).
- Color & Euler assignment wrote past the parsed size because their
assignment loops iterated on their type size instead of the slice size.
Tests added for empty-slice assignment.
Ref !158183
Expression such as: vec[0:3] = (1, 2, 3, 4)
Would silently ignore trailing items,
Other mathutils types would raise an error but vector ignored this.
Update tests and note why raising an exception is preferred
over resizing.
Ref !158183
This is a scene wide option to choose backface hit behavior
for screen tracing. This allows more control of the look
of the Global Illumination.
Backface hits are defined as hitting the camera facing
geometry from behind.
The option is a slider that allows to reuse part of the
front-face radiance as backface indirect lighting
contribution.
Not considering rays hitting backfaces as "missed" ray
most of the light leaking that can happen when using
Screen Space Global Illumination.
The option can be turned off all-together using the checkbox
for compatibility reasons. Turning it off will recover the
same "ray fail" behavior of the previous version.
Note that this patch modifies what is treated as a backface hit.
The previous definition could return true on ray going away
from the viewer, which was incorrect. This fixes small patches
of missing hits next to depth discontinuities. This is why
one test needed to be updated.
Pull Request: https://projects.blender.org/blender/blender/pulls/157803
This adds support to read object visibilities from an Alembic archive.
If an Alembic object is set as hidden, the corresponding Blender object
is hidden from both viewports and renders.
For viewport, the visibility is set on the `Base` so that the outliner
shows the correct flag, and so that the unhide operator (`ALT+H`)
works, as this is how users may interact with visibility state the
most.
Animated visibility is currently not supported.
Ref #69191.
Pull Request: https://projects.blender.org/blender/blender/pulls/157983
Previously the context manager yielded a flat 1-D memoryview for the
full image and a 2-D `(rows, columns * channels)` view for a region,
which obscured the geometry of the underlying pixels.
Returning shaped `(height, width, channels)` memoryview in both cases:
- Matches the shape convention used by `numpy` and other image
libraries, and the shape of `bpy.types.Window.screenshot` so
values can flow between them without reshaping.
- Enables direct per-pixel/per-channel indexing as `buf[y, x, c]`
instead of computing a flat offset.
Bulk slice-assignment still requires 1-D on both sides
(a CPython limitation, `NotImplementedError`).
Ref !158030
These output directories are intended to be idempotent & not shared
across test runs. While typically users will call the script via `ctest`
commands, it is still better to enforce the callee to pass in the
desired temporary directory so that cleanup steps avoid deleting
unintended data.
For a number of `bl_animation` tests, no arguments are passed to the
underlying test script, so the entire scaffolding for `argparse` has
been removed.
Pull Request: https://projects.blender.org/blender/blender/pulls/157970
Resolve incorrect use of _PyEval_SliceIndex when accessing slices.
Add tests that would have caught this.
Co-authored-by: Campbell Barton <campbell@blender.org>
Ref !157968
This commit adds a specific operator to trigger creation of an autosave.
The primary intention for this is for testing further autosave
functionality as part of !152453
Includes a basic test for this functionality, similar to other I/O
tests.
Pull Request: https://projects.blender.org/blender/blender/pulls/157812
The online listing schema uses `IDP_BOOLEAN` as type for boolean
properties, but the Blender custom property deserializer expects it to
be `IDP_BOOL`.
Online brush assets would not show in the asset shelf because of this
issue.
Pull Request: https://projects.blender.org/blender/blender/pulls/157793
Resolve:
- Regression in [0] vertices already rotated to step a were being
rotated again by the full step a+1 rotation. Reset extruded vertices
to their original coordinates each step before applying the rotation.
- Regression in [1] the translation (used for screw) was rotated
in place each iteration, accumulating rotations across steps.
Compute the step translation fresh from the original vector instead.
Adds tests covering spin and screw with duplicate enabled/disabled.
Ref !156356
[0]: b20e99a626
[1]: 08afa95a78
Adds a basic unit test using the existing paint brush. Similar to the
sculpt, vertex paint, and weight paint tests, this test applies a stroke
to a mesh and then compares the initial and new state of the image to
ensure that no invalid data has been written and that some data has
successfully changed.
Currently, the brush is tested against float and byte buffers, further
exhaustive tests are planned, though this test is helpful in the
meantime to avoid breakage while refactoring
Part of #155365
Pull Request: https://projects.blender.org/blender/blender/pulls/157669
Both OpenColorIO and OpenEXR were implicitly always required as these are non optional dependencies of OpenImageIO. Because OpenImageIO currently doesn't try to find these dependencies by itself properly, we get build failures in bpy and lite builds when OpenColorIO and/or OpenEXR is turned off on the Blender side of things. (However, they do properly list them as dependencies in cmake, so if you manually look for them, the OpenImageIO cmake target will pull in all of the required libraries properly)
As OpenImageIO is a mandatory dependency, make OpenColorIO and OpenEXR mandatory as well as these libraries need to be included either way for OpenImageIO (and by extension Blender) to work.
Because of this we can again remove the linker workarounds as now we should properly pull in the needed dependencies where needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/156154
Adds tests for BLF font drawing which currently has no tests:
- blf.draw into pixel buffer.
- blf.draw to a GPU buffer.
- 3D text drawing.
These are compared with reference images using idiff.
- Tests fail if they don't match the images.
- Tests fail if they don't match the expected dimensions.
BLF bitmap drawing covers:
- Combining characters.
- Word wrapping.
BLF VFont drawing covers:
- Combining characters.
- Word wrapping.
- Colored materials.
- Text boxes.
- Horizontal & vertical alignment.
- Text on a curve.
To see the HTML output the Python scripts can be run with
`--show-html` which generates a HTML showing the differences.
Notes:
- This misses tests for mono-spaced drawing
as it's not available to Python.
- The BLF/GPU code-path is not enabled as part of CTest
(only VFont and BLF_buffer API's are included), because the GPU
context is needed. These tests might need to use a graphical context
like the UI tests do.
Ref !157100
On export, apply the UsdColorSpaceAPI schema to the root prim, materials
lights, color primvras and shader prims for image textures. By default
the root prim would have been enough, but it is possible to export with
out a root prim and this keeps behavior consistent independent of that
setting.
On import, use UsdColorSpaceAPI::ComputeColorSpaceName to resolve
the colorspace for each color attribute through the USD hierarchy,
and convert from that colorspace to scene linear.
Pull Request: projects.blender.org/blender/blender/pulls/157196
The Asset Catalog definition file is colon-separated, so colons should
not appear in any of the fields themselves. Rather than adding elaborate
escaping rules, just don't write those characters.
This is just implemented for online asset listings, as that's considered
3rd-party data, and thus needs more sanitising before writing to a local
file.
Pull Request: https://projects.blender.org/blender/blender/pulls/157439
Discovered during development of !156706.
Prior to 1561c1ea4a socket identifiers could (in rare cases) essentially be arbitrary names.
This is because in version `(2, 66, 2)` the socket names got copied to the identifiers.
But since 1561c1ea4a, socket identifiers are expected to be valid RNA identifiers.
This PR adds versioning code that sanitizes the socket identifiers.
Pull Request: https://projects.blender.org/blender/blender/pulls/157286
After the RNA changes for Geometry Nodes, we are finally very close
to being able to pass data as inputs to node tools, which allows
creating a test that creates and runs a node tool with a data-block
input. Historically this has broken a few times, so it makes sense for
a first test of this system.
A few tweaks are necessary to get this to work. First, because the
registration of node group operators is currently called by the notifier
system, it doesn't happen in background mode. I added a WindowManager
RNA function to trigger this manually. Second, passing a dictionary to
define the inputs of the operator is necessary because of the rather
complex RNA type hierarchy, however this dictionary conversion wasn't
handled recursively in the operator calling code in bpy_rna.cc. This is
corrected by simply also handling the PropertyGroup base type used for
these node group input properties.
Pull Request: https://projects.blender.org/blender/blender/pulls/157078
A common mistake while writing CMake code is to write if the C/C++ way
`if (something)` whereas CMake uses `if()` without spaces.
Cleanup the few cases of this mistake (as well as other statement like
set()) throughout the codebase.
This was never implemented. Adding support is relatively simple.
We either expose the path corresponding to the bake or the
path the bake will inherit from the modifier.
Because there are arbitrarily many metadata files and the connection
to the binary blob files is only clear at runtime when loading the bakes,
this PR just exposes the entire directory.
Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/156380
This expands the unit tests in `bl_animation_pose_slide.py`
with tests for
* Blend with Rest Pose
* Blend to Neighbor
* Push/Relax
* the limitation that axis lock does not work on quaternion rotations
Pull Request: https://projects.blender.org/blender/blender/pulls/157108
Currently, automasking is only used inside Sculpt mode. In preparation
for further changes needed to expose the functionality to the 3D Texture
Paint brush, this PR migrates the values from being stored on the
`Sculpt` struct to the `MeshAutomaskingSettings`, stored as a pointer
on the `Paint` struct.
We do not default initialize these values, as it is specifically
relevant for Sculpt, Vertex Paint, Weight Paint, and Texture Paint.
Part of #156409
Pull Request: https://projects.blender.org/blender/blender/pulls/156494
When calculating the mask values, calculate the relative `factor` of the
automask for a given vertex and apply that as the value of the
.sculpt_mask. This is incorrect, as the `factor` is inversely related to
the mask value (i.e. a mask value of 1.0 corresponds to a factor value
of 0.0).
This was already fixed for creating a mask from boundary elements, to
extend the fix, simply remove the ability to specify whether the mask
should be based on the inverted factor or not in
`apply_mask_from_settings`, and always assume that it should be.
Pull Request: https://projects.blender.org/blender/blender/pulls/157021
These tend to break when there are bugs somewhere else, as such they are
a good case to cover in higher level testing.
Rather than testing the quick effects themselves (like, testing that
they do exactly the right thing), just make sure that adding them
doesn't crash, and does roughly the right thing.
When building without fluids support, the Quick Liquid and Quick Smoke
tests won't run, but print an error. I think that is better than
failing, because it's common to build without these and the failures
would be annoying.
Pull Request: https://projects.blender.org/blender/blender/pulls/156808
Current sequencer render tests always run on the CPU. With addition of
compositor based transitions and modifiers, they could be running on
the GPU (and more of that whole pipeline will be able to use the GPU
soon).
Add ability to run these tests on the GPU, gated behind the same
WITH_GPU_COMPOSITOR_TESTS build option (on the buildbot that is
`+test_gpu_compositor`)
Pull Request: https://projects.blender.org/blender/blender/pulls/156704
Creating a texture coordinate by combining a UV Map with a white noise
texture did not properly handle that one provides derivatives while the
other does not. It would read from wrong or uninitialized stack memory,
now make sure that is zeroed.
Pull Request: https://projects.blender.org/blender/blender/pulls/156596
The remote library listing already included custom properties. However,
the format they used didn't match what the C++ indexer expected at all.
This means the custom properties would essentially get lost. Sometimes
they contain important information though, for example, the type of node
tree so the compositor asset shelf can display only compositing assets.
The C++ indexer expected the same format as for the local asset index.
This avoids duplicating the reading code. This commit makes the listing
match that.
Another issue is, that a top level custom property should always be a
group property (this is the one iterated within when doing
`bpy.types.AssetData.items(), like the listing generator does).
Otherwise adding more properties isn't supported, and property lookups
assumed this. We can handle that by letting the indexer create the top
level group if needed, that way it can be implicit in the remote library
listing.
Pull Request: https://projects.blender.org/blender/blender/pulls/156305
This commit introduces a new `WM_event_handling_break` API, that allows
some code executed during event handling (e.g. operators etc.) to
request the `WM_main` main event loop to stop processing the event
queues and to do a full loop (including redraw step) before resuming
handling of the events.
`test_undo.py` undo tests had to be modified to add a small delay when
batch-triggering undo/redo events, to give Blender enough time to
process all the relevant events and reach the expected state.
Co-authored-by: Campbell Barton <ideasman42@noreply.localhost>
Pull Request: https://projects.blender.org/blender/blender/pulls/156375
Add texture cache variations of image tests. Re-using the existing
mechanism from volume ray marching, but tweaked so they appear on
the same results.html page.
Add new image_mipmap tests that use an image with different colored
mipmap levels, testing ray differentials and mipmaps in different
scenes.
Pull Request: https://projects.blender.org/blender/blender/pulls/154913
This will be replaced by the texture cache. Advanced OpenImageIO features
will no longer be available, and texture filtering results will be different.
But performance will be better and there will be consistency with SVM.
OSL specifc image tests were removed as these now match SVM exactly and are
tested by WITH_CYCLES_TEST_OSL.
Pull Request: https://projects.blender.org/blender/blender/pulls/154913
VSE by default uses sRGB color space, and was immediately converting
everything into it. In some cases that created redundant colorspace
conversions.
Now, all images are converted into sequencer (default sRGB) color space
only "when needed", which is these cases:
- Strip has non-default color multiplier or color saturation setting,
- Strip has "make float" option on, and input is not already float,
- Image is an input to a non-compositor effect,
- Image needs to be blended with result of lower channels,
- Non-compositor modifier *without* using "linear modifiers" option.
Note: this is not 100% backwards compatible change, because strip scale
or rotation does *not* cause it to get converted to sequencer color
space. This only affects strips where images are not already sRGB; now
the pixels will be filtered in their current color space. Arguably when
that color space is linear, that is *more correct* result than
previously, but it can change the result ever so slightly
(example image in the PR).
Performance (Ryzen 5950X / RTX 3080Ti, Linux):
Scenario A: 100 4K resolution EXR images (1.8GB), just render out this
sequence as H.264 movie, no effects, transforms, nothing: 51sec -> 48sec.
Scenario B: several simple compositor effects stacked on a strip, plus
that is blended with a compositor based procedural texture strip.
Playback FPS with GPU compositor: 5.5FPS -> 6.2FPS.
Pull Request: https://projects.blender.org/blender/blender/pulls/156281
In OpenGL mipmap creation is a driver responsibility. In Metal
and Vulkan this became an application responsibility. This results
in a mismatch between OpenGL and the other backends.
This PR will implement mipmap creation inside the GPU module. It
is for now only enabled for Vulkan. OpenGL and Metal will be added
in separately.
This PR introduces a compute shader that will generate the
mipmap chain. The compute shader is be based on
https://github.com/nvpro-samples/vk_compute_mipmaps/tree/main/nvpro_pyramid
general sharer. This shader can calculate 2 mipmap levels at a time.
This PR adds the first couple of texture formats and falls
back to the backend specific implementation for the rest. The
supported texture formats are:
- 2D texture/UNORM_8_8_8_8
- 2D arrayed texture/UNORM_8_8_8_8
- 2D texture/SFLOAT_16
- 2D arrayed texture/SFLOAT_16
- 2D texture/SFLOAT_16_16_16_16
- 2D arrayed texture/SFLOAT_16_16_16_16
Other texture formats will be added later on and OpenGL/Metal enablement
will be added later.
Pull Request: https://projects.blender.org/blender/blender/pulls/155463
Part of #148449.
Add a Workbench-specific folder for testing Workbench-specific features.
Generate a different list of tests in CMake, removing tests without a
meaningful translation to Workbench.
Removes attributes, bsdf, displacement, integrator, light,
light_linking, node_inlining, principled_bsdf, raycast, shader, shadow,
and sss.
Some features (shadows, outlines, curvature) don't have specific tests
and are instead enabled/disabled across the added tests.
This has the advantage of testing that they work correctly in
combination with other features without increasing the number of tests.
This also adds tests for viewport-specific volume features
(interpolation, density, slices).
These tests are added to the openvdb folder since they require
`WITH_OPENVDB` to work.
They could be disabled on the Python side for other engines, or moved
to a workbench_openvdb folder if necessary.
However, since they use very low-resolution volumes, it may be good to
keep them to test interpolation in EEVEE and Cycles, even if they're a
bit redundant.
Pull Request: https://projects.blender.org/blender/blender/pulls/153558