Commit Graph

106064 Commits

Author SHA1 Message Date
Hans Goudey
490c50c718 Cleanup: Use camel case for file tooltip struct name 2024-01-19 09:27:56 -05:00
Hans Goudey
6abf43cef5 Cleanup: Use std::string to store and pass tooltip text
Store temporrary tooltip text as `std::string` instead of
manually allocated C strings. Use `fmt` to format instead
of our own formatting utilities that return an allocated C
string.
2024-01-19 09:27:56 -05:00
Hans Goudey
90c4e2e6ec Cleanup: Replace UI button "string info" function
Instead of a single function with variadic arguments, a special enum
type containing which string to request, and a special struct to
contain the request and the result, just use separate functions for
each request, and return a std::string by value. Also change the enum
item string access to just give access to the enum item itself and add
const in a few places as necessary.

The callers of the API function get much clearer this way, and it's
much easier to see which information is used to create certain tooltip
strings.
2024-01-19 09:27:56 -05:00
Falk David
c5dff902a6 GPV3: Modifiers: Add get_drawing_infos_for_write
This API returns a vector with a pointer to each drawing as well
as the starting frame for the keyframe that the drawing came from.
2024-01-19 14:58:07 +01:00
Falk David
b6ed5eea8d GPv3: Return std::optional from frame_key_at
Previously, `frame_key_at` would return `-1` for when it couldn't find
a key for the given frame.
This could lead to issues though, because `-1` is a valid key (it is a valid scene frame number).

This changes the API to return an optional instead. This makes it very clear
when no key was found, and should make it less error prone.
2024-01-19 14:58:07 +01:00
Sybren A. Stüvel
0602683ec2 Cleanup: Anim, add missing #pragma once
No functional changes.
2024-01-19 14:54:45 +01:00
Philipp Oeser
8189e2266b Revert "Fix #68436: External Particle Disk Cache Playback Is Broken"
this broke the dynamic paint test

This reverts commit ab9c0af1ce.
2024-01-19 14:53:43 +01:00
Sergey Sharybin
f8c283d2b7 Fix: Assert in geometry nodes in specific files
Possibly also fixes write past array boundaries.

Happens with the mikassa-shading.blend file, by simply opening
the file in debug mode. The fix is suggested by Jacques.

Pull Request: https://projects.blender.org/blender/blender/pulls/117331
2024-01-19 14:52:43 +01:00
Jacques Lucke
4b47b46f9c Cleanup: rename PIL to BLI
The term `PIL` stands for "platform independent library." It exists since the `Initial Revision`
commit from 2002. Nowadays, we generally just use the `BLI` (blenlib) prefix for such code
and the `PIL` prefix feels more confusing then useful. Therefore, this patch renames the
`PIL` to `BLI`.

Pull Request: https://projects.blender.org/blender/blender/pulls/117325
2024-01-19 14:32:28 +01:00
Omar Emara
35dcd79391 Fix: Syntax error in latest commit 2024-01-19 14:52:05 +02:00
Martijn Versteegh
a3b7674c6e Compositor: Add a Nearest sampling to Map UV node
When using the MapUV node for certain NPR workflows (for example palette
based remapping of colors) it can be useful to not use the default
anisotropic filtering.

In preparation of potentially adding more filter modes at a later stage
and to keep things consistent with the 'transform' node we use the full
set of interpolation modes in the enum, but expose only the implemented
ones in RNA..
2024-01-19 13:24:22 +01:00
Omar Emara
56f3cef4c1 Fix: Cryptomatte fails with multi-layer images
The GPU Cryptomatte node fails when the source is a multi-layer image.
This is because the check that compares the Cryptomatte Type Name with
the layer name was reversed.
2024-01-19 14:07:00 +02:00
Falk David
d3cd2c5556 Fix: GPv3: Error in shader caused by mixing data types 2024-01-19 12:34:59 +01:00
Omar Emara
23f90dea4c Fix #117317: Empty Defocus output when Z is less than 0
The Defocus node produces an empty output when the Z input is less than
0. This patch fixes that by ensuring zero or positive blur radius.
2024-01-19 13:19:22 +02:00
Omar Emara
20932608ea Fix #117318: Empty Defocus output when max blur is less than 1
The Defocus node produces an empty output when the max blur is less than
1. This patch fixes that by passing the image through in that case,
since it is identity in this case.
2024-01-19 13:08:19 +02:00
Omar Emara
91f7216eb1 Compositor: Optimize Pixelate node for unit pixel size
Pass the input image through for unit pixel sizes.
2024-01-19 13:03:28 +02:00
Omar Emara
d537e63fa6 Fix: Plane Deform mask retains original alpha
The Plane Deform mask output retains the original alpha of the input
image, while it should be a binary mask. This patch ignores the alpha of
the image and uses a binary mask instead.
2024-01-19 12:59:31 +02:00
Jacques Lucke
f384622343 BLI: add utility to create random number generator with seed based on time
This is used in a bunch of different places and is done in slightly different ways
every time. Now the intend of the code is more obvious.
2024-01-19 11:58:02 +01:00
Falk David
4197270ca1 Cleanup: GPv3: Unused variable 2024-01-19 11:49:46 +01:00
Philipp Oeser
ab9c0af1ce Fix #68436: External Particle Disk Cache Playback Is Broken
This has been broken since 2.8.

