Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/DEG_depsgraph.h5
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc15
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc23
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc4
4 files changed, 45 insertions, 2 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index d5a93d21b99..c94a8876ab0 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -92,6 +92,11 @@ Depsgraph *DEG_graph_new(struct Main *bmain,
struct ViewLayer *view_layer,
eEvaluationMode mode);
+void DEG_graph_replace_owners(struct Depsgraph *depsgraph,
+ struct Main *bmain,
+ struct Scene *scene,
+ struct ViewLayer *view_layer);
+
/* Free Depsgraph itself and all its data */
void DEG_graph_free(Depsgraph *graph);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 6791125d1e9..27d6db6a58f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -2127,9 +2127,20 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
/* Layer parenting need react to the parent object transformation. */
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
if (gpl->parent != NULL) {
- ComponentKey transform_key(&gpl->parent->id, NodeType::TRANSFORM);
ComponentKey gpd_geom_key(&gpd->id, NodeType::GEOMETRY);
- add_relation(transform_key, gpd_geom_key, "GPencil Parent Layer");
+
+ if (gpl->partype == PARBONE) {
+ ComponentKey bone_key(&gpl->parent->id, NodeType::BONE, gpl->parsubstr);
+ OperationKey armature_key(
+ &gpl->parent->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL);
+
+ add_relation(bone_key, gpd_geom_key, "Bone Parent");
+ add_relation(armature_key, gpd_geom_key, "Armature Parent");
+ }
+ else {
+ ComponentKey transform_key(&gpl->parent->id, NodeType::TRANSFORM);
+ add_relation(transform_key, gpd_geom_key, "GPencil Parent Layer");
+ }
}
}
break;
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index ce6797939b5..a19a2958f28 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -285,6 +285,29 @@ Depsgraph *DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEval
return reinterpret_cast<Depsgraph *>(deg_depsgraph);
}
+/* Replace the "owner" pointers (currently Main/Scene/ViewLayer) of this depsgraph.
+ * Used during undo steps when we do want to re-use the old depsgraph data as much as possible. */
+void DEG_graph_replace_owners(struct Depsgraph *depsgraph,
+ Main *bmain,
+ Scene *scene,
+ ViewLayer *view_layer)
+{
+ DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+
+ const bool do_update_register = deg_graph->bmain != bmain;
+ if (do_update_register && deg_graph->bmain != NULL) {
+ DEG::unregister_graph(deg_graph);
+ }
+
+ deg_graph->bmain = bmain;
+ deg_graph->scene = scene;
+ deg_graph->view_layer = view_layer;
+
+ if (do_update_register) {
+ DEG::register_graph(deg_graph);
+ }
+}
+
/* Free graph's contents and graph itself */
void DEG_graph_free(Depsgraph *graph)
{
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index b019c079dab..8decb9f6b87 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -814,12 +814,16 @@ void DEG_ids_check_recalc(
static void deg_graph_clear_id_recalc_flags(ID *id)
{
+ /* Keep incremental track of used recalc flags, to get proper update when undoing. */
+ id->recalc_undo_accumulated |= id->recalc;
id->recalc &= ~ID_RECALC_ALL;
bNodeTree *ntree = ntreeFromID(id);
/* Clear embedded node trees too. */
if (ntree) {
+ ntree->id.recalc_undo_accumulated |= ntree->id.recalc;
ntree->id.recalc &= ~ID_RECALC_ALL;
}
+ /* XXX And what about scene's master collection here? */
}
void DEG_ids_clear_recalc(Main *UNUSED(bmain), Depsgraph *depsgraph)