Commit Graph

101443 Commits

Author SHA1 Message Date
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
Alexander Gavrilov 406f601c4b Depsgraph: change the fix for #107081 to handle any Scene references.
The cause of that bug is any dependency on Scene COW, because that is
triggered by selection. Context properties merely are the most reasonable
way for that to happen. Therefore, the special rule should really apply
to any Scene references.

The real motivation is this removes dependency on dvar for when this
code is extracted as a new method in the next commit.

Pull Request #110139
2023-07-25 14:03:17 +03:00
Alexander Gavrilov 347a466e15 Depsgraph: tag relations update when marker camera refs are changed.
Since markers are used to animate scene.camera, changing their camera
links carries the same consequences as changing scene.camera directly.
This means relations need rebuilding in case a new camera was added.

Pull Request #110139
2023-07-25 14:03:17 +03:00
Alexander Gavrilov cc7dcfcfd5 Depsgraph: tag relations update from Set Active Object As Camera.
Dependency building assumes scene.camera is fixed due to #107081.
Thus it is necessary to do a relations update when it does change.

Pull Request #110139
2023-07-25 14:03:17 +03:00
Campbell Barton 9581007322 Cleanup: correct declaration 2023-07-25 20:51:32 +10:00
Julian Eisel db0b804a0a UI: Attempt to restore region for redo from Adjust Last Operation panel
The Adjust Last Operation panel would attempt to use the main region,
even when the operator was initially executed in a different region.
This becomes an issue when the operator relies on context of the region.
For example the pose library gets the active asset from context, which
is only available in the region (e.g. asset shelf) displaying the
assets. In general it seems like redo should restore the region of
invocation.

This uses the region type from the initial operator call context to
lookup a region to restore on redo. While not completely bullet proof
(multiple regions of the same type may be present), this should mitigate
the issue quite a bit.

Required for #104831.

Pull Request: https://projects.blender.org/blender/blender/pulls/108892
2023-07-25 12:42:42 +02:00
Julian Eisel 63c07c80f5 Cleanup: Use const for screen lookup helpers 2023-07-25 12:38:47 +02:00
Julian Eisel 4137f9a87f Fix missing redraws of affected regions with dynamically sized regions
Regions that change their size in the layout phase (something that is
supported for a while now) might affect the size of following regions.
For example the asset shelf design forsees that it takes space away from
the tool- and sidebar. When its size changes, tool- and sidebar need to
redraw.

Without this there is a crash in the `asset-shelf` branch:
- Open sidebar
- In the asset shelf Display Settings popover, toggle "Names" twice.

At first the sidebar will be empty, when toggling the second time a
null-dereference will cause a crash. This is because the layout phase of
the sidebar does not run, but after that the region size is updated,
it's tagged for redraw and the draw phase runs (without any layout).

Pull Request: https://projects.blender.org/blender/blender/pulls/110212
2023-07-25 12:07:53 +02:00
Hans Goudey 1f302a0635 Cleanup: Small changes to GP smooth operator
- Avoid calling `.finish()` twice, only pass span
- Fix "opcities" typo
- Remove unnecessary "is_empty()" check
- Group creation of "src_data" in one block
- Remove periods after doxygen titles
- Remove unnecessary "curves" argument
- Order mutable argument last

Pull Request: https://projects.blender.org/blender/blender/pulls/110428
2023-07-25 11:00:45 +02:00
Jacques Lucke f397ba7571 BLI: update blender::Set vs std::unordered_set benchmark results
Also give more details about the used CPU and compiler.
2023-07-25 10:49:14 +02:00
Campbell Barton c6725b935c Fix #109720: load_post can't be used to initialize the driver namespace
Regression in [0] changed the order of execution for the load_post
handler which previously (in 3.5x) ran before driver evaluation.

Calling either load_post/load_post_fail handlers after loading was
changed intentionally to simplify the code-path for calling handlers
however it meant the handler couldn't be used to setup drivers,
so restore the original logic.

[0]: 46be42f6b1
2023-07-25 15:42:36 +10:00
Campbell Barton 530ee6e7fa Cleanup: make class doc-strings directly above classes
In some cases it wasn't clear if a comment before a class was meant
to be it's doc-string. Remove blank lines between the class & it's
doc-string.
2023-07-25 14:11:42 +10:00
Campbell Barton 7210b80895 Cleanup: run code_clean, remove struct, use utility macros & nullptr 2023-07-25 13:32:21 +10:00
Campbell Barton 921d6dc3e2 Cleanup: typedef uchar, ushort, uint & ulong in freestyle
source/blender/freestyle wasn't fillowing Blender's own
conventions for integer types.

