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>2021-01-29 03:12:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-29 03:43:14 +0300
commit82b06f3112b91572169339e69e9f91a8fabc7be2 (patch)
treeb9f772dcc502d8afd3e5cf19218cad33748acaa1 /source/blender/makesrna/intern/rna_wm_gizmo.c
parent213f8294b5c801c367fbddd6c1b4e6656908e71e (diff)
PyAPI: Add error when registering a 3D gizmo into a 2D gizmo group
Address issue raised in T85145.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_gizmo.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 5d4d661b16f..50270df5f36 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -600,6 +600,18 @@ static wmGizmo *rna_GizmoGroup_gizmo_new(wmGizmoGroup *gzgroup,
BKE_reportf(reports, RPT_ERROR, "GizmoType '%s' not known", idname);
return NULL;
}
+ if ((gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0) {
+ /* Allow for neither callbacks to be set, while this doesn't seem like a valid use case,
+ * there may be rare situations where a developer wants a gizmo to be draw-only. */
+ if ((gzt->test_select == NULL) && (gzt->draw_select != NULL)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "GizmoType '%s' is for a 3D gizmo-group. "
+ "The 'draw_select' callback is set where only 'test_select' will be used.",
+ idname);
+ return NULL;
+ }
+ }
wmGizmo *gz = WM_gizmo_new_ptr(gzt, gzgroup, NULL);
return gz;
}