Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/context.c
| Show First 20 Lines • Show All 921 Lines • ▼ Show 20 Lines | |||||
| SceneLayer *CTX_data_scene_layer(const bContext *C) | SceneLayer *CTX_data_scene_layer(const bContext *C) | ||||
| { | { | ||||
| SceneLayer *sl; | SceneLayer *sl; | ||||
| if (ctx_data_pointer_verify(C, "render_layer", (void *)&sl)) { | if (ctx_data_pointer_verify(C, "render_layer", (void *)&sl)) { | ||||
| return sl; | return sl; | ||||
| } | } | ||||
| else { | else { | ||||
| return BKE_scene_layer_from_workspace_get(CTX_wm_workspace(C)); | return BKE_scene_layer_from_workspace_get(CTX_data_scene(C), CTX_wm_workspace(C)); | ||||
| } | } | ||||
| } | } | ||||
| const char *CTX_data_engine(const bContext *C) | |||||
| { | |||||
| const char *engine; | |||||
| if (ctx_data_pointer_verify(C, "engine", (void *)&engine)) { | |||||
| return engine; | |||||
| } | |||||
| Scene *scene = CTX_data_scene(C); | |||||
| WorkSpace *workspace = CTX_wm_workspace(C); | |||||
| return BKE_render_engine_get(scene, workspace); | |||||
| } | |||||
| /** | /** | ||||
| * This is tricky. Sometimes the user overrides the render_layer | * This is tricky. Sometimes the user overrides the render_layer | ||||
| * but not the scene_collection. In this case what to do? | * but not the scene_collection. In this case what to do? | ||||
| * | * | ||||
| * If the scene_collection is linked to the SceneLayer we use it. | * If the scene_collection is linked to the SceneLayer we use it. | ||||
| * Otherwise we fallback to the active one of the SceneLayer. | * Otherwise we fallback to the active one of the SceneLayer. | ||||
| */ | */ | ||||
| LayerCollection *CTX_data_layer_collection(const bContext *C) | LayerCollection *CTX_data_layer_collection(const bContext *C) | ||||
| ▲ Show 20 Lines • Show All 312 Lines • Show Last 20 Lines | |||||