Commit Graph

103973 Commits

Author SHA1 Message Date
Falk David
37d2eaee4e Fix: GPv3: Crash renaming a layer
When renaming a layer to a (long) name that was already taken
by another layer, Blender would crash.
This was because the memory for the unique string was held by
`std::string` which cannot grow.
The solution is to use `char unique_name[MAX_NAME]`.
2023-10-18 17:01:25 +02:00
Julian Eisel
236e9ee6cb Merge branch 'blender-v4.0-release' 2023-10-18 16:11:35 +02:00
Julian Eisel
f622b4ce96 Fix #113201: Assets in same folder as current file ignored in All library
Note: Initially committed as 7705e49bcd, but got reverted with
1f0520034a. Note includes fixes for unit tests.

If an asset library was pointing to the same path as the current file is saved
in, the assets from this library wouldn't be loaded. This is because the asset
library service assumed the absolute library root path is a way to uniquely
identify an asset library.

Instead, identify the asset library using both the root path and the library
type.
2023-10-18 16:10:42 +02:00
Michael Kowalski
d96b137188 Merge branch 'blender-v4.0-release' 2023-10-18 09:37:49 -04:00
Michael B Johnson
686487ca17 Fix: USD: Use color3f for color nodes
Blender was writing out color attributes on USDPreviewSurface as
float3 instead of the more accurate color3f.  While this is somewhat
technically okay, since color3f is a role alias for float3, it does cause
issues in applications that are correctly expecting color3f.

The material writer code actually expects color3f in other
sections, but was using float3 in this section erroneously.

Co-authored-by: Dhruv Govil <dgovil2@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113695
2023-10-18 14:52:06 +02:00
Hans Goudey
5b108ae522 Cleanup: Resolve clang compile warnings
Of the two overloaded functions clang chose the non-span version with
only a single item in the initializer list. Resolve that by not using an
intializer list in that case.
2023-10-18 14:23:57 +02:00
Campbell Barton
6ed3b4a5a6 Cleanup: format, quiet unused argument warning 2023-10-18 22:09:27 +11:00
Campbell Barton
3e26a1a39c Cleanup: set WITH_INPUT_IME=OFF when unsupported
This avoids having to do platform checks before checking WITH_INPUT_IME.
2023-10-18 22:04:25 +11:00
Pratik Borhade
2a5c499585 GPv3: Assign material
Assign active material to selected strokes. This is similar to legacy GP
operator `GPENCIL_OT_stroke_change_color`.
Implements #113481

Pull Request: https://projects.blender.org/blender/blender/pulls/113573
2023-10-18 12:57:57 +02:00
Bastien Montagne
c5a408f5a1 WM Jobs: Add job's own reporting mechanism.
wmJob's shared data (with their worker threads), #wmJobWorkerStatus, now
also contains a #ReportList pointer.

Job worker code is now expected to use `BKE_report` APIs to populate this
new shared reportlist, instead of calling the (absolutely) not
thread-safe `WM_reports` API. This will be tackled in later commits.

Note that since commit 9859622a66, #ReportList and `BKE_report` API
is now thread-safe, so no further handling for this is required in the
wmJob code itself.

The periodic wmJob update handling (done through timers currently)
takes care of moving reports from the job data to the WM data.

Implements #112537.

Pull Request: #113548.
2023-10-18 12:48:52 +02:00
Bastien Montagne
9727373821 WM Reports: Add public API to move reports from a ReportList to WM one.
There was already such a `wm_add_reports` function, but it was private.
It is now available in the public API, and renamed to
`WM_reports_from_reports_move`.
2023-10-18 12:48:52 +02:00
Pablo Vazquez
9f2d32c154 UI: Use proper icon for nodes with UV Maps picker
It was set to none, which draws as a dot instead of the already familiar
UV Map icon used in the UV Maps list and other places.

Affects:
* UV Map
* Tangent
* Normal Map

