Fix error redoing shrink fatten

Use a property to store even-offset option.
This commit is contained in:
Campbell Barton 2015-05-25 15:45:56 +10:00
parent 7fd93dc8dc
commit a5a648c7c6
3 changed files with 30 additions and 0 deletions

View File

@ -2024,6 +2024,18 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
}
{
const char *prop_id = NULL;
if (t->mode == TFM_SHRINKFATTEN) {
prop_id = "use_even_offset";
}
if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id))) {
RNA_property_boolean_set(op->ptr, prop, (t->flag & T_ALT_TRANSFORM) != 0);
}
}
}
/* note: caller needs to free 't' on a 0 return */

View File

@ -80,6 +80,7 @@
#include "BKE_editmesh.h"
#include "BKE_tracking.h"
#include "BKE_mask.h"
#include "BKE_utildefines.h"
#include "ED_anim_api.h"
#include "ED_armature.h"
@ -1069,6 +1070,8 @@ static int initTransInfo_edit_pet_to_flag(const int proportional)
* Setup internal data, mouse, vectors
*
* \note \a op and \a event can be NULL
*
* \see #saveTransform does the reverse.
*/
void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event)
{
@ -1160,6 +1163,19 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->spacetype = sa->spacetype;
}
/* handle T_ALT_TRANSFORM initialization, we may use for different operators */
if (op) {
const char *prop_id = NULL;
if (t->mode == TFM_SHRINKFATTEN) {
prop_id = "use_even_offset";
}
if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id)) &&
RNA_property_is_set(op->ptr, prop))
{
BKE_BIT_TEST_SET(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM);
}
}
if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;

View File

@ -791,6 +791,8 @@ static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness");
Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP);
}