Commit Graph

91 Commits

Author SHA1 Message Date
Campbell Barton
786734e6c8 Fix #106057: setting the sculpt curve brush in Python clears active tool
The built-in brush identifier didn't match the enum name causing
brush assignment not to update the tool-system (clearing the tool).

Resolve by using generate_from_enum_ex(..) to avoid each brush
definition having to manually duplicate enum definitions.
2023-04-14 20:14:06 +10:00
Campbell Barton
10b7d4f601 WM: support separators when generating tools from enums & icon map
Currently this is disabled for sculpt, we may want to enable this in the
future. Also add an icon map argument for brushes to use generic icons.
2023-04-14 20:14:06 +10:00
Campbell Barton
40683e524c Cleanup: remove unused argument for tool-systems generate_from_enum_ex
Also avoid using a dict as a default argument. While it didn't cause
problems - in general it's bad practice and worth avoiding as any
modifications produce strange behavior.
2023-04-14 20:14:06 +10:00
Harley Acheson
39bcf6bdc9 UI: Allow Clipboard Copy/Paste Images
Adds operators to copy and paste to and from the OS clipboard, but only
implemented for Windows.

Pull Request: https://projects.blender.org/blender/blender/pulls/105833
2023-04-14 03:48:17 +02:00
Pablo Vazquez
cef128e68a Fix menu padding in Console editor header
The View menu was a few pixels to the right compared to all other editors.
2023-04-13 18:06:12 +02:00
Campbell Barton
a7462f58d1 Fix missing import for DJV on APPLE
We might removing support for this if it's not used,
correct the import for now.
2023-04-13 13:14:17 +10:00
Campbell Barton
11ad851fbe Fix lightmap UV calculation ignoring unselected objects in edit-mode 2023-04-13 13:14:15 +10:00
Campbell Barton
ad5ec544c8 Cleanup: remove unused apply-image option from uvcalc_lightmap
Note that this was a quick update from Blender 2.4's API,
while many other improvements could be made - remove this option as
it does nothing.
2023-04-13 13:14:13 +10:00
Campbell Barton
678dc456e3 Cleanup: remove duplicate class
Introduced in ba982119cdcacfa8e603457face1d8ebc763ef75.
2023-04-13 13:14:09 +10:00
Campbell Barton
14905cd1d5 Cleanup: quiet pylint's inconsistent-return-statements warning
No functional changes as the return value either relied on None
evaluating to False or wasn't used.
2023-04-13 13:14:06 +10:00
Campbell Barton
6482f9fffe Cleanup: quiet various pylint warnings 2023-04-13 13:14:05 +10:00
Campbell Barton
84e72e8170 Cleanup: remove duplicate assignments, assign 'layout' early in draw(..)
Also remove unused assignments.
2023-04-13 13:14:03 +10:00
Campbell Barton
ab64bd264a Cleanup: consistent naming for tool_settings & operator properties
Use names:
- `tool_settings` instead of `ts`.

- `props` instead of `op` / `prop` / `op_props`
  As Python may reference operators, don't confuse the operator
  properties with an instance of the operator.

In both cases these names were already used for most scripts.
2023-04-13 13:14:01 +10:00
Campbell Barton
b0edd63752 Cleanup: avoid early imports, remove unused variable 2023-04-13 13:13:59 +10:00
Damien Picard
2b6c1600cf UI: Allow Float Kerning for Text Objects
Change Text Object character `kern` member to float from int, and allow
fractional changes to kerning with Shift-Alt-arrows.

Pull Request: https://projects.blender.org/blender/blender/pulls/105181
2023-04-12 19:11:53 +02:00
Damien Picard
2771f53cb7 UI: Fix disconnected and non-clickable checkbox labels in popovers
For popovers, draw the checkbox in header as usual with label, but
hide the panel header label, see ed870f87b942.

Patch by Yevgeny Makarov (@jenkm) in
https://archive.blender.org/developer/D9586

