diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-16 17:27:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-16 18:56:50 +0300 |
commit | bfc9d426bb95e2bc0dd4541d6b4c5f802909149c (patch) | |
tree | 37702887bc3185309a13612613efd2752ebe0639 /source/blender/blenkernel/intern/layer.c | |
parent | 80bb4254c6fb638cee0d33868c81c76c104817bf (diff) |
Multi-Object Editing
This adds initial multi-object editing support.
- Selected objects are used when entering edit & pose modes.
- Selection & tools work on all objects however many tools need porting
See: T54641 for remaining tasks.
Indentation will be done separately.
See patch: D3101
Diffstat (limited to 'source/blender/blenkernel/intern/layer.c')
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 50c7dc0c02f..5f24dd481e2 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -26,6 +26,7 @@ #include <string.h> +#include "BLI_array.h" #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_string_utf8.h" @@ -41,6 +42,7 @@ #include "BKE_main.h" #include "BKE_node.h" #include "BKE_workspace.h" +#include "BKE_object.h" #include "DEG_depsgraph.h" @@ -2235,6 +2237,61 @@ void BKE_renderable_objects_iterator_end(BLI_Iterator *UNUSED(iter)) /* Do nothing - iter->data was static allocated, we can't free it. */ } +/* -------------------------------------------------------------------- */ +/** \name BKE_view_layer_objects_in_mode_iterator + * \{ */ + +void BKE_view_layer_objects_in_mode_iterator_begin(BLI_Iterator *iter, void *data_in) +{ + struct ObjectsInModeIteratorData *data = data_in; + Base *base = data->base_active; + + /* when there are no objects */ + if (base == NULL) { + iter->valid = false; + return; + } + iter->data = data_in; + iter->current = base; +} + +void BKE_view_layer_objects_in_mode_iterator_next(BLI_Iterator *iter) +{ + struct ObjectsInModeIteratorData *data = iter->data; + Base *base = iter->current; + + if (base == data->base_active) { + /* first step */ + base = data->view_layer->object_bases.first; + if (base == data->base_active) { + base = base->next; + } + } + else { + base = base->next; + } + + while (base) { + if ((base->flag & BASE_SELECTED) != 0 && + (base->object->type == data->base_active->object->type) && + (base != data->base_active) && + (base->object->mode & data->object_mode)) + { + iter->current = base; + return; + } + base = base->next; + } + iter->valid = false; +} + +void BKE_view_layer_objects_in_mode_iterator_end(BLI_Iterator *UNUSED(iter)) +{ + /* do nothing */ +} + +/** \} */ + /* Evaluation */ /** |