Merge branch 'blender-v4.2-release'

This also reverts da2a262658a396 and 57e925b38feb19b and fixes a
merge conflict in `action.cc`.
This commit is contained in:
Jacques Lucke 2024-07-05 18:15:59 +02:00
commit 5360722449
10 changed files with 34 additions and 26 deletions

@ -127,8 +127,12 @@ template<typename T> static void shrink_array(T **array, int *num, const int shr
bool Action::is_empty() const bool Action::is_empty() const
{ {
/* The check for emptyness has to include the check for an empty `groups` ListBase because of the
* animation filtering code. With the functions `rearrange_action_channels` and
* `join_groups_action_temp` the ownership of FCurves is temporarily transferred to the `groups`
* ListBase leaving `curves` potentially empty. */
return this->layer_array_num == 0 && this->slot_array_num == 0 && return this->layer_array_num == 0 && this->slot_array_num == 0 &&
BLI_listbase_is_empty(&this->curves); BLI_listbase_is_empty(&this->curves) && BLI_listbase_is_empty(&this->groups);
} }
bool Action::is_action_legacy() const bool Action::is_action_legacy() const
{ {
@ -140,7 +144,7 @@ bool Action::is_action_layered() const
/* This is a valid layered Action if there is ANY layered info (because that /* This is a valid layered Action if there is ANY layered info (because that
* takes precedence) or when there is no legacy info. */ * takes precedence) or when there is no legacy info. */
return this->layer_array_num > 0 || this->slot_array_num > 0 || return this->layer_array_num > 0 || this->slot_array_num > 0 ||
BLI_listbase_is_empty(&this->curves); (BLI_listbase_is_empty(&this->curves) && BLI_listbase_is_empty(&this->groups));
} }
blender::Span<const Layer *> Action::layers() const blender::Span<const Layer *> Action::layers() const

@ -275,14 +275,17 @@ void VolumeGridData::ensure_grid_loaded() const
}); });
if (!loaded_grid) { if (!loaded_grid) {
if (grid_) { if (grid_) {
/* Create a dummy grid of the expected type. */ const openvdb::Name &grid_type = grid_->type();
loaded_grid = grid_->createGrid(""); if (openvdb::GridBase::isRegistered(grid_type)) {
} /* Create a dummy grid of the expected type. */
else { loaded_grid = openvdb::GridBase::createGrid(grid_type);
/* Create a dummy grid. We can't really know the expected data type here. */ }
loaded_grid = openvdb::FloatGrid::create();
} }
} }
if (!loaded_grid) {
/* Create a dummy grid. We can't really know the expected data type here. */
loaded_grid = openvdb::FloatGrid::create();
}
BLI_assert(loaded_grid); BLI_assert(loaded_grid);
BLI_assert(loaded_grid.unique()); BLI_assert(loaded_grid.unique());
BLI_assert(loaded_grid->isTreeUnique()); BLI_assert(loaded_grid->isTreeUnique());

@ -144,8 +144,10 @@ static void world_blend_write(BlendWriter *writer, ID *id, const void *id_addres
{ {
World *wrld = (World *)id; 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); BLI_listbase_clear(&wrld->gpumaterial);
wrld->last_update = 0;
/* write LibData */ /* write LibData */
BLO_write_id_struct(writer, World, id_address, &wrld->id); 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); DEG_debug_print_eval(depsgraph, __func__, world->id.name, world);
GPU_material_free(&world->gpumaterial); 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() void Instance::view_update()
{ {
sampling.reset(); sampling.reset();
sync.view_update();
} }
/** \} */ /** \} */

@ -318,6 +318,11 @@ class Instance {
return flags; return flags;
} }
int get_recalc_flags(const ::World &world)
{
return world.last_update > depsgraph_last_update_ ? ID_RECALC_SHADING : 0;
}
private: private:
static void object_sync_render(void *instance_, static void object_sync_render(void *instance_,
Object *ob, 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) ObjectHandle &SyncModule::sync_object(const ObjectRef &ob_ref)
{ {
ObjectKey key(ob_ref.object); ObjectKey key(ob_ref.object);
@ -56,11 +49,10 @@ ObjectHandle &SyncModule::sync_object(const ObjectRef &ob_ref)
return handle; return handle;
} }
WorldHandle SyncModule::sync_world() WorldHandle SyncModule::sync_world(const ::World &world)
{ {
WorldHandle handle; WorldHandle handle;
handle.recalc = world_updated_ ? int(ID_RECALC_SHADING) : 0; handle.recalc = inst_.get_recalc_flags(world);
world_updated_ = false;
return handle; return handle;
} }

@ -155,16 +155,12 @@ class SyncModule {
Map<ObjectKey, ObjectHandle> ob_handles = {}; Map<ObjectKey, ObjectHandle> ob_handles = {};
bool world_updated_ = false;
public: public:
SyncModule(Instance &inst) : inst_(inst){}; SyncModule(Instance &inst) : inst_(inst){};
~SyncModule(){}; ~SyncModule(){};
void view_update();
ObjectHandle &sync_object(const ObjectRef &ob_ref); ObjectHandle &sync_object(const ObjectRef &ob_ref);
WorldHandle sync_world(); WorldHandle sync_world(const ::World &world);
void sync_mesh(Object *ob, void sync_mesh(Object *ob,
ObjectHandle &ob_handle, ObjectHandle &ob_handle,

@ -104,7 +104,7 @@ void World::sync()
WorldHandle wo_handle = {0}; WorldHandle wo_handle = {0};
if (inst_.scene->world != nullptr) { if (inst_.scene->world != nullptr) {
/* Detect world update before overriding it. */ /* 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; has_update = wo_handle.recalc != 0;
} }

@ -91,8 +91,13 @@ typedef struct World {
/** Light-group membership information. */ /** Light-group membership information. */
struct LightgroupMembership *lightgroup; struct LightgroupMembership *lightgroup;
void *_pad1;
/** Runtime. */ /** Runtime. */
ListBase gpumaterial; ListBase gpumaterial;
/* The Depsgraph::update_count when this World was last updated. */
uint64_t last_update;
} World; } World;
/* **************** WORLD ********************* */ /* **************** WORLD ********************* */

@ -13,6 +13,7 @@
#include "NOD_socket.hh" #include "NOD_socket.hh"
#include "NOD_socket_search_link.hh" #include "NOD_socket_search_link.hh"
#include "RNA_access.hh"
#include "RNA_enum_types.hh" #include "RNA_enum_types.hh"
namespace blender::nodes { namespace blender::nodes {