Commit Graph

302 Commits

Author SHA1 Message Date
Campbell Barton b03332a055 Cleanup: use BLI_assert_msg instead of checking string literals 2024-04-03 14:27:54 +11:00
Campbell Barton d514b3b53b Cleanup: use explicit casts when assigning booleans to floats
While valid, this isn't so common and cppcheck warns about this,
use explicit casts to suppress the warning, also correct "true"
being assigned to a float value.
2024-04-01 22:20:09 +11:00
Campbell Barton 686605a6dd Cleanup: declare arrays as const where possible 2024-03-28 22:57:57 +11:00
Campbell Barton b28861682e Fix 2D cage gizmo failing to refresh when Shift is pressed/released
Detecting when the Shift state "changed" wasn't working because
of a self-assignment.

Since cursor motion always refreshes,
this isn't an especially noticeable an issue.
2024-03-28 13:45:24 +11:00
Hans Goudey 148940ad15 Cleanup: Remove unnecessary keywords from newly C++ headers
Pull Request: https://projects.blender.org/blender/blender/pulls/119943
2024-03-27 02:45:30 +01:00
Hans Goudey b8b745ae1e Cleanup: Move remaining editors internal headers to C++ 2024-03-27 02:45:27 +01:00
Hans Goudey 893130e6fe Refactor: Remove unnecessary C wrapper for GPUBatch class
Similar to fe76d8c946

Pull Request: https://projects.blender.org/blender/blender/pulls/119898
2024-03-26 03:06:25 +01:00
Hans Goudey fe76d8c946 Refactor: Remove unnecessary C wrappers for vertex and index buffers
Now that all relevant code is C++, the indirection from the C struct
`GPUVertBuf` to the C++ `blender::gpu::VertBuf` class just adds
complexity and necessitates a wrapper API, making more cleanups like
use of RAII or other C++ types more difficult.

This commit replaces the C wrapper structs with direct use of the
vertex and index buffer base classes. In C++ we can choose which parts
of a class are private, so we don't risk exposing too many
implementation details here.

Pull Request: https://projects.blender.org/blender/blender/pulls/119825
2024-03-24 16:38:30 +01:00
Hans Goudey 8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00
Campbell Barton e33f5e36ac Cleanup: spacing around C-style comment blocks 2024-03-09 23:40:57 +11:00
Kyler Kelly 060174cf14 Transform: customizable rotation snap increment values
Add two snapping increment options: a regular value
(activated with Ctrl) and a precise value (activated with Ctrl+Shift).
These values are separate for 2D and 3D views.

Ref !118760
2024-03-09 16:57:12 +11:00
Hans Goudey 744f3b2823 Cleanup: Grammar in comments: Fix uses of "own"
"Own" (the adjective) cannot be used on its own. It should be combined
with something like "its own", "our own",  "her own", or "the object's own".
It also isn't used separately to mean something like "separate".

Also, "its own" is correct instead of "it's own" which is a misues of the verb.
2024-03-07 16:23:35 -05:00
Germano Cavalcante db754790b7 Fix: snap gizmo state returning to default values after unhidden
This didn't present a problem currently because the measure tool gizmo
coincidentally uses the default snap settings.
2024-02-21 14:22:45 -03:00
Germano Cavalcante 1a74b80d42 Refactor: replace 'isect_ray_plane_v3' with 'isect_ray_plane_v3_factor'
By using `isect_ray_plane_v3_factor` we avoid calculating the v4 plane.
2024-02-13 21:08:49 -03:00
Campbell Barton b372ebae68 Cleanup: unused headers for source/blender/editors
Remove 1317 includes from editors.
2024-02-13 10:02:53 +11:00
Bastien Montagne 54618dbae3 Cleanup: Make `BKE_global.h` a Cpp header. 2024-02-10 18:25:14 +01:00
Brecht Van Lommel d377ef2543 Clang Format: bump to version 17
Along with the 4.1 libraries upgrade, we are bumping the clang-format
version from 8-12 to 17. This affects quite a few files.

If not already the case, you may consider pointing your IDE to the
clang-format binary bundled with the Blender precompiled libraries.
2024-01-03 13:38:14 +01:00
Campbell Barton 77695da84b Cleanup: minor formatting tweaks 2023-12-08 16:22:14 +11:00
Bastien Montagne 3acb64e7ac BKE_main: move header to be a fully CPP one.
Pull Request: https://projects.blender.org/blender/blender/pulls/115681
2023-12-01 20:38:54 +01:00
Jesse Yurkovich d304ba7906 Cleanup: Rename GPU_select header to indicate its move to C++
From a prior PR[0] there was a desire to rename this header to more
clearly indicate it's C++ now.

[0] !112491

Pull Request: https://projects.blender.org/blender/blender/pulls/115631
2023-12-01 03:39:03 +01:00
Ray Molenkamp 6b70c04724 Cleanup: CMake: Modernize bf_depsgraph dependencies
Pretty straightforward

- Remove any bf_depsgraph paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115422
2023-11-25 22:51:59 +01:00
Ray Molenkamp b683bcc46c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any bf_intern_clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115323
2023-11-24 17:12:24 +01:00
Hans Goudey 3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Campbell Barton aaf05c2497 Cleanup: various C++ changes (use nullptr, function style casts) 2023-11-07 11:35:16 +11:00
Campbell Barton 77a94e9e38 Cleanup: various non-functional changes for C++ 2023-10-07 18:29:48 +11:00
Germano Cavalcante fb556c75df Snap: New icons
For Blender 4.0 we decided to support individual icons for different
snap elements.

