Commit Graph

103705 Commits

Author SHA1 Message Date
Harley Acheson
08e63b5c26 Cleanup: Make format
Just formatting changes resulting from "make format"
2023-09-11 17:36:10 -07:00
Hans Goudey
dd9f196c2e Mesh: Pre-fill loose verts and bounds cache of line primitive
On a Ryzen 7950x, saves about 30 ms of work every frame where a 10
million vertex line is rebuild from scratch.
2023-09-11 16:52:45 -04:00
Hans Goudey
7344c7875a Geometry: Move mesh primitives from nodes to geometry module
This makes the code reusable in a few more places,
particularly by tests for a new boolean implementation
also defined in the geometry module.

It also makes the way some primitives are reused among
different nodes a bit clearer.

Pull Request: https://projects.blender.org/blender/blender/pulls/112255
2023-09-11 22:49:41 +02:00
Hans Goudey
67aad1f72d Cleanup: Remove unused includes in cuboid primitive 2023-09-11 16:13:39 -04:00
Bastien Montagne
8289c83dfe Cleanup: Add warning about current limitations of operators' get_name callback.
This callback is actually never excuted when e.g. defining operators
buttons through the layout API.

A design task has also been created to keep track of this issue: #112253
2023-09-11 20:37:03 +02:00
Miguel Pozo
b3bf8a4e05 EEVEE-Next: Add back data passes UI and missing passes
The `VIEWLAYER_PT_eevee_next_layer_passes_data` class name was
re-used by mistake for Workbench Next in ba982119cd,
and the actual EEVEE Next class was then removed in 678dc456e3.

This adds back the UI as it was, and the missing passes (Vector and
Position) it referenced.

Pull Request: https://projects.blender.org/blender/blender/pulls/112162
2023-09-11 20:14:04 +02:00
Miguel Pozo
f25418b730 Fix #112242: Workbench: Allow xray in render mode 2023-09-11 19:52:03 +02:00
Hans Goudey
4caa2dddd9 Cleanup: Grammar and corrections in operator type documentation 2023-09-11 13:42:07 -04:00
Miguel Pozo
efb74555fd Fix: EEVEE-Next: Velocity do_deform detection
In image renders, after the first motion blur step,
non deformed geometry was being marked as deformed,
since all their geometry lengths are 0.

This caused velocity_local_pos_get to read wrong/unitialized values.
2023-09-11 19:16:32 +02:00
Hans Goudey
ee1ee584de Geometry Nodes: Show node tool name in redo panel
Depends on the "relative_asset_identifier" property format.
If that is changed in the future, this callback can be adjusted.

See #101778
2023-09-11 13:03:24 -04:00
Nate Rupsis
9da88301ef Fix #100718: NLA Hold Forward Inconsistency
Fix #100718: NLA Hold Forward Inconsistency

Action Track with 'extrapolation=Hold Forward' behaves the same as 'Hold'.

For the Action Track, we now properly treat extrapolation Hold_Forward just like the rest of the NLA system.

Co-author Wayde Moss @wbmoss_dev
Pull Request: https://projects.blender.org/blender/blender/pulls/109182
2023-09-11 18:40:31 +02:00
Hans Goudey
974edc5885 Cleanup: Remove unnecessary "add node search"
Now that specific menus can be searched directly (see 7f9d51853c),
there is no need to maintain separate search functionality for adding
nodes. This PR removes the add node search. In a way this brings us
closer to the `NodeItem` situation before, but the setup is more
flexible since the menus are more standard and easier to customize.

In the few ways we customized the node search items before, this gives
us the same results as before. Overall the searching is less flexible,
but I think that is just a tradeoff we have to accept for the simplicity
of searching menus. In the future menus could be made more dynamic,
with each builtin node's menu path stored on the node type, similar to
assets. That might be a nice compromise. In the meantime this code
is just dead weight.

Pull Request: https://projects.blender.org/blender/blender/pulls/112056
2023-09-11 18:36:09 +02:00
Nathan Vegdahl
d64e4a387a Fix #111780: bone collections and undo don't work together
The issue was that Armatures have their own edit-mode undo system, but it
didn't account for bone collections yet.

The solution implemented here is to also copy the list of BoneCollections
in each edit-mode undo step, just like EditBones themselves already are.
Additionally, the undo EditBones now have their bone collection membership
remapped to point at those undo copies, so that the entire undo step is
self-contained.

