26 .default_value({0.0f, 0.0f})
30 "A value that is relative to the image size and needs to be converted to be in pixels");
37 "A value that is relative to the image size and needs to be converted to be in pixels");
43 b.add_output<
decl::Vector>(
"Value",
"Vector Value").dimensions(2);
67 const bool is_per_dimension = reference_dimension ==
89 {0,
nullptr, 0,
nullptr,
nullptr},
107 "The value is relative to each of the dimensions of the image independently"},
112 "The value is relative to the X dimension of the image"},
117 "The value is relative to the Y dimension of the image"},
122 "The value is relative to the greater dimension of the image"},
127 "The value is relative to the smaller dimension of the image"},
132 "The value is relative to the diagonal of the image"},
133 {0,
nullptr, 0,
nullptr,
nullptr},
138 "reference_dimension",
139 "Reference Dimension",
140 "Defines the dimension of the image that the relative value is in reference to",
141 reference_dimension_items,
169 const float2 value_in_pixels = input_value * reference_size;
198 return float2(this->
get_input(
"Float Value").get_single_value_default(0.0f));
217 return float2(image_size.x);
219 return float2(image_size.y);
253 ntype.
ui_name =
"Relative To Pixel";
255 "Converts values that are relative to the image size to be in terms of pixels";
#define NODE_CLASS_CONVERTER
#define BLI_assert_unreachable()
CMPNodeRelativeToPixelDataType
@ CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_VECTOR
@ CMP_NODE_RELATIVE_TO_PIXEL_DATA_TYPE_FLOAT
CMPNodeRelativeToPixelReferenceDimension
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_DIAGONAL
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_PER_DIMENSION
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_Y
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_X
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_GREATER
@ CMP_NODE_RELATIVE_TO_PIXEL_REFERENCE_DIMENSION_SMALLER
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
const DNode & node() const
const bNode & bnode() const
NodeOperation(Context &context, DNode node)
Result & get_result(StringRef identifier)
Context & context() const
Result & get_input(StringRef identifier) const
InputDescriptor & get_input_descriptor(StringRef identifier)
static Domain compute_realized_transformation_domain(Context &context, const Domain &domain, const bool realize_translation=false)
T get_single_value_default(const T &default_value) const
void set_single_value(const T &value)
const Domain & domain() const
void allocate_single_value()
bool is_single_value() const
StructureType structure_type
CMPNodeRelativeToPixelReferenceDimension get_reference_dimension()
RelativeToPixelOperation(Context &context, DNode node)
CMPNodeRelativeToPixelDataType get_data_type()
float2 compute_reference_size()
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
void node_register_type(bNodeType &ntype)
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
T reduce_max(const VecBase< T, Size > &a)
T length(const VecBase< T, Size > &a)
T reduce_min(const VecBase< T, Size > &a)
static void node_declare(NodeDeclarationBuilder &b)
static void node_init(bNodeTree *, bNode *node)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_rna(StructRNA *srna)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void node_update(bNodeTree *ntree, bNode *node)
static void register_node()
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
VecBase< float, 2 > float2
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)