Commit Graph

1665 Commits

Author SHA1 Message Date
Alaska
bbd4aef629 Tests: Rename Principled folder to Principled BSDF
In a previous commit the Principled BSDF tests were renamed from
`principled_...` to `principled_bsdf_...`. The proposal was made to
also rename the folder these tests were in to `principled_bsdf` for the
sake of consistency. This is what this commit does.

Pull Request: https://projects.blender.org/blender/blender/pulls/131771
2024-12-13 12:22:12 +01:00
Aras Pranckevicius
82f0578ca3 Compositor: always use the new CPU compositor
Part of #125968: this makes the new CPU compositor always be used.

Pull Request: https://projects.blender.org/blender/blender/pulls/131783
2024-12-12 20:17:36 +01:00
Clément Foucault
79b0ea17a4 EEVEE: Update camera ortho reference image 2024-12-12 20:07:39 +01:00
Clément Foucault
8cdeecaef8 EEVEE: Increase samples of shadow_link_transparency 2024-12-12 19:56:02 +01:00
Clément Foucault
48a752dee4 EEVEE: Increase threashold for certain render tests
This avoid test failure because of platform difference.
2024-12-12 19:55:52 +01:00
Clément Foucault
f160bc0806 EEVEE: Test: Add condition to skip lightprobe baking in some render tests
This allows to workaround some issues (that have been reported) about
hanging and broken test when baking the lightprobe volumes.
2024-12-12 18:49:58 +01:00
Alaska
337e992d7d Tests: Add Cycles test for baking from the active camera
For a while now Cycles has had the ability to bake a texture from the
perspective of the active camera.

This commit adds two tests for one, one with a glossy sphere with
flat shading, and one with smooth shading.

Ref: blender/blender-test-data!27

Pull Request: https://projects.blender.org/blender/blender/pulls/131083
2024-12-12 04:03:08 +01:00
Alaska
2a40964638 Fix: Storm render tests fail to run
An oversight in b7028617ad lead to Storm
render tests failing due to a missing argument.

This commit fixes that.

Pull Request: https://projects.blender.org/blender/blender/pulls/131740
2024-12-12 01:27:04 +01:00
Charles Flèche
0df5d8220b USD: Add new get_prim_map API callable from python on_import hooks
When importing an USD, the Blender object names do not necessarily match
Prim names:

```
#usda 1.0
def Xform "xform1"
{
  def Mesh "MyObject"  # Will be imported as "MyObject"
}
def Xform "xform2"
{
  def Mesh "MyObject"  # Will be imported as "MyObject.001"
}
def Xform "xform2"
{
  def Mesh "MyObject"  # Will be imported as "MyObject.002"
}
```

