diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-10 13:55:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-10 13:55:10 +0400 |
commit | 3f9629a4c74685c0a13b8cdfb34768f7b6864d1e (patch) | |
tree | 65165054d092988a4c95c9383c9b77a0881d2cf5 /source/blender/editors/armature/armature_relations.c | |
parent | 6ebfdd8dc33264ca5f172065a5b1f3803eddf20a (diff) |
patch [#36078] Fixes joining behavior for curves and armatures (when active object not selected).
Diffstat (limited to 'source/blender/editors/armature/armature_relations.c')
-rw-r--r-- | source/blender/editors/armature/armature_relations.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index d5dbe80538f..289901076a1 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -170,7 +170,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } /* join armature exec is exported for use in object->join objects operator... */ -int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) +int join_armature_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -180,6 +180,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) bPoseChannel *pchan, *pchann; EditBone *curbone; float mat[4][4], oimat[4][4]; + bool ok = false; /* Ensure we're not in editmode and that the active object is an armature*/ if (!ob || ob->type != OB_ARMATURE) @@ -187,6 +188,21 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) if (!arm || arm->edbo) return OPERATOR_CANCELLED; + CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) + { + if (base->object == ob) { + ok = true; + break; + } + } + CTX_DATA_END; + + /* that way the active object is always selected */ + if (ok == false) { + BKE_report(op->reports, RPT_WARNING, "Active object is not a selected armature"); + return OPERATOR_CANCELLED; + } + /* Get editbones of active armature to add editbones to */ ED_armature_to_edit(ob); |