Commit Graph

128025 Commits

Author SHA1 Message Date
Sergey Sharybin
10c5c94eaf Fix #112486: VSE: Rendering transparent frames produces errors/crashes
A mistake in some of the previous refactor which was aimed to make the
byte buffer to be stored as uint8_t. One of the array size calculation
was missing multiplication by 4 channels.

Pull Request: https://projects.blender.org/blender/blender/pulls/112508
2023-09-18 12:22:12 +02:00
c6b553d57c Anim: Add bone collections to the outliner
Add bone collections to the outliner, underneath the Armature.

This basically follows the same approach as the bone groups (which were
removed from the outliner in the previous commit).
2023-09-18 12:14:54 +02:00
d7e9497a06 Anim: remove bone groups from the outliner
Bone groups have been replaced by bone collections. The data in DNA is
there just for versioning & forward compatibility, so the UI elements are
being removed from Blender 4.0.
2023-09-18 12:14:54 +02:00
Sergey Sharybin
1b3141c06e Cleanup: Strict compiler warning in GPU code
The NDEBUG is a toggle define, and in debug builds it is not defined.

This change solves the warning
  mtl_context.mm:2282:5: warning: 'NDEBUG' is not defined, evaluates to 0 [-Wundef]

Pull Request: https://projects.blender.org/blender/blender/pulls/112504
2023-09-18 12:04:47 +02:00
Bastien Montagne
64976a396b I18N: Updated UI translations from dedicated git repo (3c637f5ed7d08b). 2023-09-18 11:10:30 +02:00
Campbell Barton
2d057c0238 Cleanup: remove unnecessary PyErr_Fetch/Restore use in bpy_rna
srna_from_self had logic to replace the exception unless there was
already an exception set. This logic isn't needed, except in some
disabled code which has been updated. If srna_from_self ran with an
exception set it would leak memory in Python 3.12.
2023-09-18 17:38:55 +10:00
Campbell Barton
688595842e Fix memory leak with collections attributes in RNA for Python 3.12
PyErr_Fetch needs to call PyErr_Restore, avoid a resource leak by
not raising an error in the first place.
2023-09-18 17:15:43 +10:00
Campbell Barton
906a5a89c4 Cleanup: remove fix for #112129 which is no longer needed
Since [0] this is no longer needed.

[0]: a8db82861809be71f501d33cfe0a3e231ce1ae4d
2023-09-18 16:06:31 +10:00
Campbell Barton
209056b0e9 Cleanup: remove error checks on return value of safe utf8 functions
The safe functions never return an error value,
so checking for it makes no sense.
2023-09-18 15:11:45 +10:00
Campbell Barton
f952e9768d Cleanup: add "_safe(..)" suffix to BLI_str_utf8_as_unicode_step
This makes it clearer other "safe" functions should be used in
combination with the resulting offsets.

Also correct doc-string which wasn't updated from the "or_error()"
version of this function.
2023-09-18 15:07:09 +10:00
Campbell Barton
ab4562738c Cleanup: add asserts, improve wmEvent::utf8_buf doc-string
- rna_Event_unicode_length would return -1 if utf8_buf wasn't a valid
  unicode sequence, while this shouldn't happen, assert and return zero
  instead of returning a bad length.
- Move comment on wmEvent::utf8_buf null termination to a doc-string.
2023-09-18 14:32:15 +10:00
Campbell Barton
8774af25d1 UI: use "safe" utf8 decoding functions for string search
The functions used to calculate the UTF8 code-points already used the
safe versions (count_utf8_code_points & BLI_str_utf8_as_unicode_step).

So it makes sense to use safe accessors elsewhere too.
2023-09-18 14:27:54 +10:00
Campbell Barton
9e788ddecf BLI_string: add BLI_str_utf8_as_unicode_safe
Similar to BLI_str_utf8_size_safe, matches logic from other safe UTF8
decoding functions.
2023-09-18 14:25:13 +10:00
Campbell Barton
ed552e9e4f Cleanup: add suffix to clarify unicode functions that return an error
There were enough cases of callers ignoring a potential the error value,
using the column width for e.g. to calculate pixel sizes, or the size in
bytes to calculate buffer offsets.

