124907 Commits

Author SHA1 Message Date
Jeroen Bakker
f5dd7d5e6c Vulkan: Fix Workbench Normals
Workbench normals where inverted resulting to drawing artifacts like:
- Black pixels during matcaps (normals contained NAN values)
- Studio light inverted

The root cause for this was that Vulkan default to determine if a
primitive is facing the camera should be switched. The default was still
incorrect.

Although this fixes it, a better solution is to determine the front
facing based on if the viewport should be switched. As all rendering
occurs when the viewport is inverted it doesn't matter at this moment.

Pull Request: https://projects.blender.org/blender/blender/pulls/108797
2023-06-09 11:54:06 +02:00
Jacques Lucke
d154ebfa83 RNA: support compiling rna files as C++ code
Compiling files in `makesrna` as C code is often a bit annoying when converting
other files to C++ (#103343). That's because one often had to introduce additional
C wrappers.

The goal of this patch is to support compiling rna files as C++ code. This mostly
required changes in `makesrna.c` to make the generated code compatible with C
and C++. The cmake code had to change a bit as well because we need to pass
different compiler options for C++ code to avoid some warnings.

This commit also converts a few rna files to C++ already, although that is mostly
just for testing. The rest of the files are expected to be converted after this patch
is merged.

It's possible, even likely, that `makesrna.c` has to change a little bit more to
support C++, but that is hard to know without converting all files first.

Co-authored-by: Lukas Tönne <lukas@blender.org>
Co-authored-by: Ray Molenkamp <github@lazydodo.com>

Pull Request: https://projects.blender.org/blender/blender/pulls/108290
2023-06-09 11:45:41 +02:00
Bastien Montagne
7ef8389dad Fix #108746: Defaults / Save startup file don't save the window size.
Hopefully now the behavior is fully consistent with before the refactor,
current implemented one by this commit:

- When loading factory settings file on startup, go full-screen.
- In all other startup cases, use size as stored in the startup .blend
  file.

Regression from ebb5643e59 and 32bbfbb06e.
2023-06-09 11:29:15 +02:00
Pratik Borhade
34bca3be26 Merge branch 'blender-v3.6-release' 2023-06-09 14:52:46 +05:30
Pratik Borhade
9735b8ee71 Fix #106966: Register undo-step when unlinking data-block
When unlinking IDs like GN tree, materials, etc. undo step is not created.
To fix this, assign `undo_push_label` a string value for registering an
undo-step (with the help of `ED_undo_push`)

Pull Request: https://projects.blender.org/blender/blender/pulls/108452
2023-06-09 11:20:41 +02:00
Sergey Sharybin
884b1e8cc3 BLI: Add math::exp() function
Covers both arithmetic and vectorized types.

Pull Request: https://projects.blender.org/blender/blender/pulls/108793
2023-06-09 10:33:29 +02:00
Clément Foucault
31c986998b Metal: Fix operator precedence bug 2023-06-09 10:15:04 +02:00
Pratik Borhade
03e4c4b26d Merge branch 'blender-v3.6-release' 2023-06-09 09:58:51 +05:30
Fynn Grotehans
bab7548f94 Fix #104628: Rename Texture-paint brush display panel to 'Cursor'
The same Panel was named different in Image editor -> Paint
and in 3D view -> Texture Paint. 'Cursor' is the common name for
this panel in all paint modes.

Co-authored-by: Fynn Grotehans <68659993+Fynn-G@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/108544
2023-06-09 06:26:28 +02:00
Chris Blackbourn
0050a67c7a Merge branch 'blender-v3.6-release' 2023-06-09 15:35:04 +12:00
Chris Blackbourn
31ce143569 Fix #108786: Logic errors with pinned islands inside uv packer
Pinning information was accidentally skipped inside of the
UV packing engine because of their ordering.

This was most noticeable when using the "Bounding Box" shape
method, causing some pinned islands to be moved when they
should have been locked in place.
2023-06-09 15:29:43 +12:00
Campbell Barton
2f1899a7fa Cleanup: spelling in comments 2023-06-09 11:40:50 +10:00
Campbell Barton
4805930084 Cleanup: use 'r_' prefix for return argument 2023-06-09 11:39:25 +10:00
Campbell Barton
896c8d7a13 Cleanup: move space_console & space_info to C++ 2023-06-09 11:28:29 +10:00
Campbell Barton
b7d2ff61bc Fix building with MSVC (address errors) 2023-06-09 11:14:13 +10:00
Germano Cavalcante
0ed8195486 Fix assert failing after 4d6da30d16
Assert can be triggered if only `SCE_SNAP_MODE_FACE_NEAREST` is used.
2023-06-08 22:08:02 -03:00
Campbell Barton
55c05e037b Fix error building from missing includes 2023-06-09 09:49:02 +10:00
Joseph Eagar
2ed675c3fb Cleanup: move bmesh_interp.c to c++ 2023-06-08 14:59:31 -07:00
Hans Goudey
65d8cfd82d BLI: Add hash function to quaternion type
Just reuse the 4D vector hash.
This allows creating a CPPType for math::Quaternion.
2023-06-08 17:42:36 -04:00
Hans Goudey
04422064fb Cleanup: Fix mistaken dependency between rotation headers
The quaternion header depended on the old C header where it doesn't
need to with a better alternative in the newer C++ types. Also remove an
unused function in another header.
2023-06-08 17:33:47 -04:00
Hans Goudey
65d294c385 Geometry Nodes: Use smaller grain size for sampe nearest surface node
This increases the framerate in a production file from about 2.3 to 2.5
FPS, and reduces gaps in a profile where the CPU was waiting for just
a few threads to finish the BVH tree lookups. If BVH lookups become
faster in the future, this grain size could be increased.
2023-06-08 16:26:11 -04:00
Hans Goudey
38833a20a6 Merge branch 'blender-v3.6-release' 2023-06-08 15:59:10 -04:00
Hans Goudey
fd74b280d9 Fix: Amend previous windows build error fix
Thanks to Ray for helping with this!
2023-06-08 15:55:47 -04:00
Hans Goudey
38eb063c0c Merge branch 'blender-v3.6-release' 2023-06-08 15:34:41 -04:00
Hans Goudey
0dde6ab424 Fix: Build error after previous remesh fix
MSVC requires some coddling to understand these templates.
2023-06-08 15:32:57 -04:00
Julian Eisel
631e5d5d4f Asset system: Store ID type in asset representation
No user visible changes expected.

This brings us another step closer to replacing the temporary asset
handle design with the proper asset representation design. I held off
with this a bit because we eventually want to support non-ID assets, but
for now it is fine to consider all assets to be IDs. In future the asset
system can make the necessary distinctions still.

Now only the preview is handled via asset handle still.
2023-06-08 20:55:10 +02:00
Germano Cavalcante
4d6da30d16 Cleanup: Remove unsupported mode from macro 'SCE_SNAP_MODE_GEOM'
`SCE_SNAP_MODE_FACE_NEAREST` is actually not supported as one of the
geometry snap modes.

It is not used for either the snap cursor or the `Set Snap Base` mode.
2023-06-08 15:55:43 -03:00
Hans Goudey
fcc9828141 Merge branch 'blender-v3.6-release' 2023-06-08 14:04:07 -04:00
Hans Goudey
2b45f2d662 Mesh: Fix remesh color attribute propagation, improve performance
Fixes #108730

The call to `CustomData_interp` also interpolated the face corner
topology attributes, which broke the mesh completely. To fix this,
avoid relying on the CustomData API and move the attribute
interpolation to use the attribute API instead. This change also
makes it trivial to support all attribute types in the future.

Also, only retrieve the closest vertex once, instead of doing it
again for every attribute. Combined with building the topology
maps in parallel this approximately doubled the performance
of color attribute propagation in a test with 2 million vertices
and 8 color attributes on both domains (63 to 34 ms).

Pull Request: https://projects.blender.org/blender/blender/pulls/108773
2023-06-08 19:58:13 +02:00
Julian Eisel
a7a3c00f76 Cleanup: Get asset ID via asset representation, not via file
It is preferred to get asset data via the asset representation now,
since this should replace the file based asset handle design.
2023-06-08 19:25:12 +02:00
Julian Eisel
4394de611f Asset system: Add public functions for asset identifier query
No user visible changes expected.

This is needed in #104831 but makes sense to expose publicly in the
asset system APIs either way. So committing this to the main branch
already.
2023-06-08 18:51:00 +02:00
Jason Fielder
cddb53558f Metal: Resolve issues with buffer reading and clearing
Ensure buffer read operations wait for pending GPU work to
complete. This is only required for unit tests, but required to
ensure correct results in all cases. Also adds support for staging
buffer if GPU memory type is private.

Buffer clearing routine added to support values above 1 byte.
The previous buffer clearing functionality using fillBuffer writes
values to each byte, rather than the full 32 bit uint used by the
GPU API.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108757
2023-06-08 18:30:51 +02:00
Harley Acheson
a4faea2df6 Merge branch 'blender-v3.6-release' 2023-06-08 09:29:45 -07:00
Leon Schittek
16c9eacf41 UI: Correct default width of toolbars
Correct default initial widths of toolbars

Pull Request: https://projects.blender.org/blender/blender/pulls/108292
2023-06-08 18:27:59 +02:00
Julian Eisel
56f4610a50 Cleanup: Make asset-list function static
The function has static behavior, i.e. doesn't depend on an `AssetList`
instance, so its APIs should reflect that.
2023-06-08 18:22:57 +02:00
Weizhen Huang
84863dae89 Fix light texture invisible when looking at a light
`sd->type` was set to `PRIMITIVE_TRIANGLE` when it should be
`PRIMITIVE_LAMP`.

Function #lights_intersect_impl sets `isect->prim` to `lamp`, which is
passed to function #shader_setup_from_sample. There `prim != PRIM_NONE`
is evaluated to `true`, thus setting `sd->type` to `PRIMITIVE_TRIANGLE`
erroneously. This fix checks `lamp != LAMP_NONE` first, as in all other
usages of #shader_setup_from_sample `LAMP_NONE` is passed as the value
of `lamp`.

Pull Request: https://projects.blender.org/blender/blender/pulls/108769
2023-06-08 18:05:30 +02:00
Sergey Sharybin
a7644fd5bb Cleanup: Use references in the motion tracking code
Used for arguments which are not supposed to be nullptr.

Pull Request: https://projects.blender.org/blender/blender/pulls/108767
2023-06-08 17:55:16 +02:00
Julian Eisel
179a2421ca Refactor: Better context override for text button activate API function
No user visible change expected.

It wasn't clear that the caller of `UI_textbutton_activate_rna()` would
have to override the context region for it to work correctly. This is
only the case because UI internals happen to require it.

Instead of implicitly requiring the caller to do the context override so
UI internals work, do the override inside of the API function in
question.
2023-06-08 17:34:34 +02:00
Julian Eisel
133c395336 Fix string buffer size for asset library path query
`FILE_MAX` is enough here, since the returned string will only be the
path to the .blend file, not the full path into the .blend library.
2023-06-08 17:19:37 +02:00
guishe
0c202993f1 Fix #108745: Crash in debug build when deleting object
`totitem_added` should be used instead to add `RNA_enum_item_end`

Pull Request: https://projects.blender.org/blender/blender/pulls/108762
2023-06-08 17:19:16 +02:00
Jason Fielder
2e8317873f Metal: DrawManager-Next: Fix Object bounds and infos
Ensure float3 data types are marked as packed where appropriate for
ObjectInfos and instead update ObjectBounds during resource
finalization using local resource to reduce global memory thrashing.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108766
2023-06-08 16:49:42 +02:00
Jason Fielder
72987941e7 Metal: EEVEE-Next: Fix light and shadow OOB issues
Addressing a number of small issues and OOB reads/writes occuring in
EEVEE Next shadows + lighting passes. Improving correctness for unit
tests. Shadows are not yet working overall, but this unblocks progress
towards unit tests.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108768
2023-06-08 16:47:45 +02:00
Habib Gahbiche
f3cb157452 Compositor: add new node: Kuwahara filter
The filter is used to reduce noise while preserving edges. It can be used to create a cartoon effect from photorealistic images.

It offers two variations:
1) Classic aka isotropic kuwahara filter: simple and faster computation. Algorithm splits an area around a single pixel in four parts and computes the mean of the region with the lowest standard deviation.
2) Anisotropic Kuwahara filter: improves the classical approach by considering the direction of structures of regions

