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/editors/render/render_update.c | |
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/editors/render/render_update.c')
-rw-r--r-- | source/blender/editors/render/render_update.c | 235 |
1 files changed, 14 insertions, 221 deletions
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 9ae103ae017..1864cb0af6a 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -59,9 +59,7 @@ #include "BKE_scene.h" #include "BKE_workspace.h" -#include "GPU_lamp.h" #include "GPU_material.h" -#include "GPU_buffers.h" #include "RE_engine.h" #include "RE_pipeline.h" @@ -145,20 +143,18 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update } else { - RenderEngineType *engine_type = RE_engines_find(win->scene->r.engine); - if ((engine_type->flag & RE_USE_LEGACY_PIPELINE) == 0) { - if (updated) { - DRW_notify_view_update( - (&(DRWUpdateContext){ - .bmain = bmain, - .depsgraph = update_ctx->depsgraph, - .scene = scene, - .view_layer = view_layer, - .ar = ar, - .v3d = (View3D *)sa->spacedata.first, - .engine_type = engine_type - })); - } + RenderEngineType *engine_type = RE_engines_find(scene->r.engine); + if (updated) { + DRW_notify_view_update( + (&(DRWUpdateContext){ + .bmain = bmain, + .depsgraph = update_ctx->depsgraph, + .scene = scene, + .view_layer = view_layer, + .ar = ar, + .v3d = (View3D *)sa->spacedata.first, + .engine_type = engine_type + })); } } } @@ -243,69 +239,8 @@ static void render_engine_flag_changed(Main *bmain, int update_flag) } } -static int mtex_use_tex(MTex **mtex, int tot, Tex *tex) +static void material_changed(Main *UNUSED(bmain), Material *ma) { - int a; - - if (!mtex) - return 0; - - for (a = 0; a < tot; a++) - if (mtex[a] && mtex[a]->tex == tex) - return 1; - - return 0; -} - -static int nodes_use_tex(bNodeTree *ntree, Tex *tex) -{ - bNode *node; - - for (node = ntree->nodes.first; node; node = node->next) { - if (node->id) { - if (node->id == (ID *)tex) { - return 1; - } - else if (GS(node->id->name) == ID_MA) { - if (mtex_use_tex(((Material *)node->id)->mtex, MAX_MTEX, tex)) - return 1; - } - else if (node->type == NODE_GROUP) { - if (nodes_use_tex((bNodeTree *)node->id, tex)) - return 1; - } - } - } - - return 0; -} - -static int nodes_use_material(bNodeTree *ntree, Material *ma) -{ - bNode *node; - - for (node = ntree->nodes.first; node; node = node->next) { - if (node->id) { - if (node->id == (ID *)ma) { - return 1; - } - else if (node->type == NODE_GROUP) { - if (nodes_use_material((bNodeTree *)node->id, ma)) - return 1; - } - } - } - - return 0; -} - -static void material_changed(Main *bmain, Material *ma) -{ - Material *parent; - Object *ob; - Scene *scene; - int texture_draw = false; - /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&ma->id)); @@ -315,86 +250,22 @@ static void material_changed(Main *bmain, Material *ma) GPU_material_free(&ma->gpumaterial); } } - - /* find node materials using this */ - for (parent = bmain->mat.first; parent; parent = parent->id.next) { - if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma)) { - /* pass */ - } - else { - continue; - } - - BKE_icon_changed(BKE_icon_id_ensure(&parent->id)); - - if (parent->gpumaterial.first) - GPU_material_free(&parent->gpumaterial); - } - - /* find if we have a scene with textured display */ - for (scene = bmain->scene.first; scene; scene = scene->id.next) { - if (scene->customdata_mask & CD_MASK_MTFACE) { - texture_draw = true; - break; - } - } - - /* find textured objects */ - if (texture_draw) { - for (ob = bmain->object.first; ob; ob = ob->id.next) { - DerivedMesh *dm = ob->derivedFinal; - Material ***material = give_matarar(ob); - short a, *totmaterial = give_totcolp(ob); - - if (dm && totmaterial && material) { - for (a = 0; a < *totmaterial; a++) { - if ((*material)[a] == ma) { - GPU_drawobject_free(dm); - break; - } - } - } - } - } - } -static void lamp_changed(Main *bmain, Lamp *la) +static void lamp_changed(Main *UNUSED(bmain), Lamp *la) { - Object *ob; - /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&la->id)); - /* glsl */ - for (ob = bmain->object.first; ob; ob = ob->id.next) - if (ob->data == la && ob->gpulamp.first) - GPU_lamp_free(ob); - if (defmaterial.gpumaterial.first) GPU_material_free(&defmaterial.gpumaterial); } -static int material_uses_texture(Material *ma, Tex *tex) -{ - if (mtex_use_tex(ma->mtex, MAX_MTEX, tex)) - return true; - else if (ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex)) - return true; - - return false; -} - static void texture_changed(Main *bmain, Tex *tex) { - Material *ma; - Lamp *la; - World *wo; Scene *scene; ViewLayer *view_layer; - Object *ob; bNode *node; - bool texture_draw = false; /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&tex->id)); @@ -406,48 +277,6 @@ static void texture_changed(Main *bmain, Tex *tex) } } - /* find materials */ - for (ma = bmain->mat.first; ma; ma = ma->id.next) { - if (!material_uses_texture(ma, tex)) - continue; - - BKE_icon_changed(BKE_icon_id_ensure(&ma->id)); - - if (ma->gpumaterial.first) - GPU_material_free(&ma->gpumaterial); - } - - /* find lamps */ - for (la = bmain->lamp.first; la; la = la->id.next) { - if (mtex_use_tex(la->mtex, MAX_MTEX, tex)) { - lamp_changed(bmain, la); - } - else if (la->nodetree && nodes_use_tex(la->nodetree, tex)) { - lamp_changed(bmain, la); - } - else { - continue; - } - } - - /* find worlds */ - for (wo = bmain->world.first; wo; wo = wo->id.next) { - if (mtex_use_tex(wo->mtex, MAX_MTEX, tex)) { - /* pass */ - } - else if (wo->nodetree && nodes_use_tex(wo->nodetree, tex)) { - /* pass */ - } - else { - continue; - } - - BKE_icon_changed(BKE_icon_id_ensure(&wo->id)); - - if (wo->gpumaterial.first) - GPU_material_free(&wo->gpumaterial); - } - /* find compositing nodes */ for (scene = bmain->scene.first; scene; scene = scene->id.next) { if (scene->use_nodes && scene->nodetree) { @@ -456,32 +285,6 @@ static void texture_changed(Main *bmain, Tex *tex) ED_node_tag_update_id(&scene->id); } } - - if (scene->customdata_mask & CD_MASK_MTFACE) - texture_draw = true; - } - - /* find textured objects */ - if (texture_draw) { - for (ob = bmain->object.first; ob; ob = ob->id.next) { - DerivedMesh *dm = ob->derivedFinal; - Material ***material = give_matarar(ob); - short a, *totmaterial = give_totcolp(ob); - - if (dm && totmaterial && material) { - for (a = 0; a < *totmaterial; a++) { - if (ob->matbits && ob->matbits[a]) - ma = ob->mat[a]; - else - ma = (*material)[a]; - - if (ma && material_uses_texture(ma, tex)) { - GPU_drawobject_free(dm); - break; - } - } - } - } } } @@ -526,7 +329,6 @@ static void scene_changed(Main *bmain, Scene *scene) if (ob->mode & OB_MODE_TEXTURE_PAINT) { BKE_texpaint_slots_refresh_object(scene, ob); BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); - GPU_drawobject_free(ob->derivedFinal); } } } @@ -568,12 +370,3 @@ void ED_render_id_flush_update(const DEGEditorUpdateContext *update_ctx, ID *id) } } - -void ED_render_internal_init(void) -{ - RenderEngineType *ret = RE_engines_find(RE_engine_id_BLENDER_RENDER); - - ret->view_update = render_view3d_update; - ret->render_to_view = render_view3d_draw; - -} |