This makes it difficult in the [USD Import Hooks]
(https://docs.blender.org/api/current/bpy.types.USDHook.html) to link a
Blender object back to its source Prim for additional processing. A
typical use cases for games is to generate UVs, create and apply a
material on the fly when importing a collision shape that does not have
a visual representation (hence no materials) based on some Prim
attributes, but that the artist needs to differenciate in Blender's
viewport.

The Import context exposes a new method `get_prim_map()` that returns a
`dict` of `prim path` / `list of Blender ID`.

For example, given the following USD scene,
```
/
 |--XformThenCube [def Xform]
 |   `--Cube [def Cube]
 |--XformThenXformCube [def Xform]
 |   `--XformIntermediate [def Xform]
 |       `--Cube [def Mesh]
 |--Cube [def Cube]
 `--Material [def Material]
     `--Principled_BSDF [def Shader]
```

the `get_prim_map()` method will return a map as:

```python
@static_method
def on_import(import_context):
  pprint(import_context.get_prim_map())
```

```json
{
  "/Cube": [bpy.data.objects["Cube.002"], bpy.data.meshes["Cube.002"]],
  "/XformThenCube": [bpy.data.objects["XformThenCube"]],
  "/XformThenCube/Cube": [bpy.data.objects["Cube"], bpy.data.meshes["Cube"]],
  "/XformThenXformCube": [bpy.data.objects["XformThenXformCube"]],
  "/XformThenXformCube/XformIntermediate": [bpy.data.objects["XformIntermediate"]],
  "/XformThenXformCube/XformIntermediate/Cube": [bpy.data.objects["Cube.001"], bpy.data.meshes["Cube.001"]],
  "/Material": [bpy.data.materials["Material"]],
}
```

Co-authored-by: Odréanne Breton <odreanne.breton@ubisoft.com>
Co-authored-by: Sttevan Carnali Joga <sttevan.carnali-joga@ubisoft.com>
Co-authored-by: Charles Flèche <charles.fleche@ubisoft.com>
2024-12-11 21:36:09 +01:00
Sybren A. Stüvel
b7028617ad Refactor: render tests, change how argparse is used
Some changes to how argparse is used in render tests:

1. Use the common approach of one dash for single-letter options (`-b`)
   and two dashes for longer options (`--blender`). In this commit that
   just means changing single-dashed (`-testdir`) to double-dashed
   (`--testdir`).

2. Remove unnecessary `nargs` arguments. The code was telling `argparse`
   to put CLI arguments into a list of one item, and then had code to
   turn that one-item list into the item itself. I've just removed the
   `nargs` argument altogether, as that just produces the desired
   value without requiring more code.

   I've also removed `nargs="+"` from the handling of the `--blender`
   parameter, as that allowed for multiple occurrences of `--blender
   {path}` but was silently ignoring all of those except the first.

   To ensure that required arguments are present, the code now uses
   `required=True` instead of `nargs`.

3. Add a `description` parameter so that `--help` shows what the
   test script actually does. Also it helps people (like me) who want
   to figure out which blend file is actually being opened by the
   test, without making the test itself more verbose.

No functional changes, except that you now cannot add multiple
`--blender` arguments any more (the CLI invocation will fail). This wasn't
used anywhere I could find, though.

Pull Request: https://projects.blender.org/blender/blender/pulls/131666
2024-12-10 14:52:34 +01:00
Aras Pranckevicius
f4b1e169aa Fix: VSE white balance modifier undefined results for HDR colors
Commit 073ce98231 back in 2016 changed white balance math to do
a pow based pixel operation instead of multiplication. However
pow on negative numbers (which would happen on any HDR input) is
undefined. Until some better math is decided upon, at least ensure
the input is not negative.
2024-12-10 10:21:24 +02:00
Alaska
6a23d9d7e9 Tests: Update outdated EEVEE volume tests
During the PR that added the relevant Volume tests, the .blend file
was changed but the corresponding volume reference image was not.

This commit fixes that.
2024-12-10 07:34:06 +01:00
Alaska
8756ebb25a Tests: Rename all Principled tests to Principled BSDF
While looking into something else, I noticed that the OSL render tests
were not testing the Principled Volume tests.

This is because when running OSL tests, we skip all Principled BSDF
tests by ignoring all tests that start with `principled_`
(this was done due to noise differences between SVM and OSL).

However this had the knock on effect of skipping tests like
- `principled_absorption`
- `principled_blackbody`
- `principled_smoke`

in the volumetric test suite.

This commit fixes this issue by renaming all Principled BSDF tests to
`principled_bsdf_` and updating the block list to use this new name.

Ref: blender/blender-test-data!31
Pull Request: https://projects.blender.org/blender/blender/pulls/131540
2024-12-10 06:44:07 +01:00
Michael Kowalski
ba6043fb86 USD: test files for material import hook
Pull Request: https://projects.blender.org/blender/blender/pulls/131559
2024-12-09 18:27:34 -05:00
Hans Goudey
f9c4204b9f Tests: Add test for Set Curve Normal node with Normal input
Regression test for #131621.
2024-12-09 17:05:46 -05:00
Hans Goudey
b7fe1ee1d6 Tests: Add test for "Set Handle Position" node 2024-12-07 12:20:04 -05:00
Jesse Yurkovich
f92bfe0f0b USD: Write sparse values for Camera, Light, and Skeleton attribute data
Make use of our sparse value writer in more places. Namely, when using
animated Camera or Light properties, this will prevent a needless stream
of unchanging values being written into the USD file [1]. Skeletons and
armatures benefit too but less so as typically the primary benefit only
applies to the comparatively small `scale` transform attribute, which
typically remains unchanged from frame to frame.

The newly added `set_attribute` common code can, and eventually will, be
used to reduce boilerplate elsewhere where we do the same sparse writing
dance.

Ref #130759

Pull Request: https://projects.blender.org/blender/blender/pulls/131333
2024-12-07 00:15:08 +01:00
Jesse Yurkovich
76c699ada5 Fix: vertex crease data was imported incorrectly from USD
While adding tests for subd import I discovered that our vertex crease
data was imported incorrectly.

This PR adds tests and fixes:
- We tried to read crease sharpness data as ints instead of floats. This
  caused the import process to early-return, meaning we never load any
  data at all
- Empty USD data would still cause us to create the `crease_vert`
  attribute unnecessarily
- Sharpness data needs clamped to 0-1 to handle USD's SHARPNESS_INFINITE
  value of 10.0
- We need to fill the `crease_vert` span with 0's since incoming USD
  data may not have values set for all the verts

Pull Request: https://projects.blender.org/blender/blender/pulls/131516
2024-12-06 22:19:31 +01:00
Aras Pranckevicius
dc063d8a80 Fix #131106: VSE strip mask inconsistencies between byte and float images
If a strip mask was used several times in the same frame, and it needed
to do byte->float conversion (e.g. mask is produced by a byte-color
strip, but then used in both a byte-color strip, and later on in a
float-color strip), then that byte->float mask image conversion was
introducing two inconsistencies:
- It was making mask alpha channel affect the result, which was not
  happening with regular byte mask images, and
- It was converting float mask to scene linear space, which was
  resulting in different image than with a byte mask.

Fix those issues by ensuring that all VSE modifiers can take either
byte or float mask as-is, without extra conversions. Previously, some
of the modifiers were done in a way where they only handled "(byte
image + byte mask) or (float image + float mask)" cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/131355
2024-12-06 18:43:52 +01:00
Aras Pranckevicius
ba0f9906ef Tests: Add more VSE modifiers render tests 2024-12-06 11:32:37 +02:00
Jesse Yurkovich
69c63311fa Fix #130907: Use Blender Action name as the UsdSkelAnimation name
Rather than using a default "Anim" name when exporting armature
animations, use the animation's Action name instead. Likewise use the
UsdSkelAnimation name for the Action's name during import.

Blendshapes/shapekeys still use the default "Anim" name as there's no
action for these situations.

Pull Request: https://projects.blender.org/blender/blender/pulls/131021
2024-12-04 23:43:07 +01:00
Alaska
615ab676a7 Tests: Add Cycles test for a volume with a zero angle distant light
During Blender 4.2's development, a bug was introduced that lead to
volumes rendering incorrectly if:
- There was a distant light with a zero angle spread
- The light tree was enabled

This was reported to blender/blender#129420 and fixed in 4.3.

This commit adds a render test for this situation.

Ref: blender/blender#123012
Ref: blender/blender-test-data!26

Pull Request: https://projects.blender.org/blender/blender/pulls/131079
2024-12-04 02:09:35 +01:00
Alaska
42f8ffbb4c Tests: Add render test for Principled BSDF with a colored zero weight coat
Ref: blender/blender-test-data!20
Ref: blender/blender!124856
Ref: blender/blender#123012

Pull Request: https://projects.blender.org/blender/blender/pulls/130608
2024-12-04 02:00:21 +01:00
Falk David
f6c30bfe45 Curves: Add python function to compare curve geometries
This adds a `unit_test_compare` function to `Curves`.

Compares the curves. Curves are the same if:
* The number of points matches.
* The number of curves matches.
* The attribute names are the same and have the same type.
* The point attribute values are within the `threshold`.
* The curve topology matches (e.g. the curve sizes are the same).
* The curve attribute values are within the `threshold`.
* The indices of the points and curves are the same (can be ignored if this should be treated as the same).

The implementation reuses the same functions as the existing
comparison function for meshes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131164
2024-12-03 11:11:27 +01:00
Campbell Barton
6ca1417103 Cleanup: suppress unused Python warnings
Suppress unused warnings using the "vulture" utility.

- Include public definitions in the modules `__all__`.
- Mark arguments & variables as unused with a "_" prefix.
2024-12-03 12:54:13 +11:00
Hans Goudey
94309e202f Tests: Add file for object conversion tests 2024-12-02 15:05:59 -05:00
Hans Goudey
d04ac76ed8 Fix #131214: Geometry Nodes: Crash due to Free curve normals 2024-12-02 13:11:52 -05:00
Nathan Vegdahl
089c3cd85c Refactor: rename ChannelBag and channel_bag
We've had a bunch of inconsistency between `channel_bag` and `channelbag` in the
code base.  After discussion with @dr.sybren, we decided to standardize on
`channelbag` and also rename the camelcase `ChannelBag` to `Channelbag` to be
consistent with that.

This PR implements those changes.

Note that the reason we standardized on `channelbag` rather than `channel_bag`
is because it makes things clearer when stringing multiple terms together in
type and function names.  For example, in `channelbag_fcurves_move()` it makes
it clear that `channelbag` describes one thing, rather than `channel` and `bag`
being two separate things.

No functional changes intended.

Pull Request: https://projects.blender.org/blender/blender/pulls/130988
2024-12-02 17:55:59 +01:00
Nathan Vegdahl
aa83738d44 Anim: change parameters of slots.new() RNA function
`Action.slots.new()` in the Python API previously took either an ID or nothing
as a parameter. In the former case it would create a slot with the appropriate
`id_root` and name for that ID. In the latter case it would create a default
slot with an unspecified `id_root` and default name.

This had several issues:

1. You couldn't create a slot with a specific `id_root` without already having
   an ID of that type. In theory this isn't a problem, but in practice in larger
   scripts/addons you don't necessarily have such an ID on hand at the call
   site.
2. You couldn't directly create a slot with a desired name without an existing
   ID with that name. This isn't so important, since you can always just set the
   name afterwards. But it's a bit annoying.
3. Most other `new()` APIs in Blender *require* you to specify the name of the
   item being created. So calling this with no parameters was violating that
   norm.
4. Ideally, we want to eliminate unspecified `id_root`s, since they cause other
   weirdness in the API such as slot identifiers changing upon slot assignment.

To resolve these issues, and just generally to make the API more
straightforward, this PR changes `slots.new()` to take two required parameters:
an ID type and a name. For example:

`slots.new(id_type='CAMERA', name="My Camera Data Slot")`.

This fully specifies everything needed for the slot identifier upon creation,
and doesn't require any outside data items to create a slot with the desired
type and name.

In the future if we decide we still want a `for_id`-style slot creation API, we
can reintroduce it as a separate function.

Ref: #130892
Pull Request: https://projects.blender.org/blender/blender/pulls/130970
2024-12-02 17:04:37 +01:00
YimingWu
38fa0e71ee Tests: Add object conversion tests
Adding object conversion tests to verify the refactored object type
conversion code works as intended.

The object conversion operator `exec()` function is restructured by
PR #130668 to clean up code path for better readability, since it's a
relatively big change, this test is put up to verify that:

- For supported object type pairs, converted objects would have the
  expected target object type.
- For unsupported/unimplemented type pairs, the test expect the
  converted object to have the same type as the source object.
- Verify that the code behaviour stays exactly the same as prior
  to the change in #130668, including code logic that are later subject
  to change and redesign, in which case this test file/script would need
  to be updated accrodingly.

This test added such files:

- `tests/data/modelling/object_conversion.blend`: Sets up differnt types
  of input objects and their expected converted object combinations.
- `tests/python/object_conversion.py`: Does mesh equal checks for
  objects that are converted to mesh against expected objects in the
  blend file, and does object type checks for other target types.

Note:

This test currently does not do topology-level equal check except for
when target object type is `MESH`. Equal check hasn't been implemented
for other object types yet, but ideally in the future we should use
topology check on top of type check for other object types as well.

See https://projects.blender.org/blender/blender/pulls/130668

Pull Request: https://projects.blender.org/blender/blender/pulls/130738
2024-12-02 16:30:41 +01:00
Richard Antalik
f1775361e1 VSE: Update test after fix in 618b7f4a9b
Render behavior was incorrect after 5ecb70964e. For more info see commit
message in 618b7f4a9b.
2024-12-02 10:22:19 +01:00
Campbell Barton
bc66905a15 Cleanup: remove/comment unused functions 2024-12-02 11:23:47 +11:00
Alaska
f090bb73ec Cycles: Add test for overlapping volumes with different anisotropy
Ref: blender/blender-test-data!17

Ref: blender/blender#125595
Ref: blender/blender#123012

Pull Request: https://projects.blender.org/blender/blender/pulls/130491
2024-11-29 06:34:51 +01:00
Alaska
31bfcff4ea Tests: Add Cycles tests for new volumetric scatter phase functions
Blender 4.3 added new volumetric scatter phase functions to Cycles.
This commit adds tests for each of the new phase functions.

Ref: blender/blender@0315eae536
Ref: blender/blender#123012
Ref: blender/blender-test-data!25

Pull Request: https://projects.blender.org/blender/blender/pulls/130894
2024-11-28 06:59:23 +01:00
Alaska
0ab0f41c1e Tests: Add render tests for shadow linking on point clouds and curves
Having a test like this was found to be useful during
blender/blender!125803

And a test like this will be useful in case of refactors or in the case
HIP-RT adds native point cloud support.

Ref: blender/blender-test-data!19
Ref: blender/blender-test-data!21
Ref: blender/blender#123012
Pull Request: https://projects.blender.org/blender/blender/pulls/130504
2024-11-27 16:13:33 +01:00
Nathan Vegdahl
409697a962 Anim: rename action_slot_name to last_slot_identifier
`AnimData`, NLA strips, and action constraints all have an `action_slot_name`
field in RNA. The purpose of this field is to store the identifier of the most
recently assigned slot, so that it can be used for auto-assignment when later
assigning different actions.

However, this field name is misleading in two ways:

1. In accordance with #130740, it's actually the slot *identifier*, not name.
2. It could be mistaken as a way to rename the currently assigned slot, which it
   is not.

To resolve both of those issues, we're renaming the field to
`last_slot_identifier`, which better communicates its actual nature.

As a bonus, this also ends up decluttering Python autocomplete when looking
for things related to action_slot.

Ref: #130892
Pull Request: https://projects.blender.org/blender/blender/pulls/130911
2024-11-26 16:05:40 +01:00
Nathan Vegdahl
c0fd193abf Anim: rename slot name to slot identifier
This PR renames `ActionSlot::name` to `ActionSlot::identifier` for both DNA and
RNA, and also renames related methods, functions, constants, and comments.

The purpose of this rename is to help make it clear that this is not a "name"
in the traditional sense, but rather is a composite of the slot name + id type
for lookup purposes.

Ref: #130892
Pull Request: https://projects.blender.org/blender/blender/pulls/130740
2024-11-26 12:11:06 +01:00
Alaska
6768f9120b Test: Update reference image for Cycles light texture test
Over the last few releases, Blender main has drifted away from the
reference image for the light texture test.
The two main contributors being:
blender/blender@296ac0e9ef
blender/blender@84bab7f300

This is fine for most platforms as the differences between main and the
reference image have been within the test threshold.

However oneAPI is failing on this render test due to the differences
between main and the reference, plus some other small differences
specific to oneAPI.

This commit updates the reference image to fix the failing test with
oneAPI.

Ref: blender/blender-test-data!22
Pull Request: https://projects.blender.org/blender/blender/pulls/130681
2024-11-23 03:20:39 +01:00
Hans Goudey
ea875f6f32 Geometry Nodes: Port triangulate node from BMesh to Mesh
Add a Mesh implementation of triangulation, which is currently just
implemented for BMesh. The main benefit of this is performance and
decreased memory usage. The benefit is especially large because the
node currently converts to BMesh, triangulates, and then converts back.
But the BMesh implementation is entirely single threaded, so it will
always be much slower.

The new implementation uses the principle of "never just process a
single element at a time" but it also tries to avoid processing _too_
many elements at once, to decrease the size of temporary buffers.
Practically that means the work is organized into chunks of selected
faces, but within each chunk, each task is done in a separate loop.
Arguably I went a bit far with some optimizations, and some of the
complexity isn't necessary, but I hope everything is clear anyway.

Unlike some other Mesh ports like the extrude node or the split edges
code, this generates a new mesh. I still go back and forth on that
aspect, but reusing the same mesh would have required reallocating
face attributes from scratch anyway. Implicit sharing is used to
avoid copying vertex attributes though.

The result mesh is reorganized a bit. Unselected face data comes first,
then selected triangles, then triangulated NGons, then triangulated
quads. This makes attribute interpolation and internal calculations
more efficient.

The "Minimum Vertices" socket is replaced with versioning. In the new
implementation it would have an impact on code complexity, and for a
builtin "atomic" node it makes more sense as part of the selection.

The performance difference depends on the number of CPU threads, the
number of attributes, and the selection size. As all of those numbers
go up, the benefit will grow. The "modes" also affect the performance,
obviously.

With a Ryzen 7950x, I tested performance in a few situations (in ms):
|                            | Selection | Before | After | Change |
| -------------------------- | --------- | ------ | ----- | ------ |
| 1.4 m quads (fixed)        | 50%       | 1533   | 15.9  | 96x    |
| 10 m quads (shortest)      | 100%      | 9700   | 165.0 | 59x    |
| 1 m 10-side Ngons (beauty) | 90%       | 3785   | 115.9 | 33x    |
| 1 m quads many attributes  | 100%      | 54600  | 332.3 | 164x   |

In follow-up commits, I'll move other areas to use mesh triangulation
instead of BMesh. This is the last geometry node using BMesh besides
the Ico Sphere primitive.

Pull Request: https://projects.blender.org/blender/blender/pulls/112264
2024-11-23 00:25:52 +01:00
Hans Goudey
9d36f6c828 Tests: Tweak two Geometry Nodes triangulation test files 2024-11-22 18:12:02 -05:00
Falk David
dc6e879d0f Grease Pencil: Setter for drawing property on frame python API
Previously, it wasn't possible to copy a drawing from one frame to another
if that drawing was in another layer or object.

This allows the `frame.drawing` property to be set to any another drawing.
Setting `drawing` to `None` clears the drawing geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/130523
2024-11-22 14:19:20 +01:00
Falk David
b8ace9331c Grease Pencil: Add python tests for the layer.frames API
This adds tests for the `frames.new`, `frames.remove`, `frames.copy`,
and `frames.move` python API.

Pull Request: https://projects.blender.org/blender/blender/pulls/130726
2024-11-22 12:47:50 +01:00
Christoph Lendenfeld
16c2e71ab0 Anim: Symmetrize collection assignments when symmetrizing Armatures
This patch makes it so collection assignments of bones are
symmetrized when the "Symmetrize" operator is run.

* Only collections with names that can be symmetrized are modified.
* Collections are created if they don't exist,
they are created under the same parent as the source collection
* In the case of a "left" bone assigned to a "right" collection the
resulting "right" bone will be assigned to a "left" collection.
The system does explicitly not try to be smart here.

Also adds unit tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/130524
2024-11-22 12:31:29 +01:00
Hans Goudey
c17b546dac Tests: Add two new geometry nodes triangulate test files 2024-11-21 10:27:48 -05:00
Jesse Yurkovich
39e96d9c0f Fix #130155: Handle opacityThreshold controlled with individual image channels
When EEVEE next removed the Alpha Threshold option a node graph setup
was used instead. Based on a USD test asset[1] the original code was
designed around only using the Image A channel during import to wire
up the nodes. However, the other channels (R, G, or B) are just as
valid.

We now handle this by wiring up the Separate RGB node, that is already
inserted for the scenario in general, to the shader nodes handling the
threshold calculation. Also adds additional test coverage for both
export and import as well.

The Round and LessThan+OneMinus networks remain the only shapes that
will be recognized for the processing.

[1] https://github.com/usd-wg/assets/tree/main/test_assets/AlphaBlendModeTest

Pull Request: https://projects.blender.org/blender/blender/pulls/130346
2024-11-21 03:50:11 +01:00
Jesse Yurkovich
2523958e0e USD: Add support for animated point instancers
The existing point instancer reader is slightly refactored to allow for
animated setups. The primary change is simply to inherit from
`USDGeomReader` rather than `USDXformReader`. This allows access to the
`read_geometry` API used by the cache modifier.

The existing `read_object_data` method is split into two parts with
`read_geometry` loading per-frame USD data and `read_object_data`
coordinating the initial loading process, including creating the GN node
tree just once.

A new test has been added (a variation of the nested point instancer
file) with time samples on various attributes and on both point
instancers. This also fixes #129502 and the file provided in that issue.

----
The already added test file is `tests/data/usd/usd_point_instancer_anim.usda`

Pull Request: https://projects.blender.org/blender/blender/pulls/129881
2024-11-20 22:03:32 +01:00
Jesse Yurkovich
cf1a3cb41f USD: Add test data for upcoming feature work 2024-11-20 10:34:28 -08:00
Alaska
60bf09e8db Tests: Add render test for Orthographic camera with DOF with far nearclip
Ref: blender/blender-test-data!18

Ref: blender/blender#123249
Ref: blender/blender@08cc73a9bb

Pull Request: https://projects.blender.org/blender/blender/pulls/130500
2024-11-20 05:34:52 +01:00
Charles Flèche
428ab699dc USD: Add option to merge transform and shape on export
Adds the option `merge_parent_xform` to the USD export operator and
panels so the transform and shapes are merged into a single USD Prim.

Without the option (existing default), a top-level mesh would be
exported as a top-level `Xform` that has a `Mesh` child:
```
def Xform "MyBlenderMeshObject"
{
  matrix4d xformOp:transform = ...

  def Mesh "MyBlenderMeshData"
  {
  }
}
```

This matches the Blender data model, where a transformable object
contains a geometric shape (like a mesh). This structure is also very
valid in USD, where we don't want to directly instantiate geometric
primitives[1]

However, "since number of prims on a stage is one of the primary factors
that governs how USD scale"[2], to reduce the number of prims in a
stage, geometric primitives *are transformable* themselves (see the
inheritence diagram[3]).

As such, the new export option allows to export geometric primitives
without the parent transform:
```
def Mesh "MyBlenderMeshObject"
{
  matrix4d xformOp:transform = ...
}
```

This MR adds a the `is_object_data_context` flag to the
`HierarchyContext` context structure. The point of this change is to
make unambiguous in `USDHierarchyIterator::create_usd_export_context`
the fact that an `object` or a `data` is currently being exported: the
new `merge_parent_xform` option is meaningless for `object`. Only `data`
can be exported with a parent `Xform` or as a child of said `Xform`.

Ideally this flag would not be needed at all: the final USD prim path
*could* be computed in an override of the virtual
`AbstractHierarchyIterator::get_object_data_path` method. However, this
would mean that an `object` and a `data` would have the same export path.
This does not currently play well with
`AbstractHierarchyIterator::ensure_writer`, where `writers` are cached
*by their export path*: it would cache a transform writer, but will skip
the subsequent data writer.

Additionally, another new `is_parent` flag is added to handle the case
where merging the Xform is invalid: objects that are parents to other
objects should remain unmerged as otherwise that would yield invalid USD
files.

[1] https://openusd.org/release/glossary.html#usdglossary-gprim
[2] https://openusd.org/release/glossary.html#usdglossary-instancing
[3] https://openusd.org/release/api/class_usd_geom_xformable.html

Co-authored-by: Odréanne Breton <odreanne.breton@ubisoft.com>
Co-authored-by: Sttevan Carnali Joga <sttevan.carnali-joga@ubisoft.com>
Co-authored-by: Charles Flèche <charles.fleche@ubisoft.com>
2024-11-19 19:18:53 +01:00
Sergey Sharybin
8467e05036 Fix: Make CMake files compatible with CMake 3.10
The `cmake_path()` function was introduced in CMake 3.20,
while our minimum supported version is 3.10.

In practice this fixes compilation error API docs.

Pull Request: https://projects.blender.org/blender/blender/pulls/130447
2024-11-18 12:32:17 +01:00