Commit Graph

120055 Commits

Author SHA1 Message Date
Sergey Sharybin
c70a38798d API: Better documentation of scene.frame_set()
Make it explicit that it updates all view layers.

Ref #133379

Pull Request: https://projects.blender.org/blender/blender/pulls/133536
2025-01-29 12:13:59 +01:00
Jacques Lucke
e1753900b7 BLI: improve UTF-8 safety when copying StringRef to char buffers
Previously, there was a `StringRef.copy` method which would copy the string into
the given buffer. However, it was not defined for the case when the buffer was
too small. It moved the responsibility of making sure the buffer is large enough
to the caller.

Unfortunately, in practice that easily hides bugs in builds without asserts
which don't come up in testing much. Now, the method is replaced with
`StringRef.copy_utf8_truncated` which has much more well defined semantics and
also makes sure that the string remains valid utf-8.

This also renames `unsafe_copy` to `copy_unsafe` to make the naming more similar
to `copy_utf8_truncated`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133677
2025-01-29 12:12:27 +01:00
Philipp Oeser
bf2264a3b8 Cleanup: typo 2025-01-29 10:09:59 +01:00
Philipp Oeser
8703317b81 Fix #133687: editbone transform wrong with hidden connected parent bone
If the parent editbone is hidden, it will (rightfully) not be taken into
account in `createTransArmatureVerts`.
In `recalcData_edit_armature` though, there was the assumption in a
particular code path that "this bone has a parent tip that has been
moved" even though it wasnt (because it was hidden -- see above).

To resolve, guard this code path with a `EBONE_VISIBLE` check.

Pull Request: https://projects.blender.org/blender/blender/pulls/133707
2025-01-29 10:07:27 +01:00
Philipp Oeser
0b97b60b2a Fix #133614: Grease Pencil: Handles wrong after Selection to cursor
Just missing the re-calculating of the handles [we already have a
function for this, just call it]

Pull Request: https://projects.blender.org/blender/blender/pulls/133649
2025-01-29 10:01:30 +01:00
Philipp Oeser
a77e0ccd78 Fix: Curves "Warp" and "Randomize" dont update properly
Resolve by tagging positions as changed.

With this and !133544 (which fixes #133537) we can also expose those operators in the menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/133548
2025-01-29 10:00:05 +01:00
Philipp Oeser
8a45c24f57 Fix: "Affect only origins" does not work for Curves
For this to work, we need to properly support `XFormObjectData` for
`Curves`.

Similar to 50770bd8f5

Part of #103680

Also fixes #133537

Pull Request: https://projects.blender.org/blender/blender/pulls/133544
2025-01-29 09:57:36 +01:00
Campbell Barton
1fdb91c766 License Headers: quiet "check_licenses" warnings 2025-01-29 17:22:51 +11:00
Michael B Johnson
662c1b815c Fix #131459: Treat USD DomeLight options as Lights rather than Materials
This commit moves the Convert World Material checkbox under Materials to
a World Dome Light option "under" Lights. Based on feedback this is more
intuitive for artists. Previously artists would try unchecking "Lights"
and be confused why a DomeLight would still be in their scene.

This is only a UI layout change, API remains unchanged.

Authored by Apple

Co-authored-by: Dhruv Govil <dgovil2@apple.com>

Pull Request: https://projects.blender.org/blender/blender/pulls/131829
2025-01-29 06:56:40 +01:00
Campbell Barton
91fc1c7fac Refactor: split viewport bounds calculation into utility functions
Move 3D viewport bounds calculation out of the operator callbacks
into utility functions, needed for !129594.

Some minor renaming:

- `ok` -> `changed`.
- `ok_dist` -> `do_zoom`.
2025-01-29 14:39:33 +11:00
Harley Acheson
867e9d879a Fix #59358: Don't Show Status Bar Impossible Confirms & Cancels
When performing a transform operation that drags or tweaks, do not show
the Cancel or Confirm keymap item on the Status Bar if they use the
same mouse button that initiated the operation. For example if you are
RCS and are tweaking an object, don't show Cancel on status bar since
that requires right click. If LCS then don't show Confirm (requires
left click) when tweaking, dragging gizmo parts, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/131336
2025-01-29 03:57:08 +01:00
Campbell Barton
bd1ded952b Cleanup: spelling in comments 2025-01-29 12:31:19 +11:00
Campbell Barton
915ba086ca Cleanup: use EBONE_VISIBLE / EBONE_SELECTABLE to simplify checks
ANIM_bone_is_visible_editbone was being used in situations where the
intention is to check if the bone is visible to the user.

