Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/library_query.c
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BLI_linklist_stack.h" | #include "BLI_linklist_stack.h" | ||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_collection.h" | #include "BKE_collection.h" | ||||
| #include "BKE_constraint.h" | #include "BKE_constraint.h" | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_group.h" | |||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_library_query.h" | #include "BKE_library_query.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_rigidbody.h" | #include "BKE_rigidbody.h" | ||||
| ▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | static void library_foreach_bone(LibraryForeachIDData *data, Bone *bone) | ||||
| for (Bone *curbone = bone->childbase.first; curbone; curbone = curbone->next) { | for (Bone *curbone = bone->childbase.first; curbone; curbone = curbone->next) { | ||||
| library_foreach_bone(data, curbone); | library_foreach_bone(data, curbone); | ||||
| } | } | ||||
| FOREACH_FINALIZE_VOID; | FOREACH_FINALIZE_VOID; | ||||
| } | } | ||||
| static void library_foreach_layer_collection(LibraryForeachIDData *data, ListBase *lb) | |||||
| { | |||||
| for (LayerCollection *lc = lb->first; lc; lc = lc->next) { | |||||
| FOREACH_CALLBACK_INVOKE(data, lc->collection, IDWALK_CB_NOP); | |||||
| library_foreach_layer_collection(data, &lc->layer_collections); | |||||
| } | |||||
| FOREACH_FINALIZE_VOID; | |||||
| } | |||||
| static void library_foreach_ID_as_subdata_link( | static void library_foreach_ID_as_subdata_link( | ||||
| ID **id_pp, LibraryIDLinkCallback callback, void *user_data, int flag, LibraryForeachIDData *data) | ID **id_pp, LibraryIDLinkCallback callback, void *user_data, int flag, LibraryForeachIDData *data) | ||||
| { | { | ||||
| /* Needed e.g. for callbacks handling relationships... This call shall be absolutely readonly. */ | /* Needed e.g. for callbacks handling relationships... This call shall be absolutely readonly. */ | ||||
| ID *id = *id_pp; | ID *id = *id_pp; | ||||
| FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pp, IDWALK_CB_PRIVATE); | FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pp, IDWALK_CB_PRIVATE); | ||||
| BLI_assert(id == *id_pp); | BLI_assert(id == *id_pp); | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | switch ((ID_Type)GS(id->name)) { | ||||
| CALLBACK_INVOKE(smd->mask_id, IDWALK_CB_USER); | CALLBACK_INVOKE(smd->mask_id, IDWALK_CB_USER); | ||||
| } | } | ||||
| } | } | ||||
| SEQ_END | SEQ_END | ||||
| } | } | ||||
| CALLBACK_INVOKE(scene->gpd, IDWALK_CB_USER); | CALLBACK_INVOKE(scene->gpd, IDWALK_CB_USER); | ||||
| FOREACH_SCENE_COLLECTION_BEGIN(scene, sc) | for (CollectionObject *cob = scene->master_collection->gobject.first; cob; cob = cob->next) { | ||||
| { | CALLBACK_INVOKE(cob->ob, IDWALK_CB_USER); | ||||
| for (LinkData *link = sc->objects.first; link; link = link->next) { | |||||
| CALLBACK_INVOKE_ID(link->data, IDWALK_CB_USER); | |||||
| } | } | ||||
| for (CollectionChild *child = scene->master_collection->children.first; child; child = child->next) { | |||||
| CALLBACK_INVOKE(child->collection, IDWALK_CB_USER); | |||||
| } | } | ||||
| FOREACH_SCENE_COLLECTION_END; | |||||
| ViewLayer *view_layer; | ViewLayer *view_layer; | ||||
| for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) { | for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) { | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | for (Base *base = view_layer->object_bases.first; base; base = base->next) { | ||||
| CALLBACK_INVOKE(base->object, IDWALK_NOP); | CALLBACK_INVOKE(base->object, IDWALK_CB_NOP); | ||||
| } | } | ||||
| library_foreach_layer_collection(&data, &view_layer->layer_collections); | |||||
| for (FreestyleModuleConfig *fmc = view_layer->freestyle_config.modules.first; fmc; fmc = fmc->next) { | for (FreestyleModuleConfig *fmc = view_layer->freestyle_config.modules.first; fmc; fmc = fmc->next) { | ||||
| if (fmc->script) { | if (fmc->script) { | ||||
| CALLBACK_INVOKE(fmc->script, IDWALK_CB_NOP); | CALLBACK_INVOKE(fmc->script, IDWALK_CB_NOP); | ||||
| } | } | ||||
| } | } | ||||
| for (FreestyleLineSet *fls = view_layer->freestyle_config.linesets.first; fls; fls = fls->next) { | for (FreestyleLineSet *fls = view_layer->freestyle_config.linesets.first; fls; fls = fls->next) { | ||||
| if (fls->group) { | if (fls->group) { | ||||
| ▲ Show 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | switch ((ID_Type)GS(id->name)) { | ||||
| LightProbe *probe = (LightProbe *) id; | LightProbe *probe = (LightProbe *) id; | ||||
| CALLBACK_INVOKE(probe->image, IDWALK_CB_USER); | CALLBACK_INVOKE(probe->image, IDWALK_CB_USER); | ||||
| CALLBACK_INVOKE(probe->visibility_grp, IDWALK_CB_NOP); | CALLBACK_INVOKE(probe->visibility_grp, IDWALK_CB_NOP); | ||||
| break; | break; | ||||
| } | } | ||||
| case ID_GR: | case ID_GR: | ||||
| { | { | ||||
| Group *group = (Group *) id; | Collection *collection = (Collection *) id; | ||||
| FOREACH_GROUP_BASE_BEGIN(group, base) | for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) { | ||||
| { | CALLBACK_INVOKE(cob->ob, IDWALK_CB_USER); | ||||
| CALLBACK_INVOKE(base->object, IDWALK_CB_USER_ONE); | } | ||||
| for (CollectionChild *child = collection->children.first; child; child = child->next) { | |||||
| CALLBACK_INVOKE(child->collection, IDWALK_CB_USER); | |||||
| } | } | ||||
| FOREACH_GROUP_BASE_END | |||||
| break; | break; | ||||
| } | } | ||||
| case ID_NT: | case ID_NT: | ||||
| { | { | ||||
| bNodeTree *ntree = (bNodeTree *) id; | bNodeTree *ntree = (bNodeTree *) id; | ||||
| bNode *node; | bNode *node; | ||||
| bNodeSocket *sock; | bNodeSocket *sock; | ||||
| ▲ Show 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | case ID_KE: | ||||
| return ELEM(id_type_used, ID_ME, ID_CU, ID_LT); /* Warning! key->from, could be more types in future? */ | return ELEM(id_type_used, ID_ME, ID_CU, ID_LT); /* Warning! key->from, could be more types in future? */ | ||||
| case ID_SCR: | case ID_SCR: | ||||
| return ELEM(id_type_used, ID_SCE); | return ELEM(id_type_used, ID_SCE); | ||||
| case ID_WO: | case ID_WO: | ||||
| return (ELEM(id_type_used, ID_TE)); | return (ELEM(id_type_used, ID_TE)); | ||||
| case ID_SPK: | case ID_SPK: | ||||
| return ELEM(id_type_used, ID_SO); | return ELEM(id_type_used, ID_SO); | ||||
| case ID_GR: | case ID_GR: | ||||
| return ELEM(id_type_used, ID_OB); | return ELEM(id_type_used, ID_OB, ID_GR); | ||||
| case ID_NT: | case ID_NT: | ||||
| /* Could be the following, but node.id has no type restriction... */ | /* Could be the following, but node.id has no type restriction... */ | ||||
| #if 0 | #if 0 | ||||
| return ELEM(id_type_used, ID_GD /* + node.id types... */); | return ELEM(id_type_used, ID_GD /* + node.id types... */); | ||||
| #else | #else | ||||
| return true; | return true; | ||||
| #endif | #endif | ||||
| case ID_BR: | case ID_BR: | ||||
| ▲ Show 20 Lines • Show All 285 Lines • Show Last 20 Lines | |||||