Refactored USD instancing export to support instanceable references.
With this change, it's now possible to instance object hierarchies and
geometry types other than meshes (e.g., curves, point clouds, etc.).
No longer marking mesh prims as instances in
USDGenericMeshWriter::write_mesh().
USDTransformWriter::do_write() now marks the Xform as instanceable
with a reference to the prototype's Xform when the Blender object is
an instance.
In USDAbstractWriter::mark_as_instance() the target prim is now marked
as instanceable.
Added AbstractHierarchyIterator virtual functions include_data_writers()
and include_child_writers() to allow pruning children of instanceable Xforms
in AbstractHierarchyIterator::make_writers(). These functions return true
in the base class implementation, so that the iterator behavior for Alembic
exports is unaffected. In the USDHierarchyIterator subclass, these functions
are overridden to return false if instancing is enabled and the objects are
instances.
Added virtual function AbstractHierarchyIterator::should_determine_duplication_references()
which returns true if duplication references should be resolved for children
of a given context. This function is overridden in USDHierarchyIterator to
skip processing children of instances, which is more efficient for USD export,
since children of instances are pruned during traversal for writing. For nested
instances where the original prototype is not included in the export, this also
avoids designating a duplicated object parented to an instance as "the original",
which would cause USD errors since defining a prim under an instance
proxy is not allowed.
Extended logic in `AbstractHierarchyIterator::determine_duplication_references()`
to identify prototypes.
Added new function `HierarchyContext::is_prototype()`.
Disallowing merging with parent for instances and prototypes, since
the Xforms cannot be discarded in those cases.
Extended `USDWriterAbstract::ensure_usd_material()` with special logic
to ensure materials for prototype prims are defined in the subtree of the
prototype. This helps ensure the hierarchical encapsulation requirement
for prototypes and is required by certain renderers (e.g., Houdini's Karma)
for instance materials to render.
Added a new `process_scene_graph_instances()` function to ensure
prototypes are exported as abstract prims.
Added python tests test_export_native_instancing_true and
test_export_native_instancing_false.
Pull Request: https://projects.blender.org/blender/blender/pulls/131707
The issue was that the function that computes the maximum used material index
did not take the edit mesh into account yet. This led the drawing code to
believe that only the first material is used by the mesh.
Pull Request: https://projects.blender.org/blender/blender/pulls/133711
This patch allows the multi-function procedure pixel operation to
operate on single values. While it previously assumes a 1x1 image for
processing which was later reduced to a single value using input
processors. This is more efficient, but will allow us to use
multi-function procedures for single value sub-trees even in GPU
execution.
This patch adds a none-const variant of the get_single_value method and
use that in the set_single_value method, which will reduce code
duplication. This is also needed for a future change.
The Translate node is a transform operation that should not realize the
transformations of its input. So this patch marks its input accordingly.
Additionally, we also protect against operating on single values and
pass them without changes.
Precision in knife operations is greatly impacted when projecting a 3D
coordinate to 2D in screen space.
This happened for example when performing constraint operations, where
only the mval of the constrained position was used for snapping.
To solve this problem, the constrained position is now used to
calculate the ray_orig and ray_dir used in snap operations.
Now, a ray_orig and ray_dir are calculated whenever an mval is
set and can be adjusted later when setting a constraint.
Ref !131764
In NDOF's turntable mode, direction of rotating around Z axis should be
inverted when the view is "upside-down".
Co-authored-by: Kamil Galik <kgalik@3dconnexion.com>
Ref: !129970
This PR explicitly declares integer type for `image_center_offs`, which
formalizes accidentally implemented correct behavior. Previously type
was float, all rhs types in expression were integers, so result was int
cast to float.
Comment is also added clarifying why integer must be used - float may
cause images to be interpolated, even when translation is set to 0.
There should be no functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/133573
After drop to scene operation, notifiers are sent to redraw the tree but
it uses the old tree hierarchy. `RGN_DRAW_NO_REBUILD` flag prevented the
tree rebuilding in `outliner_build_tree`. To clear the flag, call
region_redraw function inside `scene_drop_invoke()`.
Pull Request: https://projects.blender.org/blender/blender/pulls/133253
In the theme settings for the user interface, there was a option to
change the outline color of pulldown menus (E.g. the buttons at the top
of the 3D viewport) when the button was selected.
However this color wasn't used. This commit aims to fix that
by using the selected outline color for the outline of selected
pulldown buttons.
Pull Request: https://projects.blender.org/blender/blender/pulls/133470
Since one user-defined conversion operator is allowed during implicit conversion,
and after this conversion here is a constructor which can accept result
of conversion, there was a backdoor for a vector types to up-cast their
dimensions via cast to pointer type of a component of a vector. Since it was
implicit and non-intentional it led to buffer overflows.
Pull Request: https://projects.blender.org/blender/blender/pulls/132927
This adds a debugging utility for developers that makes it easier to what's
stored in a .blend file. Some possible use cases:
* Figure out if some specific data has been written to the .blend file.
* Check the order of data in the .blend file.
* Work towards having less runtime dependent changes in .blend files (it's
easier to diff the textual output).
It is **not** a goal to provide a general human and machine readable form of
.blend files (like xml/json files). That would be way more involved.
The way to use this is to set `GENERATE_DEBUG_BLEND_FILE` to `1` at the top of
`writefile.cc`. Then, whenever Blender saves a .blend file, it will generate a
`.debug.txt` file next to it.
There is already `blend2json.py` which serves a similar purpose but is a
separate program that can be executed on the .blend file afterwards. With the
`--full-data` flag it outputs comparable data, but the output is a bit more
verbose and it needs an extra step that can be avoided by generating the
`.debug.txt` file immediately. For certain use cases,
`GENERATE_DEBUG_BLEND_FILE` can be more convenient. It's also much simpler to
add log additional data in that file that is produced during the blend-write
process.
Pull Request: https://projects.blender.org/blender/blender/pulls/133063
When assigning an Action to an ID, a slot can be automatically
assigned as well. This behaviour is now extended by making untyped
slot identifiers (like `XXSlot`) act as wildcards.
If the last-used slot identifier was 'untyped' (like `XXSlot`), and a
slot with the same name that is specific to the animated ID's type
exists, that slot will be chosen.
Similarly, if the last-used slot identifier was 'typed' (like
`OBSlot`), a slot `OBSlot` does NOT exist, but an untyped slot with
the same name exists (like `XXSlot`), that one will be chosen.
If there is any ambiguity in the matter, the more specific slot is
chosen. In other words, in this case:
- last_slot_identifier = `XXSlot`
- both `XXSlot` and `OBSlot` exist on the Action (where `OB`
represents the ID type of `animated_id`).
the `OBSlot` should be chosen. This means that `XXSlot` NOT being
auto-assigned if there is an alternative. Since untyped slots are
bound on assignment, this design keeps the Action as-is, which means
that the `XXSlot` remains untyped and thus the user is free to assign
this to another ID type if desired.
Pull Request: https://projects.blender.org/blender/blender/pulls/133653
When an action slot does not have an ID type, and it is assigned to some
ID, the slot is bound to that ID's type. This now no longer happens when
the Action is linked, because linked data should not be modified.
Pull Request: https://projects.blender.org/blender/blender/pulls/133670
"Shape Key Lock", the current name for the property to isolate
a shape key is non-descriptive. The pin icon helps a bit but
it is still unrelated.
Rename "Shape Key Lock" to "Solo Active Shape Key".
More details and screenshots in the PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/133377
There is no (good) reason to use 'refine' internal code to create RNA
pointers of IDs, these always ignore any 'ID inheritance', since by
definition the 'owner ID' info of an ID PointerRNA is always that ID.
Similarily, do not call RNA pointers creation code with null data, this
will simply return `PointerRNA_NULL`, can as well return that directly.
Pull Request: https://projects.blender.org/blender/blender/pulls/133668
Deduplicate `assign_action_ensure_slot_for_keying()` and
`generic_slot_for_autoassign()`.
Some of the functionality of the latter function was copied into the
former. This has now been replaced by actually calling the function in
the appropriate spot.
No functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/133652
This adds a shallow check to see if the node group has been changed. If it has
been changed, the weak library reference is removed so that the node group will
be loaded from the source file again. This should become unnecessary once we
have asset embedding.
There are probably still ways to make Blender behave unexpectedly when editing
the Smooth by Angle node group, but this should already cover common edits. More
precise checks could be added as necessary.
Pull Request: https://projects.blender.org/blender/blender/pulls/133654
An Action slot usually has a specific ID type (`ActionSlot::idtype`).
When this is set to 0, it is not specifc to any particular ID type. The
latter case was called "unbound", and is now called "untyped".
Note that untyped slots are given an ID type as soon as they are
actually assigned to any ID.
No functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/133651
This patch introduces a new Derived Resources concept to the compositor.
Derived resources are resources that are computed from a particular
result and cached in it in case it is needed by another operation, which
can greatly improve performance in some cases at the cost of more memory
usage.
The first use case is to store denoised versions of the Denoising Albedo
and Denoising Normals passes if auxiliary pass denoising is enabled in
the denoise node. Consequently, multi-pass denoising setups where the
same auxiliary passes are used in multiple denoise nodes should be much
faster due to caching of the derived resources.
This implementation has the limitation that it can't preemptively
invalidate the cache when the derived resources are no longer needed to
free up memory. This requires a special resource tracking mechanism that
need to happen during node tree compilation, and will be submitted
later. The limitation is not significant in the particular derived
resources that is currently implemented. Since the auxiliary passes are
rarely used outside of denoising.
Fixes#131171.
Pull Request: https://projects.blender.org/blender/blender/pulls/125671
Uninitialized textures are bound when simplified anti-aliasing is disabled.
The textures are initialized later. Fixing by referencing the textures
similar to the other passes.
Pull Request: https://projects.blender.org/blender/blender/pulls/133648
Broken detection of isolated archipelagos of IDs lead to falsly detecting
some data as unused in some specific cases (when the entry point of the
archipelago was only used within that archipelago, but some other ID in
the archipelago had actual valid users outside of it).
The issue is that the localized node tree has an invalid type if the linked file
is not available. So we essentially ended up with a geometry node group that
contains a group node that points to a non-geometry nodes group.
Pull Request: https://projects.blender.org/blender/blender/pulls/133650
Adding sockets to the file output node using `node.inputs.new` is not supported.
They would have been removed in `update_output_file` again anyway if the code
would get that far. The correct way to do this is to use the `node.file_slots`
API. We still allow moving and removing sockets for the time being, because
changing that would be a breaking change.
Pull Request: https://projects.blender.org/blender/blender/pulls/133554
Attribute name could be a path built from multiple object/property names
while each of them can be 64 symbols long.
This was fixed by cff53fdb53, so Cycles
can handle this. But eevee need additional change.
Pull Request: https://projects.blender.org/blender/blender/pulls/131183
Recently it came to out attention that macOs13 doesn't always work due
to texture atomics not supported by that version of the OS.
Development happens most of the time on newer versions of the OS without
ability to check if it still works on the older versions.
This PR enables to disable some Metal capabilities to better check how
Blender works on those OS's. The capabilities that will be disabled
are texture gathering and texture atomics. It doesn't disable the
capabilities that are required to start Blender, which are still
part of the `MTLCapabilities` struct.
This allows us to reproduce issues like #129571
Pull Request: https://projects.blender.org/blender/blender/pulls/133636
When moving an object with a motion path and animdata but no assigned
action, and with certain auto-key settings enabled, Blender would crash.
The cause was code that tried to access an action's fcurves without
proper guarding: the guard checked whether an object had animdata, but
not whether it had an action assigned or not, and would happily try to
access that non-existent action's fcurves.
This fixes the crash by also checking if an action is assigned.
Pull Request: https://projects.blender.org/blender/blender/pulls/133552
This PR implements a new the threading model for building render graphs
based on tests performed last month. For out workload multithreaded
command building will block in the driver or device. So better to use a
single thread for command building.
Details of the internal working is documented at https://developer.blender.org/docs/features/gpu/vulkan/render_graph/
- When a context is activated on a thread the context asks for a
render graph it can use by calling `VKDevice::render_graph_new`.
- Parts of the GPU backend that requires GPU commands will add a
specific render graph node to the render graph. The nodes also
contains a reference to all resources it needs including the
access it needs and the image layout.
- When the context is flushed the render graph is submitted to the
device by calling `VKDevice::render_graph_submit`.
- The device puts the render graph in `VKDevice::submission_pool`.
- There is a single background thread that gets the next render
graph to send to the GPU (`VKDevice::submission_runner`).
- Reorder the commands of the render graph to comply with Vulkan
specific command order rules and reducing possible bottlenecks.
(`VKScheduler`)
- Generate the required barriers `VKCommandBuilder::groups_extract_barriers`.
This is a separate step to reduce resource locking giving other
threads access to the resource states when they are building
the render graph nodes.
- GPU commands and pipeline barriers are recorded to a VkCommandBuffer.
(`VKCommandBuilder::record_commands`)
- When completed the command buffer can be submitted to the device
queue. `vkQueueSubmit`
- Render graphs that have been submitted can be reused by a next
thread. This is done by pushing the render graph to the
`VKDevice::unused_render_graphs` queue.
Pull Request: https://projects.blender.org/blender/blender/pulls/132681
PR #133601 exposes some holes in the Status Bar display. Currently you
can see keymap entries for other areas, like 3D View, when hovering in
the Top Bar. Or see the wrong items when hovering in a non-region
portions of an area. Or see keymap entries for window regions while
hovering headers. This PR fixes all these things.
Pull Request: https://projects.blender.org/blender/blender/pulls/133620
When your mouse is hovering in the gaps between editors the Status Bar
indicates that you can resize and bring up context options. This same
gap is also along the outside window edges even though not visible and
so shows these options when not applicable. This PR carefully shows the
actual area options right up to the edge instead. And also does not
show "Resize" for the gap between global areas and the rest.
Pull Request: https://projects.blender.org/blender/blender/pulls/133601