44 Object *camera = scene->camera;
81 if (
object !=
nullptr && object->parent !=
nullptr) {
82 object =
object->parent;
95 if (clip !=
nullptr) {
127 if (cti ==
nullptr) {
133 Object *cam = data->camera ? data->camera : scene->camera;
152 if (cti ==
nullptr) {
157 return (data->camera !=
nullptr) ? data->camera : scene->camera;
172 if (selected_count == 0) {
175 "At least one track with bundle should be selected to "
176 "define origin position");
182 if (
object ==
nullptr) {
189 float median[3] = {0.0f, 0.0f, 0.0f};
196 mul_v3_fl(median, 1.0f / selected_count);
198 float mat[4][4], vec[3];
225 "Set active marker as origin by moving camera (or its parent if present) in 3D space";
240 "Set origin to median point of selected bundles");
255 float mat[4][4], vec[3], obmat[4][4], dvec[3];
282 if (
fabsf(dvec[1]) < 1e-3f) {
298 if (is_camera ||
fabsf(vec[2]) < 1e-3f) {
314 if (
fabsf(dvec[0]) < 1e-3f) {
330 if (is_camera ||
fabsf(vec[2]) < 1e-3f) {
357 float lmat[4][4], ilmat[4][4], rmat[3][3];
386 float vec[3][3], mat[4][4], obmat[4][4], newmat[4][4], orig[3] = {0.0f, 0.0f, 0.0f};
389 {0.0f, 0.0f, -1.0f, 0.0f},
390 {0.0f, 1.0f, 0.0f, 0.0f},
391 {1.0f, 0.0f, 0.0f, 0.0f},
392 {0.0f, 0.0f, 0.0f, 1.0f},
404 if (
object ==
nullptr) {
415 while (track && tot < 3) {
418 if (tot == 0 || track == tracking_object->
active_track) {
440 else if (plane == 1) {
464 if (object->loc[2] < 0) {
481 set_axis(scene,
object, clip, tracking_object, axis_track,
'X');
495 {0,
"FLOOR", 0,
"Floor",
"Set floor plane"},
496 {1,
"WALL", 0,
"Wall",
"Set wall plane"},
497 {0,
nullptr, 0,
nullptr,
nullptr},
503 "Set plane based on 3 selected bundles by moving camera "
504 "(or its parent if present) in 3D space";
515 RNA_def_enum(
ot->
srna,
"plane", plane_items, 0,
"Plane",
"Plane to be used for orientation");
532 op->
reports,
RPT_ERROR,
"Single track with bundle should be selected to define axis");
537 if (
object ==
nullptr) {
551 set_axis(scene,
object, clip, tracking_object, track, axis == 0 ?
'X' :
'Y');
565 {0,
"X", 0,
"X",
"Align bundle align X axis"},
566 {1,
"Y", 0,
"Y",
"Align bundle align Y axis"},
567 {0,
nullptr, 0,
nullptr,
nullptr},
573 "Set the direction of a scene axis by rotating the camera "
574 "(or its parent if present). This assumes that the selected "
575 "track lies on a real axis connecting it to the origin";
586 RNA_def_enum(
ot->
srna,
"axis", axis_actions, 0,
"Axis",
"Axis to use to align bundle along");
601 float vec[2][3], mat[4][4], scale;
609 if (!scale_solution && !apply_scale) {
611 if (
object ==
nullptr) {
628 if (
len_v3(vec[0]) > 1e-5f) {
629 scale = dist /
len_v3(vec[0]);
642 mul_v3_fl(reconstructed_cameras[i].mat[3], scale);
655 else if (!scale_solution) {
658 object->scale[0] =
object->scale[1] =
object->scale[2] = 1.0f / scale;
661 object->scale[0] /= solver_camera->
scale[0];
662 object->scale[1] /= solver_camera->
scale[1];
663 object->scale[2] /= solver_camera->
scale[2];
667 tracking_object->
scale = scale;
705 ot->
description =
"Set scale of scene by scaling camera (or its parent if present)";
723 "Distance between selected tracks",
735 if (clip !=
nullptr) {
755 RNA_float_set(op->
ptr,
"distance", clip->tracking.settings.object_distance);
764 ot->
name =
"Set Solution Scale";
766 "Set object solution scale using distance between "
767 "two selected tracks";
768 ot->
idname =
"CLIP_OT_set_solution_scale";
785 "Distance between selected tracks",
797 if (clip !=
nullptr) {
824 ot->
name =
"Apply Solution Scale";
826 "Apply scale on solution itself to make distance between "
827 "selected tracks equals to desired";
828 ot->
idname =
"CLIP_OT_apply_solution_scale";
845 "Distance between selected tracks",
#define FOREACH_SCENE_OBJECT_END
#define FOREACH_SCENE_OBJECT_BEGIN(scene, _instance)
const bConstraintTypeInfo * BKE_constraint_typeinfo_get(struct bConstraint *con)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
SpaceClip * CTX_wm_space_clip(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
General operations, lookup, etc. for blender objects.
void BKE_object_where_is_calc_mat4(const Object *ob, float r_obmat[4][4])
void BKE_object_rot_to_mat3(const Object *ob, float r_mat[3][3], bool use_drot)
MovieClip * BKE_object_movieclip_get(Scene *scene, const Object *ob, bool use_default)
void BKE_object_apply_mat4(Object *ob, const float mat[4][4], bool use_compat, bool use_parent)
void BKE_object_to_mat4(const Object *ob, float r_mat[4][4])
void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BKE_tracking_get_camera_object_matrix(const struct Object *camera_object, float mat[4][4])
struct MovieTrackingObject * BKE_tracking_object_get_active(const struct MovieTracking *tracking)
#define TRACK_VIEW_SELECTED(sc, track)
#define LISTBASE_FOREACH(type, var, list)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void mul_m4_m4m3(float R[4][4], const float A[4][4], const float B[3][3])
void unit_m4(float m[4][4])
#define mul_m4_series(...)
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
bool invert_m4(float mat[4][4])
bool invert_m3(float mat[3][3])
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void DEG_id_tag_update(ID *id, unsigned int flags)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
@ CONSTRAINT_TYPE_OBJECTSOLVER
Object is a sort of wrapper for general info.
MovieClip * ED_space_clip_get_clip(const SpaceClip *sc)
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
const Depsgraph * depsgraph
const ProjectiveReconstruction & reconstruction
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
MovieTrackingReconstruction reconstruction
MovieTrackingTrack * active_track
struct MovieTrackingTrack * next
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void CLIP_OT_set_origin(wmOperatorType *ot)
static Object * object_solver_camera(Scene *scene, Object *ob)
void CLIP_OT_apply_solution_scale(wmOperatorType *ot)
static bool set_orientation_poll(bContext *C)
static int apply_solution_scale_exec(bContext *C, wmOperator *op)
static int set_scale_invoke(bContext *C, wmOperator *op, const wmEvent *)
static int apply_solution_scale_invoke(bContext *C, wmOperator *op, const wmEvent *)
static bool set_solution_scale_poll(bContext *C)
void CLIP_OT_set_solution_scale(wmOperatorType *ot)
void CLIP_OT_set_axis(wmOperatorType *ot)
static int set_origin_exec(bContext *C, wmOperator *op)
static int set_scale_exec(bContext *C, wmOperator *op)
static int do_set_scale(bContext *C, wmOperator *op, bool scale_solution, bool apply_scale)
static bool apply_solution_scale_poll(bContext *C)
static int set_solution_scale_exec(bContext *C, wmOperator *op)
void CLIP_OT_set_scale(wmOperatorType *ot)
static int set_axis_exec(bContext *C, wmOperator *op)
static Object * get_camera_with_movieclip(Scene *scene, const MovieClip *clip)
static int set_plane_exec(bContext *C, wmOperator *op)
static int set_solution_scale_invoke(bContext *C, wmOperator *op, const wmEvent *)
static void object_solver_inverted_matrix(Scene *scene, Object *ob, float invmat[4][4])
static int count_selected_bundles(bContext *C)
void CLIP_OT_set_plane(wmOperatorType *ot)
static Object * get_orientation_object(bContext *C)
static void set_axis(Scene *scene, Object *ob, const MovieClip *clip, const MovieTrackingObject *tracking_object, const MovieTrackingTrack *track, char axis)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)