Commit Graph

99509 Commits

Author SHA1 Message Date
Campbell Barton
3d45004552 Fix tangent layer extraction using an empty attribute name
The attribute name was always "" as the size argument was `sizeof(char)`
instead of the buffer length.
2023-05-13 17:34:17 +10:00
Campbell Barton
88938f03c7 Fix buffer overflow with seq_proxy_get_custom_file_fname
The file path was 256 bytes, passing in a buffer size of 1792
for string join & making the path absolute could also overflow
as it assumes a size of 1024.
2023-05-13 17:34:14 +10:00
Campbell Barton
7433f34c4d Fix incorrect buffer size passed to BLI_strncpy 2023-05-13 17:34:13 +10:00
Chris Blackbourn
654cfc06c5 Cleanup: format 2023-05-13 11:03:59 +12:00
Marino Toscano
a05a7988dc Fix #106929: Gap in node links when sockets are aligned
Fix an issue when drawing node links that caused gaps, when sockets were
horizontally or vertically aligned.

When the inner and outer points of the node link's bezier control
polygon overlap, the link's tangent can be a zero vector. The shader
didn't check for this before normalizing the tangent leading to an
undefined vector which prevented the outermost segments of the link
from being drawn.
Since this only happens when the end points of the node link are
horizontally or vertically aligned, we can use the vector between the
link's end points instead of the tangent.

Fix #106929
Fix #89282

Pull Request: https://projects.blender.org/blender/blender/pulls/107636
2023-05-12 20:35:22 +02:00
Hans Goudey
ee08b2ddff Geometry Nodes: Add display toggle for simulation cache in timeline
Similar to the existing options for toggling physics cache display.
2023-05-12 13:48:52 -04:00
Hans Goudey
34e29440f7 Fix #107151: Multires data from external file is not loaded
Making the custom data API const correct in 3a3d9488a1 caused
the issue, because it previously relied on non-threadsafe behavior. As a
workaround, just restore the thread-unsafety, and note the issue in a
new comment.
2023-05-12 13:48:11 -04:00
Iliya Katueshenock
995802d68e Fix #107893: Attribute Statistic produces wrong Variance value
The division must be by the amount, not the index of the latter.

Pull Request: https://projects.blender.org/blender/blender/pulls/107894
2023-05-12 19:43:26 +02:00
Bastien Montagne
3b647faec8 Fix (unreported) three wrong next/prev pointers order in ListBase link structs.
There was even one case in BLI ListBase tests!

Order was opposite of the one expected by the BLI ListBase code... Not
sure how, but this did not cause any issue apparently? But would expect
it to at least affect the order in which items in the list would be
iterated.
2023-05-12 19:02:39 +02:00
Bastien Montagne
ddd6e05c8d BKE: Collection: Add a basic validation tool for collections.
Mainly for debug purposes, makes it easy to detect invalid collections
(e.g. having more than once a same collection as child).
2023-05-12 19:02:39 +02:00
Bastien Montagne
d87d2dd4ba BLI: Add basic validation tool for ListBase.
Mainly a debug tool, makes it very easy to detect broken listbase.
2023-05-12 19:02:39 +02:00
Harley Acheson
d9f5ce2546 UI: Changes to NLA Solo Button
Move the NLA Solo button to right side of channel row.

Pull Request: https://projects.blender.org/blender/blender/pulls/107672
2023-05-12 18:55:06 +02:00
Aliaksandr Sharstniou
f5e3ed77c7 Geometry Nodes: Change "Separate Components" node output order to match Spreadsheet
The order of geometry components should match between
the Separate Components node and the spreadsheet editor.
This switches the Curve and Point Cloud outputs.

Resolves #107837

Pull Request: https://projects.blender.org/blender/blender/pulls/107868
2023-05-12 18:08:06 +02:00
Sebastian Parborg
846e0801ab Fix crash in transform code if there was no active pose channel 2023-05-12 17:42:46 +02:00
Bastien Montagne
4ecbb3f1d5 Fix IDManagement remapping missing some required remapping with some liboverrides.
`BKE_library_id_can_use_filter_id` would not handle properly cases where
the ID is a liboverride - it's hierarchy root pointer can point back to
virtually any kind of ID (although typically a Collection or Object).

