Files
test/source/blender/blenkernel/intern/object_update.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

428 lines
14 KiB
C++
Raw Normal View History

/* SPDX-FileCopyrightText: 2014 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup bke
*/
#include "DNA_constraint_types.h"
Depsgraph: Initial groundwork for copy-on-write support < Dependency graph Copy-on-Write > -------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || This is an initial commit of Copy-on-write support added to dependency graph. Main priority for now: get playback (Alt-A) and all operators (selection, transform etc) to work with the new concept of clear separation between evaluated data coming from dependency graph and original data coming from .blend file (and stored in bmain). = How does this work? = The idea is to support Copy-on-Write on the ID level. This means, we duplicate the whole ID before we cann it's evaluaiton function. This is currently done in the following way: - At the depsgraph construction time we create "shallow" copy of the ID datablock, just so we know it's pointer in memory and can use for function bindings. - At the evaluaiton time, the copy of ID get's "expanded" (needs a better name internally, so it does not conflict with expanding datablocks during library linking), which means the content of the datablock is being copied over and all IDs are getting remapped to the copied ones. Currently we do the whole copy, in the future we will support some tricks here to prevent duplicating geometry arrays (verts, edges, loops, faces and polys) when we don't need that. - Evaluation functions are operating on copied datablocks and never touching original datablock. - There are some cases when we need to know non-ID pointers for function bindings. This mainly applies to scene collections and armatures. The idea of dealing with this is to "expand" copy-on-write datablock at the dependency graph build time. This might introduce some slowdown to the dependency graph construction time, but allows us to have minimal changes in the code and avoid any hash look-up from evaluation function (one of the ideas to avoid using pointers as function bindings is to pass name of layer or a bone to the evaluation function and look up actual data based on that name). Currently there is a special function in depsgraph which does such a synchronization, in the future we might want to make it more generic. At some point we need to synchronize copy-on-write version of datablock with the original version. This happens, i.e., when we change active object or change selection. We don't want any actual evaluation of update flush happening for such thins, so now we have a special update tag: DEG_id_tag_update((id, DEG_TAG_COPY_ON_WRITE) - For the render engines we now have special call for the dependency graph to give evaluated datablock for the given original one. This isn't fully ideal but allows to have Cycles viewport render. This is definitely a subject for further investigation / improvement. This call will tag copy-on-write component tagged for update without causing updates to be flushed to any other objects, causing chain reaction of updates. This tag is handy when selection in the scene changes. This basically summarizes ideas underneath this commit. The code should be reasonably documented. Here is a demo of dependency graph with all copy-on-write stuff in it: https://developer.blender.org/F635468 = What to expect to (not) work? = - Only meshes are properly-ish aware of copy-on-write currently, Non-mesh geometry will probably crash or will not work at all. - Armatures will need similar depsgraph built-time expansion of the copied datablock. - There are some extra tags / relations added, to keep things demo-able but which are slowing things down for evaluation. - Edit mode works for until click selection is used (due to the selection code using EditDerivedMesh created ad-hoc). - Lots of tools will lack tagging synchronization of copied datablock for sync with original ID. = How to move forward? = There is some tedious work related on going over all the tools, checking whether they need to work with original or final evaluated object and make the required changes. Additionally, there need synchronization tag done in fair amount of tools and operators as well. For example, currently it's not possible to change render engine without re-opening the file or forcing dependency graph for re-build via python console. There is also now some thoughts required about copying evaluated properties between objects or from collection to a new object. Perhaps easiest way would be to move base flag flush to Object ID node and tag new objects for update instead of doing manual copy. here is some WIP patch which moves such evaluaiton / flush: https://developer.blender.org/F635479 Lots of TODOs in the code, with possible optimization. = How to test? = This is a feature under heavy development, so obviously it is disabled by default. The only reason it goes to 2.8 branch is to avoid possible merge hell. In order to enable this feature use WITH_DEPSGRAPH_COPY_ON_WRITE CMake configuration option.
2017-06-14 10:26:24 +02:00
#include "DNA_mesh_types.h"
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "BLI_string.h"
#include "BKE_armature.hh"
#include "BKE_constraint.h"
#include "BKE_curve.hh"
#include "BKE_curves.h"
#include "BKE_displist.h"
#include "BKE_editmesh.hh"
#include "BKE_grease_pencil.h"
#include "BKE_grease_pencil.hh"
#include "BKE_lattice.hh"
2024-01-23 15:18:09 -05:00
#include "BKE_layer.hh"
#include "BKE_mball.hh"
#include "BKE_mesh.hh"
#include "BKE_object.hh"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_pointcloud.hh"
#include "BKE_scene.hh"
#include "BKE_volume.hh"
Depsgraph: Initial groundwork for copy-on-write support < Dependency graph Copy-on-Write > -------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || This is an initial commit of Copy-on-write support added to dependency graph. Main priority for now: get playback (Alt-A) and all operators (selection, transform etc) to work with the new concept of clear separation between evaluated data coming from dependency graph and original data coming from .blend file (and stored in bmain). = How does this work? = The idea is to support Copy-on-Write on the ID level. This means, we duplicate the whole ID before we cann it's evaluaiton function. This is currently done in the following way: - At the depsgraph construction time we create "shallow" copy of the ID datablock, just so we know it's pointer in memory and can use for function bindings. - At the evaluaiton time, the copy of ID get's "expanded" (needs a better name internally, so it does not conflict with expanding datablocks during library linking), which means the content of the datablock is being copied over and all IDs are getting remapped to the copied ones. Currently we do the whole copy, in the future we will support some tricks here to prevent duplicating geometry arrays (verts, edges, loops, faces and polys) when we don't need that. - Evaluation functions are operating on copied datablocks and never touching original datablock. - There are some cases when we need to know non-ID pointers for function bindings. This mainly applies to scene collections and armatures. The idea of dealing with this is to "expand" copy-on-write datablock at the dependency graph build time. This might introduce some slowdown to the dependency graph construction time, but allows us to have minimal changes in the code and avoid any hash look-up from evaluation function (one of the ideas to avoid using pointers as function bindings is to pass name of layer or a bone to the evaluation function and look up actual data based on that name). Currently there is a special function in depsgraph which does such a synchronization, in the future we might want to make it more generic. At some point we need to synchronize copy-on-write version of datablock with the original version. This happens, i.e., when we change active object or change selection. We don't want any actual evaluation of update flush happening for such thins, so now we have a special update tag: DEG_id_tag_update((id, DEG_TAG_COPY_ON_WRITE) - For the render engines we now have special call for the dependency graph to give evaluated datablock for the given original one. This isn't fully ideal but allows to have Cycles viewport render. This is definitely a subject for further investigation / improvement. This call will tag copy-on-write component tagged for update without causing updates to be flushed to any other objects, causing chain reaction of updates. This tag is handy when selection in the scene changes. This basically summarizes ideas underneath this commit. The code should be reasonably documented. Here is a demo of dependency graph with all copy-on-write stuff in it: https://developer.blender.org/F635468 = What to expect to (not) work? = - Only meshes are properly-ish aware of copy-on-write currently, Non-mesh geometry will probably crash or will not work at all. - Armatures will need similar depsgraph built-time expansion of the copied datablock. - There are some extra tags / relations added, to keep things demo-able but which are slowing things down for evaluation. - Edit mode works for until click selection is used (due to the selection code using EditDerivedMesh created ad-hoc). - Lots of tools will lack tagging synchronization of copied datablock for sync with original ID. = How to move forward? = There is some tedious work related on going over all the tools, checking whether they need to work with original or final evaluated object and make the required changes. Additionally, there need synchronization tag done in fair amount of tools and operators as well. For example, currently it's not possible to change render engine without re-opening the file or forcing dependency graph for re-build via python console. There is also now some thoughts required about copying evaluated properties between objects or from collection to a new object. Perhaps easiest way would be to move base flag flush to Object ID node and tag new objects for update instead of doing manual copy. here is some WIP patch which moves such evaluaiton / flush: https://developer.blender.org/F635479 Lots of TODOs in the code, with possible optimization. = How to test? = This is a feature under heavy development, so obviously it is disabled by default. The only reason it goes to 2.8 branch is to avoid possible merge hell. In order to enable this feature use WITH_DEPSGRAPH_COPY_ON_WRITE CMake configuration option.
2017-06-14 10:26:24 +02:00
#include "MEM_guardedalloc.h"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_light_linking.hh"
#include "DEG_depsgraph_query.hh"
Depsgraph: New dependency graph integration commit This commit integrates the work done so far on the new dependency graph system, where goal was to replace legacy depsgraph with the new one, supporting loads of neat features like: - More granular dependency relation nature, which solves issues with fake cycles in the dependencies. - Move towards all-animatable, by better integration of drivers into the system. - Lay down some basis for upcoming copy-on-write, overrides and so on. The new system is living side-by-side with the previous one and disabled by default, so nothing will become suddenly broken. The way to enable new depsgraph is to pass `--new-depsgraph` command line argument. It's a bit early to consider the system production-ready, there are some TODOs and issues were discovered during the merge period, they'll be addressed ASAP. But it's important to merge, because it's the only way to attract artists to really start testing this system. There are number of assorted documents related on the design of the new system: * http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents * http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph There are also some user-related information online: * http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/ * http://code.blender.org/2015/03/more-dependency-graph-tricks/ Kudos to everyone who was involved into the project: - Joshua "Aligorith" Leung -- design specification, initial code - Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes - Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the project and so - Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the issues and recording/writing documentation. - Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
namespace deg = blender::deg;
void BKE_object_eval_reset(Object *ob_eval)
{
BKE_object_free_derived_caches(ob_eval);
}
void BKE_object_eval_local_transform(Depsgraph *depsgraph, Object *ob)
{
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
/* calculate local matrix */
BKE_object_to_mat4(ob, ob->runtime->object_to_world.ptr());
}
void BKE_object_eval_parent(Depsgraph *depsgraph, Object *ob)
{
/* NOTE: based on `solve_parenting()`, but with the cruft stripped out. */
Object *par = ob->parent;
float totmat[4][4];
float tmat[4][4];
float locmat[4][4];
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
/* get local matrix (but don't calculate it, as that was done already!) */
/* XXX: redundant? */
copy_m4_m4(locmat, ob->object_to_world().ptr());
/* get parent effect matrix */
BKE_object_get_parent_matrix(ob, par, totmat);
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
mul_m4_m4m4(ob->runtime->object_to_world.ptr(), tmat, locmat);
/* origin, for help line */
if ((ob->partype & PARTYPE) == PARSKEL) {
copy_v3_v3(ob->runtime->parent_display_origin, par->object_to_world().location());
}
else {
copy_v3_v3(ob->runtime->parent_display_origin, totmat[3]);
}
}
void BKE_object_eval_constraints(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
bConstraintOb *cob;
float ctime = BKE_scene_ctime_get(scene);
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
/* evaluate constraints stack */
/* TODO: split this into:
* - pre (i.e. BKE_constraints_make_evalob, per-constraint (i.e.
* - inner body of BKE_constraints_solve),
* - post (i.e. BKE_constraints_clear_evalob)
*
* Not sure why, this is from Joshua - sergey
*/
2022-09-29 17:11:20 -05:00
cob = BKE_constraints_make_evalob(depsgraph, scene, ob, nullptr, CONSTRAINT_OBTYPE_OBJECT);
BKE_constraints_solve(depsgraph, &ob->constraints, cob, ctime);
BKE_constraints_clear_evalob(cob);
}
void BKE_object_eval_transform_final(Depsgraph *depsgraph, Object *ob)
{
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
/* Make sure inverse matrix is always up to date. This way users of it
2019-06-12 09:04:10 +10:00
* do not need to worry about recalculating it. */
invert_m4_m4_safe(ob->runtime->world_to_object.ptr(), ob->object_to_world().ptr());
/* Set negative scale flag in object. */
if (is_negative_m4(ob->object_to_world().ptr())) {
ob->transflag |= OB_NEG_SCALE;
}
else {
ob->transflag &= ~OB_NEG_SCALE;
}
ob->runtime->last_update_transform = DEG_get_update_count(depsgraph);
}
void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
/* includes all keys and modifiers */
switch (ob->type) {
case OB_MESH: {
CustomData_MeshMasks cddata_masks = scene->customdata_mask;
CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH);
/* Custom attributes should not be removed automatically. They might be used by the render
* engine or scripts. They can still be removed explicitly using geometry nodes.
* Vertex groups can be used in arbitrary situations with geometry nodes as well. */
cddata_masks.vmask |= CD_MASK_PROP_ALL | CD_MASK_MDEFORMVERT;
cddata_masks.emask |= CD_MASK_PROP_ALL;
cddata_masks.fmask |= CD_MASK_PROP_ALL;
cddata_masks.pmask |= CD_MASK_PROP_ALL;
cddata_masks.lmask |= CD_MASK_PROP_ALL;
if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) {
/* Always compute orcos for render. */
cddata_masks.vmask |= CD_MASK_ORCO;
}
blender::bke::mesh_data_update(*depsgraph, *scene, *ob, cddata_masks);
break;
}
case OB_ARMATURE:
BKE_pose_where_is(depsgraph, scene, ob);
break;
case OB_MBALL:
BKE_mball_data_update(depsgraph, scene, ob);
break;
case OB_CURVES_LEGACY:
case OB_SURF:
case OB_FONT: {
bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
BKE_displist_make_curveTypes(depsgraph, scene, ob, for_render);
break;
}
case OB_LATTICE:
BKE_lattice_modifiers_calc(depsgraph, scene, ob);
break;
case OB_CURVES:
BKE_curves_data_update(depsgraph, scene, ob);
break;
case OB_POINTCLOUD:
BKE_pointcloud_data_update(depsgraph, scene, ob);
break;
case OB_VOLUME:
BKE_volume_data_update(depsgraph, scene, ob);
break;
case OB_GREASE_PENCIL:
BKE_object_eval_grease_pencil(depsgraph, scene, ob);
break;
}
/* particles */
if (!(ob->mode & OB_MODE_EDIT) && ob->particlesystem.first) {
const bool use_render_params = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
ParticleSystem *tpsys, *psys;
ob->transflag &= ~OB_DUPLIPARTS;
2022-09-29 17:11:20 -05:00
psys = static_cast<ParticleSystem *>(ob->particlesystem.first);
while (psys) {
if (psys_check_enabled(ob, psys, use_render_params)) {
/* check use of dupli objects here */
if (psys->part && (psys->part->draw_as == PART_DRAW_REND || use_render_params) &&
((psys->part->ren_as == PART_DRAW_OB && psys->part->instance_object) ||
(psys->part->ren_as == PART_DRAW_GR && psys->part->instance_collection)))
{
ob->transflag |= OB_DUPLIPARTS;
}
particle_system_update(depsgraph, scene, ob, psys, use_render_params);
psys = psys->next;
}
else if (psys->flag & PSYS_DELETE) {
tpsys = psys->next;
BLI_remlink(&ob->particlesystem, psys);
psys_free(ob, psys);
psys = tpsys;
}
else {
psys = psys->next;
}
}
}
if (DEG_is_active(depsgraph)) {
Object *object_orig = DEG_get_original(ob);
object_orig->runtime->bounds_eval = BKE_object_evaluated_geometry_bounds(ob);
}
}
void BKE_object_sync_to_original(Depsgraph *depsgraph, Object *object)
{
if (!DEG_is_active(depsgraph)) {
return;
}
Object *object_orig = DEG_get_original(object);
/* Base flags. */
object_orig->base_flag = object->base_flag;
/* Transformation flags. */
copy_m4_m4(object_orig->runtime->object_to_world.ptr(), object->object_to_world().ptr());
copy_m4_m4(object_orig->runtime->world_to_object.ptr(), object->world_to_object().ptr());
copy_m4_m4(object_orig->constinv, object->constinv);
object_orig->transflag = object->transflag;
object_orig->flag = object->flag;
/* Copy back error messages from modifiers. */
2022-09-29 17:11:20 -05:00
for (ModifierData *md = static_cast<ModifierData *>(object->modifiers.first),
*md_orig = static_cast<ModifierData *>(object_orig->modifiers.first);
md != nullptr && md_orig != nullptr;
md = md->next, md_orig = md_orig->next)
{
BLI_assert(md->type == md_orig->type && STREQ(md->name, md_orig->name));
MEM_SAFE_FREE(md_orig->error);
2022-09-29 17:11:20 -05:00
if (md->error != nullptr) {
md_orig->error = BLI_strdup(md->error);
}
}
}
void BKE_object_eval_uber_transform(Depsgraph * /*depsgraph*/, Object * /*object*/) {}
void BKE_object_batch_cache_dirty_tag(Object *ob)
{
switch (ob->type) {
case OB_MESH:
BKE_mesh_batch_cache_dirty_tag((Mesh *)ob->data, BKE_MESH_BATCH_DIRTY_ALL);
break;
case OB_LATTICE:
BKE_lattice_batch_cache_dirty_tag((Lattice *)ob->data, BKE_LATTICE_BATCH_DIRTY_ALL);
break;
case OB_CURVES_LEGACY:
case OB_SURF:
case OB_FONT:
BKE_curve_batch_cache_dirty_tag((Curve *)ob->data, BKE_CURVE_BATCH_DIRTY_ALL);
break;
case OB_MBALL: {
/* This function is currently called on original objects, so to properly
* clear the actual displayed geometry, we have to tag the evaluated mesh. */
Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf(ob);
if (mesh) {
BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_ALL);
}
break;
}
case OB_CURVES:
BKE_curves_batch_cache_dirty_tag((Curves *)ob->data, BKE_CURVES_BATCH_DIRTY_ALL);
break;
case OB_POINTCLOUD:
BKE_pointcloud_batch_cache_dirty_tag((PointCloud *)ob->data, BKE_POINTCLOUD_BATCH_DIRTY_ALL);
break;
case OB_VOLUME:
BKE_volume_batch_cache_dirty_tag((Volume *)ob->data, BKE_VOLUME_BATCH_DIRTY_ALL);
break;
case OB_GREASE_PENCIL:
BKE_grease_pencil_batch_cache_dirty_tag((GreasePencil *)ob->data,
BKE_GREASEPENCIL_BATCH_DIRTY_ALL);
break;
default:
break;
}
}
void BKE_object_eval_uber_data(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
BLI_assert(ob->type != OB_ARMATURE);
BKE_object_handle_data_update(depsgraph, scene, ob);
BKE_object_batch_cache_dirty_tag(ob);
ob->runtime->last_update_geometry = DEG_get_update_count(depsgraph);
}
void BKE_object_eval_ptcache_reset(Depsgraph *depsgraph, Scene *scene, Object *object)
{
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
BKE_ptcache_object_reset(scene, object, PTCACHE_RESET_DEPSGRAPH);
}
void BKE_object_eval_transform_all(Depsgraph *depsgraph, Scene *scene, Object *object)
{
/* This mimics full transform update chain from new depsgraph. */
BKE_object_eval_local_transform(depsgraph, object);
2022-09-29 17:11:20 -05:00
if (object->parent != nullptr) {
BKE_object_eval_parent(depsgraph, object);
}
if (!BLI_listbase_is_empty(&object->constraints)) {
BKE_object_eval_constraints(depsgraph, scene, object);
}
BKE_object_eval_uber_transform(depsgraph, object);
BKE_object_eval_transform_final(depsgraph, object);
}
2017-11-29 15:47:00 +01:00
void BKE_object_data_select_update(Depsgraph *depsgraph, ID *object_data)
{
DEG_debug_print_eval(depsgraph, __func__, object_data->name, object_data);
switch (GS(object_data->name)) {
case ID_ME:
BKE_mesh_batch_cache_dirty_tag((Mesh *)object_data, BKE_MESH_BATCH_DIRTY_SELECT);
break;
case ID_CU_LEGACY:
BKE_curve_batch_cache_dirty_tag((Curve *)object_data, BKE_CURVE_BATCH_DIRTY_SELECT);
break;
case ID_LT:
BKE_lattice_batch_cache_dirty_tag((Lattice *)object_data, BKE_LATTICE_BATCH_DIRTY_SELECT);
break;
default:
break;
}
}
void BKE_object_select_update(Depsgraph *depsgraph, Object *object)
{
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
if (object->type == OB_MESH && !object->runtime->is_data_eval_owned) {
Mesh *mesh_input = (Mesh *)object->runtime->data_orig;
std::lock_guard lock{mesh_input->runtime->eval_mutex};
2022-09-29 17:11:20 -05:00
BKE_object_data_select_update(depsgraph, static_cast<ID *>(object->data));
}
else {
2022-09-29 17:11:20 -05:00
BKE_object_data_select_update(depsgraph, static_cast<ID *>(object->data));
}
}
void BKE_object_eval_eval_base_flags(Depsgraph *depsgraph,
Scene *scene,
const int view_layer_index,
Object *object,
int base_index,
const bool is_from_set)
{
/* TODO(sergey): Avoid list lookup. */
BLI_assert(view_layer_index >= 0);
2022-09-29 17:11:20 -05:00
ViewLayer *view_layer = static_cast<ViewLayer *>(
BLI_findlink(&scene->view_layers, view_layer_index));
BLI_assert(view_layer != nullptr);
BLI_assert(view_layer->object_bases_array != nullptr);
BLI_assert(base_index >= 0);
BLI_assert(base_index < MEM_allocN_len(view_layer->object_bases_array) / sizeof(Base *));
Base *base = view_layer->object_bases_array[base_index];
BLI_assert(base->object == object);
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
/* Set base flags based on collection and object restriction. */
BKE_base_eval_flags(base);
/* For render, compute base visibility again since BKE_base_eval_flags
2019-08-17 00:54:22 +10:00
* assumed viewport visibility. Select-ability does not matter here. */
if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) {
if (base->flag & BASE_ENABLED_RENDER) {
base->flag |= BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT;
}
else {
base->flag &= ~BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT;
}
}
/* Copy flags and settings from base. */
object->base_flag = base->flag;
if (is_from_set) {
object->base_flag |= BASE_FROM_SET;
object->base_flag &= ~(BASE_SELECTED | BASE_SELECTABLE);
}
object->base_local_view_bits = base->local_view_bits;
object->runtime->local_collections_bits = base->local_collections_bits;
if (object->mode == OB_MODE_PARTICLE_EDIT) {
2022-09-29 17:11:20 -05:00
for (ParticleSystem *psys = static_cast<ParticleSystem *>(object->particlesystem.first);
psys != nullptr;
psys = psys->next)
{
BKE_particle_batch_cache_dirty_tag(psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
}
}
/* Copy base flag back to the original view layer for editing. */
if (DEG_is_active(depsgraph) && (view_layer == DEG_get_evaluated_view_layer(depsgraph))) {
Base *base_orig = base->base_orig;
2022-09-29 17:11:20 -05:00
BLI_assert(base_orig != nullptr);
BLI_assert(base_orig->object != nullptr);
base_orig->flag = base->flag;
}
}
void BKE_object_eval_light_linking(Depsgraph *depsgraph, Object *object)
{
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
deg::light_linking::eval_runtime_data(depsgraph, *object);
}
void BKE_object_eval_shading(Depsgraph *depsgraph, Object *object)
{
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
object->runtime->last_update_shading = DEG_get_update_count(depsgraph);
}