Fix #104061: Python GPU module unusable after too early import
Add-ons may attempt to load the GPU module in background mode when no GPU
context has been initialized yet. This would give an error on import.
If then later the GPU context does get initialized, for example for a
render engine, import would still fail as the module is cached.
This reverts commit d7f124f06f, and again
throws errors in methods and constructors instead of module import.
Pull Request: https://projects.blender.org/blender/blender/pulls/123395
This commit is contained in:
committed by
Brecht Van Lommel
parent
eaeb8ba8cd
commit
da9f586748
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "../generic/python_compat.h"
|
||||
|
||||
#include "gpu_py.hh"
|
||||
#include "gpu_py_uniformbuffer.hh" /* own include */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -59,6 +60,8 @@ static PyObject *pygpu_uniformbuffer__tp_new(PyTypeObject * /*self*/,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
{
|
||||
BPYGPU_IS_INIT_OR_ERROR_OBJ;
|
||||
|
||||
GPUUniformBuf *ubo = nullptr;
|
||||
PyObject *pybuffer_obj;
|
||||
char err_out[256] = "unknown error. See console";
|
||||
|
||||
Reference in New Issue
Block a user