This patch implements both approaches above as multi-threaded operations for the full-frame and tiled compositor.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/107015
2023-06-08 16:14:45 +02:00
Jeroen Bakker
513250051e Vulkan: Image Views
The ownership of image views depends on how they are used. When used as
an framebuffer attachment the image view is owned by the framebuffer.
When used as a image/texture in a shader the ownership of the image view
is the texture itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/108765
2023-06-08 16:07:38 +02:00
Brecht Van Lommel
a2bd080cf3 Cleanup: renaming of GPU contexts for clarity
* opengl_context -> system_gpu_context. This is the operating system OpenGL,
  Metal or Vulkan context provided by GHOST.
* gpu_context -> blender_gpu_context. This is the GPUContext provided by
  the Blender GPU module, which wraps the GHOST context and adds some state.
* Various functions create/destroy/enable/disable both contexts, these have
  just gpu_context in the name now.

Pull Request: https://projects.blender.org/blender/blender/pulls/108723
2023-06-08 15:46:53 +02:00
Sergey Sharybin
a20162392e Cleanup: Typo in constant name
No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/108764
2023-06-08 15:42:30 +02:00
Omar Emara
9ddc8504fa Realtime Compositor: Implement Sun Beams node
This patch implements the Sun Beams node for the realtime compositor.
The implementation is not identical to the existing CPU implementation,
but is very close. The new implementation is a higher quality one and
resolves some of the artefacts in the existing implementation. This is
achieved by doing a simple line integration toward the source pixel,
while having a number of integration steps that is invariant of the
angle to the source.

