Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * Contributor(s): Blender Foundation, 00019 * Sergey Sharybin 00020 * 00021 * ***** END GPL LICENSE BLOCK ***** 00022 */ 00023 00029 #include <stdlib.h> 00030 #include <limits.h> 00031 00032 #include "MEM_guardedalloc.h" 00033 00034 #include "BKE_movieclip.h" 00035 #include "BKE_tracking.h" 00036 00037 #include "RNA_define.h" 00038 00039 #include "rna_internal.h" 00040 00041 #include "DNA_movieclip_types.h" 00042 #include "DNA_scene_types.h" 00043 00044 #include "WM_types.h" 00045 00046 #include "IMB_imbuf_types.h" 00047 #include "IMB_imbuf.h" 00048 00049 #ifdef RNA_RUNTIME 00050 00051 #include "BKE_depsgraph.h" 00052 00053 static void rna_MovieClip_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) 00054 { 00055 MovieClip *clip= (MovieClip*)ptr->id.data; 00056 00057 BKE_movieclip_reload(clip); 00058 DAG_id_tag_update(&clip->id, 0); 00059 } 00060 00061 static void rna_MovieClip_size_get(PointerRNA *ptr, int *values) 00062 { 00063 MovieClip *clip= (MovieClip*)ptr->id.data; 00064 00065 values[0]= clip->lastsize[0]; 00066 values[1]= clip->lastsize[1]; 00067 } 00068 00069 #else 00070 00071 static void rna_def_movieclip_proxy(BlenderRNA *brna) 00072 { 00073 StructRNA *srna; 00074 PropertyRNA *prop; 00075 00076 static const EnumPropertyItem clip_tc_items[]= { 00077 {IMB_TC_NONE, "NONE", 0, "No TC in use", ""}, 00078 {IMB_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", "Use images in the order they are recorded"}, 00079 {IMB_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", "Use global timestamp written by recording device"}, 00080 {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"}, 00081 {IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps", "Record run, but ignore timecode, changes in framerate or dropouts"}, 00082 {0, NULL, 0, NULL, NULL}}; 00083 00084 srna = RNA_def_struct(brna, "MovieClipProxy", NULL); 00085 RNA_def_struct_ui_text(srna, "Movie Clip Proxy", "Proxy parameters for a movie clip"); 00086 RNA_def_struct_sdna(srna, "MovieClipProxy"); 00087 00088 /* build proxy sized */ 00089 prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE); 00090 RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_25); 00091 RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original footage dimension"); 00092 00093 prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE); 00094 RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_50); 00095 RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original footage dimension"); 00096 00097 prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE); 00098 RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_75); 00099 RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original footage dimension"); 00100 00101 prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE); 00102 RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_100); 00103 RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original footage dimension"); 00104 00105 prop= RNA_def_property(srna, "build_undistorted", PROP_BOOLEAN, PROP_NONE); 00106 RNA_def_property_boolean_sdna(prop, NULL, "build_flag", MCLIP_PROXY_BUILD_UNDISTORT); 00107 RNA_def_property_ui_text(prop, "Build Undistorted", "Also build undistorted proxies for selected sizes"); 00108 00109 /* build timecodes */ 00110 prop= RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE); 00111 RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN); 00112 RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index"); 00113 00114 prop= RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE); 00115 RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_FREE_RUN); 00116 RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index"); 00117 00118 prop= RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE); 00119 RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN); 00120 RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time"); 00121 00122 /* quality of proxied image */ 00123 prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED); 00124 RNA_def_property_int_sdna(prop, NULL, "quality"); 00125 RNA_def_property_ui_text(prop, "Quality", "JPEG quality of proxy images"); 00126 RNA_def_property_ui_range(prop, 1, 100, 1, 0); 00127 00128 prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE); 00129 RNA_def_property_enum_sdna(prop, NULL, "tc"); 00130 RNA_def_property_enum_items(prop, clip_tc_items); 00131 RNA_def_property_ui_text(prop, "Timecode", ""); 00132 RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); 00133 00134 /* directory */ 00135 prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); 00136 RNA_def_property_string_sdna(prop, NULL, "dir"); 00137 RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files"); 00138 RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); 00139 } 00140 00141 static void rna_def_moviecliUser(BlenderRNA *brna) 00142 { 00143 StructRNA *srna; 00144 PropertyRNA *prop; 00145 00146 static EnumPropertyItem clip_render_size_items[] = { 00147 {MCLIP_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""}, 00148 {MCLIP_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""}, 00149 {MCLIP_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""}, 00150 {MCLIP_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""}, 00151 {MCLIP_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""}, 00152 {0, NULL, 0, NULL, NULL}}; 00153 00154 srna= RNA_def_struct(brna, "MovieClipUser", NULL); 00155 RNA_def_struct_ui_text(srna, "Movie Clip User", "Parameters defining how a MovieClip datablock is used by another datablock"); 00156 00157 prop= RNA_def_property(srna, "current_frame", PROP_INT, PROP_TIME); 00158 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 00159 RNA_def_property_int_sdna(prop, NULL, "framenr"); 00160 RNA_def_property_range(prop, MINAFRAME, MAXFRAME); 00161 RNA_def_property_ui_text(prop, "Current Frame", "Current frame number in movie or image sequence"); 00162 00163 /* render size */ 00164 prop= RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE); 00165 RNA_def_property_enum_sdna(prop, NULL, "render_size"); 00166 RNA_def_property_enum_items(prop, clip_render_size_items); 00167 RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions"); 00168 RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); 00169 00170 /* render undistorted */ 00171 prop= RNA_def_property(srna, "use_render_undistorted", PROP_BOOLEAN, PROP_NONE); 00172 RNA_def_property_boolean_sdna(prop, NULL, "render_flag", MCLIP_PROXY_RENDER_UNDISTORT); 00173 RNA_def_property_ui_text(prop, "Render Undistorted", "Render preview using undistorted proxy"); 00174 RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); 00175 } 00176 00177 static void rna_def_movieClipScopes(BlenderRNA *brna) 00178 { 00179 StructRNA *srna; 00180 00181 srna= RNA_def_struct(brna, "MovieClipScopes", NULL); 00182 RNA_def_struct_ui_text(srna, "MovieClipScopes", "Scopes for statistical view of a movie clip"); 00183 } 00184 00185 00186 static void rna_def_movieclip(BlenderRNA *brna) 00187 { 00188 StructRNA *srna; 00189 PropertyRNA *prop; 00190 00191 static EnumPropertyItem clip_source_items[]= { 00192 {MCLIP_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"}, 00193 {MCLIP_SRC_MOVIE, "MOVIE", 0, "Movie File", "Movie file"}, 00194 {0, NULL, 0, NULL, NULL}}; 00195 00196 srna= RNA_def_struct(brna, "MovieClip", "ID"); 00197 RNA_def_struct_ui_text(srna, "MovieClip", "MovieClip datablock referencing an external movie file"); 00198 RNA_def_struct_ui_icon(srna, ICON_SEQUENCE); 00199 00200 prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); 00201 RNA_def_property_string_sdna(prop, NULL, "name"); 00202 RNA_def_property_ui_text(prop, "File Path", "Filename of the movie or sequence file"); 00203 RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); 00204 00205 prop= RNA_def_property(srna, "tracking", PROP_POINTER, PROP_NONE); 00206 RNA_def_property_struct_type(prop, "MovieTracking"); 00207 00208 prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); 00209 RNA_def_property_struct_type(prop, "MovieClipProxy"); 00210 00211 /* use proxy */ 00212 prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE); 00213 RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY); 00214 RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this clip"); 00215 RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); 00216 00217 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); 00218 RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get" , NULL, NULL); 00219 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 00220 00221 prop= RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ); 00222 RNA_def_property_float_sdna(prop, NULL, "aspx"); 00223 RNA_def_property_array(prop, 2); 00224 RNA_def_property_range(prop, 0.1f, 5000.0f); 00225 RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2); 00226 RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this clip, does not affect rendering"); 00227 RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL); 00228 00229 /* source */ 00230 prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE); 00231 RNA_def_property_enum_items(prop, clip_source_items); 00232 RNA_def_property_ui_text(prop, "Source", "Where the clip comes from"); 00233 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 00234 00235 /* custom proxy directory */ 00236 prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); 00237 RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR); 00238 RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Create proxy images in a custom directory (default is movie location)"); 00239 RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update"); 00240 00241 /* grease pencil */ 00242 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); 00243 RNA_def_property_pointer_sdna(prop, NULL, "gpd"); 00244 RNA_def_property_flag(prop, PROP_EDITABLE); 00245 RNA_def_property_struct_type(prop, "GreasePencil"); 00246 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this movie clip"); 00247 } 00248 00249 void RNA_def_movieclip(BlenderRNA *brna) 00250 { 00251 rna_def_movieclip(brna); 00252 rna_def_movieclip_proxy(brna); 00253 rna_def_moviecliUser(brna); 00254 rna_def_movieClipScopes(brna); 00255 } 00256 00257 #endif