Commit Graph

99075 Commits

Author SHA1 Message Date
Michael Kowalski
5a6db19da4 Cleanup: make format. 2023-04-25 12:48:36 -04:00
Michael Kowalski
239af1705d Fix #102594: USD Import: mask multiple prim paths.
These changes enhance the prim_path_mask USD import option to allow masking on multiple paths.

Changed the prim_path_mask import property to a string of arbitrary size.

Multiple paths may be specified in a list delimited by commas or semicolons.

Reviewed by Bastien and Matt McLin.

Pull Request: https://projects.blender.org/blender/blender/pulls/106974
2023-04-25 16:32:52 +02:00
Bastien Montagne
cbcf9058cd Fix (unreported) potential missing deletion of some linked liboverrides during resync.
The code checking whether old liboverrides which have been resynced into
new ones should be deleted was still assuming it was only working on
local liboverrides.

However, since recursive resync was implemented, this is not true
anymore, it can also handle resynced linked liboverrides.

This could have lead to missing deletion of some old linked liboverrides
after resyncing them.
2023-04-25 15:51:03 +02:00
Bastien Montagne
5f67b25c28 LibOverride: Do not attempt to resync a hierarchy when the root goes missing.
This addresses an issue here at the Blender studio, where a root
collection of a set was removed by mistake from the set library .blend file.

Since all the other linked data (sub collections, actual objects etc.)
of the set were still available, the liboverride resync code went crazy
trying to resync all these scattered pieces of a set, finding new valid
root IDs for the hierarchies, and so on.

So from now on, do not attempt to resync anything that is part of a
liboverride hierarchy which root ID linked reference has gone missing.
2023-04-25 15:51:03 +02:00
Bastien Montagne
b666d2d1bd Fix further (unreported) issues in object collection cache cleanup code.
`BKE_collection_object_cache_free` can be called from some points in
code (e.g. during ID remapping) where proper parenting relationships
between collections cannot be ensured.

Would be good to check if recursive cache cleanup is actually needed
from these points, it would almost certainly be better and safer to
instead tag parent collections as dirty too, but this will be for
another time.

For now, just add a NULL-check on the parent collection pointer.
2023-04-25 15:51:03 +02:00
Bastien Montagne
250d35928e Fix (unreported) broken code in BKE_collection_object_cache_free.
This call should be recursive, only freeing cache of immediate parents
of the collection is not enough, the whole parenting chain needs to be
processed.
2023-04-25 15:51:03 +02:00
Julian Eisel
1fad165c1a Cleanup: Avoid unnecessary & misleading Outliner context function call
The function used to be needed for recursing the tree, as the name
indicated. But it has recently been ported to the new tree iterators
so the recursion isn't necessary anymore.
2023-04-25 15:49:25 +02:00
Jeroen Bakker
d5cd51f089 Vulkan: Add streaming buffers.
Add support for streaming buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/107335
2023-04-25 15:48:52 +02:00
Jeroen Bakker
a813b65c7d Vulkan: Command Buffer.
Changes to the internal workings of the VKCommandBuffer:
- Use state engine to track correct usage.
- Switch between render pass/no render pass automatically.

Eventually the command buffer should be rewritten to use custom command
encoding to improve performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/107337
2023-04-25 15:32:41 +02:00
Jeroen Bakker
468a152fe1 Vulkan: Uniform Buffer
Add implementation to clear and bind uniform buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/107334
2023-04-25 15:30:55 +02:00
Jeroen Bakker
fd7f21af8c Vulkan: Shader Interface Attribute Extraction.
Add extraction of attributes from shader interface.

Pull Request: https://projects.blender.org/blender/blender/pulls/107333
2023-04-25 15:09:25 +02:00
illua1
70504a35dd Cleanup: Type conversions in node.cc
Make sure that function style, reinterpret_cast, and static_cast are
used for all type conversions, without of casting to void *. Some other
related minor changes: add temporal variables, lost space, asserts for
case to avoid type conversions by using `->id` way.

Pull Request: https://projects.blender.org/blender/blender/pulls/107097
2023-04-25 14:38:24 +02:00
Pratik Borhade
d742223197 Fix #107273: Group input is not listed in the node search
Group input/output nodes are not listed in search list
after cc925b9282. Similar to 5b2b114a2a
add these nodes in search list with the help of `gather_add_node_search_ops`.

Reviewed by: deadpin, HooglyBoogly

