Commit Graph

741 Commits

Author SHA1 Message Date
Bastien Montagne 93728fee53 LibOverride: Extend unittest to cover more advanced/complex cases.
These tests now have basic coverage of:
* Linking data and creating liboverride hierarchy from it.
* Linking that liboverride again.
* Creating liboverride of liboverride.
* Modifying data hierarchy in the library, and testing (recursive)
  resync of it.
* ID name collision handling (between modified linked data and
  existing overrides).
2023-08-06 23:11:19 +02:00
Brecht Van Lommel 647f2053a9 Tests: add automated regressions tests for Hydra Storm
These are meant to test Hydra integration. Currently they are only enabled
for WITH_OPENGL_RENDER_TESTS=ON due to similar reasons as Eevee and
Workbench, which is that they require a GPU and results can be platform
dependent due to hardware and driver differences.

There are separate tests for USD and Hydra export paths. The goal is to
make these identical, but they aren't yet. So for that reason they have
separate reference renders, and there is a HTML page to compare them.

Ref #110765
2023-08-04 17:01:09 +02:00
Campbell Barton 89811cb96f Cleanup: unused-imports in tests/ 2023-07-25 21:43:53 +10:00
Campbell Barton 932a85a24f Fix tests failing from errors in the users startup file
Tests should never depend on the users startup.blend which can have
settings that interfere with tests.

Failure to load the user startup.blend for e.g. prevented
bl_alembic_io_test from passing.
2023-07-25 21:20:10 +10:00
Jacques Lucke 3d73b71a97 Geometry Nodes: new Repeat Zone
This adds support for running a set of nodes repeatedly. The number
of iterations can be controlled dynamically as an input of the repeat
zone. The repeat zone can be added in via the search or from the
Add > Utilities menu.

The main use case is to replace long repetitive node chains with a more
flexible alternative. Technically, repeat zones can also be used for
many other use cases. However, due to their serial nature, performance
is very  sub-optimal when they are used to solve problems that could
be processed in parallel. Better solutions for such use cases will
be worked on separately.

Repeat zones are similar to simulation zones. The major difference is
that they have no concept of time and are always evaluated entirely in
the current frame, while in simulations only a single iteration is
evaluated per frame.

Stopping the repetition early using a dynamic condition is not yet
supported. "Break" functionality can be implemented manually using
Switch nodes in the  loop for now. It's likely that this functionality
will be built into the repeat zone in the future.
For now, things are kept more simple.

Remaining Todos after this first version:
* Improve socket inspection and viewer node support. Currently, only
  the first iteration is taken into account for socket inspection
  and the viewer.
* Make loop evaluation more lazy. Currently, the evaluation is eager,
  meaning that it evaluates some nodes even though their output may not
  be required.

Pull Request: https://projects.blender.org/blender/blender/pulls/109164
2023-07-11 22:36:10 +02:00
Jeroen Bakker 7d122ff82b Cleanup: make format 2023-06-16 15:15:27 +02:00
Jacques Lucke 9535248911 Tests: support simulation nodes regression tests
Geometry nodes supports simulation nodes which allows later frames to depend
on previous frames. The existing geometry nodes regression tests only evaluated
the node tree at a single frame and therefore couldn't test the correct behavior of
simulations.

This adds a new kind of regression test that evaluates the scene at multiple
consecutive frames and then checks if the last frame matches.

