Commit Graph

120055 Commits

Author SHA1 Message Date
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
Christoph Lendenfeld
f0f1afd250 Refactor: remove driver dependency in keying code
No functional changes expected.

Before this PR the keyframing code was aware of driver specifics
and changed the frame where a key is inserted to the current driver value.

This is now changed so that the calling code needs to know where on the
FCurve the key should be inserted. This removes the need for the
`INSERTKEY_DRIVER` flag.

Pull Request: https://projects.blender.org/blender/blender/pulls/116823
2024-01-18 15:40:07 +01:00
Omar Emara
538ace5750 Fix: GPU Directional Blur distorts input
The GPU Directional Blur node distorts the inputs if the resolution is
not square. This is because rotation is performed on normalized
coordinates. This patch performs the normalization at the texture
evaluation.
2024-01-18 16:19:44 +02:00
Germano Cavalcante
7e53fe106a Fix: Individual projection sometimes snapping to the wrong object
The code was comparing real distance to square distance, which is
obviously wrong.
2024-01-18 11:17:00 -03:00
Hans Goudey
c70a7c933f Cleanup: Make format 2024-01-18 08:46:25 -05:00
Pratik Borhade
e97d34aba6 Fix #117266: Sculpt: Initialize Face Sets not updating
Likely caused by 251069ae5b due to missing flag for updating draw buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/117273
2024-01-18 14:19:55 +01:00
Jason Fielder
11afaa8dc6 Fix #116414: EEVEE Shadow compilation macOS
Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/117278
2024-01-18 14:10:24 +01:00
Hans Goudey
83b7b729a1 Fix #114657: Store default color attribute on store if none set yet
When there is no default color attribute yet, when creating a new color
attribute with the store named attribute node, set the default. Though
we generally try to avoid this more magical behavior, there's little
downside in this case, and it's probably what users expect.

Don't set the active attribute though, since that's UI data that generally
shouldn't be changed procedurally. It's okay if there's no active color
attribute.

Pull Request: https://projects.blender.org/blender/blender/pulls/117249
2024-01-18 14:02:27 +01:00
Omar Emara
f0f073bd1f Fix: Files with Pixelate nodes have zero pixel size
Old files with the pixelate node have zero pixel sizes. This patch just
adds versioning to properly initialize the pixel size.
2024-01-18 14:39:23 +02:00
Alexander Gavrilov
b350d7a4c3 Shape Keys: support locking to protect from accidental editing.
It is very common for graphical editors with layers to support
locking individual layers to protect them from accidental edits due
to misclicks. Blender itself already supports locking vertex groups.
This adds lock toggles for shape keys, with lock/unlock all operators.

The flags are checked by sculpt brushes, edit mode transform tools,
and Smooth, Propagate and Blend From Shape operators. This selection
aims to cover operations that only deform the mesh, where the shape
key selection matters.

Topology changing operations always apply to all keys, and thus
incorrect shape key selection is less impactful. Excluding them
from the new feature greatly reduces the patch size.

Pull Request: https://projects.blender.org/blender/blender/pulls/104463
2024-01-18 13:17:24 +01:00