MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / IsAssignableFrom

Function IsAssignableFrom

Source/Engine/AI/BehaviorTreeNodes.cpp:22–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#include "Engine/Serialization/Serialization.h"
21
22bool IsAssignableFrom(const StringAnsiView& to, const StringAnsiView& from)
23{
24 // Special case of null
25 if (to.IsEmpty())
26 return from.IsEmpty();
27 if (from.IsEmpty())
28 return false;
29
30 // Exact typename math
31 if (to == from)
32 return true;
33
34 // Scripting Type match
35 const ScriptingTypeHandle typeHandleTo = Scripting::FindScriptingType(to);
36 const ScriptingTypeHandle typeHandleFrom = Scripting::FindScriptingType(from);
37 if (typeHandleTo && typeHandleFrom)
38 return typeHandleTo.IsAssignableFrom(typeHandleFrom);
39
40#if USE_CSHARP
41 // MClass match
42 const auto mclassTo = Scripting::FindClass(to);
43 const auto mclassFrom = Scripting::FindClass(from);
44 if (mclassTo && mclassFrom)
45 return mclassTo == mclassFrom || mclassFrom->IsSubClassOf(mclassTo);
46#endif
47
48 return false;
49}
50
51BehaviorUpdateResult BehaviorTreeNode::InvokeUpdate(const BehaviorUpdateContext& context)
52{

Callers 2

UpdateMethod · 0.85
IsInstanceOfTypeMethod · 0.85

Calls 5

FindScriptingTypeFunction · 0.85
FindClassFunction · 0.85
IsEmptyMethod · 0.45
IsAssignableFromMethod · 0.45
IsSubClassOfMethod · 0.45

Tested by

no test coverage detected