Following !113793 efforts to unify icons.
2023-10-18 12:36:25 +02:00
Falk David
a89bb7632a GPv3: Separate/Delete Geometry node
This implements deleting a selection of layers on a grease pencil geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/113828
2023-10-18 11:54:56 +02:00
Falk David
080823f93c Fix: GPv3: Memory leak in set_name
The `set_name` function was not freeing the previously
allocated string and would leak the memory.
2023-10-18 11:50:41 +02:00
Hans Goudey
95201c6cbf Merge branch 'blender-v4.0-release' 2023-10-18 11:32:04 +02:00
Hans Goudey
b2fe1bf624 Fix #113824: Setting curves select mode changes active attribute
Currently the active attribute is stored as an index. This should be
changed to a string, but until then, adding or removing an attribute
changes the indeices. The workaround is to store the name and fix
the active attribute after the change.
2023-10-18 11:31:34 +02:00
Falk David
bc0e5cf8bd Cleanup: GPv3: Use helper to duplicate drawings 2023-10-18 11:27:01 +02:00
Falk David
74facf9841 GPv3: Add wrapper class for DrawingReference
Adds a simple C++ wrapper so we don't have to use
`MEM_dupallocN`, `MEM_freeN` etc.
2023-10-18 11:27:01 +02:00
Hans Goudey
b3460a6b2c Merge branch 'blender-v4.0-release' 2023-10-18 11:14:11 +02:00
Hans Goudey
cdae07dccf Fix #113842: Curves Info node length output always zero
Caused by a1cc621e1e. The "is_hair_length" value needs to be
set before `attr_input_name` is called because it uses the value to set
the attribute name with the "l" alias.
2023-10-18 11:13:38 +02:00
Jacques Lucke
5bee6bcedc Geometry Nodes: new Split to Instances node
This node allows splitting up a geometry into groups. A group is defined as all
elements with the same group id. The output contains an instance per group.
The `Group ID` output can be used for further deterministic processing.

The node supports meshes, curves, point clouds and instances. It only works
on the top-level geometry, so it does not go into nested instances because it
also generates new instances.

Co-authored-by: Hans Goudey <hans@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/113083
2023-10-18 10:26:23 +02:00
Jacques Lucke
9c56a19640 Merge branch 'blender-v4.0-release' 2023-10-18 10:18:04 +02:00
Jacques Lucke
969dd7b985 Geometry Nodes: add forward compatibility for map range socket identifiers
Also see 0ea193bdb3.
2023-10-18 10:17:43 +02:00
Jacques Lucke
fa1e65f554 Geometry Nodes: show grease pencil materials in material socket
This is only done when the experimental grease pencil option is
turned on for now.
2023-10-18 10:04:04 +02:00
Jacques Lucke
6e35e30ba8 Merge branch 'blender-v4.0-release' 2023-10-18 09:57:26 +02:00
Jacques Lucke
4f3262a128 Fix: update curve types before using them 2023-10-18 09:56:22 +02:00
Dalai Felinto
9a967d26fd GPv3: Set Material node
Note: At the moment the node only supports
non-Grease Pencil materials.

But if the material socket is connected to the
modifier a Grease Pencil material can be used.

Part of #113602.

Ref !113816.
2023-10-18 08:58:02 +02:00
Richard Antalik
3a230075cc Merge branch 'blender-v4.0-release' 2023-10-18 01:13:26 +02:00
Richard Antalik
01612bacfd Fix #113755: Incorrect speed overlay on retimed strips
Caused by off by 1 error in speed calculation.
2023-10-18 01:11:31 +02:00
Harley Acheson
8b74073383 Merge branch 'blender-v4.0-release' 2023-10-17 15:51:33 -07:00
Harley Acheson
9a3fa4d8cc Fix #113826: Set Explicit Font Size for Overlays
The complaint illustrates how text measurement can be broken by a
drawing callback. This is because overlays are setting global_font_size
value, which is used by subsequent drawing, but does not explicitly set
size on the global_font_default font, which is needed for measurement.

Pull Request: https://projects.blender.org/blender/blender/pulls/113868
2023-10-18 00:50:05 +02:00
Hans Goudey
e84ba67c73 Fix: Material selection node test failure
The actual selection needs to be evaluated on the right domain, not
necessarily the domain from the field context. It's interpolated as
a separate step.

Also reuse the attribute accessor already assigned to a local variable.
2023-10-17 22:46:16 +02:00
Hans Goudey
60e7e89bfa Cleanup: Retrieve virtual array single value in one call 2023-10-17 22:43:38 +02:00
Hans Goudey
4c7fe8b583 Cleanup: Remove unnecessary parentheses in switch cases
Also remove unnececessary checks that can be combined with the switch,
and use `.index_range()` instead of `IndexRange(.size())`.
2023-10-17 22:28:47 +02:00
Dalai Felinto
e773cc2967 GPv3: Set Material Index node
Part of #113602.

