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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-12-20 18:15:55 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-12-20 18:15:55 +0300
commit5b1404f0665d7e110e60ebea8a1029a5f7f15a70 (patch)
tree2be03cbb0f3889bcc7fcd3cad4b0090e13320040 /source/blender/depsgraph/intern/depsgraph.cc
parent1e236deab3636984054fed4920c477b56934fe6a (diff)
Depsgraph: Add utility function to unlink relation from graph
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph.cc')
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 2ab6320f14f..9a3b1788aa1 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -51,6 +51,7 @@ extern "C" {
#include "RNA_access.h"
}
+#include <algorithm>
#include <cstring>
#include "DEG_depsgraph.h"
@@ -68,6 +69,14 @@ static DEG_EditorUpdateIDCb deg_editor_update_id_cb = NULL;
static DEG_EditorUpdateSceneCb deg_editor_update_scene_cb = NULL;
static DEG_EditorUpdateScenePreCb deg_editor_update_scene_pre_cb = NULL;
+/* TODO(sergey): Find a better place for this. */
+template <typename T>
+static void remove_from_vector(vector<T> *vector, const T& value)
+{
+ vector->erase(std::remove(vector->begin(), vector->end(), value),
+ vector->end());
+}
+
Depsgraph::Depsgraph()
: time_source(NULL),
need_update(false),
@@ -391,7 +400,15 @@ DepsRelation::DepsRelation(DepsNode *from,
DepsRelation::~DepsRelation()
{
/* Sanity check. */
- BLI_assert(this->from && this->to);
+ BLI_assert(from != NULL && to != NULL);
+}
+
+void DepsRelation::unlink()
+{
+ /* Sanity check. */
+ BLI_assert(from != NULL && to != NULL);
+ remove_from_vector(&from->outlinks, this);
+ remove_from_vector(&to->inlinks, this);
}
/* Low level tagging -------------------------------------- */