Co-authored-by: Yevgeny Makarov <jenkm>
Pull Request: https://projects.blender.org/blender/blender/pulls/105657
2023-04-12 17:00:51 +02:00
Damien Picard
5cf365554b I18n: disambiguate a few messages
- "Lens" can be a transparent object used in cameras, or specifically
  its property of focal length
- "Empty" can be an adjective meaning void, or an object type. The
  latter is already disambiguated using `ID_ID`
- "New" and "Old" are adjectives that can have agreements in some
  languages
- "Modified" is an adjective that can have agreement in some languages
- "Clipping" can be a property of a camera, or a behavior of the
  mirror modifier
- "Value" in HSV nodes, see #105113
- "Area" in the Face Area geometry node, can mean a measurement or a
  window type
- "New" is an adjective that can have agreement
- "Tab" can be a UI element or a whitespace character
- "Volume" can mean a measurement or an object type. The latter is
  already disambiguated using `ID_ID`

These changes introduce the new `BLT_I18NCONTEXT_TIME` translation
context.

They also remove `BLT_I18NCONTEXT_VIRTUAL_REALITY`, which I added at
one point but then couldn't find which messages I wanted to fix with
it.

Ref #43295

Pull Request: #106718
2023-04-12 15:09:17 +02:00
Hans Goudey
c31434a570 Cleanup: Remove setting polygon loop total from Python
This property is not editable after 7966cd16d6dc4e66d01f,
though doing so didn't seem to give an error. It doesn't have
to be set anymore, since the data is redundant with the
"loop_start" anyway.
2023-04-12 08:38:32 -04:00
Julian Eisel
da75495ada Fix user add-ons not showing up with "User" filter in Preferences
Mistake in ba25023d22, updated the drawing code with the wrong function
call. So when setting the add-ons category to "User", add-ons installed
in the user paths (custom paths configured in Preferences) wouldn't show
up.
2023-04-12 13:04:54 +02:00
Damien Picard
3f4f975228 I18n: fix footer in the text editor when loading an external file
When loading an external file in the text editor, the footer text
stating "File: <file>" or "File: <file> (unsaved)" was not translated,
because the translation happened after string formatting, and the
message was thus not found in the po files.

Pull Request: https://projects.blender.org/blender/blender/pulls/106716
2023-04-12 12:19:00 +02:00
zanqdo
5df8e35da7 UI: Add slash separators to Hue/Saturation/Value
It was that names of related "combo" operations
like Hue/Saturation/Value, *Dilate/Erode*
and Brightness/Contrast should be separated
by slashes in their names.

This patch changes this for the multiple nodes
and operators concerning Hue/Saturation/Value
across Blender.

Note1: This patch should only touch UI names
which do not need versioning and should not
break scripts.

Note2: This breaks first letter fuzzy search
for "hsv". It was noted by @HooglyBoogly that
the "/" character needs to be added to the
fuzzy search split list. Note however that such
search is already broken in Main for nodes like
Brightness/Contrast and Dilate/Erode which
already use slash separators

Pull Request: https://projects.blender.org/blender/blender/pulls/106721
2023-04-11 23:48:05 +02:00
zanqdo
f8108d6dfd UI: Rename Bright/Contrast to Brightness/Contrast
Rename *Bright/Contrast* to *Brightness/Contrast* in order to avoid the use of shortened names and improve consistency within Blender and with industry conventions.

Reasoning:

The modified color characteristic is called *brightness*, not *bright*. You don't modify the *bright* of an image.

This also interferes with search in case someone searches for brightness, producing no results.

*Note: This patch should only touch UI names which do not need versioning. It leaves the actual property name in nodes for a future breaking release.*

Pull Request: https://projects.blender.org/blender/blender/pulls/104998
2023-04-11 21:32:29 +02:00
Hans Goudey
c7995f3185 Fix #106366: Handle exceptions in add fur operator
Give errors in a few cases:
- The mesh has no UV map
- The faces have no area
- The applied modifier has no curve data (it may have been modified)