Pull Request: https://projects.blender.org/blender/blender/pulls/113821
2023-10-17 20:20:40 +02:00
Germano Cavalcante
6b001ea76c Merge branch 'blender-v4.0-release' into main 2023-10-17 14:53:45 -03:00
Dalai Felinto
42f71c9dca GPv3: Material Selection node
Part of #113602.

Pull Request: https://projects.blender.org/blender/blender/pulls/113827
2023-10-17 19:52:46 +02:00
Germano Cavalcante
934c2c894b Fix 'Snap Mode' versioning
NEAREST and PROJECT were swapped.
2023-10-17 14:52:42 -03:00
Germano Cavalcante
6bbad6c428 Fix #113801: "Snap to Same Target" don't work as expected
Introduced during snap code refactoring.

It seemed wrong to overwrite the calculated nearest distance based only
on the original distance.

But this is intentional, (the code could be improved since there are
unnecessary tests to detect the closest object).
2023-10-17 14:31:49 -03:00
Falk David
ed124d23d1 Fix: GPv3: Crash when storing deformed points
The issue was that the optional array was not correctly initialized.

Ref !113858
2023-10-17 19:29:52 +02:00
Dalai Felinto
c5ed37a5c0 GPv3: Replace Material node
Note: At the moment the node only supports non-Grease Pencil materials.

But if the material socket is connected to the modifier a Grease Pencil
material can be used.

Part of #113602.

Co-authored-by: Hans Goudey <hans@blender.org>
Ref !113818.
2023-10-17 18:51:47 +02:00
Falk David
78cb2776bb Fix #113740: Crash adding layer into empty group
This crash was cause by some mismatch in the indices.
We need to make sure to clamp the insertion index to the size of the
span of the layers.

Pull Request: https://projects.blender.org/blender/blender/pulls/113852
2023-10-17 18:34:42 +02:00
Dalai Felinto
f54d5df2fc GPv3: Fillet Curve node
Part of #113602.

Pull Request: https://projects.blender.org/blender/blender/pulls/113850
2023-10-17 18:30:38 +02:00
Hans Goudey
e1fd7a8a7b Cleanup: Simplify grease pencil line overlay size counting
Avoid the need to iterate over every curve, and only iterate over the
cyclic attribute if it exists. This removes the check that avoided
creating cyclic segments for curves with only two points. If that
was necessary, some of the complexity would return, but the
new `array_utils` function wouldn't be necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/113814
2023-10-17 18:29:17 +02:00
Falk David
48e60dcbff Fix: GPv3: Compile error 2023-10-17 17:13:13 +02:00
Falk David
07749b389d GPv3: Convert radius to blender units
Previously, Grease Pencil used a radius convention where
1 "px" = 0.001 units. This "px" was the brush size which would be
stored in the stroke thickness and then scaled by the point pressure
factor. Finally, the render engine would divide this thickness value by
2000 (we're going from a thickness to a radius, hence the factor of
two) to convert back into blender units.

Store the radius now directly in blender units. This makes it
consistent with how hair curves handle the radius.

* Removes the scaling in the render engine.
* Makes sure the grease pencil primitives use the correct radii
* Changes the drawing tool to work with screen space radius
* Draws the drawing tool cursor in screen space
* Makes sure the scaling is done when converting from legacy
grease pencil objects
* Makes sure the scaling is done when loading previous files

Consequences for the draw tool:
* Since the tool has a radius input in pixels, it now works in screen space. This is a pretty big change to how it works by default before, so a new option will have to be added that allows the brush to be in "Scene" space. This is similar to how it works in sculpt mode. But this is a bigger change, so I would like to split that into a separate PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/113770
2023-10-17 17:00:35 +02:00
Germano Cavalcante
5139a3a09f Merge branch 'blender-v4.0-release' into main 2023-10-17 11:46:45 -03:00
Germano Cavalcante
6ecef4d176 Fix crash when Transform Extend multiple NLA strips
`tdn` was being incremented even though it wasn't used, which led to
changes in memory outside the HEAP limits.
2023-10-17 11:46:10 -03:00
Miguel Pozo
6f125661e6 GPU: Add Texture::debug_clear
Clear uninitialized textures to NaN/debug values.
Enabled for `--debug-gpu` only.

Pull Request: https://projects.blender.org/blender/blender/pulls/113781
2023-10-17 15:54:09 +02:00
Miguel Pozo
25c2b17266 Merge branch 'blender-v4.0-release' 2023-10-17 15:46:32 +02:00