- RNA support for returning copied strings from functions, flagging strings as PROP_T...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 8 Jan 2010 13:52:38 +0000 (13:52 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 8 Jan 2010 13:52:38 +0000 (13:52 +0000)
- scene.render_data.frame_path(frame=num), returns the output path for rending images of video.
- scene.render_data.file_extension, readonly attribute, gives the extension ".jpg", ".mov" etc
- player support was guessing names, use the above functions to get the actual names used, accounting for #'s replacing numbers.

22 files changed:
release/scripts/op/screen_play_rendered_anim.py
release/scripts/ui/properties_render.py
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/BKE_writeavi.h
source/blender/blenkernel/BKE_writeffmpeg.h
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/writeavi.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/screen/screendump.c
source/blender/editors/space_file/writeimage.c
source/blender/editors/space_image/image_ops.c
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_scene_api.c
source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
source/blender/python/intern/bpy_rna.c
source/blender/quicktime/apple/quicktime_export.c
source/blender/quicktime/quicktime_export.h
source/blender/render/intern/source/pipeline.c

index a8c9701..b52bdf4 100644 (file)
@@ -29,39 +29,6 @@ import subprocess
 import os
 import platform
 
-# from BKE_add_image_extension()
-img_format_exts = {
-    'IRIS': '.rgb',
-    'RADHDR': '.hdr',
-    'PNG': 'png',
-    'TARGA': 'tga',
-    'RAWTARGA': 'tga',
-    'BMP': 'bmp',
-    'TIFF': 'tif',
-    'OPENEXR': 'exr',
-    'MULTILAYER': 'exr',
-    'CINEON': 'cin',
-    'DPX': 'dpx',
-    'JPEG': 'jpg',
-    'JPEG2000': 'jp2',
-    'QUICKTIME_QTKIT': 'mov',
-    'QUICKTIME_CARBON': 'mov',
-    'AVIRAW': 'avi',
-    'AVIJPEG': 'avi',
-    'AVICODEC': 'avi',
-    'XVID': 'avi',
-    'THEORA': 'ogg',
-    }
-
-movie_formats = ('QUICKTIME_QTKIT',
-                'QUICKTIME_CARBONTKIT',
-                'AVIRAW',
-                'AVIJPEG',
-                'AVICODEC',
-                'XVID',
-                'THEORA')
-
-
 def guess_player_path(preset):
     if preset == 'BLENDER24':
         player_path = 'blender'
@@ -112,16 +79,13 @@ class PlayRenderedAnim(bpy.types.Operator):
         if player_path == '':
             player_path = guess_player_path(preset)
 
-        # doesn't support ### frame notation yet
-        if rd.file_format in movie_formats:
-            file = "%s%04d_%04d" % (file_path, sce.start_frame, sce.end_frame)
-        elif preset in ('BLENDER24', 'DJV', 'CUSTOM'):
-            file = "%s%04d" % (file_path, sce.start_frame)
-        elif preset in ('FRAMECYCLER', 'RV'):
-            file = "%s#" % file_path
-
-        if rd.file_extensions:
-            file += '.' + img_format_exts[rd.file_format]
+        if preset in ('FRAMECYCLER', 'RV'):
+            # replace the number with '#'
+            file_a, file_b = rd.frame_path(frame=0), rd.frame_path(frame=1)
+            file = ''.join([(c if file_b[i] == c else "#") for i, c in enumerate(file_a)])
+        else:
+            # works for movies and images
+            file = rd.frame_path(frame=sce.start_frame)
 
         cmd = [player_path]
         # extra options, fps controls etc.
index 50c78ef..90f5485 100644 (file)
@@ -292,7 +292,7 @@ class RENDER_PT_output(RenderButtonsPanel):
 
         if wide_ui:
             col = split.column()
-        col.prop(rd, "file_extensions")
+        col.prop(rd, "use_file_extension")
         col.prop(rd, "use_overwrite")
         col.prop(rd, "use_placeholder")
 
index 85c3c71..7f18fb1 100644 (file)
@@ -47,8 +47,8 @@ void  free_image(struct Image *me);
 void   BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
 void   BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
 int            BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, char *name, int imtype, int subimtype, int quality);
