Cleanup: rename V3D_MANIP_* -> V3D_ORIENT_*
Wasn't obvious it's related to orientation, also term manipulator is no longer in use.
This commit is contained in:
parent
d86894b9e4
commit
46ac288a93
Notes:
blender-bot
2023-02-14 09:33:11 +01:00
Referenced by issue #77102, (v2.82+, CYCLES) Rendering with motion blur enabled causing unexpected, broken-looking result on specific frames Referenced by issue #61854, Blender 2.80 Grease Pencil surface offset by viewport distance instead of geometry surface Referenced by issue #61417, Blender 2.8 not showing image as planes meshes, then crashing on render Referenced by issue #61372, Crash on Add Curve Referenced by issue #61269, Crash when entering Particle Edit Mode with macOS + NVIDIA Referenced by issue #61213, Edge Seam not displayed
|
@ -464,7 +464,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
|
|||
|
||||
/* derive the rotation from the average normal:
|
||||
* - code taken from transform_gizmo.c,
|
||||
* calc_gizmo_stats, V3D_MANIP_NORMAL case
|
||||
* calc_gizmo_stats, V3D_ORIENT_NORMAL case
|
||||
*/
|
||||
/* we need the transpose of the inverse for a normal... */
|
||||
copy_m3_m4(imat, ob->obmat);
|
||||
|
|
|
@ -1359,19 +1359,19 @@ TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int flag)
|
|||
/**
|
||||
* Activate a transform orientation in a 3D view based on an enum value.
|
||||
*
|
||||
* \param orientation: If this is #V3D_MANIP_CUSTOM or greater, the custom transform orientation
|
||||
* with index \a orientation - #V3D_MANIP_CUSTOM gets activated.
|
||||
* \param orientation: If this is #V3D_ORIENT_CUSTOM or greater, the custom transform orientation
|
||||
* with index \a orientation - #V3D_ORIENT_CUSTOM gets activated.
|
||||
*/
|
||||
void BKE_scene_orientation_slot_set_index(TransformOrientationSlot *orient_slot, int orientation)
|
||||
{
|
||||
const bool is_custom = orientation >= V3D_MANIP_CUSTOM;
|
||||
orient_slot->type = is_custom ? V3D_MANIP_CUSTOM : orientation;
|
||||
orient_slot->index_custom = is_custom ? (orientation - V3D_MANIP_CUSTOM) : -1;
|
||||
const bool is_custom = orientation >= V3D_ORIENT_CUSTOM;
|
||||
orient_slot->type = is_custom ? V3D_ORIENT_CUSTOM : orientation;
|
||||
orient_slot->index_custom = is_custom ? (orientation - V3D_ORIENT_CUSTOM) : -1;
|
||||
}
|
||||
|
||||
int BKE_scene_orientation_slot_get_index(const TransformOrientationSlot *orient_slot)
|
||||
{
|
||||
return (orient_slot->type == V3D_MANIP_CUSTOM) ? (orient_slot->type + orient_slot->index_custom) : orient_slot->type;
|
||||
return (orient_slot->type == V3D_ORIENT_CUSTOM) ? (orient_slot->type + orient_slot->index_custom) : orient_slot->type;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -2216,7 +2216,7 @@ void BKE_scene_transform_orientation_remove(
|
|||
TransformOrientationSlot *orient_slot = &scene->orientation_slots[i];
|
||||
if (orient_slot->index_custom == orientation_index) {
|
||||
/* could also use orientation_index-- */
|
||||
orient_slot->type = V3D_MANIP_GLOBAL;
|
||||
orient_slot->type = V3D_ORIENT_GLOBAL;
|
||||
orient_slot->index_custom = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ static void gizmo_mesh_spin_init_draw_prepare(
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
|
||||
switch (orient_slot->type) {
|
||||
case V3D_MANIP_VIEW:
|
||||
case V3D_ORIENT_VIEW:
|
||||
{
|
||||
if (!equals_m3m3(viewinv_m3, ggd->prev.viewinv_m3)) {
|
||||
/* Take care calling refresh from draw_prepare,
|
||||
|
|
|
@ -4446,7 +4446,7 @@ void MESH_OT_select_axis(wmOperatorType *ot)
|
|||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_enum(ot->srna, "orientation", rna_enum_transform_orientation_items, V3D_MANIP_LOCAL, "Axis Mode", "Axis orientation");
|
||||
RNA_def_enum(ot->srna, "orientation", rna_enum_transform_orientation_items, V3D_ORIENT_LOCAL, "Axis Mode", "Axis orientation");
|
||||
RNA_def_enum(ot->srna, "sign", axis_sign_items, SELECT_AXIS_POS, "Axis Sign", "Side to select");
|
||||
RNA_def_enum(ot->srna, "axis", rna_enum_axis_xyz_items, 0, "Axis", "Select the axis to compare each vertex on");
|
||||
RNA_def_float(ot->srna, "threshold", 0.0001f, 0.000001f, 50.0f, "Threshold", "", 0.00001f, 10.0f);
|
||||
|
|
|
@ -985,7 +985,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
|
|||
stopConstraint(t);
|
||||
}
|
||||
else {
|
||||
setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_axis, msg1);
|
||||
setUserConstraint(t, V3D_ORIENT_GLOBAL, constraint_axis, msg1);
|
||||
}
|
||||
}
|
||||
else if (!edit_2d) {
|
||||
|
@ -993,7 +993,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
|
|||
/* First press, constraint to an axis. */
|
||||
t->orientation.index = 0;
|
||||
const short *orientation_ptr = t->orientation.types[t->orientation.index];
|
||||
const short orientation = orientation_ptr ? *orientation_ptr : V3D_MANIP_GLOBAL;
|
||||
const short orientation = orientation_ptr ? *orientation_ptr : V3D_ORIENT_GLOBAL;
|
||||
if (is_plane == false) {
|
||||
setUserConstraint(t, orientation, constraint_axis, msg2);
|
||||
}
|
||||
|
@ -1010,7 +1010,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
|
|||
}
|
||||
else {
|
||||
const short *orientation_ptr = t->orientation.types[t->orientation.index];
|
||||
const short orientation = orientation_ptr ? *orientation_ptr : V3D_MANIP_GLOBAL;
|
||||
const short orientation = orientation_ptr ? *orientation_ptr : V3D_ORIENT_GLOBAL;
|
||||
if (is_plane == false) {
|
||||
setUserConstraint(t, orientation, constraint_axis, msg2);
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
|
|||
if (ELEM(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
|
||||
|
||||
/* Scale isn't normally very useful after extrude along normals, see T39756 */
|
||||
if ((t->con.mode & CON_APPLY) && (t->con.orientation == V3D_MANIP_NORMAL)) {
|
||||
if ((t->con.mode & CON_APPLY) && (t->con.orientation == V3D_ORIENT_NORMAL)) {
|
||||
stopConstraint(t);
|
||||
}
|
||||
|
||||
|
@ -2138,7 +2138,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
|||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
|
||||
!RNA_property_is_set(op->ptr, prop) &&
|
||||
(t->orientation.user != V3D_MANIP_CUSTOM_MATRIX))
|
||||
(t->orientation.user != V3D_ORIENT_CUSTOM_MATRIX))
|
||||
{
|
||||
TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT];
|
||||
orient_slot->type = t->orientation.user;
|
||||
|
@ -2172,20 +2172,20 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
|||
* so use the orientation in the constraint if set */
|
||||
short orientation = (t->con.mode & CON_APPLY) ? t->con.orientation : t->orientation.user;
|
||||
|
||||
if (orientation == V3D_MANIP_CUSTOM) {
|
||||
if (orientation == V3D_ORIENT_CUSTOM) {
|
||||
const int orientation_index_custom = BKE_scene_transform_orientation_get_index(
|
||||
t->scene, t->orientation.custom);
|
||||
|
||||
/* Maybe we need a t->con.custom_orientation?
|
||||
* Seems like it would always match t->orientation.custom. */
|
||||
orientation = V3D_MANIP_CUSTOM + orientation_index_custom;
|
||||
BLI_assert(orientation >= V3D_MANIP_CUSTOM);
|
||||
orientation = V3D_ORIENT_CUSTOM + orientation_index_custom;
|
||||
BLI_assert(orientation >= V3D_ORIENT_CUSTOM);
|
||||
}
|
||||
|
||||
RNA_float_set_array(op->ptr, "constraint_matrix", &t->spacemtx[0][0]);
|
||||
|
||||
/* Use 'constraint_matrix' instead. */
|
||||
if (orientation != V3D_MANIP_CUSTOM_MATRIX) {
|
||||
if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
|
||||
RNA_enum_set(op->ptr, "constraint_orientation", orientation);
|
||||
}
|
||||
|
||||
|
|
|
@ -611,7 +611,7 @@ typedef struct TransInfo {
|
|||
short user_alt;
|
||||
short index;
|
||||
short *types[2];
|
||||
/* this gets used when custom_orientation is V3D_MANIP_CUSTOM */
|
||||
/* this gets used when custom_orientation is V3D_ORIENT_CUSTOM */
|
||||
TransformOrientation *custom;
|
||||
} orientation;
|
||||
/** backup from view3d, to restore on end. */
|
||||
|
|
|
@ -658,7 +658,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
|
|||
char text[256];
|
||||
|
||||
switch (orientation) {
|
||||
case V3D_MANIP_GLOBAL:
|
||||
case V3D_ORIENT_GLOBAL:
|
||||
{
|
||||
float mtx[3][3];
|
||||
BLI_snprintf(text, sizeof(text), ftext, IFACE_("global"));
|
||||
|
@ -666,11 +666,11 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
|
|||
setConstraint(t, mtx, mode, text);
|
||||
break;
|
||||
}
|
||||
case V3D_MANIP_LOCAL:
|
||||
case V3D_ORIENT_LOCAL:
|
||||
BLI_snprintf(text, sizeof(text), ftext, IFACE_("local"));
|
||||
setLocalConstraint(t, mode, text);
|
||||
break;
|
||||
case V3D_MANIP_NORMAL:
|
||||
case V3D_ORIENT_NORMAL:
|
||||
BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal"));
|
||||
if (checkUseAxisMatrix(t)) {
|
||||
setAxisMatrixConstraint(t, mode, text);
|
||||
|
@ -679,23 +679,23 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
|
|||
setConstraint(t, t->spacemtx, mode, text);
|
||||
}
|
||||
break;
|
||||
case V3D_MANIP_VIEW:
|
||||
case V3D_ORIENT_VIEW:
|
||||
BLI_snprintf(text, sizeof(text), ftext, IFACE_("view"));
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
case V3D_MANIP_CURSOR:
|
||||
case V3D_ORIENT_CURSOR:
|
||||
BLI_snprintf(text, sizeof(text), ftext, IFACE_("cursor"));
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
case V3D_MANIP_GIMBAL:
|
||||
case V3D_ORIENT_GIMBAL:
|
||||
BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal"));
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
case V3D_MANIP_CUSTOM_MATRIX:
|
||||
case V3D_ORIENT_CUSTOM_MATRIX:
|
||||
BLI_snprintf(text, sizeof(text), ftext, IFACE_("custom matrix"));
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
case V3D_MANIP_CUSTOM:
|
||||
case V3D_ORIENT_CUSTOM:
|
||||
{
|
||||
char orientation_str[128];
|
||||
BLI_snprintf(orientation_str, sizeof(orientation_str), "%s \"%s\"",
|
||||
|
|
|
@ -1418,8 +1418,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
|||
NULL);
|
||||
|
||||
/* Make second orientation local if both are global. */
|
||||
if (t->orientation.user == V3D_MANIP_GLOBAL) {
|
||||
t->orientation.user_alt = V3D_MANIP_LOCAL;
|
||||
if (t->orientation.user == V3D_ORIENT_GLOBAL) {
|
||||
t->orientation.user_alt = V3D_ORIENT_LOCAL;
|
||||
t->orientation.types[0] = &t->orientation.user_alt;
|
||||
SWAP(short *, t->orientation.types[0], t->orientation.types[1]);
|
||||
}
|
||||
|
@ -1514,7 +1514,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
|||
RNA_property_is_set(op->ptr, prop)))
|
||||
{
|
||||
RNA_property_float_get_array(op->ptr, prop, &t->spacemtx[0][0]);
|
||||
t->orientation.user = V3D_MANIP_CUSTOM_MATRIX;
|
||||
t->orientation.user = V3D_ORIENT_CUSTOM_MATRIX;
|
||||
t->orientation.custom = 0;
|
||||
}
|
||||
else if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
|
||||
|
@ -1523,14 +1523,14 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
|||
short orientation = RNA_property_enum_get(op->ptr, prop);
|
||||
TransformOrientation *custom_orientation = NULL;
|
||||
|
||||
if (orientation >= V3D_MANIP_CUSTOM) {
|
||||
if (orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) {
|
||||
orientation = V3D_MANIP_GLOBAL;
|
||||
if (orientation >= V3D_ORIENT_CUSTOM) {
|
||||
if (orientation >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) {
|
||||
orientation = V3D_ORIENT_GLOBAL;
|
||||
}
|
||||
else {
|
||||
custom_orientation = BKE_scene_transform_orientation_find(
|
||||
t->scene, orientation - V3D_MANIP_CUSTOM);
|
||||
orientation = V3D_MANIP_CUSTOM;
|
||||
t->scene, orientation - V3D_ORIENT_CUSTOM);
|
||||
orientation = V3D_ORIENT_CUSTOM;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -650,11 +650,11 @@ void ED_transform_calc_orientation_from_type_ex(
|
|||
bool ok = false;
|
||||
|
||||
switch (orientation_type) {
|
||||
case V3D_MANIP_GLOBAL:
|
||||
case V3D_ORIENT_GLOBAL:
|
||||
{
|
||||
break; /* nothing to do */
|
||||
}
|
||||
case V3D_MANIP_GIMBAL:
|
||||
case V3D_ORIENT_GIMBAL:
|
||||
{
|
||||
if (gimbal_axis(ob, r_mat)) {
|
||||
ok = true;
|
||||
|
@ -663,7 +663,7 @@ void ED_transform_calc_orientation_from_type_ex(
|
|||
/* if not gimbal, fall through to normal */
|
||||
ATTR_FALLTHROUGH;
|
||||
}
|
||||
case V3D_MANIP_NORMAL:
|
||||
case V3D_ORIENT_NORMAL:
|
||||
{
|
||||
if (obedit || ob->mode & OB_MODE_POSE) {
|
||||
ED_getTransformOrientationMatrix(C, r_mat, pivot_point);
|
||||
|
@ -673,7 +673,7 @@ void ED_transform_calc_orientation_from_type_ex(
|
|||
/* no break we define 'normal' as 'local' in Object mode */
|
||||
ATTR_FALLTHROUGH;
|
||||
}
|
||||
case V3D_MANIP_LOCAL:
|
||||
case V3D_ORIENT_LOCAL:
|
||||
{
|
||||
if (ob->mode & OB_MODE_POSE) {
|
||||
/* each bone moves on its own local axis, but to avoid confusion,
|
||||
|
@ -689,7 +689,7 @@ void ED_transform_calc_orientation_from_type_ex(
|
|||
ok = true;
|
||||
break;
|
||||
}
|
||||
case V3D_MANIP_VIEW:
|
||||
case V3D_ORIENT_VIEW:
|
||||
{
|
||||
if (rv3d != NULL) {
|
||||
copy_m3_m4(r_mat, rv3d->viewinv);
|
||||
|
@ -698,13 +698,13 @@ void ED_transform_calc_orientation_from_type_ex(
|
|||
}
|
||||
break;
|
||||
}
|
||||
case V3D_MANIP_CURSOR:
|
||||
case V3D_ORIENT_CURSOR:
|
||||
{
|
||||
ED_view3d_cursor3d_calc_mat3(scene, r_mat);
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
case V3D_MANIP_CUSTOM:
|
||||
case V3D_ORIENT_CUSTOM:
|
||||
{
|
||||
TransformOrientation *custom_orientation = BKE_scene_transform_orientation_find(
|
||||
scene, orientation_index_custom);
|
||||
|
@ -1235,7 +1235,7 @@ static void gizmo_xform_message_subscribe(
|
|||
extern PropertyRNA rna_Scene_cursor_location;
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_Scene_transform_orientation_slots,
|
||||
((ts->transform_pivot_point == V3D_AROUND_CURSOR) || (orient_slot->type == V3D_MANIP_CURSOR)) ?
|
||||
((ts->transform_pivot_point == V3D_AROUND_CURSOR) || (orient_slot->type == V3D_ORIENT_CURSOR)) ?
|
||||
&rna_Scene_cursor_location : NULL,
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
|
@ -1793,7 +1793,7 @@ static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *gzgr
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
|
||||
switch (orient_slot->type) {
|
||||
case V3D_MANIP_VIEW:
|
||||
case V3D_ORIENT_VIEW:
|
||||
{
|
||||
WIDGETGROUP_gizmo_refresh(C, gzgroup);
|
||||
break;
|
||||
|
@ -2076,7 +2076,7 @@ static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmGizmoGroup
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_SCALE);
|
||||
switch (orient_slot->type) {
|
||||
case V3D_MANIP_VIEW:
|
||||
case V3D_ORIENT_VIEW:
|
||||
{
|
||||
float viewinv_m3[3][3];
|
||||
copy_m3_m4(viewinv_m3, rv3d->viewinv);
|
||||
|
@ -2240,7 +2240,7 @@ static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup
|
|||
/* Shear is like rotate, use the rotate setting. */
|
||||
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
|
||||
switch (orient_slot->type) {
|
||||
case V3D_MANIP_VIEW:
|
||||
case V3D_ORIENT_VIEW:
|
||||
{
|
||||
float viewinv_m3[3][3];
|
||||
copy_m3_m4(viewinv_m3, rv3d->viewinv);
|
||||
|
|
|
@ -230,7 +230,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
|
|||
|
||||
ggd->data.orientation_type = scene->orientation_slots[SCE_ORIENT_DEFAULT].type;
|
||||
const bool use_normal = (
|
||||
(ggd->data.orientation_type != V3D_MANIP_NORMAL) ||
|
||||
(ggd->data.orientation_type != V3D_ORIENT_NORMAL) ||
|
||||
(axis_type == EXTRUDE_AXIS_NORMAL));
|
||||
const int axis_len_used = use_normal ? 4 : 3;
|
||||
|
||||
|
@ -240,7 +240,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
|
|||
struct TransformBounds tbounds_normal;
|
||||
if (!ED_transform_calc_gizmo_stats(
|
||||
C, &(struct TransformCalcParams){
|
||||
.orientation_type = V3D_MANIP_NORMAL + 1,
|
||||
.orientation_type = V3D_ORIENT_NORMAL + 1,
|
||||
}, &tbounds_normal))
|
||||
{
|
||||
unit_m3(tbounds_normal.axis);
|
||||
|
@ -353,7 +353,7 @@ static void gizmo_mesh_extrude_draw_prepare(const bContext *C, wmGizmoGroup *gzg
|
|||
{
|
||||
GizmoExtrudeGroup *ggd = gzgroup->customdata;
|
||||
switch (ggd->data.orientation_type) {
|
||||
case V3D_MANIP_VIEW:
|
||||
case V3D_ORIENT_VIEW:
|
||||
{
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
float mat[3][3];
|
||||
|
@ -401,7 +401,7 @@ static void gizmo_mesh_extrude_invoke_prepare(const bContext *UNUSED(C), wmGizmo
|
|||
if (i == 3) {
|
||||
use_normal_matrix = true;
|
||||
}
|
||||
else if (ggd->data.orientation_type == V3D_MANIP_NORMAL) {
|
||||
else if (ggd->data.orientation_type == V3D_ORIENT_NORMAL) {
|
||||
use_normal_matrix = true;
|
||||
}
|
||||
if (use_normal_matrix) {
|
||||
|
|
|
@ -228,7 +228,7 @@ static bool delete_orientation_poll(bContext *C)
|
|||
if (ED_operator_areaactive(C) == 0)
|
||||
return 0;
|
||||
|
||||
return ((scene->orientation_slots[SCE_ORIENT_DEFAULT].type >= V3D_MANIP_CUSTOM) &&
|
||||
return ((scene->orientation_slots[SCE_ORIENT_DEFAULT].type >= V3D_ORIENT_CUSTOM) &&
|
||||
(scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom != -1));
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ void BIF_clearTransformOrientation(bContext *C)
|
|||
|
||||
for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
|
||||
TransformOrientationSlot *orient_slot = &scene->orientation_slots[i];
|
||||
if (orient_slot->type == V3D_MANIP_CUSTOM) {
|
||||
orient_slot->type = V3D_MANIP_GLOBAL; /* fallback to global */
|
||||
if (orient_slot->type == V3D_ORIENT_CUSTOM) {
|
||||
orient_slot->type = V3D_ORIENT_GLOBAL; /* fallback to global */
|
||||
orient_slot->index_custom = -1;
|
||||
}
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
|
|||
|
||||
BLI_assert(index != -1);
|
||||
|
||||
scene->orientation_slots[SCE_ORIENT_DEFAULT].type = V3D_MANIP_CUSTOM;
|
||||
scene->orientation_slots[SCE_ORIENT_DEFAULT].type = V3D_ORIENT_CUSTOM;
|
||||
scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom = index;
|
||||
}
|
||||
|
||||
|
@ -413,26 +413,26 @@ void initTransformOrientation(bContext *C, TransInfo *t)
|
|||
Object *obedit = CTX_data_active_object(C);
|
||||
|
||||
switch (t->orientation.user) {
|
||||
case V3D_MANIP_GLOBAL:
|
||||
case V3D_ORIENT_GLOBAL:
|
||||
unit_m3(t->spacemtx);
|
||||
BLI_strncpy(t->spacename, IFACE_("global"), sizeof(t->spacename));
|
||||
break;
|
||||
|
||||
case V3D_MANIP_GIMBAL:
|
||||
case V3D_ORIENT_GIMBAL:
|
||||
unit_m3(t->spacemtx);
|
||||
if (ob && gimbal_axis(ob, t->spacemtx)) {
|
||||
BLI_strncpy(t->spacename, IFACE_("gimbal"), sizeof(t->spacename));
|
||||
break;
|
||||
}
|
||||
ATTR_FALLTHROUGH; /* no gimbal fallthrough to normal */
|
||||
case V3D_MANIP_NORMAL:
|
||||
case V3D_ORIENT_NORMAL:
|
||||
if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
|
||||
BLI_strncpy(t->spacename, IFACE_("normal"), sizeof(t->spacename));
|
||||
ED_getTransformOrientationMatrix(C, t->spacemtx, t->around);
|
||||
break;
|
||||
}
|
||||
ATTR_FALLTHROUGH; /* we define 'normal' as 'local' in Object mode */
|
||||
case V3D_MANIP_LOCAL:
|
||||
case V3D_ORIENT_LOCAL:
|
||||
BLI_strncpy(t->spacename, IFACE_("local"), sizeof(t->spacename));
|
||||
|
||||
if (ob) {
|
||||
|
@ -445,7 +445,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
|
|||
|
||||
break;
|
||||
|
||||
case V3D_MANIP_VIEW:
|
||||
case V3D_ORIENT_VIEW:
|
||||
if ((t->spacetype == SPACE_VIEW3D) &&
|
||||
(t->ar->regiontype == RGN_TYPE_WINDOW))
|
||||
{
|
||||
|
@ -461,17 +461,17 @@ void initTransformOrientation(bContext *C, TransInfo *t)
|
|||
unit_m3(t->spacemtx);
|
||||
}
|
||||
break;
|
||||
case V3D_MANIP_CURSOR:
|
||||
case V3D_ORIENT_CURSOR:
|
||||
{
|
||||
BLI_strncpy(t->spacename, IFACE_("cursor"), sizeof(t->spacename));
|
||||
ED_view3d_cursor3d_calc_mat3(t->scene, t->spacemtx);
|
||||
break;
|
||||
}
|
||||
case V3D_MANIP_CUSTOM_MATRIX:
|
||||
case V3D_ORIENT_CUSTOM_MATRIX:
|
||||
/* Already set. */
|
||||
BLI_strncpy(t->spacename, IFACE_("custom"), sizeof(t->spacename));
|
||||
break;
|
||||
case V3D_MANIP_CUSTOM:
|
||||
case V3D_ORIENT_CUSTOM:
|
||||
BLI_strncpy(t->spacename, t->orientation.custom->name, sizeof(t->spacename));
|
||||
|
||||
if (applyTransformOrientation(t->orientation.custom, t->spacemtx, t->spacename)) {
|
||||
|
|
|
@ -550,14 +550,17 @@ enum {
|
|||
#define V3D_SHOW_Z (1 << 3)
|
||||
|
||||
/** #TransformOrientationSlot.type */
|
||||
#define V3D_MANIP_GLOBAL 0
|
||||
#define V3D_MANIP_LOCAL 1
|
||||
#define V3D_MANIP_NORMAL 2
|
||||
#define V3D_MANIP_VIEW 3
|
||||
#define V3D_MANIP_GIMBAL 4
|
||||
#define V3D_MANIP_CURSOR 5
|
||||
#define V3D_MANIP_CUSTOM_MATRIX (V3D_MANIP_CUSTOM - 1) /* Runtime only, never saved to DNA. */
|
||||
#define V3D_MANIP_CUSTOM 1024
|
||||
enum {
|
||||
V3D_ORIENT_GLOBAL = 0,
|
||||
V3D_ORIENT_LOCAL = 1,
|
||||
V3D_ORIENT_NORMAL = 2,
|
||||
V3D_ORIENT_VIEW = 3,
|
||||
V3D_ORIENT_GIMBAL = 4,
|
||||
V3D_ORIENT_CURSOR = 5,
|
||||
V3D_ORIENT_CUSTOM = 1024,
|
||||
/** Runtime only, never saved to DNA. */
|
||||
V3D_ORIENT_CUSTOM_MATRIX = (V3D_ORIENT_CUSTOM - 1),
|
||||
};
|
||||
|
||||
/* View3d.mpr_flag (also) */
|
||||
enum {
|
||||
|
|
|
@ -463,15 +463,15 @@ const EnumPropertyItem rna_enum_transform_pivot_items_full[] = {
|
|||
|
||||
/* Icons could be made a consistent set of images. */
|
||||
const EnumPropertyItem rna_enum_transform_orientation_items[] = {
|
||||
{V3D_MANIP_GLOBAL, "GLOBAL", ICON_ORIENTATION_GLOBAL, "Global", "Align the transformation axes to world space"},
|
||||
{V3D_MANIP_LOCAL, "LOCAL", ICON_ORIENTATION_LOCAL, "Local", "Align the transformation axes to the selected objects' local space"},
|
||||
{V3D_MANIP_NORMAL, "NORMAL", ICON_ORIENTATION_NORMAL, "Normal",
|
||||
{V3D_ORIENT_GLOBAL, "GLOBAL", ICON_ORIENTATION_GLOBAL, "Global", "Align the transformation axes to world space"},
|
||||
{V3D_ORIENT_LOCAL, "LOCAL", ICON_ORIENTATION_LOCAL, "Local", "Align the transformation axes to the selected objects' local space"},
|
||||
{V3D_ORIENT_NORMAL, "NORMAL", ICON_ORIENTATION_NORMAL, "Normal",
|
||||
"Align the transformation axes to average normal of selected elements "
|
||||
"(bone Y axis for pose mode)"},
|
||||
{V3D_MANIP_GIMBAL, "GIMBAL", ICON_ORIENTATION_GIMBAL, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
|
||||
{V3D_MANIP_VIEW, "VIEW", ICON_ORIENTATION_VIEW, "View", "Align the transformation axes to the window"},
|
||||
{V3D_MANIP_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "Cursor", "Align the transformation axes to the 3D cursor"},
|
||||
// {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
|
||||
{V3D_ORIENT_GIMBAL, "GIMBAL", ICON_ORIENTATION_GIMBAL, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
|
||||
{V3D_ORIENT_VIEW, "VIEW", ICON_ORIENTATION_VIEW, "View", "Align the transformation axes to the window"},
|
||||
{V3D_ORIENT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "Cursor", "Align the transformation axes to the 3D cursor"},
|
||||
// {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -1984,7 +1984,7 @@ static void rna_ViewLayer_remove(
|
|||
}
|
||||
|
||||
/* Fake value, used internally (not saved to DNA). */
|
||||
#define V3D_MANIP_DEFAULT -1
|
||||
#define V3D_ORIENT_DEFAULT -1
|
||||
|
||||
static int rna_TransformOrientationSlot_type_get(PointerRNA *ptr)
|
||||
{
|
||||
|
@ -1992,7 +1992,7 @@ static int rna_TransformOrientationSlot_type_get(PointerRNA *ptr)
|
|||
TransformOrientationSlot *orient_slot = ptr->data;
|
||||
if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
|
||||
if ((orient_slot->flag & SELECT) == 0) {
|
||||
return V3D_MANIP_DEFAULT;
|
||||
return V3D_ORIENT_DEFAULT;
|
||||
}
|
||||
}
|
||||
return BKE_scene_orientation_slot_get_index(orient_slot);
|
||||
|
@ -2004,7 +2004,7 @@ void rna_TransformOrientationSlot_type_set(PointerRNA *ptr, int value)
|
|||
TransformOrientationSlot *orient_slot = ptr->data;
|
||||
|
||||
if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
|
||||
if (value == V3D_MANIP_DEFAULT) {
|
||||
if (value == V3D_ORIENT_DEFAULT) {
|
||||
orient_slot->flag &= ~SELECT;
|
||||
return;
|
||||
}
|
||||
|
@ -2021,7 +2021,7 @@ static PointerRNA rna_TransformOrientationSlot_get(PointerRNA *ptr)
|
|||
Scene *scene = ptr->id.data;
|
||||
TransformOrientationSlot *orient_slot = ptr->data;
|
||||
TransformOrientation *orientation;
|
||||
if (orient_slot->type < V3D_MANIP_CUSTOM) {
|
||||
if (orient_slot->type < V3D_ORIENT_CUSTOM) {
|
||||
orientation = NULL;
|
||||
}
|
||||
else {
|
||||
|
@ -2036,13 +2036,13 @@ static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(
|
|||
{
|
||||
EnumPropertyItem tmp = {0, "", 0, "", ""};
|
||||
EnumPropertyItem *item = NULL;
|
||||
int i = V3D_MANIP_CUSTOM, totitem = 0;
|
||||
int i = V3D_ORIENT_CUSTOM, totitem = 0;
|
||||
|
||||
if (include_default) {
|
||||
tmp.identifier = "DEFAULT";
|
||||
tmp.name = "Default";
|
||||
tmp.description = "Use the scene orientation";
|
||||
tmp.value = V3D_MANIP_DEFAULT;
|
||||
tmp.value = V3D_ORIENT_DEFAULT;
|
||||
tmp.icon = ICON_OBJECT_ORIGIN;
|
||||
RNA_enum_item_add(&item, &totitem, &tmp);
|
||||
tmp.icon = 0;
|
||||
|
@ -2092,7 +2092,7 @@ const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(
|
|||
return rna_TransformOrientation_impl_itemf(scene, include_default, r_free);
|
||||
}
|
||||
|
||||
#undef V3D_MANIP_DEFAULT
|
||||
#undef V3D_ORIENT_DEFAULT
|
||||
|
||||
void rna_TransformOrientationSlot_ui_info(
|
||||
ID *scene_id, TransformOrientationSlot *orient_slot,
|
||||
|
@ -2100,7 +2100,7 @@ void rna_TransformOrientationSlot_ui_info(
|
|||
{
|
||||
Scene *scene = (Scene *)scene_id;
|
||||
|
||||
if (orient_slot->type < V3D_MANIP_CUSTOM) {
|
||||
if (orient_slot->type < V3D_ORIENT_CUSTOM) {
|
||||
const EnumPropertyItem *items = rna_enum_transform_orientation_items;
|
||||
const int i = RNA_enum_from_value(items, orient_slot->type);
|
||||
strcpy(r_name, items[i].name);
|
||||
|
|
Loading…
Reference in New Issue