MCPcopy Create free account
hub / github.com/Norbyte/ositools / FindComponentByNameGuid

Function FindComponentByNameGuid

OsiInterface/Functions/FunctionUtilities.cpp:95–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93 }
94
95 void * FindComponentByNameGuid(ComponentType componentType, std::string const & nameGuid, bool logError)
96 {
97 auto stringPtr = NameGuidToFixedString(nameGuid);
98 if (stringPtr == nullptr) {
99 OsiError("Could not map GUID '" << nameGuid << "' to FixedString");
100 return nullptr;
101 }
102
103 auto entityWorld = GetEntityWorld();
104 if (entityWorld == nullptr) {
105 return nullptr;
106 }
107
108 FixedString fs;
109 fs.Str = stringPtr;
110
111 auto component = entityWorld->Components.Buf[(uint32_t)componentType].component->FindComponentByGuid(&fs);
112 if (component != nullptr) {
113 return component;
114 } else {
115 if (logError) {
116 OsiError("No " << (uint32_t)componentType << " component found with GUID '" << nameGuid << "'");
117 }
118 return nullptr;
119 }
120 }
121
122 void * FindComponentByHandle(ComponentType componentType, ObjectHandle const & handle, bool logError)
123 {

Callers 2

FindCharacterByNameGuidFunction · 0.85
FindItemByNameGuidFunction · 0.85

Calls 2

NameGuidToFixedStringFunction · 0.85
GetEntityWorldFunction · 0.85

Tested by

no test coverage detected