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:
authorBastien Montagne <montagne29@wanadoo.fr>2012-05-26 18:53:33 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-05-26 18:53:33 +0400
commitae919658d4a371772dce7a78113f828d10efeeaa (patch)
tree0848019aadc32a08f067691fb66d112cf45fd73b
parent76599a498953952aff33424a4053322decfd171f (diff)
Add frame_duration read-only member to Image RNA struct, returns movie's length in frames (or 1 for still images).
-rw-r--r--source/blender/makesrna/intern/rna_image.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index b022da97630..03e446c9d91 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -53,6 +53,7 @@ static EnumPropertyItem image_source_items[] = {
#ifdef RNA_RUNTIME
+#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
static void rna_Image_animated_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -287,6 +288,15 @@ static int rna_Image_depth_get(PointerRNA *ptr)
return planes;
}
+static int rna_Image_frame_duration_get(PointerRNA *ptr)
+{
+ Image *im = (Image *)ptr->data;
+
+ if (im->anim)
+ return IMB_anim_get_duration(im->anim, IMB_TC_RECORD_RUN);
+ return 1;
+}
+
static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
Image *ima = ptr->id.data;
@@ -629,6 +639,11 @@ static void rna_def_image(BlenderRNA *brna)
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_Image_resolution_get", "rna_Image_resolution_set", NULL);
+ prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);