Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/collection.c
| Show All 24 Lines | |||||
| #include "BLI_iterator.h" | #include "BLI_iterator.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_math_base.h" | #include "BLI_math_base.h" | ||||
| #include "BLI_threads.h" | #include "BLI_threads.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BKE_anim_data.h" | #include "BKE_anim_data.h" | ||||
| #include "BKE_collection.h" | #include "BKE_collection.h" | ||||
| #include "BKE_icons.h" | #include "BKE_icons.h" | ||||
ankitm: Run `make format` or use extensions (VSCode, Sublime Text) for `clang-format`.
Alphabetical… | |||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_idtype.h" | #include "BKE_idtype.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_lib_query.h" | #include "BKE_lib_query.h" | ||||
| #include "BKE_lib_remap.h" | #include "BKE_lib_remap.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_rigidbody.h" | #include "BKE_rigidbody.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_workspace.h" | |||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| #include "DNA_collection_types.h" | #include "DNA_collection_types.h" | ||||
| #include "DNA_layer_types.h" | #include "DNA_layer_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_rigidbody_types.h" | #include "DNA_rigidbody_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_windowmanager_types.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Prototypes | /** \name Prototypes | ||||
| ▲ Show 20 Lines • Show All 1,030 Lines • ▼ Show 20 Lines | void BKE_collections_child_remove_nulls(Main *bmain, Collection *collection) | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Move object from a collection into another | * Move object from a collection into another | ||||
| * | * | ||||
| * If source collection is NULL move it from all the existing collections. | * If source collection is NULL move it from all the existing collections. | ||||
| */ | */ | ||||
| void BKE_collection_object_move( | void BKE_collection_object_move(Main *bmain, | ||||
| Main *bmain, Scene *scene, Collection *collection_dst, Collection *collection_src, Object *ob) | Scene *scene, | ||||
| Collection *collection_dst, | |||||
| Collection *collection_src, | |||||
| Object *ob, | |||||
| ViewLayer *view_layer) | |||||
| { | { | ||||
| /* In both cases we first add the object, then remove it from the other collections. | /* In both cases we first add the object, then remove it from the other collections. | ||||
| * Otherwise we lose the original base and whether it was active and selected. */ | * Otherwise we lose the original base and whether it was active and selected. */ | ||||
| if (collection_src != NULL) { | if (collection_src != NULL) { | ||||
| if (BKE_collection_object_add(bmain, collection_dst, ob)) { | if (BKE_collection_object_add(bmain, collection_dst, ob)) { | ||||
| BKE_collection_object_remove(bmain, collection_src, ob, false); | BKE_collection_object_remove(bmain, collection_src, ob, false); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* Adding will fail if object is already in collection. | /* Adding will fail if object is already in collection. | ||||
| * However we still need to remove it from the other collections. */ | * However we still need to remove it from the other collections. */ | ||||
| BKE_collection_object_add(bmain, collection_dst, ob); | BKE_collection_object_add(bmain, collection_dst, ob); | ||||
| scene_collections_object_remove(bmain, scene, ob, false, collection_dst); | scene_collections_object_remove(bmain, scene, ob, false, collection_dst); | ||||
| } | } | ||||
| wmWindowManager *wm = bmain->wm.first; | |||||
Done Inline ActionsThe first view layer is not special, it may not be the active one dfelinto: The first view layer is not special, it may not be the active one | |||||
| LISTBASE_FOREACH (wmWindow *, window, &wm->windows) { | |||||
| bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); | |||||
| LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | |||||
| View3D *v3d = area->spacedata.first; | |||||
Done Inline ActionsUse LISTBASE_FOREACH. wmWindow *window = wm->windows.first; window != NULL; window = window->next ankitm: Use `LISTBASE_FOREACH`.
Same for
wmWindow *window = wm->windows.first; window != NULL… | |||||
| BKE_layer_collection_local_sync(view_layer, v3d); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Collection Scene Membership | /** \name Collection Scene Membership | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 686 Lines • Show Last 20 Lines | |||||
Run make format or use extensions (VSCode, Sublime Text) for clang-format.
Alphabetical order for headers.
Same for
https://wiki.blender.org/wiki/Tools/ClangFormat