Commit Graph

7197 Commits

Author SHA1 Message Date
Harley Acheson
63f56fee91 Merge branch 'blender-v4.0-release' 2023-10-11 10:28:13 -07:00
Harley Acheson
d6a6c3e1fc UI: Highlight Selected Item in View3D Mode Menu
Allow the View3D "Mode" menu to highlight the currently-selected mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/112058
2023-10-11 19:27:02 +02:00
Harley Acheson
e00bd55576 Merge branch 'blender-v4.0-release' 2023-10-11 08:26:58 -07:00
Harley Acheson
aa88d9a8e3 Revert "UI: Input Placeholders"
This reverts commit b0515e34f9.
Unintentionally added to 4.0
2023-10-11 08:01:24 -07:00
Harley Acheson
61dc86b0eb Merge branch 'blender-v4.0-release' 2023-10-10 15:48:29 -07:00
Harley Acheson
b0515e34f9 UI: Input Placeholders
Optional inline hint describing the expected value of an input field.

Pull Request: https://projects.blender.org/blender/blender/pulls/112104
2023-10-11 00:47:13 +02:00
Jacques Lucke
663aa3538d UI: allocate panel runtime data separately
This results in better separation for what is stored in .blend files and what is not.
Also allows us to potentially use C++ in panel run-time data.

Pull Request: https://projects.blender.org/blender/blender/pulls/113502
2023-10-10 18:17:31 +02:00
Germano Cavalcante
5429d892b7 Merge branch 'blender-v4.0-release' into main 2023-10-10 12:19:37 -03:00
Bastien Montagne
a238ab737b Fix (unreported) liboverride: Hierarchy corruption when making some override local.
Making some liboverride local will break/corrupt liboverride hierarchies
in many cases. So that function (or its caller, in some cases) need to
call #BKE_lib_override_library_main_hierarchy_root_ensure to re-validate
(and re-generate if needed) the liboverride hierarchy roots.
2023-10-10 16:56:48 +02:00
Campbell Barton
137f8dd7bc Cleanup: spelling in comments 2023-10-10 09:44:57 +11:00
Hans Goudey
8f27baf388 Merge branch 'blender-v4.0-release' 2023-10-09 23:54:43 +02:00
Hans Goudey
976eaae02f Cleanup: Move BKE_object.hh to C++
Simplifies the fix to #111120, where the object bounds functions
may return a C++ type instead of `BoundBox`.

Pull Request: https://projects.blender.org/blender/blender/pulls/113462
2023-10-09 23:41:53 +02:00
Harley Acheson
a6a4d45538 Merge branch 'blender-v4.0-release' 2023-10-09 13:10:22 -07:00
Harley Acheson
1d141e721c Fix #109968: Allow Warping on Actual Mouse Bounds
For Color Circle (and Square) and for Walk Navigation, use the actual
region bounds for mouse warping.

Pull Request: https://projects.blender.org/blender/blender/pulls/113066
2023-10-09 22:09:04 +02:00
Harley Acheson
311a3d5695 Merge branch 'blender-v4.0-release' 2023-10-09 07:58:47 -07:00
Harley Acheson
35d3d52508 UI: Search All Menus with Space Bar
Allow initiating the search of any named menu by pressing space bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/113299
2023-10-09 16:56:16 +02:00
Jeroen Bakker
03040f3b7f Cleanup: Make format 2023-10-09 12:49:02 +02:00
Bastien Montagne
df0d7c9c3d WM Jobs: Refactor all worker status variables into a single shared struct.
Move the three current 'status variables' (stop, update and progress)
into a single 'WorkerStatus' struct. This is cleaner and will allow for
future workin this area without having to edit tens of 'startjob'
callbacks signatures all the time.

No functional change expected here.

Note: jobs' specific internal code has been modified as little as
possible, in many cases the job's own data still just store pointers to
these three values. Ideally in the future more refactor will be using a
single pointer to the shared `wmJobWorkerStatus` data instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/113343
2023-10-09 12:12:22 +02:00
Campbell Barton
0742ef808f Fix writing past struct bounds of GHOST_TEventImeData
IME editing would cast GHOST_TEventImeData to wmIMEData then read/write
an additional member that doesn't exist in GHOST_TEventImeData.

In practice it's likely struct padding prevented this from showing up
as a bug. Nevertheless it's bad practice to rely on this.

