31#include "RNA_prototypes.hh"
45 float matrix_space[4][4])
50 matrix_space[3][0] = (region->
winx / 2) + snode->
xof;
51 matrix_space[3][1] = (region->
winy / 2) + snode->
yof;
57 const float2 &image_offset,
58 float matrix_space[4][4])
63 matrix_space[3][0] = ((region->
winx / 2) + snode->
xof) -
64 ((image_dims.x / 2.0f - image_offset.x) * snode->
zoom);
65 matrix_space[3][1] = ((region->
winy / 2) + snode->
yof) -
66 ((image_dims.y / 2.0f - image_offset.y) * snode->
zoom);
72 if (snode ==
nullptr) {
94 if (ibuf && ibuf->
x > 0 && ibuf->
y > 0) {
100 return fallback_dims;
116 matrix[0][0] = snode->
zoom;
117 matrix[1][1] = snode->
zoom;
118 matrix[3][0] = snode->
xof;
119 matrix[3][1] = snode->
yof;
126 const float (*matrix)[4] = (
const float (*)[4])value_p;
129 snode->
zoom = matrix[0][0];
130 snode->
xof = matrix[3][0];
131 snode->
yof = matrix[3][1];
143 if (node && node->is_type(
"CompositorNodeViewer")) {
198 params.range_get_fn =
nullptr;
207 gzgt->
name =
"Backdrop Transform Widget";
208 gzgt->
idname =
"NODE_GGT_backdrop_transform";
253 nullptr, &RNA_NodeSocket,
const_cast<bNodeSocket *
>(x_input));
254 const float xmin =
float(
RNA_int_get(&x_input_rna_pointer,
"default_value"));
258 nullptr, &RNA_NodeSocket,
const_cast<bNodeSocket *
>(y_input));
259 const float ymin =
float(
RNA_int_get(&y_input_rna_pointer,
"default_value"));
263 nullptr, &RNA_NodeSocket,
const_cast<bNodeSocket *
>(width_input));
264 const float width =
float(
RNA_int_get(&width_input_rna_pointer,
"default_value"));
268 nullptr, &RNA_NodeSocket,
const_cast<bNodeSocket *
>(height_input));
269 const float height =
float(
RNA_int_get(&height_input_rna_pointer,
"default_value"));
271 r_rect->
xmin = (xmin + offset.x) / dims.x;
272 r_rect->
xmax = (xmin + width + offset.x) / dims.x;
273 r_rect->
ymin = (ymin + offset.y) / dims.y;
274 r_rect->
ymax = (ymin + height + offset.y) / dims.y;
284 nullptr, &RNA_NodeSocket,
const_cast<bNodeSocket *
>(x_input));
288 nullptr, &RNA_NodeSocket,
const_cast<bNodeSocket *
>(y_input));
292 nullptr, &RNA_NodeSocket,
const_cast<bNodeSocket *
>(width_input));
296 nullptr, &RNA_NodeSocket,
const_cast<bNodeSocket *
>(height_input));
298 const float xmin = rect->
xmin * dims.x - offset.x;
299 const float width = rect->
xmax * dims.x - offset.x - xmin;
300 const float ymin = rect->
ymin * dims.y - offset.y;
301 const float height = rect->
ymax * dims.y - offset.y - ymin;
303 RNA_int_set(&x_input_rna_pointer,
"default_value",
int(xmin));
304 RNA_int_set(&y_input_rna_pointer,
"default_value",
int(ymin));
305 RNA_int_set(&width_input_rna_pointer,
"default_value",
int(width));
306 RNA_int_set(&height_input_rna_pointer,
"default_value",
int(height));
334 const float (*matrix)[4] = (
const float (*)[4])value_p;
344 BLI_rctf_recenter(&rct, ((matrix[3][0]) / dims[0]) + 0.5f, ((matrix[3][1]) / dims[1]) + 0.5f);
346 rct_isect.
xmin = offset.x / dims.x;
347 rct_isect.
xmax = offset.x / dims.x + 1;
348 rct_isect.
ymin = offset.y;
349 rct_isect.
ymax = offset.y / dims.y + 1;
364 if (!node || !node->is_type(
"CompositorNodeCrop")) {
368 snode->
edittree->ensure_topology_cache();
375 else if (
STREQ(
input->name,
"Alpha Crop") && !
input->is_directly_linked()) {
442 reinterpret_cast<ID *
>(snode->
edittree), &RNA_NodeSocket, source_input);
449 params.range_get_fn =
nullptr;
458 gzgt->
name =
"Backdrop Crop Widget";
459 gzgt->
idname =
"NODE_GGT_backdrop_crop";
486 const float aspect = dims.x / dims.y;
488 float loc[3],
rot[3][3],
size[3];
497 loc[0] = (position.x - 0.5) * dims.x + offset.x;
498 loc[1] = (position.y - 0.5) * dims.y + offset.y;
503 size[0] = size_value.x;
504 size[1] = size_value.y * aspect;
514 const float (*matrix)[4] = (
const float (*)[4])value_p;
527 const float aspect = dims.x / dims.y;
529 rct.
xmin = position.x - size_value.x / 2;
530 rct.
xmax = position.x + size_value.x / 2;
531 rct.
ymin = position.y - size_value.y / 2;
532 rct.
ymax = position.y + size_value.y / 2;
542 if (
size[0] != 0 and
size[1] != 0) {
550 &rct, ((loc[0] - offset.x) / dims.x) + 0.5, ((loc[1] - offset.y) / dims.y) + 0.5);
571 if (node && node->is_type(
"CompositorNodeBoxMask")) {
572 snode->
edittree->ensure_topology_cache();
574 if (
STR_ELEM(
input->name,
"Position",
"Size",
"Rotation") &&
input->is_directly_linked()) {
643 reinterpret_cast<ID *
>(snode->
edittree), &RNA_NodeSocket, source_input);
650 params.range_get_fn =
nullptr;
659 gzgt->
name =
"Backdrop Box Mask Widget";
660 gzgt->
idname =
"NODE_GGT_backdrop_box_mask";
686 if (node && node->is_type(
"CompositorNodeEllipseMask")) {
687 snode->
edittree->ensure_topology_cache();
689 if (
STR_ELEM(
input->name,
"Position",
"Size",
"Rotation") &&
input->is_directly_linked()) {
722 gzgt->
name =
"Backdrop Ellipse Mask Widget";
723 gzgt->
idname =
"NODE_GGT_backdrop_ellipse_mask";
758 if (!node || !node->is_type(
"CompositorNodeGlare")) {
763 snode->
edittree->ensure_topology_cache();
764 if (type_socket.is_directly_linked()) {
831 reinterpret_cast<ID *
>(snode->
edittree), &RNA_NodeSocket, source_input);
841 gzgt->
name =
"Glare Widget";
842 gzgt->
idname =
"NODE_GGT_glare";
877 if (node && node->is_type(
"CompositorNodeCornerPin")) {
889 for (
int i = 0;
i < 4;
i++) {
908 float matrix_space[4][4];
912 for (
int i = 0;
i < 4;
i++) {
928 for (
int i = 0;
i < 4;
i++) {
949 (
ID *)snode->
edittree, &RNA_NodeSocket, sock);
961 gzgt->
name =
"Corner Pin Widget";
962 gzgt->
idname =
"NODE_GGT_backdrop_corner_pin";
988 if (node && node->is_type(
"CompositorNodeSplit")) {
989 snode->
edittree->ensure_topology_cache();
1021 float (*matrix)[4] =
reinterpret_cast<float (*)[4]
>(value_p);
1028 float loc[3],
rot[3][3],
size[3];
1037 const float gizmo_width = 0.1f;
1041 float3{(
pos.x - 0.5f) * dims.x + offset.x, (
pos.y - 0.5f) * dims.y + offset.y, 0.0f},
1043 float3{gizmo_width, std::numeric_limits<float>::epsilon(), 1.0f});
1048 const void *value_p)
1050 const float (*matrix)[4] =
reinterpret_cast<const float (*)[4]
>(value_p);
1061 float pos_x = (matrix[3][0] - offset.x) + dims.x * 0.5;
1062 float pos_y = (matrix[3][1] - offset.y) + dims.y * 0.5;
1108 reinterpret_cast<ID *
>(snode->
edittree), &RNA_NodeSocket, source_input);
1115 params.range_get_fn =
nullptr;
1124 gzgt->
name =
"Split Widget";
1125 gzgt->
idname =
"NODE_GGT_backdrop_split";
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)
#define LISTBASE_FOREACH(type, var, list)
void loc_rot_size_to_mat4(float R[4][4], const float loc[3], const float rot[3][3], const float size[3])
void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], const float wmat[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void unit_m4(float m[4][4])
void axis_angle_to_mat3_single(float R[3][3], char axis, float angle)
void mat4_to_eul(float eul[3], const float mat[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)
@ CMP_NODE_GLARE_SUN_BEAMS
@ SNODE_GIZMO_HIDE_ACTIVE_NODE
@ ED_GIZMO_CAGE_DRAW_FLAG_CORNER_HANDLES
@ ED_GIZMO_CAGE_DRAW_FLAG_XFORM_CENTER_HANDLE
@ ED_GIZMO_CAGE_DRAW_FLAG_NOP
@ ED_GIZMO_CAGE2D_STYLE_CIRCLE
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE
@ ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE
@ ED_GIZMO_CAGE_XFORM_FLAG_ROTATE
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM
@ ED_GIZMO_MOVE_STYLE_CROSS_2D
Read Guarded memory(de)allocation.
@ WM_GIZMOGROUPTYPE_PERSISTENT
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void * MEM_mallocN(size_t len, const char *str)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
bNode * node_get_active(bNodeTree &ntree)
static bool WIDGETGROUP_node_split_poll(const bContext *C, wmGizmoGroupType *)
static void WIDGETGROUP_node_split_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_node_split_prop_matrix_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static bool WIDGETGROUP_node_transform_poll(const bContext *C, wmGizmoGroupType *)
static void gizmo_node_bbox_update(NodeBBoxWidgetGroup *bbox_group)
static void WIDGETGROUP_node_mask_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static bool WIDGETGROUP_node_ellipse_mask_poll(const bContext *C, wmGizmoGroupType *)
static void gizmo_node_box_mask_prop_matrix_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static bool node_gizmo_is_set_visible(const bContext *C)
static float2 node_gizmo_safe_calc_dims(const ImBuf *ibuf, const float2 &fallback_dims)
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_box_mask_poll(const bContext *C, wmGizmoGroupType *)
void NODE_GGT_backdrop_split(wmGizmoGroupType *gzgt)
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 WIDGETGROUP_node_glare_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_node_box_mask_prop_matrix_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static void node_input_to_rect(const bNode *node, const float2 &dims, const float2 offset, rctf *r_rect)
static void WIDGETGROUP_node_corner_pin_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_node_crop_prop_matrix_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static bool WIDGETGROUP_node_glare_poll(const bContext *C, wmGizmoGroupType *)
void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt)
static void WIDGETGROUP_node_transform_setup(const bContext *, wmGizmoGroup *gzgroup)
void NODE_GGT_backdrop_box_mask(wmGizmoGroupType *gzgt)
static void WIDGETGROUP_node_box_mask_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)
static void node_input_from_rect(bNode *node, const rctf *rect, const float2 &dims, const float2 &offset)
void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt)
static void WIDGETGROUP_node_ellipse_mask_setup(const bContext *, wmGizmoGroup *gzgroup)
static void gizmo_node_split_prop_matrix_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
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_split_setup(const bContext *, wmGizmoGroup *gzgroup)
void NODE_GGT_backdrop_ellipse_mask(wmGizmoGroupType *gzgt)
static void WIDGETGROUP_node_glare_setup(const bContext *, wmGizmoGroup *gzgroup)
static void WIDGETGROUP_node_crop_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
static bool WIDGETGROUP_node_crop_poll(const bContext *C, wmGizmoGroupType *)
static void WIDGETGROUP_node_glare_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
void NODE_GGT_backdrop_glare(wmGizmoGroupType *gzgt)
static const float2 GIZMO_NODE_DEFAULT_DIMS
static void WIDGETGROUP_bbox_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
T clamp(const T &a, const T &min, const T &max)
bool is_any_zero(const T &a)
VecBase< float, 2 > float2
VecBase< float, 3 > float3
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
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_discrete(ID *id, StructRNA *type, void *data)
ImageRuntimeHandle * runtime
struct bNodeTree * edittree
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoGroupFnRefresh refresh
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoGroupFnDrawPrepare draw_prepare
void(* customdata_free)(void *)
const wmGizmoPropertyType * type
struct wmGizmoProperty::@331027022007232055216276241130041346111314317052 custom_func
wmGizmoGroup * parent_gzgroup
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)
wmGizmo * WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
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 StringRef idname, bool quiet)