Commit Graph

99566 Commits

Author SHA1 Message Date
Damien Picard
7849857dfb I18n: extract messages related to paint curves
Two new messages are extracted:
- "New" in the context of paint curves. Used for the template_ID to
  create a new curve;
- "PaintCurve", the default name of a newly-created paint curve.

Pull Request: https://projects.blender.org/blender/blender/pulls/107888
2023-05-16 10:42:32 +02:00
Damien Picard
e268f42e02 I18n: extract a few messages
A few new messages were extracted.

- "Catalog", the default name when creating a new catalog.
- Tooltips related to drag and dropping catalogs in the asset browser.
  Some use `fmt::format()` as a possible solution to messages
  currently extracted with string concatenation as mentioned in
  #92758.

Pull Request: https://projects.blender.org/blender/blender/pulls/107710
2023-05-16 10:41:25 +02:00
Chris Blackbourn
6daa3f6b8a UV: Fix packing problem with locked-position and large island count 2023-05-16 17:19:31 +12:00
Campbell Barton
36c682c551 Cleanup: remove redundant call to mat4_to_size 2023-05-16 14:41:21 +10:00
Campbell Barton
0de1791164 Cleanup: quiet C4189 warning for MSVC 2023-05-16 14:33:02 +10:00
Campbell Barton
802af4e04b BLI_file: split BLI_rename into two functions
Include the term "overwrite" so users of this function are aware
this function will delete the destination file (unlike LIBC rename).

- Add BLI_rename_overwrite (previously called BLI_rename).
- BLI_rename is now a wrapper for rename.

Use BLI_rename when renaming in the file selector.
2023-05-16 13:15:48 +10:00
Campbell Barton
d2a3689b4a Docs: add doc-string for BLI_rename
Since this may delete the destination file,
it's important to note when that happens.

Also note why path comparison isn't used in code-comments.
2023-05-16 13:01:39 +10:00
Campbell Barton
8ab0196607 BLI_file: BLI_rename no longer checks for the destination path on WIN32
This change was made to prevent renaming files in the file selector from
deleting the file, see: #12255 & [0]. This check is no longer needed as
file selectors now checks the destination doesn't exist before renaming.

Generally, having low level file handling functions behave differently
between platforms is something to avoid with the potential of leading
to unexpected behavior.

Also unify WIN32/UNIX BLI_rename.

[0]: 41ad6f9d0a
2023-05-16 12:59:50 +10:00
Campbell Barton
8d5255d6a1 Fix BLI_rename returning success on failure for WIN32
When the `from` file didn't exist, BLI_rename returned success,
the in-line doc-string was incorrect - remove in favor of the header's
doc-string. This error existed since the initial revision.
Note that this was fixed [0] for other systems.

[0]: 622019a085
2023-05-16 11:24:49 +10:00
Campbell Barton
5d695b4f06 Fix memory leak in BLI_file_older for WIN32
Error from [0] which added UTF16 path support,
resolve using `BLI_stat` to avoid inline allocation.

[0]: f11a6d3a84
2023-05-16 11:24:14 +10:00
Chris Blackbourn
4b4babae8b UV: Improve correctness of uv packer
Minor corrections including:
* Fast packer wasn't treating locked islands correctly.
* Pointer aliasing.
* Fix and some assumptions that might not be always true.
* Improve variable names.
* Improved comments.
2023-05-16 11:00:35 +12:00
Chris Blackbourn
0b1a5dfba4 Cleanup: format 2023-05-16 10:15:56 +12:00
Damien Picard
dd32dac60f I18n: disambiguate Mix node A and B inputs
In some languages, the A and B sockets need to be disambiguated
because because they can have different letters depending on context.

In Spanish, A is used for B (Blue -> Azul), while the greek letter
alpha is used for A, to disambiguate Azul / alpha.

Pull Request: https://projects.blender.org/blender/blender/pulls/107706
2023-05-15 19:55:36 +02:00
Damien Picard
9603c38ab8 I18n: translate node assets in Add Search menu
Asset nodes got translated in the Add Node menu, but not in the Add
Search menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/107316
2023-05-15 19:00:31 +02:00
Michael Kowalski
42342124f8 USD export: option to add a root prim.
This  pull request adds a 'root_prim_path' USD export string parameter.  If this option is set to a well-formed prim path (e.g., '/World'), a transform primitive with the given path will be added to the stage as the parent of all exported primitives. This will allow transforming the scene by this root node in other applications and is also required for loading the exported scene as a reference in other USDs.

As part of this change, the '_materials' node, which contains all exported materials, is also created under the root prim.   This is required so that materials are imported correctly when the USD is referenced in another stage.

Finally, added an export_params_valid() function to verify that the 'root_prim_path' is valid before starting the export job.  This function can be extended in the future to perform additional validation of other export parameters.

This update combines work in pull request
https://projects.blender.org/blender/blender/pulls/104506
and an implementation in the 'universal-scene-description' branch.

Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/107855
2023-05-15 16:00:59 +02:00
Iliya Katueshenock
f7388e3be5 Cleanup: Move BKE_node.h to C++
See: https://projects.blender.org/blender/blender/issues/103343

