Cleanup: Unify, move and rename transform flags
Flags unified: T_CURSOR -> CTX_CURSOR T_TEXTURE -> CTX_TEXTURE Flags moved: T_CAMERA -> CTX_CAMERA T_POSE -> CTX_POSE_BONE T_OBJECT -> CTX_OBJECT T_TEXTURE -> CTX_TEXTURE_SPACE Flag renamed: CTX_EDGE -> CTX_EDGE_DATA
This commit is contained in:
@@ -440,7 +440,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
|
||||
}
|
||||
else {
|
||||
/* Do we need more refined tags? */
|
||||
if (t->flag & T_POSE) {
|
||||
if (t->options & CTX_POSE_BONE) {
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
||||
}
|
||||
else {
|
||||
@@ -484,7 +484,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
WM_paint_cursor_tag_redraw(window, t->region);
|
||||
}
|
||||
else if (t->flag & T_CURSOR) {
|
||||
else if (t->options & CTX_CURSOR) {
|
||||
ED_area_tag_redraw(t->area);
|
||||
}
|
||||
else {
|
||||
@@ -895,7 +895,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
|
||||
break;
|
||||
case TFM_MODAL_ROTATE:
|
||||
/* only switch when... */
|
||||
if (!(t->options & CTX_TEXTURE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) {
|
||||
if (!(t->options & CTX_TEXTURE_SPACE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) {
|
||||
if (transform_mode_is_changeable(t->mode)) {
|
||||
restoreTransObjects(t);
|
||||
resetTransModal(t);
|
||||
@@ -1069,7 +1069,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
|
||||
t->modifiers &= ~(MOD_CONSTRAINT_SELECT | MOD_CONSTRAINT_PLANE);
|
||||
}
|
||||
else {
|
||||
if (t->flag & T_CAMERA) {
|
||||
if (t->options & CTX_CAMERA) {
|
||||
/* Exception for switching to dolly, or trackball, in camera view. */
|
||||
if (t->mode == TFM_TRANSLATION) {
|
||||
setLocalConstraint(t, (CON_AXIS2), TIP_("along local Z"));
|
||||
@@ -1382,7 +1382,7 @@ static void drawTransformPixel(const struct bContext *C, ARegion *region, void *
|
||||
*/
|
||||
if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) {
|
||||
if (region == t->region) {
|
||||
if (t->flag & (T_OBJECT | T_POSE)) {
|
||||
if (t->options & (CTX_OBJECT | CTX_POSE_BONE)) {
|
||||
if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) {
|
||||
drawAutoKeyWarning(t, region);
|
||||
}
|
||||
@@ -1652,7 +1652,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "texture_space")) &&
|
||||
RNA_property_is_set(op->ptr, prop)) {
|
||||
if (RNA_property_boolean_get(op->ptr, prop)) {
|
||||
options |= CTX_TEXTURE;
|
||||
options |= CTX_TEXTURE_SPACE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,83 +74,82 @@ struct wmTimer;
|
||||
/** #TransInfo.options */
|
||||
typedef enum {
|
||||
CTX_NONE = 0,
|
||||
CTX_TEXTURE = (1 << 0),
|
||||
CTX_EDGE = (1 << 1),
|
||||
CTX_NO_PET = (1 << 2),
|
||||
CTX_NO_MIRROR = (1 << 3),
|
||||
CTX_AUTOCONFIRM = (1 << 4),
|
||||
CTX_MOVIECLIP = (1 << 6),
|
||||
CTX_MASK = (1 << 7),
|
||||
CTX_PAINT_CURVE = (1 << 8),
|
||||
CTX_GPENCIL_STROKES = (1 << 9),
|
||||
CTX_CURSOR = (1 << 10),
|
||||
|
||||
/* These are similar to TransInfo::data_type. */
|
||||
CTX_CAMERA = (1 << 0),
|
||||
CTX_CURSOR = (1 << 1),
|
||||
CTX_EDGE_DATA = (1 << 2),
|
||||
CTX_GPENCIL_STROKES = (1 << 3),
|
||||
CTX_MASK = (1 << 4),
|
||||
CTX_MOVIECLIP = (1 << 5),
|
||||
CTX_OBJECT = (1 << 6),
|
||||
CTX_PAINT_CURVE = (1 << 7),
|
||||
CTX_POSE_BONE = (1 << 8),
|
||||
CTX_TEXTURE_SPACE = (1 << 9),
|
||||
|
||||
CTX_NO_PET = (1 << 10),
|
||||
CTX_NO_MIRROR = (1 << 11),
|
||||
CTX_AUTOCONFIRM = (1 << 12),
|
||||
/** When transforming object's, adjust the object data so it stays in the same place. */
|
||||
CTX_OBMODE_XFORM_OBDATA = (1 << 11),
|
||||
CTX_OBMODE_XFORM_OBDATA = (1 << 13),
|
||||
/** Transform object parents without moving their children. */
|
||||
CTX_OBMODE_XFORM_SKIP_CHILDREN = (1 << 12),
|
||||
CTX_OBMODE_XFORM_SKIP_CHILDREN = (1 << 14),
|
||||
} eTContext;
|
||||
|
||||
/** #TransInfo.flag */
|
||||
typedef enum {
|
||||
T_OBJECT = 1 << 0,
|
||||
/** \note We could remove 'T_EDIT' and use 'obedit_type', for now ensure they're in sync. */
|
||||
T_EDIT = 1 << 1,
|
||||
T_POSE = 1 << 2,
|
||||
T_TEXTURE = 1 << 3,
|
||||
/** Transforming the 3d view. */
|
||||
T_CAMERA = 1 << 4,
|
||||
/** Transforming the 3D cursor. */
|
||||
T_CURSOR = 1 << 5,
|
||||
T_EDIT = 1 << 0,
|
||||
/** Transform points, having no rotation/scale. */
|
||||
T_POINTS = 1 << 6,
|
||||
T_POINTS = 1 << 1,
|
||||
/** restrictions flags */
|
||||
T_NO_CONSTRAINT = 1 << 7,
|
||||
T_NULL_ONE = 1 << 8,
|
||||
T_NO_ZERO = 1 << 9,
|
||||
T_NO_CONSTRAINT = 1 << 2,
|
||||
T_NULL_ONE = 1 << 3,
|
||||
T_NO_ZERO = 1 << 4,
|
||||
T_ALL_RESTRICTIONS = T_NO_CONSTRAINT | T_NULL_ONE | T_NO_ZERO,
|
||||
|
||||
T_PROP_EDIT = 1 << 10,
|
||||
T_PROP_CONNECTED = 1 << 11,
|
||||
T_PROP_PROJECTED = 1 << 12,
|
||||
T_PROP_EDIT = 1 << 5,
|
||||
T_PROP_CONNECTED = 1 << 6,
|
||||
T_PROP_PROJECTED = 1 << 7,
|
||||
T_PROP_EDIT_ALL = T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED,
|
||||
|
||||
T_V3D_ALIGN = 1 << 13,
|
||||
T_V3D_ALIGN = 1 << 8,
|
||||
/** For 2D views such as UV or f-curve. */
|
||||
T_2D_EDIT = 1 << 14,
|
||||
T_CLIP_UV = 1 << 15,
|
||||
T_2D_EDIT = 1 << 9,
|
||||
T_CLIP_UV = 1 << 10,
|
||||
|
||||
/** Auto-IK is on. */
|
||||
T_AUTOIK = 1 << 16,
|
||||
T_AUTOIK = 1 << 11,
|
||||
|
||||
/** Don't use mirror even if the data-block option is set. */
|
||||
T_NO_MIRROR = 1 << 17,
|
||||
T_NO_MIRROR = 1 << 12,
|
||||
|
||||
/** To indicate that the value set in the `value` parameter is the final
|
||||
* value of the transformation, modified only by the constrain. */
|
||||
T_INPUT_IS_VALUES_FINAL = 1 << 18,
|
||||
T_INPUT_IS_VALUES_FINAL = 1 << 13,
|
||||
|
||||
/** To specify if we save back settings at the end. */
|
||||
T_MODAL = 1 << 19,
|
||||
T_MODAL = 1 << 14,
|
||||
|
||||
/** No re-topology (projection). */
|
||||
T_NO_PROJECT = 1 << 20,
|
||||
T_NO_PROJECT = 1 << 15,
|
||||
|
||||
T_RELEASE_CONFIRM = 1 << 21,
|
||||
T_RELEASE_CONFIRM = 1 << 16,
|
||||
|
||||
/** Alternative transformation. used to add offset to tracking markers. */
|
||||
T_ALT_TRANSFORM = 1 << 22,
|
||||
T_ALT_TRANSFORM = 1 << 17,
|
||||
|
||||
/** #TransInfo.center has been set, don't change it. */
|
||||
T_OVERRIDE_CENTER = 1 << 23,
|
||||
T_OVERRIDE_CENTER = 1 << 18,
|
||||
|
||||
T_MODAL_CURSOR_SET = 1 << 24,
|
||||
T_MODAL_CURSOR_SET = 1 << 19,
|
||||
|
||||
T_CLNOR_REBUILD = 1 << 25,
|
||||
T_CLNOR_REBUILD = 1 << 20,
|
||||
|
||||
/** Merges unselected into selected after transforming (runs after transforming). */
|
||||
T_AUTOMERGE = 1 << 26,
|
||||
T_AUTOMERGE = 1 << 21,
|
||||
/** Runs auto-merge & splits. */
|
||||
T_AUTOSPLIT = 1 << 27,
|
||||
T_AUTOSPLIT = 1 << 22,
|
||||
} eTFlag;
|
||||
|
||||
/** #TransInfo.modifiers */
|
||||
|
||||
@@ -914,7 +914,7 @@ static void drawObjectConstraint(TransInfo *t)
|
||||
mul_m3_m3m3(tmp_axismtx, tc->mat3_unit, td->axismtx);
|
||||
axismtx = tmp_axismtx;
|
||||
}
|
||||
else if (t->flag & T_POSE) {
|
||||
else if (t->options & CTX_POSE_BONE) {
|
||||
mul_v3_m4v3(co, tc->mat, td->center);
|
||||
axismtx = td->axismtx;
|
||||
}
|
||||
|
||||
@@ -928,10 +928,10 @@ int special_transform_moving(TransInfo *t)
|
||||
if (t->spacetype == SPACE_GRAPH) {
|
||||
return G_TRANSFORM_FCURVES;
|
||||
}
|
||||
if ((t->flag & T_EDIT) || (t->flag & T_POSE)) {
|
||||
if ((t->flag & T_EDIT) || (t->options & CTX_POSE_BONE)) {
|
||||
return G_TRANSFORM_EDIT;
|
||||
}
|
||||
if (t->flag & (T_OBJECT | T_TEXTURE)) {
|
||||
if (t->options & (CTX_OBJECT | CTX_TEXTURE_SPACE)) {
|
||||
return G_TRANSFORM_OBJ;
|
||||
}
|
||||
|
||||
@@ -985,8 +985,6 @@ void createTransData(bContext *C, TransInfo *t)
|
||||
|
||||
/* if tests must match recalcData for correct updates */
|
||||
if (t->options & CTX_CURSOR) {
|
||||
t->flag |= T_CURSOR;
|
||||
|
||||
if (t->spacetype == SPACE_IMAGE) {
|
||||
convert_type = TC_CURSOR_IMAGE;
|
||||
}
|
||||
@@ -998,11 +996,10 @@ void createTransData(bContext *C, TransInfo *t)
|
||||
(ob->mode == OB_MODE_SCULPT) && ob->sculpt) {
|
||||
convert_type = TC_SCULPT;
|
||||
}
|
||||
else if (t->options & CTX_TEXTURE) {
|
||||
t->flag |= T_TEXTURE;
|
||||
else if (t->options & CTX_TEXTURE_SPACE) {
|
||||
convert_type = TC_OBJECT_TEXSPACE;
|
||||
}
|
||||
else if (t->options & CTX_EDGE) {
|
||||
else if (t->options & CTX_EDGE_DATA) {
|
||||
t->flag |= T_EDIT;
|
||||
convert_type = TC_MESH_EDGES;
|
||||
/* Multi object editing. */
|
||||
@@ -1142,6 +1139,8 @@ void createTransData(bContext *C, TransInfo *t)
|
||||
/* In grease pencil all transformations must be canceled if not Object or Edit. */
|
||||
}
|
||||
else {
|
||||
t->options |= CTX_OBJECT;
|
||||
|
||||
/* Needed for correct Object.obmat after duplication, see: T62135. */
|
||||
BKE_scene_graph_evaluated_ensure(t->depsgraph, CTX_data_main(t->context));
|
||||
|
||||
@@ -1152,7 +1151,6 @@ void createTransData(bContext *C, TransInfo *t)
|
||||
t->options |= CTX_OBMODE_XFORM_SKIP_CHILDREN;
|
||||
}
|
||||
|
||||
t->flag |= T_OBJECT;
|
||||
convert_type = TC_OBJECT;
|
||||
}
|
||||
|
||||
@@ -1164,6 +1162,7 @@ void createTransData(bContext *C, TransInfo *t)
|
||||
createTransActionData(C, t);
|
||||
break;
|
||||
case TC_POSE:
|
||||
t->options |= CTX_POSE_BONE;
|
||||
createTransPose(t);
|
||||
/* Disable PET, its not usable in pose mode yet T32444. */
|
||||
init_prop_edit = false;
|
||||
@@ -1225,11 +1224,11 @@ void createTransData(bContext *C, TransInfo *t)
|
||||
if ((rv3d->persp == RV3D_CAMOB) && v3d->camera) {
|
||||
/* we could have a flag to easily check an object is being transformed */
|
||||
if (v3d->camera->id.tag & LIB_TAG_DOIT) {
|
||||
t->flag |= T_CAMERA;
|
||||
t->options |= CTX_CAMERA;
|
||||
}
|
||||
}
|
||||
else if (v3d->ob_center && v3d->ob_center->id.tag & LIB_TAG_DOIT) {
|
||||
t->flag |= T_CAMERA;
|
||||
t->options |= CTX_CAMERA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -870,8 +870,6 @@ void createTransPose(TransInfo *t)
|
||||
t->mode = TFM_RESIZE;
|
||||
}
|
||||
}
|
||||
|
||||
t->flag |= T_POSE;
|
||||
}
|
||||
|
||||
void createTransArmatureVerts(TransInfo *t)
|
||||
|
||||
@@ -963,7 +963,7 @@ void recalcData_objects(TransInfo *t)
|
||||
*/
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
|
||||
|
||||
if (t->flag & T_TEXTURE) {
|
||||
if (t->options & CTX_TEXTURE_SPACE) {
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
}
|
||||
}
|
||||
@@ -991,7 +991,7 @@ void recalcData_objects(TransInfo *t)
|
||||
|
||||
void special_aftertrans_update__object(bContext *C, TransInfo *t)
|
||||
{
|
||||
BLI_assert(t->flag & (T_OBJECT | T_TEXTURE));
|
||||
BLI_assert(t->options & (CTX_OBJECT | CTX_TEXTURE_SPACE));
|
||||
|
||||
Object *ob;
|
||||
const bool canceled = (t->state == TRANS_CANCEL);
|
||||
|
||||
@@ -225,7 +225,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
|
||||
t->flag = 0;
|
||||
|
||||
if (obact && !(t->options & (CTX_CURSOR | CTX_TEXTURE)) &&
|
||||
if (obact && !(t->options & (CTX_CURSOR | CTX_TEXTURE_SPACE)) &&
|
||||
ELEM(object_mode, OB_MODE_EDIT, OB_MODE_EDIT_GPENCIL)) {
|
||||
t->obedit_type = obact->type;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
|
||||
/* Crease needs edge flag */
|
||||
if (ELEM(t->mode, TFM_CREASE, TFM_BWEIGHT)) {
|
||||
t->options |= CTX_EDGE;
|
||||
t->options |= CTX_EDGE_DATA;
|
||||
}
|
||||
|
||||
t->remove_on_cancel = false;
|
||||
@@ -1110,7 +1110,7 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (t->flag & T_POSE) {
|
||||
else if (t->options & CTX_POSE_BONE) {
|
||||
ViewLayer *view_layer = t->view_layer;
|
||||
Object *ob = OBACT(view_layer);
|
||||
if (ED_object_calc_active_center_for_posemode(ob, select_only, r_center)) {
|
||||
@@ -1187,10 +1187,10 @@ void calculateCenter(TransInfo *t)
|
||||
calculateCenter2D(t);
|
||||
|
||||
/* For panning from the camera-view. */
|
||||
if ((t->flag & T_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) {
|
||||
if ((t->options & CTX_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) {
|
||||
if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) {
|
||||
|
||||
if (t->flag & T_CAMERA) {
|
||||
if (t->options & CTX_CAMERA) {
|
||||
float axis[3];
|
||||
/* persinv is nasty, use viewinv instead, always right */
|
||||
copy_v3_v3(axis, t->viewinv[2]);
|
||||
|
||||
@@ -70,7 +70,7 @@ int transform_mode_really_used(bContext *C, int mode)
|
||||
bool transdata_check_local_center(TransInfo *t, short around)
|
||||
{
|
||||
return ((around == V3D_AROUND_LOCAL_ORIGINS) &&
|
||||
((t->flag & (T_OBJECT | T_POSE)) ||
|
||||
((t->options & (CTX_OBJECT | CTX_POSE_BONE)) ||
|
||||
/* implicit: (t->flag & T_EDIT) */
|
||||
(ELEM(t->obedit_type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE, OB_GPENCIL)) ||
|
||||
(t->spacetype == SPACE_GRAPH) ||
|
||||
@@ -629,7 +629,7 @@ void ElementRotation_ex(TransInfo *t,
|
||||
* matrix (and inverse). That is not all though. Once the proper translation
|
||||
* has been computed, it has to be converted back into the bone's space.
|
||||
*/
|
||||
else if (t->flag & T_POSE) {
|
||||
else if (t->options & CTX_POSE_BONE) {
|
||||
/* Extract and invert armature object matrix */
|
||||
|
||||
if ((td->flag & TD_NO_LOC) == 0) {
|
||||
@@ -1026,7 +1026,7 @@ void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, float ma
|
||||
mul_v3_fl(vec, td->factor);
|
||||
}
|
||||
|
||||
if (t->flag & (T_OBJECT | T_POSE)) {
|
||||
if (t->options & (CTX_OBJECT | CTX_POSE_BONE)) {
|
||||
mul_m3_v3(td->smtx, vec);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ static void applyAlign(TransInfo *t, const int UNUSED(mval[2]))
|
||||
}
|
||||
|
||||
/* around local centers */
|
||||
if (t->flag & (T_OBJECT | T_POSE)) {
|
||||
if (t->options & (CTX_OBJECT | CTX_POSE_BONE)) {
|
||||
copy_v3_v3(tc->center_local, td->center);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -152,7 +152,7 @@ static void ElementMirror(TransInfo *t, TransDataContainer *tc, TransData *td, i
|
||||
sub_v3_v3(vec, td->center);
|
||||
}
|
||||
|
||||
if (t->flag & (T_OBJECT | T_POSE)) {
|
||||
if (t->options & (CTX_OBJECT | CTX_POSE_BONE)) {
|
||||
mul_m3_v3(td->smtx, vec);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ static void applyTranslationValue(TransInfo *t, const float vec[3])
|
||||
const float *original_normal;
|
||||
|
||||
/* In pose mode, we want to align normals with Y axis of bones... */
|
||||
if (t->flag & T_POSE) {
|
||||
if (t->options & CTX_POSE_BONE) {
|
||||
original_normal = td->axismtx[1];
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -332,7 +332,7 @@ void applyProject(TransInfo *t)
|
||||
if (tc->use_local_mat) {
|
||||
mul_m4_v3(tc->mat, iloc);
|
||||
}
|
||||
else if (t->flag & T_OBJECT) {
|
||||
else if (t->options & CTX_OBJECT) {
|
||||
BKE_object_eval_transform_all(t->depsgraph, t->scene, td->ob);
|
||||
copy_v3_v3(iloc, td->ob->obmat[3]);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ void applyProject(TransInfo *t)
|
||||
|
||||
add_v3_v3(td->loc, tvec);
|
||||
|
||||
if (t->tsnap.align && (t->flag & T_OBJECT)) {
|
||||
if (t->tsnap.align && (t->options & CTX_OBJECT)) {
|
||||
/* handle alignment as well */
|
||||
const float *original_normal;
|
||||
float mat[3][3];
|
||||
@@ -422,7 +422,7 @@ void applyGridAbsolute(TransInfo *t)
|
||||
if (tc->use_local_mat) {
|
||||
mul_m4_v3(tc->mat, iloc);
|
||||
}
|
||||
else if (t->flag & T_OBJECT) {
|
||||
else if (t->options & CTX_OBJECT) {
|
||||
BKE_object_eval_transform_all(t->depsgraph, t->scene, td->ob);
|
||||
copy_v3_v3(iloc, td->ob->obmat[3]);
|
||||
}
|
||||
@@ -571,7 +571,8 @@ static void initSnappingMode(TransInfo *t)
|
||||
}
|
||||
}
|
||||
|
||||
if ((t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) && (t->flag & T_CAMERA) == 0) {
|
||||
if ((t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) &&
|
||||
(t->options & CTX_CAMERA) == 0) {
|
||||
/* Only 3D view or UV. */
|
||||
/* Not with camera selected in camera view. */
|
||||
|
||||
@@ -1068,7 +1069,7 @@ static void TargetSnapClosest(TransInfo *t)
|
||||
TransData *closest = NULL;
|
||||
|
||||
/* Object mode */
|
||||
if (t->flag & T_OBJECT) {
|
||||
if (t->options & CTX_OBJECT) {
|
||||
int i;
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
TransData *td = tc->data;
|
||||
|
||||
Reference in New Issue
Block a user