Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "SubObjectLocator.h"
|
|
|
|
|
#include "Modules/ModuleManager.h"
|
|
|
|
|
#include "IUniversalObjectLocatorModule.h"
|
|
|
|
|
#include "UniversalObjectLocatorFragment.h"
|
2023-11-22 12:02:21 -05:00
|
|
|
#include "UniversalObjectLocatorRegistry.h"
|
|
|
|
|
#include "UniversalObjectLocatorParameterTypeHandle.h"
|
Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
//#include "Modules/VisualizerDebuggingState.h"
|
|
|
|
|
#include "Containers/Ticker.h"
|
2023-11-28 11:19:12 -05:00
|
|
|
#include "Misc/DelayedAutoRegister.h"
|
Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
|
|
|
|
|
#include "DirectPathObjectLocator.h"
|
|
|
|
|
|
|
|
|
|
namespace UE::UniversalObjectLocator
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class FUniversalObjectLocatorModule
|
|
|
|
|
: public IUniversalObjectLocatorModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
void StartupModule() override
|
|
|
|
|
{
|
2023-11-28 11:19:12 -05:00
|
|
|
// Register fragment types as soon as the object system is ready
|
|
|
|
|
FDelayedAutoRegisterHelper(EDelayedRegisterRunPhase::ObjectSystemReady,
|
|
|
|
|
[this]
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
FFragmentTypeParameters FragmentTypeParams("subobj", NSLOCTEXT("SubObjectLocator", "Object", "Object"));
|
|
|
|
|
FragmentTypeParams.PrimaryEditorType = "SubObject";
|
|
|
|
|
FSubObjectLocator::FragmentType = this->RegisterFragmentType<FSubObjectLocator>(FragmentTypeParams);
|
|
|
|
|
}
|
Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
|
2023-11-28 11:19:12 -05:00
|
|
|
{
|
|
|
|
|
FFragmentTypeParameters FragmentTypeParams("uobj", NSLOCTEXT("DirectPathObjectLocator", "Object", "Object"));
|
|
|
|
|
FDirectPathObjectLocator::FragmentType = this->RegisterFragmentType<FDirectPathObjectLocator>(FragmentTypeParams);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
|
|
|
|
|
TickerDelegate = FTSTicker::GetCoreTicker().AddTicker(
|
|
|
|
|
FTickerDelegate::CreateRaw(this, &FUniversalObjectLocatorModule::PurgeVisualizers), 60.f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShutdownModule() override
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FFragmentTypeHandle RegisterFragmentTypeImpl(const FFragmentType& FragmentType) override
|
|
|
|
|
{
|
2023-11-22 12:02:21 -05:00
|
|
|
FRegistry& Registry = FRegistry::Get();
|
|
|
|
|
|
|
|
|
|
const int32 Index = Registry.FragmentTypes.Num();
|
|
|
|
|
Registry.FragmentTypes.Add(FragmentType);
|
Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
checkf(Index < static_cast<int32>(std::numeric_limits<uint8>::max()), TEXT("Maximum number of UOL FragmentTypes reached"));
|
|
|
|
|
|
|
|
|
|
// @todo: enable this code once visualizer debugging state is enabled
|
|
|
|
|
// Re-assign the debugging ptr in case it changed
|
2023-11-22 12:02:21 -05:00
|
|
|
// UE::Core::FVisualizerDebuggingState::Assign("UOL", Registry.FragmentTypes.GetData());
|
Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
|
|
|
|
|
return FFragmentTypeHandle(static_cast<uint8>(Index));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UnregisterFragmentTypeImpl(FFragmentTypeHandle FragmentType) override
|
|
|
|
|
{
|
2023-11-22 12:02:21 -05:00
|
|
|
FRegistry::Get().FragmentTypes[FragmentType.GetIndex()] = FFragmentType{};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FParameterTypeHandle RegisterParameterTypeImpl(UScriptStruct* Struct)
|
|
|
|
|
{
|
|
|
|
|
FRegistry& Registry = FRegistry::Get();
|
|
|
|
|
|
|
|
|
|
const int32 Index = Registry.ParameterTypes.Num();
|
|
|
|
|
Registry.ParameterTypes.Add(Struct);
|
|
|
|
|
|
|
|
|
|
checkf(Index < FResolveParameterBuffer::MaxNumParameters, TEXT("Maximum number of UOL ParameterTypes reached"));
|
|
|
|
|
|
|
|
|
|
return FParameterTypeHandle(static_cast<uint8>(Index));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UnregisterParameterTypeImpl(FParameterTypeHandle ParameterType)
|
|
|
|
|
{
|
|
|
|
|
FRegistry& Registry = FRegistry::Get();
|
|
|
|
|
check(ParameterType.IsValid());
|
|
|
|
|
Registry.ParameterTypes[ParameterType.GetIndex()] = nullptr;
|
Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PurgeVisualizers(float) const
|
|
|
|
|
{
|
2023-11-22 12:02:21 -05:00
|
|
|
for (FFragmentType& FragmentType : FRegistry::Get().FragmentTypes)
|
Added initial draft of Universal Object Locator mechanism
Universal Object Locators (UOLs) are designed to support referencing objects that don't fit neatly into a basic outer->inner path representation. Examples might include transient actors, dynamically created objects, or objects that need to be referenced by an external ID or using external lookup logic. Specifically this might be an object spawned by Sequencer, a transient object on a USD stage, or a gameplay-specific object created by a game system.
A UOL comprises zero or more 'fragments': atomic pieces of data and logic that defines how to lookup or load an object based on a context. Fragment types are globally registered as part of module initialization.
UOLs are hashable, and support string conversion that conforms to RFC3986 so they can be used as URIs (though that is not a current use-case). In order to support this type of string conversion, the 'path' part of of a UOL defines the fragment types, and the query string is used to encode the payload data for each fragment. This allows us to support a more diverse set of characters as part of payload strings (ie, / : and .) which are otherwise unsupported as part of the path.
An example UOL to an anim instance might look like: uobj://actor/subobj/animinst?payload0=/Path/To/Package.LevelName:PathToActor&payload1=ComponentName
#rb david.bromberg, ludovic.chabant, Max.Chen
[CL 29714989 by andrew rodham in ue5-main branch]
2023-11-14 11:31:58 -05:00
|
|
|
{
|
|
|
|
|
if (FragmentType.DebuggingAssistant)
|
|
|
|
|
{
|
|
|
|
|
FragmentType.DebuggingAssistant->Purge();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FTSTicker::FDelegateHandle TickerDelegate;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace UE::UniversalObjectLocator
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(UE::UniversalObjectLocator::FUniversalObjectLocatorModule, UniversalObjectLocator);
|
|
|
|
|
|