Use errors instead of cancelling the operator completely so the
operator can still do something useful when many meshes are
selected and only some fail.

Pull Request: https://projects.blender.org/blender/blender/pulls/106823
2023-04-11 19:19:41 +02:00
Julian Eisel
ba25023d22 Python: Support multiple custom script directories in Preferences
Makes it possible to select multiple custom script directories in Preferences >
File Paths, replacing the single Scripts path option. Each of these directories
supports the regular script directory layout with a startup file (or files?),
add-ons, modules and presets.
When installing an add-on, the script directory can be chosen.

NOTE: Deprecates the `bpy.types.PreferencesFilePaths.script_directory`
property, and replaces `bpy.utils.script_path_pref` with
`bpy.utils.script_paths_pref`.

Pull Request: https://projects.blender.org/blender/blender/pulls/104876
2023-04-11 15:20:52 +02:00
Martijn Versteegh
4ab7bb5b1f Fix : Show 'Exit group' menu entry also for non group nodes.
The Exit Group menu entry was mistakenly only whown for nodes who are
themselves also group nodes. It should be show for any node inside a
group.

Pull Request: https://projects.blender.org/blender/blender/pulls/106643
2023-04-07 13:09:33 +02:00
d85520f297 Python: bl_ui_utils.layout.operator_context context manager
Introduce a context manager that temporarily overrides a UILayout's
operator context.

Instead of writing this:

```py
default_op_context = layout.context
layout.context = 'OTHER_VALUE'
layout.do_stuff()
layout.context = default_op_context
```

you can now write this:

```py
from bl_ui_utils.layout import operator_context

with operator_context(layout, 'OTHER_VALUE'):
    layout.do_stuff()
```

This is also exception-safe; it will always ensure the layout's operator
context is restored when the `with` body is exited, regardless of
whether that's done with an exception or regularly.

Idea in-the-hallway approved by @Sergey.
2023-04-07 11:34:48 +02:00
Harley Acheson
14b112ef82 Fix #106422: Mesh Data Attributes Using tip_ for iface_
pgettext_tip incorrectly imported as iface_ instead of importing
pgettext_iface. These leads to incorrectly translated attribute text
shown when the user elects to translate only tooltips.

Pull Request: https://projects.blender.org/blender/blender/pulls/106507
2023-04-03 20:55:22 +02:00
Hans Goudey
e7f395dd20 Nodes: Add dropdown to select group socket subtype
Previously the only way to control the subtype was to remove the group
input or output and create it again. This commit adds a dropdown to
change an existing socket, for supported socket types.

Based on a patch by Angus Stanton: https://developer.blender.org/D15715

It was necessary to fix the UI code slightly; the layout's context
wasn't being used in calls to an operator's enum items callback.

Pull Request: https://projects.blender.org/blender/blender/pulls/105614
2023-04-03 18:23:30 +02:00
YimingWu
dc63f75837 Fix #106414: Handle mat==None case in GPencil Change Active Material operator
Some material slots could be empty, the operator could encounter a python
exception. Now fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/106418
2023-04-02 17:08:50 +02:00
Germano Cavalcante
6778460e53 Fix #106323: Snap to Face Nearest not working
Face Nearest only works with individual projection, so always set the
`SCE_SNAP_PROJECT` flag in this case.

Also gray out the `Project Individual Elements` option in the UI if
`Face Nearest` is enabled.

And change the description to indicate that `Project Individual Elements`
is always enabled with the `Face Nearest` option.

(I feel a better design for this option needs to be considered).
2023-03-31 17:30:26 -03:00
Christoph Lendenfeld
0187943a3d Animation: Weight Paint select more/less for faces
This adds the select more/less operators to the weight paint mode face selection.

