[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58146] trunk/blender/source/blender/ editors: patch [#36078] Fixes joining behavior for curves and armatures ( when active object not selected).
Campbell Barton
ideasman42 at gmail.com
Wed Jul 10 11:55:10 CEST 2013
Revision: 58146
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58146
Author: campbellbarton
Date: 2013-07-10 09:55:10 +0000 (Wed, 10 Jul 2013)
Log Message:
-----------
patch [#36078] Fixes joining behavior for curves and armatures (when active object not selected).
Modified Paths:
--------------
trunk/blender/source/blender/editors/armature/armature_relations.c
trunk/blender/source/blender/editors/curve/editcurve.c
trunk/blender/source/blender/editors/mesh/meshtools.c
Modified: trunk/blender/source/blender/editors/armature/armature_relations.c
===================================================================
--- trunk/blender/source/blender/editors/armature/armature_relations.c 2013-07-10 09:40:49 UTC (rev 58145)
+++ trunk/blender/source/blender/editors/armature/armature_relations.c 2013-07-10 09:55:10 UTC (rev 58146)
@@ -170,7 +170,7 @@
}
/* 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 @@
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 @@
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);
Modified: trunk/blender/source/blender/editors/curve/editcurve.c
===================================================================
--- trunk/blender/source/blender/editors/curve/editcurve.c 2013-07-10 09:40:49 UTC (rev 58145)
+++ trunk/blender/source/blender/editors/curve/editcurve.c 2013-07-10 09:55:10 UTC (rev 58146)
@@ -6100,7 +6100,7 @@
/************** 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,7 +6112,23 @@
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;
/* trasnform all selected curves inverse in obact */
Modified: trunk/blender/source/blender/editors/mesh/meshtools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/meshtools.c 2013-07-10 09:40:49 UTC (rev 58145)
+++ trunk/blender/source/blender/editors/mesh/meshtools.c 2013-07-10 09:55:10 UTC (rev 58146)
@@ -88,9 +88,10 @@
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 @@
totmat += base->object->totcol;
if (base->object == ob)
- ok = 1;
+ ok = true;
/* check for shapekeys */
if (me->key)
@@ -129,7 +130,7 @@
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;
}
More information about the Bf-blender-cvs
mailing list