Commit Graph

126566 Commits

Author SHA1 Message Date
Sergey Sharybin
8ea68765fc Fix CUDA error with light linking and emissive world volume
The issue was an out-of-bounds read access when checking whether
the world volume emission needs to be accumulated.

Solution is to check for this case. Done in the generic place, so
that the shade_volume kernel is more readable and no branching
added there, and there is no impact on scenes without the light
linking.

Assume that the world emissive volume belongs to the default light
linking group, as there is no way to link it explicitly to anything.

Pull Request: https://projects.blender.org/blender/blender/pulls/110733
2023-08-03 07:54:06 +02:00
Hans Goudey
a049f3b5df Cleanup: Use references for mesh extraction render data and cache 2023-08-02 23:59:31 -04:00
Hans Goudey
55970fa367 Cleanup: Simplify mesh triangle material counting
Use `parallel_for` instead of the C threading API, extract some
constant checks from hot loops, and use `EnumerableThreadSpecific`
for thread-local storage.

Pull Request: https://projects.blender.org/blender/blender/pulls/105940
2023-08-03 05:02:36 +02:00
Hans Goudey
9cad2e8771 Fix #110682: Loading old files crashes from missing DNA rename
Missing in 5e9ea9243b33916e693c5a4b900bcaf214882a96
2023-08-02 22:26:10 -04:00
Campbell Barton
19e698cc39 Cleanup: use C++ includes, various non-functional changes for C++ 2023-08-03 09:44:28 +10:00
Campbell Barton
8c8ff6b85b Cleanup: spelling in comments, use C-style comments 2023-08-03 09:44:28 +10:00
Hans Goudey
8bb8cfb54e Cleanup: Remove unnecessary struct keyword from C++ headers
Pull Request: https://projects.blender.org/blender/blender/pulls/110734
2023-08-03 01:11:28 +02:00
Hans Goudey
731d296f35 Cleanup: Move mesh related blenkernel headers to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110730
2023-08-02 22:14:18 +02:00
Germano Cavalcante
72d7e3e684 Fix Compiler Error in Clang
```
error: type 'float' cannot be narrowed to 'int' in initializer list [-Wc++11-narrowing]
```
2023-08-02 16:26:34 -03:00
Julian Eisel
8662575f40 UI: Avoid slight text color flashing while clicking preview tiles
Text of preview-tile widgets would change color while pressing the mouse
button on them, this wasn't useful and just made the UI feel glitchy.
The widget background already indicates the state well.