Just like in edit mode, press `CTRL`+`Numpad Plus/Minus` to use them.
They have also been added to the `Select` menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/105607
2023-03-31 14:53:00 +02:00
Christoph Lendenfeld
0d1a0cb453 Animation: Weight Paint select more/less for vertices
This adds the select more/less operators to the weight paint mode vertex selection.

Just like in edit mode, press CTRL+Numpad Plus/Minus to use them.
They have also been added to the Select menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/105633
2023-03-31 14:47:57 +02:00
Thomas Dinges
1987cbb12a Merge branch 'blender-v3.5-release' 2023-03-28 13:41:43 +02:00
Jacques Lucke
57712d7b18 Fix #106177: modal operator does not work from Node menu
This was an issue with the `operator_context`. It's a bit confusing because it
looks like every `uiLayout` has its own, but in `uiLayoutSetOperatorContext`
you can see that the `operator_context` is always set on the root layout for
some reason.

The fix is to set `INVOKE_REGION_WIN` as the operator context after it has been
set to something else (I found this to be the default by printing the operator
context before it was changed).

Pull Request: https://projects.blender.org/blender/blender/pulls/106213
2023-03-28 13:13:30 +02:00
Hans Goudey
de5ec852f3 Merge branch 'blender-v3.5-release' 2023-03-27 14:52:51 -04:00
Hans Goudey
ba4442ef41 Fix #105965: Add fur modifier properties missing UI data
Currently assigning values to IDProperties clears their UI data.
That is fixed by #106161, but that is too risky for 3.5. Instead,
work around the issue by triggering `MOD_nodes_update_interface`
function which recreates the UI data of the modifier properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/106190
2023-03-27 20:51:35 +02:00
Christoph Lendenfeld
5d5027db03 Animation: Gaussian Smooth operator for Graph Editor
Add a Gaussian smoothing operator to supersede the current
smoothing operator in the graph editor.

Advantage over the current implementation:
* Supports modal operations
* Is independent of key density
* More options in the redo panel
* More predictable Impulse Response

Option in the redo panel to change

Filter Width: How far out on each side of a key the code checks
to average key values

Sigma: The shape of the bell curve, lower values make a sharper bell curve
reducing the smoothing effect.
Too High values will make the code behave like an average filter as the
curve in the -1/1 range will almost be flat.

On a technical note, the operator needs to store additional data when running in modal
to avoid allocating/deallocating data on every modal run.
For that reason the `tGraphSliderOp` struct has been extended with
`void *operator_data` and `void (*free_operator_data)(void *operator_data)`.
The former is the data and the latter is a function responsible for freeing that data.

Pull Request: https://projects.blender.org/blender/blender/pulls/105635
2023-03-24 12:11:20 +01:00
Christoph Lendenfeld
84e170c563 Animation: Add duration display to frame range settings
This patch adds an option to the Status Bar: `Scene Duration`

This shows the duration of the current scene in frames and timecode
`Duration: <timecode> (Frame <current frame>/<total frames>)`
The timecode follows the formatting defined in the user preferences.

Pull Request: https://projects.blender.org/blender/blender/pulls/104882
2023-03-23 10:18:38 +01:00
Campbell Barton
846ed20ad6 Cleanup: remove unused argument signified from used arguments in Python
Also simplify import for `_bpy._utils_previews`.
2023-03-23 15:31:14 +11:00
45c1deac4f Bone relation lines: optionally draw between bone heads
Add control over how bone relation lines are drawn. Instead of always
drawing from the head of the child to the tail of the parent, give users
a choice for the parent side of the line. This can now be toggled
between the head and the tail of the bone, where the tail is Blender's
original behaviour and is retained as default value.

Pull request: https://projects.blender.org/blender/blender/pulls/105427
2023-03-21 15:16:13 +01:00
Erik Abrahamsson
4b30b5c57f Nodes: SDF Volume nodes milestone 1
Geometry Nodes: SDF Volume nodes milestone 1

