Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/context.c
| Show All 24 Lines | |||||
| */ | */ | ||||
| #include <string.h> | #include <string.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stddef.h> | #include <stddef.h> | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_group_types.h" | |||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_space_types.h" | #include "DNA_space_types.h" | ||||
| #include "DNA_view3d_types.h" | #include "DNA_view3d_types.h" | ||||
| #include "DNA_windowmanager_types.h" | #include "DNA_windowmanager_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_linestyle_types.h" | #include "DNA_linestyle_types.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| ▲ Show 20 Lines • Show All 903 Lines • ▼ Show 20 Lines | |||||
| * Otherwise we fallback to the active one of the ViewLayer. | * Otherwise we fallback to the active one of the ViewLayer. | ||||
| */ | */ | ||||
| LayerCollection *CTX_data_layer_collection(const bContext *C) | LayerCollection *CTX_data_layer_collection(const bContext *C) | ||||
| { | { | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| LayerCollection *layer_collection; | LayerCollection *layer_collection; | ||||
| if (ctx_data_pointer_verify(C, "layer_collection", (void *)&layer_collection)) { | if (ctx_data_pointer_verify(C, "layer_collection", (void *)&layer_collection)) { | ||||
| if (BKE_view_layer_has_collection(view_layer, layer_collection->scene_collection)) { | if (BKE_view_layer_has_collection(view_layer, layer_collection->collection)) { | ||||
| return layer_collection; | return layer_collection; | ||||
| } | } | ||||
| } | } | ||||
| /* fallback */ | /* fallback */ | ||||
| return BKE_layer_collection_get_active(view_layer); | return BKE_layer_collection_get_active(view_layer); | ||||
| } | } | ||||
| SceneCollection *CTX_data_scene_collection(const bContext *C) | Collection *CTX_data_collection(const bContext *C) | ||||
| { | { | ||||
| SceneCollection *scene_collection; | Collection *collection; | ||||
| if (ctx_data_pointer_verify(C, "scene_collection", (void *)&scene_collection)) { | if (ctx_data_pointer_verify(C, "collection", (void *)&collection)) { | ||||
| return scene_collection; | return collection; | ||||
| } | } | ||||
| LayerCollection *layer_collection = CTX_data_layer_collection(C); | LayerCollection *layer_collection = CTX_data_layer_collection(C); | ||||
| if (layer_collection) { | if (layer_collection) { | ||||
| return layer_collection->scene_collection; | return layer_collection->collection; | ||||
| } | } | ||||
| /* fallback */ | /* fallback */ | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| return BKE_collection_master(&scene->id); | return BKE_collection_master(scene); | ||||
| } | } | ||||
| int CTX_data_mode_enum_ex(const Object *obedit, const Object *ob, const eObjectMode object_mode) | int CTX_data_mode_enum_ex(const Object *obedit, const Object *ob, const eObjectMode object_mode) | ||||
| { | { | ||||
| // Object *obedit = CTX_data_edit_object(C); | // Object *obedit = CTX_data_edit_object(C); | ||||
| if (obedit) { | if (obedit) { | ||||
| switch (obedit->type) { | switch (obedit->type) { | ||||
| case OB_MESH: | case OB_MESH: | ||||
| ▲ Show 20 Lines • Show All 270 Lines • Show Last 20 Lines | |||||