-void   BKE_makepicstring(struct Scene *scene, char *string, char *base, int frame, int imtype);
-void   BKE_add_image_extension(struct Scene *scene, char *string, int imtype);
+void   BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ext);
+void   BKE_add_image_extension(char *string, int imtype);
 int            BKE_ftype_to_imtype(int ftype);
 int            BKE_imtype_to_ftype(int imtype);
 int            BKE_imtype_is_movie(int imtype);
index a8d38dd..e2778eb 100644 (file)
@@ -40,19 +40,16 @@ struct RenderData;
 struct ReportList;
 struct Scene;
 
-int start_avi(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
-void end_avi(void);
-int append_avi(struct RenderData *rd, int frame, int *pixels, int rectx, int recty, struct ReportList *reports);
-void makeavistring (struct RenderData *rd, char *string);
-
 typedef struct bMovieHandle {
        int (*start_movie)(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
        int (*append_movie)(struct RenderData *rd, int frame, int *pixels, int rectx, int recty, struct ReportList *reports);
        void (*end_movie)(void);
        int (*get_next_frame)(struct RenderData *rd, struct ReportList *reports); /* optional */
+       void (*get_movie_path)(char *string, struct RenderData *rd); /* optional */
 } bMovieHandle;
 
 bMovieHandle *BKE_get_movie_handle(int imtype);
+void BKE_makeanimstring(char *string, struct RenderData *rd);
 
 #ifdef __cplusplus
 }
index 6ec8320..98c385e 100644 (file)
@@ -63,6 +63,7 @@ struct Scene;
 extern int start_ffmpeg(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
 extern void end_ffmpeg(void);
 extern int append_ffmpeg(struct RenderData *rd, int frame, int *pixels, int rectx, int recty, struct ReportList *reports);
+void filepath_ffmpeg(char* string, struct RenderData* rd);
 
 extern void ffmpeg_set_preset(struct RenderData *rd, int preset);
 extern void ffmpeg_verify_image_type(struct RenderData *rd);
index e3bb443..ff5b501 100644 (file)
@@ -883,7 +883,7 @@ int BKE_imtype_is_movie(int imtype)
        return 0;
 }
 
-void BKE_add_image_extension(Scene *scene, char *string, int imtype)
+void BKE_add_image_extension(char *string, int imtype)
 {
        char *extension="";
        
@@ -1409,7 +1409,7 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt
 }
 
 
-void BKE_makepicstring(struct Scene *scene, char *string, char *base, int frame, int imtype)
+void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ext)
 {
        if (string==NULL) return;
 
@@ -1422,8 +1422,8 @@ void BKE_makepicstring(struct Scene *scene, char *string, char *base, int frame,
        BLI_convertstringcode(string, G.sce);
        BLI_convertstringframe(string, frame);
 
-       if(scene->r.scemode & R_EXTENSION) 
-               BKE_add_image_extension(scene, string, imtype);
+       if(use_ext)
+               BKE_add_image_extension(string, imtype);
                
 }
 
index ec3d118..9ff5ee0 100644 (file)
 #include "BKE_writeavi.h"
 #include "AVI_avi.h"
 
+/* callbacks */
+static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports);
+static void end_avi(void);
+static int append_avi(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports);
+static void filepath_avi(char *string, RenderData *rd);
 
 /* ********************** general blender movie support ***************************** */
 
@@ -67,6 +72,7 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
        mh.append_movie= append_avi;
        mh.end_movie= end_avi;
        mh.get_next_frame = NULL;
+       mh.get_movie_path = filepath_avi;
        
        /* do the platform specific handles */
 #ifdef __sgi
@@ -86,6 +92,7 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
                mh.start_movie= start_qt;
                mh.append_movie= append_qt;
                mh.end_movie= end_qt;
+               mh.get_movie_path = filepath_qt;
        }
 #endif
 #ifdef WITH_FFMPEG
@@ -93,6 +100,7 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
                mh.start_movie = start_ffmpeg;
                mh.append_movie = append_ffmpeg;
                mh.end_movie = end_ffmpeg;
+               mh.get_movie_path = filepath_ffmpeg;
        }
 #endif
        if (imtype == R_FRAMESERVER) {
@@ -111,7 +119,7 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
 static AviMovie *avi=NULL;
 static int sframe;
 
-void makeavistring (RenderData *rd, char *string) 
+static void filepath_avi (char *string, RenderData *rd)
 {
        char txt[64];
 
@@ -128,7 +136,7 @@ void makeavistring (RenderData *rd, char *string)
        }
 }
 
