[Bf-blender-cvs] [3a284a37fde] master: Refactor: Move simulation foreach_id to new IDTypeInfo structure.
Bastien Montagne
noreply at git.blender.org
Wed May 20 18:43:53 CEST 2020
Commit: 3a284a37fde9daae7d987a33555e8529cdfdd488
Author: Bastien Montagne
Date: Wed May 20 17:07:00 2020 +0200
Branches: master
https://developer.blender.org/rB3a284a37fde9daae7d987a33555e8529cdfdd488
Refactor: Move simulation foreach_id to new IDTypeInfo structure.
===================================================================
M source/blender/blenkernel/intern/lib_query.c
M source/blender/blenkernel/intern/simulation.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index be535e28f17..1c17250d49e 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -882,11 +882,7 @@ static void library_foreach_ID_link(Main *bmain,
break;
}
case ID_SIM: {
- Simulation *simulation = (Simulation *)id;
- if (simulation->nodetree) {
- /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
- BKE_library_foreach_ID_embedded(&data, (ID **)&simulation->nodetree);
- }
+ BLI_assert(0);
break;
}
diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc
index b4cfa7cf0ef..50770125a18 100644
--- a/source/blender/blenkernel/intern/simulation.cc
+++ b/source/blender/blenkernel/intern/simulation.cc
@@ -87,13 +87,13 @@ static void simulation_free_data(ID *id)
}
}
-void *BKE_simulation_add(Main *bmain, const char *name)
+static void simulation_foreach_id(ID *id, LibraryForeachIDData *data)
{
- Simulation *simulation = (Simulation *)BKE_libblock_alloc(bmain, ID_SIM, name, 0);
-
- simulation_init_data(&simulation->id);
-
- return simulation;
+ Simulation *simulation = (Simulation *)id;
+ if (simulation->nodetree) {
+ /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
+ BKE_library_foreach_ID_embedded(data, (ID **)&simulation->nodetree);
+ }
}
IDTypeInfo IDType_ID_SIM = {
@@ -110,8 +110,18 @@ IDTypeInfo IDType_ID_SIM = {
/* copy_data */ simulation_copy_data,
/* free_data */ simulation_free_data,
/* make_local */ nullptr,
+ /* foreach_id */ simulation_foreach_id,
};
+void *BKE_simulation_add(Main *bmain, const char *name)
+{
+ Simulation *simulation = (Simulation *)BKE_libblock_alloc(bmain, ID_SIM, name, 0);
+
+ simulation_init_data(&simulation->id);
+
+ return simulation;
+}
+
void BKE_simulation_data_update(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene))
{
}
More information about the Bf-blender-cvs
mailing list