3D View: utility to get matrix from cursor
This commit is contained in:
@@ -98,6 +98,8 @@ typedef struct ViewDepths {
|
||||
} ViewDepths;
|
||||
|
||||
struct View3DCursor *ED_view3d_cursor3d_get(struct Scene *scene, struct View3D *v3d);
|
||||
void ED_view3d_cursor3d_calc_mat3(const struct Scene *scene, const struct View3D *v3d, float mat[3][3]);
|
||||
void ED_view3d_cursor3d_calc_mat4(const struct Scene *scene, const struct View3D *v3d, float mat[4][4]);
|
||||
void ED_view3d_cursor3d_position(struct bContext *C, float fp[3], const int mval[2]);
|
||||
void ED_view3d_cursor3d_update(struct bContext *C, const int mval[2]);
|
||||
|
||||
|
||||
@@ -81,6 +81,19 @@ View3DCursor *ED_view3d_cursor3d_get(Scene *scene, View3D *v3d)
|
||||
}
|
||||
}
|
||||
|
||||
void ED_view3d_cursor3d_calc_mat3(const Scene *scene, const View3D *v3d, float mat[3][3])
|
||||
{
|
||||
const View3DCursor *cursor = ED_view3d_cursor3d_get((Scene *)scene, (View3D *)v3d);
|
||||
quat_to_mat3(mat, cursor->rotation);
|
||||
}
|
||||
|
||||
void ED_view3d_cursor3d_calc_mat4(const Scene *scene, const View3D *v3d, float mat[4][4])
|
||||
{
|
||||
const View3DCursor *cursor = ED_view3d_cursor3d_get((Scene *)scene, (View3D *)v3d);
|
||||
quat_to_mat4(mat, cursor->rotation);
|
||||
copy_v3_v3(mat[3], cursor->location);
|
||||
}
|
||||
|
||||
Camera *ED_view3d_camera_data_get(View3D *v3d, RegionView3D *rv3d)
|
||||
{
|
||||
/* establish the camera object, so we can default to view mapping if anything is wrong with it */
|
||||
|
||||
@@ -672,7 +672,7 @@ int ED_transform_calc_manipulator_stats(
|
||||
case V3D_MANIP_CURSOR:
|
||||
{
|
||||
float mat[3][3];
|
||||
quat_to_mat3(mat, ED_view3d_cursor3d_get(scene, v3d)->rotation);
|
||||
ED_view3d_cursor3d_calc_mat3(scene, v3d, mat);
|
||||
copy_m4_m3(rv3d->twmat, mat);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -483,9 +483,8 @@ void initTransformOrientation(bContext *C, TransInfo *t)
|
||||
break;
|
||||
case V3D_MANIP_CURSOR:
|
||||
{
|
||||
const View3DCursor *cursor = ED_view3d_cursor3d_get(t->scene, CTX_wm_view3d(C));
|
||||
BLI_strncpy(t->spacename, IFACE_("cursor"), sizeof(t->spacename));
|
||||
quat_to_mat3(t->spacemtx, cursor->rotation);
|
||||
ED_view3d_cursor3d_calc_mat3(t->scene, CTX_wm_view3d(C), t->spacemtx);
|
||||
break;
|
||||
}
|
||||
case V3D_MANIP_CUSTOM:
|
||||
|
||||
Reference in New Issue
Block a user