Since text fields & labels can include characters that return an error
from BLI_str_utf8_as_unicode, add the suffix to make this explicit.
2023-09-18 13:41:03 +10:00
Campbell Barton
a47f6ffa4d Cleanup: use booleans for text drawing & editing 2023-09-18 12:25:31 +10:00
Campbell Barton
b091195a8a Fix text editor cursor motion with tabs
- Moving the cursor to the beginning/end of the line didn't work
  with word-wrap enabled.
- Moving the cursor up/down without word-wrap enabled
  didn't maintain the column.

Resolve using column conversion functions with tab support.
2023-09-18 12:11:07 +10:00
Campbell Barton
66028c8c97 Fix crash converting spaces to tabs
The cursor & selection weren't updated after converting between tabs
& spaces, meaning they could be invalid (in the middle of a UTF8 byte
sequence or out of bounds).

Resolve by storing the column and restoring it afterwards.
2023-09-18 12:11:06 +10:00
Campbell Barton
ce2fa2a13e BLI_string: add BLI_str_utf8_offset_* functions that support tabs
Useful when calculating the column the cursor will be displayed in
the text editor.
2023-09-18 11:47:37 +10:00
Campbell Barton
108dad4e52 BLI_string: prevent buffer overflow for BLI_str_utf8_offset_* functions
Strings that include Latin1 encoding or corrupt UTF8 byte sequences
could read past the buffer bounds (stepping over the null terminator).

Resolve by passing in the string length.

Other changes to support non-UTF8 byte sequences:

- BLI_str_utf8_offset_{to/from}_index were accumulating
  the UTF8 offset without accounting for non-UTF8 characters
  which could cause a buffer underflow or enter an eternal loop.

- BLI_str_utf8_offset_to_index would read past the buffer bounds if the
  offset passed in if it was in the middle of a UTF8 byte sequence.
2023-09-18 11:47:34 +10:00
Campbell Barton
3eb30b048d BLI_string: add BLI_wcwidth_safe to avoid handling error values inline 2023-09-18 11:47:33 +10:00
Hans Goudey
2fac2228d0 Cycles: Use Blender headers to access geometry data, avoid copy
Since 34b44878449d67a56fd2, attributes are always made mutable when
accessed from the RNA API. This can result in unnecessary copies, which
increases memory usage and reduces performance.

Cycles is the only user of the C++ RNA API, which we'd like to remove
in the future since it doesn't really make sense in the big picture.
Hydra is now a better alternative for external render engines.

To start that change and fix the unnecessary copies, this commit
moves to use Blender headers directly for accessing attribute and
other geometry data. This also removes the few places that still had
overhead from the RNA API after the changes ([0]) in 3.6. In a simple
test with a large grid, I observed a 1.76x performance improvement,
from 1.04 to 0.59 seconds to extract the mesh data to Cycles.

[0]: https://wiki.blender.org/wiki/Reference/Release_Notes/3.6/Cycles#Performance

Pull Request: https://projects.blender.org/blender/blender/pulls/112306
2023-09-18 02:50:09 +02:00
Hans Goudey
f122193e24 Cleanup: Remove unused logic from geometry nodes operator
The "new node tree & assign to modifier" operator isn't used in the tool
context of the geometry node editor-- it doesn't have to handle it.
2023-09-17 20:09:14 -04:00
Harley Acheson
6a76696faf Cleanup: Make format
Formatting changes from Make Format
2023-09-17 11:06:16 -07:00
Jacques Lucke
e2156c6402 Cleanup: move local classes out of header
Those are not needed in other files anymore since
62e2cc0ad075e51b8354f1f1161ecd09fbc967b2.
2023-09-17 19:21:47 +02:00
Jacques Lucke
62e2cc0ad0 Geometry Nodes: refactor geometry nodes execution interface
The main goal of this refactor is to simplify how a geometry node group is executed.
Previously, there was duplicated logic that turned the lazy-function graph of a node
group into a single lazy-function. Now this is done only in one place and others can
just execute the lazy-function directly, without having to worry about the underlying graph.

