Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-11-08 17:16:49 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-11-08 23:39:01 +0300
commit206c94fea98d44ed9667607638c455c7c0e63822 (patch)
treeddc1f6f30c18d10674daaeeaee6b465550447709 /source/blender/blenkernel/intern/layer.c
parent670e6cab4319b94c96c6a61cb76199f1054b935a (diff)
Farewell Scene->base
While getting rid of Scene->base we got the following fixes: * Fix "Convert To" operator * Fix "NLA allowing to selected objects that are not selectable * Fix scene.objects (readonly, no option to link/unlink) Note: Collada needs to use the context SceneLayer for adding objects however I added a placeholder, so Collada maintainers can fix this properly.
Diffstat (limited to 'source/blender/blenkernel/intern/layer.c')
-rw-r--r--source/blender/blenkernel/intern/layer.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 3544cf02afb..c6ee00c5839 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -204,6 +204,24 @@ static bool find_scene_collection_in_scene_collections(ListBase *lb, const Layer
}
/**
+ * Fallback for when a Scene has no camera to use
+ *
+ * \param scene_layer: in general you want to use the same SceneLayer that is used
+ * for depsgraph. If rendering you pass the scene active layer, when viewing in the viewport
+ * you want to get SceneLayer from context.
+ */
+Object *BKE_scene_layer_camera_find(SceneLayer *scene_layer)
+{
+ for (Base *base = scene_layer->object_bases.first; base; base = base->next) {
+ if (base->object->type == OB_CAMERA) {
+ return base->object;
+ }
+ }
+
+ return NULL;
+}
+
+/**
* Find the SceneLayer a LayerCollection belongs to
*/
SceneLayer *BKE_scene_layer_find_from_collection(const Scene *scene, LayerCollection *lc)