Commit Graph

2967 Commits

Author SHA1 Message Date
SensArice
1098f434b0 Geometry Nodes: Find in String node
Add a node that finds the number of times a substring occurs in a string,
and the position of the start of the first match.

See the PR description for more rational and details.

Pull Request: https://projects.blender.org/blender/blender/pulls/129270
2024-12-24 17:12:19 +01:00
Dan-Gry
f363b09e6e Fix #132120: Separate Menu Class for Adding Empty Objects
This PR adds a separate menu class for adding empty objects, rather
than using operator_menu_enum. This way the menu can be extended by
python.

Pull Request: https://projects.blender.org/blender/blender/pulls/132192
2024-12-23 22:31:33 +01:00
Hans Goudey
081b0258ef Fix #101769: Curves sculpt strength UI sidebar inconsistency
"Add" and "Delete" don't use the brush strength, don't display
it in the sidebar in those cases.
2024-12-20 15:46:18 -05:00
Pratik Borhade
2e10c5d174 Fix #102439: Missing node tools in keymap hierarchy
Select_* tool keymap was only accessed from searching, they were not
exposed in hierarchy. Now fixed, added inside "node editor" keymap
category.

Pull Request: https://projects.blender.org/blender/blender/pulls/132154
2024-12-20 12:10:58 +01:00
YimingWu
5c04893104 Fix #132117: Grease Pencil: Material slots display logic fix
Sometimes context.material.grease_pencil will be none. E.g. when adding
a material slot in some grease pencil objects. This fix modified the
`poll` function to show material slots when the active object is a
grease pencil object or an active grease pencil material is present in
the context.

Pull Request: https://projects.blender.org/blender/blender/pulls/132158
2024-12-20 11:46:34 +01:00
Richard Antalik
8ce5356522 VSE: Text editing in preview
This commit implements most features needed for simple text editing.

Active text strip can be edited in preview by pressing tab key, which
enabled text editing mode. With this mode active, outline matches text
boundary box and cursor is drawn.

Cursor can be moved with usual keys. Pressing shift starts selection.
Selection and navigation works when text is scaled or rotated. Mirrored
text is not supported in this PR. it can be done, but the text is
unreadable that way, so I kept it simple.

Multi line text is supported. Pressing return key starts new line.

Copy/paste operator uses OS copy paste buffer, so text from other apps
can be pasted.

Text is still limited to 512 characters. Text string property still
exists in side panel and is limited to single line. Individual
characters can not be styled in different way like in 3D viewport, but
the code is mostly ready for such feature.

Ref: #126547

Pull Request: https://projects.blender.org/blender/blender/pulls/127239
2024-12-19 15:56:54 +01:00
Aras Pranckevicius
974efe7d23 Refactor: move ffmpeg/video related code into one place
Previously, code related to reading/writing movie files via ffmpeg was
scattered around: some under blenkernel, some directly in generic
imbuf headers, some under intern/ffmpeg. Some of the files were named
with not exactly clear names. Some parts not directly related to movies
were including ffmpeg headers directly (rna_scene.cc).

What is in this PR:

Movie and ffmpeg related code is now under imbuf/movie:
- IMB_anim.hh: movie reading, proxy querying, various utility functions.
- IMB_movie_enums.hh: simple enum definitions,
- IMB_movie_write.hh: movie writing functions.
- intern: actual implementation and private headers.
    - ffmpeg_compat.h: various ffmpeg version difference handling
      utilities,
    - ffmpeg_swscale.hh/cc: scaling and format conversion utilities
      for ffmpeg libswscale,
    - ffmpeg_util.hh/cc: misc utilities related to ffmpeg,
    - movie_proxy_indexer.hh/cc: proxies and timecode indexing for movies,
    - movie_read.hh/cc: decoding of movies into images,
    - movie_write.cc: encoding of images into movies.
- tests: basic ffmpeg library unit tests that previously
  lived under intern/ffmpeg.

Interface changes (at C++ level, no Python API changes):
- Mostly just movie related functions that were BKE_ previously, are now IMB_.
- I did one large-ish change though, and that is to remove bMovieHandle
  struct that had pointers to several functions. Now that is
  IMB_movie_write_begin, IMB_movie_write_append, IMB_movie_write_end
  functions using a single opaque struct handle. As a result, usages
  of that in pipeline.cc and render_opengl.cc have changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132074
2024-12-19 12:34:30 +01:00
Sean Kim
3e71e6c216 Cleanup: Suppress python console warning after previous commit
Introduced in ee2f2f00bd