Pull Request: https://projects.blender.org/blender/blender/pulls/109046
2023-06-16 10:00:55 +02:00
Campbell Barton 65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Campbell Barton 49594c37ae License headers: use SPDX-FileCopyrightText for CMake files 2023-06-14 23:36:23 +10:00
Hans Goudey 7d935f94f3 Cleanup: Grammar: it's vs its 2023-06-13 14:51:49 -04:00
Aras Pranckevicius 23afc6161c IO: remove OBJ and PLY Python add-ons (#104503, #104504)
With C++ based built-in implementations having both more features
and way better performance, it's time to retire the add-ons. Implements
#104503 and #104504.

Pull Request: https://projects.blender.org/blender/blender/pulls/108440
2023-05-30 21:41:26 +02:00
Sergey Sharybin ec7c1a6e0a Add light group tests category to Cycles
Pull Request: https://projects.blender.org/blender/blender/pulls/108424
2023-05-30 14:37:42 +02:00
Bastien Montagne 14fdd92067 Merge branch 'blender-v3.6-release' 2023-05-30 12:21:28 +02:00
Bastien Montagne 80430f6c50 Cleanup: docstrings arguments part.
Docstring argument part needs to be separated from description by an
empty line, otherwise it is not properly recognized by Sphinx.
2023-05-30 11:55:08 +02:00
Campbell Barton 9ff94a79e5 Fix library override test on WIN32
Committed to main but should have been committed to the 3.6 branch.
2023-05-30 12:58:11 +10:00
Campbell Barton 019362bd96 Test: ensure __builtins__ can't workaround secure driver evaluation 2023-05-27 15:44:57 +10:00
Campbell Barton 30c1efad84 Fix library override test on WIN32 2023-05-27 14:57:57 +10:00
Campbell Barton d133d622c1 Merge branch 'blender-v3.6-release' 2023-05-27 13:47:02 +10:00
Campbell Barton aa6414c8c8 Cleanup: format 2023-05-27 13:45:03 +10:00
Bastien Montagne 9c15058d0b Merge branch 'blender-v3.6-release' 2023-05-26 18:53:47 +02:00
Bastien Montagne 4c5998ee0b Unittest: Add very basic 'old file loading' test.
Use existing `lib/tests/libraries_and_linking/library_test_scene.blend`
essentially as 'file loads without error' test. Also does very basic
proxy -> liboverrides conversion check.

This test could be extended a lot, but just opening this file already
allowed to identify three bugs in current 3.6/main code, and an issue in
an upcoming refactor of the readfile code...
2023-05-26 18:43:19 +02:00
Sergey Sharybin ba3f26fac5 Cycles: light and shadow linking
With light linking, lights can be set to affect only specific objects in the
scene. Shadow linking additionally gives control over which objects acts a
shadow blockers for a light.

Usage:
https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Cycles

Implementation:
https://wiki.blender.org/wiki/Source/Render/Cycles/LightLinking

Ref #104972
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2023-05-24 14:11:47 +02:00
Campbell Barton ac263a9bce PyAPI: remove context override argument from bpy.ops
Remove deprecated context override argument to operator execution and
poll() method in favor of context.temp_override().
2023-05-23 14:34:09 +10:00
Sergey Sharybin 8bca0e1075 Cleanup: Format python after recent changes
Pull Request: https://projects.blender.org/blender/blender/pulls/108086
2023-05-19 18:20:27 +02:00
Sergey Sharybin 8cc22d2809 Workaround Cycles regression test failures
The failure happens since the recent changes in the make_orthonormals.

The only difference is the underwater caustics test file, and the
difference seems to be a noise floor.

There seems to be nothing wrong with the math in the function itself:
the return values are all without quite small epsilon when comparing
Linux with M2 macOS. The thing is: the very first input is already a
bit different on different platforms. So the difference is already
somewhere else.

For now increase the threshold to avoid confusion of the rest of the
team, and to allow builds to be deployed.

Pull Request: https://projects.blender.org/blender/blender/pulls/108080
2023-05-19 16:42:08 +02:00
Campbell Barton 0099f51cdd Cleanup: sort file, uppercase booleans, add missing headers
Also update files to ignore for check_cmake.
2023-05-17 13:13:10 +10:00
Chris Blackbourn 48abc09d84 Cleanup: format 2023-05-05 23:44:56 +12:00
Sergey Sharybin ecb8d7f8ab Tests: Add test for broken EXR files
To make sure non-trivial cases like #106977 are not re-introduced.

Pull Request: https://projects.blender.org/blender/blender/pulls/107643
2023-05-05 11:00:54 +02:00
Campbell Barton 6a5ab77dcc Cleanup: format 2023-05-02 08:41:10 +10:00
Michael B Johnson 3c74575dac Fix #107062: support opacityThreshold when exporting USD
This PR addresses issue “USD export does not respect opacity threshold for clip alpha blend mode #107062”

This commit extends the USD Preview Surface material support to author the opacityThreshold attribute of materials on export, when the Alpha Clip blend mode is selected.

When authoring alpha cutouts in Blender, one sets the Blend Mode to "Alpha Clip", and the Clip Threshold to some value greater than zero.
When this case is detected on export, we now author the opacityThreshold attribute to match the specified clip threshold.

Note that opacityThreshold is already handled correctly on import, so this change allows the feature to be fully round-tripped.

Co-authored-by: Matt McLin <mmclin@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/107149
2023-05-01 17:28:23 +02:00
Campbell Barton d302901ce0 Fix bl_run_operators test running without a window context
While technically valid, a context without a window set can't access
the active object or view layer, causing object mode setting to fail,
making the checks not all that useful.

Use Context.temp_override(..) to set the context's window.
2023-04-30 15:08:27 +10:00
Jesse Yurkovich 1bb77d9eae Cleanup: Better logging for imbuf tests
Recent failures requiring investigation have exposed some shortcomings
that this addresses:
- When creating the diff image for offline comparison, use a higher
  threshold to prevent idiff from printing more output which will often
  contradict the primary failure output just above it (very confusing)
- For metadata failures, make sure these get printed so it's obvious
  what kind of failure we're dealing with

Pull Request: https://projects.blender.org/blender/blender/pulls/107058
2023-04-18 03:32:20 +02:00
Campbell Barton e9d4e571d0 Cleanup: use identity comparisons with False 2023-04-14 20:14:06 +10:00
Jesse Yurkovich aa3bdfd76a Image: Use OpenImageIO for loading and saving a variety of image formats
This checkin will use OIIO to replace the image save/load code for BMP,
DDS, DPX, HDR, PNG, TGA, and TIFF.

This simplifies our build environment, reduces binary duplication,
removes large amounts of hard to maintain code, and fixes some bugs
along the way.

It should also help reduce rare differences between Blender and Cycles
which already uses OIIO for most situations. Or potentially makes them
easier to solve once discovered.

This is a continuation of the work for #101413

Pull Request: https://projects.blender.org/blender/blender/pulls/105785
2023-04-12 05:22:26 +02:00
Brecht Van Lommel 1658b8ab46 Fix Cycles Metal failing when run in parallel, always run serial
The command buffer fails to execute, the cause is unknown. It does not
appear to be related to the binary archive cache as disabling that does
not prevent the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/106328
2023-03-30 19:46:49 +02:00
Hans Goudey cef82a1d39 Cleanup: Grammar: "it's" vs "its" 2023-03-24 08:34:21 -04:00
Bastien Montagne a2600e0a76 Merge branch 'blender-v3.5-release' 2023-03-20 15:30:14 +01:00
Bastien Montagne a60f651502 Address #105786: How to handle linked data with 'fake user' set.
133dde41bb changed how 'fake user' flag is handled with linked data.

Previous behavior was a bug/inconsistency, in that the 'directly linked'
tag would be 'over-set' and never cleared, forcing saving references to
a lot of unused linked data.
Note that ideally, 'Fake user' flag should be ignored, and the only way
to decide whether to keep or not a linked ID should be whether it's
actually used by some local data.

However, #103867 and #105687 show that this is causing issues in some cases,
where users wrongly relied on the linked data's pre-defined 'Fake user' flag
to keep their linked data in their production files, even if said data had no
real user.

While not ideal, for now we should consider 'fake user' flag for linked data
as a real usage case. A better handling of this edge-case is related to
wider designs aboud handling of 'non used' data on file save, whether
linked IDs should keep track of being explicitly or implicitly linked by
the user, etc.
2023-03-20 15:29:24 +01:00
Hans Goudey 45c4a0b1ef Merge branch 'blender-v3.5-release' 2023-03-18 19:57:58 -04:00
Michael B Johnson 73509d1bc1 Fix #105327: USD import fails to recognize UV map varname
Follow connections when reading the varname attribute of a primvar
reader, and support both string and TfToken types for the varname.

A unit test is also provided.

Authored by Apple: Matt McLin

Pull Request: https://projects.blender.org/blender/blender/pulls/105508
2023-03-18 00:05:39 +01:00
Campbell Barton ce34024681 Merge branch 'blender-v3.5-release' 2023-03-14 16:09:44 +11:00
Campbell Barton 51e5417bd3 Fix #105678: Crash assigning Image.pixels to an undersized sequence
Now only dynamic function parameters that use ParameterDynAlloc support
dynamically sized parameters arrays.

Add tests for both dynamic arrays that don't support resizing
(Image.pixels) and dynamic sized arguments using
(VertexGroup.add(index=[..])).

Regression in [0] which extended support for dynamic sized function
arguments.

[0]: dfb8c5974e
2023-03-14 16:00:24 +11:00
Campbell Barton b4eef99973 Cleanup: use C-style code comments, format 2023-03-03 16:29:22 +11:00
Bastien Montagne ff6ce25926 Add a basic support to BKE library linking code to generate liboverrides.
This commit adds the ability to generate liboverrides of linked data at
the `BKE_blendfile_link_append` BKE level, and through the Python API
(the `BPY_library_load` context manager, aka `bpy.data.libraries.load`).

The python API was updated essentially to allow easy testing of the new
code. This commit also adds tests for the new 'override' behavior, and
for existing basic link one.

Current code only generates 'basic' overrides, without any handing of
hierarchies or dependencies, as for brush assets only the Brush ID needs
to be overridden.

That new feature does not aim at being exposed to user through the
link/append operations in its current state, as it is way too simplistic.

This change is a requirement for the Brush Asset project (#101908).

Pull Request #104746
2023-03-02 17:22:42 +01:00
Campbell Barton e1ab9e352c Cleanup: autopep8 2023-03-01 22:12:18 +11:00
Campbell Barton bd0aa88909 Fix invalid path references after moving tools & scripts 2023-03-01 22:00:46 +11:00
Campbell Barton e65671c1ed Merge branch 'blender-v3.5-release' 2023-03-01 11:21:02 +11:00
RedMser 337e68aeb5 Test: update bl_rna_defaults
- Remove Group test
- Add Brush, Collection, GreasePencil, HairCurves,
  LightProbe, PointCloud, Volume tests

Ref !105172.
2023-03-01 11:18:47 +11:00
Sergey Sharybin ecb88eff7e Merge branch 'blender-v3.5-release' 2023-02-21 16:41:47 +01:00
Sergey Sharybin 03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00
Jesse Yurkovich 2d34a09043 Tests: Address imbuf_save failures on ARM64 builds
This does 2 things to address the ARM64 failures:
- Increases the threshold to be inline with what Cycles uses
- Disables the 2 problematic WebP variations (#105006 will track)
2023-02-20 21:36:19 -08:00
Jesse Yurkovich 7699c7407d Tests: Add tests for image format saving and loading
This adds saving and loading tests for our supported image formats.

**Saving - bf_imbuf_save.py**
There are 2 template images which are loaded anew for each file save
attempt.  One is an 8-bit RGBA image and the other 32-bit. This is
required as many formats use a variety of factors to determine which of
`ibuf->rect` or `ibuf->rectfloat` to use for processing.  The templates
are constructed to have alpha transparency as well as values > 1 (or
clamped to 1 for the case of the 8-bit template).

Test flow:
 - Load in an appropriate template image
 - Save it to the desired format with the desired set of options
 - Compare against the reference image

Notes:
 - 98 references are used totaling ~3.6MB
 - 10-12 second test runtime
 - Templates can be reconstructed with the create-templates.blend file

**Loading - bf_imbuf_load.py**
Test flow:
 - Load in each of the reference images
 - Save them back out as .exr
 - Save additional metadata to a secondary file (alpha mode, colorspace etc)
 - Compare the saved out .exr with another set of reference .exrs
 - Compare the saved out file metadata with set of reference metadata

Notes:
 - 98 exr references are used totaling ~10MB
 - 10-12 second test runtime as well

A HTML report is not implemented. The diff output organization is very
similar to the other tests so it should be somewhat easy to do in the
future if we want.

The standard set of environment variables are implemented for both:
BLENDER_TEST_UPDATE, BLENDER_VERBOSE, and BLENDER_TEST_COLOR

Pull Request #104442
2023-02-20 19:06:38 -08:00
Hans Goudey d465b92823 Cleanup: Make format, fix missing static warning 2023-02-15 17:39:53 -05:00
Michael B Johnson 5040c39d1a Fix T103354: Author extents on UsdGeomMesh
A properly authored USD file will have the extent attribute authored on all prims conforming to UsdGeomBoundable.
This cached extent information is useful because it allows the 3D range of prims to be quickly understood without reading potentially large arrays of data. Note that because the shape of prims may change over time, extent attributes are always evaluated for a given timecode.

This patch introduces support for authoring extents on meshes and volumes during export to USD.

Because extents are common to multiple kinds of geometries, the main support for authoring extents has been placed in USDAbstractWriter, whose new author_extent method can operate on any prim conforming to pxr::UsdGeomBoundable. The USD library already provides us the code necessary to compute the bounds for a given prim, in pxr::UsdGeomBBoxCache::ComputeLocalBound.
Note that not all prims that are imageable are boundable, such as transforms and cameras.

For more details on extents, see https://graphics.pixar.com/usd/release/api/class_usd_geom_boundable.html#details.

Note that when new types of geometries are introduced, such as curves in https://developer.blender.org/D16545, we will need to update the USD writer for that geometry such that it calls this->author_extent.

Update on Feb 2: This patch has been updated to include a unit test to ensure authored extents are valid. This test requires new test assets that will need to be submitted via svn. The test assets are attached in the d16837_usd_test_assets.zip file. To use, unzip and merge the contents of this zip into the lib/tests/usd folder.

This unit test also addresses #104269 by validating compliance of exported USD via UsdUtils.ComplianceChecker.

Pull Request #104676
2023-02-14 12:11:53 +01:00
Campbell Barton 91346755ce Cleanup: use '#' prefix for issues instead of 'T'
Match the convention from Gitea instead of Phabricator's T for tasks.
2023-02-12 14:56:05 +11:00
Campbell Barton fefc6a73b3 Fix pep8 checker operating on dot-files
Temporary editor files were included which could make the checker fail.
2023-02-11 14:12:43 +11:00
Campbell Barton 9f4edf8c2a Cleanup: remove unused variables 2023-02-11 14:04:35 +11:00
Campbell Barton b77c82e2bb Tests: minor updates to make bl_rna_manual_reference more useful
- Avoid flooding the output with every match that succeeds.
- Report patterns listed in the manual that don't match anything in
  Blender.
- Disable external URL lookups, this is too slow.
  Instead use a LOCAL_PREFIX (a local build of the manual)
  or skip the test.
2023-02-10 14:04:15 +11:00
Lukas Stockner 0220bdc2d5 Cycles: Tests: Add option to increase SPP for manual comparisons
Useful for validating changes when sampling/noise changes:
- First run with BLENDER_TEST_UPDATE=1 and e.g. CYCLESTEST_SPP_MULTIPLIER=32
- Apply your change
- Run with only CYCLESTEST_SPP_MULTIPLIER=32
- Compare
- Reset the SVN repo

Differential Revision: https://developer.blender.org/D17107
2023-02-03 21:00:47 +01:00
Jacques Lucke bbc18673f3 Cleanup: make format 2023-02-02 13:16:39 +01:00
Michael Kowalski f359a39d11 Fix T100028: Convert USD camera properties to mm from USD units.
Authored by Sonny Campbell.

Currently when importing a USD file, some of the camera properties are
ignored, or the units are not converted correctly from USD world units.
On import we currently set the focal length, but not the camera sensor
size (horizontal and vertical aperture), so the camera field of view
is wrong. The sensor size information is in the USD file, but is ignored
for perspective cameras.

USD uses "tenth of a world unit" scale for some physical camera properties
like focal length and aperture.
https://graphics.pixar.com/usd/release/api/class_usd_geom_camera.html#UsdGeom_CameraUnits

I have added the UsdStage's metersPerUnit parameter to the ImportSettings
so the camera can do the required conversion on import. This will convert from
the USD file's world units to millimeters for Blender's camera settings.

Reviewed by: Sybren and makowalski.

Differential Revision: https://developer.blender.org/D16019
2023-01-30 17:22:26 -05:00
Bastien Montagne 3649c05f57 Cleanup: Run `make format` on codebase. 2023-01-30 09:40:17 +01:00
Michael Kowalski fa57c691f6 USD IO CI Tests
Various new CI tests for USD Import / Export functionalty:

Import:
 - Added mesh import tests for topology types and multiple UV sets. (Python)

Export:
 - Added a verification tests for mesh topology. (C++)
 - Added a test to make sure UsdPreviewSurface export conversion of materials
is correct. (C++)

Reviewed by: Sybren and Hans.

Differential Revision: https://developer.blender.org/D16274
2023-01-25 14:51:39 -05:00
Jacques Lucke 85908e9edf Geometry Nodes: new Interpolate Curves node
This adds a new `Interpolate Curves` node. It allows generating new curves
between a set of existing guide curves. This is essential for procedural hair.

Usage:
- One has to provide a set of guide curves and a set of root positions for
  the generated curves. New curves are created starting from these root
  positions. The N closest guide curves are used for the interpolation.
- An additional up vector can be provided for every guide curve and
  root position. This is typically a surface normal or nothing. This allows
  generating child curves that are properly oriented based on the
  surface orientation.
- Sometimes a point should only be interpolated using a subset of the
  guides. This can be achieved using the `Guide Group ID` and
  `Point Group ID` inputs. The curve generated at a specific point will
  only take the guides with the same id into account. This allows e.g.
  for hair parting.
- The `Max Neighbors` input limits how many guide curves are taken
  into account for every interpolated curve.

Differential Revision: https://developer.blender.org/D16642
2023-01-20 12:09:38 +01:00
Campbell Barton 66dee44088 CMake: quiet references to undeclared variable warnings
These warnings can reveal errors in logic, so quiet them by checking
if the features are enabled before using variables or by assigning
empty strings in some cases.

- Check CMAKE_THREAD_LIBS_INIT is set before use as CMake docs
  note that this may be left unset if it's not needed.
- Remove BOOST/OPENVDB/VULKAN references when disable.
- Define INC_SYS even when empty.
- Remove PNG_INC from freetype (not defined anywhere).
2023-01-19 17:10:42 +11:00
Campbell Barton ca3e19f4c5 Fixes for 'make check_pep8' target
- Skip files in dirs starting with '.' (`.git` was being searched).
- Update --disable list for pylint.
2023-01-18 18:27:49 +11:00
Brecht Van Lommel 589cbbf0e3 Tests: test availability of new bundled Python libraries
Differential Revision: https://developer.blender.org/D16733
2023-01-09 13:42:56 +01:00
Chris Blackbourn 8c194e1ba6 Cleanup: format 2022-12-29 20:49:08 +13:00
Hans Goudey 99fcfdd9fb Tests: Print when mesh test starts, to help debugging crashes 2022-12-20 12:02:05 -06:00
Hans Goudey 7907803694 Tests: Remove random shuffling from modifiers test
These are meant to be regression tests, not fuzz tests. The "random"
shuffling made debugging quite annoying, even though the random order
was the same every time. Instead, hard-code the two lists to make
things more obvious. The resulting list doesn't make much sense
(for example, the multires modifier has to be first in the stack),
but for now avoid changing things further.

Also remove some comments that weren't helpful.
2022-12-20 10:40:52 -06:00
Bastien Montagne b93025db59 Add concept of 'runtime' ID in Main data-base.
Such IDs are tagged with the new `LIB_TAG_RUNTIME`. They are essentially
like any other regular ID, except that they do not get written in .blend
files. They also do not make their linked data usages directly linked.
They do be written in undo steps however.

This tag should be ignored in any non-Main IDs (e.g. evaluated data,
`NO_MAIN`, etc.).

This commit also adds a new RNA ID property, `is_runtime`. This is not a
direct mapping to the DNA tag, as a non-main ID will also return True,
and the property is only editable for Main IDs.

Some basic testing for expected behavior of that new tag was also added
to `blendfile_io` py unittest.

Required for brush asset project, see T101908.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16675
2022-12-20 13:15:51 +09:00
Campbell Barton 5a761a47e1 Cleanup: replace StringIO seek() & read() with a call to getvalue() 2022-12-18 14:18:01 +11:00
Campbell Barton 7571222a69 Cleanup: add trailing commas for multi-line collections
Avoid accidentally missing commas between strings, see: T101020.
Also use single quotes for enum identifiers.
2022-12-15 17:34:09 +11:00
Brecht Van Lommel ebff39d5bb Build: make running executables as part of build/tests work with shared libs
Ensure the environment is set up for blender_test, idiff and oslc so that they
can find the required shared libraries.

Also deduplicate add_bundled_libraries() between Linux and macOS.

Includes contributions by Ray Molenkamp and Brecht Van Lommel.

Ref T99618
2022-12-07 15:28:17 +01:00
Jacques Lucke ca2ca0ce5d Geometry Nodes: add instance test category 2022-12-05 17:56:47 +01:00
Jacques Lucke 44ab02fc5c Geometry Nodes: add texture regression test category 2022-12-05 12:06:18 +01:00
Campbell Barton cc6bdac921 Cleanup: format 2022-12-05 12:54:00 +11:00
Bastien Montagne 313c2e9105 Fix a test after recent changes to lib (in)directly linked ID handling.
rB133dde41bb5b changed handling of (in)directly linked status handling
for IDs, now IDs that are not directly linked get proper status and
handling on file save. this broke parts of the `pyapi_idprop_datablock`
tests.
2022-11-30 15:08:11 +01:00
Bastien Montagne 133dde41bb Improve handling of (in)direclty linked status for linked IDs.
This commit essentially ensures before writing .blend file that only
actualy locally used linked IDs are tagged as `LIB_TAG_EXTERN` (and
therefore get a reference stored in the .blend file).

Previously, a linked ID tagged as directly linked would never get back
to the indirectly linked status. Consequence was a lot of 'needless'
references to linked data in .blend files.

This commit also introduces a new flag for lib_query ID usage types,
`IDWALK_CB_DIRECT_WEAK_LINK`, used currently for base's Object
pointer, and for LayerCollection's Collection pointer.

NOTE: A side-effect of this patch is that even IDs explicitely linked by
the user won't be kept anymore when writing files, i.e. they will not be
there anymore after a file reload, if they are not actually used.

Overhead of new process is below 0.1% in whole file saving process in
a Heist production file e.g.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16605
2022-11-30 11:16:14 +01:00
Bastien Montagne 369914e7b1 Liblink: Add test over direct vs indirect link status.
Some checks are currently commented out, since Blender will never 'clear'
the directly linked status of an ID once it has been used by local data.
2022-11-24 10:52:27 +01:00
Wannes Malfait e83f46ea76 Geometry Nodes: Use Mesh instead of BMesh in split edges node
Rewrite the edge split code to operate directly on Mesh instead
of BMesh. This allows for the use of multi-threading and makes
the node around 2 times faster. Around 15% of the time is spent
just on the creation of the topology maps, so these being cached
on the mesh could cause an even greater speedup. The new node
gave identical results compared to the BMesh version on all the
meshes I tested it on (up to permutation of the indices).

Here are some of the results on a few simple test cases:
(Intel i7-7700HQ (8 cores) @ 2.800GHz , with 50% of edges selected)
|       | 370x370 UV Sphere | 400x400 Grid | Suzanne 4 subdiv levels |
| ----- | ----------------- | -------------- | --------------------- |
| Mesh  | 89ms              | 111ms          | 76ms                  |
| BMesh | 200ms             | 276ms          | 208ms                 |

Differential Revision: https://developer.blender.org/D16399
2022-11-20 15:42:10 -06:00
Campbell Barton 0fd94a1f5e Tests: enable element-wise multiplication for mathutils API tests 2022-11-20 10:42:17 +11:00
Hans Goudey 1ea169d90e Mesh: Move loose edge flag to a separate cache
As part of T95966, this patch moves loose edge information out of the
flag on each edge and into a new lazily calculated cache in mesh
runtime data. The number of loose edges is also cached, so further
processing can be skipped completely when there are no loose edges.

Previously the `ME_LOOSEEDGE` flag was updated on a "best effort"
basis. In order to be sure that it was correct, you had to be sure
to call `BKE_mesh_calc_edges_loose` first. Now the loose edge tag
is always correct. It also doesn't have to be calculated eagerly
in various places like the screw modifier where the complexity
wasn't worth the theoretical performance benefit.

The patch also adds a function to eagerly set the number of loose
edges to zero to avoid building the cache. This is used by various
primitive nodes, with the goal of improving drawing performance.
This results in a few ms shaved off extracting draw data for some
large meshes in my tests.

In the Python API, `MeshEdge.is_loose` is no longer editable.
No built-in addons set the value anyway. The upside is that
addons can be sure the data is correct based on the mesh.

**Tests**
There is one test failure in the Python OBJ exporter: `export_obj_cube`
that happens because of existing incorrect versioning. Opening the
file in master, all the edges were set to "loose", which is fixed
by this patch.

Differential Revision: https://developer.blender.org/D16504
2022-11-18 16:05:06 -06:00
Rateeb Riyasat cce4271b31 Add regression test for triangulate faces
Basic test for `quads_convert_to_tris`

As the operator name in blender is different from the bpy name, the operator
name in blender was opted in terms of the blend file collection name as well
as the test name. This was done so that new developers in the future can
easier understand which operator this corresponds to. Although it might be
better to change this to the bpy name so as to be consistent with the rest
of the codebase.

Updated blend file `lib/tests/modeling/operators.blend` has been
committed as rBL63101.

Reviewed By: zazizizou, mont29

Differential Revision: https://developer.blender.org/D16072
2022-11-16 18:34:11 +01:00
Sergey Sharybin 3153bd0f5d SVG: Add more sophisticated test suit
This test suit tests SVG on a big files, as opposite of testing one
specific aspect of the standard by atomic files.
2022-11-10 11:04:30 +01:00
Campbell Barton b320597697 Tests: don't create byte-code cache when calling Python from SVN
Creating `__pycache__` directories in SVN's lib/ directory can cause
updating SVN to fail. Add the -B flag when TEST_PYTHON_EXE from LIBDIR
is used so so Python doesn't generate this cache.
2022-11-03 11:51:52 +11:00
Michael Jones ba67a383fa Cycles: Enable MNEE on Metal (macOS >= 13)
This patch enables MNEE on macOS >= 13. There was an inefficiency in the calculation of spill requirements, fixed as of macOS 13. This patch also adds a temporary inlining workaround for a Metal compiler bug which causes `mnee_compute_constraint_derivatives` to behave incorrectly.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16235
2022-10-12 17:06:50 +01:00
Campbell Barton 3f64b88684 Cleanup: use function style casts for C++, format & spelling 2022-10-12 10:39:12 +11:00
Sergey Sharybin be44fd9401 Fix SVG tests: Add missing file 2022-10-11 15:13:30 +02:00
Sergey Sharybin 223ba59cb0 Beginning of automated SVG regression test
This commit contains the CTest integration.

Starting with the very simple tests for the recent fixes in the
io_corve_svg addon which were related on closing path.

The idea is to use same framework as what we use for render tests
to make it easily visible what aspect of SVG changed or broke.

In order to achieve this both .blend and .svg files are used.
The .svg file defines the exact subject of test, and the .blend
file defines camera, and possibly material.

The longer term idea is to have a number of atomic tests for a
specific SVG features to help isolating problematic areas, as
well as a more comprehensive tests to perform QA.
2022-10-11 15:03:09 +02:00
Campbell Barton a66e584294 Cleanup: correct API usage for script access
In practice this didn't cause problems, but accessing scripts via
bpy.utils.resource_path('USER') ignores the BLENDER_USER_SCRIPTS
environment variable.
2022-09-29 17:22:32 +10:00
Joseph Eagar 0156a677c7 Sculpt: New Cavity Automasking Mode
Add new cavity automasking mode based on local mesh
curvature.  Cavity masking is a great way to quickly add
detail in crevices and the like.  It's meant to be used
with the Paint brush in color attribute mode.  It does
work with other brushes but the results can be unpredictable.

{F13131497}

The old "dirty mask" operator has been replace with a new
"mask from cavity" operator that shares the same code with
cavity automasking.

Differences from the sculpt-dev implementation:
    * It uses the word "cavity."  When I first implemented
this I wasn't aware
      this feature existed in other software (and other
paint modes in Blender),
      and for reasons that escape me today I initially
decided to call it a concave or
      concavity mask.
    * The cavity factor works a bit differently.  It's
      no longer non-linear and functions as a simple
      scale around 0.5f.
    * Supports custom curves.
    * Supports blurring.

Reviewed By: Julian Kaspar, Jeroen Bakker and Campbell Barton
Differential Revision: https://developer.blender.org/D15122
Ref D15122
2022-09-28 16:22:34 -07:00
Sebastian Herhoz 75a6d3abf7 Cycles: add Path Guiding on CPU through Intel OpenPGL
This adds path guiding features into Cycles by integrating Intel's Open Path
Guiding Library. It can be enabled in the Sampling > Path Guiding panel in the
render properties.

This feature helps reduce noise in scenes where finding a path to light is
difficult for regular path tracing.

The current implementation supports guiding directional sampling decisions on
surfaces, when the material contains a least one diffuse component, and in
volumes with isotropic and anisotropic Henyey-Greenstein phase functions.

On surfaces, the guided sampling decision is proportional to the product of
the incident radiance and the normal-oriented cosine lobe and in volumes it
is proportional to the product of the incident radiance and the phase function.

The incident radiance field of a scene is learned and updated during rendering
after each per-frame rendering iteration/progression.

At the moment, path guiding is only supported by the CPU backend. Support for
GPU backends will be added in future versions of OpenPGL.

Ref T92571

Differential Revision: https://developer.blender.org/D15286
2022-09-27 15:56:32 +02:00
Campbell Barton 998ace3463 Cleanup: use lowercase function calls & macros in for CMake
This is already the case for most CMake usage.
Although some find modules are an exception to this, as they were
originally maintained externally they use some different conventions.

Also corrected bad indentation in: intern/cycles/CMakeLists.txt
2022-09-23 14:33:44 +10:00
Campbell Barton 4baa6e57bd Cleanup: prefer 'arg' over 'params' for sphinx documentation
While both are supported, 'arg' is in more common use so prefer it.
2022-09-19 14:24:31 +10:00
Campbell Barton 39c341bf4a Cleanup: remove redundant braces from assert & raise
autopep8 v1.7 added a space after assert & raise,
remove the braces as they aren't needed.
2022-09-14 16:18:59 +10:00
Omar Emara 9990792e87 Compositor: Rename compositor build option
Currently, the compositor can be disabled using the WITH_COMPOSITOR
build option. Since, we intent to always build the realtime compositor,
we need to make the distinction between both compositors clear.

So this patch renames the option to WITH_COMPOSITOR_CPU. Additionally,
the check for the option was moved inside the compositor modules' own
CMake file in preparation for the realtime compositor code.

Differential Revision: https://developer.blender.org/D15622

Reviewed By: Jeroen Bakker, Ray Molenkamp
2022-08-09 15:59:56 +02:00
Campbell Barton 26b9c54b01 License headers: add missing license headers 2022-08-09 13:25:11 +10:00
Campbell Barton 1ec7f75b2a Cleanup: format 2022-08-04 07:41:03 +10:00
Hans Goudey 8081a05015 Tests: Remove deprecated/removed operators from tests
44aa9e40ff
2022-08-02 16:26:38 -05:00