Changes:
1. Added `BKE_node.hh` file. New file includes old one.
2. Functions moved to new file. Redundant `(void)`, `struct` are removed.
3. All cpp includes replaced from `.h` on `.hh`.
4. Everything in `BKE_node.hh` is on `blender::bke` namespace.
5. All implementation functions moved in namespace.
6. Function names (`BKE_node_*`) changed to `blender::bke::node_*`.
7. `eNodeSizePreset` now is a class, with renamed items.

Pull Request: https://projects.blender.org/blender/blender/pulls/107790
2023-05-15 15:14:22 +02:00
Bastien Montagne
2a8c20853c Fix LibOverride broken resync behavior in some cases after recent changes.
The issue was that in case an ID was only related to its liboverride
hierarchy through a 'to' pointer (e.g. the parent pointer of an object),
it would now be tagged as 'isolated' from its hierarchy, since nothing
in said hierarchy actually points to it. It would then be deleted during
resync process.

This is once again the infamous 'inverted dependency logic of object
parenting' case...

Note that this did not have any consequences on typical liboverride
usages (based on using a hierarchy of collections0, since all objects
would then be referenced by one or more collection.

Reported by @dr.sybren while investigating #102662.
2023-05-15 13:47:15 +02:00
Campbell Barton
98dd91f418 WM: make all blend file paths absolute & normalized on read/write
Ensure the file path G.main->filepath is always absolute and normalized.

- It was possible to call WM_OT_open_mainfile with only a filename,
  if this resolved from the CWD, Blender's internal filepath
  would not be absolute as expected.

- It was possible to open files on UNIX with an additional forward slash
  causing the blend file path it's self to contain a '//' prefix,
  this is error prone as running BLI_path_abs(..) multiple times would
  add the blend file prefix each time.

- Remove requirement for "filepath" to be an absolute path when saving.
  Instead, expand the path - making it absolute, as this constraint
  wasn't applied open opening files, prefer making save/open behave
  consistently.

- Assert when BLI_path_abs/BLI_path_rel receive a basepath that has
  a "//" (relative) prefix itself.
2023-05-15 19:58:40 +10:00
Campbell Barton
5285cd9a7b BLI_path: use native normalize (avoids // prefix on UNIX) 2023-05-15 19:58:39 +10:00
Campbell Barton
7eb55a5fa9 BLI_path: add BLI_path_normalize_native for non-blend file paths
System paths with multiple leading slashes get normalized to one slash.
2023-05-15 19:58:39 +10:00
Campbell Barton
b68a7dd7a6 Cleanup: unused argument warning 2023-05-15 19:58:39 +10:00
Sybren A. Stüvel
51c2a0f816 Fix #104606: iTaSC solver moves root bone to origin and imobilizes it
Add a new flag that determines whether root bones (i.e. bones without a
parent) should be translated to the armature object's origin. This can
be found in the Armature's IK properties panel.

By default this flag is disabled, so new rigs will not see this 'locking
to the origin' behaviour. Versioning code ensures that the flag is
enabled on older files, to preserve the behaviour of existing rigs.

This also bumps the Blender subversion and at the same time fixes an
incorrect bump in ee08b2ddff (where the
'minimum compatible version' was updated instead of the current Blender
version).

Pull request: https://projects.blender.org/blender/blender/pulls/107869
2023-05-15 10:46:26 +02:00
Philipp Oeser
b0bef8354d Fix #107906: sculpt box hide missing update with non-deform modifiers
When not drawing from PBVH (e.g. with non-deform modifiers), we have to
tag with ID_RECALC_GEOMETRY.

Pull Request: https://projects.blender.org/blender/blender/pulls/107938
2023-05-15 10:38:57 +02:00
Omar Emara
d91f0bf8d2 Realtime Compositor: Implement Convert Color Space node
This patch implements the Convert Color Space node for the realtime
compositor. A custom OCIO GpuShaderCreator was implemented to use the
ShaderCreateInfo in constructing the OCIO GPU processor shader. That
shader is then cached inside the cache manager and is invalidated when
the OCIO configuration changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/107878
2023-05-15 07:20:08 +02:00
Campbell Barton
a0c6dde5a2 Fix word selection failing when the selected word boundary wasn't space
Double-clicking between alpha-numeric & punctuation for e.g.
did nothing instead of selecting the word.

Instead of a special check for white-space, use the enum values as a
priority so alpha-numeric characters are priories above others
in a way that doesn't prevent groups of other character types
from being selected.
2023-05-15 11:04:25 +10:00
Campbell Barton
26362f283f Cleanup: pass an immutable position to BLI_str_cursor_step_bounds_*
Having some arguments be input/output and others output only was
confusing, a function that detects a range from a position
can simply calculate the range - modifying the input position isn't
needed.

Instead, note that word select puts the cursor at the end by convention.

Also use `r_` prefix for output only arguments.
2023-05-15 10:52:27 +10:00
Campbell Barton
5eee40a63e Cleanup: remove empty lines before function doc-string 2023-05-15 10:29:38 +10:00
Campbell Barton
c6f3fc5d9b Cleanup: use doxygen groups for BLI_path_util.h 2023-05-15 10:24:13 +10:00
Campbell Barton
d32fc1a3ea Cleanup: rename BLI_path_rel basename -> basepath
"basename" typically refers to the filename without any slashes
(as returned by `BLI_path_basename`), making the argument misleading.
2023-05-15 09:54:52 +10:00
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