-int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
+static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
 {
        int x, y;
        char name[256];
@@ -136,7 +144,7 @@ int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *re
        int quality;
        double framerate;
        
-       makeavistring(rd, name);
+       filepath_avi(name, rd);
 
        sframe = (rd->sfra);
        x = rectx;
@@ -174,7 +182,7 @@ int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *re
        return 1;
 }
 
-int append_avi(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports)
+static int append_avi(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports)
 {
        unsigned int *rt1, *rt2, *rectot;
        int x, y;
@@ -218,3 +226,12 @@ void end_avi(void)
        avi= NULL;
 }
 
+/* similar to BKE_makepicstring() */
+void BKE_makeanimstring(char *string, RenderData *rd)
+{
+       bMovieHandle *mh= BKE_get_movie_handle(rd->imtype);
+       if(mh->get_movie_path)
+               mh->get_movie_path(string, rd);
+       else
+               string[0]= '\0';
+}
index 5b58f0b..920ff25 100644 (file)
@@ -75,7 +75,6 @@
 #endif
 
 extern void do_init_ffmpeg();
-static void makeffmpegstring(RenderData* rd, char* string);
 
 static int ffmpeg_type = 0;
 static int ffmpeg_codec = CODEC_ID_MPEG4;
@@ -638,7 +637,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
        do_init_ffmpeg();
 
        /* Determine the correct filename */
-       makeffmpegstring(rd, name);
+       filepath_ffmpeg(name, rd);
        fprintf(stderr, "Starting output to %s(ffmpeg)...\n"
                "  Using type=%d, codec=%d, audio_codec=%d,\n"
                "  video_bitrate=%d, audio_bitrate=%d,\n"
@@ -772,7 +771,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
    ********************************************************************** */
 
 /* Get the output filename-- similar to the other output formats */
-static void makeffmpegstring(RenderData* rd, char* string) {
+void filepath_ffmpeg(char* string, RenderData* rd) {
 
        // XXX quick define, solve!
 #define FILE_MAXDIR 256
index c938f09..4125ced 100644 (file)
@@ -3413,7 +3413,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
                                printf("Append frame %d", scene->r.cfra);
                }
                else {
-                       BKE_makepicstring(scene, name, scene->r.pic, scene->r.cfra, scene->r.imtype);
+                       BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION);
                        ok= BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
                        
                        if(ok==0) printf("write error: cannot save %s\n", name);
index 088be19..7fea283 100644 (file)
@@ -84,7 +84,7 @@ static int screenshot_exec(bContext *C, wmOperator *op)
                /* BKE_add_image_extension() checks for if extension was already set */
                if(scene->r.scemode & R_EXTENSION) 
                        if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5)
-                               BKE_add_image_extension(scene, path, scene->r.imtype);
+                               BKE_add_image_extension(path, scene->r.imtype);
                
                ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0, 0);
                ibuf->rect= scd->dumprect;
@@ -258,7 +258,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update)
                                char name[FILE_MAXDIR+FILE_MAXFILE];
                                int ok;
                                
-                               BKE_makepicstring(sj->scene, name, rd.pic, cfra, rd.imtype);
+                               BKE_makepicstring(name, rd.pic, cfra, rd.imtype, rd.scemode & R_EXTENSION);
                                
                                ibuf->rect= sj->dumprect;
                                ok= BKE_write_ibuf(sj->scene, ibuf, name, rd.imtype, rd.subimtype, rd.quality);
index 045c790..9e8e3b7 100644 (file)
@@ -102,7 +102,7 @@ static void save_rendered_image_cb_real(char *name, int confirm)
        /* BKE_add_image_extension() checks for if extension was already set */
        if(scene->r.scemode & R_EXTENSION) 
                if(strlen(name)<FILE_MAXDIR+FILE_MAXFILE-5)
-                       BKE_add_image_extension(scene, name, scene->r.imtype);
+                       BKE_add_image_extension(name, scene->r.imtype);
 
        strcpy(str, name);
        BLI_convertstringcode(str, G.sce);