In this case, EBONE_VISIBLE makes more sense as it also accounts
for hidden bones too.
2025-01-29 12:15:54 +11:00
Campbell Barton
73f66f5a72 Transform: use consistent bone visibility checking
Check bone visibility before selection to ensure bones in hidden
collections aren't handled as selected.
2025-01-29 12:15:53 +11:00
Campbell Barton
01e879957c 3D View: add missing calls to force-finish smooth view
Operations that act on the viewport should finish smooth-view first.
2025-01-29 12:15:53 +11:00
Campbell Barton
eb1340517f Fix use after free toggling quad-view 2025-01-29 12:15:53 +11:00
Jesse Yurkovich
e44fa6040a Cleanup: USD: Remove dead field from USDMeshReader
Remove the dead `uv_token_map_` field from `USDMeshReader`, reducing its
size by 448 bytes in the process.

Pull Request: https://projects.blender.org/blender/blender/pulls/133346
2025-01-29 02:13:17 +01:00
Julian Eisel
9d83061ed4 UI: Don't re-query invalid preview images from disk
Loading a custom preview/icon from disk can fail, e.g. if the image file
is corrupted. This was never handled that well, and I think since
315e7e04a8 we'd continuously re-query such previews.

Fixes #133617.
Also needed for #131871.

Pull Request: https://projects.blender.org/blender/blender/pulls/133679
2025-01-28 19:32:54 +01:00
Hans Goudey
8692c093d6 Fix #101979: Edge angle node outputs wrong sign
Use the third point of the triangle connected to the edge
instead of the center of the second face as a reference point
for the concavity test.

Pull Request: https://projects.blender.org/blender/blender/pulls/133682
2025-01-28 18:16:53 +01:00
Clément Foucault
10c0b19213 Cleanup: GPUMaterial: Remove leftover EEVEE Legacy code 2025-01-28 17:48:34 +01:00
Clément Foucault
bb72bd509e Fix #88185: EEVEE: Collection Holdout not working properly in Blended mode
This was caused by using the same factor as in dithered.
But dithered already has the transparency applied from
the dithered transparency. The transparency needs to be
applied to holdout in forward.
2025-01-28 17:48:33 +01:00
Hans Goudey
3deedd9181 Sculpt: Simplify vector displacement brush calculation
Remove the need for a temporary array of colors.
Just put the data directly into the translations vector.
This should provide a small performance improvement.
2025-01-28 11:16:06 -05:00
Nathan Vegdahl
d93b2d43d3 Anim: allow reordering Slots in Action Editor channel list
This updates the Move Channels operator in the Action Editor channel list to
also work with Slots, allowing Slots to be reordered within an Action.

Note that the Move Channels operator already had interesting behavior when
channels are selected in multiple levels of the channel hierarchy (e.g. when
both channel groups and f-curve channels are selected).  For Slots, I've chosen
a simpler behavior: if any Slot is moved, all non-Slot channels (i.e. those
lower in the hierarchy) are left alone.

In the future we may want to change channel group rearrangement to work the same
way with respect to f-curve channels, but I've left that alone for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/133328
2025-01-28 17:05:58 +01:00
Jacques Lucke
a15aaa3aa6 Fix #133603: reroute node breaks graying out node group inputs
The evaluated value was not properly forwarded through reroute nodes.
2025-01-28 16:51:27 +01:00
Jeroen Bakker
3eaa70c251 Fix #133690: Vulkan: Faster downloading of textures.
Somehow incorrect memory is selected when not setting the host write random on
a buffer that is only read.

