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>2018-02-01 20:53:54 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-02-02 17:25:05 +0300
commita4d2b102f313b8d427e6ff6066f38cc3a2394628 (patch)
tree6af63f78564ab08127b134394b7cc9bb29e30bed /source/blender/blenkernel/intern/layer.c
parent26dff781b3c13ad21010d595d38baa5b8b6e06a5 (diff)
Collections: Operator to select collection objects
This is only supported by layer collections (the ones accessible in the outliner when you see "View Layer").
Diffstat (limited to 'source/blender/blenkernel/intern/layer.c')
-rw-r--r--source/blender/blenkernel/intern/layer.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 9332bafb256..4333faea863 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -988,6 +988,34 @@ void BKE_layer_collection_resync(const ID *owner_id, const SceneCollection *sc)
/* ---------------------------------------------------------------------- */
/**
+ * Select all the objects of this layer collection
+ *
+ * It also select the objects that are in nested collections.
+ * \note Recursive
+ */
+void BKE_layer_collection_objects_select(struct LayerCollection *layer_collection)
+{
+ if ((layer_collection->flag & COLLECTION_DISABLED) ||
+ ((layer_collection->flag & COLLECTION_SELECTABLE) == 0))
+ {
+ return;
+ }
+
+ for (LinkData *link = layer_collection->object_bases.first; link; link = link->next) {
+ Base *base = link->data;
+ if (base->flag & BASE_SELECTABLED) {
+ base->flag |= BASE_SELECTED;
+ }
+ }
+
+ for (LayerCollection *iter = layer_collection->layer_collections.first; iter; iter = iter->next) {
+ BKE_layer_collection_objects_select(iter);
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+
+/**
* Link a collection to a renderlayer
* The collection needs to be created separately
*/