The highlevel reason for this is that the "info file" (saved as frame
zero) was not written anymore.
Reason for that in turn is that when calling `BKE_ptcache_write` outside
the bake job, the `PTCacheID` `calldata` (a psys in our case) is not the
evaluated particle system, causing a check for `totpoint` to fail (these
were always zero).

Deeper reasoning is unclear, no further investigations were done as to
why/when this happened.

The solution proposed here is using the evaluated psys when writing the
info frame (and this is isolated to just this spot). File then gets
written and can/will be read when using this as an external disk cache
in another file.

Pull Request: https://projects.blender.org/blender/blender/pulls/117291
2024-01-19 11:47:36 +01:00
casey bianco-davis
3b23105120 GPv3: Pass more attributes to the renderer
This implements the following: rotation, aspect, hardness, vertex color, fill color and stroke UVs.

Pull Request: https://projects.blender.org/blender/blender/pulls/109093
2024-01-19 11:47:00 +01:00
Lukas Tönne
81a8e0b0c1 Cleanup: Removed unused grease pencil code lines. 2024-01-19 11:37:36 +01:00
Lukas Tönne
01d4e8a345 Grease Pencil: Replace opacity modifier DNA flag for influence panel.
Use `BKE_panel_layout_panel_state_ensure` to get a panel open/close flag
without requiring a DNA flag.
2024-01-19 11:32:44 +01:00
Lukas Tönne
2eb6bc5ca3 Grease Pencil: Fix layout for influence curve widget.
This should use a column layout of full width.
2024-01-19 11:22:17 +01:00
Jacques Lucke
ef741bc6ff Fix: crash when adding bake item to already baked node
This was caused by the introduction of the generic `SocketValueVariant` type.
Now it's not enough to simply default-construct the value anymore, but it has
to be constructed with the correct type.
2024-01-19 11:19:22 +01:00
Jacques Lucke
796aa0be59 Fix #117077: layout panels don't work in panels with no header
Previously, panels without headers were always skipped in the code
that opens and closes panels because they could not be closed.
Now they can contain layout panels that can be closed even if the root
panel can not be closed.
2024-01-19 10:59:54 +01:00
Sergey Sharybin
1dfb41bc75 Fix #117280: Cycles: Lights from instancer not working randomly
The issue was caused by light and shadow linking runtime data not
evaluated first time for lights linked to scene indirectly.

Simple solution is to hook up shading component to the instance
operation, so that visibility flag is properly propagated to the
shading component, and the light linking is evaluated.

Do it as non-flushing operation to prevent possible unwanted
re-evaluated of instancers.

Pull Request: https://projects.blender.org/blender/blender/pulls/117301
2024-01-19 09:24:59 +01:00
Sergey Sharybin
2cc6eab244 Cleanup: Simplify tracking of relations for instancing
Instead of having a set of hardcoded rules in the collection and
object instance collection builder introduce new node on object's
INSTANCING component which is to be hooked up to the node which is
duplicating the object.

Should be no functional changes.
2024-01-19 09:24:57 +01:00
Sergey Sharybin
fc42227b2d Cleanup: Make duplication node and ocmponent name more clear
Follow the new terminology of instancing, and make it clear what
side it is (instancer or instancee).
2024-01-19 09:24:57 +01:00
Sergey Sharybin
efba5f0432 Depsgraph: Add explicit object shading exit operation
Currently there is no functional changes.