Pull Request: https://projects.blender.org/blender/blender/pulls/133721
2025-01-28 16:41:43 +01:00
Michael Kowalski
319c64205d USD: Scene graph instancing export
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
2025-01-28 15:51:56 +01:00
Jacques Lucke
b3ae8b5396 Fix #133698: material viewport color not displayed in edit mode
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
2025-01-28 15:50:26 +01:00
Hans Goudey
7d6e098ca1 Cleanup: Remove unused includes in blenkernel
Pull Request: https://projects.blender.org/blender/blender/pulls/133688
2025-01-28 15:27:34 +01:00
Omar Emara
980226662b Compositor: Allow pixel operations to operate on single values
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.
2025-01-28 13:54:13 +02:00
Omar Emara
a9abb5254e Cleanup: Use none-const get_single_value for setting values
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.
2025-01-28 13:38:28 +02:00
Omar Emara
2ae06ac16e Fix: Translate node wrongly realizes transforms
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.
2025-01-28 13:13:52 +02:00
Jeroen Bakker
2d3d1d249b Cleanup: Remove compilation warnings GCC13
Pull Request: https://projects.blender.org/blender/blender/pulls/133702
2025-01-28 11:50:59 +01:00
Jacques Lucke
517768074b Fix #133693: use-after-free in screw modifier
The mesh was tagged as changed after it has been freed.
It's freed in the call to `mesh_remove_doubles_on_axis`.
2025-01-28 11:06:37 +01:00
Omar Emara
f7c543250f Fix #133665: Movie Distortion have a different name
The Movie Distortion have an ambiguous name "(Un)Distortion" after being
added, while the name should simply be Movie Distortion for clarity.
2025-01-28 10:12:39 +02:00
Germano Cavalcante
40298880b5 Fix #113685: Knife precision penalized by long-distance constraints
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
2025-01-28 18:24:58 +11:00
Jonathan Plasse
2459b3a049 PyDoc: add bpy.types.AddonPreferences to registration doc-strings
Ref: !133484
2025-01-28 17:35:42 +11:00
Jason C. Wenger
7070c781b9 Fix select shortest path failing to set the active faces material
Now the active material stays in sync with the active face,
so it's consistent with other kinds of selection picking.

Ref: !133593
2025-01-28 17:26:37 +11:00
Campbell Barton
a2b5cb5863 Fix NDOF orbit turntable direction when upside-down
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
2025-01-28 16:09:47 +11:00
Richard Antalik
bf19960937 Refactor: VSE: Use C++ matrix BLI API
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
2025-01-28 02:01:07 +01:00
Pratik Borhade
340aa78724 Fix #119254: Rebuild outliner tree after drop to scene operation
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
2025-01-27 22:43:24 +01:00
Alaska
be975efc9e Fix #133465: Pulldown selected outline color was not used
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
2025-01-27 22:19:05 +01:00
Pratik Borhade
f4f2248a9c Fix #125270: Outliner: Fade child object linked to other collection
In Outliner dim children that are linked to other collections.

Pull Request: https://projects.blender.org/blender/blender/pulls/133637
2025-01-27 21:34:42 +01:00
Julian Eisel
e8f18f33fa Fix: Rescaling material/texture previews not updating correctly
Code was querying the wrong job type.

Looks like a mistake in 5d84d9b0d6.

Pull Request: https://projects.blender.org/blender/blender/pulls/133676
2025-01-27 19:45:46 +01:00
Hans Goudey
74a5530207 Cleanup: Formatting 2025-01-27 13:13:46 -05:00
Iliya Katueshenock
c646feac47 Cleanup: BLI: Delete incorrect dimension up-cast via pointer constructor
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
2025-01-27 18:38:14 +01:00
Jesse Yurkovich
ca491185f8 Fix #132876: Remove assert and use proper limit when drawing instances
The assert would fire for perfectly valid scenes and the limit used, as
well as the cast, was incorrect.

Pull Request: https://projects.blender.org/blender/blender/pulls/133561
2025-01-27 18:28:20 +01:00
Jacques Lucke
d7cb705707 BLO: generate human readable .blend file for debugging purposes
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
2025-01-27 18:24:29 +01:00
Aras Pranckevicius
f5c2aecd8b Tests: emit more information in import tests templates
- Bone matrices,
- Material viewport settings (colors, backfaces etc.)
- Improved handling of relative paths of material images

Pull Request: https://projects.blender.org/blender/blender/pulls/133658
2025-01-27 18:19:04 +01:00
Sybren A. Stüvel
1a35335fcd Anim: treat untyped slot identifiers ("XXSlot") as wildcard
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
2025-01-27 18:03:20 +01:00
Sybren A. Stüvel
dd67b355ee Anim: do not set slot ID type when Action is linked
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
2025-01-27 17:51:23 +01:00