Blender V5.3
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
8
9#include <mutex>
10
11#include "DEG_depsgraph.hh"
13
14#include "depsgraph.hh"
15
17
18void add(blender::Depsgraph &depsgraph, std::function<void()> fn)
19{
20 deg::Depsgraph &deg_graph = reinterpret_cast<deg::Depsgraph &>(depsgraph);
21 if (!deg_graph.is_active || deg_graph.sync_writeback == DEG_EVALUATE_SYNC_WRITEBACK_NO) {
22 return;
23 }
24
25 std::lock_guard lock{deg_graph.sync_writeback_callbacks_mutex};
26 deg_graph.sync_writeback_callbacks.append(std::move(fn));
27}
28
29} // namespace blender::deg::sync_writeback
volatile int lock
void add(Depsgraph &depsgraph, std::function< void()> fn)
@ DEG_EVALUATE_SYNC_WRITEBACK_NO
Vector< std::function< void()> > sync_writeback_callbacks
Definition depsgraph.hh:198
DepsgraphEvaluateSyncWriteback sync_writeback
Definition depsgraph.hh:193