Pull Request: https://projects.blender.org/blender/blender/pulls/112482
2023-09-17 19:09:45 +02:00
Harley Acheson
87fbe14cb4 BLF: Slant Angle Correction
Internal change to slant direction of artificial italics (obliquing)
to match the counter-clockwise degrees of variable font SLNT values.

Pull Request: https://projects.blender.org/blender/blender/pulls/112483
2023-09-17 18:58:37 +02:00
Alaska
88ad79c2d1 Add panels to Principled BSDF node
Add panels to the Principled BSDF node to organize
and reduce the size of the node.

Layout inspired by previous work from @LukasStockner

Pull Request: https://projects.blender.org/blender/blender/pulls/112314
2023-09-17 15:42:15 +02:00
Jacques Lucke
7bde842e98 Cleanup: improve and unify naming 2023-09-17 15:13:30 +02:00
Jacques Lucke
4db6a22c72 Functions: use array indexing instead of VectorSet in graph executor
This avoids the need to build the VectorSet and array
indexing is generally faster than a hash table lookup.
2023-09-17 14:27:01 +02:00
Jacques Lucke
2a5f3bd1cc Functions: refactor lazy-function graph interface
Goals of the refactor:
* Simplify adding (named) graph inputs and outputs.
* Add ability to refer to a graph input or output with an index.
* Get rid of the "dummy" terminology which doesn't really help.

Previously, one would add "dummy nodes" which can then serve as input
and output nodes of the graph. Now one directly adds input and outputs
using `Graph.add_input` and `Graph.add_output`. There is one interface
node that contains all inputs and another one that contains all outputs.

Being able to refer to a graph input or output with an index makes it
more efficient to implement some algorithms. E.g. one could have a
bit span for a socket that contains all the information what graph
inputs this socket depends on.

Pull Request: https://projects.blender.org/blender/blender/pulls/112474
2023-09-17 13:54:09 +02:00
Campbell Barton
342ebeac09 Fix text editor word-wrap displaying characters with an unknown width
Characters with an unknown width (control characters for  e.g.)
caused word wrap not to work properly, the text cursor was out of sync
with the displayed text.

Use BLI_str_utf8_char_width_safe which is the convention for the
text editor.
2023-09-17 21:20:28 +10:00
Campbell Barton
0add567339 Text Editor: improvements to auto-close implementation
- Restore the selection if auto-closing a selection fails.
- Simplify auto-close selection by ordering the selection.
- Call text_update_line_edited on the selection when auto-closing
  a selection to ensure formatting is recalculated for the region.
- Internal changes needed to support multi-byte auto-closing
  although this is still limited to ASCII at the moment.
2023-09-17 17:17:34 +10:00
Campbell Barton
b9124d8a85 Fix text editor auto-close potentially auto-closing non-brackets
Entering non ascii characters would truncate the code-point to char
when passing it to text_closing_character_pair_get(), which could then
match bracket values. Resolve by checking the characters are ascii.
2023-09-17 17:17:33 +10:00
Campbell Barton
0464b9fc58 Fix selecting between tab (or other control characters) in the UI
It wasn't possible to select the position between two tab characters
with the mouse cursor in the UI. Don't handle characters with an unknown
width as combining.

Follow up to [0] which changed this for cursor motion.

[0]: bc51449ff1a8f2083c5b06998f1b448f184357ea
2023-09-17 15:48:20 +10:00
Campbell Barton
5ae99270c1 Fix incorrect cast for BLF_str_offset_from_cursor_position
Casting size_t* to be used as an int* would fail on 64bit,
big-endian systems.
2023-09-17 15:39:39 +10:00
Campbell Barton
69bf9db9a4 Tests: update test for change to BLI_str_cursor_step_next_utf8
Change to handling of control characters in [0] caused tests to fail,
now the cursor no longer skips over control characters,
update test to account for this.

