From 906b9e0584b93094b1c45514fbf6fd8c62e6d015 Mon Sep 17 00:00:00 2001 From: Dan Eicher Date: Wed, 13 Jun 2012 23:04:32 +0000 Subject: [#26630] Several problems with API constraint_orientation Added a check to TRANSFORM_OT_create_orientation so it throws an exception instead of crashing blender (due to invalid view3d) Can still create an orientation from the console just can't set it to active with the 'use' parameter --- source/blender/editors/transform/transform_ops.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/editors/transform/transform_ops.c') diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index f00e2418ad9..81a4c082dcc 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -40,6 +40,7 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_armature.h" +#include "BKE_report.h" #include "WM_api.h" #include "WM_types.h" @@ -282,6 +283,11 @@ static int create_orientation_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "name", name); + if (use && !CTX_wm_view3d(C)) { + BKE_report(op->reports, RPT_ERROR, "Create Orientation \"use\" parameter only valid in a 3dView context"); + return OPERATOR_CANCELLED; + } + BIF_createTransformOrientation(C, op->reports, name, use, overwrite); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); -- cgit v1.2.3