In the future it allows to more easily hook the shading component
to other nodes to ensure the visibility flow.

Note that since the operation is not used by any relation it will
appear disconnected in the graphviz debugger. This is due to the
current behavior of deg_graph_remove_unused_noops().
2024-01-19 09:24:57 +01:00
Campbell Barton
7daf900181 Cleanup: spelling in comments, remote debug print 2024-01-19 17:28:14 +11:00
Campbell Barton
a5794b3caa PyAPI: include the handler type when printing an exception
The extra information can help when debugging.
2024-01-19 15:44:27 +11:00
Campbell Barton
f7f3460231 Cleanup: various non-functional changes for C++ 2024-01-19 11:52:10 +11:00
Jacques Lucke
f4e52f447a Modifiers: add ModifierTypeInfo::foreach_cache callback
This allows modifiers to have cache pointers that are preserved over undo steps.
I intend to use this for the baked data cache for the geometry nodes modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/117307
2024-01-18 22:51:30 +01:00
Jacques Lucke
d25274ee63 Cleanup: rename IDCacheKey.offset_in_ID to identifier
The name `offset_in_ID` is very misleading since it does not have to be an offset at all,
it just has to be some unique value. Often it's also a hash or a constant value depending
on the use.

Pull Request: https://projects.blender.org/blender/blender/pulls/117306
2024-01-18 22:50:40 +01:00
Hans Goudey
4aad32bcfe Cleanup: Fix linker error after recent cleanup
Also avoid unnecessary .c_str() calls.
2024-01-18 16:34:27 -05:00
Hans Goudey
85842b0ef3 Fix: Display newly added node in front
The ui order needs to be higher than the other nodes before the
nodes are sorted later.
2024-01-18 16:13:00 -05:00
Hans Goudey
ff657f28d0 Fix #117235: Frame node sorting sometimes incorrect
Sometimes a frame node can't be behind another because of parenting.
Comparing the two nodes with `compare_node_depth` would give that
result too, but sometimes every combination of frame node isn't tested.
In that case, the existing values of `ui_order` matter, and we should start
the sort there. So first sort based on the existing order, then do a stable
sort to fulfill the constrains coming from  selection and parenting.
2024-01-18 16:13:00 -05:00
Hans Goudey
dd0a2f3982 Cleanup: Move node transform convert file to C++ namespace 2024-01-18 16:13:00 -05:00
Hans Goudey
49078e68e3 Nodes: Avoid unnecessarily sorting nodes after transform 2024-01-18 16:13:00 -05:00
Hans Goudey
f929fb5d77 Cleanup: Store uiBlock name as std::string
And change some adjacent code to benefit from the simplicity
and constant time access to the length of the string.
2024-01-18 16:13:00 -05:00
Hans Goudey
821b077149 Fix #117272: Color property with popover causes Blender freeze
Caused by 29f3af9527, exposed by bff51ae66c.

The problem was that a `uiBut` pointer was being passed to a function
and then dereferenced as a `PanelType`. In the past, the button used to
just have zeros where the pointer was then read from, but after the
changes in the second commit, this was no longer the case.

Fix by being more explicit about the argument type, and changing the
argument from a button to the panel type for one callback. It's a bit
complex because the panel type and panel type idname are stored in
different places depending on the button type.
2024-01-18 13:57:30 -05:00
Thomas Barlow
7d77caab9b PyAPI: Add ShapeKey.points for faster foreach_get/set of Mesh shape key data
Mesh shape key data elements are always of the `ShapeKeyPoint` type and
only have a `.co` property which is stored contiguously. However, the
`.data` collection property's elements are dynamically typed because
Legacy Curve shape key data elements use a mix of `ShapeKeyCurvePoint`
and `ShapeKeyBezierPoint` elements. The necessary support for handling
the dynamic/mixed typing of the shape key data elements disables raw
access to the collection and its elements which makes `foreach_get`/
`foreach_set` slower.

`ShapeKey.points` is a new collection property whose element type is
fixed as `ShapeKeyPoint` and uses the `#rna_iterator_array_next` and
`#rna_iterator_array_get` collection functions which enable raw access
to the collection.