Without the `register` function we get the following error in the
console when running blender:

Warning! '<path_to_blender>/scripts/startup/nodeitems_builtins.py'
has no register function, this is now a requirement for registerable
scripts

Pull Request: https://projects.blender.org/blender/blender/pulls/132091
2024-12-19 00:51:45 +01:00
Sean Kim
0c1ee9eba2 Texture Paint: Add keybind for "merged" option when sampling colors
The removal of the UNDO flag to prevent adding undo steps when using the
`paint.sample_color` operator results in the "Sample Merged" option
being inaccessible to users without them adding a keymap of their own.

This commit makes the following changes:
* For Texture Paint using the default blender keymap, the Shift-Ctrl-X
  keybind is assigned to this operator with the merged option set to True
* For Texture Paint, using the industry compatible keymap, the Shift-I
  keybind is assigned to this operator with the merged option set to
  True

This parameter is only relevant for 3D Texture Painting so it is not
added to the other modes.

For all other `paint.sample_color` entries in both the keymap and in
some menus, the `merge` option is explicitly set to False.

Ref: #101144

Pull Request: https://projects.blender.org/blender/blender/pulls/132047
2024-12-18 20:30:10 +01:00
Hans Goudey
91e1031c42 Fix #132079: Python error when adding modifier on Surface object
It looks like the Mesh Sequence Cache modifier isn't supported
for this object type.
2024-12-18 13:17:27 -05:00
dupoxy
dc0032cc2a Fix #124937: Grease Pencil: Change Shear tool icon to match Blender 4.2
Update the icon of the shear tool in edit mode to match the
Grease Pencil shear icon in Blender 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/131993
2024-12-18 19:15:30 +01:00
Sean Kim
a8f1b4c462 Fix #49740: Reset Stencil Transform occasionally doesn't work
Prior to this commit, if the "Texture Mask" stencil was reset, this
would call the `brush.stencil_reset_transform` operator with the `mask`
parameter set to `True`. Subsequent clicks, even on the "Texture"
stencil "Reset Transform" button would still pass `True` to the
underlying C++ API, even though the `mask` property was left
uninitialized.

This commit sets the parameter to False explicitly to fix this bug.

Pull Request: https://projects.blender.org/blender/blender/pulls/132001
2024-12-17 17:51:08 +01:00
ernst-ellert
c4b8210c55 VSE: Add Duplicate operator for preview region
This is implemented as macro `sequencer.preview_duplicate_move`. New
macro is needed, because different transform operator is called than in
`sequencer.duplicate_move`

Duplicate operator was modified to handle overlap and to delete sound
strips after duplication.

When strip is duplicated in preview, it will be moved to nearest free
channel above original strip.

Pull Request: https://projects.blender.org/blender/blender/pulls/131529
2024-12-17 17:42:54 +01:00
Jacques Lucke
16fa437006 Nodes: update menu integration in the custom nodes Python template
The `NodeCategory` system is not used by Blender anymore for a couple years
already. Instead of using an additional abstraction layer, we now just use a
normal menu. One benefit of the `NodeCategory` system was that it could be used
to populate the search. However, the search is now directly populated from the
menu anyway.

Fixes #115746.

Pull Request: https://projects.blender.org/blender/blender/pulls/132021
2024-12-17 15:59:06 +01:00
Jacques Lucke
ee2f2f00bd Nodes: remove dead code that was used for node menus
Blender does not use this code anymore and a global search on Github
suggests that this was not used by anyone.

Pull Request: https://projects.blender.org/blender/blender/pulls/132019
2024-12-17 15:30:21 +01:00
Pratik Borhade
1debbcae1e Fix #130853: Asset shelf popup when Spacebar mapped to different actions
Similar to toolbar, when spacebar is mapped to `play`, use `shift +
spacebar` for asset-shelf popup. When spacebar mapped `toolbar`, invoke
asset shelf in paint modes. When `spacebar=search`, do not map any key
for asset-shelf popup

Co-authored-by: Julian Eisel

Pull Request: https://projects.blender.org/blender/blender/pulls/131351
2024-12-17 11:15:26 +01:00
Campbell Barton
c1951f6508 Cleanup: remove unused variables 2024-12-14 23:17:48 +11:00
Jacques Lucke
ebfbc7757b Fix #128589: allow disabling node group interface UI for custom node tree types
This adds a new `bl_use_group_interface` property that can be set on custom node
group types. By default it is `true` to avoid this being a breaking change. If
it's set to `false` some UI elements related to the built-in node group
interface are hidden.