Preview-tile widgets are currently only used in the asset view template.
More usages will be introduced in the asset-shelf patch (#104831).
2023-08-02 21:09:06 +02:00
Germano Cavalcante
c59ba19c0b Fix #110722: Wrong value when starting a transformation
Caused by 5ed14e9269.

That commit accidentally removed the `copy_v2_v2_int(t->mval, mval);`
line which was responsible for initializing the value of `mval`.
2023-08-02 15:51:55 -03:00
Germano Cavalcante
f1d44dd64a Transform: Refactor: Use float vector type for 'TransInfo::mval'
In most cases float access is required for this member.
2023-08-02 15:35:09 -03:00
Germano Cavalcante
e423fd469d Cleanup: Move int to float conversions outside the function
The function doesn't actually use the `int` value, so the parameter
already comes as `float`, this avoids unnecessary conversions.
2023-08-02 15:25:22 -03:00
Germano Cavalcante
897f6523ab Cleanup: Remove unnecessary parameter in 'transform_fn' callback
That `const int[2]` parameter is `t->mval` accessed in a different way
and many times it is not even used.

tmp
2023-08-02 15:04:12 -03:00
Bastien Montagne
4f673f18af Move BKE_lib_override.h header to be fully C++.
This implies using the `.hh` extension, and removing the `extern "C"`
blocks from it.

Pull Request: https://projects.blender.org/blender/blender/pulls/110718
2023-08-02 17:44:37 +02:00
Falk David
873453005d Fix: GPv3 not rendering when origin is out of view
This was because the `ob->runtime.geometry_set_eval` was populated
with the new `GreasePencilComponent` but
`GeometrySet::compute_boundbox_without_instances()` did not compute
the bounding box of the grease pencil geometry.
Thus the bounding box was not correctly set and the object not
correctly rendered.
2023-08-02 17:36:38 +02:00
Ray Molenkamp
d43ceb1974 Fix: bpy build on windows
functions imported from creator.cc still had extern the "C"
attribute causing a linker error due it it looking for the
undecorated symbol for these functions.
2023-08-02 08:08:36 -06:00
Falk David
331969159e Fix: Unreported memory leak
Whenever `grow_array` in
`blender/source/blender/blenkernel/intern/grease_pencil.cc` was called,
it would not free the original array after relocating the data to the
newly allocated memory. This fixes the memory leak.
2023-08-02 15:52:21 +02:00
Jacques Lucke
8f4fccaa33 Creator: move to C++
Also see #103343.

Co-authored-by: Hans Goudey <h.goudey@me.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/110539
2023-08-02 15:34:45 +02:00
Ray Molenkamp
7983dce79b Fix: bpy build on windows
functions imported from creator.c were missing the extern "C"
attribute causing a linker error due it it looking for the
decorated symbol for these functions.
2023-08-02 07:25:30 -06:00
Pratik Borhade
56832ed59a GPv3: Basic layer channel selection
PR adds support for the selection of grease pencil layers in
animation editor.
- selection status is stored in `GreasePencilLayerTreeNode`
- Existing `GP_LAYER_TREE_NODE_SELECT` flag is used for selection
- selection of channel updates the active layer in object properties

Part of #110056

Pull Request: https://projects.blender.org/blender/blender/pulls/110133
2023-08-02 15:17:08 +02:00
Amelie Fondevilla
fd75695bed GPv3: Insert grease pencil keyframe from the dopesheet
Adaptation of the operator `ACTION_OT_keyframe_insert` to take into account grease pencil channels.
Grease pencil keyframes can now be inserted in blank mode, or in additive mode (duplicate the current frame in the new keyframe).

Two API functions were added :
 * `add_duplicate_drawings` which copies the data of a drawing to creates a duplicate, and
 * `insert_duplicate_frame` which creates a duplicate frame of an existing one either by copy or instance.

The additive mode option is also added to the UI.

The Layer method `frame_key_at` previously private was set to public.

Pull Request: https://projects.blender.org/blender/blender/pulls/110649
2023-08-02 14:56:18 +02:00
Hans Goudey
4309c32be6 Mesh: Replace older flip faces utilities
Replace `BKE_mesh_face_flip_ex()` with `bke::mesh_flip_faces()`.
This gives better performance since it avoids custom data name
lookups for every face index, and processes data in a more cache
friendly way. Also remove the `CustomData_swap` API function
as mentioned in 09b6eac5c4a0f17cb20e.

Flipping 16 million faces, I observed a 3.25x speedup, from 760 to 230 ms.

Pull Request: https://projects.blender.org/blender/blender/pulls/110702
2023-08-02 14:15:27 +02:00
Falk David
b2f61b5c8a GPv3: Replace int with FramesMapKey
This adds the `FramesMapKey` alias to the `blender::bke::greasepencil` namespace.

Pull Request: https://projects.blender.org/blender/blender/pulls/110714
2023-08-02 14:02:23 +02:00
fiord
0c8785a249 Fix #106257: Move to Nodes error with no geometry input/output
If group input/output has no geometry, errors will occur,
so some validations are required.

Pull Request: https://projects.blender.org/blender/blender/pulls/110670
2023-08-02 14:00:32 +02:00
Campbell Barton
7cc3ef3260 Cleanup: use C++ includes, various non-functional changes for C++ 2023-08-02 20:30:02 +10:00
Sergey Sharybin
b655571f70 Render: Make GPU compositor a BaseRender method
The C-style API is still in place, but the implementation
is moved to a virtual method.

This is part of unification of viewport and final render
structure.

Should be no functional changes.

Ref #108618

Pull Request: https://projects.blender.org/blender/blender/pulls/110696
2023-08-02 10:30:25 +02:00
Guillermo
5d0c355b5f Cleanup: Unsafe mix of type warning
Unsafe mix warning of type `bool != int`.

Pull Request: https://projects.blender.org/blender/blender/pulls/110695
2023-08-02 10:03:47 +02:00
Hans Goudey
c3685fe068 Cleanup: Sculpt: Use consistent operator function names
Make function names consistent with operator idname
2023-08-01 21:38:21 -04:00
Hans Goudey
29a338811c Fix #110411: Mesh loop cut preview uses final instead of cage positions
Caused by 91b27ab637334383b57b, which caused the final position
arrays to be returned in more situations (in this case, when the final
result is a non-wrapper mesh). Instead, use the cage mesh, which
is more correct anyway-- it just wasn't always available before.
2023-08-01 21:36:26 -04:00
Hans Goudey
e4e23bdd73 Cleanup: Sculpt: Remove unnecessary visibility flushing
Face set code modifies visibility of faces, then flushes those changes
to vertex and edge visibility. However, then it did an extra flush back
from vertices to faces and edges, which shouldn't be necessary.
2023-08-01 21:25:38 -04:00
Hans Goudey
12258d4931 Cleanup: Sculpt: Remove unused function to set vert visibility
Unused after ef5f3070315ea130479c. More recently, visibility
is just set at the face level and synced to vertices with generic
Mesh API functions.
2023-08-01 21:20:25 -04:00
Hans Goudey
7114d2efa6 Cleanup: Sculpt: Use utility functions for setting face visibility 2023-08-01 21:15:29 -04:00
Hans Goudey
620a5ebe4a Mesh: Parallelize edit selection and visibility interpolation
Each of the four algorithms is different, and not all of them will
parallelize linearly, but for large meshes these "flushing" operations
begin to become noticeable compared to other multithreaded code.
For example, flushing visibility to vertices and edges after a change
to faces became 3.75x faster, from 90 to 24 ms.

Also avoid duplicating selection interpolation logic, use the attribute
API instead.
2023-08-01 20:51:11 -04:00
Hans Goudey
b54bca9f08 Cleanup: Reduce indentation in pbvh clipping 2023-08-01 18:19:13 -04:00
Hans Goudey
8104d6e95c Cleanup: Simplify some parallel iteration over PBVH nodes
Use `parallel_for` instead of the older task API. A lot of sculpt code
still uses `SculptThreadedTaskData`, so this is just a start.
2023-08-01 18:14:43 -04:00
Hans Goudey
02e0d7717b Cleanup: Remove unused variable in pbvh draw code 2023-08-01 17:30:10 -04:00
Hans Goudey
6806b1c93d Cleanup: Remove unused simulation data-block defaults
Data-block was removed in f3f05daf11b6be97202750c0251060dc2f5a18f3.
2023-08-01 15:08:30 -04:00
Ray Molenkamp
1a860d123d MSVC: enable Two-phase name lookup
Previously disabled due to OpenMP issues but those have been resolved
on the compilers that are currently our lower bar. (vs2019)

Pull Request: https://projects.blender.org/blender/blender/pulls/110660
2023-08-01 20:44:24 +02:00
Kaspian Jakobsson
5a9128af25 Fix #109679: incorrect handling of negative Z normal maps after recent fix
Implement clamped scaling on the Z-axis, so that strength zero means the
normal map has no effect.

Ref #109763
2023-08-01 20:23:12 +02:00
Charlie Jolly
5b80d9bbaf Compositor: Improve link drag search
Add link drag search for Math operations
Add link drag search for Mix operations

Pull Request: https://projects.blender.org/blender/blender/pulls/110575
2023-08-01 20:03:32 +02:00
Hans Goudey
40de15d521 Mesh: Move flip faces function to blenkernel
The aim is to replace the `BKE_mesh_faces_flip` functions with
this newer C++ function using the attribute API. But that is must
be called by RNA, so move this to blenkernel to avoid a circular
dependency between the geometry module and RNA.
2023-08-01 13:08:59 -04:00
Julian Eisel
9048bf6ffd Cleanup: Use enumerator instead of magic number in outliner function
This enum type was introduced a while ago. Better to use it as it
instead of a fixed value with unclear meaning.
2023-08-01 19:04:15 +02:00
Julian Eisel
49adf49bae Fix outliner library override data storage (undefined behavior)
The Library Overrides view of the Outliner was casting a
`TreeElementOverridesData` pointer to an `ID` pointer, which would be
undefined behavior. Make sure it uses the actual ID referenced by the
`TreeElementOverridesData`.
2023-08-01 19:03:36 +02:00
Damien Picard
c6118da243 I18n: translate Repeat Zone in the Add Node menu
The Repeat Zone operator from the Geometry nodes Add Node -> Utilities
menu was not translated because it used the "Operator" translation
context, instead of the default context.

Since the function displaying the menu item, `add_repeat_zone()`, is
only ever called from the Utilities menu, and the label is specified
there as "Repeat Zone", we know in advance that it will have this
name.

For the same reason, this commit also simplifies the function which
creates the menu entry for simulation zones. This function is also
only called from the Simulation menu with a specific label using the
default context, so it should also use this one.

Pull Request: https://projects.blender.org/blender/blender/pulls/110644
2023-08-01 18:07:32 +02:00
Falk David
162fc23887 GPv3: Use add_new and remove_contained in core
Instead of the default `add` and `remove` functions for the frames map,
use `add_new` and `remove_contained` for when it is known that a value
is or isn't in the map already. This should be slightly more efficient
(and just better practice overall).
2023-08-01 17:56:20 +02:00
Clément Foucault
1e7f27ec55 Fix Realtime Compositor: Broken keying node on MacOS
This was caused by `mod` not being available to integer
types. It isn't part of the GLSL stadard officially.
In this particular case, it is not needed. so replace it
with the `%` operator.
2023-08-01 17:48:57 +02:00
Falk David
de8ce4e34b GPv3: Add user count to drawings
Adds a user count to drawings to track how many frames use the drawing.
If the user count hits `0` the drawing should be deleted.

Also adds a function to delete a frame in a layer. This will
decrement the user count of the drawing and delete it if there are no
users left. This is consistent with the way GPv2 worked.

Pull Request: https://projects.blender.org/blender/blender/pulls/110579
2023-08-01 17:04:39 +02:00
Ray Molenkamp
b4e4030bd6 Cleanup: Format 2023-08-01 08:46:26 -06:00
Anthony
ef00b42982 Fix: failure to open on Windows ARM64 and WSL
This is done by forcing the Mesa D3D12 driver (which both use to render
Blender) to report that it is OpenGL 4.3 compatible.

It mostly is, other than a few texture extensions that are not yet
implemented. Blender (currently) does not use those.

There is a discussion pending with the viewport/evee team on those
extentions

Pull Request: https://projects.blender.org/blender/blender/pulls/110582
2023-08-01 16:36:39 +02:00