Pull Request: https://projects.blender.org/blender/blender/pulls/108718
2023-06-08 15:36:35 +02:00
Christoph Lendenfeld
f6249cc93b Fix: Crash when using loop select on edge that has only 1 face
The code assumed that the edge to poly map returns 2 polys,
which of course is not always the case, e.g. the border edges on a plane

Now the code assumes there is at least 1 face
which should be true since the code picks a face to begin with.

Pull Request: https://projects.blender.org/blender/blender/pulls/108759
2023-06-08 15:24:20 +02:00
Falk David
b550d0be23 Cleanup: Move anim_filter.c to C++
In order to use the new grease pencil structure in this file, it will be useful to have it in C++.
Resolves #108693.

See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/108715
2023-06-08 14:59:01 +02:00
Christoph Lendenfeld
47ce7bbecc Fix: Face loop select toggle behaviour in paint mode
As pointed out by @pablovazquez the selection behavior
of the face loop selection in paint modes was missing the toggle feature.

The logic goes like this:
If any of the 2 adjacent faces to the selected edge are selected,
deselect instead of select.

There is still an inconsistency which I left in for this patch,
but is up to discussion.
CTRL+ALT+SHIFT click does an actual deselect in paint mode.
In edit mode it does toggle as well, just as ALT+SHIFT click

I can remove that feature if it isn't wanted

Pull Request: https://projects.blender.org/blender/blender/pulls/108753
2023-06-08 14:45:18 +02:00