Pull Request: https://projects.blender.org/blender/blender/pulls/107323
2023-04-25 14:28:16 +02:00
Omar Emara
1c3d67d4cc Realtime Compositor: Split cache into containers
This patch refactors the static cache manager to be split into multiple
smaller Cached Resources Containers. This is a non factional change, and
was done to simplify future implementations of cached resources as they
become more elaborate.
2023-04-25 13:20:00 +02:00
Jacques Lucke
a57584e40d BLI: extract MapItem type to simplify iterating over map items 2023-04-25 12:15:02 +02:00
Jeroen Bakker
5fde2b34ba GPU: Ensure Absolute Ratio During SDF-Widget Drawing
In the GPU_SHADER_2D_WIDGET_BASE the deriviates were assumed to be
positive. This is not always the case. In Vulkan this leads to
incorrect rendering of the widgets due to incorrect SDF values.

This change will ensure that the shader make the ratio variable
absolute.

Pull Request: https://projects.blender.org/blender/blender/pulls/107327
2023-04-25 12:08:43 +02:00
Philipp Oeser
eda88466ee Fix #107186: Curve assets don't generate preview images
e7bea3fb6e disabled this.

I do believe excluding `OB_CURVES_LEGACY` is wrong though. While it
_might_ not have real geometry, it certainly _can_ have real geometry,
so now legacy curves are enabled again in `OB_TYPE_IS_GEOMETRY`.

A more elaborate check for real geo on legacy curves could be set up in
a following commit.

Since `OB_TYPE_IS_GEOMETRY` is also used in depsgraph driver handling,
will seek additional review from more devs.

Pull Request: https://projects.blender.org/blender/blender/pulls/107214
2023-04-25 11:25:21 +02:00
Bastien Montagne
6124f4dbb4 ID RNA: Add accessor to the 'IS_MISSING" status tag of IDs.
This tag is set for linked data that cannot be found anymore on
fileread, and for which an empty placeholder ID is generated instead.
2023-04-25 10:47:56 +02:00
Omar Emara
151a53110c Realtime Compositor: Implement Texture node
This patch implements the Texture node for the realtime compositor. The
evaluation of the texture is not GPU accelerated, but is cached as a
form of temporary implementation since the Texture node is deprecated
and will be removed in the future. Furthermore, texture node evaluation
is not supported for now.

This patch also introduces the concept of an ID static cache, which
uses the DrawDataList mechanism to invalidate the cache as needed,
consequently, a DrawDataList was added to the Tex ID structure.

An improvement that should be implemented outside of this patch is to
implement support for proxy textures in results to avoid redundant
copies in the execute method of the texture node. This should be
straightforward bit will be implemented in a separate patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/107291
2023-04-25 09:04:35 +02:00
Hans Goudey
2cbf536605 Cleanup: Use consistent enum type in header
Fixes a warning on GCC 13 about `uint` being used in the declaration and
the proper enum type `eDupli_ID_Flags` being used in the definition for
`BKE_id_copy_for_duplicate`.
2023-04-24 21:45:12 -04:00
Hans Goudey
30f8e688c3 Fix: Wrong crease accessed for multires reshape
Also fix one more case of incorrect conversions from char to float.
2023-04-24 21:42:12 -04:00
Hans Goudey
9f78530d80 Multires: Use cached loose edge information
Avoids iterating over poly and corner edge index arrays.
2023-04-24 21:39:50 -04:00
Hans Goudey
3507431c30 Subdiv: Optimize coarse position extraction with cache
The coarse positions given to the evaluator are skipped if there are
vertices not attached to faces. Use the cache from 8e967cfeaf
to skip that topology query, or even to tell if there are no such vertices,
so we can skip a copy completely. I observed a 12x improvement for this
step, from 7.5 ms to 0.6 ms on a 1 million vertex grid.
2023-04-24 17:01:12 -04:00
Joseph Eagar
c4e4184c50 Sculpt: Fix #107092: ss->filter_cache not being null'd on free 2023-04-24 12:20:03 -07:00
Bastien Montagne
a649ff7b98 Fix broken 'replace object in collection' code.
Code was not handling properly the case where the new object that should
replace the old one in given collection is already in the collection. In
such case, remove the old object from the collection, but do not attempt
to add the new one again.
2023-04-24 19:35:11 +02:00
Damien Picard
4f08eeae9c Nodes: Make spacings unitless in String to Curves node
The String to Curves node allows selecting various metrics for the
characters. Size is the absolute height between two lines, and is
correctly marked as a distance. Character, Word and Line Spacing, on
the other hand, do not represent any distance, but are proportional to
the base size and should not have distance units.

This commit simply removes the properties' `PROP_DISTANCE` subtype.

