diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-30 10:39:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-30 11:53:19 +0300 |
commit | 12bc34b0b81b11186e3814f8a255f1226f0588c3 (patch) | |
tree | 3d18bb58c9f0973753e70931a73ebf7a270fbf02 /source/blender/editors/object/object_vgroup.c | |
parent | 1a623c183f32fb913f4cadd63d2a667087df7637 (diff) |
Object: add ED_object_array_in_mode_or_selected
Use this utility function for render-shading & weight paint modes.
This adds support for edit-mode & pose-mode where all objects in the
mode are used in this case instead of the selected objects.
Diffstat (limited to 'source/blender/editors/object/object_vgroup.c')
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 41541288e07..a144632fc5f 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -84,54 +84,6 @@ static bool vertex_group_supported_poll_ex(bContext *C, const Object *ob); /** \name Local Utility Functions * \{ */ -static Object **object_array_for_wpaint_impl(bContext *C, - bool (*filter_fn)(struct Object *ob, void *user_data), - void *filter_user_data, - uint *r_objects_len) -{ - Object **objects; - - Object *ob = NULL; - bool use_ob = true; - if (CTX_wm_space_properties(C)) { - /* May return pinned object. */ - ob = ED_object_context(C); - } - else if (CTX_data_mode_enum(C) == CTX_MODE_PAINT_WEIGHT) { - /* When painting, limit to active. */ - ob = CTX_data_active_object(C); - } - else { - /* Otherwise use full selection. */ - use_ob = false; - } - - if (use_ob) { - if (!filter_fn(ob, filter_user_data)) { - ob = NULL; - } - *r_objects_len = (ob != NULL) ? 1 : 0; - objects = MEM_mallocN(sizeof(*objects) * *r_objects_len, __func__); - if (ob != NULL) { - objects[0] = ob; - } - } - else { - ViewLayer *view_layer = CTX_data_view_layer(C); - const View3D *v3d = CTX_wm_view3d(C); /* may be NULL. */ - objects = BKE_view_layer_array_selected_objects_params( - view_layer, - v3d, - r_objects_len, - &((const struct ObjectsInViewLayerParams){ - .no_dup_data = true, - .filter_fn = filter_fn, - .filter_userdata = filter_user_data, - })); - } - return objects; -} - static bool object_array_for_wpaint_filter(Object *ob, void *user_data) { bContext *C = user_data; @@ -143,7 +95,7 @@ static bool object_array_for_wpaint_filter(Object *ob, void *user_data) static Object **object_array_for_wpaint(bContext *C, uint *r_objects_len) { - return object_array_for_wpaint_impl(C, object_array_for_wpaint_filter, C, r_objects_len); + return ED_object_array_in_mode_or_selected(C, object_array_for_wpaint_filter, C, r_objects_len); } static bool vertex_group_use_vert_sel(Object *ob) |