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>2013-07-10 13:55:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-10 13:55:10 +0400
commit3f9629a4c74685c0a13b8cdfb34768f7b6864d1e (patch)
tree65165054d092988a4c95c9383c9b77a0881d2cf5 /source/blender/editors
parent6ebfdd8dc33264ca5f172065a5b1f3803eddf20a (diff)
patch [#36078] Fixes joining behavior for curves and armatures (when active object not selected).
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/armature_relations.c18
-rw-r--r--source/blender/editors/curve/editcurve.c18
-rw-r--r--source/blender/editors/mesh/meshtools.c7
3 files changed, 38 insertions, 5 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);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 0f96e886ef3..75de4e13707 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -6100,7 +6100,7 @@ void CURVE_OT_shade_flat(wmOperatorType *ot)
/************** join operator, to be used externally? ****************/
/* TODO: shape keys - as with meshes */
-int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
+int join_curve_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -6112,6 +6112,22 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
ListBase tempbase;
float imat[4][4], cmat[4][4];
int a;
+ bool ok = false;
+
+ 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 curve");
+ return OPERATOR_CANCELLED;
+ }
tempbase.first = tempbase.last = NULL;
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 51b5e30bc3f..950482df555 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -88,9 +88,10 @@ int join_mesh_exec(bContext *C, wmOperator *op)
Key *key, *nkey = NULL;
KeyBlock *kb, *okb, *kbn;
float imat[4][4], cmat[4][4], *fp1, *fp2;
- int a, b, totcol, totmat = 0, totedge = 0, totvert = 0, ok = 0;
+ int a, b, totcol, totmat = 0, totedge = 0, totvert = 0;
int totloop = 0, totpoly = 0, vertofs, *matmap = NULL;
int i, j, index, haskey = 0, edgeofs, loopofs, polyofs;
+ bool ok = false;
bDeformGroup *dg, *odg;
MDeformVert *dvert;
CustomData vdata, edata, fdata, ldata, pdata;
@@ -119,7 +120,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
totmat += base->object->totcol;
if (base->object == ob)
- ok = 1;
+ ok = true;
/* check for shapekeys */
if (me->key)
@@ -129,7 +130,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
/* that way the active object is always selected */
- if (ok == 0) {
+ if (ok == false) {
BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh");
return OPERATOR_CANCELLED;
}