[0]: bc51449ff1a8f2083c5b06998f1b448f184357ea
2023-09-17 14:55:19 +10:00
Campbell Barton
1cda66b911 WM: resolve transform triggering key-maps to be rebuilt
Since [0] modal transform in the 3D viewport caused key-maps to be
rebuilt by the event system. Creating a temporary copy for
ViewOpsData_Utility flagged the key-map as outdated.

This could crash (resolved by [1] - for the most-part), but would still
rebuild the whole key-map, adding unnecessary overhead.

This would also reset the KMI_EXPANDED flag, causing transform
to hide key-map items when using Blender with the key-map editor open.

Add a function to temporarily suppress key-map updates.
While not ideal, full support for temporary key-maps that behave
differently to user key-maps is a bigger project for something
that's only needed in one place.

[0]: 017d4912b26155cc01a09f382c3545eed5ce219d
[1]: 9a0eaa2062f2ebda1381f9ab42f161b1b0f587b2
2023-09-17 13:36:25 +10:00
Campbell Barton
edc47d3d5a Cleanup: split ID property access into get/ensure functions
- Add IDP_EnsureProperties,
- Remove create_if_needed argument from IDP_GetProperties.

Split access & creation so intention reads more clearly without
looking up function arguments.
2023-09-17 12:16:40 +10:00
Campbell Barton
ad04167a7d Cleanup: avoid path copying & allocation setting the window title 2023-09-17 12:03:08 +10:00
Campbell Barton
e39940e255 Fix error from 106d2bb3120b579fdf11336baf4e1cf8669bc53b
Swapped width/height for the image size.
2023-09-17 11:32:41 +10:00
Campbell Barton
75afef1372 Cleanup: use braces for GHOST Cocoa *.mm sources 2023-09-17 09:16:09 +10:00
Campbell Barton
5b9740c913 Cleanup: use braces for sources in intern/
Omitted intern/itasc as some of these sources are from KDL:
https://www.orocos.org/kdl.html
2023-09-17 09:05:40 +10:00
Campbell Barton
e3444fd314 Cleanup: various non-functional C++ changes 2023-09-17 09:05:40 +10:00
Campbell Barton
106d2bb312 Cleanup: document ownership for uiTooltipField, add function attributes
- Document ownership.
- Make some arguments const.
- Use function style casts.
- Make width/height into a size[2].
2023-09-17 09:05:40 +10:00
Campbell Barton
c75a304b51 Cleanup: use lowercase ui prefix for enum, rename Color -> ColorID
Follow current conventions for types e.g. uiFontStyle, uiBlock etc.
Also rename UiTooltipColor to uiTooltipColorID since this isn't
storing the color.
2023-09-17 09:05:40 +10:00
Campbell Barton
7eae806dda Cleanup: format, spelling 2023-09-17 09:05:40 +10:00
Pablo Vazquez
fd6076ae3e UI: Add icons to Color Ramp context menu items
* Add icon to "Reset Color Ramp" (same used by Reset to Default Value)
* Add icon to "Flip Color Ramp" (sideways arrows, similar to invert
  vertex groups).
* Add separators after stops distribution operators, and before
  reset since they have pretty different purposes.
2023-09-17 00:31:47 +02:00
Jacques Lucke
c63f4e3085 Geometry Nodes: use separate struct for side effect nodes
This makes it easier to add another map containing side effect
nodes in #112421.

No functional changes expected.
2023-09-16 18:57:04 +02:00
Jacques Lucke
54fd33d783 Functions: support wrapping lazy-function node execute function
This is a light weight solution to passing in some extra context into
a lazy-function that is invoked by the graph executor.
The new functionality is used by #112421.
2023-09-16 18:50:54 +02:00
Jacques Lucke
93f8d55473 Function: add assert to detect invalid side effect nodes early 2023-09-16 18:44:58 +02:00