When restoring from an undo step, we simply do the reverse: copy all of
the EditBones and BoneCollections back to the actual armature, and remap
the EditBone collection membership appropriately.

This patch also includes a temporary workaround for a final issue, where
BoneCollection membership information could be lost when undoing pops you
out of edit mode.  The correct solution for this is a bit involved, and
will be part of a future PR.  But the workaround ensures that things
aren't broken in the mean time.

Pull Request: https://projects.blender.org/blender/blender/pulls/111965
2023-09-11 18:28:15 +02:00
Amelie Fondevilla
e5325b3ee1 GPv3: Mirror grease pencil frames
Update of the `ACTION_OT_mirror` to take into account grease pencil
frames. Implemented modes are mirror over current frame, zero
frame, and selected marker.

Pull Request: https://projects.blender.org/blender/blender/pulls/111511
2023-09-11 17:49:16 +02:00
Michael Kowalski
678b827605 Fix: USD export: revert renaming active UV maps
Pull request #109518 (commit cf5666345d) added logic to rename the
active UV map to "st". However, this behavior is currently breaking
UV Map node export to USD Preview Surface materials.

Specifically, UV Map nodes that reference the original active map name
do not get updated to use the new name "st", and the exported USD shader
references an invalid texture coordinate primvar.

This commit removes this logic for now.  We should support such
renaming in the future, but the behavior should be extended to update
the relevant UV Map nodes with the new name.  Also, we should consider
adding a USD export option to enable this feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/112234
2023-09-11 16:53:56 +02:00
Miguel Pozo
12522e1c86 Cleanup: GPU: Remove duplicated line 2023-09-11 16:08:04 +02:00
ChengduLittleA
44e245f4f0 Fix #112218: Do not require screen in object_join_poll
OBJECT_OT_object_join does not seem to use any screen/window during its
execution. Removing the relevant poll code so it makes it easier to run
this operator in the background.

Pull Request: https://projects.blender.org/blender/blender/pulls/112244
2023-09-11 15:54:23 +02:00
Philipp Oeser
52cfa67f6f Fix #112144: Graph Editor handle highlighting not working correctly
Mistake in 7c48196056.

Second handle was always drawn with positions of the first handle (when
it was highlighted).

Should be good for 3.6/3.3 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/112219
2023-09-11 15:35:26 +02:00
Philipp Oeser
397a0a0e7e Fix #112028: Ctrl+Alt+Scroll not working on all selected objects
Regression from c51467cd4c.

Above commit made the IS_ALLSELECT_EVENT more strict and now excluded
mousewheel events.

Refining IS_ALLSELECT_EVENT even further (to respect mousewheel there)
is unfortunately not easily possible since mouswheel events are excluded
from `win->eventstate` (could only be retrieved from `win->event_queue`
but that is not reliable either since it might have events that are not
handled yet).

Possible solutions:
___
Adding mouswheel events to `win->eventstate`
- seemed to risky (could not forsee all possible consequences this would
have, e.g. double-click behavior)
___
Moving shortcuts for button array copy/paste from ALT to SHIFT
- downside: breaking user habits
- upside: additionally holding ALT could open the door for pasting on
all selected items
-- downside: without further work to make paste to multiple work better,
it would bring back #108096
___

So propose to do what was first suggested in #108270 as a third
solution:

Instead of refining IS_ALLSELECT_EVENT, bring it back to the state
before c51467cd4c (So `Ctrl + Alt + V` would still pass this test), but
specifically "filter out `Ctrl + Alt + V` right after in ui_apply_but().

Pull Request: https://projects.blender.org/blender/blender/pulls/112095
2023-09-11 15:33:36 +02:00
Jeroen Bakker
81c6eb9c7f Vulkan: Enable Shader Draw Parameters Support
Shader draw parameter support is needed for Workbench-next. (Almost) All
devices that we support also supports shader draw parameters. This PR
doesn't include a workaround for devices that don't have support.

For end-users this PR will allow workbench-next to render the object on
the correct location. Before this patch they were always drawn on the origin.

The catch is that OpenGL uses gl_InstanceID which always starts counting at 0.
Vulkan has gl_InstanceIndex which holds the correct instance number. By
subtracting the gl_InstanceIndex from gl_BaseInstance will get the correct
gl_InstanceID.

This patch also activates some device extensions to perform in shader printf
statements inside a shader. Documentation for this will be added to the dev
docs how to use them.

