diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2018-08-12 14:59:39 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2018-08-12 14:59:39 +0300 |
commit | b8ab411185c11ce98e7e791b0d30a9d9b1ce6d69 (patch) | |
tree | 9c219e06fc6a1f9b09d6fbf7d86c8526cfa6d775 /source/blender/depsgraph | |
parent | 209686f1c8189bc01f91d14a922651844df8b201 (diff) | |
parent | dc2d841b7c50565302af2986d62ddbd29c332acd (diff) |
Merge branch 'hair_guides' into hair_guides_groominghair_guides_grooming
Diffstat (limited to 'source/blender/depsgraph')
16 files changed, 237 insertions, 121 deletions
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index 185a98f2a2b..c9cdea34401 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -106,28 +106,6 @@ set(SRC util/deg_util_function.h ) -if(WITH_CXX11) - add_definitions(-DDEG_STD_UNORDERED_MAP) -elseif(HAVE_STD_UNORDERED_MAP_HEADER) - if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE) - add_definitions(-DDEG_STD_UNORDERED_MAP) - else() - if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE) - add_definitions(-DDEG_STD_UNORDERED_MAP_IN_TR1_NAMESPACE) - else() - add_definitions(-DDEG_NO_UNORDERED_MAP) - message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)") - endif() - endif() -else() - if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE) - add_definitions(-DDEG_TR1_UNORDERED_MAP) - else() - add_definitions(-DDEG_NO_UNORDERED_MAP) - message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)") - endif() -endif() - if(WITH_BOOST) list(APPEND INC_SYS ${BOOST_INCLUDE_DIR} diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index 71376d94ca8..7d827f48f9c 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -239,9 +239,9 @@ void DEG_make_inactive(struct Depsgraph *depsgraph); void DEG_debug_print_begin(struct Depsgraph *depsgraph); void DEG_debug_print_eval(struct Depsgraph *depsgraph, - const char* function_name, - const char* object_name, - const void* object_address); + const char *function_name, + const char *object_name, + const void *object_address); void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph, const char *function_name, @@ -269,9 +269,9 @@ void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph, const void *parent_address); void DEG_debug_print_eval_time(struct Depsgraph *depsgraph, - const char* function_name, - const char* object_name, - const void* object_address, + const char *function_name, + const char *object_name, + const void *object_address, float time); #ifdef __cplusplus diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index 4cbc7700947..8f5925a5ce3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -67,6 +67,12 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) } if (!deg_copy_on_write_is_expanded(id_node->id_cow)) { flag |= DEG_TAG_COPY_ON_WRITE; + /* This means ID is being added to the dependency graph first + * time, which is similar to "ob-visible-change" + */ + if (GS(id->name) == ID_OB) { + flag |= OB_RECALC_OB | OB_RECALC_DATA; + } } if (flag != 0) { DEG_graph_id_tag_update(bmain, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.cc b/source/blender/depsgraph/intern/builder/deg_builder_map.cc index 218483d1dc5..cde7b9721b7 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.cc @@ -37,24 +37,29 @@ namespace DEG { -BuilderMap::BuilderMap() { +BuilderMap::BuilderMap() +{ set = BLI_gset_ptr_new("deg builder gset"); } -BuilderMap::~BuilderMap() { +BuilderMap::~BuilderMap() +{ BLI_gset_free(set, NULL); } -bool BuilderMap::checkIsBuilt(ID *id) { +bool BuilderMap::checkIsBuilt(ID *id) +{ return BLI_gset_haskey(set, id); } -void BuilderMap::tagBuild(ID *id) { +void BuilderMap::tagBuild(ID *id) +{ BLI_gset_insert(set, id); } -bool BuilderMap::checkIsBuiltAndTag(ID *id) { +bool BuilderMap::checkIsBuiltAndTag(ID *id) +{ void **key_p; if (!BLI_gset_ensure_p_ex(set, id, &key_p)) { *key_p = id; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index a784fdc33c4..477a97bb2f0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -78,6 +78,8 @@ extern "C" { #include "BKE_curve.h" #include "BKE_effect.h" #include "BKE_fcurve.h" +#include "BKE_gpencil.h" +#include "BKE_gpencil_modifier.h" #include "BKE_idcode.h" #include "BKE_groom.h" #include "BKE_key.h" @@ -95,6 +97,7 @@ extern "C" { #include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_rigidbody.h" +#include "BKE_shader_fx.h" #include "BKE_sound.h" #include "BKE_tracking.h" #include "BKE_world.h" @@ -516,6 +519,18 @@ void DepsgraphNodeBuilder::build_object(int base_index, data.builder = this; modifiers_foreachIDLink(object, modifier_walk, &data); } + /* Grease Pencil Modifiers. */ + if (object->greasepencil_modifiers.first != NULL) { + BuilderWalkUserData data; + data.builder = this; + BKE_gpencil_modifiers_foreachIDLink(object, modifier_walk, &data); + } + /* Shadr FX. */ + if (object->shader_fx.first != NULL) { + BuilderWalkUserData data; + data.builder = this; + BKE_shaderfx_foreachIDLink(object, modifier_walk, &data); + } /* Constraints. */ if (object->constraints.first != NULL) { BuilderWalkUserData data; @@ -540,10 +555,6 @@ void DepsgraphNodeBuilder::build_object(int base_index, if (object->particlesystem.first != NULL) { build_particles(object); } - /* Grease pencil. */ - if (object->gpd != NULL) { - build_gpencil(object->gpd); - } /* Proxy object to copy from. */ if (object->proxy_from != NULL) { build_object(-1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY); @@ -594,6 +605,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object) case OB_SURF: case OB_MBALL: case OB_LATTICE: + case OB_GPENCIL: case OB_GROOM: build_object_data_geometry(object); /* TODO(sergey): Only for until we support granular @@ -832,8 +844,19 @@ void DepsgraphNodeBuilder::build_driver_variables(ID * id, FCurve *fcurve) LISTBASE_FOREACH (DriverVar *, dvar, &fcurve->driver->variables) { DRIVER_TARGETS_USED_LOOPER(dvar) { + if (dtar->id == NULL) { + continue; + } build_id(dtar->id); build_driver_id_property(dtar->id, dtar->rna_path); + /* Corresponds to dtar_id_ensure_proxy_from(). */ + if ((GS(dtar->id->name) == ID_OB) && + (((Object *)dtar->id)->proxy_from != NULL)) + { + Object *proxy_from = ((Object *)dtar->id)->proxy_from; + build_id(&proxy_from->id); + build_driver_id_property(&proxy_from->id, dtar->rna_path); + } } DRIVER_TARGETS_LOOPER_END } @@ -1205,6 +1228,20 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata) op_node->set_as_entry(); break; } + + case ID_GD: + { + /* GPencil evaluation operations. */ + op_node = add_operation_node(obdata, + DEG_NODE_TYPE_GEOMETRY, + function_bind(BKE_gpencil_eval_geometry, + _1, + (bGPdata *)obdata_cow), + DEG_OPCODE_PLACEHOLDER, + "Geometry Eval"); + op_node->set_as_entry(); + break; + } case ID_GM: { /* Groom evaluation operations. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index c0a93164956..d6bd3bf7160 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -159,7 +159,7 @@ struct DepsgraphNodeBuilder { const char *name = "", int name_tag = -1); - void build_id(ID* id); + void build_id(ID *id); void build_layer_collections(ListBase *lb); void build_view_layer(Scene *scene, ViewLayer *view_layer, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 00d7a5da455..b1486e82af5 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -161,7 +161,8 @@ void DepsgraphNodeBuilder::build_rig(Object *object) build_armature(armature); /* Rebuild pose if not up to date. */ if (object->pose == NULL || (object->pose->flag & POSE_RECALC)) { - BKE_pose_rebuild(object, armature); + /* By definition, no need to tag depsgraph as dirty from here, so we can pass NULL bmain. */ + BKE_pose_rebuild(NULL, object, armature, true); /* XXX: Without this animation gets lost in certain circumstances * after loading file. Need to investigate further since it does * not happen with simple scenes.. @@ -313,12 +314,13 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) } op_node = add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, - function_bind(BKE_pose_eval_proxy_copy, + function_bind(BKE_pose_eval_proxy_pose_init, _1, object_cow), DEG_OPCODE_POSE_INIT); op_node->set_as_entry(); + int pchan_index = 0; LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, @@ -333,10 +335,14 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) NULL, DEG_OPCODE_BONE_READY); /* Bone is fully evaluated. */ - op_node = add_operation_node(&object->id, + op_node = add_operation_node( + &object->id, DEG_NODE_TYPE_BONE, pchan->name, - NULL, + function_bind(BKE_pose_eval_proxy_copy_bone, + _1, + object_cow, + pchan_index), DEG_OPCODE_BONE_DONE); op_node->set_as_exit(); @@ -348,10 +354,14 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) DEG_OPCODE_PARAMETERS_EVAL, pchan->name); } + + pchan_index++; } op_node = add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, - NULL, + function_bind(BKE_pose_eval_proxy_pose_done, + _1, + object_cow), DEG_OPCODE_POSE_DONE); op_node->set_as_exit(); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index f1db05b7220..3d7b2d6d232 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -134,10 +134,6 @@ void DepsgraphNodeBuilder::build_view_layer( if (scene->nodetree != NULL) { build_compositor(scene); } - /* Grease pencil. */ - if (scene->gpd != NULL) { - build_gpencil(scene->gpd); - } /* Cache file. */ LISTBASE_FOREACH (CacheFile *, cachefile, &bmain_->cachefiles) { build_cachefile(cachefile); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 4a250292f83..88084fbfb57 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -87,10 +87,12 @@ extern "C" { #include "BKE_material.h" #include "BKE_mball.h" #include "BKE_modifier.h" +#include "BKE_gpencil_modifier.h" #include "BKE_node.h" #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_rigidbody.h" +#include "BKE_shader_fx.h" #include "BKE_sound.h" #include "BKE_tracking.h" #include "BKE_world.h" @@ -527,6 +529,18 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) data.builder = this; modifiers_foreachIDLink(object, modifier_walk, &data); } + /* Grease Pencil Modifiers. */ + if (object->greasepencil_modifiers.first != NULL) { + BuilderWalkUserData data; + data.builder = this; + BKE_gpencil_modifiers_foreachIDLink(object, modifier_walk, &data); + } + /* Shader FX. */ + if (object->shader_fx.first != NULL) { + BuilderWalkUserData data; + data.builder = this; + BKE_shaderfx_foreachIDLink(object, modifier_walk, &data); + } /* Constraints. */ if (object->constraints.first != NULL) { BuilderWalkUserData data; @@ -572,17 +586,9 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) if (object->particlesystem.first != NULL) { build_particles(object); } - /* Grease pencil. */ - if (object->gpd != NULL) { - build_gpencil(object->gpd); - } /* Proxy object to copy from. */ if (object->proxy_from != NULL) { build_object(NULL, object->proxy_from); - ComponentKey ob_pose_key(&object->proxy_from->id, DEG_NODE_TYPE_EVAL_POSE); - ComponentKey proxy_pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE); - add_relation(ob_pose_key, proxy_pose_key, "Proxy Pose"); - ComponentKey ob_transform_key(&object->proxy_from->id, DEG_NODE_TYPE_TRANSFORM); ComponentKey proxy_transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM); add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform"); @@ -632,6 +638,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) case OB_SURF: case OB_MBALL: case OB_LATTICE: + case OB_GPENCIL: case OB_GROOM: { build_object_data_geometry(object); @@ -1354,6 +1361,14 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) continue; } build_id(dtar->id); + /* Initialize relations coming to proxy_from. */ + Object *proxy_from = NULL; + if ((GS(dtar->id->name) == ID_OB) && + (((Object *)dtar->id)->proxy_from != NULL)) + { + proxy_from = ((Object *)dtar->id)->proxy_from; + build_id(&proxy_from->id); + } /* Special handling for directly-named bones. */ if ((dtar->flag & DTAR_FLAG_STRUCT_REF) && (((Object *)dtar->id)->type == OB_ARMATURE) && @@ -1401,6 +1416,13 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) continue; } add_relation(variable_key, driver_key, "RNA Target -> Driver"); + if (proxy_from != NULL) { + RNAPathKey proxy_from_variable_key(&proxy_from->id, + dtar->rna_path); + add_relation(proxy_from_variable_key, + variable_key, + "Proxy From -> Variable"); + } } else { if (dtar->id == id) { @@ -1786,6 +1808,42 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) } } } + /* Grease Pencil Modifiers */ + if (object->greasepencil_modifiers.first != NULL) { + ModifierUpdateDepsgraphContext ctx = {}; + ctx.scene = scene_; + ctx.object = object; + LISTBASE_FOREACH(GpencilModifierData *, md, &object->greasepencil_modifiers) { + const GpencilModifierTypeInfo *mti = BKE_gpencil_modifierType_getInfo((GpencilModifierType)md->type); + if (mti->updateDepsgraph) { + DepsNodeHandle handle = create_node_handle(obdata_ubereval_key); + ctx.node = reinterpret_cast< ::DepsNodeHandle* >(&handle); + mti->updateDepsgraph(md, &ctx); + } + if (BKE_object_modifier_gpencil_use_time(object, md)) { + TimeSourceKey time_src_key; + add_relation(time_src_key, obdata_ubereval_key, "Time Source"); + } + } + } + /* Shader FX */ + if (object->shader_fx.first != NULL) { + ModifierUpdateDepsgraphContext ctx = {}; + ctx.scene = scene_; + ctx.object = object; + LISTBASE_FOREACH(ShaderFxData *, fx, &object->shader_fx) { + const ShaderFxTypeInfo *fxi = BKE_shaderfxType_getInfo((ShaderFxType)fx->type); + if (fxi->updateDepsgraph) { + DepsNodeHandle handle = create_node_handle(obdata_ubereval_key); + ctx.node = reinterpret_cast< ::DepsNodeHandle* >(&handle); + fxi->updateDepsgraph(fx, &ctx); + } + if (BKE_object_shaderfx_use_time(object, fx)) { + TimeSourceKey time_src_key; + add_relation(time_src_key, obdata_ubereval_key, "Time Source"); + } + } + } /* Materials. */ if (object->totcol) { for (int a = 1; a <= object->totcol; a++) { @@ -1883,13 +1941,13 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) } /* Link object data evaluation node to exit operation. */ OperationKey obdata_geom_eval_key(obdata, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_PLACEHOLDER, - "Geometry Eval"); + DEG_NODE_TYPE_GEOMETRY, + DEG_OPCODE_PLACEHOLDER, + "Geometry Eval"); OperationKey obdata_geom_done_key(obdata, - DEG_NODE_TYPE_GEOMETRY, - DEG_OPCODE_PLACEHOLDER, - "Eval Done"); + DEG_NODE_TYPE_GEOMETRY, + DEG_OPCODE_PLACEHOLDER, + "Eval Done"); add_relation(obdata_geom_eval_key, obdata_geom_done_key, "ObData Geom Eval Done"); @@ -1905,35 +1963,67 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) Curve *cu = (Curve *)obdata; if (cu->bevobj != NULL) { ComponentKey bevob_geom_key(&cu->bevobj->id, - DEG_NODE_TYPE_GEOMETRY); + DEG_NODE_TYPE_GEOMETRY); add_relation(bevob_geom_key, - obdata_geom_eval_key, - "Curve Bevel Geometry"); + obdata_geom_eval_key, + "Curve Bevel Geometry"); ComponentKey bevob_key(&cu->bevobj->id, - DEG_NODE_TYPE_TRANSFORM); + DEG_NODE_TYPE_TRANSFORM); add_relation(bevob_key, - obdata_geom_eval_key, - "Curve Bevel Transform"); + obdata_geom_eval_key, + "Curve Bevel Transform"); build_object(NULL, cu->bevobj); } if (cu->taperobj != NULL) { ComponentKey taperob_key(&cu->taperobj->id, - DEG_NODE_TYPE_GEOMETRY); + DEG_NODE_TYPE_GEOMETRY); add_relation(taperob_key, obdata_geom_eval_key, "Curve Taper"); build_object(NULL, cu->taperobj); } if (cu->textoncurve != NULL) { ComponentKey textoncurve_key(&cu->textoncurve->id, - DEG_NODE_TYPE_GEOMETRY); + DEG_NODE_TYPE_GEOMETRY); add_relation(textoncurve_key, - obdata_geom_eval_key, - "Text on Curve"); + obdata_geom_eval_key, + "Text on Curve"); build_object(NULL, cu->textoncurve); } break; } case ID_LT: break; + case ID_GD: /* Grease Pencil */ + { + bGPdata *gpd = (bGPdata *)obdata; + + /* Geometry cache needs to be recalculated on frame change + * (e.g. to fix crashes after scrubbing the timeline when + * onion skinning is enabled, since the ghosts need to be + * re-added to the cache once scrubbing ends) + */ + TimeSourceKey time_key; + ComponentKey geometry_key(obdata, DEG_NODE_TYPE_GEOMETRY); + add_relation(time_key, + geometry_key, + "GP Frame Change"); + + /* Geometry cache also needs to be recalculated when Material + * settings change (e.g. when fill.opacity changes on/off, + * we need to rebuild the bGPDstroke->triangles caches) + */ + for (int i = 0; i < gpd->totcol; i++) { + Material *ma = gpd->mat[i]; + if ((ma != NULL) && (ma->gp_style != NULL)) { + OperationKey material_key(&ma->id, + DEG_NODE_TYPE_SHADING, + DEG_OPCODE_MATERIAL_UPDATE); + add_relation(material_key, + geometry_key, + "Material -> GP Data"); + } + } + break; + } case ID_GM: /* Groom */ { Groom *groom = (Groom *)obdata; @@ -2228,6 +2318,11 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node if (id_type == ID_ME && comp_node->type == DEG_NODE_TYPE_GEOMETRY) { rel_flag &= ~DEPSREL_FLAG_NO_FLUSH; } + /* materials need update grease pencil objects */ + if (id_type == ID_MA) { + rel_flag &= ~DEPSREL_FLAG_NO_FLUSH; + } + /* Notes on exceptions: * - Parameters component is where drivers are living. Changing any * of the (custom) properties in the original datablock (even the diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index eaa17d27ffc..811986ea0e8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -469,11 +469,20 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object) DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE); + OperationKey from_bone_done_key(&proxy_from->id, + DEG_NODE_TYPE_BONE, + pchan->name, + DEG_OPCODE_BONE_DONE); add_relation(pose_init_key, bone_local_key, "Pose Init -> Bone Local"); add_relation(bone_local_key, bone_ready_key, "Local -> Ready"); add_relation(bone_ready_key, bone_done_key, "Ready -> Done"); add_relation(bone_done_key, pose_done_key, "Bone Done -> Pose Done"); + /* Make sure bone in the proxy is not done before it's FROM is done. */ + add_relation(from_bone_done_key, + bone_done_key, + "From Bone Done -> Pose Done"); + if (pchan->prop != NULL) { OperationKey bone_parameters(&object->id, DEG_NODE_TYPE_PARAMETERS, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc index f069c63f138..78d1a930eb7 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc @@ -123,10 +123,6 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la if (scene->nodetree != NULL) { build_compositor(scene); } - /* Grease pencil. */ - if (scene->gpd != NULL) { - build_gpencil(scene->gpd); - } /* Masks. */ LISTBASE_FOREACH (Mask *, mask, &bmain_->mask) { build_mask(mask); diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index ca9f32d4d8c..a6c930196ef 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -128,10 +128,10 @@ Scene *DEG_get_evaluated_scene(const Depsgraph *graph) reinterpret_cast<const DEG::Depsgraph *>(graph); Scene *scene_cow = deg_graph->scene_cow; /* TODO(sergey): Shall we expand datablock here? Or is it OK to assume - * that calleer is OK with just a pointer in case scene is not up[dated + * that calleer is OK with just a pointer in case scene is not updated * yet? */ - BLI_assert(DEG::deg_copy_on_write_is_expanded(&scene_cow->id)); + BLI_assert(scene_cow != NULL && DEG::deg_copy_on_write_is_expanded(&scene_cow->id)); return scene_cow; } @@ -140,6 +140,9 @@ ViewLayer *DEG_get_evaluated_view_layer(const Depsgraph *graph) const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph); Scene *scene_cow = DEG_get_evaluated_scene(graph); + if (scene_cow == NULL) { + return NULL; /* Happens with new, not-yet-built/evaluated graphes. */ + } /* Do name-based lookup. */ /* TODO(sergey): Can this be optimized? */ ViewLayer *view_layer_orig = deg_graph->view_layer; diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index d2c9f93ba50..f5e7452aa74 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -100,6 +100,7 @@ void depsgraph_geometry_tag_to_component(const ID *id, case OB_FONT: case OB_LATTICE: case OB_MBALL: + case OB_GPENCIL: case OB_GROOM: *component_type = DEG_NODE_TYPE_GEOMETRY; break; @@ -113,11 +114,17 @@ void depsgraph_geometry_tag_to_component(const ID *id, case ID_ME: *component_type = DEG_NODE_TYPE_GEOMETRY; break; - case ID_PA: + case ID_PA: /* Particles */ return; case ID_LP: *component_type = DEG_NODE_TYPE_PARAMETERS; break; + case ID_GD: + *component_type = DEG_NODE_TYPE_GEOMETRY; + break; + case ID_PAL: /* Palettes */ + *component_type = DEG_NODE_TYPE_PARAMETERS; + break; default: break; } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 10df9ed05a4..44dc688b805 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -560,9 +560,13 @@ void update_special_pointers(const Depsgraph *depsgraph, object_cow->runtime.mesh_orig = (Mesh *)object_cow->data; } if (object_cow->type == OB_ARMATURE) { - BKE_pose_remap_bone_pointers((bArmature *)object_cow->data, - object_cow->pose); - update_pose_orig_pointers(object_orig->pose, object_cow->pose); + const bArmature *armature_orig = (bArmature *)object_orig->data; + bArmature *armature_cow = (bArmature *)object_cow->data; + BKE_pose_remap_bone_pointers(armature_cow, object_cow->pose); + if (armature_orig->edbo == NULL) { + update_pose_orig_pointers(object_orig->pose, + object_cow->pose); + } } update_particle_system_orig_pointers(object_orig, object_cow); break; @@ -731,20 +735,19 @@ static void deg_update_copy_on_write_animation(const Depsgraph *depsgraph, } typedef struct ObjectRuntimeBackup { - CurveCache *curve_cache; Object_Runtime runtime; short base_flag; } ObjectRuntimeBackup; /* Make a backup of object's evaluation runtime data, additionally - * male object to be safe for free without invalidating backed up + * make object to be safe for free without invalidating backed up * pointers. */ static void deg_backup_object_runtime( Object *object, ObjectRuntimeBackup *object_runtime_backup) { - /* Store evaluated mesh, and make sure we don't free it. */ + /* Store evaluated mesh and curve_cache, and make sure we don't free it. */ Mesh *mesh_eval = object->runtime.mesh_eval; object_runtime_backup->runtime = object->runtime; BKE_object_runtime_reset(object); @@ -755,9 +758,6 @@ static void deg_backup_object_runtime( if (mesh_eval != NULL && object->data == mesh_eval) { object->data = object->runtime.mesh_orig; } - /* Store curve cache and make sure we don't free it. */ - object_runtime_backup->curve_cache = object->curve_cache; - object->curve_cache = NULL; /* Make a backup of base flags. */ object_runtime_backup->base_flag = object->base_flag; } @@ -769,7 +769,7 @@ static void deg_restore_object_runtime( Mesh *mesh_orig = object->runtime.mesh_orig; object->runtime = object_runtime_backup->runtime; object->runtime.mesh_orig = mesh_orig; - if (object->runtime.mesh_eval != NULL) { + if (object->type == OB_MESH && object->runtime.mesh_eval != NULL) { if (object->id.recalc & ID_RECALC_GEOMETRY) { /* If geometry is tagged for update it means, that part of * evaluated mesh are not valid anymore. In this case we can not @@ -785,19 +785,14 @@ static void deg_restore_object_runtime( /* Do same thing as object update: override actual object data * pointer with evaluated datablock. */ - if (object->type == OB_MESH) { - object->data = mesh_eval; - /* Evaluated mesh simply copied edit_btmesh pointer from - * original mesh during update, need to make sure no dead - * pointers are left behind. - */ - mesh_eval->edit_btmesh = mesh_orig->edit_btmesh; - } + object->data = mesh_eval; + /* Evaluated mesh simply copied edit_btmesh pointer from + * original mesh during update, need to make sure no dead + * pointers are left behind. + */ + mesh_eval->edit_btmesh = mesh_orig->edit_btmesh; } } - if (object_runtime_backup->curve_cache != NULL) { - object->curve_cache = object_runtime_backup->curve_cache; - } object->base_flag = object_runtime_backup->base_flag; } diff --git a/source/blender/depsgraph/util/deg_util_foreach.h b/source/blender/depsgraph/util/deg_util_foreach.h index e00aa5dbb5e..5484192207b 100644 --- a/source/blender/depsgraph/util/deg_util_foreach.h +++ b/source/blender/depsgraph/util/deg_util_foreach.h @@ -30,11 +30,4 @@ #pragma once -#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) -# define foreach(x, y) for(x : y) -#elif defined(HAVE_BOOST_FUNCTION_BINDINGS) -# include <boost/foreach.hpp> -# define foreach BOOST_FOREACH -#else -# error "Depsgraph requires either Boost or C++11 for range-based loops." -#endif +#define foreach(x, y) for(x : y) diff --git a/source/blender/depsgraph/util/deg_util_function.h b/source/blender/depsgraph/util/deg_util_function.h index e91986d54ba..8863d92eb74 100644 --- a/source/blender/depsgraph/util/deg_util_function.h +++ b/source/blender/depsgraph/util/deg_util_function.h @@ -30,22 +30,8 @@ #pragma once -#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1900) - #include <functional> using std::function; using namespace std::placeholders; #define function_bind std::bind - -#elif defined(HAVE_BOOST_FUNCTION_BINDINGS) - -#include <boost/bind.hpp> -#include <boost/function.hpp> - -using boost::function; -#define function_bind boost::bind - -#else -# error "Depsgraph requires either Boost or C++11 for function bindings." -#endif |