36 {
RV3D_VIEW_LEFT,
"LEFT", ICON_TRIA_LEFT,
"Left",
"View from the left"},
37 {
RV3D_VIEW_RIGHT,
"RIGHT", ICON_TRIA_RIGHT,
"Right",
"View from the right"},
38 {
RV3D_VIEW_BOTTOM,
"BOTTOM", ICON_TRIA_DOWN,
"Bottom",
"View from the bottom"},
39 {
RV3D_VIEW_TOP,
"TOP", ICON_TRIA_UP,
"Top",
"View from the top"},
42 {0,
nullptr, 0,
nullptr,
nullptr},
63 float align_quat_buf[4];
64 float *align_quat =
nullptr;
69 if (obact !=
nullptr) {
77 align_quat = align_quat_buf;
113 int view_axis_roll_best = -1;
122 if (angle_best > angle_test) {
123 angle_best = angle_test;
125 view_axis_roll_best = j;
129 if (view_best == -1) {
143 view_axis_roll = view_axis_roll_best;
151 C, v3d, region, quat, viewnum, view_axis_roll, nextperspo, align_quat, smooth_viewtx);
153 perspo = rv3d->
persp;
163 ot->name =
"View Axis";
164 ot->description =
"Use a preset viewpoint";
165 ot->idname =
"VIEW3D_OT_view_axis";
179 ot->srna,
"align_active",
false,
"Align Active",
"Align to the active object's axis");
182 ot->srna,
"relative",
false,
"Relative",
"Rotate relative to the current orientation");
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void invert_qt_normalized(float q[4])
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void mat3_to_quat(float q[4], const float mat[3][3])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
float angle_signed_qtqt(const float q1[4], const float q2[4])
#define BLT_I18NCONTEXT_EDITOR_VIEW3D
@ RV3D_VIEW_AXIS_ROLL_270
bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_region)
bool ED_view3d_quat_from_axis_view(char view, char view_axis_roll, float r_quat[4])
bool ED_operator_rv3d_user_region_poll(bContext *C)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void axis_set_view(bContext *C, View3D *v3d, ARegion *region, const float quat_[4], char view, char view_axis_roll, int perspo, const float *align_to_quat, const int smooth_viewtx)
void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *region)
void VIEW3D_OT_view_axis(wmOperatorType *ot)
static wmOperatorStatus view_axis_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_view_items[]
int WM_operator_smooth_viewtx_get(const wmOperator *op)