* Move colorband and theme DNA to own headers
* Move some anim, curve, modifier and space enums to new headers
* Move data transfer enums to DNA
* Duplicate imbuf proxy and GPU backend enums
For a few reasons:
* Reduce number of includes in DNA headers
* Don't define enums used in DNA outside of DNA
* Move theme settings to separate header for userdef_default_theme.c
* Prepare for using default initializers in DNA headers. (#134531)
Pull Request: https://projects.blender.org/blender/blender/pulls/138831
This PR intends to replace the current face corner normals calculation.
Compared to the existing code it has a few benefits:
- It's much easier to understand.
- It doesn't require edges, ideally helping to remove them from caches
and eventually to make them optional.
- It is completely multithreaded using the vert to face map, which is
already used for vertex normals and domain interpolation. The previous
code has a significant single threaded portion that scales with the
size of the mesh.
- Lower peak memory usage: It doesn't require a temporary edge to corner
map, the corner to face map, or a corner domain sized bit vector.
- The code sorting corners around a vertex should be easy to reuse.
- It's over twice as fast. On a test file with custom normals I observe
an overall FPS increase of 2.56x, from 37 to 95.
Pull Request: https://projects.blender.org/blender/blender/pulls/138013
* Remove `DEG_get_evaluated_object` in favor of `DEG_get_evaluated`.
* Remove `DEG_is_original_object` in favor of `DEG_is_original`.
* Remove `DEG_is_evaluated_object` in favor of `DEG_is_evaluated`.
Pull Request: https://projects.blender.org/blender/blender/pulls/138317
The corner-cost bias used when calculating the shortest path meant
the path could cross over itself.
Resolve by tagging vertices as well as edges to prevent stepping across
vertices used by edges that have been added to the heap.
Previously spell checker ignored text in single quotes however this
meant incorrect spelling was ignored in text where it shouldn't have
been.
In cases single quotes were used for literal strings
(such as variables, code & compiler flags),
replace these with back-ticks.
In cases they were used for UI labels,
replace these with double quotes.
In cases they were used to reference symbols,
replace them with doxygens symbol link syntax (leading hash).
Apply some spelling corrections & tweaks (for check_spelling_* targets).
It's safer to pass a type so that it can be checked if delete should be
used instead. Also changes a few void pointer casts to const_cast so that
if the data becomes typed it's an error.
Pull Request: https://projects.blender.org/blender/blender/pulls/137404
Prevent dissolve leaving duplicate faces when dissolving edges.
Also use the builtin reuse of duplicate faces provided by BM_face_join()
instead of doing it manually.
Ref: !137634
If `f_new` is a double of an existing face and the existing face is
being reused, then the existing face already has custom-data and
multi-res data and etc.
There's also a good case to be made that custom or multireas data on the
existing face might be that way because it was hand-edited by the user,
and therefore it's superior to anything we'd interpolate or copy from
faces being removed.
Change BM_faces_join() to not waste time doing that.
Ref: !137537
Every call to BM_faces_join and BM_faces_join_pair has been adjusted to
provide the new face pointer, and a BLI_assert_msg has been added so
that doubles are now consistently identified and flagged as a problem.
BM_faces_join is now also capable of automatically reusing a double
when it is found. This new behavior is currently unused at this point.
Future patch-sets will begin to use it, allowing simplification of
calling functions.
Ref: !137406
This fixes most "One Definition Rule" violations inside blender proper
resulting from duplicate structures of the same name. The fixes were
made similar to that of !135491. See also #120444 for how this has come
up in the past.
These were found by using the following compile options:
-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
Note: There are still various ODR issues remaining that require
more / different fixes than what was done here.
Pull Request: https://projects.blender.org/blender/blender/pulls/136371
uv_select_all_perform had split the UV_SYNC_SELECTION
case into a separate block which complicated changes in this area.
Now each UV select function handles the sync-select case.
Also make UV's const when only used for comparison.
When sync select is enabled, the data layers aren't accessed
so there is no need to add them.
Also skip adding a "pin" layer when clearing pinned UV's.
The general idea is to keep the 'old', C-style MEM_callocN signature, and slowly
replace most of its usages with the new, C++-style type-safer template version.
* `MEM_cnew<T>` allocation version is renamed to `MEM_callocN<T>`.
* `MEM_cnew_array<T>` allocation version is renamed to `MEM_calloc_arrayN<T>`.
* `MEM_cnew<T>` duplicate version is renamed to `MEM_dupallocN<T>`.
Similar templates type-safe version of `MEM_mallocN` will be added soon
as well.
Following discussions in !134452.
NOTE: For now static type checking in `MEM_callocN` and related are slightly
different for Windows MSVC. This compiler seems to consider structs using the
`DNA_DEFINE_CXX_METHODS` macro as non-trivial (likely because their default
copy constructors are deleted). So using checks on trivially
constructible/destructible instead on this compiler/system.
Pull Request: https://projects.blender.org/blender/blender/pulls/134771
* Uses const where possible
* Joins declaration with assignment
* Use std::array where possible instead of C-style array
* Use float3 instead of C-style array for position and normal
* Reduces scope of variables where possible
Pull Request: https://projects.blender.org/blender/blender/pulls/135336
This commit changes usages of `GHash` inside `bmesh_log.cc` into their
equivalent `blender::Map` declarations and functions.
Additionally, some debug functions are put inside a NDEBUG section
instead of being kept in a broken state behind `#if 0`
Pull Request: https://projects.blender.org/blender/blender/pulls/135276
- Refactor tagging logic into a function to remove duplicate code
The two phases of tagging were identical logic just with the variables
and tag values swapped. This change ensures the two loops use matching
behavior.
- Adjust iteration to prevent restarting from the beginning of the mesh
after each island.
- Simplify and speed iteration tests.
testing to ensure v->e is non-null is redundant - verts with no edges
would never have passed `bm_vert_dissolve_fan_test` in the first
place, so can't be tagged as `VERT_INDEX_INIT`.
Re-testing `bm_vert_dissolve_fan_test(v)` is redundant - it was
checked above, and during tagging, the topology does not change.
Topology only changes later, after tagging is complete.
Therefore it's guaranteed to return the same result as the first time.
- Simplify loop logic, rename vars for clarity
offset and nth were constants, and depth was what causes alternation.
However none of that math is necessary - it can simply be done with
call order.
'seek_a' and 'seek_b' were renamed to what they actually are - lists
of verts that are tagged for collapse and ignore, respectively.
Further, by checking if any verts were tagged during the first
iteration pass, the second iteration pass can be avoided entirely if
it will perform no work.
Ref: !135212
The existing behavior of the grid fill operator requires a loop of
boundary or wire edges to be selected. This algorithm tries to fit a
grid of quads into the edge loop. It also works if you select two of the
four 'rails' of an edge loop.
This new behavior allows running grid fill after selecting faces.
If the algorithm sees that a set of faces are selected, it separates
all the faces, and then attempts to grid from their exterior boundary
using the exact same logic it normally uses for interior boundaries.
This all assumes the user has selected a set of faces with an outside
border that works with grid fill. (has one clear exterior loop with an
even number of edges) If not, grid fill will halt, and notify the user
of the error, exactly the way that it already did before.
Once the grid fill is complete and successful,
the existing faces which were replaced get deleted.
UVs (including at UV island boundaries) are interpolated properly,
as are custom-data on verts, edges, faces, and face corners.
At the edges of the selection, the edges/faces/face corners that are
selected contribute, but the custom-data outside the selection does not.
This also resolves non-deterministic behavior.
The previous behavior of `edbm_grid_fill_prepare` found the vertex with
the largest angle, then walked the edge loop until it found one out of
the three best remaining corners. This established one edge of the grid
area, and the second edge was found by symmetry.
However, the direction that the algorithm walked the loop
(and therefore which second corner was found) was essentially arbitrary.
The new behavior first finds the vert with the largest angle,
then finds the vert with the second largest angle,
(after excluding the diagonally opposite corner from the first vert),
and selects the edge between those two verts.
Ref !129318.
Previously we generally expected CustomData layers to have implicit
sharing info, but we didn't require it. This PR clarifies that we do
require layers with non-null data to have implicit sharing info. This
generally makes code simpler because we don't have to have a separate
code path for non-shared layers. For example, it makes the "totelem"
arguments for layer freeing functions unnecessary, since shared data
knows how to free itself. Those arguments are removed in this PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/134578
Replace `const char *` with `StringRef` for the API in `BKE_attribute.h`.
The benefits are slightly simpler code and possibly slightly improved
performance through avoiding the need to measure string length.
Pull Request: https://projects.blender.org/blender/blender/pulls/134183