Blender V4.3
BKE_anonymous_attribute_make.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <fmt/format.h>
6#include <sstream>
7#include <xxhash.h>
8
9namespace blender::bke {
10
11template<typename... Args> inline std::string hash_to_anonymous_attribute_name(Args &&...args)
12{
13 std::stringstream ss;
14 ((ss << args), ...);
15 const std::string long_name = ss.str();
16 const XXH128_hash_t hash = XXH3_128bits(long_name.c_str(), long_name.size());
17 return fmt::format(".a_{:x}{:x}", hash.low64, hash.high64);
18}
19
20} // namespace blender::bke
std::string hash_to_anonymous_attribute_name(Args &&...args)
#define hash
Definition noise.c:154