diff options
-rw-r--r-- | source/blender/blenkernel/BKE_world.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/world.c | 6 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 19 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 12 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_flush.cc | 4 | ||||
-rw-r--r-- | source/blender/editors/render/render_update.c | 31 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 2 |
7 files changed, 32 insertions, 44 deletions
diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index 6a9a75828e5..eb0548c682e 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -33,6 +33,7 @@ * \author nzc */ +struct Depsgraph; struct Main; struct World; @@ -43,5 +44,6 @@ void BKE_world_copy_data(struct Main *bmain, struct World *wrld_dst, const struc struct World *BKE_world_copy(struct Main *bmain, const struct World *wrld); struct World *BKE_world_localize(struct World *wrld); void BKE_world_make_local(struct Main *bmain, struct World *wrld, const bool lib_local); +void BKE_world_eval(struct Depsgraph *depsgraph, struct World *world); #endif diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index a5a38a6dc12..110b933e67c 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -168,3 +168,9 @@ void BKE_world_make_local(Main *bmain, World *wrld, const bool lib_local) { BKE_id_make_local_generic(bmain, &wrld->id, true, lib_local); } + +void BKE_world_eval(struct Depsgraph *depsgraph, World *world) +{ + DEG_debug_print_eval(depsgraph, __func__, world->id.name, world); + GPU_material_free(&world->gpumaterial); +} diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index b2e46f3d8e9..e8e3e241ebf 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -975,17 +975,20 @@ void DepsgraphNodeBuilder::build_world(World *world) if (built_map_.checkIsBuiltAndTag(world)) { return; } - /* Animation. */ - build_animdata(&world->id); - /* world itself */ + /* World itself. */ + add_id_node(&world->id); + World *world_cow = get_cow_datablock(world); + /* Shading update. */ add_operation_node(&world->id, DEG_NODE_TYPE_SHADING, - NULL, + function_bind(BKE_world_eval, + _1, + world_cow), DEG_OPCODE_WORLD_UPDATE); - /* world's nodetree */ - if (world->nodetree != NULL) { - build_nodetree(world->nodetree); - } + /* Animation. */ + build_animdata(&world->id); + /* World's nodetree. */ + build_nodetree(world->nodetree); } /* Rigidbody Simulation - Scene Level */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 98a6a75d994..af6a0e7a1ad 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1510,14 +1510,18 @@ void DepsgraphRelationBuilder::build_world(World *world) if (built_map_.checkIsBuiltAndTag(world)) { return; } + /* animation */ build_animdata(&world->id); - /* TODO: other settings? */ /* world's nodetree */ if (world->nodetree != NULL) { build_nodetree(world->nodetree); - ComponentKey ntree_key(&world->nodetree->id, DEG_NODE_TYPE_SHADING); - ComponentKey world_key(&world->id, DEG_NODE_TYPE_SHADING); - add_relation(ntree_key, world_key, "NTree->World Shading Update"); + OperationKey ntree_key(&world->nodetree->id, + DEG_NODE_TYPE_SHADING, + DEG_OPCODE_MATERIAL_UPDATE); + OperationKey world_key(&world->id, + DEG_NODE_TYPE_SHADING, + DEG_OPCODE_MATERIAL_UPDATE); + add_relation(ntree_key, world_key, "World's NTree"); build_nested_nodetree(&world->id, world->nodetree); } } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index d84f1be4ee0..975723ef8a3 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -270,7 +270,9 @@ void flush_editors_id_update(Main *bmain, * TODO: image datablocks do not use COW, so might not be detected * correctly. */ if (deg_copy_on_write_is_expanded(id_cow)) { - deg_editors_id_update(update_ctx, id_orig); + if (graph->is_active) { + deg_editors_id_update(update_ctx, id_orig); + } /* ID may need to get its auto-override operations refreshed. */ if (ID_IS_STATIC_OVERRIDE_AUTO(id_orig)) { id_orig->tag |= LIB_TAG_OVERRIDESTATIC_AUTOREFRESH; diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 09d89e3b90f..c42eda678ba 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -58,8 +58,6 @@ #include "BKE_scene.h" #include "BKE_workspace.h" -#include "GPU_material.h" - #include "RE_engine.h" #include "RE_pipeline.h" @@ -73,8 +71,6 @@ #include "render_intern.h" // own include -extern Material defmaterial; - /***************************** Render Engines ********************************/ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int updated) @@ -244,22 +240,12 @@ static void material_changed(Main *UNUSED(bmain), Material *ma) { /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&ma->id)); - - /* glsl */ - if (ma->id.recalc & ID_RECALC) { - if (!BLI_listbase_is_empty(&ma->gpumaterial)) { - GPU_material_free(&ma->gpumaterial); - } - } } static void lamp_changed(Main *UNUSED(bmain), Lamp *la) { /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&la->id)); - - if (defmaterial.gpumaterial.first) - GPU_material_free(&defmaterial.gpumaterial); } static void texture_changed(Main *bmain, Tex *tex) @@ -271,15 +257,12 @@ static void texture_changed(Main *bmain, Tex *tex) /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&tex->id)); - /* paint overlays */ for (scene = bmain->scene.first; scene; scene = scene->id.next) { + /* paint overlays */ for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) { BKE_paint_invalidate_overlay_tex(scene, view_layer, tex); } - } - - /* find compositing nodes */ - for (scene = bmain->scene.first; scene; scene = scene->id.next) { + /* find compositing nodes */ if (scene->use_nodes && scene->nodetree) { for (node = scene->nodetree->nodes.first; node; node = node->next) { if (node->id == &tex->id) @@ -293,16 +276,6 @@ static void world_changed(Main *UNUSED(bmain), World *wo) { /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&wo->id)); - - /* glsl */ - if (wo->id.recalc & ID_RECALC) { - if (!BLI_listbase_is_empty(&defmaterial.gpumaterial)) { - GPU_material_free(&defmaterial.gpumaterial); - } - if (!BLI_listbase_is_empty(&wo->gpumaterial)) { - GPU_material_free(&wo->gpumaterial); - } - } } static void image_changed(Main *bmain, Image *ima) diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 41780033011..347b48bf321 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -84,8 +84,6 @@ # include "smoke_API.h" #endif -extern Material defmaterial; /* from material.c */ - //* Checking powers of two for images since OpenGL ES requires it */ #ifdef WITH_DDS static bool is_power_of_2_resolution(int w, int h) |