Pull Request: https://projects.blender.org/blender/blender/pulls/111461
2023-09-11 15:04:54 +02:00
Falk David
5ed35e5665 Cleanup: Anim: Replace use of T_AUTOMERGE
In the animation transform code, `T_AUTOMERGE` was used
to indicate that the duplicated keys need to be merged.

In perparation of #111051, this no longer makes much sense because
in grease pencil we cannot have two keys in the same channel at the same
frame.

This PR replaces the `T_AUTOMERGE` flag in the animation code to
`T_DUPLICATED_KEYS` to indicate that the transform is being called
with duplicated keyframes.

Pull Request: https://projects.blender.org/blender/blender/pulls/111268
2023-09-11 14:43:35 +02:00
Lukas Tönne
0b3d473f12 Nodes: Draw node buttons between outputs and inputs for custom layouts
Node buttons/options are conventionally drawn between outputs and
inputs. With custom node layouts this is not so clear any more since
inputs and outputs can be mixed.

This patch simply draws buttons right before the first input, or at the
bottom if a node does not have input sockets. This ensures a layout
compatible with standard node drawing and does not require extra work.

Eventually an explicit declaration method could place buttons explicitly
but for now this yields a useful default behavior.

![Screenshot_20230911_142856](/attachments/6c341bf5-0f89-432b-8eaa-cbbe7a46e764)

Pull Request: https://projects.blender.org/blender/blender/pulls/112228
2023-09-11 14:40:31 +02:00
Lukas Tönne
6d5c52eb48 Fix node group socket order when making a group from a single node
This is a special case in the node group operator which exposes all the
sockets when only one node is selected. This was still creating sockets
in inputs..outputs order, unlike the general case with multiple nodes.

Followup fix for #112073

Pull Request: https://projects.blender.org/blender/blender/pulls/112226
2023-09-11 14:25:02 +02:00
Pratik Borhade
a370acae0c Fix: Regression: Box select not working for GP/GPv3 channels
Caused by 62d9e55eec
Grease pencil channels are not added to the `anim_data` list when
`ANIMFILTER_FCURVESONLY` is set. So skip this filter-type when GP
animdata is present.

Pull Request: https://projects.blender.org/blender/blender/pulls/111377
2023-09-11 14:22:47 +02:00
Hans Goudey
75d788f2d3 Nodes: Support shortcuts for adding specific node group assets from menu
Use the same method for passing assets to an operator as the newer node
group operator menus. This supports quick favorites and shortcuts for
specific assets.

Also fix a crash when a dynamic submenu is added to quick favorites.
That still doesn't work though-- the menu ends up being empty.
2023-09-11 08:20:39 -04:00
Lukas Tönne
ee14c4aa34 Nodes: Add PanelDeclarationBuilder for panels in builtin nodes
Node groups already have panels, but they modify the node declaration
directly, which is not something we want to do for builtin nodes. For
those the `PanelDeclarationBuilder` should be used.

`PanelDeclarationBuilder` has `add_input`/`add_output` methods just like `NodeDeclarationBuilder`. Adding sockets to a panel increases its size by one. All sockets must be added in order: Adding sockets or panels to the root `NodeDeclarationBuilder` after a panel will complete the panel and adding more sockets to it after that will fail. This is to enforce a stable item order where indices don't change after adding a socket, which is important for things like field dependencies.

Example:
```cpp
static void node_declare(NodeDeclarationBuilder &b)
{
  // Currently this is necessary to enable custom layouts and panels.
  // Will go away eventually when most nodes uses custom layout.
  b.use_custom_socket_order();

  // Create a panel.
  PanelDeclarationBuilder &pb = b.add_panel("My Panel").description("A demo panel").default_closed(true);
  // Add to the panel instead of the root layout.
  pb.add_input<decl::Color>("Color").default_value({0.8f, 0.8f, 0.8f, 1.0f});
  pb.add_input<decl::Float>("Weight").unavailable();

  // Continue socket declarations as usual.
  b.add_output<decl::Shader>("BSDF");

  // !!! Warning: continuing the panel after other items is not allowed and will show an error.
  pb.add_output<decl::Float>("Bad Socket");
}
```

Pull Request: https://projects.blender.org/blender/blender/pulls/111695
2023-09-11 13:39:28 +02:00
Richard Antalik
29fcce6a8c Fix build warnings
Introduced in 4d668e6825.
2023-09-11 13:10:14 +02:00
Falk David
b66c0676b4 GPv3: Move dopesheet channels
This will allow to move selected channels to
Top/Bottom/Up/Down in the list.

