Commit Graph

101479 Commits

Author SHA1 Message Date
Campbell Barton
2f39d8df59 Cleanup: remove unused rna_Main_filepath_set callback 2023-07-27 15:07:20 +10:00
Campbell Barton
3da47a6084 Cleanup: remove unused set callbacks from readonly RNA properties
Oversight in 8d9422cfe3.
2023-07-27 14:32:40 +10:00
Harley Acheson
8d9422cfe3 Fix #110508: Text Object Select Attributes in Object Mode
Status of selected bold, italics, underline, and small caps requires
that the curve have an editfont object. Not checking for this works
interactively but can cause errors in Python. This PR adds explicit
getters and setters that check for editfont.

Pull Request: https://projects.blender.org/blender/blender/pulls/110513
2023-07-27 05:31:08 +02:00
Hans Goudey
f557222a7b Fix: Mesh face normal calculation can give zero vectors
Triangles and quads don't check for degenerate faces (where the normal
might be zero), while ngons already set the Z component to 1 for that,
which is also what we do for vertex normals.

Also reorder the face size checks to put quads and triangles before
N-gons, since they are typically more common on high-poly meshes.
And change the check for 2 sided faces into an assert.
2023-07-26 22:53:25 -04:00
Campbell Barton
cc892efcd4 Cleanup: use snake case, especially for structs that define callbacks
Use snake case for ShaderFxTypeInfo, ModifierTypeInfo,
GpencilModifierTypeInfo & bConstraintTypeInfo.
2023-07-27 12:21:06 +10:00
Campbell Barton
d4b2054f1f Cleanup: various C++ cleanups
- Use C++ headers.
- Use function style cast.
- Use boolean literals.
- Remove redundant struct, void.
- Correct struct comment ID's.
2023-07-27 12:21:06 +10:00
Lukas Stockner
4bd8f24b81 Update OBJ parser tests for Principled BSDF Sheen versioning change
Eventually this will need to be updated for the new Sheen in general,
but we should probably wait with that until all breaking changes for
the Principled BSDF are done.
2023-07-27 03:20:55 +02:00
Campbell Barton
a838e141fe Cleanup: quiet compiler warnings 2023-07-27 10:51:33 +10:00
Lukas Stockner
c66a694056 Cycles: Replace Sheen model in the Principled BSDF
This replaces the Sheen model used in the Principled BSDF with the
model from #108869 that is already used in the Sheen BSDF now.

The three notable differences are:
- At full intensity (Sheen = 1.0), the new model is significantly
  stronger than the old one. For existing files, the intensity is
  adjusted to keep the overall look similar.
- The Sheen Tint input is now a color input, instead of the
  previous blend factor between white and the base color.
- There is now a Sheen roughness control, which can be used to
  tweak the look between velvet-like and dust-like.

Pull Request: https://projects.blender.org/blender/blender/pulls/109949
2023-07-27 02:17:44 +02:00
Jacques Lucke
234f866db2 RNA: move rna_test.c to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110505
2023-07-26 19:27:56 +02:00
Brecht Van Lommel
b3223d3f4f Fix #110426: render hanging when drawing metadata in the image editor
Release must be called regardless if the returned image buffer pointer
is null.
2023-07-26 18:48:24 +02:00
Amelie Fondevilla
0c07fb50c8 GPv3: Keyframe on-click selection
Implementation of the click-selection operator of keyframes in the dopesheet, along with its alternatives : deselect all when no frames is hit, extend selection with shift, column selection with alt, select all keyframes on current channel with ctrl+alt.

Includes the new following API functions :
 * `select_frame_at` : selects a frame in a layer at a specific time (if such frame exists),
 * `select_all_frames` : selects all frames of a layer,
 * `select_layer_channel` : selects a layer, and sets it as active (if layer is not null, otherwise the active layer is set null),
 * `layer_has_frame_selected` : checks if any of the frames in the layer is selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/110492
2023-07-26 17:59:09 +02:00
Falk David
d6aa9906fd Modifiers: Add idname field to ModifierTypeInfo
Previously the panel type name of a modifier (e.g. "MOD_PT_Smooth") was
created by copying from the ModifierTypeInfos name.
This meant that modifiers with the same default name would use
the same identifier for the panels.

