Fix #116249: Compositor: Gizmos ignore backdrop transformations #119025
|
@ -50,13 +50,16 @@ static void node_gizmo_calc_matrix_space(const SpaceNode *snode,
|
|||
static void node_gizmo_calc_matrix_space_with_image_dims(const SpaceNode *snode,
|
||||
const ARegion *region,
|
||||
const float2 &image_dims,
|
||||
const float2 &image_offset,
|
||||
float matrix_space[4][4])
|
||||
{
|
||||
unit_m4(matrix_space);
|
||||
mul_v3_fl(matrix_space[0], snode->zoom * image_dims.x);
|
||||
mul_v3_fl(matrix_space[1], snode->zoom * image_dims.y);
|
||||
matrix_space[3][0] = ((region->winx / 2) + snode->xof) - ((image_dims.x / 2.0f) * snode->zoom);
|
||||
matrix_space[3][1] = ((region->winy / 2) + snode->yof) - ((image_dims.y / 2.0f) * snode->zoom);
|
||||
matrix_space[3][0] = ((region->winx / 2) + snode->xof) -
|
||||
((image_dims.x / 2.0f - image_offset.x) * snode->zoom);
|
||||
matrix_space[3][1] = ((region->winy / 2) + snode->yof) -
|
||||
((image_dims.y / 2.0f - image_offset.y) * snode->zoom);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -402,6 +405,7 @@ struct NodeSunBeamsWidgetGroup {
|
|||
|
||||
struct {
|
||||
float2 dims;
|
||||
float2 offset;
|
||||
} state;
|
||||
};
|
||||
|
||||
|
@ -448,7 +452,7 @@ static void WIDGETGROUP_node_sbeam_draw_prepare(const bContext *C, wmGizmoGroup
|
|||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
|
||||
node_gizmo_calc_matrix_space_with_image_dims(
|
||||
snode, region, sbeam_group->state.dims, gz->matrix_space);
|
||||
snode, region, sbeam_group->state.dims, sbeam_group->state.offset, gz->matrix_space);
|
||||
}
|
||||
|
||||
static void WIDGETGROUP_node_sbeam_refresh(const bContext *C, wmGizmoGroup *gzgroup)
|
||||
|
@ -464,6 +468,7 @@ static void WIDGETGROUP_node_sbeam_refresh(const bContext *C, wmGizmoGroup *gzgr
|
|||
if (ibuf) {
|
||||
sbeam_group->state.dims[0] = (ibuf->x > 0) ? ibuf->x : 64.0f;
|
||||
sbeam_group->state.dims[1] = (ibuf->y > 0) ? ibuf->y : 64.0f;
|
||||
sbeam_group->state.offset = {float(ima->offset_x), float(ima->offset_y)};
|
||||
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
bNode *node = nodeGetActive(snode->edittree);
|
||||
|
@ -507,6 +512,7 @@ struct NodeCornerPinWidgetGroup {
|
|||
|
||||
struct {
|
||||
float2 dims;
|
||||
float2 offset;
|
||||
} state;
|
||||
};
|
||||
|
||||
|
@ -556,7 +562,7 @@ static void WIDGETGROUP_node_corner_pin_draw_prepare(const bContext *C, wmGizmoG
|
|||
|
||||
float matrix_space[4][4];
|
||||
node_gizmo_calc_matrix_space_with_image_dims(
|
||||
snode, region, cpin_group->state.dims, matrix_space);
|
||||
snode, region, cpin_group->state.dims, cpin_group->state.offset, matrix_space);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
wmGizmo *gz = cpin_group->gizmos[i];
|
||||
|
@ -576,6 +582,7 @@ static void WIDGETGROUP_node_corner_pin_refresh(const bContext *C, wmGizmoGroup
|
|||
if (ibuf) {
|
||||
cpin_group->state.dims[0] = (ibuf->x > 0) ? ibuf->x : 64.0f;
|
||||
cpin_group->state.dims[1] = (ibuf->y > 0) ? ibuf->y : 64.0f;
|
||||
cpin_group->state.offset = {float(ima->offset_x), float(ima->offset_y)};
|
||||
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
bNode *node = nodeGetActive(snode->edittree);
|
||||
|
|
Loading…
Reference in New Issue