Co-authored by: Pratik Borhade <pratikborhade302@gmail.com>

Pull Request: https://projects.blender.org/blender/blender/pulls/111009
2023-09-11 13:07:48 +02:00
Amelie Fondevilla
3ee7900775 GPv3: Frame All/Selected keyframes
Update the `ACTION_OT_view_all` and `ACTION_OT_view_selected`
operators to take into account grease pencil keyframes.

Pull Request: https://projects.blender.org/blender/blender/pulls/111480
2023-09-11 12:40:04 +02:00
Amelie Fondevilla
6221ff436f GPv3: Jump to Selected/Previous/Next keyframe
Update of the following operators to take into account
grease pencil frames :
* SCREEN_OT_keyframe_jump, which jumps to the average
position of the selected frames, and
* ACTION_OT_frame_jump, which jumps to the previous/next
frame in the active channel.

Pull Request: https://projects.blender.org/blender/blender/pulls/111476
2023-09-11 12:32:01 +02:00
Philipp Oeser
84b4b90e08 Fix #112208: Vertex parenting index wrong with multiple splines
Caused by 346023b457.

Above commit made variables too local (starting index with zero in each
nurb of the curve/surface object, but we need the "overall" index).

Should be good for LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/112222
2023-09-11 12:19:53 +02:00
Amelie Fondevilla
fc5b0ba19a GPv3: Set keyframe type
Update of the animation operator "set keyframe type" to take into account grease pencil keyframes.

Pull Request: https://projects.blender.org/blender/blender/pulls/111472
2023-09-11 11:58:57 +02:00
casey bianco-davis
5870ffa570 GPv3: Frame delete operator
This operator is a combination of the previous delete operator `frame` mode
and the `active_frames_delete_all` operator.

This also add the delete menu and key binds.
2023-09-11 11:37:16 +02:00
Damien Picard
8460aac59d I18n: translate drag and drop messages for sockets
The new node interface items can be dragged and dropped to change
their hierarchy. The messages indicating where an element is dropped
were extracted using N_(), but not actually translated.

This commit enables this translation using TIP_(). It also extracts a
missing message ("Insert into panel").

Pull Request: https://projects.blender.org/blender/blender/pulls/112108
2023-09-11 11:04:36 +02:00
Guillermo Venegas
fca8df9415 Fix #112087: Float curve flickers with aligned points at x axis
Sorting curve points only at x axis generates undefined
behavior if some points are aligned at x axis with qsort.

Pull Request: https://projects.blender.org/blender/blender/pulls/112205
2023-09-11 00:17:14 +02:00
Iliya Katueshenock
3b44fd3655 Fix #112184: Adapt optimized case of Points of Curve node for domain
Fix mistake in 000e722c7d. If domain is not
the curve, then result should be adopted to domain.

Pull Request: https://projects.blender.org/blender/blender/pulls/112185
2023-09-09 19:16:10 +02:00
Richard Antalik
72d3d7f7f4 Fix errors in previous commit
Commit introduced build warning and crash due to not unbinding shader.
2023-09-09 17:22:03 +02:00
Richard Antalik
cba9f47562 Cleanup: VSE timeline drawing code
Deduplicate code, touch up some precondition, and minor improvements.
2023-09-09 17:15:56 +02:00
Richard Antalik
4d668e6825 Cleanup: refactor VSE timeline drawing code
- Use context variables for drawing functions.
- Move conditions to functions drawing specific elements as
  preconditions
- Disentangle calculation of common coordinates.
- Use more descriptive variable names (in context at least)

Individual drawing functions are mostly unchanged, so improvements there
are minimal.

