Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_relations.c
| Show First 20 Lines • Show All 1,747 Lines • ▼ Show 20 Lines | static void libblock_relink_collection(Collection *collection, const bool do_collection) | ||||
| if (do_collection) { | if (do_collection) { | ||||
| BKE_libblock_relink_to_newid(&collection->id); | BKE_libblock_relink_to_newid(&collection->id); | ||||
| } | } | ||||
| for (CollectionObject *cob = collection->gobject.first; cob != NULL; cob = cob->next) { | for (CollectionObject *cob = collection->gobject.first; cob != NULL; cob = cob->next) { | ||||
| BKE_libblock_relink_to_newid(&cob->ob->id); | BKE_libblock_relink_to_newid(&cob->ob->id); | ||||
| } | } | ||||
| for (CollectionChild *child = collection->children.first; child; child = child->next) { | LISTBASE_FOREACH (CollectionChild *, child, &collection->children) { | ||||
| libblock_relink_collection(child->collection, true); | libblock_relink_collection(child->collection, true); | ||||
| } | } | ||||
| } | } | ||||
| static Collection *single_object_users_collection(Main *bmain, | static Collection *single_object_users_collection(Main *bmain, | ||||
| Scene *scene, | Scene *scene, | ||||
| Collection *collection, | Collection *collection, | ||||
| const int flag, | const int flag, | ||||
| const bool copy_collections, | const bool copy_collections, | ||||
| const bool is_master_collection) | const bool is_master_collection) | ||||
| { | { | ||||
| /* Generate new copies for objects in given collection and all its children, | /* Generate new copies for objects in given collection and all its children, | ||||
| * and optionally also copy collections themselves. */ | * and optionally also copy collections themselves. */ | ||||
| if (copy_collections && !is_master_collection) { | if (copy_collections && !is_master_collection) { | ||||
| collection = ID_NEW_SET(collection, BKE_collection_copy(bmain, NULL, collection)); | collection = ID_NEW_SET(collection, BKE_collection_copy(bmain, NULL, collection)); | ||||
| } | } | ||||
| /* We do not remap to new objects here, this is done in separate step. */ | /* We do not remap to new objects here, this is done in separate step. */ | ||||
| for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) { | LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) { | ||||
| Object *ob = cob->ob; | Object *ob = cob->ob; | ||||
| /* an object may be in more than one collection */ | /* an object may be in more than one collection */ | ||||
| if ((ob->id.newid == NULL) && ((ob->flag & flag) == flag)) { | if ((ob->id.newid == NULL) && ((ob->flag & flag) == flag)) { | ||||
| if (!ID_IS_LINKED(ob) && BKE_object_scenes_users_get(bmain, ob) > 1) { | if (!ID_IS_LINKED(ob) && BKE_object_scenes_users_get(bmain, ob) > 1) { | ||||
| ID_NEW_SET(ob, BKE_object_copy(bmain, ob)); | ID_NEW_SET(ob, BKE_object_copy(bmain, ob)); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 317 Lines • ▼ Show 20 Lines | FOREACH_SCENE_OBJECT_BEGIN (scene, ob) { | ||||
| if (!ID_IS_LINKED(ob)) { | if (!ID_IS_LINKED(ob)) { | ||||
| IDP_RelinkProperty(ob->id.properties); | IDP_RelinkProperty(ob->id.properties); | ||||
| } | } | ||||
| } | } | ||||
| FOREACH_SCENE_OBJECT_END; | FOREACH_SCENE_OBJECT_END; | ||||
| if (scene->nodetree) { | if (scene->nodetree) { | ||||
| IDP_RelinkProperty(scene->nodetree->id.properties); | IDP_RelinkProperty(scene->nodetree->id.properties); | ||||
| for (bNode *node = scene->nodetree->nodes.first; node; node = node->next) { | LISTBASE_FOREACH (bNode *, node, &scene->nodetree->nodes) { | ||||
| IDP_RelinkProperty(node->prop); | IDP_RelinkProperty(node->prop); | ||||
| } | } | ||||
| } | } | ||||
| if (scene->world) { | if (scene->world) { | ||||
| IDP_RelinkProperty(scene->world->id.properties); | IDP_RelinkProperty(scene->world->id.properties); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | if (adt) { | ||||
| if (adt->tmpact) { | if (adt->tmpact) { | ||||
| adt->tmpact->id.tag &= ~LIB_TAG_PRE_EXISTING; | adt->tmpact->id.tag &= ~LIB_TAG_PRE_EXISTING; | ||||
| } | } | ||||
| /* Drivers */ | /* Drivers */ | ||||
| /* TODO: need to handle the ID-targets too? */ | /* TODO: need to handle the ID-targets too? */ | ||||
| /* NLA Data */ | /* NLA Data */ | ||||
| for (NlaTrack *nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { | LISTBASE_FOREACH (NlaTrack *, nlt, &adt->nla_tracks) { | ||||
| make_local_animdata_tag_strips(&nlt->strips); | make_local_animdata_tag_strips(&nlt->strips); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void make_local_material_tag(Material *ma) | static void make_local_material_tag(Material *ma) | ||||
| { | { | ||||
| if (ma) { | if (ma) { | ||||
| ▲ Show 20 Lines • Show All 581 Lines • Show Last 20 Lines | |||||