[Bf-blender-cvs] [0540d2b65c2] master: Added MovieClip.fps read-only property to RNA

Sybren A. Stüvel noreply at git.blender.org
Tue Nov 20 10:32:29 CET 2018


Commit: 0540d2b65c282e958dc7621676b1d829544009cf
Author: Sybren A. Stüvel
Date:   Tue Nov 20 10:32:24 2018 +0100
Branches: master
https://developer.blender.org/rB0540d2b65c282e958dc7621676b1d829544009cf

Added MovieClip.fps read-only property to RNA

This makes it possible for a Python script that loads a MovieClip into the
clip editor to also change the scene frame rate to match.

===================================================================

M	source/blender/makesrna/intern/rna_movieclip.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index 3639c8547ba..5318ea172ef 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -72,6 +72,16 @@ static void rna_MovieClip_size_get(PointerRNA *ptr, int *values)
 	values[1] = clip->lastsize[1];
 }
 
+static float rna_MovieClip_fps_get(PointerRNA *ptr)
+{
+	MovieClip *clip = (MovieClip *)ptr->id.data;
+	if (clip == NULL) {
+		return 0.0f;
+	}
+
+	return BKE_movieclip_get_fps(clip);
+}
+
 static void rna_MovieClipUser_proxy_render_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
 	ID *id = (ID *) ptr->id.data;
@@ -362,6 +372,12 @@ static void rna_def_movieclip(BlenderRNA *brna)
 	RNA_def_property_int_sdna(prop, NULL, "len");
 	RNA_def_property_ui_text(prop, "Duration", "Detected duration of movie clip in frames");
 
+	/* FPS */
+	prop = RNA_def_property(srna, "fps", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_float_funcs(prop, "rna_MovieClip_fps_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Frame Rate", "Detected frame rate of the movie clip in frames per second");
+
 	/* color management */
 	prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");



More information about the Bf-blender-cvs mailing list