class

MClassRegistry

Module
Core
Header
#include "Core/MClassRegistry.h"
Namespace
Mowo

Type aliases

AliasDescription
using FNameResolver = MClass* (*)(FName name)Classes that exist on disk but are registered only when first needed (Visual Scripting: the class index knows the file, nothing has parsed it). A FindByName miss gives the resolver one chance to register the name; GetAllClasses first asks for every pending class, because a caller enumerating classes (a palette, a node catalogue) must see them all. Neither hook re-enters itself on the same thread.
using FPendingMaterializer = void (*)()

Constructors

SignatureNameDescription
MClassRegistry(const MClassRegistry&) = deleteMClassRegistry

Public functions

ReturnsNameDescription
MClassRegistry&Get
MClassRegistry&operator=
boolRegisterCalled by codegen's static-init for each MCLASS-annotated type.
boolUnregisterHot-reload path: drop every MClass whose pointer lives inside a module that is about to unload.
boolRegisterNamedData-driven classes have no C++ type, so no std::type_index to key on — Visual Script builds an MClass at runtime from a .vscript asset and registers it BY NAME here so SpawnActorByClass / FindByName resolve it like any codegen class.
boolUnregisterNamedDrop a previously RegisterNamed'd class.
size_tUnregisterAllInModuleDrop every MClass whose static instance lives inside the given module binary (handle from FModuleManager::GetModuleHandle).
boolIsClassInModuleTrue when the MClass static instance lives inside the given module binary — the hot-reload orchestrator's actor filter.
MClass*FindLookup.
MClass*FindByNameName lookup — MClass::GetSuperClass() resolves superClassName through this (the super's MClass instance lives in another TU / module, so codegen can't link the pointer at static init).
MClass*FindForType
size_tNum
uint32_tRevisionMoves on every change to the set of classes (register, unregister, a module dropping its classes).
std::vector<MClass*>GetAllClassesSnapshot of every registered MClass (codegen + named/synthetic).
uint32_tEpochThe same counter as Revision(), under the name MObject::GetClass keys its per-object cache on.
voidSetLazyHooks

Function details

MClassRegistry

C++
MClassRegistry(const MClassRegistry&) = delete

Get

C++
static MClassRegistry& Get()

operator=

C++
MClassRegistry& operator=(const MClassRegistry&) = delete

Register

C++
bool Register(std::type_index typeId, MClass* cls)

Called by codegen's static-init for each MCLASS-annotated type. Returns true on insert; false for nullptr or a duplicate typeid (two MCLASS-annotated headers for the same C++ type — invalid input, first registration wins).

Unregister

C++
bool Unregister(std::type_index typeId)

Hot-reload path: drop every MClass whose pointer lives inside a module that is about to unload.

RegisterNamed

C++
bool RegisterNamed(FName name, MClass* cls)

Data-driven classes have no C++ type, so no std::type_index to key on — Visual Script builds an MClass at runtime from a .vscript asset and registers it BY NAME here so SpawnActorByClass / FindByName resolve it like any codegen class. The registry does NOT own the MClass (the caller, e.g. VisualScriptClassRegistry, owns the storage). FindByName searches these too. Fails on a name already taken (by a codegen or another named class).

UnregisterNamed

C++
bool UnregisterNamed(FName name)

Drop a previously RegisterNamed'd class. Returns true if removed.

UnregisterAllInModule

C++
size_t UnregisterAllInModule(void* moduleHandle)

Drop every MClass whose static instance lives inside the given module binary (handle from FModuleManager::GetModuleHandle). Attribution is by ADDRESS — generated MClass instances are statics in the module's .refl.cpp TUs, so their addresses fall inside the module image. Call BEFORE the library is freed. Also clears cached superClass links pointing into the dropped set (other modules' classes may have lazily linked to them). Returns the number of classes dropped.

IsClassInModule

C++
static bool IsClassInModule(const MClass* cls, void* moduleHandle)

True when the MClass static instance lives inside the given module binary — the hot-reload orchestrator's actor filter.

Find

C++
MClass* Find(std::type_index typeId) const

Lookup. Returns nullptr if not registered.

FindByName

C++
MClass* FindByName(FName name) const

Name lookup — MClass::GetSuperClass() resolves superClassName through this (the super's MClass instance lives in another TU / module, so codegen can't link the pointer at static init). Linear scan over the registry: called once per class thanks to the GetSuperClass cache, and the registry is small (tens of classes). Returns nullptr if not registered.

FindForType

C++
template<typename T> MClass* FindForType() const

Num

C++
size_t Num() const

Revision

C++
uint32_t Revision() const

Moves on every change to the set of classes (register, unregister, a module dropping its classes). A caller caching name lookups — Visual Scripting resolves a reflected call by name on every invocation — keys its cache on this, because a hot-reloaded module frees the FMFunctionInfo a stale entry would still point at.

GetAllClasses

C++
std::vector<MClass*> GetAllClasses() const

Snapshot of every registered MClass (codegen + named/synthetic). Copies the pointer set under the shared lock; the MClass instances are static (codegen) or owner-managed (named), so the pointers stay valid until module unload.

Epoch

C++
uint32_t Epoch() const

The same counter as Revision(), under the name MObject::GetClass keys its per-object cache on. Never 0, so a zeroed cache stamp never matches.

SetLazyHooks

C++
void SetLazyHooks(FNameResolver resolver, FPendingMaterializer materializer)
Generated from Core/MClassRegistry.h via core.json · Nov 5, 2026Version 1.0.0