code cleanup: minor edits for mask/transform
This commit is contained in:
parent
85571c339d
commit
ee572a9642
@ -34,12 +34,19 @@
|
|||||||
struct wmKeyConfig;
|
struct wmKeyConfig;
|
||||||
struct MaskLayer;
|
struct MaskLayer;
|
||||||
struct MaskLayerShape;
|
struct MaskLayerShape;
|
||||||
|
struct wmEvent;
|
||||||
|
|
||||||
/* mask_edit.c */
|
/* mask_edit.c */
|
||||||
void ED_mask_size(const struct bContext *C, int *width, int *height);
|
void ED_mask_size(const struct bContext *C, int *width, int *height);
|
||||||
void ED_mask_zoom(const struct bContext *C, float *zoomx, float *zoomy);
|
void ED_mask_zoom(const struct bContext *C, float *zoomx, float *zoomy);
|
||||||
void ED_mask_aspect(const struct bContext *C, float *aspx, float *aspy);
|
void ED_mask_aspect(const struct bContext *C, float *aspx, float *aspy);
|
||||||
|
|
||||||
|
void ED_mask_pixelspace_factor(const struct bContext *C, float *scalex, float *scaley);
|
||||||
|
void ED_mask_mouse_pos(const struct bContext *C, struct wmEvent *event, float co[2]);
|
||||||
|
|
||||||
|
void ED_mask_point_pos(const struct bContext *C, float x, float y, float *xr, float *yr);
|
||||||
|
void ED_mask_point_pos__reverse(const struct bContext *C, float x, float y, float *xr, float *yr);
|
||||||
|
|
||||||
void ED_operatortypes_mask(void);
|
void ED_operatortypes_mask(void);
|
||||||
void ED_keymap_mask(struct wmKeyConfig *keyconf);
|
void ED_keymap_mask(struct wmKeyConfig *keyconf);
|
||||||
void ED_operatormacros_mask(void);
|
void ED_operatormacros_mask(void);
|
||||||
|
@ -99,15 +99,6 @@ void ED_mask_select_flush_all(struct Mask *mask);
|
|||||||
int ED_maskedit_poll(struct bContext *C);
|
int ED_maskedit_poll(struct bContext *C);
|
||||||
int ED_maskedit_mask_poll(struct bContext *C);
|
int ED_maskedit_mask_poll(struct bContext *C);
|
||||||
|
|
||||||
void ED_mask_pixelspace_factor(const struct bContext *C, float *scalex, float *scaley);
|
|
||||||
void ED_mask_mouse_pos(const struct bContext *C, struct wmEvent *event, float co[2]);
|
|
||||||
|
|
||||||
void ED_mask_point_pos(const struct bContext *C, float x, float y, float *xr, float *yr);
|
|
||||||
void ED_mask_point_pos__reverse(const struct bContext *C, float x, float y, float *xr, float *yr);
|
|
||||||
|
|
||||||
void ED_mask_get_zoom(const bContext *C, float *zoomx, float *zoomy);
|
|
||||||
void ED_mask_get_size(const bContext *C, float *zoomx, float *zoomy);
|
|
||||||
|
|
||||||
/* mask_shapekey.c */
|
/* mask_shapekey.c */
|
||||||
void MASK_OT_shape_key_insert(struct wmOperatorType *ot);
|
void MASK_OT_shape_key_insert(struct wmOperatorType *ot);
|
||||||
void MASK_OT_shape_key_clear(struct wmOperatorType *ot);
|
void MASK_OT_shape_key_clear(struct wmOperatorType *ot);
|
||||||
|
@ -74,6 +74,7 @@
|
|||||||
#include "ED_view3d.h"
|
#include "ED_view3d.h"
|
||||||
#include "ED_mesh.h"
|
#include "ED_mesh.h"
|
||||||
#include "ED_clip.h"
|
#include "ED_clip.h"
|
||||||
|
#include "ED_mask.h"
|
||||||
|
|
||||||
#include "UI_view2d.h"
|
#include "UI_view2d.h"
|
||||||
#include "WM_types.h"
|
#include "WM_types.h"
|
||||||
@ -225,13 +226,24 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
|
|||||||
project_int_noclip(t->ar, vec, adr);
|
project_int_noclip(t->ar, vec, adr);
|
||||||
}
|
}
|
||||||
else if (t->spacetype == SPACE_IMAGE) {
|
else if (t->spacetype == SPACE_IMAGE) {
|
||||||
float aspx, aspy, v[2];
|
#if 0
|
||||||
|
if (t->options & CTX_MASK) {
|
||||||
|
float v[2];
|
||||||
|
ED_mask_point_pos__reverse(t->context, vec[0], vec[1], &v[0], &v[1]);
|
||||||
|
adr[0] = v[0];
|
||||||
|
adr[1] = v[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
float aspx, aspy, v[2];
|
||||||
|
|
||||||
ED_space_image_get_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
|
ED_space_image_get_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
|
||||||
v[0] = vec[0] / aspx;
|
v[0] = vec[0] / aspx;
|
||||||
v[1] = vec[1] / aspy;
|
v[1] = vec[1] / aspy;
|
||||||
|
|
||||||
UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1);
|
UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (t->spacetype == SPACE_ACTION) {
|
else if (t->spacetype == SPACE_ACTION) {
|
||||||
int out[2] = {0, 0};
|
int out[2] = {0, 0};
|
||||||
@ -272,10 +284,13 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
|
|||||||
|
|
||||||
copy_v2_v2(v, vec);
|
copy_v2_v2(v, vec);
|
||||||
|
|
||||||
if (t->options & CTX_MOVIECLIP)
|
if (t->options & CTX_MOVIECLIP) {
|
||||||
ED_space_clip_get_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
|
ED_space_clip_get_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
|
||||||
else if (t->options & CTX_MASK)
|
}
|
||||||
|
else if (t->options & CTX_MASK) {
|
||||||
|
/* MASKTODO - not working as expected */
|
||||||
ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
|
ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
|
||||||
|
}
|
||||||
|
|
||||||
v[0] /= aspx;
|
v[0] /= aspx;
|
||||||
v[1] /= aspy;
|
v[1] /= aspy;
|
||||||
|
Loading…
Reference in New Issue
Block a user