Pull Request: https://projects.blender.org/blender/blender/pulls/131877
2024-12-14 11:51:19 +01:00
Thomas Dinges
f3e5c17283 Cleanup: Remove legacy GPENCIL code from UI python files.
Also remove unused gpencil modifier defines.

Pull Request: https://projects.blender.org/blender/blender/pulls/131879
2024-12-14 11:19:24 +01:00
Aras Pranckevicius
82f0578ca3 Compositor: always use the new CPU compositor
Part of #125968: this makes the new CPU compositor always be used.

Pull Request: https://projects.blender.org/blender/blender/pulls/131783
2024-12-12 20:17:36 +01:00
Christoph Lendenfeld
7e1db7de19 Fix #129416: Wrong Bone Selection Set used for selection
The issue was that when using a specific selection set,
the property `selection_set_index` is set to a specific index.
That index would persist to the next call of the operator
when trying to call it from the selection set list. The fix is to explicitly reset the
index to -1 when calling the operator from the list, because
that means the active selection set will be used.

Pull Request: https://projects.blender.org/blender/blender/pulls/131675
2024-12-12 11:19:55 +01:00
Hans Goudey
20c3269ac9 Fix #100324: Curves sculpt slide brush always resets with pressure
When releasing the pen the pressure would always go back to zero,
undoing the effect of the brush. To fix this, don't take pressure into
account for the strength, and don't display it in the UI. The grab brush
in mesh sculpt mode works the same way.

Pull Request: https://projects.blender.org/blender/blender/pulls/131744
2024-12-11 16:43:15 +01:00
Campbell Barton
a7bc3e3418 Cleanup: quiet Python linter warnings 2024-12-11 11:26:24 +11:00
Campbell Barton
560b6e2831 Cleanup: spelling (make check_spelling_*) 2024-12-11 11:23:51 +11:00
Falk David
612be514c6 Grease Pencil: Add lasso/box erase operators in draw mode
In Blender 4.2 in Grease Pencil draw mode it was possible to
erase strokes using box and lasso gestures.

Under the hood, these were just using the selection operators
that had special deletion handling if the object was in draw mode.

Rather than hacking this into the selection operations, this adds
two new operators:
* `grease_pencil.erase_lasso`
* `grease_pencil.erase_box`

When using one of the erase operations with auto-key, the previous
keyframe will be duplicated to the current frame (for the drawings
that are affected by the eraser).

They are mapped to the same shortcuts than the selection
operators in Blender 4.2.
* Lasso erase: `Ctrl`+`Alt`+`RMB`.
* Box erase: `B`.

This is part of #130518.

Pull Request: https://projects.blender.org/blender/blender/pulls/131504
2024-12-10 11:50:05 +01:00
Campbell Barton
cd1f3857f0 Fix unhandled exception in the shading options
Account for shading.selected_studio_light being None.
2024-12-10 16:15:24 +11:00
Bastien Montagne
9f9500f0f2 Fix part of #116579: I18N tools: Do not extract UI messages of unregistered operators.
Operators keep being a pain... This time, the fact that unregistered
operators are not removed from `bpyt.type.Operator` subclasses list
breaks workflow to generate translations info for a specific add-on
(since it relies on differences between UI messages extracted when this
add-on is enabled, and when it is disabled).
2024-12-09 16:05:52 +01:00
Pratik Borhade
03b2fc744e Grease Pencil: Add layer channel color property
This adds a `channel_color` property to layers.
The color is stored in the tree nodes.
It's currently used by the dopesheet for the channel colors.

Resolves #130370.

Pull Request: https://projects.blender.org/blender/blender/pulls/130512
2024-12-09 14:11:29 +01:00
Pratik Borhade
186804eabc Fix #118298: "Strips" in "Duplicate Strips" is redundant
For consistency, just use "Duplicate" for operator text in menu
since the Menu itself is about "strips".

Pull Request: https://projects.blender.org/blender/blender/pulls/131484
2024-12-09 11:33:24 +01:00
Sean
46cd7afcda Grease Pencil: "Set Start Point" operator
Adds back the operator to change the start point on cyclical strokes.
Behaves the same way as in 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/128540
2024-12-09 11:04:16 +01:00
Campbell Barton
48a3c53188 Cleanup: redundant imports, redundant "global" declaration 2024-12-09 11:50:37 +11:00
Pratik Borhade
50d67099fb Fix #118263: VSE: Expose remove all gaps in UI
Add `gap_remove` operator with `all` property true in `Strips >
Transform` menu