index f204d77..827b2dd 100644 (file)
@@ -785,8 +785,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
                BLI_convertstringframe(name, scene->r.cfra);
                
                if(scene->r.scemode & R_EXTENSION)  {
-                       BKE_add_image_extension(scene, name, sima->imtypenr);
-                       BKE_add_image_extension(scene, name, sima->imtypenr);
+                       BKE_add_image_extension(name, sima->imtypenr);
                }
                
                /* enforce user setting for RGB or RGBA, but skip BW */
index aa7939c..a03903e 100644 (file)
@@ -1238,9 +1238,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
                        ptrstr= "*";
                else if(dparm->prop==func->c_ret)
                        ptrstr= ((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR))? "*": "";
-               else if ((dparm->prop->flag & PROP_RETURN))
-                       ptrstr= ((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR))? "**": "*";
-               else
+               else if ((dparm->prop->flag & PROP_RETURN)) {
+                       if ((dparm->prop->flag & PROP_THICK_WRAP) && (dparm->prop->type == PROP_STRING))
+                               ptrstr= "";
+                       else
+                               ptrstr= ((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR))? "**": "*";
+               } else
                        ptrstr= (dparm->prop->type == PROP_POINTER)? "*": "";
 
                fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
@@ -1276,8 +1279,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
                        else
                                fprintf(f, "\t%s= %s((%s%s**)_data);\n", dparm->prop->identifier, ptrstr, rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
                }