Pull Request: https://projects.blender.org/blender/blender/pulls/106660
2023-04-24 18:31:25 +02:00
illua1
aeb15e4e76 Cleanup: fix compiler warning
Warning C4551: function call missing argument list.

Pull Request: https://projects.blender.org/blender/blender/pulls/107237
2023-04-24 17:37:31 +02:00
Germano Cavalcante
4504a13bd9 Fix #107262: snap source of type Active Element sometimes fails
Remove micro optimization that seeks to reuse the active center 
alculation.

This operation is lightweight and reusing its result only adds an
unnecessary dependency.
2023-04-24 11:41:40 -03:00
Bastien Montagne
9a671c401d Fix several issues in recent changes to ID swap and lib_query.
Fix #107297: Crash on undoing "Use Nodes" step.
Fix (unreported) crash on undoing certain type of data deletion (like
collections) in some specific cases.

Main serious issues were in new handling of embedded IDs in ID swap code
(#107297), and in general in lib_query remapping code from
`BKE_lib_id_swap_full` in readfile code in undo case which could access
other IDs data, when it is not guaranteed to be valid at this point in
code.

Added an option flag to lib_query code to forbid access to the original
ID pointers in such cases.
2023-04-24 15:49:59 +02:00
Jeroen Bakker
d9621add55 Vulkan: Initialize Device Capabilities.
Load the device capabilities into the context. This makes sure
that GPU framework already takes care of the capabilities.

Pull Request: https://projects.blender.org/blender/blender/pulls/107302
2023-04-24 15:35:27 +02:00
Jeroen Bakker
b94a0ec8db WindowManager: Context Creation
Currently window manager always tried to create an OpenGL context.
This is incorrect and will fail when using Vulkan. Somehow this
doesn't fail for Metal.

This PR creates a context based on the current selected backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/107301
2023-04-24 15:33:35 +02:00
Jeroen Bakker
26147b29a7 Vulkan: Construct a Vulkan 1.2 Context.
Apparently we always constructed a Vulkan 1.0 Context, although we
are targetting Vulkan 1.2. This also lead to incorrect expectations
when using the Vulkan Memory allocator.

Pull Request: https://projects.blender.org/blender/blender/pulls/107300
2023-04-24 15:32:17 +02:00
Omar Emara
b68b3e7b8f Cleanup: Add missing domain priority for mask nodes
This patch adds missing domain priority specifications for the Box and
Ellipse mask. This is a non-functional change because the inputs
happened to be properly ordered anyways.
2023-04-24 14:05:50 +02:00
Sybren A. Stüvel
85ed2e8c36 Animation: add function for deduplicating FCurve keys
Introduce `BKE_fcurve_deduplicate_keys()` to merge keys that are on the
same time, or within the time comparison threshold (1/100th of a frame).

When merging two consecutive keys, the last one 'wins' and determines
the final key *value*. The first key's *time* is retained, to ensure the
reference point for the next comparisons is stable. The only exception
here is when there is a key exactly on an integer frame number, in which
case that one is preferred.

The function is exposed in RNA as `fcurve.keyframe_points.deduplicate()`

This commit also introduces a new function `BKE_fcurve_bezt_shrink(fcu,
new_totvert);` that can reallocate the `bezt` array to ensure removed
keys no longer take up memory.

The RNA function `fcurve.update()` currently performs two steps, which
are now exposed to RNA as well, as `keyframe_points.sort()` and
`keyframe_points.handles_recalc()`. This is so that Python code can
sort, deduplicate, and then recalculate the handles only once (calling
`update` + `deduplicate` would do the latter twice).

In Blender 4.0 the deduplication will also be part of `fcurve.update()`,
see #107126.

Reviewed on https://projects.blender.org/blender/blender/pulls/107089
2023-04-24 12:07:28 +02:00
Sybren A. Stüvel
92ab89c6d9 Anim: add simple unit test for stability of sort_time_fcurve()
The `sort_time_fcurve()` function should be stable, i.e. not change the
relative order of keys that have the same X-coordinate. This is now
enforced by a unit test.

I want to build a new function that can deduplicate the keyframes after
sorting, for which it's important that the 'last key wins' to get reliable
results.
2023-04-24 12:07:28 +02:00
Sybren A. Stüvel
017d83790c Refactor: move keyframe-adding function from RNA to editors/animation
The RNA function `fcurve.keyframe_points.add(N)` was purely implemented
in the RNA wrapper. It now sits in `ED_keyframes_add(fcu, N)` where it
can be used by other C code as well.

It's in the editors code, as regular keyframe insertion is there as
well.

No functional changes.
2023-04-24 12:07:28 +02:00
Philipp Oeser
e4afa06dab Fix #107261: bpy.types.Text (region_as_string/region_from_string) crash
These two didnt check if keywords were passed in, crashed on running
`PyDict_GET_SIZE` on NULL (in case of no keywords).

Oversight in ee292a1d66.

Now just check if keywords are actually passed in.

Pull Request: https://projects.blender.org/blender/blender/pulls/107285
2023-04-24 11:48:22 +02:00
Jacques Lucke
ca32fb604e Geometry Nodes: support outputting field without computing full node
Many nodes output anonymous attributes (e.g. the top selection in the
Cylinder node). The actual data is only contained in the geometry output
though. The field output just contains a reference to this data (essentially
just the generated name of an attribute). This data can be output even
without computing the geometry itself.

As of right now, this only simplifies the code a bit, but does not have a
bigger impact, because to use the anonymous attribute, you always need
the geometry anyway. However, with the upcoming simulation nodes,
it's possible to create the anonymous attribute in one frame and to access
it in another frame. In the other frame we only need the anonymous
attribute reference and don't have to create the actual geometry again.
Skipping creating the actual attribute on the geometry can have a
significant performance benefit.
2023-04-24 11:42:05 +02:00
Campbell Barton
10fc2d6d96 Cleanup: remove basepath argument from BLI_path_normalize{_dir}
Keep these operations separate to simplify path handling logic & docs.
Many callers passed NULL and there were times paths were passed in which
didn't make any sense (where the paths had already been made absolute).
2023-04-24 12:23:04 +10:00
Campbell Barton
20eb682967 Cleanup: rename main_name to main_filepath
It wasn't clear this is a file-path, previous name was left over from
when the blend files path was called `name`.
2023-04-24 12:11:40 +10:00
Campbell Barton
6ab225074d Cleanup: minor changes to BLI_path_normalize
- Don't attempt to skip the WIN32 drive component on relative paths
  it's possible this would have unexpected behavior but paths like
  are already unlikely to work as expected, e.g. "//C:\".
- Remove early returns for empty paths as there is no need for special
  handling.
- Add path normalize NOP tests
2023-04-24 11:58:47 +10:00
illua1
2166fd2685 Geometry Nodes: Delete value moving for drag and drop group inputs
Initially, this function was for node data. At Simon's suggestion, it
was extended to a node group inputs as well. However, this overlaps with
another function. It has been missing for a while, but has recently been
fixed by https://projects.blender.org/blender/blender/pulls/107179. Now this functionality is redundant.

Pull Request: https://projects.blender.org/blender/blender/pulls/107255
2023-04-24 03:54:59 +02:00
Campbell Barton
8b1c54cd50 Cleanup: remove redundant path functions
- BLI_path_normalize ran BLI_path_abs on a path that had already
  been made absolute.
- BLI_path_slash_ensure was called after BLI_path_normalize_dir
  which already ensures a slash.
2023-04-24 11:25:56 +10:00
Hans Goudey
993d24c174 Cleanup: Miscellaneous improvements to subdivision geometry nodes
- Implement mesh creation in GeometrySet agnostic way, with less context
- Remove useless comments
- Use a field to clamp crease values instead of clamping when copying
- Small variable name tweaks
- Use `BKE_subdiv_new_from_mesh` instead of "update"
- Remove crease layers before writing, avoiding potential copy
2023-04-23 15:27:20 -04:00
Hans Goudey
e7eb8fd908 Cleanup: Remove unused includes, correct comments 2023-04-23 15:27:20 -04:00
Hans Goudey
54072154c5 Subdiv: Tag result mesh with no loose edges/verts
Avoid possible calculations of loose edges later on if the coarse mesh
doesn't have loose edges or vertices. We expect these counts to be
cached already since `BKE_subdiv_converter_init_for_mesh` calls
`verts_no_face()` and `loose_edges()` already.

Related commits:
- 63689e4756
- 8e967cfeaf
2023-04-23 15:27:20 -04:00
Hans Goudey
473bb8a8b0 Cleanup: Remove else after return in subdiv modifier code 2023-04-23 15:27:20 -04:00
Hans Goudey
5bed959e81 Cleanup: Avoid magic number for bits per integer 2023-04-23 15:27:20 -04:00
Hans Goudey
aa327e4ea5 Cleanup: Simplify subdiv check for crease usage
Now that crease arrays are separate arrays, we can just
not set the array pointers when crease usage is turned off.
2023-04-23 15:27:20 -04:00
Hans Goudey
2f581a779c Cleanup: Use utility constructor to create field operations 2023-04-23 15:27:20 -04:00