This was breaking liboverride resync process in some rare cases, by
failing to remap the 'hierarchy root' pointer of some liboverrides.
2023-05-12 17:02:18 +02:00
Hans Goudey
6491387fba Fix: Incorrect value retrieval in simulation subframe mixing 2023-05-12 10:40:51 -04:00
Hans Goudey
4d7a93930c Fix: Build error after previous commit 2023-05-12 10:15:57 -04:00
Hans Goudey
e6e6fb3a62 Geometry Nodes: Implement simulation subframe mixing
Generally render engines can do subframe mixing themselves, but the
purpose of subframe mixing in the simulation output node is to support
higher quality motion blur with bakes when there are topology-changing
operations after the simulation output node. Linear mixing can fill the
gaps while maintaining lower memory usage.

All point/instance domain attributes are mixed, but mixing is only
supported when the domain size is unchanged or when an `id` attribute
gives a mapping between elements. Theoretically it may be possible, but
nested instance geometry is not mixed in this commit due to the
difficulty of finding matching geometries across arbitrary instance
hierarchy changes. Attributes that are completely unchanged are ignored
using implicit sharing for better performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/107599
2023-05-12 15:58:54 +02:00
Campbell Barton
fb584456e8 Revert "Fix #107759: Crash when running modal operator in load_post handler"
This reverts commit 95a114f3ca.

This broke bl_rigging_symmetrize, it seems likely the window was not
NULL on load in this case, setting it to NULL caused the the active
object not to be recognized.

This needs further investigation, reverting for now.
2023-05-12 23:23:49 +10:00
Hans Goudey
4f2ac09886 Cleanup: Reduce binary size by deduplicating attribute processing
This makes the Blender binary 350 KB smaller. The largest change comes
from using `FunctionRef` instead of a template when gathering indices to
mix in the extrude node (which has no performance cost). The rest of the
change comes from consolidating uses of code generation for all
attribute types. This brings us a bit further in the direction of
unifying attribute propagation.

Pull Request: https://projects.blender.org/blender/blender/pulls/107823
2023-05-12 14:44:39 +02:00
Jacques Lucke
38416e7ad2 RNA: use correct ui scale type string in generated rna code
Previously, it printed the elements of `PropertyScaleType` as floats which does
not make sense. It also resulted in compile errors when attempting to compile
the generated code as c++ code.

Pull Request: https://projects.blender.org/blender/blender/pulls/107724
2023-05-12 13:50:06 +02:00
Jeroen Bakker
4cf7b95a15 Vulkan: Fix Compilation Issues on Windows
VKVertexAttributeObject was both defined as a class and a struct.
Settled on being a class.

Also removed an assert that is currently failing as workbench has
more attributes defined than actually used.

Pull Request: https://projects.blender.org/blender/blender/pulls/107874
2023-05-12 12:38:42 +02:00
Jeroen Bakker
7a52ad1161 Vulkan: Fix Incorrect Vertex Buffer State
After uploading the vertex buffer the state got corrupted.
Reason of this corruption is an assign-compare operation that should
just be an compare operation.

Pull Request: https://projects.blender.org/blender/blender/pulls/107875
2023-05-12 12:33:37 +02:00
cgtinker
aaf56d7aa5 Refactor: Anim, Symmetrize Armature operator
Remove some nested `if` statements to improve readablilty. My main
intention has been to improve readability and therefore making it easier
to implement changes in the future.

Seperating the symmetrize operator selection logic from the temp pointer
logic may reduces performance but it seems acceptable in this case. The
change allows focussing on the selection logic without taking care of
the temp pointers at the same time.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/106487
2023-05-12 12:13:35 +02:00
Jeroen Bakker
83a2904d1a Vulkan: IndexBuffer as Subrange
Add support for index buffers as subrange. When an index buffer
is a subrange it should bind the source buffer and use the index start
as an offset in the buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/107871
2023-05-12 12:12:43 +02:00
Jeroen Bakker
f9d094ba9e Vulkan: Initial Draw List
Dummy implementation of the VKDrawList that isn't caching the draw calls
but just execute them when they are appended to the list.

