Cleanup: Use CustomIDVectorSet for operator types

Missing from c2fd4eb9cc.
This commit is contained in:
Hans Goudey
2025-03-24 12:27:49 -04:00
parent c40afd4225
commit aa1449bbae

View File

@@ -50,36 +50,16 @@ static void wm_operatortype_free_macro(wmOperatorType *ot);
using blender::StringRef;
struct OperatorTypePointerHash {
uint64_t operator()(const wmOperatorType *value) const
{
return get_default_hash(StringRef(value->idname));
}
uint64_t operator()(const StringRef name) const
{
return get_default_hash(name);
}
};
struct OperatorTypePointerNameEqual {
bool operator()(const wmOperatorType *a, const wmOperatorType *b) const
{
return STREQ(a->idname, b->idname);
}
bool operator()(const StringRef idname, const wmOperatorType *a) const
{
return a->idname == idname;
}
};
static auto &get_operators_map()
{
struct OperatorNameGetter {
StringRef operator()(const wmOperatorType *value) const
{
return StringRef(value->idname);
}
};
static auto map = []() {
blender::VectorSet<wmOperatorType *,
blender::DefaultProbingStrategy,
OperatorTypePointerHash,
OperatorTypePointerNameEqual>
map;
blender::CustomIDVectorSet<wmOperatorType *, OperatorNameGetter> map;
/* Reserve size is set based on blender default setup. */
map.reserve(2048);
return map;