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:
authorCampbell Barton <ideasman42@gmail.com>2020-10-28 09:33:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-28 09:33:17 +0300
commitfb3f0d3cf004006854db6694a61c097e490673c3 (patch)
tree4a2d7e8bc581fb232761f09f420c66273a8638ae
parent1be819ea666058977510d907f7eae88fa1de9581 (diff)
parent4f24808d08f47af661104f5976e17c57e8086ea9 (diff)
Merge branch 'blender-v2.91-release'
-rw-r--r--source/blender/editors/object/object_edit.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 3e7f028bd95..df940d3fa25 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -163,13 +163,32 @@ Object **ED_object_array_in_mode_or_selected(bContext *C,
ScrArea *area = CTX_wm_area(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob_active = OBACT(view_layer);
+ ID *id_pin = NULL;
+ const bool use_objects_in_mode = (ob_active != NULL) &&
+ (ob_active->mode & (OB_MODE_EDIT | OB_MODE_POSE));
+ const char space_type = area ? area->spacetype : SPACE_EMPTY;
Object **objects;
Object *ob = NULL;
bool use_ob = true;
- if (area && (area->spacetype == SPACE_PROPERTIES)) {
- /* May return pinned object. */
- ob = ED_object_context(C);
+
+ if (space_type == SPACE_PROPERTIES) {
+ SpaceProperties *sbuts = area->spacedata.first;
+ id_pin = sbuts->pinid;
+ }
+
+ if (id_pin && (GS(id_pin->name) == ID_OB)) {
+ /* Pinned data takes priority, in this case ignore selection & other objects in the mode. */
+ ob = (Object *)id_pin;
+ }
+ else if ((space_type == SPACE_PROPERTIES) && (use_objects_in_mode == false)) {
+ /* When using the space-properties, we don't want to use the entire selection
+ * as the current active object may not be selected.
+ *
+ * This is not the case when we're in a mode that supports multi-mode editing,
+ * since the active object and all other objects in the mode will be included
+ * irrespective of selection. */
+ ob = ob_active;
}
else if (ob_active && (ob_active->mode &
(OB_MODE_ALL_PAINT | OB_MODE_ALL_SCULPT | OB_MODE_ALL_PAINT_GPENCIL))) {
@@ -192,10 +211,10 @@ Object **ED_object_array_in_mode_or_selected(bContext *C,
}
}
else {
- const View3D *v3d = (area && area->spacetype == SPACE_VIEW3D) ? area->spacedata.first : NULL;
+ const View3D *v3d = (space_type == SPACE_VIEW3D) ? area->spacedata.first : NULL;
/* When in a mode that supports multiple active objects, use "objects in mode"
* instead of the object's selection. */
- if ((ob_active != NULL) && (ob_active->mode & (OB_MODE_EDIT | OB_MODE_POSE))) {
+ if (use_objects_in_mode) {
objects = BKE_view_layer_array_from_objects_in_mode(view_layer,
v3d,
r_objects_len,