Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-11-07 16:55:18 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-11-07 16:55:18 +0400
commit27d42c63d9b507b1771ed5a7923c389c719b877b (patch)
tree8dd4ca61e197a7053633f62b4a5d8091957724c4 /source/blender/makesrna/intern
parente122dc0748f6a4d77b236e26beba93e2a9a36bf0 (diff)
Camera tracking integration
=========================== Commiting camera tracking integration gsoc project into trunk. This commit includes: - Bundled version of libmv library (with some changes against official repo, re-sync with libmv repo a bit later) - New datatype ID called MovieClip which is optimized to work with movie clips (both of movie files and image sequences) and doing camera/motion tracking operations. - New editor called Clip Editor which is currently used for motion/tracking stuff only, but which can be easily extended to work with masks too. This editor supports: * Loading movie files/image sequences * Build proxies with different size for loaded movie clip, also supports building undistorted proxies to increase speed of playback in undistorted mode. * Manual lens distortion mode calibration using grid and grease pencil * Supervised 2D tracking using two different algorithms KLT and SAD. * Basic algorithm for feature detection * Camera motion solving. scene orientation - New constraints to "link" scene objects with solved motions from clip: * Follow Track (make object follow 2D motion of track with given name or parent object to reconstructed 3D position of track) * Camera Solver to make camera moving in the same way as reconstructed camera This commit NOT includes changes from tomato branch: - New nodes (they'll be commited as separated patch) - Automatic image offset guessing for image input node and image editor (need to do more tests and gather more feedback) - Code cleanup in libmv-capi. It's not so critical cleanup, just increasing readability and understanadability of code. Better to make this chaneg when Keir will finish his current patch. More details about this project can be found on this page: http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2011 Further development of small features would be done in trunk, bigger/experimental features would first be implemented in tomato branch.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt2
-rw-r--r--source/blender/makesrna/intern/makesrna.c2
-rw-r--r--source/blender/makesrna/intern/rna_ID.c2
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c72
-rw-r--r--source/blender/makesrna/intern/rna_internal.h3
-rw-r--r--source/blender/makesrna/intern/rna_main.c7
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c54
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c278
-rw-r--r--source/blender/makesrna/intern/rna_scene.c25
-rw-r--r--source/blender/makesrna/intern/rna_screen.c5
-rw-r--r--source/blender/makesrna/intern/rna_space.c293
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c772
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c19
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c109
14 files changed, 1639 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index ab69addbbdb..1667ca17e37 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -59,6 +59,7 @@ set(DEFSRC
rna_mesh.c
rna_meta.c
rna_modifier.c
+ rna_movieclip.c
rna_nla.c
rna_nodetree.c
rna_object.c
@@ -82,6 +83,7 @@ set(DEFSRC
rna_text.c
rna_texture.c
rna_timeline.c
+ rna_tracking.c
rna_ui.c
rna_userdef.c
rna_vfont.c
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 891b62f7c79..533d1e2c929 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -2479,6 +2479,8 @@ static RNAProcessItem PROCESS_ITEMS[]= {
{"rna_vfont.c", NULL, RNA_def_vfont},
{"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
{"rna_world.c", NULL, RNA_def_world},
+ {"rna_movieclip.c", NULL, RNA_def_movieclip},
+ {"rna_tracking.c", NULL, RNA_def_tracking},
{NULL, NULL}};
static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const char *api_filename)
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index e4692d32338..eed178b238d 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -143,6 +143,7 @@ short RNA_type_to_ID_code(StructRNA *type)
if(RNA_struct_is_a(type, &RNA_VectorFont)) return ID_VF;
if(RNA_struct_is_a(type, &RNA_World)) return ID_WO;
if(RNA_struct_is_a(type, &RNA_WindowManager)) return ID_WM;
+ if(RNA_struct_is_a(type, &RNA_MovieClip)) return ID_MC;
return 0;
}
@@ -177,6 +178,7 @@ StructRNA *ID_code_to_RNA_type(short idcode)
case ID_VF: return &RNA_VectorFont;
case ID_WO: return &RNA_World;
case ID_WM: return &RNA_WindowManager;
+ case ID_MC: return &RNA_MovieClip;
default: return &RNA_ID;
}
}
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index fdbb4f09f93..e1e4f3929b2 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -64,9 +64,11 @@ EnumPropertyItem constraint_type_items[] ={
{CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"},
{0, "", 0, "Relationship", ""},
{CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""},
+ {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""},
{CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""},
{CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", ""},
{CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT_DATA, "Follow Path", ""},
+ {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""},
{CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT_DATA, "Pivot", ""},
{CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", ""},
{CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", ""},
@@ -156,6 +158,10 @@ static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
return &RNA_CopyTransformsConstraint;
case CONSTRAINT_TYPE_PIVOT:
return &RNA_PivotConstraint;
+ case CONSTRAINT_TYPE_FOLLOWTRACK:
+ return &RNA_FollowTrackConstraint;
+ case CONSTRAINT_TYPE_CAMERASOLVER:
+ return &RNA_CameraSolverConstraint;
default:
return &RNA_UnknownType;
}
@@ -2026,6 +2032,70 @@ static void rna_def_constraint_pivot(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
+static void rna_def_constraint_follow_track(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem reference_items[] = {
+ {FOLLOWTRACK_TRACK, "TRACK", 0, "Track", "Use 2D track position as reference"},
+ {FOLLOWTRACK_BUNDLE, "BUNDLE", 0, "Bundle", "Use 3D reconstructed bundle position as reference"},
+ {0, NULL, 0, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the target motion track");
+ RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
+
+ /* movie clip */
+ prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* track */
+ prop= RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "track");
+ RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* reference */
+ prop= RNA_def_property(srna, "reference", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "reference");
+ RNA_def_property_enum_items(prop, reference_items);
+ RNA_def_property_ui_text(prop, "Reference", "Reference source to follow");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* use default clip */
+ prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_ACTIVECLIP);
+ RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+}
+
+static void rna_def_constraint_camera_solver(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the reconstructed camera movenment");
+ RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
+
+ /* movie clip */
+ prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* use default clip */
+ prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
+ RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+}
+
/* base struct for constraints */
void RNA_def_constraint(BlenderRNA *brna)
{
@@ -2136,6 +2206,8 @@ void RNA_def_constraint(BlenderRNA *brna)
rna_def_constraint_damped_track(brna);
rna_def_constraint_spline_ik(brna);
rna_def_constraint_pivot(brna);
+ rna_def_constraint_follow_track(brna);
+ rna_def_constraint_camera_solver(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 2e3b371c3f3..a137ddc6bc0 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -177,6 +177,8 @@ void RNA_def_userdef(struct BlenderRNA *brna);
void RNA_def_vfont(struct BlenderRNA *brna);
void RNA_def_wm(struct BlenderRNA *brna);
void RNA_def_world(struct BlenderRNA *brna);
+void RNA_def_movieclip(struct BlenderRNA *brna);
+void RNA_def_tracking(struct BlenderRNA *brna);
/* Common Define functions */
@@ -290,6 +292,7 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop);
+void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop);
/* ID Properties */
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 076bdfe1964..be03da6839d 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -245,6 +245,12 @@ static void rna_Main_wm_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
rna_iterator_listbase_begin(iter, &bmain->wm, NULL);
}
+static void rna_Main_movieclips_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Main *bmain= (Main*)ptr->data;
+ rna_iterator_listbase_begin(iter, &bmain->movieclip, NULL);
+}
+
#ifdef UNIT_TEST
static PointerRNA rna_Test_test_get(PointerRNA *ptr)
@@ -307,6 +313,7 @@ void RNA_def_main(BlenderRNA *brna)
{"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks", RNA_def_main_actions},
{"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks", RNA_def_main_particles},
{"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil},
+ {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips},
{NULL, NULL, NULL, NULL, NULL, NULL}};
int i;
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index dfa368d6b94..f568f6de855 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -66,6 +66,7 @@
#include "BKE_node.h"
#include "BKE_depsgraph.h"
#include "BKE_speaker.h"
+#include "BKE_movieclip.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
@@ -85,6 +86,7 @@
#include "DNA_particle_types.h"
#include "DNA_vfont_types.h"
#include "DNA_node_types.h"
+#include "DNA_movieclip_types.h"
#include "ED_screen.h"
@@ -521,6 +523,26 @@ void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSetting
/* XXX python now has invalid pointer? */
}
+MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
+{
+ MovieClip *clip;
+
+ errno= 0;
+ clip= BKE_add_movieclip_file(filepath);
+
+ if(!clip)
+ BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to load movie clip");
+
+ return clip;
+}
+
+void rna_Main_movieclips_remove(Main *bmain, MovieClip *clip)
+{
+ unlink_movieclip(bmain, clip);
+ free_libblock(&bmain->movieclip, clip);
+ /* XXX python now has invalid pointer? */
+}
+
/* tag functions, all the same */
void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); }
void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); }
@@ -550,6 +572,7 @@ void rna_Main_armatures_tag(Main *bmain, int value) { tag_main_lb(&bmain->armatu
void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, value); }
void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); }
void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); }
+void rna_Main_movieclips_tag(Main *bmain, int value) { tag_main_lb(&bmain->text, value); }
static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA); }
static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE); }
@@ -1468,5 +1491,36 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL);
}
+void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataMovieClips");
+ srna= RNA_def_struct(brna, "BlendDataMovieClips", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
+
+ func= RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
+ parm= RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "remove", "rna_Main_movieclips_remove");
+ RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
+ parm= RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+
+ /* load func */
+ func= RNA_def_function(srna, "load", "rna_Main_movieclip_load");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new movie clip to the main database from a file");
+ parm= RNA_def_string_file_path(func, "filepath", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip datablock");
+ RNA_def_function_return(func, parm);
+}
+
#endif
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
new file mode 100644
index 00000000000..afdf3cd9c46
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -0,0 +1,278 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_movieclip.c
+ * \ingroup RNA
+ */
+
+
+#include <stdlib.h>
+#include <limits.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BKE_movieclip.h"
+#include "BKE_tracking.h"
+
+#include "RNA_define.h"
+
+#include "rna_internal.h"
+
+#include "DNA_movieclip_types.h"
+#include "DNA_scene_types.h"
+
+#include "WM_types.h"
+
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_depsgraph.h"
+
+static void rna_MovieClip_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+
+ BKE_movieclip_reload(clip);
+ DAG_id_tag_update(&clip->id, 0);
+}
+
+static void rna_MovieClip_size_get(PointerRNA *ptr, int *values)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+
+ values[0]= clip->lastsize[0];
+ values[1]= clip->lastsize[1];
+}
+
+static void rna_MovieClip_resolution_get(PointerRNA *ptr, float *values)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ ImBuf *ibuf;
+
+ ibuf= BKE_movieclip_get_ibuf(clip, NULL);
+ if (ibuf) {
+ values[0]= ibuf->ppm[0];
+ values[1]= ibuf->ppm[1];
+
+ IMB_freeImBuf(ibuf);
+ }
+ else {
+ values[0]= 0;
+ values[1]= 0;
+ }
+}
+
+#else
+
+static void rna_def_movieclip_proxy(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem clip_tc_items[]= {
+ {IMB_TC_NONE, "NONE", 0, "No TC in use", ""},
+ {IMB_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", "use images in the order as they are recorded"},
+ {IMB_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", "use global timestamp written by recording device"},
+ {IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)", "interpolate a global timestamp using the record date and time written by recording device"},
+ {0, NULL, 0, NULL, NULL}};
+
+ srna = RNA_def_struct(brna, "MovieClipProxy", NULL);
+ RNA_def_struct_ui_text(srna, "Movie Clip Proxy", "Proxy parameters for a movie clip");
+ RNA_def_struct_sdna(srna, "MovieClipProxy");
+
+ /* build proxy sized */
+ prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_25);
+ RNA_def_property_ui_text(prop, "25%", "Build 25% proxy resolution");
+
+ prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_50);
+ RNA_def_property_ui_text(prop, "50%", "Build 50% proxy resolution");
+
+ prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_75);
+ RNA_def_property_ui_text(prop, "75%", "Build 75% proxy resolution");
+
+ prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_100);
+ RNA_def_property_ui_text(prop, "100%", "Build 100% proxy resolution");
+
+ prop= RNA_def_property(srna, "build_undistorted", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_flag", MCLIP_PROXY_BUILD_UNDISTORT);
+ RNA_def_property_ui_text(prop, "Build Undistorted", "Also build undistorted proxies for selected sizes");
+
+ /* build timecodes */
+ prop= RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN);
+ RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
+
+ prop= RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_FREE_RUN);
+ RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
+
+ prop= RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN);
+ RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
+
+ /* quality of proxied image */
+ prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "quality");
+ RNA_def_property_ui_text(prop, "Quality", "JPEG Quality of proxies to build");
+ RNA_def_property_ui_range(prop, 1, 100, 1, 0);
+
+ prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tc");
+ RNA_def_property_enum_items(prop, clip_tc_items);
+ RNA_def_property_ui_text(prop, "Timecode", "");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* directory */
+ prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "dir");
+ RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
+}
+
+static void rna_def_moviecliUser(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem clip_render_size_items[] = {
+ {MCLIP_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
+ {MCLIP_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""},
+ {MCLIP_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
+ {MCLIP_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""},
+ {MCLIP_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "MovieClipUser", NULL);
+ RNA_def_struct_ui_text(srna, "Movie Clip User", "Parameters defining how a MovieClip datablock is used by another datablock");
+
+ prop= RNA_def_property(srna, "current_frame", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Current Frame", "Current frame number in movie or image sequence");
+
+ /* render size */
+ prop= RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "render_size");
+ RNA_def_property_enum_items(prop, clip_render_size_items);
+ RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* render undistorted */
+ prop= RNA_def_property(srna, "use_render_undistorted", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "render_flag", MCLIP_PROXY_RENDER_UNDISTORT);
+ RNA_def_property_ui_text(prop, "Render Undistorted", "Draw preview using undistorted proxy");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+}
+
+static void rna_def_movieClipScopes(BlenderRNA *brna)
+{
+ StructRNA *srna;
+
+ srna= RNA_def_struct(brna, "MovieClipScopes", NULL);
+ RNA_def_struct_ui_text(srna, "MovieClipScopes", "Scopes for statistical view of a movie clip");
+}
+
+
+static void rna_def_movieclip(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem clip_source_items[]= {
+ {MCLIP_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
+ {MCLIP_SRC_MOVIE, "MOVIE", 0, "Movie File", "Movie file"},
+ {0, NULL, 0, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "MovieClip", "ID");
+ RNA_def_struct_ui_text(srna, "MovieClip", "MovieClip datablock referencing an external movie file");
+ RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
+
+ prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "File Path", "Filename of the text file");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
+
+ prop= RNA_def_property(srna, "tracking", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTracking");
+
+ prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieClipProxy");
+
+ /* use proxy */
+ prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY);
+ RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this clip");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ prop= RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" , "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
+ RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get" , NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop= RNA_def_float_vector(srna, "resolution" , 2 , NULL , 0, 0, "Resolution" , "X/Y pixels per meter" , 0 , 0);
+ RNA_def_property_float_funcs(prop, "rna_MovieClip_resolution_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop= RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "aspx");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, 0.1f, 5000.0f);
+ RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
+ RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this clip, does not affect rendering");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* source */
+ prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, clip_source_items);
+ RNA_def_property_ui_text(prop, "Source", "Where the clip comes from");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* custom proxy directory */
+ prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR);
+ RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
+
+ /* grease pencil */
+ prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this movie clip");
+}
+
+void RNA_def_movieclip(BlenderRNA *brna)
+{
+ rna_def_movieclip(brna);
+ rna_def_movieclip_proxy(brna);
+ rna_def_moviecliUser(brna);
+ rna_def_movieClipScopes(brna);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 63fce2d9edb..4245d606f61 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1074,6 +1074,15 @@ static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scen
}
}
+static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ Scene *scene= (Scene*)ptr->id.data;
+ Object *camera= scene->camera;
+
+ if(camera)
+ DAG_id_tag_update(&camera->id, 0);
+}
+
#else
static void rna_def_transform_orientation(BlenderRNA *brna)
@@ -2428,13 +2437,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "xsch");
RNA_def_property_range(prop, 4, 10000);
RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the rendered image");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ysch");
RNA_def_property_range(prop, 4, 10000);
RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
prop= RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
RNA_def_property_int_sdna(prop, NULL, "size");
@@ -2459,13 +2468,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "xasp");
RNA_def_property_range(prop, 1.0f, 200.0f);
RNA_def_property_ui_text(prop, "Pixel Aspect X", "Horizontal aspect ratio - for anamorphic or non-square pixel output");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
prop= RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "yasp");
RNA_def_property_range(prop, 1.0f, 200.0f);
RNA_def_property_ui_text(prop, "Pixel Aspect Y", "Vertical aspect ratio - for anamorphic or non-square pixel output");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
/* JPEG and AVI JPEG */
@@ -3752,6 +3761,14 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "TransformOrientation");
RNA_def_property_ui_text(prop, "Transform Orientations", "");
+ /* acctive MovieClip */
+ prop= RNA_def_property(srna, "active_clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_ui_text(prop, "Active Movie Clip", "Active movie clip used for constraints and viewport drawing");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
/* Nestled Data */
rna_def_tool_settings(brna);
rna_def_unit_settings(brna);
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 795ea417d90..c8792ef30f3 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -288,6 +288,11 @@ static void rna_def_screen(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
RNA_def_property_ui_text(prop, "Node Editors", "");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop= RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_CLIPS);
+ RNA_def_property_ui_text(prop, "Clip Editors", "");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
}
void RNA_def_screen(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 0dc4ca343fe..580f759c38f 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -70,6 +70,7 @@ EnumPropertyItem space_type_items[] = {
{SPACE_LOGIC, "LOGIC_EDITOR", 0, "Logic Editor", ""},
{SPACE_CONSOLE, "CONSOLE", 0, "Python Console", ""},
{SPACE_USERPREF, "USER_PREFERENCES", 0, "User Preferences", ""},
+ {SPACE_CLIP, "CLIP_EDITOR", 0, "Clip Editor", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem draw_channels_items[] = {
@@ -126,6 +127,7 @@ EnumPropertyItem viewport_shade_items[] = {
#include "ED_screen.h"
#include "ED_view3d.h"
#include "ED_sequencer.h"
+#include "ED_clip.h"
#include "IMB_imbuf_types.h"
@@ -166,6 +168,8 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
return &RNA_SpaceConsole;
case SPACE_USERPREF:
return &RNA_SpaceUserPreferences;
+ case SPACE_CLIP:
+ return &RNA_SpaceClipEditor;
default:
return &RNA_Space;
}
@@ -883,6 +887,15 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
bgpic->blend = 1.0f - value;
}
+static BGpic *rna_BackgroundImage_add(View3D *v3d)
+{
+ BGpic *bgpic= ED_view3D_background_image_add(v3d);;
+
+ WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ return bgpic;
+}
+
/* Space Node Editor */
static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value)
@@ -955,6 +968,34 @@ static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C,
return item;
}
+static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value)
+{
+ SpaceClip *sc= (SpaceClip*)(ptr->data);
+
+ ED_space_clip_set(NULL, sc, (MovieClip*)value.data);
+}
+
+static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ SpaceClip *sc= (SpaceClip*)(ptr->data);
+
+ sc->scopes.ok= 0;
+}
+
+static void rna_SpaceClipEditor_lock_selection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ SpaceClip *sc= (SpaceClip*)(ptr->data);
+
+ sc->xlockof= 0.f;
+ sc->ylockof= 0.f;
+}
+
+static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ScrArea *sa= rna_area_from_space(ptr);
+ ED_area_tag_refresh(sa);
+}
+
#else
static void rna_def_space(BlenderRNA *brna)
@@ -1170,21 +1211,46 @@ static void rna_def_background_image(BlenderRNA *brna)
{(1<<RV3D_VIEW_CAMERA), "CAMERA", 0, "Camera", "Show background image in camera view"},
{0, NULL, 0, NULL, NULL}};
+ static EnumPropertyItem bgpic_source_items[] = {
+ {V3D_BGPIC_IMAGE, "IMAGE", 0, "Image", ""},
+ {V3D_BGPIC_MOVIE, "MOVIE", 0, "Movie", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna= RNA_def_struct(brna, "BackgroundImage", NULL);
RNA_def_struct_sdna(srna, "BGpic");
RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3d View background");
+ prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "source");
+ RNA_def_property_enum_items(prop, bgpic_source_items);
+ RNA_def_property_ui_text(prop, "Background Source", "Data source used for background");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ima");
RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+ prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_ui_text(prop, "MovieClip", "Movie clip displayed and edited in this space");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "iuser");
RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "MovieClipUser");
+ RNA_def_property_pointer_sdna(prop, NULL, "cuser");
+ RNA_def_property_ui_text(prop, "Clip User", "Parameters defining which frame of the movie clip is displayed");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "xof");
@@ -1220,6 +1286,28 @@ static void rna_def_background_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+ prop= RNA_def_property(srna, "use_camera_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_CAMERACLIP);
+ RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+}
+
+static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BackgroundImages");
+ srna= RNA_def_struct(brna, "BackgroundImages", NULL);
+ RNA_def_struct_sdna(srna, "View3D");
+ RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
+
+ func= RNA_def_function(srna, "add", "rna_BackgroundImage_add");
+ RNA_def_function_ui_description(func, "Add new background image");
+
+ parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
+ RNA_def_function_return(func, parm);
}
static void rna_def_space_view3d(BlenderRNA *brna)
@@ -1243,6 +1331,16 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
{0, NULL, 0, NULL, NULL}};
+ static EnumPropertyItem bundle_drawtype_items[] = {
+ {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
+ {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
+ {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
+ {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
+ {OB_CUBE, "CUBE", 0, "Cube", ""},
+ {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
+ {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "SpaceView3D", "Space");
RNA_def_struct_sdna(srna, "View3D");
RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
@@ -1386,6 +1484,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "BackgroundImage");
RNA_def_property_ui_text(prop, "Background Images", "List of background images");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+ rna_def_backgroundImages(brna, prop);
prop= RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DISPBGPICS);
@@ -1471,6 +1570,33 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_quadview_get", NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Quad View Region", "3D region that defines the quad view settings");
+ prop= RNA_def_property(srna, "show_reconstruction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_RECONSTRUCTION);
+ RNA_def_property_ui_text(prop, "Show Reconstruction", "Display reconstruction data from active movie clip");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "bundle_draw_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_float_sdna(prop, NULL, "bundle_size");
+ RNA_def_property_ui_text(prop, "Bundle Size", "Display size of bundles from reconstructed data");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "bundle_draw_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bundle_drawtype");
+ RNA_def_property_enum_items(prop, bundle_drawtype_items);
+ RNA_def_property_ui_text(prop, "Bundle Display Type", "Viewport display style for bundles");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_CAMERAPATH);
+ RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed path of camera");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "show_bundle_name", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_BUNDLENAME);
+ RNA_def_property_ui_text(prop, "Show Bundle Name", "Show names for bundle objects");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
/* region */
srna= RNA_def_struct(brna, "RegionView3D", NULL);
@@ -2659,6 +2785,172 @@ static void rna_def_space_logic(BlenderRNA *brna)
}
+static void rna_def_space_clip(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem mode_items[] = {
+ {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
+ {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction", "Show tracking/reconstruction tools"},
+ {SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem view_items[] = {
+ {SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
+ {SC_VIEW_GRAPH, "GRAPH", ICON_IPO, "Graph", "Show graph view for active element"},
+ {0, NULL, 0, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "SpaceClipEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceClip");
+ RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data");
+
+ /* movieclip */
+ prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "Movie clip displayed and edited in this space");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceClipEditor_clip_set", NULL, NULL);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* clip user */
+ prop= RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "MovieClipUser");
+ RNA_def_property_pointer_sdna(prop, NULL, "user");
+ RNA_def_property_ui_text(prop, "Movie Clip User", "Parameters defining which frame of the movie clip is displayed");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* mode */
+ prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, "rna_SpaceClipEditor_clip_mode_update");
+
+ /* view */
+ prop= RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "view");
+ RNA_def_property_enum_items(prop, view_items);
+ RNA_def_property_ui_text(prop, "View", "Type of the clip editor view");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, "rna_SpaceClipEditor_view_type_update");
+
+ /* show pattern */
+ prop= RNA_def_property(srna, "show_marker_pattern", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Marker Pattern", "Show pattern boundbox for markers");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_PATTERN);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show search */
+ prop= RNA_def_property(srna, "show_marker_search", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Marker Search", "Show search boundbox for markers");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_SEARCH);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show pyramid */
+ prop= RNA_def_property(srna, "show_pyramid_levels", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Pyramid ", "Show patterns for each pyramid level for markers (KLT only)");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_PYRAMID_LEVELS);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* lock to selection */
+ prop= RNA_def_property(srna, "lock_selection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Lock to Selection", "Lock viewport to selected markers during playback");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_SELECTION);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, "rna_SpaceClipEditor_lock_selection_update");
+
+ /* show markers pathes */
+ prop= RNA_def_property(srna, "show_track_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TRACK_PATH);
+ RNA_def_property_ui_text(prop, "Show Track Path", "Show path of how track moves");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* path length */
+ prop= RNA_def_property(srna, "path_length", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "path_length");
+ RNA_def_property_range(prop, 0, 50);
+ RNA_def_property_ui_text(prop, "Path Length", "Length of displaying path, in frames");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show tiny markers */
+ prop= RNA_def_property(srna, "show_tiny_markers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Tiny Markers", "Show markers tiny");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TINY_MARKER);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show bundles */
+ prop= RNA_def_property(srna, "show_bundles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Bundles", "Show projection of bundles into footage");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_BUNDLES);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* mute footage */
+ prop= RNA_def_property(srna, "use_mute_footage", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Mute Footage", "Mute footage and show black background instead");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MUTE_FOOTAGE);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* hide disabled */
+ prop= RNA_def_property(srna, "show_disabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Disabled", "Show disabled tracks from the footage");
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SC_HIDE_DISABLED);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* scopes */
+ prop= RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "scopes");
+ RNA_def_property_struct_type(prop, "MovieClipScopes");
+ RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize movie clip statistics");
+
+ /* show names */
+ prop= RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_NAMES);
+ RNA_def_property_ui_text(prop, "Show Names", "Show track names and status");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show grid */
+ prop= RNA_def_property(srna, "show_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRID);
+ RNA_def_property_ui_text(prop, "Show Grid", "Show grid showing lens distortion");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show stable */
+ prop= RNA_def_property(srna, "show_stable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_STABLE);
+ RNA_def_property_ui_text(prop, "Show Stable", "Show stable footage in editor (if stabilization is enabled)");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* manual calibration */
+ prop= RNA_def_property(srna, "use_manual_calibration", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MANUAL_CALIBRATION);
+ RNA_def_property_ui_text(prop, "Manual Calibration", "Use manual calibration helpers");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show stable */
+ prop= RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GPENCIL);
+ RNA_def_property_ui_text(prop, "Show Grease Pencil", "Show grease pencil strokes over the footage");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show filters */
+ prop= RNA_def_property(srna, "show_filters", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_FILTERS);
+ RNA_def_property_ui_text(prop, "Show Filters", "Show filters for graph editor");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show graph_frames */
+ prop= RNA_def_property(srna, "show_graph_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_FRAMES);
+ RNA_def_property_ui_text(prop, "Show Frames", "Show curves for frames in graph editor");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+ /* show graph_tracks */
+ prop= RNA_def_property(srna, "show_graph_tracks", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS);
+ RNA_def_property_ui_text(prop, "Show Tracks", "Show curves for tracks in graph editor");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+}
+
+
void RNA_def_space(BlenderRNA *brna)
{
rna_def_space(brna);
@@ -2681,6 +2973,7 @@ void RNA_def_space(BlenderRNA *brna)
rna_def_space_userpref(brna);
rna_def_space_node(brna);
rna_def_space_logic(brna);
+ rna_def_space_clip(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
new file mode 100644
index 00000000000..34307f972c5
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -0,0 +1,772 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_tracking.c
+ * \ingroup RNA
+ */
+
+
+#include <stdlib.h>
+#include <limits.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BKE_movieclip.h"
+#include "BKE_tracking.h"
+
+#include "RNA_define.h"
+
+#include "rna_internal.h"
+
+#include "DNA_movieclip_types.h"
+#include "DNA_scene_types.h"
+
+#include "WM_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_depsgraph.h"
+#include "BKE_node.h"
+
+#include "IMB_imbuf.h"
+
+#include "WM_api.h"
+
+static void rna_tracking_tracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
+}
+
+static void rna_tracking_tracks_add(MovieTracking *tracking, int frame, int number)
+{
+ int a;
+
+ for(a= 0; a<number; a++)
+ BKE_tracking_add_track(tracking, 0, 0, frame, 1, 1);
+
+ WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, NULL);
+}
+
+static PointerRNA rna_tracking_active_track_get(PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+
+ return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingTrack, clip->tracking.act_track);
+}
+
+static void rna_tracking_active_track_set(PointerRNA *ptr, PointerRNA value)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ MovieTrackingTrack *track= (MovieTrackingTrack *)value.data;
+ int index= BLI_findindex(&clip->tracking.tracks, track);
+
+ if(index>=0) clip->tracking.act_track= track;
+ else clip->tracking.act_track= NULL;
+}
+
+void rna_trackingTrack_name_set(PointerRNA *ptr, const char *value)
+{
+ MovieClip *clip= (MovieClip *)ptr->id.data;
+ MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+ BLI_strncpy(track->name, value, sizeof(track->name));
+
+ BKE_track_unique_name(&clip->tracking, track);
+}
+
+static void rna_tracking_trackerPattern_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+
+ BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
+}
+
+static void rna_tracking_trackerSearch_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+
+ BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
+}
+
+static void rna_tracking_trackerAlgorithm_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+
+ if(track->tracker==TRACKER_KLT)
+ BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
+ else
+ BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
+}
+
+static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+
+ BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
+}
+
+static int rna_tracking_markers_length(PointerRNA *ptr)
+{
+ MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+
+ return track->markersnr;
+}
+
+static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ MovieTrackingCamera *camera= &clip->tracking.camera;
+ float val= camera->focal;
+
+ if(clip->lastsize[0])
+ val= val*camera->sensor_width/(float)clip->lastsize[0];
+
+ return val;
+}
+
+static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ MovieTrackingCamera *camera= &clip->tracking.camera;
+
+ if(clip->lastsize[0])
+ value= clip->lastsize[0]*value/camera->sensor_width;
+
+ camera->focal= value;
+}
+
+static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), void *data)
+{
+ MovieTrackingTrack *track= (MovieTrackingTrack*)data;
+
+ if((track->flag&TRACK_USE_2D_STAB)==0)
+ return 1;
+
+ return 0;
+}
+
+static void rna_tracking_stabTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ rna_iterator_listbase_begin(iter, &clip->tracking.tracks, rna_track_2d_stabilization);
+}
+
+static int rna_tracking_stabTracks_active_index_get(PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ return clip->tracking.stabilization.act_track;
+}
+
+static void rna_tracking_stabTracks_active_index_set(PointerRNA *ptr, int value)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ clip->tracking.stabilization.act_track= value;
+}
+
+static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min, int *max)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+
+ *min= 0;
+ *max= clip->tracking.stabilization.tot_track-1;
+ *max= MAX2(0, *max);
+}
+
+static void rna_tracking_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ MovieTrackingStabilization *stab= &clip->tracking.stabilization;
+
+ stab->ok= 0;
+
+ nodeUpdateID(scene->nodetree, &clip->id);
+
+ WM_main_add_notifier(NC_SCENE|ND_NODES, NULL);
+ DAG_id_tag_update(&clip->id, 0);
+}
+
+/* API */
+
+static MovieTrackingMarker *rna_trackingTrack_marker_find_frame(MovieTrackingTrack *track, int framenr)
+{
+ return BKE_tracking_get_marker(track, framenr);
+}
+
+#else
+
+static int rna_matrix_dimsize_4x4[]= {4, 4};
+
+static void rna_def_trackingSettings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem speed_items[] = {
+ {0, "FASTEST", 0, "Fastest", "Track as fast as it's possible"},
+ {TRACKING_SPEED_DOUBLE, "DOUBLE", 0, "Double", "Track with double speed"},
+ {TRACKING_SPEED_REALTIME, "REALTIME", 0, "Realtime", "Track with realtime speed"},
+ {TRACKING_SPEED_HALF, "HALF", 0, "Half", "Track with half of realtime speed"},
+ {TRACKING_SPEED_QUARTER, "QUARTER", 0, "Quarter", "Track with quarter of realtime speed"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem cleanup_items[] = {
+ {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"},
+ {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"},
+ {TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna= RNA_def_struct(brna, "MovieTrackingSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking settings", "Match moving settings");
+
+ /* speed */
+ prop= RNA_def_property(srna, "speed", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, speed_items);
+ RNA_def_property_ui_text(prop, "Speed", "Speed to make tracking with");
+
+ /* limit frames */
+ prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "frames_limit");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Frames Limit", "Amount of frames to be tracked during single tracking operation");
+
+ /* adjust frames */
+ prop= RNA_def_property(srna, "frames_adjust", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "adjframes");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Adjust Frames", "Automatically re-adjust marker position using position on each N frames. 0 means only keyframed position is used");
+
+ /* margin */
+ prop= RNA_def_property(srna, "margin", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "margin");
+ RNA_def_property_range(prop, 0, 300);
+ RNA_def_property_ui_text(prop, "Margin", "Margin for markers from image boundary");
+
+ /* keyframe_a */
+ prop= RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "keyframe1");
+ RNA_def_property_ui_text(prop, "Keyframe A", "First keyframe used for reconstruction initialization");
+
+ /* keyframe_b */
+ prop= RNA_def_property(srna, "keyframe_b", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "keyframe2");
+ RNA_def_property_ui_text(prop, "Keyframe B", "Second keyframe used for reconstruction initialization");
+
+ /* tool settings */
+
+ /* distance */
+ prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_ui_text(prop, "Distance", "Distance between two bundles used for scene scaling");
+
+ /* frames count */
+ prop= RNA_def_property(srna, "clean_frames", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "clean_frames");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Tracked Frames", "Effect on tracks which are tracked less than the specified amount of frames");
+
+ /* reprojection error */
+ prop= RNA_def_property(srna, "clean_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "clean_error");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Reprojection Error", "Effect on tracks which have a larger reprojection error");
+
+ /* cleanup action */
+ prop= RNA_def_property(srna, "clean_action", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "clean_action");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, cleanup_items);
+ RNA_def_property_ui_text(prop, "Action", "Cleanup action to execute");
+}
+
+static void rna_def_trackingCamera(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem camera_units_items[] = {
+ {CAMERA_UNITS_PX, "PIXELS", 0, "px", "Use pixels for units of focal length"},
+ {CAMERA_UNITS_MM, "MILLIMETERS", 0, "mm", "Use millimeters for units of focal length"},
+ {0, NULL, 0, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "MovieTrackingCamera", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking camera data", "Match-moving camera data for tracking");
+
+ /* Sensor */
+ prop= RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sensor_width");
+ RNA_def_property_range(prop, 0.0f, 500.0f);
+ RNA_def_property_ui_text(prop, "Sensor", "Width of CCD sensor in millimeters");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+
+ /* Focal Length */
+ prop= RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "focal");
+ RNA_def_property_range(prop, 0.0f, 5000.0f);
+ RNA_def_property_float_funcs(prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL);
+ RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+
+ /* Focal Length in pixels */
+ prop= RNA_def_property(srna, "focal_length_pixels", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "focal");
+ RNA_def_property_range(prop, 0.0f, 5000.0f);
+ RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+
+ /* Units */
+ prop= RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "units");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, camera_units_items);
+ RNA_def_property_ui_text(prop, "Units", "Units used for camera focal length");
+
+ /* Principal Point */
+ prop= RNA_def_property(srna, "principal", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_sdna(prop, NULL, "principal");
+ RNA_def_property_ui_text(prop, "Principal Point", "Optical center of lens");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+
+ /* Radial distortion parameters */
+ prop= RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "k1");
+ RNA_def_property_ui_range(prop, -10, 10, .1, 3);
+ RNA_def_property_ui_text(prop, "K1", "First coefficient of third order polynomial radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop= RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "k2");
+ RNA_def_property_ui_range(prop, -10, 10, .1, 3);
+ RNA_def_property_ui_text(prop, "K2", "Second coefficient of third order polynomial radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop= RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "k3");
+ RNA_def_property_ui_range(prop, -10, 10, .1, 3);
+ RNA_def_property_ui_text(prop, "K3", "Third coefficient of third order polynomial radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
+
+ /* pixel aspect */
+ prop= RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "pixel_aspect");
+ RNA_def_property_range(prop, 0.1f, 5000.0f);
+ RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
+ RNA_def_property_ui_text(prop, "Pixel Aspect", "Pixel aspect ratio");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+}
+
+static void rna_def_trackingMarker(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "MovieTrackingMarker", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking marker data", "Match-moving marker data for tracking");
+
+ /* position */
+ prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+ RNA_def_property_float_sdna(prop, NULL, "pos");
+ RNA_def_property_ui_text(prop, "Position", "Marker position at frame in normalized coordinates");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+
+ /* frame */
+ prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can't be safty edited for now, need to re-sort markers array after change */
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+
+ /* enable */
+ prop= RNA_def_property(srna, "enable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MARKER_DISABLED);
+ RNA_def_property_ui_text(prop, "Enable", "Is marker enabled for current frame");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+}
+
+static void rna_def_trackingTrack(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static EnumPropertyItem tracker_items[] = {
+ {TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker"},
+ {TRACKER_KLT, "KLT", 0, "KLT", "Kanade–Lucas–Tomasi racker"},
+ {0, NULL, 0, NULL, NULL}};
+
+ rna_def_trackingMarker(brna);
+
+ srna= RNA_def_struct(brna, "MovieTrackingTrack", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking track data", "Match-moving track data for tracking");
+ RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
+
+ /* name */
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Unique name of track");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingTrack_name_set");
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME);
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ /* Pattern */
+ prop= RNA_def_property(srna, "pattern_min", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+ RNA_def_property_float_sdna(prop, NULL, "pat_min");
+ RNA_def_property_ui_text(prop, "Pattern Min", "Left-bottom corner of pattern area in normalized coordinates relative to marker position");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
+
+ prop= RNA_def_property(srna, "pattern_max", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+ RNA_def_property_float_sdna(prop, NULL, "pat_max");
+ RNA_def_property_ui_text(prop, "Pattern Max", "Right-bottom corner of pattern area in normalized coordinates relative to marker position");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
+
+ /* Search */
+ prop= RNA_def_property(srna, "search_min", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+ RNA_def_property_float_sdna(prop, NULL, "search_min");
+ RNA_def_property_ui_text(prop, "Search Min", "Left-bottom corner of search area in normalized coordinates relative to marker position");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
+
+ prop= RNA_def_property(srna, "search_max", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+ RNA_def_property_float_sdna(prop, NULL, "search_max");
+ RNA_def_property_ui_text(prop, "Search Max", "Right-bottom corner of search area in normalized coordinates relative to marker position");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
+
+ /* tracking algorithm */
+ prop= RNA_def_property(srna, "tracker", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, tracker_items);
+ RNA_def_property_ui_text(prop, "Tracker", "Tracking algorithm to use");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerAlgorithm_update");
+
+ /* pyramid level for pyramid klt tracking */
+ prop= RNA_def_property(srna, "pyramid_levels", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "pyramid_levels");
+ RNA_def_property_range(prop, 1, 16);
+ RNA_def_property_ui_text(prop, "Pyramid levels", "Number of pyramid levels for KLT tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPyramid_update");
+
+ /* minmal correlation - only used for SAD tracker */
+ prop= RNA_def_property(srna, "minimum_correlation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "minimum_correlation");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Correlation", "Minimal value of correlation between mathed pattern and reference which is still treated as successful tracking");
+
+ /* markers */
+ prop= RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingMarker");
+ RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
+ RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, "rna_tracking_markers_length", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
+
+ /* ** channels ** */
+
+ /* use_red_channel */
+ prop= RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_RED);
+ RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* use_green_channel */
+ prop= RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_GREEN);
+ RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* use_blue_channel */
+ prop= RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_BLUE);
+ RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* has bundle */
+ prop= RNA_def_property(srna, "has_bundle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HAS_BUNDLE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Has Bundle", "True if track has a valid bundle");
+
+ /* bundle position */
+ prop= RNA_def_property(srna, "bundle", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_sdna(prop, NULL, "bundle_pos");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Bundle", "Position of bundle reconstructed from this track");
+
+ /* hide */
+ prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HIDDEN);
+ RNA_def_property_ui_text(prop, "Hide", "Track is hidden");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* locked */
+ prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_LOCKED);
+ RNA_def_property_ui_text(prop, "Lock", "Track is locked and all changes to it are disabled");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* custom color */
+ prop= RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_CUSTOMCOLOR);
+ RNA_def_property_ui_text(prop, "Custom Color", "Use custom color instead of theme-defined");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* color */
+ prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Color", "Color of the track in the Clip Editor");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* average error */
+ prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Average Error", "Average error of re-projection");
+
+ /* ** api ** */
+
+ func= RNA_def_function(srna, "marker_find_frame", "rna_trackingTrack_marker_find_frame");
+ RNA_def_function_ui_description(func, "Get marker for specified frame");
+ parm= RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "type for the new spline", MINFRAME, MAXFRAME);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
+ RNA_def_function_return(func, parm);
+}
+
+static void rna_def_trackingStabilization(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "MovieTrackingStabilization", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking stabilization data", "Match-moving stabilization data for tracking");
+
+ /* 2d stabilization */
+ prop= RNA_def_property(srna, "use_2d_stabilization", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_2D_STABILIZATION);
+ RNA_def_property_ui_text(prop, "Use 2D stabilization", "Use 2D stabilization for footage");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* tracks */
+ prop= RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop, "rna_tracking_stabTracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks used for stabilization");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* rotation track */
+ prop= RNA_def_property(srna, "rotation_track", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "rot_track");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Rotation Track", "Track used to compensate rotation");
+ RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
+
+ /* active track index */
+ prop= RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "act_track");
+ RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get", "rna_tracking_stabTracks_active_index_set", "rna_tracking_stabTracks_active_index_range");
+ RNA_def_property_ui_text(prop, "Active Track Index", "Index of active track in stabilization tracks list");
+
+ /* autoscale */
+ prop= RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE);
+ RNA_def_property_ui_text(prop, "Autoscale", "Automatically scale footage to cover unfilled areas when stabilizating");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* max scale */
+ prop= RNA_def_property(srna, "scale_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "maxscale");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Miximal Scale", "Maximal value for scale factor");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* influence_location */
+ prop= RNA_def_property(srna, "influence_location", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "locinf");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Location Influence", "Influence of stabilization algorithm on footage location");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* influence_scale */
+ prop= RNA_def_property(srna, "influence_scale", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "scaleinf");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Scale Influence", "Influence of stabilization algorithm on footage scale");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* influence_rotation */
+ prop= RNA_def_property(srna, "influence_rotation", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "rotinf");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Rotation Influence", "Influence of stabilization algorithm on footage rotation");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+}
+
+static void rna_def_reconstructedCamera(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "MovieReconstructedCamera", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking reconstructed camera data", "Match-moving reconstructed camera data from tracker");
+
+ /* frame */
+ prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
+
+ /* matrix */
+ prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "mat");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(prop, "Matrix", "Worldspace transformation matrix");
+
+ /* average_error */
+ prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction");
+}
+
+static void rna_def_trackingReconstruction(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_reconstructedCamera(brna);
+
+ srna= RNA_def_struct(brna, "MovieTrackingReconstruction", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking reconstruction data", "Match-moving reconstruction data from tracker");
+
+ /* is_valid */
+ prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_RECONSTRUCTED);
+ RNA_def_property_ui_text(prop, "Reconstructed", "Is tracking data contains valid reconstruction information");
+
+ /* average_error */
+ prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction");
+
+ /* cameras */
+ prop= RNA_def_property(srna, "cameras", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieReconstructedCamera");
+ RNA_def_property_collection_sdna(prop, NULL, "cameras", "camnr");
+ RNA_def_property_ui_text(prop, "Cameras", "Collection of solved cameras");
+}
+
+static void rna_def_trackingTracks(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "MovieTrackingTracks");
+ srna= RNA_def_struct(brna, "MovieTrackingTracks", NULL);
+ RNA_def_struct_sdna(srna, "MovieTracking");
+ RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
+
+ func= RNA_def_function(srna, "add", "rna_tracking_tracks_add");
+ RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip");
+ RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add tracks on", MINFRAME, MAXFRAME);
+ RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of tracks to add to the movie clip", 0, INT_MAX);
+
+ /* active track */
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_pointer_funcs(prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
+}
+
+static void rna_def_tracking(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_trackingSettings(brna);
+ rna_def_trackingCamera(brna);
+ rna_def_trackingTrack(brna);
+ rna_def_trackingStabilization(brna);
+ rna_def_trackingReconstruction(brna);
+
+ srna= RNA_def_struct(brna, "MovieTracking", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking data", "Match-moving data for tracking");
+
+ /* settings */
+ prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingSettings");
+
+ /* camera properties */
+ prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingCamera");
+
+ /* tracks */
+ prop= RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop, "rna_tracking_tracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
+ rna_def_trackingTracks(brna, prop);
+
+ /* stabilization */
+ prop= RNA_def_property(srna, "stabilization", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingStabilization");
+
+ /* reconstruction */
+ prop= RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
+}
+
+void RNA_def_tracking(BlenderRNA *brna)
+{
+ rna_def_tracking(brna);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 25c673a168f..5ab9c334016 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -397,6 +397,25 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
+ func= RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
+ RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
+
+ func= RNA_def_function(srna, "template_track", "uiTemplateTrack");
+ RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
+ api_ui_item_rna_common(func);
+
+ func= RNA_def_function(srna, "template_marker", "uiTemplateMarker");
+ RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
+ api_ui_item_rna_common(func);
+ parm= RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
+ parm= RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
+ RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
+
func= RNA_def_function(srna, "template_list", "uiTemplateList");
RNA_def_function_ui_description(func, "Item. A list widget to display data. e.g. vertexgroups");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index fc9c8a241c6..e4e1c78ab3e 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1030,8 +1030,21 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
RNA_def_property_range(prop, 1, 5);
RNA_def_property_ui_text(prop, "Outline Width", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "bundle_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "bundle_solid");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Bundle Solid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "camera_path", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "camera_path");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Camera Path", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
}
+
static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1741,6 +1754,94 @@ static void rna_def_userdef_theme_colorset(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_update");
}
+static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_clip */
+
+ srna= RNA_def_struct(brna, "ThemeClipEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_ui_text(srna, "Theme Clip Editor", "Theme settings for the Movie Clip Editor");
+
+ rna_def_userdef_theme_spaces_main(srna, SPACE_CLIP);
+
+ prop= RNA_def_property(srna, "marker_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "marker_outline");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Marker Outline Color", "Color of marker's outile");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Marker Color", "Color of marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "active_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "act_marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active Marker", "Color of active marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "selected_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "sel_marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected Marker", "Color of sleected marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "disabled_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "dis_marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Disabled Marker", "Color of disabled marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "locked_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "lock_marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Locked Marker", "Color of locked marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "path_before", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "path_before");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Path Before", "Color of path before current frame");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "path_after", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "path_after");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Path After", "Color of path after current frame");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Grid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "cframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "handle_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Handle Vertex", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "handle_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Handle Vertex Select", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "handle_vertex_size", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 255);
+ RNA_def_property_ui_text(prop, "Handle Vertex Size", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+}
+
static void rna_def_userdef_themes(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1765,6 +1866,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
{15, "INFO", ICON_INFO, "Info", ""},
{16, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""},
{17, "CONSOLE", ICON_CONSOLE, "Python Console", ""},
+ {20, "CLIP_EDITOR", ICON_CLIP, "Movie Clip Editor", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "Theme", NULL);
@@ -1887,6 +1989,12 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "tarm", "");
RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
RNA_def_property_ui_text(prop, "Bone Color Sets", "");
+
+ prop= RNA_def_property(srna, "clip_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "tclip");
+ RNA_def_property_struct_type(prop, "ThemeClipEditor");
+ RNA_def_property_ui_text(prop, "Clip Editor", "");
}
static void rna_def_userdef_addon(BlenderRNA *brna)
@@ -1926,6 +2034,7 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna)
rna_def_userdef_theme_space_userpref(brna);
rna_def_userdef_theme_space_console(brna);
rna_def_userdef_theme_space_logic(brna);
+ rna_def_userdef_theme_space_clip(brna);
rna_def_userdef_theme_colorset(brna);
rna_def_userdef_themes(brna);
}