Commit Graph

99537 Commits

Author SHA1 Message Date
Campbell Barton
fcca4298ef Cleanup: improve doc-string & naming for internal frame-range extraction 2023-05-15 09:54:52 +10:00
Campbell Barton
1715f1c1f4 Fix potential buffer overflows from incorrect strcpy use
BLI_path_sequence_decode & BLI_path_filename_ensure ignored maximum
buffer size arguments.
2023-05-15 09:54:51 +10:00
Campbell Barton
ab2dfc842a BLI_path: include FILE_MAX in BLI_path_{abs,rel} function signatures
These are now the only two BLI_path functions which assume paths are
FILE_MAX size which makes sense as they're using the `//` file prefix.
Something that's specific to file paths stored in DNA.

Use FILE_MAX in the function signature as a form of documentation.
2023-05-15 09:53:40 +10:00
Campbell Barton
e225a53e54 BLI_path: use PATH_MAX instead of FILE_MAX for system paths
FILE_MAX is used mainly for blend-file paths, avoid using this
when paths may be system-paths.
2023-05-15 09:53:40 +10:00
Campbell Barton
fd71bb7844 BLI_path: remove FILE_MAX size limit for BLI_path_cmp_normalized
Allocate larger paths if necessary, as this may be used for system
paths where the blend-file size limit isn't implied.
2023-05-15 09:53:40 +10:00
Campbell Barton
13a3dfd788 BLI_path: remove FILE_MAX limit on BLI_path_frame{_range} functions
- Use BLI_str_replace_range to avoid a temporary string copy.
- Also add a buffer size argument to BLI_path_frame_range.
2023-05-15 09:09:08 +10:00
Campbell Barton
1d371706cf BLI_string: add BLI_str_replace_range for replacing a range
Add a convenient way to replace a range of text in the middle of a
string that make shrink or grow the string that handles corner cases
and keeps the string null terminated.
2023-05-15 09:08:59 +10:00
Harley Acheson
1ad4f67d78 BLI: New functions specifically for word/sequence selection
Double-clicking to select words/sequences now using the same functions
specifically for this task, rather than boundary-seeking functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/107927
2023-05-14 21:50:53 +02:00
Joseph Eagar
f62add82ab Sculpt: Fix #105326: Fill brush function invert(ctrl) only works one way
Problem was the use or OR instead of XOR.

Note: I decided to use an if statement with the !
operator instead of XOR for code clarity.
2023-05-14 09:44:08 -07:00
Joseph Eagar
eb15da661e Sculpt: Fix #106895: Brush textures broken for round brushes 2023-05-14 09:32:25 -07:00
Damien Picard
d17f9f4872 UI: Capitalize "Python" in UI messages, improve a few others
- "... (matches pythons ...)": capitalize and use possessive ('s).
- "Layer Proxy Protection": replace proxy by override, following 2.80.
- "Enable Plane Trim": expand description.
- "Make curve path children to rotate along the path": remove "to".
- "Option for curve-deform: make deformed child to stretch along
  entire path": remove "to".
- "... apply the curve radius with path following it and deforming":
  rephrase unclear description.
- "Custom light falloff curve" : unrelated to lights, used in Grease
  Pencil modifiers.
- "Grease Pencil layer assigned to the generated strokes": rephrase
  because a GP stroke is assigned to a layer, not the other way
  around.
- "Attribute domain where the attribute domain is stored in the
  simulation state": remove second "domain" (typo).

Pull Request: https://projects.blender.org/blender/blender/pulls/107916
2023-05-14 15:23:43 +02:00
Chris Blackbourn
018f3dbf85 Cleanup: format 2023-05-14 11:11:51 +12:00
Chris Blackbourn
f44795ce17 Fix #107898: UV packer regression
Layouts with >1024 rectangle islands would leave empty UV space.

Regression from ccb2dbddac.
2023-05-14 11:07:24 +12:00
Daniel Salazar
69d6210e38 UI: Improve description for shapekey pin
New tooltip provides more useful information.
2023-05-13 15:24:43 -06:00
Bastien Montagne
eac620f7bf Cleanup in readfile code area.
Mostly some minor renaming of parameters and variables, adding a few
comments...

The only actual behavior change is a more correct handling of the
`LIB_TAG_KEEP_ON_UNDO` on ID tag. This should not have any consequences
in current code though.

So no actual change in behavior is expected from this commit.
2023-05-13 19:45:29 +02:00
Bastien Montagne
2117af10ab Cleanup: Clear non-ID pointers in Outliner tree's readfile code.
Not really critical, but cleaner, and should ensure a hard crash in case
these (assumed invalid) pointers get ever accessed.
2023-05-13 19:35:17 +02:00
Bastien Montagne
b960a4fdb8 Fix (unreported) BKE_main_id_refcount_recompute wrong handling of some ID types.
Scene, WindowManager and Workspace types of IDs should always have a
'virtual' user, to ensure they are always written to file.
2023-05-13 19:26:02 +02:00
Bastien Montagne
5a2f159ba4 Cleanup: Minor fixes to comments and CLOG reports. 2023-05-13 19:24:41 +02:00
Antonio Vazquez
a23275a6ea Fix #107810: SVG exported line thickness wrong
Due a limitation in the precission of the thickness
calculation, the result could be wrong.

As the code tried to use the real thickness, in some
cases this was wrong.

Related to old fix for #103061

Pull Request: https://projects.blender.org/blender/blender/pulls/107835
2023-05-13 16:11:40 +02:00
Campbell Barton
79f4405039 RNA: correct BLI_strncpy buffer size argument 2023-05-13 17:55:02 +10:00
Campbell Barton
bfeb687cb4 Remove use of FILENAME_MAX
GCC documented FILENAME_MAX is the maximum length of a file that can
be opened, not to be used for allocation as it may be INT_MAX for e.g.

Even though this wasn't the case on supported systems,
prefer FILE_MAX which is used for full paths in most places.
2023-05-13 17:54:16 +10:00
Campbell Barton
169dd2a2b4 Use UTF8 copy function to ensure valid UTF8 output 2023-05-13 17:38:48 +10:00
Campbell Barton
4e85d17000 Cleanup: use native path separator 2023-05-13 17:38:46 +10:00
Campbell Barton
a534e05476 Cleanup: use dirpath & filename for directories and file names
Use `filename` instead of `names`, `dirpath` instead of `dir`.
2023-05-13 17:34:29 +10:00
Campbell Barton
557344b64c Cleanup: correct UTF8 code-commets, remove imbdds reference 2023-05-13 17:34:25 +10:00
Campbell Barton
e89939ca26 Cleanup: reserve the term 'len' for string length 2023-05-13 17:34:23 +10:00
Campbell Barton
b1a426eac7 Cleanup: use string copy & printf macros 2023-05-13 17:34:21 +10:00
Campbell Barton
302137b14b 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-13 17:34:19 +10:00
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