MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / defineListFromPython

Function defineListFromPython

Source/Falcor/Core/API/PythonHelpers.cpp:101–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101DefineList defineListFromPython(const pybind11::dict& dict)
102{
103 DefineList defines;
104 for (const auto& [key, value] : dict)
105 {
106 if (!pybind11::isinstance<pybind11::str>(key))
107 FALCOR_THROW("Define key must be a string.");
108 auto keyStr = key.cast<std::string>();
109 if (pybind11::isinstance<pybind11::str>(value))
110 defines.add(keyStr, value.cast<std::string>());
111 else if (pybind11::isinstance<pybind11::bool_>(value))
112 defines.add(keyStr, value.cast<bool>() ? "1" : "0");
113 else if (pybind11::isinstance<pybind11::int_>(value))
114 defines.add(keyStr, std::to_string(value.cast<int64_t>()));
115 else
116 FALCOR_THROW("Define value for key '{}' must be a string, bool, or int.", keyStr);
117 }
118 return defines;
119}
120
121pybind11::dict typeConformanceListToPython(const TypeConformanceList& conformances)
122{

Callers 3

FALCOR_SCRIPT_BINDINGFunction · 0.85
FALCOR_SCRIPT_BINDINGFunction · 0.85
FALCOR_SCRIPT_BINDINGFunction · 0.85

Calls 2

to_stringFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected