diff options
author | Ton Roosendaal <ton@blender.org> | 2018-04-19 18:34:44 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-19 18:35:25 +0300 |
commit | 51b796ff1528c52cc8b4079fab1003671652a4d9 (patch) | |
tree | 0dfc2d2dabe5e77959264f5b6667897569290a41 /source/blender/python | |
parent | 785e8a636a293941a4295e669cb5aeecfafae039 (diff) |
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/gpu.c | 245 | ||||
-rw-r--r-- | source/blender/python/intern/gpu_offscreen.c | 2 |
2 files changed, 1 insertions, 246 deletions
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index a7a0ae78f26..06f3143ec46 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -55,7 +55,7 @@ #define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, # name, name) PyDoc_STRVAR(M_gpu_doc, -"This module provides access to the GLSL shader and Offscreen rendering functionalities." +"This module provides access to GPU offscreen rendering, matrix stacks and selection." ); static struct PyModuleDef gpumodule = { PyModuleDef_HEAD_INIT, @@ -74,251 +74,10 @@ static PyObject *PyInit_gpu(void) if (m == NULL) return NULL; - /* Take care to update docs when editing: 'doc/python_api/rst/gpu.rst' */ - - - /* -------------------------------------------------------------------- */ - /* GPUDynamicType */ - - /* device constant groups */ - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_MISC); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_LAMP); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_OBJECT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_SAMPLER); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_MIST); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_WORLD); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_MAT); - - /* device constants */ - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_NONE); - /* GPU_DYNAMIC_GROUP_OBJECT */ - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_VIEWMAT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_MAT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_VIEWIMAT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_IMAT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_LOCTOVIEWMAT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_LOCTOVIEWIMAT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_COLOR); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE); - /* GPU_DYNAMIC_GROUP_LAMP */ - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNVEC); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNCO); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNIMAT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNPERSMAT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNENERGY); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNCOL); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_ATT1); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_ATT2); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DISTANCE); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTSIZE); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTBLEND); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTSCALE); - /* GPU_DYNAMIC_GROUP_SAMPLER */ - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DBUFFER); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DIMAGE); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DSHADOW); - /* GPU_DYNAMIC_GROUP_MIST */ - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_ENABLE); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_START); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_DISTANCE); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_INTENSITY); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_TYPE); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_COLOR); - /* GPU_DYNAMIC_GROUP_WORLD */ - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_HORIZON_COLOR); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_AMBIENT_COLOR); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_ZENITH_COLOR); - /* GPU_DYNAMIC_GROUP_MAT */ - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_DIFFRGB); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_REF); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_SPECRGB); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_SPEC); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_HARD); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_EMIT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_AMB); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_ALPHA); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_MIR); - - - /* -------------------------------------------------------------------- */ - /* GPUDataType */ - - PY_MODULE_ADD_CONSTANT(m, GPU_DATA_1I); - PY_MODULE_ADD_CONSTANT(m, GPU_DATA_1F); - PY_MODULE_ADD_CONSTANT(m, GPU_DATA_2F); - PY_MODULE_ADD_CONSTANT(m, GPU_DATA_3F); - PY_MODULE_ADD_CONSTANT(m, GPU_DATA_4F); - PY_MODULE_ADD_CONSTANT(m, GPU_DATA_9F); - PY_MODULE_ADD_CONSTANT(m, GPU_DATA_16F); - PY_MODULE_ADD_CONSTANT(m, GPU_DATA_4UB); - - - /* -------------------------------------------------------------------- */ - /* CustomDataType - * - * Intentionally only include the subset used by the GPU API. - */ - PY_MODULE_ADD_CONSTANT(m, CD_MTFACE); - PY_MODULE_ADD_CONSTANT(m, CD_ORCO); - PY_MODULE_ADD_CONSTANT(m, CD_TANGENT); - PY_MODULE_ADD_CONSTANT(m, CD_MCOL); return m; } -#define PY_DICT_ADD_STRING(d, s, f) \ - val = PyUnicode_FromString(s->f); \ - PyDict_SetItemString(d, # f, val); \ - Py_DECREF(val) - -#define PY_DICT_ADD_LONG(d, s, f) \ - val = PyLong_FromLong(s->f); \ - PyDict_SetItemString(d, # f, val); \ - Py_DECREF(val) - -#define PY_DICT_ADD_ID(d, s, f) \ - RNA_id_pointer_create((struct ID *)s->f, &tptr); \ - val = pyrna_struct_CreatePyObject(&tptr); \ - PyDict_SetItemString(d, # f, val); \ - Py_DECREF(val) - -#if 0 /* UNUSED */ -#define PY_OBJ_ADD_ID(d, s, f) \ - val = PyUnicode_FromString(&s->f->id.name[2]); \ - PyObject_SetAttrString(d, # f, val); \ - Py_DECREF(val) - -#define PY_OBJ_ADD_LONG(d, s, f) \ - val = PyLong_FromLong(s->f); \ - PyObject_SetAttrString(d, # f, val); \ - Py_DECREF(val) - -#define PY_OBJ_ADD_STRING(d, s, f) \ - val = PyUnicode_FromString(s->f); \ - PyObject_SetAttrString(d, # f, val); \ - Py_DECREF(val) -#endif - -PyDoc_STRVAR(GPU_export_shader_doc, -"export_shader(scene, material)\n" -"\n" -" Returns the GLSL shader that produces the visual effect of material in scene.\n" -"\n" -" :return: Dictionary defining the shader, uniforms and attributes.\n" -" :rtype: Dict" -); -static PyObject *GPU_export_shader(PyObject *UNUSED(self), PyObject *args, PyObject *kw) -{ - PyObject *pyscene; - PyObject *pymat; - PyObject *result; - PyObject *dict; - PyObject *val; - PyObject *seq; - - int i; - Scene *scene; - PointerRNA tptr; - Material *material; - GPUShaderExport *shader; - GPUInputUniform *uniform; - GPUInputAttribute *attribute; - - static const char *_keywords[] = {"scene", "material", NULL}; - static _PyArg_Parser _parser = {"OO:export_shader", _keywords, 0}; - if (!_PyArg_ParseTupleAndKeywordsFast( - args, kw, &_parser, - &pyscene, &pymat)) - { - return NULL; - } - scene = (Scene *)PyC_RNA_AsPointer(pyscene, "Scene"); - if (scene == NULL) { - return NULL; - } - - material = (Material *)PyC_RNA_AsPointer(pymat, "Material"); - if (material == NULL) { - return NULL; - } - - /* we can call our internal function at last: */ - shader = GPU_shader_export(scene, material); - if (!shader) { - PyErr_SetString(PyExc_RuntimeError, "cannot export shader"); - return NULL; - } - /* build a dictionary */ - result = PyDict_New(); - if (shader->fragment) { - PY_DICT_ADD_STRING(result, shader, fragment); - } - if (shader->vertex) { - PY_DICT_ADD_STRING(result, shader, vertex); - } - seq = PyList_New(BLI_listbase_count(&shader->uniforms)); - for (i = 0, uniform = shader->uniforms.first; uniform; uniform = uniform->next, i++) { - dict = PyDict_New(); - PY_DICT_ADD_STRING(dict, uniform, varname); - PY_DICT_ADD_LONG(dict, uniform, datatype); - PY_DICT_ADD_LONG(dict, uniform, type); - if (uniform->lamp) { - PY_DICT_ADD_ID(dict, uniform, lamp); - } - if (uniform->material) { - PY_DICT_ADD_ID(dict, uniform, material); - } - if (uniform->image) { - PY_DICT_ADD_ID(dict, uniform, image); - } - if (uniform->type == GPU_DYNAMIC_SAMPLER_2DBUFFER || - uniform->type == GPU_DYNAMIC_SAMPLER_2DIMAGE || - uniform->type == GPU_DYNAMIC_SAMPLER_2DSHADOW) - { - PY_DICT_ADD_LONG(dict, uniform, texnumber); - } - if (uniform->texpixels) { - val = PyByteArray_FromStringAndSize((const char *)uniform->texpixels, uniform->texsize * 4); - PyDict_SetItemString(dict, "texpixels", val); - Py_DECREF(val); - PY_DICT_ADD_LONG(dict, uniform, texsize); - } - PyList_SET_ITEM(seq, i, dict); - } - PyDict_SetItemString(result, "uniforms", seq); - Py_DECREF(seq); - - seq = PyList_New(BLI_listbase_count(&shader->attributes)); - for (i = 0, attribute = shader->attributes.first; attribute; attribute = attribute->next, i++) { - dict = PyDict_New(); - PY_DICT_ADD_STRING(dict, attribute, varname); - PY_DICT_ADD_LONG(dict, attribute, datatype); - PY_DICT_ADD_LONG(dict, attribute, type); - PY_DICT_ADD_LONG(dict, attribute, number); - if (attribute->name) { - if (attribute->name[0] != 0) { - PY_DICT_ADD_STRING(dict, attribute, name); - } - else { - val = PyLong_FromLong(0); - PyDict_SetItemString(dict, "name", val); - Py_DECREF(val); - } - } - PyList_SET_ITEM(seq, i, dict); - } - PyDict_SetItemString(result, "attributes", seq); - Py_DECREF(seq); - - GPU_free_shader_export(shader); - - return result; -} - -static PyMethodDef meth_export_shader[] = { - {"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc} -}; - /* -------------------------------------------------------------------- */ /* Initialize Module */ @@ -330,8 +89,6 @@ PyObject *GPU_initPython(void) module = PyInit_gpu(); - PyModule_AddObject(module, "export_shader", (PyObject *)PyCFunction_New(meth_export_shader, NULL)); - /* gpu.offscreen */ PyModule_AddObject(module, "offscreen", (submodule = BPyInit_gpu_offscreen())); PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule); diff --git a/source/blender/python/intern/gpu_offscreen.c b/source/blender/python/intern/gpu_offscreen.c index cbfc712b331..a8ec828c13f 100644 --- a/source/blender/python/intern/gpu_offscreen.c +++ b/source/blender/python/intern/gpu_offscreen.c @@ -197,8 +197,6 @@ static PyObject *pygpu_offscreen_draw_view3d(BPy_GPUOffScreen *self, PyObject *a fx_settings = v3d->fx_settings; /* full copy */ - ED_view3d_draw_offscreen_init(scene, view_layer, v3d); - rv3d_mats = ED_view3d_mats_rv3d_backup(ar->regiondata); GPU_offscreen_bind(self->ofs, true); /* bind */ |