Pull Request: https://projects.blender.org/blender/blender/pulls/107873
2023-05-12 12:09:41 +02:00
YimingWu
149d364307 Fix #107863: Handles NULL pose constraint list
When the the armature doesn't have an active pose bone yet so
`ED_object_pose_constraint_list` returns NULL unhandled during
`edit_constraint_property_get`, now fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/107864
2023-05-12 10:56:53 +02:00
Campbell Barton
95a114f3ca Fix #107759: Crash when running modal operator in load_post handler
Regression in [0] which caused the window to be NULL when the load_post
handler was called. While this can be worked around using
context.temp_override, keep the previous behavior as this
change wasn't intentional.

[0]: 46be42f6b1
2023-05-12 17:23:56 +10:00
Campbell Barton
b2ebb01255 Fix crash when adding a modal operator from Python with no active window
Reported as part of #107759.
2023-05-12 16:19:24 +10:00
Chris Blackbourn
edc12436c6 UV: During packing, add progress bar and ability to cancel
Uses job system.

Co-authored-by: Campbell Barton <campbell@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/107859
2023-05-12 14:50:40 +12:00
Hans Goudey
85ddc1b0de Cleanup: Use OffsetIndices class in extrude node and merge by distance node 2023-05-11 22:15:41 -04:00
Chris Blackbourn
225d111357 UV: Rename ED_UVPACK_PIN_NORMAL to ED_UVPACK_PIN_DEFAULT 2023-05-12 11:09:27 +12:00
Chris Blackbourn
eb273143c6 Cleanup: format 2023-05-12 11:00:26 +12:00
Habib Gahbiche
7495a1dee1 Fix #98475: Full frame compositor: File Output node using EXR-Multilayer is broken
The same input (original image) was used for all layers. Now the operation correctly assigns the right input to the right output buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/107709
2023-05-11 21:01:44 +02:00
Erik Abrahamsson
36983fb5e4 Geometry Nodes: Add 'Signed Distance' input node
Adds an input node Signed Distance that can
be used to refer to the distance-grid of an SDF volume.
Right now it's experimental and can be enabled by enabling
"New Volume Nodes" in the preferences.

It returns a float AttributeFieldInput called 'distance' which
can tell Volume nodes which grid to get.

See #103248.
2023-05-11 18:25:34 +02:00
Miguel Pozo
8a9f3b2a68 Shader Nodes: Move socket defaults to node declaration
Solves the same issue that was reported in #108726.
2023-05-11 18:00:12 +02:00
Hans Goudey
2db23d38ca Fix #107826: Missing defaults for principlied volume string sockets
Caused by the dynamic declaration changes in 0de54b84c6.
The fix is to use the declaration to store the socket defaults.
2023-05-11 11:32:42 -04:00
Germano Cavalcante
5d09699d3c Cleanup: use more descriptive names for snap cursor API
Inform in the name that:
- the state is being edited
- the active state is the one used
- a state can be created and freed
2023-05-11 11:46:09 -03:00
Germano Cavalcante
b3c02cfcfd Cleanup: remove unused snap_3d functions 2023-05-11 11:43:02 -03:00
Germano Cavalcante
16228f2d71 Fix #107830: missing snap indication in measure tool
Error happened because the activated snap state was different from the
one being drawn.

So create a utility that activates the correct state.
2023-05-11 11:43:02 -03:00
Sybren A. Stüvel
64f9a30cbd Test: actually use the right matrix for unit test
No functional changes, just a test working in debug mode too ;-)
2023-05-11 16:38:17 +02:00
Ray Molenkamp
53bccfe34a CMake/Win: fftw adjust for filename changes in 3.6
Preparation for the the 3.6 library update landing.

The filenames for these libs will change a little bit and 3.6 will add
new library for the fp32 version of fftw.
2023-05-11 08:36:33 -06:00
Bastien Montagne
6f3cf1e436 LibOverride: Fix resync process no properly tagging newly used linked data as directly linked.
LibOverride resync process would not properly 'make local' newly created
overrides (copied from their linked reference). The main consequence was
that some linked data used by these new liboverrides would not be
properly tagged as directly linked.

While this would not be an issue in current codebase, this was breaking
upcomming readfile undo refactor, since some linked data did not get
their local 'placeholder reference' data written in memfile blendfiles.

NOTE: this is more of a quick fix, whole handling of library data in
complex copying cases like that need some more general work, see #107848
and #107847.
2023-05-11 15:55:57 +02:00
Kevin C. Burke
061712fcc6 Add ORIENTATION_PARENT icon
Add ORIENTATION_PARENT icon for Parent Orientation enum