- Make GHOST_TEventImeData read-only, move the is_ime_composing boolean
  into the window.
- Add static assert to ensure both structs are the same size.
- Correct code comments.
2023-10-08 14:29:08 +11:00
Pratik Borhade
97b831df8e Merge branch 'blender-v4.0-release' 2023-10-06 16:26:53 +05:30
Pratik Borhade
b5ebf31fb1 Fix #113022: Disabled menu item's text uses inner color
This fails to differentiate between active buttons and disabled buttons
for some custom themes (and also in blender light theme)

Instead use text color with 0.5 alpha value for disabled item's text.
(Don't blend between text and inner color)

Pull Request: https://projects.blender.org/blender/blender/pulls/113082
2023-10-06 12:54:14 +02:00
Jesse Yurkovich
d47ceb53f8 Cleanup: Replace usage of old BLI_array macros with C++ types
This replaces the older dynamic c arrays with blender::Vector as
appropriate. Many files required minimal changes and the before/after
are quite similar.

There's 3 remaining usages of the old machinery but those will require
more involved changes and design.

See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110981
2023-10-06 03:02:17 +02:00
Damien Picard
e773e0952a I18n: fix translation of Grease Pencil 3.0 layer names
The Grease Pencil 3.0 layers and groups were not properly translated:
- The layers and groups' names were translated during display in the
  layer list. Since they are data, they should be left untranslated at
  this time.
- On object creation, the names "GP_Layer", "Color", "Lines", and
  "Fills" were not translated at all.
  This adds DATA_() macros around to translate them if the user has
  enabled translation of new data names.
- The functions returning unique names for layers and groups
  unique_layer_group_name() and unique_layer_name() would return
  "GP_Layer" and "GP_Group" by default.
  These defaults are now translated.
- When adding new layers and groups, the name was always hardcoded to
  "GP_Layer" and "GP_Group" because the operators' properties for the
  names defaulted to that, and prop defaults cannot be translated.
  Instead, make them default to a null string, but choose an
  appropriate name when executing the op. This name is chosen by
  unique_layer_name() and unique_layer_group_name(), whose defaults
  are now translated.

Pull Request: https://projects.blender.org/blender/blender/pulls/112930
2023-10-05 10:51:31 +02:00
Harley Acheson
e44f500be8 Fix #102591: Improvements to Context Menu Path Operators
Improvements to `ui_but_menu_add_path_operators` so that it properly
differentiates between files and directories even if the filepath is
not slash terminated. It will also not add the operators to the menu
if the filepath does not exist.

---

Right-clicking on a pathname input we get a context menu that might contain "Open File Externally" and/or "Open Location Externally".  But the first problem is that it does not check if this location exists, and we do have times where the paths do not exist yet.  This PR makes this function a bool so that can return false if the files do not exist.

The second problem is that the function does not properly differentiate between a file path and directory path. For a directory path that is not slash terminated it will assume it is a file path.  This PR actually checks the path (BLI_is_dir) to see if it really is a directory path.

Pull Request: https://projects.blender.org/blender/blender/pulls/113216
2023-10-03 18:44:56 +02:00
Jacques Lucke
48fe3aab36 UI: start search in menu when pressing spacebar
This way one can easily access the item that has been searched for most
recently if `Sort by Most Recent` is enabled in the user preferences.

Pull Request: https://projects.blender.org/blender/blender/pulls/113144
2023-10-03 11:39:00 +02:00
Campbell Barton
26bb029ad8 Fix #113154: Hang double-clicking on UI elements outside a text field
The logic to handle word selection from double clicking ran even when
the event wasn't inside the button. This would pass an invalid position
to BLI_str_cursor_step_bounds_utf8 which hung.

Resolve by limiting word-selection to when the event is inside
the text editing field as well as clamping the position to ensure
it's within the allowed range.
2023-10-03 13:57:33 +11:00
Harley Acheson
4d35344010 UI: UI: Anchor Right When Double-Clicking Last Word
Merging #113125 into blender-v4.0-release. Accidentally
committed to main first.
2023-10-01 09:56:12 -07:00
Harley Acheson
82bfc41d0c UI: Allow Separate Configuration of Subpixel Antialiasing
Separate user configuration of subpixel antialiasing from the hinting
options. For example, this allows turning this on while hinting is
"None", or off when hinting is "Full".

Pull Request: https://projects.blender.org/blender/blender/pulls/113027
2023-09-29 19:02:25 +02:00
Lukas Tönne
d1435f6729 Node groups: Add undo steps after drag and drop of interface items
These have to be added manually by the drop targets.

Pull Request: https://projects.blender.org/blender/blender/pulls/113061
2023-09-29 16:29:26 +02:00
Campbell Barton
78fc3039a8 Fix #90732: UI "Copy to Selected" crash with custom properties
Copy to selected & Alt-LMB dragging buttons didn't account for
custom properties, An IDProperty from one item was applies to other
items in the selection.

Now ID property paths are resolved up for every selected item.
2023-09-29 13:56:16 +10:00
Campbell Barton
b581ea1cc2 Fix copy-to-selected mix up with custom property names
Don't pass custom property names to RNA_struct_type_find_property
since this meant custom-property names could intentionally collide with
RNA property names.
2023-09-29 13:50:56 +10:00
Campbell Barton
8c590ef945 Cleanup: pass const ID properties to path creation functions 2023-09-29 13:50:53 +10:00
Campbell Barton
a3cb3a65b2 Fix UI "Copy Data Path" missing the trailing index for array properties
The index was missing when full_path was False.
2023-09-29 13:50:52 +10:00
Harley Acheson
5ccb289ef7 Fix #112642: Anchor Word Start For Double-click Word Select
In Interface text inputs, when double-clicking to select a word, set
the "initial selection position" to the beginning of the word. This way
you can continue to select forward by dragging before releasing mouse.

Pull Request: https://projects.blender.org/blender/blender/pulls/113037
2023-09-29 00:27:58 +02:00
Julian Eisel
31e1a32378 Fix 1 pixel overlap in tool or asset shelf header background drawing
When the tool settings or asset shelf header would draw with some
transparency, the separator line between regions would visibly overlap
the background behind buttons, which looked unpolished. Ensure there is
no overlap (but also no gap, which became visible after accounting for
the separator line in the background drawing).
2023-09-28 19:30:05 +02:00
Campbell Barton
881bb81763 UI: don't access recent-search.txt when disabled or in background mode 2023-09-28 13:42:29 +10:00
Falk David
4f617bc728 Fix: Expose GPv3 RNA only in experimental
The `blender-v4.0-release` branch would not build because some parts of grease pencil v3 were still exposed when experimental features are disabled.

This is hiding the relevant parts behind `#ifdef WITH_GREASE_PENCIL_V3` to make sure they are only built when the experimental features is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/112953
2023-09-27 15:46:18 +02:00
Julian Eisel
7ec7dac860 Fix background drawing in tool header after changing tools
After changing tools (and possibly other context), the buttons section
background drawing would be broken for one redraw, so the full region
would be drawn with a background, rather than just behind the button
boundaries.
2023-09-27 15:45:39 +02:00
Julian Eisel
e3d4cf9b3d UI: Allow popover panels to register own notifier listeners
This is necessary to let popovers redraw when asynchronously loading
data. For example to display assets or asset catalogs as they get
loaded. Needed for the asset shelf catalog selector popover. Menus
already do the same to allow populating the menu with assets as they get
loaded.
2023-09-27 11:31:21 +02:00
Campbell Barton
b4d3bd134b Cleanup: quiet ASAN warning with invalid value for eButGradientType
-1 was assigned to eButGradientType which isn't a valid value,
add UI_GRAD_NONE to resolve this.
2023-09-27 14:28:47 +10:00
Julian Eisel
73460903fa Asset Shelf: Transparent asset shelf header with background for buttons
Draw the background of the asset shelf header fully transparent, with an opaque
background with rounded corners behind sections containing buttons. This
reduces the visual space consumed by the asset shelf, and makes the header
follow a tabbed folder metaphor better. Also, this works much better with our
click-through feature, where transparent parts of regions without buttons are
passed through the region under it (we might want to consider unifying code
here a bit).

The edge to drag for region resizing respects the transparent sections.
When there is little space between sections, the sections get merged so that
there are no small gaps in the bar.

Part of #107881.

----

Note that the core of this is implemented in a generic way, so this can be
reused for other regions.

Pull Request: https://projects.blender.org/blender/blender/pulls/112241
2023-09-26 17:12:37 +02:00
Julian Eisel
ca2a8be15f Assets: Rename "Import Type" to "Import Method" in code/BPY
It was already called that way in the UI, since it's referring to a
behavior, not a type. Update the code to match that. Note that this is
a BPY compatibility breaking change for 4.0.
2023-09-26 16:48:47 +02:00
Jeroen Bakker
7dbe689b63 Vulkan: Use Point Shaders When Drawing Points
In Vulkan (and Metal) it is not possible to use a global as point
size. It needs to be set for each vertex when drawing points. Blender
has specialized shaders for that, but not all code respect those
shaders.

This PR will add an assert inside the vulkan backend when incorrect
usage of shaders are detected.

Pull Request: https://projects.blender.org/blender/blender/pulls/112906
2023-09-26 16:04:08 +02:00
Hans Goudey
916d4c9d9b Cleanup: Move BKE_screen.h to C++
See #103343
2023-09-25 17:53:11 -04:00
Sergey Sharybin
19db9a213e Light linking: Allow re-ordering in the light linking collections
The order of collections in the light linking collection is important
as it is used for tie-breaking when the same object is reachable from
multiple linked collections with different light linking state.

This commit utilizes the generic tree view reordering operations to
allow insertion of elements to a specific location and to re-order
existing objects and collections in the light linking collection.

It is possible to re-order both collections and objects, even tough
re-ordering objects does not really make a difference for the light
linking behavior. It is not possible to place an object before
collections.

Pull Request: https://projects.blender.org/blender/blender/pulls/112849
2023-09-25 18:00:28 +02:00
Sergey Sharybin
489693ef6d Light linking: Use checkbox icons for state indication
This is as per design task #104972

The same icons as exclusion in the outliner are used.

Pull Request: https://projects.blender.org/blender/blender/pulls/112857
2023-09-25 15:29:49 +02:00
Falk David
16e195a111 Cleanup: GPv3 layer tree manipulations
In preparation of https://projects.blender.org/blender/blender/pulls/112535, we need to make sure all layer tree manipulations are in functions on the `GreasePencil` struct so we can keep the `CustomData` for layers in sync with the layer tree.

 This PR makes sure that all the functions that change the layer tree in any way are `protected` on the `LayerGroup` class. The `GreasePencil` struct is declared `friend` with `LayerGroup`.

We also cleanup and remove a lot of code duplication between layers and layer groups and try to write functions in a generic way for `TreeNode` (both layers and layer groups are tree nodes).

Pull Request: https://projects.blender.org/blender/blender/pulls/112837
2023-09-25 12:11:18 +02:00
Jacques Lucke
8362563949 UI: show recently selected items at the top of searches
The goal is to make the search faster to use by dynamically adapting to the user.
This can be achieved using the simple but common approach of showing recently
selected items at the top. Note, that the "matching score" between the query and
each search item still has precedence when determining the order. So the last used
item is only at the top, if there is no other search item that matches the query better.

Besides making the search generally faster to use, my hope is that this can also
reduce the need for manually weighting search items in some places. This is
because while the ordering might not be perfect the first time, it will always be
once the user selected the element that should be at the top once.

This patch includes:
* Support for taking recent searches into account in string searching.
* Keep track of a global list of recent searches.
* Store recent searches on disk similar to recently opened files.
* A new setting in the user preferences that allows disabling the functionality.
  This can be used if deterministic key strokes are required, e.g. for automated tests.

In the future this could be improved in different ways:
* Add some kind of separator in the search list to indicate which elements are at
  the top because they have been used recently.
* Store the recent search items per search, instead of in a global list. This way
  it could adapt to the user even better.

Pull Request: https://projects.blender.org/blender/blender/pulls/110828
2023-09-25 10:56:12 +02:00
Campbell Barton
e38ff7c06d Cleanup: use C++ comments for disabled code 2023-09-25 17:06:04 +10:00
Jacques Lucke
eef2a706b4 Fix: UI: garbage string when invoking search from menu
The issue was that `event.utf8_buf` is not null-terminated.
In debug builds, it's explicitly filled with `0xff` which let to
the garbage characters. Now check for the size of the first
valid utf8 char and only copy that.

Thanks to PratikPB2123 for the investigation in #112719.
2023-09-24 22:37:01 +02:00