No intended functional changes.
2023-09-09 15:54:33 +02:00
Jacques Lucke
dd515ebc1d Geometry Nodes: add Skip input to Simulation Output node
This adds a new Skip input to the Simulation Output node (design task: #112082).
It is a convenience feature that makes it easy to conditionally forward the
output of the Simulation Input node to the Simulation Output node, without the
need for potentially multiple Switch nodes. When Skip is enabled, the other inputs
of the Simulation Output node are not evaluated, i.e. the nodes in the simulation
zone are ignored.

The implementation adds this new functionality directly to the `LazyFunction`
of the Simulation Output node. It has new inputs that are linked directly
to the Simulation Input node, so that the simulation state can be forwarded.

Pull Request: https://projects.blender.org/blender/blender/pulls/112140
2023-09-09 09:53:01 +02:00
Miguel Pozo
967d49dba4 Cleanup: Formatting
Fix formatting after e5f6c57f8c
2023-09-08 21:35:13 +02:00
Miguel Pozo
e5f6c57f8c EEVEE-Next: Merge UBOs
Merge all the small UBOs used by the engine to save binding slots.
Each module is still responsible for filling its own data (by storing a
reference to it at construction) and this data is still private for other
modules.
The engine instance pushes the data to the GPU at the end of
`end_sync`, so only the modules that modify their data outside of the
sync functions need to manually call `Instance::push_uniform_data()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112046
2023-09-08 21:03:37 +02:00
Miguel Pozo
1faa522880 Fix: EEVEE-Next: Motion blur on image renders
overscan_changed is always true the first frame.
2023-09-08 20:29:29 +02:00
Harley Acheson
930dadd600 Fix #111831: Proper Highlighting of Inactive Buttons
Deal separately with menu states of Disabled and Inactive buttons,
since we want different hover highlighting for inactive.

Pull Request: https://projects.blender.org/blender/blender/pulls/112159
2023-09-08 19:42:47 +02:00
Julian Eisel
87aa34d801 UI: Let asset shelf header resizing affect the entire asset shelf
Users expect to be able to scale the uppermost edge of the asset shelf,
which actually belongs to the asset shelf header region only. So it
would only work to hide/unhide this. They expect this because they seem
like one region, but they are actually implemented as two (to have
separate layout and scrolling mostly).

This adds a region flag so that scaling a region can actually affect the
previous one instead. Something similar is already used for split
regions.

Part of #107881.
2023-09-08 17:51:58 +02:00
Leon Schittek
cc1c38f74d UI: Fix inconsistent menu background padding
Remove slight (2 pixels) extra padding at bottom of menus.

Pull Request: https://projects.blender.org/blender/blender/pulls/111826
2023-09-08 17:43:33 +02:00
Harley Acheson
e7f1647785 Fix #112081: Incorrect Toolbar Context Highlighting
More specific targeting of Tool item alternates list.

Pull Request: https://projects.blender.org/blender/blender/pulls/112153
2023-09-08 17:38:13 +02:00
Julian Eisel
3589533908 Thumbnails: Always use cached thumbnails for offline files
bd9f94e917 made it so the file browser doesn't bring files online for
the purpuse of creating their thumbnail, because that can take a while.
Instead it uses a previously cached thumbnail if available. This should
be the behavior for all cases thumbnails are requested, it's not only
the file browser that does this.

In fact it makes sense to move this into the normal function to "manage"
thumbnails (that is, load and if necessary (re)create cached
thumbnails) since there are no currently known use-cases for
different behavior.

Also, seems like the previous solution didn't work when loading ID
previews from offline .blend files. For that we need to use the path to
the .blend file to check the offline status, not the full path to the ID.

Found while working on #109234 (Use UI preview system for async loading of
file/asset previews).

Pull Request: https://projects.blender.org/blender/blender/pulls/112101
2023-09-08 16:41:44 +02:00
Hans Goudey
98e33adac2 Mesh: Further optimize topology map creation
We need a separate array that we can change in during the parallel
group construction. That array tells where in each group the index
is added. Building this array is expensive, since construcing a new
`Array` fills its elements serially. There are two possible solutions:

1. Use a copy of the offsets to increment result indices directly
2. Rely on OS-optimized `calloc` instead of `malloc` and a copy/fill

Both depend on using `fetch_and_add` instead of `add_and_fetch`.

The vertex to corner and edge to corner map creation is optimized
by this commit, though the benefits will be useful elsewhere in the
future.

|          | Before  | 1. offsets copy | 2. calloc       |
| -------- | ------- | --------------- | --------------- |
| Grid 1m  | 3.1 ms  | 1.9 ms (1.63x)  | 1.8 ms (1.72x)  |
| Grid 16m | 51.8 ms | 33.3 ms (1.55x) | 32.7 ms (1.58x) |

This commit implements the calloc solution, since it's slightly faster
and simpler. In the future, `Array` could do this optimization itself
when it detects that its fill value is just zero bytes.

Pull Request: https://projects.blender.org/blender/blender/pulls/112065
2023-09-08 16:18:38 +02:00
Hans Goudey
be68db8ff9 Geometry Nodes: Show node group in modifier UI after duplication
When duplicating the node group from the geometry node editor, show the
data-block selector in the modifier interface. Otherwise it's not clear
that the modifier is using a local data-block, not the original asset.
2023-09-08 10:03:16 -04:00