Since different object types (e.g. OB_GREASE_PENCIL and OB_MESH)
might want to use the same default modifier name, this PR introduces
an idname field in the ModifierTypeInfo struct. This is then used to
generate the panel type name.

For compatibility reasons, the idname is the same as the name for now.

Note: Because the name was used previously, this means that some
modifiers have spaces in their panel type name.
E.g. "MOD_PT_Volume to Mesh".

Pull Request: https://projects.blender.org/blender/blender/pulls/110468
2023-07-26 17:08:14 +02:00
Hans Goudey
580833165c Fix #109583: Avoid non-threadsafe writing to custom normals data
Currently, while calculating face corner normals, Blender retrieves
custom normal data with write access. When the the custom normals in a
single smooth corner fan don't match, they are reset to the average
value.

This behavior is very old, but it comes from when Blender didn't have a
strong idea of const correctness. Indeed, modifying custom normal data
while calculating normals isn't threadsafe, which is important because
normals are calculated for viewport drawing, for example. And in the
future, properly caching face corner normals (see #93551) will require
the ability to calculate normals on a properly const mesh.

The fix is to still use the average of custom normals in a fan, but
not write that back to the custom data array. In my testing the results
are the same. Setting custom normals still fills the same value for all
corners in a fan.

Pull Request: https://projects.blender.org/blender/blender/pulls/110478
2023-07-26 17:04:13 +02:00
Julian Eisel
741c684bf6 Refactor: Pass context to UI view item activate function
The `on_activate()` function is expected to do undo pushes, call
operators, send notifiers and things like that as needed. Context is
necessary for such things, so seems reasonable to provide it as
argument.

Also needed for #110378.
2023-07-26 16:50:17 +02:00
Julian Eisel
2e9bc6373c Refactor: Deduplicate view item active state logic
Much of this was duplicated between grid view and tree view items which
keeping them in sync was becoming a hassle already. Now the logic is
shared via the base class. I find this makes the interfaces easier to
scan through visually as well.

Had to add a virtual iterator function that can be called on an
`AbstractView`.
2023-07-26 16:45:14 +02:00
Jacques Lucke
29aa89e4ec Fix: build error in windows debug builds 2023-07-26 16:39:48 +02:00
Jacques Lucke
932332ad6e BMesh: move bmesh module to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110489
2023-07-26 16:12:55 +02:00
Jacques Lucke
325acb51df Grease Pencil: move legacy grease pencil editors code to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110495
2023-07-26 16:12:48 +02:00
Julian Eisel
5f437908a2 Cleanup: Correct grid view comments 2023-07-26 15:39:47 +02:00
Julian Eisel
dedd55df33 Fix API design issue with activating UI view items
The `on_activate()` function of an item should only be called when the
item was activated through the view, not through an external data change
(e.g. changing an active item through Python). That is important because
`on_activate()` is expected to do things like sending an undo push. This
is now respected in tree and grid views.
2023-07-26 15:39:47 +02:00
Julian Eisel
add3ec71d2 Cleanup: Address clang-tidy warnings in UI views
Unused header warning and `modernize-use-override` warnings.

I would like to selectively disable warnings about redundant `virtual` and
`override` keywords, since both together are useful (`override` enables
important compiler warnings that can avoid bugs, `virtual` helps quickly
identifying API functions available for overriding). But this doesn't
seem to be possible, only all of `modernize-use-override` can be
disabled, so simply keep the `virtual` but comment it out.
2023-07-26 15:39:47 +02:00
Falk David
5846b9164a GeometrySet: Add new GreasePencilComponent
This is mostly boilerplate code to add a new `GeometryComponent` as well as making sure
the new `GeometryComponent::Type` is handled in all the `switch` statements.

Pull Request: https://projects.blender.org/blender/blender/pulls/110457
2023-07-26 13:59:37 +02:00
Campbell Barton
cda7e5af19 PyAPI: expose missing show_region_* properties
Add show_region_channels access for animation editors &
show_region_tools for the spreadsheet.

These could be hidden by resizing the region, there was just not way to
do this from Python.

Exposing these means they can be toggled from WM_MT_region_toggle_pie.
2023-07-26 21:55:26 +10:00
Jacques Lucke
00e6adb49c Grease Pencil: move legacy grease pencil modifiers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110493
2023-07-26 13:45:04 +02:00
Clément Foucault
38542ceeda DRW: Make tests pass
These were just changes that changed the test
output but not the behavior.
2023-07-26 12:42:36 +02:00
Clément Foucault
ad2771878d DRW: Add missing defines for tests
Prior to that, the Draw tests would be missing.
2023-07-26 11:45:36 +02:00
Clément Foucault
2a286ff0f1 GPU: Make shader tests pass on OpenGL
There was some inconsistencies between GLSL and MSL
regarding vector comparison.
2023-07-26 11:27:48 +02:00
Amelie
4c12988d5a GPv3: Add filtering for channels in the grease pencil dopesheet
Take into account the filtering flags while filtering grease pencil channels in the grease pencil dopesheet.
This PR also adds two API functions for layers :
* `is_empty` checks if a layer contains no frame, and
* `is_selected` checks if a layer is selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/110484
2023-07-26 11:06:36 +02:00
Amelie
8fc2b6ad06 GPv3: Prevent crashes from the dopesheet functions
Some animation operators are not yet implemented for Grease Pencil 3, and trigger asserts. This patch prevents the asserts to be triggered in case of grease pencil channels, so that  Grease Pencil 3 can be tested until the operators are properly implemented.

Pull Request: https://projects.blender.org/blender/blender/pulls/110486
2023-07-26 10:29:40 +02:00
Campbell Barton
9c7ef4a3b4 Fix build error in fcacebbfb1
The header was not included, define ulong locally.
2023-07-26 15:52:54 +10:00
Campbell Barton
566118f7f1 UI: change the name of RGN_TYPE_UI in the enum to "Sidebar"
This is the term used in the interface, using this term means enum items
can be used in UI code without having to use a separate name mapping.
2023-07-26 15:23:30 +10:00
Campbell Barton
44b9fba9d2 Cleanup: restore parenthesis in ME_FACE_TRI_TOT macro
This was removed in a recent refactor, also use a more meaningful
argument name.
2023-07-26 15:23:28 +10:00
Campbell Barton
e6dafbed66 Cleanup: spelling in comments 2023-07-26 15:23:26 +10:00
Campbell Barton
cf49cbde45 Cleanup: use doxygen formatting in UI_interface.h, DNA_screen_types.h
Also use doxygen type references & correct some typos.
2023-07-26 15:23:24 +10:00
Campbell Barton
fcacebbfb1 Cleanup: brief unsigned types, bool literals, correct struct comments 2023-07-26 15:23:23 +10:00
Hans Goudey
673fc326db Cleanup: Remove unnecessary manual mesh edit data destruction
Also slightly improve comments about original indices.
2023-07-26 00:08:31 -04:00
Hans Goudey
f9a4fcd8cf Cleanup: Access more mesh data with C++ methods
Recent C++ conversions have enabled more changes like
af53207b43 and 7826aed105.
2023-07-25 21:59:54 -04:00
Germano Cavalcante
fce95f330d Fix #110475: 'Use Mouse Position' option for navigation not working
Caused by 384c2e1f36

The 'Use Mouse Position' option was always being false which caused
navigation operators to behave as if the cursor was in the middle of
the region.
2023-07-25 21:55:44 -03:00
Hans Goudey
aebc743bf1 Cleanup: Make format
Sorry for the noise, I thought I ran this in the previous commit.
2023-07-25 15:23:56 -04:00
Hans Goudey
95edff7495 Cleanup: Rename mesh custom data fields
Implements the rest of #101689, after 5e9ea9243b.

- `vdata` -> `vert_data`
- `edata` -> `edge_data`
- `pdata` -> `face_data`
- `ldata` -> `loop_data`

A deeper rename of `loop` to `corner` will be proposed as a next
step, and renaming `totvert` and `totedge` can be done separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/110432
2023-07-25 21:15:52 +02:00
Brecht Van Lommel
aef3d1c95b Fix grease pencil crash with render engines that don't deliver Z pass
Found during Hydra render engine development, could also happen with
render engine add-ons.
2023-07-25 19:19:51 +02:00
Brecht Van Lommel
97007e56e5 Fix Freestyle build error when not using unity build 2023-07-25 19:19:51 +02:00
Hans Goudey
af19de3986 Cleanup: Pass edge to corner map by value in normal calculation 2023-07-25 11:56:01 -04:00
Hans Goudey
bd4be36894 Cleanup: Avoid passing redundant face index in normal calculation
The current face index can always be retrieved from the "loop_to_face"
map, so passing it around and updating it manually just adds more
state to track.
2023-07-25 11:56:01 -04:00
Hans Goudey
0e87e25b37 Cleanup: Simplify iteration over mesh faces, use utility functions
Utility functions make accessing the next and previous corner of a face
more obvious, and range based for loops make iterating over corners
or vertices in a face simpler too.
2023-07-25 11:56:01 -04:00
Nathan Vegdahl
6b872079fe Fix #88752: overlapping IK constraints with zero-influence misbehave
Bones with overlapping IK constraints would jump about unpredictably
when at least one of those constraints was either zero-influence or
disabled.

The underlying issue appears to be that depsgraph construction assumes
all IK constraints are enabled (which is necessary for e.g. animating
influence), but the IK solver code excludes disabled and zero-influence
constraints from the solve.  This in turn leads to
`BKE_pose_where_is_bone` not getting called when needed in some cases.

This commit addresses the issue by always including all IK targets in
the solve even when disabled or zero-influence, and simply excluding
them from being applied.

See the discussion in #88752 for more details.

This patch was primarily authored by Brecht, but with a minor fix
by me after testing.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/110417
2023-07-25 16:45:31 +02:00
Ray molenkamp
4ea2baf4ae CMake: revert last weeks modernizations
The cleanup of blenkernel last weeks , caused the house of cards to
collapse on  top of bf_gpu's shader_builder, which is off by default
but used on a daily basis by the rendering team.

Given the fixes forward in #110394 ran into a ODR violation in OSL that
was hiding there for years, I don't see another way forward without
impeding the rendering teams productivity for "quite a while" as there
is no guarantee the OSL issue would be the end of it.

the only way forward appears to be back.

this reverts :

19422044ed
a670b53abe
0f541db97c
be516e8c81
3e88a2f44c
4e64b772f5
9547e7a317
07fe6c5a57

The problematic commit was 07fe6c5a57
as blenkernel links most of blender, it's a bit of a link order issue
magnet. Given all these commits stack, it's near impossible to revert
just that one without spending a significant amount of time resolving
merge conflicts. 99% of that work was automated, so easier to just
revert all of them, and re-do the work, than it is to deal with the
merge conflicts.

Pull Request: https://projects.blender.org/blender/blender/pulls/110438
2023-07-25 16:43:21 +02:00
Julian Eisel
9d0907560a UI: Refactor quick label tooltip implementation for buttons
No user visible changes expected. Used in the asset shelf branch,
see #104831.

These tooltips only show a label string and appear after a shorter timeout
than the regular tooltips. After the regular tooltip timeout they expand to
the full tooltip. The toolbar and properties editor navigation tabs make use
of this already.

The changes here enable more control over quick label tooltips, making them
usable in more cases, and less ad-hoc. Main changes:
- Refactors internal logic so a single `UI_BUT_HAS_TOOLTIP_LABEL` button flag
  can be used to enable quick label tooltips. This decentralizes logic in a
  way that's more consistent and extensible.
- Custom callback to return a quick label. This is useful when a label tooltip
  should be displayed even when there is no button string set. E.g. in the
  asset shelf with "Show Names" disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/110200
2023-07-25 16:22:31 +02:00
Alexander Gavrilov
b248295530 Depsgraph: handle camera switching via markers in context drivers.
Blender allows animating the active camera selection (i.e. scene.camera)
by binding cameras to markers in the timeline. The dependency graph was
completely ignoring this by not building nodes for these cameras (it is
possible to reference a camera not directly included in the scene), and
not taking this into account in driver relations.

This change ensures that all cameras are included in the dependency
graph, and any drivers referencing scene.camera get dependencies on
all cameras of the timeline, and also time itself to ensure switches
are processed.

Pull Request #110139
2023-07-25 14:03:17 +03:00