Commit Graph

102682 Commits

Author SHA1 Message Date
Lukas Stockner
d169403d96 Cleanup: Format 2023-09-13 02:25:03 +02:00
Lukas Stockner
158dbc1b10 Cycles: Rework Principled BSDF Clearcoat
- Adds tint control, which simulates volumetric absorption inside the coating.
  This results in angle-dependent saturation and affects all underlying layers
  (diffuse, subsurface, metallic, transmission). It provides a physically-based
  alternative to ad-hoc effects such as tinted specular highlights.
- Renames the component from "Clearcoat" to "Coat", since it's no longer
  necessarily clear now. This matches naming in e.g. other renderers or OpenPBR.
- Adds an explicit Coat IOR input, in preparation for future smarter IOR logic
  around the interaction between Coat and main IOR. This used to be hardcoded
  to 1.5.
- Removes hardcoded 0.25 weight multiplier, and adds versioning code to update
  existing files accordingly. OBJ import/export still applies the factor.
- Replaces the GTR1 microfacet component with regular GGX. This removes a corner
  case in the Microfacet code, solves #53038, and makes us more consistent with
  other standard surface shaders. The original Disney BSDF used GTR1, but it
  doesn't appear that it caught on in the industry.

Co-authored-by: Weizhen Huang <weizhen@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/110993
2023-09-13 00:03:11 +02:00
Miguel Pozo
b7ba7663a7 Fix #112231: Workbench: Texture support in sculpt mode 2023-09-12 18:48:34 +02:00
Bastien Montagne
306723c6bf Liboverride/Outliner: Fix assert in Hierarchy view.
Not sure why/when that was changed, but drawing code should not assume
all items in the hierarchy view tree of the Outliner are liboverrides -
it adds e.g. regular local IDs items for the root item of each library
hierarchy of linked liboverrides.

