23#include "RNA_prototypes.hh"
42 N_(
"Returns the position and speed of the marker at the current scene frame relative to the "
43 "zero origin of the tracking space")},
48 N_(
"Returns the position and speed of the marker at the current scene frame relative to the "
49 "position of the first non-disabled marker in the track")},
54 N_(
"Returns the position and speed of the marker at the current scene frame relative to the "
55 "position of the marker at the current scene frame plus the user given relative frame")},
60 N_(
"Returns the position and speed of the marker at the given absolute frame")},
61 {0,
nullptr, 0,
nullptr,
nullptr},
117 col->prop_search(
ptr,
"tracking_object", &tracking_ptr,
"objects",
"", ICON_OBJECT_DATA);
120 if (tracking_object) {
122 &clip->
id, &RNA_MovieTrackingObject, tracking_object);
124 col->prop_search(
ptr,
"track_name", &object_ptr,
"tracks",
"", ICON_ANIM_DATA);
158 if (!should_compute_x && !should_compute_y) {
165 const float2 position = (current_marker_position - reference_marker_position) *
float2(
size);
167 if (should_compute_x) {
169 result.allocate_single_value();
170 result.set_single_value(position.x);
173 if (should_compute_y) {
175 result.allocate_single_value();
176 result.set_single_value(position.y);
190 track, current_marker_position, -1);
191 const float2 speed_toward_previous = previous_marker_position - current_marker_position;
196 track, current_marker_position, 1);
197 const float2 speed_toward_next = current_marker_position - next_marker_position;
204 result.allocate_single_value();
205 result.set_single_value(speed);
212 result.allocate_single_value();
213 result.set_single_value(0.0f);
217 result.allocate_single_value();
218 result.set_single_value(0.0f);
222 result.allocate_single_value();
232 float2 current_marker_position,
240 return current_marker_position;
303 movie_tracking, node_storage(
bnode()).tracking_object);
304 if (!movie_tracking_object) {
309 node_storage(
bnode()).track_name);
354 const MenuValue menu_value =
input.get_single_value_default(default_menu_value);
378 ntype.
ui_name =
"Track Position";
380 "Provide information about motion tracking points, such as x and y values";
383 ntype.
declare = file_ns::cmp_node_trackpos_declare;
384 ntype.
draw_buttons = file_ns::node_composit_buts_trackpos;
Scene * CTX_data_scene(const bContext *C)
float BKE_movieclip_remap_scene_to_clip_frame(const struct MovieClip *clip, float framenr)
void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr)
void BKE_movieclip_get_size(struct MovieClip *clip, const struct MovieClipUser *user, int *r_width, int *r_height)
#define NODE_STORAGE_FUNCS(StorageT)
#define CMP_NODE_TRACKPOS
struct MovieTrackingObject * BKE_tracking_object_get_named(struct MovieTracking *tracking, const char *name)
struct MovieTrackingMarker * BKE_tracking_marker_get(struct MovieTrackingTrack *track, int framenr)
struct MovieTrackingObject * BKE_tracking_object_get_active(const struct MovieTracking *tracking)
struct MovieTrackingMarker * BKE_tracking_marker_get_exact(struct MovieTrackingTrack *track, int framenr)
struct MovieTrackingTrack * BKE_tracking_object_find_track_with_name(struct MovieTrackingObject *tracking_object, const char *name)
#define STRNCPY_UTF8(dst, src)
#define DNA_struct_default_get(struct_name)
@ CMP_NODE_TRACK_POSITION_RELATIVE_START
@ CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME
@ CMP_NODE_TRACK_POSITION_RELATIVE_FRAME
@ CMP_NODE_TRACK_POSITION_ABSOLUTE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void uiTemplateID(uiLayout *layout, const bContext *C, PointerRNA *ptr, blender::StringRefNull propname, const char *newop, const char *openop, const char *unlinkop, int filter=UI_TEMPLATE_ID_FILTER_ALL, bool live_icon=false, std::optional< blender::StringRef > text=std::nullopt)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
int get_frame_number() const
const bNode & bnode() const
bool should_compute_output(StringRef identifier)
NodeOperation(Context &context, DNode node)
Result & get_result(StringRef identifier)
Context & context() const
Result & get_input(StringRef identifier) const
T get_single_value_default(const T &default_value) const
void execute_position(MovieTrackingTrack *track, float2 current_marker_position, int2 size)
void execute_speed(MovieTrackingTrack *track, float2 current_marker_position, int2 size)
MovieClip * get_movie_clip()
float2 compute_marker_position_at_frame(MovieTrackingTrack *track, int frame)
float2 compute_reference_marker_position(MovieTrackingTrack *track)
float2 compute_first_marker_position(MovieTrackingTrack *track)
float2 compute_temporally_neighboring_marker_position(MovieTrackingTrack *track, float2 current_marker_position, int time_delta)
MovieTrackingTrack * get_movie_tracking_track()
CMPNodeTrackPositionMode get_mode()
NodeOperation(Context &context, DNode node)
void * MEM_callocN(size_t len, const char *str)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static void cmp_node_trackpos_declare(NodeDeclarationBuilder &b)
static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRNA *ptr)
static const EnumPropertyItem mode_items[]
static NodeOperation * get_compositor_operation(Context &context, DNode node)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
static void register_node_type_cmp_trackpos()
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
struct MovieTracking tracking
MovieTrackingTrack * active_track
MovieTrackingMarker * markers
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* initfunc_api)(const bContext *C, PointerRNA *ptr)
uiLayout & column(bool align)
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)