Adds initial support for SDF volume creation and manipulation.
`SDF volume` is Blender's name of an OpenVDB grid of type Level Set.
See the discussion about naming in #91668.

The new nodes are:
- Mesh to SDF Volume: Converts a mesh to an SDF Volume
- Points to SDF Volume: Converts points to an SDF Volume
- Mean Filter SDF Volume: Applies a Mean Filter to an SDF
- Offset SDF Volume: Applies an offset to an SDF
- SDF Volume Sphere: Creates an SDF Volume in the shape of a sphere

For now an experimental option `New Volume Nodes` needs to be
enabled in Blender preferences for the nodes to be visible.

See the current work plan for Volume Nodes in #103248.

Pull Request: https://projects.blender.org/blender/blender/pulls/105090
2023-03-19 11:21:08 +01:00
Richard Antalik
b6caf5980e Merge branch 'blender-v3.5-release' 2023-03-16 04:47:15 +01:00
Damien Picard
d7a68a9de8 Fix: Correct several messages in the UI
- Show/hide mask layers: the tooltip was confusing from a user's
  perspective, because they should not be expected to know what a hide
  flag is.
- Active Spline -> Active Point: likely a copy and paste error.
- Geo Nodes face is planar node: forgotten article.
- Axes, plural instead of axis for the viewport preferences. Here
  there are several usages of axis or axes. Since they refer to
  coordinate axes I believe they should be plural, even though the
  property `mini_axis_type` is still wrong.

-----
![image](/attachments/7ccdc72d-1e83-4c22-b8e9-c3b7c5fcf629)
![image](/attachments/746015bc-23e1-49bc-8828-df07d7605048)
![image](/attachments/61c58766-a8f5-4a90-b862-c9b57c44c355)

Pull Request: https://projects.blender.org/blender/blender/pulls/105814
2023-03-16 00:12:29 +01:00
Hans Goudey
ed4e0b559a Merge branch 'blender-v3.5-release' 2023-03-15 12:14:13 -04:00
Hans Goudey
4f18022f80 Fix #105775: Make "Add > Fur" node setup stable with deformation
Move the deform curves with surface node group to last so it affects the
final generated curves consistently (though this will have a negative
performance impact), and make the generate and interpolate modifiers use
the surface mesh's rest positions.
2023-03-15 12:09:13 -04:00
097492b326 Merge remote-tracking branch 'origin/blender-v3.5-release' 2023-03-13 15:24:19 +01:00
6e4bcb7c87 Fix #100659: "Add F-Curve Modifier" applies only to Active F-Curve
In most places where it appears in a menu, the operator would already
apply to all selected F-Curves. Now it is done consistently and explicitly
from all menu items. The default of the operator is now also set to 'all
selected', so that it also behaves like that when called from the operator
search menu.
2023-03-13 15:23:57 +01:00
Pratik Borhade
577fd9add5 Merge branch 'blender-v3.5-release' 2023-03-10 21:11:09 +05:30
Leon Schittek
382a54aefb Fix #101374: enable edge panning for move operators in menus
This patch enables edge panning for the operators where there was
a mismatch in behaviour between using the shortcut `G` and the
"Move" operator exposed via the menu and operator search.

Commit 19da434e9cc0 introduced a `view2d_edge_pan` property which
was activated for the translate operators invoked when pressing G in
the default keymap.
The property is not enabled by default, to avoid it getting in the
way in some cases, so the "Move" operators exposed via the menus
didn't have edge panning. This lead to inconsistent behavior between
moving via the shortcut or via the menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/104482
2023-03-10 16:22:48 +01:00
Joseph Eagar
d795c00b88 Sculpt: Fix #105557 Bugs in new sculpt menu entries
Note: the wrong hotkeys are still displayed for
move/rotate/scale, for some reason the base view3d
keymap values are being used.
2023-03-09 15:20:22 -08:00