Files
test2/source/blender/animrig/intern/action_runtime.hh
Brecht Van Lommel 920e709069 Refactor: Make header files more clangd and clang-tidy friendly
When using clangd or running clang-tidy on headers there are
currently many errors. These are noisy in IDEs, make auto fixes
impossible, and break features like code completion, refactoring
and navigation.

This makes source/blender headers work by themselves, which is
generally the goal anyway. But #includes and forward declarations
were often incomplete.

* Add #includes and forward declarations
* Add IWYU pragma: export in a few places
* Remove some unused #includes (but there are many more)
* Tweak ShaderCreateInfo macros to work better with clangd

Some types of headers still have errors, these could be fixed or
worked around with more investigation. Mostly preprocessor
template headers like NOD_static_types.h.

Note that that disabling WITH_UNITY_BUILD is required for clangd to
work properly, otherwise compile_commands.json does not contain
the information for the relevant source files.

For more details see the developer docs:
https://developer.blender.org/docs/handbook/tooling/clangd/

Pull Request: https://projects.blender.org/blender/blender/pulls/132608
2025-01-07 12:39:13 +01:00

58 lines
1.6 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup animrig
*
* \brief Internal C++ functions to deal with Actions, Slots, and their runtime data.
*/
#pragma once
#include "BLI_vector.hh"
struct ID;
struct Main;
namespace blender::animrig {
/**
* Not placed in the 'internal' namespace, as this type is forward-declared in
* DNA_action_types.h, and that shouldn't reference the internal namespace.
*/
class SlotRuntime {
public:
/**
* Cache of pointers to the IDs that are animated by this slot.
*
* Note that this is a vector for simplicity, as the majority of the slots
* will have zero or one user. Semantically it's treated as a set: order
* doesn't matter, and it has no duplicate entries.
*
* \note This is NOT thread-safe.
*/
Vector<ID *> users;
};
namespace internal {
/**
* Rebuild the #SlotRuntime::users cache of all Slots in all Action for a specific `bmain`.
*
* The reason that all slot users are re-cached at once is two-fold:
*
* 1. Regardless of how many slot caches are rebuilt, this function will need
* to loop over all IDs anyway.
* 2. Deletion of IDs may be hard to detect otherwise. This is a bit of a weak
* argument, as if this is not implemented properly (i.e. not un-assigning
* the Action first), the 'dirty' flag will also not be set, and thus a
* rebuild will not be triggered. In any case, because the rebuild is global,
* any subsequent call at least ensures correctness even with such bugs.
*/
void rebuild_slot_user_cache(Main &bmain);
} // namespace internal
} // namespace blender::animrig