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:
authorAntonio Vazquez <blendergit@gmail.com>2020-11-13 15:17:17 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-11-13 17:21:15 +0300
commite9b955b99cd3cde127b52bff8c4559e2d57eeeb0 (patch)
tree1bdc8ebdada1b23948ef59c5751ca6f43f2fe636 /source/blender/blenkernel/intern/layer_utils.c
parent50ccf346f0b8bbf91811a88ba5f31a85dcab8467 (diff)
GPencil: Remove ID from operators to fix T82597
Instead to use the ID of the object, now the parameter is an Enum with Selected object or New. If use selected mode, the first grease pencil object selected is used. If none of the selected objects is a grease pencil object, a new object is created. Small cleanup changes to the original patch. Differential Revision: https://developer.blender.org/D9529
Diffstat (limited to 'source/blender/blenkernel/intern/layer_utils.c')
-rw-r--r--source/blender/blenkernel/intern/layer_utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/layer_utils.c b/source/blender/blenkernel/intern/layer_utils.c
index 513bc9e1420..b48aef2d05e 100644
--- a/source/blender/blenkernel/intern/layer_utils.c
+++ b/source/blender/blenkernel/intern/layer_utils.c
@@ -192,4 +192,19 @@ bool BKE_view_layer_filter_edit_mesh_has_edges(Object *ob, void *UNUSED(user_dat
return false;
}
+/** Select first selected object of the type specified. */
+Object *BKE_view_layer_first_selected_object_by_type(struct ViewLayer *view_layer,
+ const struct View3D *v3d,
+ const short ob_type)
+{
+ Object *ob_result = NULL;
+ FOREACH_SELECTED_OBJECT_BEGIN (view_layer, v3d, ob_iter) {
+ if (ob_iter->type == ob_type) {
+ ob_result = ob_iter;
+ break;
+ }
+ }
+ FOREACH_SELECTED_OBJECT_END;
+ return ob_result;
+}
/** \} */