Reported by @dfelinto & @LukasTonne, thanks.
2023-09-12 18:27:26 +02:00
Lukas Tönne
4523a1e362 Fix #112247: Node group socket declarations using only 'NONE' subtype
The declaration code for node groups was relying on `bNodeSocketType` to
provide the subtype of a socket. This worked before node panels
(#111348) since the interface sockets had a fully refined typeinfo.

Now the interface sockets use only the base typeinfo and the socket
subtype is stored in the interface data itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/112286
2023-09-12 17:13:40 +02:00
Miguel Pozo
443254b1a6 Fix #112211: Workbench: Clamp infinite inputs in TAA 2023-09-12 16:27:40 +02:00
Christoph Lendenfeld
12f8f926b2 Refactor: Rename functions and structs in keyframes_draw.cc
No functional changes.

While looking at the Dope Sheet drawing code to see if it
can be made faster I came across a bunch of functions with confusing names.

This PR tries to address that by:
* removing the `ED_` prefix from static functions
* adding it to non static functions
* renaming `AnimKeylistDrawListElem` to `ChannelListElement`
* renaming `AnimKeylistDrawList` to `ChannelDrawList`
* all `draw_..._channel` renamed to `ED_add_..._channel`
   since the function itself doesn't actually do any drawing
* generally simplifying the function names

Pull Request: https://projects.blender.org/blender/blender/pulls/111510
2023-09-12 16:08:16 +02:00
Falk David
97d2dbb24e Fix #112068: Crash when loading converted curves
In 2788fa915b the `CurvesGeometry::blend_write` and `CurvesGeometry::blend_read` functions were added. Unfortunately, the commit also altered the writing logic and introduced a bug where loading a file with a converted `Curves` object would crash. See https://projects.blender.org/blender/blender/issues/112068.

This PR fixes the issue by making sure that `CustomData_blend_write_prepare` is called before `BKE_id_blend_write`, which is the root cause of the crash that happens on load.

The  `CurvesGeometry::blend_write` function is split into  `CurvesGeometry::blend_write_prepare` and `CurvesGeometry::blend_write`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112280
2023-09-12 16:02:04 +02:00
Philipp Oeser
e7b024a691 Fix: 3D Viewport header missing update changing vertex groups
Since 3b5df8a7ea, we are displaying a "canvas picker" in the 3DView
header. In weightpaint mode, this gives us the active vertexgroup to
paint on, however the header wasnt updating when changing the
vertexgroup elsewhere (e.g. from the Properties Editor).

Part of #112186.

Pull Request: https://projects.blender.org/blender/blender/pulls/112227
2023-09-12 15:43:57 +02:00
Miguel Pozo
d81165f3ec Fix #111960, #112200, #112214: EEVEE: Incorrect BuiltinBits::LAYER use
5cf7089e43 added the `BuiltinBits::LAYER` to shaders with a geometry
stage. This causes compilation errors when
`GLContext::layered_rendering_support` is false (otherwise the flag
does nothing).

This PR moves the `LAYER` flags to the `no_geom` shader versions and
adds a check to `ShaderCreateInfo::finalize()` to ensure the `LAYER` flag
is not used in shaders with a geometry stage.

Pull Request: https://projects.blender.org/blender/blender/pulls/112245
2023-09-12 15:39:33 +02:00
Ray Molenkamp
5f8dfa231d CMake: Fix building with WITH_VULKAN_BACKEND
Ghost uses vulkan in its public headers but none of the projects that
depend on ghost had the vulkan headers in its includes nor did
bf_intern_ghost expose this vulkan dependency itself publicly yet.

bf_windowmanager also did not express its dependency on
bf_intern_ghost yet used its headers.

this change fixes both issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/112259
2023-09-12 15:07:41 +02:00
Sybren A. Stüvel
6c4eb80cc3 Anim: clarify BKE_armature_find_bone_name docstring
No functional changes.
2023-09-12 15:00:33 +02:00
Julian Eisel
0519e8d711 UI: Remove panel name size limit for complex character languages
The previous limit of 63 bytes for the panel name was an issue for
languages where characters use multiple bytes. The UI would show panel
names truncated that had reasonably long/short names.

It's easy to support dynamically sized strings here, so do that instead
of using fixed size buffers.

Fixes #111927.

Pull Request: https://projects.blender.org/blender/blender/pulls/111979
2023-09-12 14:47:46 +02:00
Jeroen Bakker
f1a0de8415 Overlay: Remove Unused Attribute in edit mesh face shader
`overlay_edit_mesh_face` has an attribute for its vertex normals,
but only used in the vertex shader when it isn't a face shader.

Removing this attribute fixes some performance validation warnings
in the Vulkan backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/112269
2023-09-12 14:47:20 +02:00
Lukas Tönne
7b680850c6 Fix for node group "make" adding sockets in wrong order
Making a group from a single node that has some connections will add the
connected outputs and inputs first, then add all unconnected outputs and
inputs. This can lead to incorrect socket order (out-in-out-in).

This patch integrates unconnected sockets into the main outputs/inputs
loops to ensure all outputs are added before inputs.

Pull Request: https://projects.blender.org/blender/blender/pulls/112281
2023-09-12 14:27:09 +02:00
Hans Goudey
c59d998ce5 Geometry Nodes: Skip redo panel for node tools without inputs
The operator system assumes that the `ot->ui` callback means
there will always be a redo panel. This situation where there is a
callback but sometimes no inputs hasn't been encountered before.

Resolve that by changing `WM_operator_check_ui_empty` into
a `WM_operator_ui_poll` that handles this case properly, with
a new operator type callback called `ui_poll`.

See #101778, #111346

Pull Request: https://projects.blender.org/blender/blender/pulls/112251
2023-09-12 13:24:05 +02:00
Jacques Lucke
34b4487844 Fix #109670: attribute shared between geometries even when edited
The RNA attribute API did not make sure that attributes are unshared when
the data is accessed. This is necessary to avoid accidentally changing data
on other geometries.

Unfortunately, we currently can't detect if the access is read-only or if the
attribute data is modified. Therefore, the data is always copied when it
was shared. This makes it a little bit less efficient in some cases, but that
should still be ok. The old behavior could by brought back by implementing
#112150.

Pull Request: https://projects.blender.org/blender/blender/pulls/111514
2023-09-12 13:03:01 +02:00
Amelie Fondevilla
127eee87ce GPv3: Duplicate keyframes
Implementation of the duplicate and move operator for grease pencil frames.

The `ACTION_OT_duplicate` operator now creates duplicates of the selected frames and stores them in the layer runtime data.
The `TRANSFORM_OT_transform` operator is updated to take care of these duplicated frames.

Pull Request: https://projects.blender.org/blender/blender/pulls/111051
2023-09-12 12:07:15 +02:00
Jeroen Bakker
6920c690f1 Vulkan: Implement Component Swizzling
Component swizzling is part of an image view and localized in the code.
With component swizzling a different channel (or 0 or 1) can be read
when the component is accessed.

Pull Request: https://projects.blender.org/blender/blender/pulls/112273
2023-09-12 11:54:57 +02:00
Jeroen Bakker
ded7d96ba1 Vulkan: Texture View
Adding support for Texture View in Vulkan backend.

When a VKTexture is a texture view many options become
irrelevant, but isn't actually clear via its API. Added
asserts to make sure that the usage is supported.

This patch allows rendering simple workbench-next scenes
without any validation errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/110887
2023-09-12 11:18:38 +02:00
Jeroen Bakker
65a88c3d60 Vulkan: Fix Incorrect UINT formats.
When `COMP_U*` is used together with a `GPU_FETCH_INT` the backend
tried to convert them to floats. What is of course not what should
happen.

Issue was that these cases were never correctly tested. With this
change the `data` attribute of the `overlay_edit_mesh` shaders are
transferred correctly and can draw some pixels as intended.

Pull Request: https://projects.blender.org/blender/blender/pulls/112270
2023-09-12 11:15:51 +02:00
Falk David
c0850237a1 Fix: "use_duplicated_keyframes" not found
`5ed35e` introduced the warning:
`RNA_boolean_set: TRANSFORM_OT_transform.use_duplicated_keyframes not found`

This was because the `TRANSFORM_OT_transform` did not pass
the `P_OPTIONS` flag to `Transform_Properties` to define
the `use_duplicated_keyframes` property.
2023-09-12 11:00:43 +02:00
Nathan Vegdahl
aaddb25fa3 Cleanup: remove unneeded include
In a previous commit fixing a warning, the C++ header include was added,
but the corresponding C header include wasn't removed.  The C++ header
already includes the C header, so including it separately is
redundant.
2023-09-12 10:29:10 +02:00
Christoph Lendenfeld
e656e850a6 Animation: Rename ACTION_OT_sample
After Renaming "Bake Curve" to "Samples to Keys" in #111049,
the name of the `ACTION_OT_sample` operator needed renaming.
That is because the word "sample" is now used to describe FCurve
data in an uneditable state.

Rename to `ACTION_OT_bake_keys` since baking is the
term used in animation to describe the action of creating dense key data.

Pull Request: https://projects.blender.org/blender/blender/pulls/112151
2023-09-12 09:42:01 +02:00
Christoph Lendenfeld
9e5e04e915 Animation: Rename Graph_OT_sample
After Renaming "Bake Curve" to "Samples to Keys" in #111049,
the name of the `GRAPH_OT_sample` operator needed renaming.
That is because the word "sample" is now used to describe FCurve
data in an uneditable state.

Rename to `GRAPH_OT_bake_keys` since baking is the term
used in animation to describe the action of creating dense key data.

Pull Request: https://projects.blender.org/blender/blender/pulls/112148
2023-09-12 09:32:18 +02:00
Campbell Barton
057c9364fc Cleanup: use braces around statements 2023-09-12 14:48:20 +10:00
Campbell Barton
52bd4b73c3 Cleanup: compiler warning from missing include 2023-09-12 14:46:32 +10:00
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