Fix #123758: Viewport Render Animation doesn't track World updates
Viewport instances created by the Viewport Render Animation operator don't get `view_updated` notifications. Fix update detection by implementing a `last_update` timestamp for `World`, similar to the ones added in #115196. Pull Request: https://projects.blender.org/blender/blender/pulls/124114
This commit is contained in:
parent
c446813dd3
commit
b20bacf657
@ -144,8 +144,10 @@ static void world_blend_write(BlendWriter *writer, ID *id, const void *id_addres
|
||||
{
|
||||
World *wrld = (World *)id;
|
||||
|
||||
/* Clean up, important in undo case to reduce false detection of changed datablocks. */
|
||||
/* Clean up runtime data, important in undo case to reduce false detection of changed
|
||||
* datablocks. */
|
||||
BLI_listbase_clear(&wrld->gpumaterial);
|
||||
wrld->last_update = 0;
|
||||
|
||||
/* write LibData */
|
||||
BLO_write_id_struct(writer, World, id_address, &wrld->id);
|
||||
@ -226,4 +228,5 @@ void BKE_world_eval(Depsgraph *depsgraph, World *world)
|
||||
{
|
||||
DEG_debug_print_eval(depsgraph, __func__, world->id.name, world);
|
||||
GPU_material_free(&world->gpumaterial);
|
||||
world->last_update = DEG_get_update_count(depsgraph);
|
||||
}
|
||||
|
@ -175,7 +175,6 @@ void Instance::update_eval_members()
|
||||
void Instance::view_update()
|
||||
{
|
||||
sampling.reset();
|
||||
sync.view_update();
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -318,6 +318,11 @@ class Instance {
|
||||
return flags;
|
||||
}
|
||||
|
||||
int get_recalc_flags(const ::World &world)
|
||||
{
|
||||
return world.last_update > depsgraph_last_update_ ? ID_RECALC_SHADING : 0;
|
||||
}
|
||||
|
||||
private:
|
||||
static void object_sync_render(void *instance_,
|
||||
Object *ob,
|
||||
|
@ -34,13 +34,6 @@ namespace blender::eevee {
|
||||
*
|
||||
* \{ */
|
||||
|
||||
void SyncModule::view_update()
|
||||
{
|
||||
if (DEG_id_type_updated(inst_.depsgraph, ID_WO)) {
|
||||
world_updated_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
ObjectHandle &SyncModule::sync_object(const ObjectRef &ob_ref)
|
||||
{
|
||||
ObjectKey key(ob_ref.object);
|
||||
@ -56,11 +49,10 @@ ObjectHandle &SyncModule::sync_object(const ObjectRef &ob_ref)
|
||||
return handle;
|
||||
}
|
||||
|
||||
WorldHandle SyncModule::sync_world()
|
||||
WorldHandle SyncModule::sync_world(const ::World &world)
|
||||
{
|
||||
WorldHandle handle;
|
||||
handle.recalc = world_updated_ ? int(ID_RECALC_SHADING) : 0;
|
||||
world_updated_ = false;
|
||||
handle.recalc = inst_.get_recalc_flags(world);
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -155,16 +155,12 @@ class SyncModule {
|
||||
|
||||
Map<ObjectKey, ObjectHandle> ob_handles = {};
|
||||
|
||||
bool world_updated_ = false;
|
||||
|
||||
public:
|
||||
SyncModule(Instance &inst) : inst_(inst){};
|
||||
~SyncModule(){};
|
||||
|
||||
void view_update();
|
||||
|
||||
ObjectHandle &sync_object(const ObjectRef &ob_ref);
|
||||
WorldHandle sync_world();
|
||||
WorldHandle sync_world(const ::World &world);
|
||||
|
||||
void sync_mesh(Object *ob,
|
||||
ObjectHandle &ob_handle,
|
||||
|
@ -104,7 +104,7 @@ void World::sync()
|
||||
WorldHandle wo_handle = {0};
|
||||
if (inst_.scene->world != nullptr) {
|
||||
/* Detect world update before overriding it. */
|
||||
wo_handle = inst_.sync.sync_world();
|
||||
wo_handle = inst_.sync.sync_world(*inst_.scene->world);
|
||||
has_update = wo_handle.recalc != 0;
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,13 @@ typedef struct World {
|
||||
/** Light-group membership information. */
|
||||
struct LightgroupMembership *lightgroup;
|
||||
|
||||
void *_pad1;
|
||||
|
||||
/** Runtime. */
|
||||
ListBase gpumaterial;
|
||||
/* The Depsgraph::update_count when this World was last updated. */
|
||||
uint64_t last_update;
|
||||
|
||||
} World;
|
||||
|
||||
/* **************** WORLD ********************* */
|
||||
|
Loading…
Reference in New Issue
Block a user