MCPcopy Create free account
hub / github.com/Prograda/Skybolt / PyComponent

Method PyComponent

src/Skybolt/SkyboltPythonBindings/PyComponent.cpp:27–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27PyComponent::PyComponent(py::object pythonComponent) :
28 mPythonComponent(std::move(pythonComponent))
29{
30 EngineRoot* engine = getGlobalEngineRoot();
31 if (!engine)
32 {
33 throw std::runtime_error("Global EngineRoot not instantiated");
34 }
35
36 refl::TypeRegistry* typeRegistry = engine->typeRegistry.get();
37
38 auto properties = getRequiredAttr(mPythonComponent, "properties");
39 mPropertiesDict = properties.attr("__dict__");
40 for (const auto& [name, property] : mPropertiesDict)
41 {
42 addProperty(*typeRegistry, py::cast<std::string>(name), property);
43 }
44}
45
46PyComponent::~PyComponent() = default;
47

Callers

nothing calls this directly

Calls 3

getGlobalEngineRootFunction · 0.85
getRequiredAttrFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected