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")
31 .compositor_expects_single_value();
38 "A value that is relative to the image size and needs to be converted to be in pixels")
39 .compositor_expects_single_value();
40 b.add_input<
decl::Color>(
"Image").compositor_realization_mode(
44 b.add_output<
decl::Vector>(
"Value",
"Vector Value").dimensions(2);
68 const bool is_per_dimension = reference_dimension ==
90 {0,
nullptr, 0,
nullptr,
nullptr},
108 "The value is relative to each of the dimensions of the image independently"},
113 "The value is relative to the X dimension of the image"},
118 "The value is relative to the Y dimension of the image"},
123 "The value is relative to the greater dimension of the image"},
128 "The value is relative to the smaller dimension of the image"},
133 "The value is relative to the diagonal of the image"},
134 {0,
nullptr, 0,
nullptr,
nullptr},
139 "reference_dimension",
140 "Reference Dimension",
141 "Defines the dimension of the image that the relative value is in reference to",
142 reference_dimension_items,
170 const float2 value_in_pixels = input_value * reference_size;
199 return float2(this->
get_input(
"Float Value").get_single_value_default(0.0f));
218 return float2(image_size.x);
220 return float2(image_size.y);
254 ntype.
ui_name =
"Relative To Pixel";
256 "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)
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
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
VecBase< float, 3 > float3
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)