Followup to Bugfix #6435 by Ton.
Added sensible way in calculateTransformCenter to report an error (including empty selection).
This commit is contained in:
parent
f712172ac3
commit
d193ce012a
@ -67,8 +67,11 @@ void initTransform(int mode, int context);
|
||||
void Transform(void);
|
||||
void Mirror(short mode);
|
||||
|
||||
/* Standalone call to get the transformation center corresponding to the current situation */
|
||||
void calculateTransformCenter(int centerMode, float *vec);
|
||||
/* Standalone call to get the transformation center corresponding to the current situation
|
||||
* returns 1 if successful, 0 otherwise (usually means there's no selection)
|
||||
* (if 0 is returns, *vec is unmodified)
|
||||
* */
|
||||
int calculateTransformCenter(int centerMode, float *vec);
|
||||
|
||||
struct TransInfo;
|
||||
struct ScrArea;
|
||||
|
@ -756,8 +756,9 @@ static void transformEvent(unsigned short event, short val) {
|
||||
}
|
||||
}
|
||||
|
||||
void calculateTransformCenter(int centerMode, float *vec)
|
||||
int calculateTransformCenter(int centerMode, float *vec)
|
||||
{
|
||||
int success = 1;
|
||||
checkFirstTime();
|
||||
|
||||
Trans.state = TRANS_RUNNING;
|
||||
@ -772,15 +773,24 @@ void calculateTransformCenter(int centerMode, float *vec)
|
||||
|
||||
Trans.around = centerMode; // override userdefined mode
|
||||
|
||||
calculateCenter(&Trans);
|
||||
|
||||
// Copy center from constraint center. Transform center can be local
|
||||
VECCOPY(vec, Trans.con.center);
|
||||
if (Trans.total == 0) {
|
||||
success = 0;
|
||||
}
|
||||
else {
|
||||
success = 1;
|
||||
|
||||
calculateCenter(&Trans);
|
||||
|
||||
// Copy center from constraint center. Transform center can be local
|
||||
VECCOPY(vec, Trans.con.center);
|
||||
}
|
||||
|
||||
postTrans(&Trans);
|
||||
|
||||
/* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */
|
||||
special_aftertrans_update(&Trans);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void initTransform(int mode, int context) {
|
||||
|
@ -578,6 +578,7 @@ void viewmove(int mode)
|
||||
|
||||
VECCOPY(ofs, G.vd->ofs);
|
||||
|
||||
/* If there's no selection, obofs is unmodified, so <0,0,0> */
|
||||
calculateTransformCenter(V3D_CENTROID, obofs);
|
||||
VecMulf(obofs, -1.0f);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user