To complete the raw access to Mesh shape key data, the `.co` property of
`ShapeKeyPoint` also needs raw access. To accomplish this, the RNA
definition for `ShapeKeyPoint` now uses the `#vec3f` DNA struct and its
`.co` property is set to start from the `x` field of the `#vec3f` DNA
struct.

Lattice shape keys also use `ShapeKeyPoint` and also benefit from using
`.points` instead of `.data`, though Lattice objects typically have far
fewer data, such that performance is of minimal concern.

On shape keys belonging to Legacy Curves (`bpy.types.Curve`/
`bpy.types.SurfaceCurve`), `.points` will simply always be empty because
they do not have `ShapeKeyPoint` elements.

---

**Performance**

The increase in performance is specifically for foreach_get/foreach_set,
there is no noticeable performance difference to iterating through or
accessing individual elements of `.points` directly through Python, e.g.
`.points[0].co` vs `.data[0].co`.

`foreach_get` with a Python list is about 2.8 times faster.

`foreach_get` with an incompatible buffer (NumPy ndarray with np.double
dtype) is about 1.4 times faster.

`foreach_get` with a compatible buffer now scales better with larger
collections, so it is about 11.7 times faster at 100 elements and about
200.0 times faster at 100000 elements, dropping off to about 65 times faster for much larger collections.

The increase in `foreach_set` performance is slightly better than in
each `foreach_get` case, but scales the same overall.

`foreach_set` with a Python list is about 3.8 times faster.

`foreach_set` with an incompatible buffer (NumPy ndarray with np.double
dtype) is about 1.45 times faster.

`foreach_set` with a compatible buffer now scales better with larger
collections, so it is about 13.4 times faster at 100 elements and about
220.0 times faster at 100000 elements, dropping off to about 70 times faster for much larger collections.

The performance drop-off might be to do with hardware/OS specifics of `memcpy`. The drop-off occurs for me on Windows 10 with my AMD Ryzen 7 3800X at just above 1.5MiB of data copied (1572888B copied -> 200x faster, 1572900B copied -> 75x faster).

Pull Request: https://projects.blender.org/blender/blender/pulls/116637
2024-01-18 19:15:17 +01:00
Harley Acheson
6d357dc60d UI: Dialog to Insert Unicode Characters for Text Objects
Dialog box that allows the entry of any Unicode character into a 3D
Text Object string by entering its hexadecimal codepoint value.

Pull Request: https://projects.blender.org/blender/blender/pulls/116966
2024-01-18 17:59:36 +01:00
Hans Goudey
4d03de9113 Cleanup: Make format 2024-01-18 11:40:19 -05:00
Christoph Lendenfeld
0b67cc1db4 Refactor: rename function to evaluate a driver
No functional changes.

In #116823 the function `remap_driver_frame` was moved,
but the name doesn't exactly correspond to what the function is doing.

Since it evaluates the driver, with different parameters, it is now called
`evaluate_driver_from_rna_pointer`.

We could maybe remove the function because it is only called once.

Pull Request: https://projects.blender.org/blender/blender/pulls/117294
2024-01-18 17:19:15 +01:00
Miguel Pozo
b5743dcf0a Fix #117159: GPU: Specialization constants binding deleted programs
The lack of a move constructor in GLProgram was causing Map reallocations
to delete their owned shaders/programs.
2024-01-18 17:12:24 +01:00
Christoph Lendenfeld
4e0141c67f Refactor: move code from RNA to blender::animrig
No functional changes.

Moves the code recently introduced with #116815
The logic now lives in a new function called `reevaluate_fcurve_errors`

Pull Request: https://projects.blender.org/blender/blender/pulls/117290
2024-01-18 16:51:20 +01:00
Thomas Dinges
64fc6d7890 Docs: Replace most wiki links with links to new developer docs
Exceptions:
* Links to personal wiki pages
* Pages that are not in the new developer docs yet (like Human Interface Guidelines)
* tools\check_wiki\check_wiki_file_structure.py needs a refactor
2024-01-18 16:49:38 +01:00
Hans Goudey
290b417998 Cleanup: GPv3: Small tweaks to modifiers
- Fix modifier icon
- Remove unused includes
- Remove unused argument
- Change function name
- Use `eval_frame` for retrieving drawings
- Avoid unnecessary cast
- Remove unnecessary parentheses
- Declare some variables const

Pull Request: https://projects.blender.org/blender/blender/pulls/117281
2024-01-18 16:29:03 +01:00