-               else
-                       fprintf(f, "\t%s= %s((%s%s*)_data);\n", dparm->prop->identifier, ptrstr, rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
+               else {
+                       if ((dparm->prop->flag & PROP_THICK_WRAP) && (dparm->prop->type == PROP_STRING))
+                               fprintf(f, "\t%s= %s((%s%s)_data);\n", dparm->prop->identifier, ptrstr, rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
+                       else
+                               fprintf(f, "\t%s= %s((%s%s*)_data);\n", dparm->prop->identifier, ptrstr, rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
+               }
 
                if(dparm->next)
                        fprintf(f, "\t_data+= %d;\n", rna_parameter_size(dparm->prop));
@@ -1614,7 +1621,9 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
                if(!first) fprintf(f, ", ");
                first= 0;
 
-               if((dparm->prop->flag & PROP_RETURN))
+               if((dparm->prop->type == PROP_STRING && dparm->prop->flag & PROP_THICK_WRAP))
+                       ptrstr= "";
+               else if(dparm->prop->flag & PROP_RETURN)
                        ptrstr= "*";
                else
                        ptrstr= "";
index 767752a..ed10c08 100644 (file)
@@ -2470,7 +2470,12 @@ int rna_parameter_size(PropertyRNA *parm)
                        case PROP_FLOAT:
                                return sizeof(float);
                        case PROP_STRING:
-                               return sizeof(char *);
+                               /* return  valyes dont store a pointer to the original */
+                               if(parm->flag & PROP_THICK_WRAP) {
+                                       StringPropertyRNA *sparm= (StringPropertyRNA*)parm;
+                                       return sizeof(char) * sparm->maxlength;
+                               } else
+                                       return sizeof(char *);
                        case PROP_POINTER: {
 #ifdef RNA_RUNTIME
                                if(parm->flag & PROP_RNAPTR)
index 91443e8..b154647 100644 (file)
@@ -225,7 +225,8 @@ void RNA_api_material(StructRNA *srna);
 void RNA_api_mesh(struct StructRNA *srna);
 void RNA_api_object(struct StructRNA *srna);
 void RNA_api_pose_channel(struct StructRNA *srna);
-void RNA_api_scene(struct StructRNA *srna); 
+void RNA_api_scene(struct StructRNA *srna);
+void RNA_api_scene_render(struct StructRNA *srna);
 void RNA_api_text(struct StructRNA *srna);
 void RNA_api_ui_layout(struct StructRNA *srna);
 void RNA_api_wm(struct StructRNA *srna);
index b8a85b6..8830583 100644 (file)
@@ -101,6 +101,7 @@ EnumPropertyItem snap_element_items[] = {
 #include "BKE_pointcache.h"
 #include "BKE_scene.h"
 #include "BKE_depsgraph.h"
+#include "BKE_image.h"
 #include "BKE_mesh.h"
 
 #include "BLI_threads.h"
@@ -359,6 +360,21 @@ static void rna_SceneRenderData_file_format_set(PointerRNA *ptr, int value)
 #endif
 }
 
+static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
+{
+       RenderData *rd= (RenderData*)ptr->data;
+       char ext[8];
+
+       BKE_add_image_extension(ext, rd->imtype);
+       return strlen(ext);
+}
+
+static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
+{
+       RenderData *rd= (RenderData*)ptr->data;
+       BKE_add_image_extension(str, rd->imtype);
+}
+
 void rna_SceneRenderData_jpeg2k_preset_update(RenderData *rd)
 {
        rd->subimtype &= ~(R_JPEG2K_12BIT|R_JPEG2K_16BIT | R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS);
@@ -2100,7 +2116,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Color Management", "Use color profiles and gamma corrected imaging pipeline");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS|NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "file_extensions", PROP_BOOLEAN, PROP_NONE);
+       prop= RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION);
        RNA_def_property_ui_text(prop, "File Extensions", "Add the file format extensions to the rendered file name (eg: filename + .jpg)");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -2111,7 +2127,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_enum_funcs(prop, NULL, "rna_SceneRenderData_file_format_set", NULL);
        RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as.");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-       
+
+       prop= RNA_def_property(srna, "file_extension", PROP_STRING, PROP_NONE);
+       RNA_def_property_string_funcs(prop, "rna_SceneRender_file_ext_get", "rna_SceneRender_file_ext_length", NULL);
+       RNA_def_property_ui_text(prop, "Extension", "The file extension used for saving renders.");
+       RNA_def_struct_name_property(srna, prop);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
        prop= RNA_def_property(srna, "free_image_textures", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FREE_IMAGE);
        RNA_def_property_ui_text(prop, "Free Image Textures", "Free all image texture from memory after render, to save memory before compositing.");
@@ -2317,6 +2339,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_boolean_funcs(prop, "rna_SceneRenderData_use_game_engine_get", NULL);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine.");
+
+       /* Scene API */
+       RNA_api_scene_render(srna);
 }
 
 
index 4efbed1..84dc3e6 100644 (file)
 #include "DNA_anim_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
+#include "BKE_utildefines.h"
 
 #ifdef RNA_RUNTIME
 
 #include "BKE_animsys.h"
 #include "BKE_scene.h"
+#include "BKE_image.h"
 #include "BKE_depsgraph.h"
+#include "BKE_writeavi.h"
 
 #include "ED_object.h"
 #include "ED_anim_api.h"
@@ -84,6 +87,14 @@ static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports,
        }
 }
 
+static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
+{
+       if(BKE_imtype_is_movie(rd->imtype))
+               BKE_makeanimstring(name, rd);
+       else
+               BKE_makepicstring(name, rd->pic, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION);
+}
+
 #else
 
 void RNA_api_scene(StructRNA *srna)
@@ -113,5 +124,18 @@ void RNA_api_scene(StructRNA *srna)
        RNA_def_boolean(func, "insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
 }
 
+void RNA_api_scene_render(StructRNA *srna)
+{
+       FunctionRNA *func;
+       PropertyRNA *parm;
+
+       func= RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path");
+       RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately.");
+       parm= RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "", "Frame number to use, if unset the current frame will be used.", MINAFRAME, MAXFRAME);
+       parm= RNA_def_string(func, "name", "", FILE_MAX, "File Name", "the resulting filename from the scenes render settings.");
+       RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
+       RNA_def_function_return_mark(func, parm);
+}
+
 #endif
 
index e63e580..ebb7c1e 100644 (file)
@@ -62,7 +62,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
                                }
                        }
                        
-                       BKE_makepicstring((Scene *)node->id, string, nif->name, rd->cfra, nif->imtype);
+                       BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, ((Scene *)node->id)->r.scemode & R_EXTENSION);
                        
                        if(0 == BKE_write_ibuf((Scene *)node->id, ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
                                printf("Cannot save Node File Output to %s\n", string);
index 5e255ba..34e4599 100644 (file)
@@ -2325,6 +2325,8 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
                return (f=='f') ? 1:0;
        case PROP_RAW_DOUBLE:
                return (f=='d') ? 1:0;
+       case PROP_RAW_UNSET:
+               return 0;
        }
 
        return 0;
@@ -2389,6 +2391,9 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
                                case PROP_RAW_DOUBLE:
                                        ((double *)array)[i]= (double)PyFloat_AsDouble(item);
                                        break;
+                               case PROP_RAW_UNSET:
+                                       /* should never happen */
+                                       break;
                                }
 
                                Py_DECREF(item);
