Refactor: Move simulation foreach_id to new IDTypeInfo structure.
This commit is contained in:
parent
ee44283393
commit
3a284a37fd
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue