27#include "RNA_prototypes.hh"
41 float matrix_space[4][4])
46 matrix_space[3][0] = (region->winx / 2) + snode->
xof;
47 matrix_space[3][1] = (region->winy / 2) + snode->
yof;
53 const float2 &image_offset,
54 float matrix_space[4][4])
59 matrix_space[3][0] = ((region->winx / 2) + snode->
xof) -
60 ((image_dims.x / 2.0f - image_offset.x) * snode->
zoom);
61 matrix_space[3][1] = ((region->winy / 2) + snode->
yof) -
62 ((image_dims.y / 2.0f - image_offset.y) * snode->
zoom);
78 matrix[0][0] = snode->
zoom;
79 matrix[1][1] = snode->
zoom;
80 matrix[3][0] = snode->
xof;
81 matrix[3][1] = snode->
yof;
88 const float(*matrix)[4] = (
const float(*)[4])value_p;
91 snode->
zoom = matrix[0][0];
92 snode->
xof = matrix[3][0];
93 snode->
yof = matrix[3][1];
107 if (node &&
ELEM(node->type, CMP_NODE_VIEWER)) {
134 const float origin[3] = {
float(region->winx / 2),
float(region->winy / 2), 0.0f};
142 (ibuf->
x > 0) ? ibuf->
x : 64.0f,
143 (ibuf->
y > 0) ? ibuf->
y : 64.0f,
161 params.range_get_fn =
nullptr;
174 gzgt->
name =
"Backdrop Transform Widget";
175 gzgt->
idname =
"NODE_GGT_backdrop_transform";
216 r_rect->
xmin = nxy->
fac_x1 + (offset.x / dims.x);
217 r_rect->
xmax = nxy->
fac_x2 + (offset.x / dims.x);
218 r_rect->
ymin = nxy->
fac_y2 + (offset.y / dims.y);
219 r_rect->
ymax = nxy->
fac_y1 + (offset.y / dims.y);
222 r_rect->
xmin = (nxy->
x1 + offset.x) / dims.x;
223 r_rect->
xmax = (nxy->
x2 + offset.x) / dims.x;
224 r_rect->
ymin = (nxy->
y2 + offset.y) / dims.y;
225 r_rect->
ymax = (nxy->
y1 + offset.y) / dims.y;
233 nxy->
fac_x1 = rect->
xmin - (offset.x / dims.x);
234 nxy->
fac_x2 = rect->
xmax - (offset.x / dims.x);
235 nxy->
fac_y2 = rect->
ymin - (offset.y / dims.y);
236 nxy->
fac_y1 = rect->
ymax - (offset.y / dims.y);
239 nxy->
x1 = rect->
xmin * dims.x - offset.x;
240 nxy->
x2 = rect->
xmax * dims.x - offset.x;
241 nxy->
y2 = rect->
ymin * dims.y - offset.y;
242 nxy->
y1 = rect->
ymax * dims.y - offset.y;
258 bool is_relative = bool(node->custom2);
271 const float(*matrix)[4] = (
const float(*)[4])value_p;
278 bool is_relative = bool(node->custom2);
282 BLI_rctf_recenter(&rct, ((matrix[3][0]) / dims[0]) + 0.5f, ((matrix[3][1]) / dims[1]) + 0.5f);
284 rct_isect.
xmin = offset.x / dims.x;
285 rct_isect.xmax = offset.x / dims.x + 1;
286 rct_isect.ymin = offset.y;
287 rct_isect.ymax = offset.y / dims.y + 1;
304 if (node &&
ELEM(node->type, CMP_NODE_CROP)) {
306 if ((node->custom1 & (1 << 0)) == 0) {
351 crop_group->
state.
dims[0] = (ibuf->
x > 0) ? ibuf->
x : 64.0f;
352 crop_group->
state.
dims[1] = (ibuf->
y > 0) ? ibuf->
y : 64.0f;
363 (
ID *)snode->
edittree, &RNA_CompositorNodeCrop, node);
370 params.range_get_fn =
nullptr;
383 gzgt->
name =
"Backdrop Crop Widget";
384 gzgt->
idname =
"NODE_GGT_backdrop_crop";
421 if (node &&
ELEM(node->type, CMP_NODE_SUNBEAMS)) {
467 sbeam_group->
state.
dims[0] = (ibuf->
x > 0) ? ibuf->
x : 64.0f;
468 sbeam_group->
state.
dims[1] = (ibuf->
y > 0) ? ibuf->
y : 64.0f;
476 (
ID *)snode->
edittree, &RNA_CompositorNodeSunBeams, node);
490 gzgt->
name =
"Sun Beams Widget";
491 gzgt->
idname =
"NODE_GGT_sbeam";
528 if (node &&
ELEM(node->type, CMP_NODE_CORNERPIN)) {
542 for (
int i = 0; i < 4; i++) {
561 float matrix_space[4][4];
565 for (
int i = 0; i < 4; i++) {
581 cpin_group->
state.
dims[0] = (ibuf->
x > 0) ? ibuf->
x : 64.0f;
582 cpin_group->
state.
dims[1] = (ibuf->
y > 0) ? ibuf->
y : 64.0f;
602 for (
int i = 0; i < 4; i++) {
613 gzgt->
name =
"Corner Pin Widget";
614 gzgt->
idname =
"NODE_GGT_backdrop_corner_pin";
SpaceNode * CTX_wm_space_node(const bContext *C)
Main * CTX_data_main(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
void unit_m4(float m[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
void BLI_rctf_recenter(struct rctf *rect, float x, float y)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
void BLI_rctf_resize(struct rctf *rect, float x, float y)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE
@ ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM
@ ED_GIZMO_MOVE_STYLE_CROSS_2D
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
@ WM_GIZMOGROUPTYPE_PERSISTENT
draw_view in_light_buf[] float
void *(* MEM_mallocN)(size_t len, const char *str)
bNode * node_get_active(bNodeTree *ntree)
static void two_xy_from_rect(NodeTwoXYs *nxy, const rctf *rect, const float2 &dims, const float2 &offset, bool is_relative)
static bool WIDGETGROUP_node_transform_poll(const bContext *C, wmGizmoGroupType *)
static void WIDGETGROUP_node_sbeam_setup(const bContext *, wmGizmoGroup *gzgroup)
static void WIDGETGROUP_node_corner_pin_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void WIDGETGROUP_node_corner_pin_setup(const bContext *, wmGizmoGroup *gzgroup)
static bool WIDGETGROUP_node_sbeam_poll(const bContext *C, wmGizmoGroupType *)
static void WIDGETGROUP_node_crop_setup(const bContext *, wmGizmoGroup *gzgroup)
void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt)
static void WIDGETGROUP_node_transform_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_node_crop_update(NodeCropWidgetGroup *crop_group)
static void WIDGETGROUP_node_sbeam_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static void WIDGETGROUP_node_corner_pin_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void WIDGETGROUP_node_sbeam_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void two_xy_to_rect(const NodeTwoXYs *nxy, const float2 &dims, const float2 offset, bool is_relative, rctf *r_rect)
static void gizmo_node_crop_prop_matrix_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt)
static void WIDGETGROUP_node_transform_setup(const bContext *, wmGizmoGroup *gzgroup)
static void gizmo_node_backdrop_prop_matrix_get(const wmGizmo *, wmGizmoProperty *gz_prop, void *value_p)
static void gizmo_node_backdrop_prop_matrix_set(const wmGizmo *, wmGizmoProperty *gz_prop, const void *value_p)
void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt)
void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt)
static void node_gizmo_calc_matrix_space(const SpaceNode *snode, const ARegion *region, float matrix_space[4][4])
static bool WIDGETGROUP_node_corner_pin_poll(const bContext *C, wmGizmoGroupType *)
static void WIDGETGROUP_node_crop_refresh(const bContext *C, wmGizmoGroup *gzgroup)
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])
static void gizmo_node_crop_prop_matrix_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static void WIDGETGROUP_node_crop_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static bool WIDGETGROUP_node_crop_poll(const bContext *C, wmGizmoGroupType *)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
struct bNodeTree * edittree
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoGroupFnRefresh refresh
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoGroupFnDrawPrepare draw_prepare
void(* customdata_free)(void *)
const wmGizmoPropertyType * type
struct wmGizmoProperty::@1373 custom_func
wmGizmoGroup * parent_gzgroup
wmGizmo * WM_gizmo_new(const char *idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
wmKeyMap * WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *, wmKeyConfig *kc)
void WM_gizmo_target_property_def_rna(wmGizmo *gz, const char *idname, PointerRNA *ptr, const char *propname, int index)
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
const wmGizmoType * WM_gizmotype_find(const char *idname, bool quiet)