Pull Request: https://projects.blender.org/blender/blender/pulls/131485
2024-12-07 10:22:30 +01:00
Philipp Oeser
f32170aabb FBX export: always write edge crease (even if no subd modifier present)
This has come up a couple of times and it seems better to change the
implementation from blender/blender-addons@f1dd37b8ac [which only
exported edge creases when a subd modifier with enabled `Use Creases`
option was present] in a way that these are always exported (if present).

Also took the liberty to rename the variable name for the layer to
correspond to "crease".

Thx @mont29 for handholding on this one!

Fixes #131284

Pull Request: https://projects.blender.org/blender/blender/pulls/131419
2024-12-06 18:20:19 +01:00
Campbell Barton
38a76db083 UI: remove redundant undo pushes for menu operators
Operators that trigger menus should not enable UNDO.

Resolves #95906

Ref !131467
2024-12-07 00:41:36 +11:00
Falk David
c1a021b0e8 Fix #130651: Tint tool does not show correct color in header
The issue was that the UI code still used the unified paint settings.
It was decided that in `PAINT_GREASE_PENCIL` mode we don't use
the unified paint settings and always use the settings on the brush.

The fix uses the `brush` as the owner of the `color` property instead
of the unified paint settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/131452
2024-12-06 10:38:57 +01:00
Alaska
fe30aee7e7 Vulkan: Unhide from behind developer extras
The GPU backend selection menu, used to select the Vulkan backend, was
hidden behind the Developer Extras user interface option in 4.3 as
Vulkan wasn't ready for wide spread testing due to multiple
major issues.

The majority of the major issues have been fixed, and Vulkan should
safer to use.

To help encourage Vulkan testing throughout Blender 4.4's development,
this commit unhides the Vulkan backend from behind the developer extras
option.

Pull Request: https://projects.blender.org/blender/blender/pulls/131231
2024-12-05 16:15:59 +01:00
Jonas Holzman
d22ea1d80b UI: PreferenceThemeSpacePanel internal cleanup
This commit removes the deprecated `ui_delimiters` variables and
logic from `PreferenceThemeSpacePanel` which are leftovers from
the old 2.79 Preferences layout.

See: https://archive.blender.org/developer/D4148 (Preferences Redesign)

Pull Request: https://projects.blender.org/blender/blender/pulls/131390
2024-12-05 15:47:41 +01:00
Christoph Lendenfeld
839f9ba948 Fix #130053: ALT+H in weight paint not unhiding bones
When in bone selection mode of during weight painting,
pressing ALT+H would unhide faces instead of bones.
Removing the keymap entry fixes that, while still allowing
unhiding of faces in face mask mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/131104
2024-12-05 12:29:36 +01:00
Aras Pranckevicius
1148df0f5c Fix #99026: VSE View menu wrongly displays Channels item for combined Sequencer & Preview type
Channels can not be shown in Sequencer & Preview type by design,
so do not show the view menu item for it.

Pull Request: https://projects.blender.org/blender/blender/pulls/131368
2024-12-05 09:20:15 +01:00
quackarooni
65b1ab43bf Geometry Nodes: Add "Collection" and "Object" input nodes
Pull Request: https://projects.blender.org/blender/blender/pulls/131075
2024-12-04 15:01:44 +01:00
Butterscotch!
e2ff0a45aa Fix BVH import bone tail calculation with multiple children
When importing a BVH file with a parent node that has more than one
child that have offsets within `0.001 * global_scale` of the parent
node, the length of the parent node is considered to be zero.

For example: A parent node with `OFFSET 0 -0.1077 0`, two children with
`OFFSET 0 -0.1074 0`, and a global scale of `1.0`, the parent node's
length would be considered zero, therefore adding `global_scale / 10`
(`0.1` in this case) to the y component of the offset. The resulting
tail offset would then be `OFFSET 0 -0.0077 0`.

Ref !105492
2024-12-03 23:30:10 +11:00
Campbell Barton
6ca1417103 Cleanup: suppress unused Python warnings
Suppress unused warnings using the "vulture" utility.

- Include public definitions in the modules `__all__`.
- Mark arguments & variables as unused with a "_" prefix.
2024-12-03 12:54:13 +11:00
Clément Foucault
3d9ffa5085 Overlay: Remove legacy option and legacy code
This simply removes the old overlay engine.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/131155
2024-12-02 19:47:55 +01:00
Nathan Vegdahl
aa83738d44 Anim: change parameters of slots.new() RNA function
`Action.slots.new()` in the Python API previously took either an ID or nothing
as a parameter. In the former case it would create a slot with the appropriate
`id_root` and name for that ID. In the latter case it would create a default
slot with an unspecified `id_root` and default name.

