The `pxr::VtArray<T>` type is based on a copy-on-write scheme that is
very easy to trigger unnecessarily because of how the C++ type system
works[1].
Here we bypass unneeded copies by ensuring we always call the `const`
version of various accessor functions. The offending call-sites were
found by using the `VT_LOG_STACK_ON_ARRAY_DETACH_COPY` env variable.
This yields a very small 2-3% performance benefit when loading in a
typical, mixed-use, asset like e.g. the "4004 Moore Lane" scene.
[1] https://github.com/PixarAnimationStudios/OpenUSD/blob/dev/pxr/base/vt/array.h#L139
Pull Request: https://projects.blender.org/blender/blender/pulls/136014
Though "Point Cloud" written as two words is technically correct and should be used in the UI, as one word it's typically easier to write and parse when reading. We had a mix of both before this patch, so better to unify this as well.
This commit also renames the editor/intern/ files to remove pointcloud_ prefix.
point_cloud was only preserved on the user facing strings:
* is_type_point_cloud
* use_new_point_cloud_type
Pull Request: https://projects.blender.org/blender/blender/pulls/134803
- Remove redundant .HasValue() calls
We are calling `GetPrimvarsWithValues` which will do the HasValue
checks for us already.
- Consistently skip non-array primvars
We only want to import in the array attributes. Consistently check for
this in each of our loops.
Pull Request: https://projects.blender.org/blender/blender/pulls/132816
It was difficult to notice, but we weren't making use of the
`USDPrimReader::valid()` API calls during import.
In many(all?) cases this was fine as we would check the validity during
`read_object_data` or similar anyhow. Rather than just removing the API
entirely, this patch attempts to use it and has the following design:
- Where ever and whenever a reader is created, in addition to checking
null, we should now also check for `valid()` This happens in
`usd_capi_import` and `usd_reader_stage`.
- The `valid()` call is intended to check just the USD object status.
Blender object checks are handled elsewhere (same as they are
currently) since these objects are often not available at the time of
the call to `valid()`
This has the benefit that we at least know that USD is valid before our
heavy reading code ever starts executing. Some duplicate checks are now
removed.
Pull Request: https://projects.blender.org/blender/blender/pulls/129181
- Use `lookup_or_add_for_write_only_span` in more places
- Use `copy_from` when reading in positions for the few readers where
this wasn't already being done
- Remove manual memory management when processing corner normals
Pull Request: https://projects.blender.org/blender/blender/pulls/128043
Reduce dependence on Blender headers as much as possible and move closer
to an include-what-you-use setup.
- Removes unnecessary includes
- Replaces some includes with more appropriate, narrower, substitutes
Pull Request: https://projects.blender.org/blender/blender/pulls/122619