mask/image: rotate about 2d cursor now works.

This commit is contained in:
Campbell Barton 2012-07-26 10:52:59 +00:00
parent 25469dfb6d
commit ffe92d0e43
3 changed files with 23 additions and 7 deletions

@ -73,6 +73,7 @@
#include "BKE_context.h"
#include "BKE_tessmesh.h"
#include "BKE_tracking.h"
#include "BKE_mask.h"
#include "ED_anim_api.h"
#include "ED_armature.h"
@ -1449,9 +1450,27 @@ void calculateCenterCursor2D(TransInfo *t)
}
if (cursor) {
if (t->options & CTX_MASK) {
float co[2];
int width, height;
float frame_size[2];
SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
ED_space_image_get_size(sima, &width, &height);
frame_size[0] = width;
frame_size[1] = height;
BKE_mask_coord_from_frame(co, cursor, frame_size);
ED_space_image_get_aspect(sima, &aspx, &aspy);
t->center[0] = co[0] * aspx;
t->center[1] = co[1] * aspy;
}
else {
t->center[0] = cursor[0] * aspx;
t->center[1] = cursor[1] * aspy;
}
}
calculateCenter2D(t);
}

@ -3380,14 +3380,11 @@ static void UV_OT_reveal(wmOperatorType *ot)
static int set_2d_cursor_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
float location[2];
if (!sima)
return OPERATOR_CANCELLED;
RNA_float_get_array(op->ptr, "location", location);
sima->cursor[0] = location[0];
sima->cursor[1] = location[1];
RNA_float_get_array(op->ptr, "location", sima->cursor);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);

@ -2044,7 +2044,7 @@ static void rna_def_space_image(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "mode");
RNA_def_property_enum_items(prop, image_space_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceImageEditor_mode_update");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mode_update");
/* grease pencil */
prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);