This had several issues:

1. You couldn't create a slot with a specific `id_root` without already having
   an ID of that type. In theory this isn't a problem, but in practice in larger
   scripts/addons you don't necessarily have such an ID on hand at the call
   site.
2. You couldn't directly create a slot with a desired name without an existing
   ID with that name. This isn't so important, since you can always just set the
   name afterwards. But it's a bit annoying.
3. Most other `new()` APIs in Blender *require* you to specify the name of the
   item being created. So calling this with no parameters was violating that
   norm.
4. Ideally, we want to eliminate unspecified `id_root`s, since they cause other
   weirdness in the API such as slot identifiers changing upon slot assignment.

To resolve these issues, and just generally to make the API more
straightforward, this PR changes `slots.new()` to take two required parameters:
an ID type and a name. For example:

`slots.new(id_type='CAMERA', name="My Camera Data Slot")`.

This fully specifies everything needed for the slot identifier upon creation,
and doesn't require any outside data items to create a slot with the desired
type and name.

In the future if we decide we still want a `for_id`-style slot creation API, we
can reintroduce it as a separate function.

Ref: #130892
Pull Request: https://projects.blender.org/blender/blender/pulls/130970
2024-12-02 17:04:37 +01:00
Julien Duroure
faaa12a101 glTF: Install Draco lib in the same directory as the glTF2 addon
This changes the location of the Draco library installation path.
The new location is at the root of addons_core/io_scene_gltf2 addon, as the library is created for this addon only.

This will solve issues where the gltf addon couldn't find the library in case of global python installation or custom script/lib paths

Pull Request: https://projects.blender.org/blender/blender/pulls/131080
2024-12-02 12:50:15 +01:00
Thomas Barlow
8ed98d592e Fix #127765: FBX Export: Incorrect materials with Geometry Nodes
Geometry Nodes can change the materials of the Object, for Mesh Objects,
the new materials are present in the evaluated Object, but for non-Mesh
Objects, the new materials may not be present until the evaluated Object
has been converted to a Mesh.

This patch fixes the materials in FBX export, with Apply Modifiers
enabled, of non-Mesh types with Geometry Nodes that change materials.
Rather than getting the materials from the evaluated Object, the
materials are now retrieved from the Mesh created from the evaluated
Object.

To support object-linked material slots, the materials on the new Mesh
are replaced at the same indices as the object-linked material slots.

Pull Request: https://projects.blender.org/blender/blender/pulls/130485
2024-12-02 10:44:00 +01:00
Thomas Barlow
d0d4fc45b3 Fix #123088: Workaround for Unity FBX import per-vertex normals issue
The FBX SDK specifies that normals should use the IndexToDirect FBX
reference mode. This mode allows data written to FBX to be deduplicated
by writing a separate array of indices into the deduplicated array of
data that can be used to reconstruct the full array of data.

When Unity imports per-vertex normals with the IndexToDirect reference
mode, it erroneously considers the imported mesh's normals invalid if
any of its normals were deduplicated. This issue is not present in other
external software that I have tested.

This patch modifies the export of per-vertex normals to not perform any
deduplication, avoiding the issue in Unity's FBX importer while
maintaining use of the IndexToDirect reference mode.

The add-on's patch version has been increased.

Pull Request: https://projects.blender.org/blender/blender/pulls/123186
2024-12-02 10:40:21 +01:00
YimingWu
5370ab3248 Fix: Attribute lookup cleanup in properties_constraint.py
The match/case clean up in 2c0d2a88ca was
applied on the wrong function. This fix includes the cleanup for the
intended function.

Pull Request: https://projects.blender.org/blender/blender/pulls/131202
2024-12-02 07:44:37 +01:00
Campbell Barton
056f748e04 Cleanup: replace redundant functions with os.path.lexists 2024-12-02 12:52:21 +11:00
Campbell Barton
d63dc070ef Fix error enabling extensions with an empty wheel list
Regression in [0] caused extensions with an empty wheel list
to raise an unhandled exception when extracting the Python
version from the wheel list.

Besides resolving this error, account for errors using the wheel
list since it isn't type checked in this code-path.

[0]: cfc10b0232565642afbfdc5a867f027640ce8274
2024-12-02 12:34:31 +11:00