@@ -2440,6 +2445,9 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
                                case PROP_RAW_DOUBLE:
                                        item= PyFloat_FromDouble(  (double) ((double *)array)[i]  );
                                        break;
+                               case PROP_RAW_UNSET:
+                                       /* should never happen */
+                                       break;
                                }
 
                                PySequence_SetItem(seq, i, item);
@@ -2584,7 +2592,7 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
 {
        PyObject *ret;
        int type = RNA_property_type(prop);
-
+       int flag = RNA_property_flag(prop);
        int a;
 
        if(RNA_property_array_check(ptr, prop)) {
@@ -2647,7 +2655,10 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
                        break;
                case PROP_STRING:
                {
-                       ret = PyUnicode_FromString( *(char**)data );
+                       if(flag & PROP_THICK_WRAP)
+                               ret = PyUnicode_FromString( (char*)data );
+                       else
+                               ret = PyUnicode_FromString( *(char**)data );
                        break;
                }
                case PROP_ENUM:
@@ -2659,7 +2670,6 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
                {
                        PointerRNA newptr;
                        StructRNA *type= RNA_property_pointer_type(ptr, prop);
-                       int flag = RNA_property_flag(prop);
 
                        if(flag & PROP_RNAPTR) {
                                /* in this case we get the full ptr */
index 3f9a6de..bd1705d 100644 (file)
@@ -488,7 +488,7 @@ static void QT_EndAddVideoSamplesToMedia (void)
 } 
 
 
-void makeqtstring (RenderData *rd, char *string) {
+void filepath_qt(char *string, RenderData *rd) {
        char txt[64];
 
        if (string==0) return;
@@ -539,7 +539,7 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
        
        sframe = (rd->sfra);
 
-       makeqtstring(rd, name);
+       filepath_qt(name, rd);
 
 #ifdef __APPLE__
        EnterMoviesOnThread(0);
index 2ccda8e..cf4f557 100644 (file)
@@ -50,6 +50,7 @@ struct ReportList;
 int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);    //for movie handle (BKE writeavi.c now)
 int append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int recty, struct ReportList *reports);
 void end_qt(void);
+static void filepath_qt(char *string, struct RenderData *rd);
 
 /*RNA helper functions */
 void quicktime_verify_image_type(struct RenderData *rd); //used by RNA for defaults values init, if needed
index 73f2532..54f89a6 100644 (file)
@@ -2777,7 +2777,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R
                printf("Append frame %d", scene->r.cfra);
        } 
        else {
-               BKE_makepicstring(scene, name, scene->r.pic, scene->r.cfra, scene->r.imtype);
+               BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION);
                
                if(re->r.imtype==R_MULTILAYER) {
                        if(re->result) {
@@ -2810,7 +2810,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R
                        if(ok && scene->r.imtype==R_OPENEXR && (scene->r.subimtype & R_PREVIEW_JPG)) {
                                if(BLI_testextensie(name, ".exr")) 
                                        name[strlen(name)-4]= 0;
-                               BKE_add_image_extension(scene, name, R_JPEG90);
+                               BKE_add_image_extension(name, R_JPEG90);
                                ibuf->depth= 24; 
                                BKE_write_ibuf(scene, ibuf, name, R_JPEG90, scene->r.subimtype, scene->r.quality);
                                printf("\nSaved: %s", name);
@@ -2895,7 +2895,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra, Repo
                        /* Touch/NoOverwrite options are only valid for image's */
                        if(BKE_imtype_is_movie(scene->r.imtype) == 0) {
                                if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
-                                       BKE_makepicstring(scene, name, scene->r.pic, scene->r.cfra, scene->r.imtype);
+                                       BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION);
 
                                if(scene->r.mode & R_NO_OVERWRITE && BLI_exist(name)) {
                                        printf("skipping existing frame \"%s\"\n", name);