The Parent orientation was introduced in 5c4b0c98d3.

Pull Request: https://projects.blender.org/blender/blender/pulls/107763
2023-05-11 14:50:15 +02:00
Sybren A. Stüvel
39ba60e88d Math: add unit test for mat3_normalized_to_quat_fast
Add a unit test for the fix in 98334b8f7d

No functional changes.
2023-05-11 14:29:48 +02:00
Jeroen Bakker
809a5aa418 Vulkan: Initial Graphics Pipeline
Initial graphic pipeline targeting. The goal of this PR is to have an initial
graphics pipeline with missing features. It should help identifying
areas that requires engineering.

Current state is that developers of the GPU module can help with the many
smaller pieces that needs to be engineered in order to get it working. It is not
intended for users or developers from other modules, but your welcome to learn
and give feedback on the code and engineering part.

We do expect that large parts of the code still needs to be re-engineered into
a more future-proof implementation.

**Some highlights**:
- In Vulkan the state is kept in the pipeline. Therefore the state is tracked
  per pipeline. In the near future this could be used as a cache. More research
  is needed against the default pipeline cache that vulkan already provides.
- This PR is based on the work that Kazashi Yoshioka already did. And include
  work from him in the next areas
  - Vertex attributes
  - Vertex data conversions
  - Pipeline state
- Immediate support working.
- This PR modifies the VKCommandBuffer to keep track of the framebuffer and its
  binding state(render pass). Some Vulkan commands require no render pass to be
  active, other require a render pass. As the order of our commands on API level
  can not be separated this PR introduces a state engine to keep track of the
  current state and desired state. This is a temporary solution, the final
  solution will be proposed when we have a pixel on the screen. At that time
  I expect that we can design a command encoder that supports all the cases
  we need.

**Notices**:
- This branch works on NVIDIA GPUs and has been validated on a Linux system. AMD
  is known not to work (stalls) and Intel GPUs have not been tested at all. Windows might work
  but hasn't been validated yet.
- The graphics pipeline is implemented with pixels in mind, not with performance. Currently
  when a draw call is scheduled it is flushed and waited until it is finished drawing, before
  other draw calls can be scheduled. We expected the performance to be worse that it actually
  is, but we expect huge performance gains in the future.
- Any advanced drawing (that is used by the image editor, compositor or 3d viewport) isn't
  implemented and might crash when used.
- Using multiple windows or resizing of window isn't supported and will stall the system.

Pull Request: https://projects.blender.org/blender/blender/pulls/106224
2023-05-11 13:01:56 +02:00
Sybren A. Stüvel
98334b8f7d Fix #107745: Matrix conversion can produce non-unit quaternion
Due to cumulative floating point errors the quaternions produced by
`mat3_normalized_to_quat_fast()` could be non-unit length. This is now
detected, and quaternions are normalised when necessary.

This is a slight roll-back of 756538b4a1,
which removed the normalisation altogether, but did introduce this issue.
2023-05-11 12:28:04 +02:00
Jeroen Bakker
8aff713270 Vulkan: Convert VertexBuffer to Contain Supported Attributes
Vulkan doesn't have a conversion from uint32_t/int32_t to float. It does
have conversions from 16/8 bits. Main reason is that Vulkan expects that
there is no benefit when converting 32 bits from one type to the other
and should be solved by passing the right data type.

In Blender however this isn't the case as there are benefits on other
GPU backends (OpenGL for example).

This PR adds helper function to check if conversion is needed and
perform any conversions in place. It also implements the function to
upload vertex buffers to the GPU.

NOTE: Test cases have been added to validate this, but they are not
able to run on the Vulkan backend just yet, because they require the
graphics pipeline to be available.

Pull Request: https://projects.blender.org/blender/blender/pulls/107733
2023-05-11 12:23:23 +02:00
Campbell Barton
d9293ca478 Fix missing include, unused argument warning 2023-05-11 17:46:23 +10:00
Campbell Barton
575c3f3b25 BLI_string: replace UTF8 skip table & macros with functions
Using a function that operates on ranges instead of the lookup table
makes BLI_strncpy_utf8 around 2.8x faster in my tests.
2023-05-11 17:35:34 +10:00