Blender V5.0
depsgraph_writeback_sync.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <mutex>
6
7#include "DEG_depsgraph.hh"
9
10#include "depsgraph.hh"
11
13
14void add(::Depsgraph &depsgraph, std::function<void()> fn)
15{
16 deg::Depsgraph &deg_graph = reinterpret_cast<deg::Depsgraph &>(depsgraph);
17 if (!deg_graph.is_active || deg_graph.sync_writeback == DEG_EVALUATE_SYNC_WRITEBACK_NO) {
18 return;
19 }
20
21 std::lock_guard lock{deg_graph.sync_writeback_callbacks_mutex};
22 deg_graph.sync_writeback_callbacks.append(std::move(fn));
23}
24
25} // namespace blender::deg::sync_writeback
@ DEG_EVALUATE_SYNC_WRITEBACK_NO
volatile int lock
BPy_StructRNA * depsgraph
void append(const T &value)
void add(Depsgraph &depsgraph, std::function< void()> fn)
Vector< std::function< void()> > sync_writeback_callbacks
Definition depsgraph.hh:194
DepsgraphEvaluateSyncWriteback sync_writeback
Definition depsgraph.hh:189