This had the down-side of making the code_clean.py utility attempt to
replace `unsigned int` types which always failed.
While this edit could have been manually ignored for all files in
freestyle, add the typedef's to `FreestyleConfig.h` and follow Blender's
convention instead.
2023-07-25 12:59:22 +10:00
Harley Acheson 4150152d0f Fix #109663: Allow Animation Keymap in Spreadsheet Editor
Allow starting and stopping animation, changing frames, etc while in
the Spreadsheet Editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/110404
2023-07-25 00:35:06 +02:00
Harley Acheson 1dfeac246d UI: Only Show Spreadsheet Scroll Bars When Necessary
Hides Spreadsheet editor scroll bars when not needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/110403
2023-07-24 23:49:32 +02:00
Hans Goudey f3f31054ba Cleanup: Make format 2023-07-24 16:32:08 -04:00
Hans Goudey 318f9b259b Cleanup: Use const pointers in PBVH draw arguments
Also remove two unused variables
2023-07-24 16:32:00 -04:00
Hans Goudey 5e9ea9243b Mesh: Rename "polys" to "faces"
Implements part of #101689.

The "poly" name was chosen to distinguish the `MLoop` + `MPoly`
combination from the `MFace` struct it replaced. Those two structures
persisted together for a long time, but nowadays `MPoly` is gone, and
`MFace` is only used in some legacy code like the particle system.

To avoid unnecessarily using a different term, increase consistency
with the UI and with BMesh, and generally make code a bit easier to
read, this commit replaces the `poly` term with `poly`. Most variables
that use the term are renamed too. `Mesh.totface` and `Mesh.fdata` now
have a `_legacy` suffix to reduce confusion. In a next step, `pdata`
can be renamed to `face_data` as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/109819
2023-07-24 22:06:55 +02:00
Damien Picard 13ec961c4a UI: fix and improve a few messages
- "Rename Channels": only one channel can be renamed at a time, use
  singular.
- "Copy Markers to Scene": rephrase erroneous operator description.
- "Axis tag names with": grammar.
- "Close or open the selected stroke adding an edge from last to first
  point": "segment" is preferred to "edge" elsewhere in the context of
  curves or Grease Pencil.
- "Number of subdivisions [points] by edge[s]": replace "by edge" with
  "per segment" for the same reason.
- "Compatibility mode for SL, OpenSim...": expand to explain that SL
  and OpenSim are respectively Second Life and OpenSimulator.
- "W/m^2" -> "W/m²". This symbol is widely supported and should be
  preferred for exponentiation outside of code.
- "Effect on tracks which are tracked less than specified amount of frames",
  "Effect on tracks which have a larger reprojection error":
  Use "Affect" and "number" instead of "amount".
- "Hull curve" -> "Envelope". This is a calque from German Hüllkurve
  meaning envelope.
- "Frquency Cutoff" -> "Frequency Cutoff" (typo)
- "Check if Select Left or Right": rephrase to "Based on Mouse
  Position" as it better explains the action of the operator.
- "Make cut event if strip is not selected ..." -> even (typo)
- "Shear selected items along the horizontal screen axis":
  Rephrase as this transform operator can act in many different axes.
- Tonemapping compositing node: the two algorithms "R/D Photoreceptor"
  and "Rh Simple" only had names, but no description. Add ones
  explaining at least the basic principle and where the names come
  from.
- In the "Matte dilate/erode side" description for the Keying node's
  Dilate/Erode socket, "side" was likely a typo for "size".
  Reformulate the description to make it clearer, inspired by similar
  ones.
- "Width of the blur edge" -> "Width of the blur for the transition";
  "Edge angle" -> "Angle of the transition";
  "Wipe direction" -> "Whether to fade in or out":
  Better explains the sequencer wipe transition (inspired by the manual).
- OSL shaders now supported on some GPU backends.
- "Add a new repeat input and output nodes " -> "Add new" (typo).