This was originally contributed by Erik Abrahamsson as !107054 with
some contributions by myself (Germano).

This set of icons being simple geometric symbols, that should be
familiar to CAD artists.

Note that Face and Volume share the same icon (circle). This is
deliberate since they communicate a similar functionality - are not
aimed at precision snapping the same way the vertex or perpendicular
are.

Also note that later we should also try to change the icons shown in
the snap menu to match the symbols that the artists see in the preview
window.

———

On the decision process:

The version currently in main (and rolled back here) was an initial
attempt of aggregating more information to the icons (e.g., by aligning
the icons to the target edges) while making them more suitable to
Blender. After presenting both options to (parts of the) community,
there was nothing fundamentally broken found with either option, though
options diverged over personal preference.

With that in mind, in the latest UI module meeting it was agreed to use
the original proposal then.

This final call was proposed by Dalai Felinto on his role of
commissioner (stakeholder) for the snap polishing tasks (#73993) and
designer for the related Snap Base design #66484.

———

This commit reverts commit 9c2e768f5b.

The reverted icons (referred originally as minimalistic icons) may be
proposed later as a separate theme option.
2023-09-27 16:59:16 -03:00
Hans Goudey 867f99c2af Cleanup: Move depsgraph headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/110816
2023-09-22 03:18:17 +02:00
Germano Cavalcante da510b0d73 Cleanup: Remove unused variable
`rna_enum_snap_element_items` is no longer used since 932baa18b7.
2023-08-25 17:29:28 -03:00
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Jacques Lucke cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00
Aras Pranckevicius d973355b3a Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).

However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.

This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.

Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
  to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).

Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.

Pull Request #110944
2023-08-10 14:51:40 +03:00
Campbell Barton 1a675d0c47 Cleanup: format disabled code 2023-08-09 10:49:53 +10:00
Hans Goudey ffe4fbe832 Cleanup: Move editors headers to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110820
2023-08-05 02:57:52 +02:00
Hans Goudey c15d391e86 Cleanup: Various cleanups in newly C++ headers
Mostly remove unnecessary struct and typedef keywords.
Move a few more small wm headers to C++ as well.
2023-08-04 17:55:14 -04:00
Hans Goudey bc8c892c65 Cleanup: Move WM headers to C++
Also move a few more headers that included WM headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/110815
2023-08-04 23:11:22 +02:00
Campbell Barton c0f87d04c7 Cleanup: use const array arguments 2023-08-01 15:46:26 +10:00
Campbell Barton 52acf6a6ec Cleanup: correct file names in comments after C -> C++ renaming
Use back-tick quotes to differentiate these from plain text.
2023-07-31 13:02:30 +10: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
Campbell Barton 302887c619 Cleanup: use boolean literals in source/
Apply clang-tidy modernize-use-bool-literals to source/.
2023-07-22 11:43:01 +10:00
Ray molenkamp 19422044ed Cleanup: CMake: Modernize bf_bmesh dependencies
Pretty straightforward

- Remove any bmesh paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110363
2023-07-22 02:05:21 +02:00
Ray Molenkamp 0f541db97c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110350
2023-07-21 18:37:30 +02:00
Ray molenkamp be516e8c81 Cleanup: CMake: Modernize bf_blentranslation dependencies
Pretty straightforward:

- Remove any blentranslation paths from INC
- Add a dependency though LIB when needed

Slightly different than usual:

blentranslation still had a dependency on imbuf, from a time long
gone, cleaned that up since I was in the area

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110324
2023-07-21 16:22:10 +02:00
Ray molenkamp 3e88a2f44c Cleanup: CMake: Modernize bf_depsgraph dependencies
Pretty straightforward

- Remove any depsgraph paths from INC
- Add a dependency though LIB when needed

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110317
2023-07-20 22:13:00 +02:00
Ray molenkamp 4e64b772f5 Cleanup: CMake: Modernize bf_windowmanager dependencies
Pretty straightforward

- Remove any windowmanager paths from INC
- Add a dependency though LIB when needed

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/109984
2023-07-20 18:52:52 +02:00
Campbell Barton 246292f486 Cleanup: various non-functional changes (mainly for C++)
- Remove redundant void, struct.
- Remove redundant parenthesis.
- Use STR_ELEM(..)
- Use function style casts.
2023-07-20 11:55:34 +10:00
Campbell Barton 08f4f1f41e Cleanup: spelling in comments, capitalize tags 2023-07-20 09:42:00 +10:00
Jacques Lucke 3525a0c070 Editors: move code to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110267
2023-07-19 18:37:21 +02:00
Ray molenkamp 07fe6c5a57 Cleanup: CMake: Modernize bf_blenkernel dependencies
Pretty straightforward

- Remove any blenkernel paths from INC
- Add a dependency though LIB

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/109939
2023-07-11 19:28:01 +02:00
Ray Molenkamp 04235d0e55 Cleanup: CMake: Modernize bf_blenlib dependencies
Pretty straightforward

- Remove any blenlib paths from INC
- Add a dependency though LIB

Pull Request: https://projects.blender.org/blender/blender/pulls/109934
2023-07-10 22:04:18 +02:00
Ray Molenkamp 57ad866d81 Cleanup: CMake: Modernize bf_guardedalloc dependencies
Pretty straightforward

- Removes any guardedalloc paths from INC
- Adds a dependency though LIB

Pull Request: https://projects.blender.org/blender/blender/pulls/109925
2023-07-10 18:44:19 +02:00