Example #1
0
void Renderer::pyHandleCustomCtorArgs(py::tuple& args, py::dict& kw){
	if(py::len(kw)>0){
		string keys; py::list k(kw.keys());
		for(int i=0; i<py::len(k); i++) keys+=(i>0?", ":"")+py::extract<string>(k[i])();
		Master().instance().checkApi(10102,"Constructing Renderer with keywords ("+keys+") will have no effect unless passed to GlSetup/S.gl.",/*pyWarn*/true);
	}
}
Example #2
0
ArgList::ArgList(const ArgList& argTemplates, const py::dict& PyDict)
{
    // TODO: Check if all required args are being set.
    copyArgsFrom(argTemplates);
    py::list keys = PyDict.keys();
    int nKeys = py::len(keys);
    for (int i = 0; i < nKeys; i++)
    {
        py::object keyObj = keys[i];
        py::object valObj = PyDict[keyObj];
        
        py::extract<string> keyStrProxy(keyObj);
        if (!keyStrProxy.check()) {
            throw Exception(AVG_ERR_INVALID_ARGS, "Argument name must be a string.");
        }
        string keyStr = keyStrProxy();

        setArgValue(keyStr, valObj);
    }
}