Pull Request: https://projects.blender.org/blender/blender/pulls/110321
2023-07-24 21:22:07 +02:00
Hans Goudey 189fc24f1a Cleanup: Simplify removing curves in GP erasor stroke mode
Avoid the initial copy, and avoid moving from a const reference.
2023-07-24 14:07:44 -04:00
Hans Goudey 78dba0bb17 Cleanup: Pass array references with spans in GP eraser 2023-07-24 13:49:27 -04:00
Amelie 4f56261f76 GPv3: Stroke mode for the Eraser tool
Implementation of the stroke mode of the eraser tool for grease pencil.
In this mode, the eraser removes each stroke that it touches, meaning each stroke that either intersects the eraser or that has all points inside of it.

Pull Request: https://projects.blender.org/blender/blender/pulls/110304
2023-07-24 17:04:39 +02:00
Sybren A. Stüvel 47cc5787a6 Fix compiler error when building without `WITH_INPUT_NDOF`
Some declarations were outside the `#ifdef WITH_INPUT_NDOF`, but still
referred to things inside that block. Now everything is inside the file.
2023-07-24 16:42:56 +02:00
Lukas Stockner 8fd0551bfe Cleanup: format 2023-07-24 16:06:45 +02:00
Lukas Stockner c7eb426eae Cleanup: Remove leftover code in versioning 2023-07-24 16:05:35 +02:00
Sybren A. Stüvel 00e5b2b6db Refactor: Anim, simplify Armature drawing code a little bit
Reduce indentation in two armature drawing functions, by flipping
conditions and using `continue` (instead of having the entire `for`-body
inside two nested conditions).

No functional changes.
2023-07-24 15:53:59 +02:00
Germano Cavalcante 017d4912b2 Transform: Use alternative hotkeys for Transform Navigation
In order to avoid navigation hotkey conflicts during transform
operations, this commit implements the "Transform Navigation with Alt"
option.

This option is enabled by default and makes navigation hotkeys require
the `Alt` key during a transforming in the 3D View.

Pull Request: https://projects.blender.org/blender/blender/pulls/109754
2023-07-24 15:51:58 +02:00
Germano Cavalcante 30b53c1005 Fix View Pan operation failing
Caused by 329cf07499
2023-07-24 10:40:36 -03:00
Lukas Stockner b220ec27d7 Cycles: Update Velvet BSDF to Sheen BSDF with new Microfiber sheen model
This patch extends the old Velvet BSDF node with a new shading model,
and renames it to Sheen BSDF accordingly.

The old model is still available, but new nodes now default to the
"Microfiber" model, which is an implementation of
https://tizianzeltner.com/projects/Zeltner2022Practical/.

Pull Request: https://projects.blender.org/blender/blender/pulls/108869
2023-07-24 15:36:36 +02:00
Germano Cavalcante 0b3d2a4f47 View3D Refactor: rename view operator files
Use the `view` prefix to better identify the hierarchy of these files.
2023-07-24 09:50:39 -03:00
Germano Cavalcante 329cf07499 View3D Refactor: compute 'ViewOpsData::zfac' only when needed 2023-07-24 09:50:39 -03:00
Germano Cavalcante e8289c0aff View3D Refactor: support 'ViewOpsType' for Roll
This deduplicates the code and will make it easier to integrate this
operator into the overall navigation utility.
2023-07-24 09:50:39 -03:00
Germano Cavalcante b4e6c02709 View3D Refactor: support 'ViewOpsType' for Orbit
This deduplicates the code and will make it easier to integrate this
operator into the overall navigation utility.
2023-07-24 09:50:29 -03:00
Germano Cavalcante 384c2e1f36 View3D Refactor: use structs to confine the Operator's navigation data
Adopt the use of structs to enclose and organize operator-specific
navigation data.

With this, we create well-defined boundaries for the navigation data of
individual operators.

This makes the code more flexible and easier to maintain and avoid
errors.
2023-07-24 09:46:32 -03:00
Germano Cavalcante 10835154eb Cleanup: split 'view3d_navigate.cc' operators into their own files
This reorganization makes the code more modular and makes it easier to
identify and fix possible errors in the future.
2023-07-24 09:37:05 -03:00
Germano Cavalcante 6faa39edb7 Cleanup: split 'ViewOpsData::init_navigation' into specific functions
The logic of `ViewOpsData::dyn_ofs` was scattered and confusing.

Confining it to a function makes initialization and usage clearer.
2023-07-24 08:49:57 -03:00