diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 142 |
1 files changed, 127 insertions, 15 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index aca02be71a5..9bc73dddf22 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -39,6 +39,7 @@ #ifdef WITH_QUICKTIME #include "quicktime_export.h" +#include "AUD_C-API.h" #endif #ifdef WITH_FFMPEG @@ -178,15 +179,11 @@ static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter) return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base*)internal->link)->object); } -static Base *rna_Scene_object_link(Scene *scene, ReportList *reports, Object *ob) +static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob) { + Scene *scene_act= CTX_data_scene(C); Base *base; - if (ob->type != OB_EMPTY && ob->data==NULL) { - BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not an Empty type and has no Object Data set.", ob->id.name+2); - return NULL; - } - if (object_in_scene(ob, scene)) { BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is already in scene \"%s\".", ob->id.name+2, scene->id.name+2); return NULL; @@ -196,7 +193,12 @@ static Base *rna_Scene_object_link(Scene *scene, ReportList *reports, Object *ob ob->id.us++; /* this is similar to what object_add_type and add_object do */ - ob->lay= base->lay= scene->lay; + base->lay= scene->lay; + + /* when linking to an inactive scene dont touch the layer */ + if(scene == scene_act) + ob->lay= base->lay; + ob->recalc |= OB_RECALC; DAG_scene_sort(scene); @@ -204,7 +206,7 @@ static Base *rna_Scene_object_link(Scene *scene, ReportList *reports, Object *ob return base; } -static void rna_Scene_object_unlink(Scene *scene, bContext *C, ReportList *reports, Object *ob) +static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob) { Base *base= object_in_scene(ob, scene); if (!base) { @@ -223,7 +225,7 @@ static void rna_Scene_object_unlink(Scene *scene, bContext *C, ReportList *repor DAG_scene_sort(scene); DAG_ids_flush_update(0); - WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); + WM_main_add_notifier(NC_SCENE|ND_OB_ACTIVE, scene); } static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value) @@ -523,14 +525,14 @@ static int rna_RenderSettings_qtcodecsettings_codecType_get(PointerRNA *ptr) { RenderData *rd= (RenderData*)ptr->data; - return quicktime_rnatmpvalue_from_codectype(rd->qtcodecsettings.codecType); + return quicktime_rnatmpvalue_from_videocodectype(rd->qtcodecsettings.codecType); } static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, int value) { RenderData *rd= (RenderData*)ptr->data; - rd->qtcodecsettings.codecType = quicktime_codecType_from_rnatmpvalue(value); + rd->qtcodecsettings.codecType = quicktime_videocodecType_from_rnatmpvalue(value); } static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, int *free) @@ -541,8 +543,8 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bCon int i=1, totitem= 0; char id[5]; - for(i=0;i<quicktime_get_num_codecs();i++) { - codecTypeDesc = quicktime_get_codecType_desc(i); + for(i=0;i<quicktime_get_num_videocodecs();i++) { + codecTypeDesc = quicktime_get_videocodecType_desc(i); if (!codecTypeDesc) break; tmp.value= codecTypeDesc->rnatmpvalue; @@ -557,8 +559,47 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bCon *free= 1; return item; +} + +#ifdef USE_QTKIT +static int rna_RenderSettings_qtcodecsettings_audiocodecType_get(PointerRNA *ptr) +{ + RenderData *rd= (RenderData*)ptr->data; + + return quicktime_rnatmpvalue_from_audiocodectype(rd->qtcodecsettings.audiocodecType); +} + +static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *ptr, int value) +{ + RenderData *rd= (RenderData*)ptr->data; + + rd->qtcodecsettings.audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value); +} + +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + EnumPropertyItem *item= NULL; + EnumPropertyItem tmp = {0, "", 0, "", ""}; + QuicktimeCodecTypeDesc *codecTypeDesc; + int i=1, totitem= 0; + + for(i=0;i<quicktime_get_num_audiocodecs();i++) { + codecTypeDesc = quicktime_get_audiocodecType_desc(i); + if (!codecTypeDesc) break; + + tmp.value= codecTypeDesc->rnatmpvalue; + tmp.identifier= codecTypeDesc->codecName; + tmp.name= codecTypeDesc->codecName; + RNA_enum_item_add(&item, &totitem, &tmp); + } + + RNA_enum_item_end(&item, &totitem); + *free= 1; + + return item; } #endif +#endif static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr) { @@ -1897,6 +1938,35 @@ static void rna_def_scene_render_data(BlenderRNA *brna) static EnumPropertyItem quicktime_codec_type_items[] = { {0, "codec", 0, "codec", ""}, {0, NULL, 0, NULL, NULL}}; + +#ifdef USE_QTKIT + static EnumPropertyItem quicktime_audio_samplerate_items[] = { + {22050, "22050", 0, "22kHz", ""}, + {44100, "44100", 0, "44.1kHz", ""}, + {48000, "48000", 0, "48kHz", ""}, + {88200, "88200", 0, "88.2kHz", ""}, + {96000, "96000", 0, "96kHz", ""}, + {192000, "192000", 0, "192kHz", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem quicktime_audio_bitdepth_items[] = { + {AUD_FORMAT_U8, "8BIT", 0, "8bit", ""}, + {AUD_FORMAT_S16, "16BIT", 0, "16bit", ""}, + {AUD_FORMAT_S24, "24BIT", 0, "24bit", ""}, + {AUD_FORMAT_S32, "32BIT", 0, "32bit", ""}, + {AUD_FORMAT_FLOAT32, "FLOAT32", 0, "float32", ""}, + {AUD_FORMAT_FLOAT64, "FLOAT64", 0, "float64", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem quicktime_audio_bitrate_items[] = { + {64000, "64000", 0, "64kbps", ""}, + {112000, "112000", 0, "112kpbs", ""}, + {128000, "128000", 0, "128kbps", ""}, + {192000, "192000", 0, "192kbps", ""}, + {256000, "256000", 0, "256kbps", ""}, + {320000, "320000", 0, "320kbps", ""}, + {0, NULL, 0, NULL, NULL}}; +#endif #endif #ifdef WITH_FFMPEG @@ -2104,8 +2174,47 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "qtcodecsettings.codecSpatialQuality"); RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Spatial quality", "Intra-frame spatial quality level"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + +#ifdef USE_QTKIT + prop= RNA_def_property(srna, "quicktime_audiocodec_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.audiocodecType"); + RNA_def_property_enum_items(prop, quicktime_codec_type_items); + RNA_def_property_enum_funcs(prop, "rna_RenderSettings_qtcodecsettings_audiocodecType_get", + "rna_RenderSettings_qtcodecsettings_audiocodecType_set", + "rna_RenderSettings_qtcodecsettings_audiocodecType_itemf"); + RNA_def_property_ui_text(prop, "Audio Codec", "QuickTime audio codec type"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_samplerate", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.audioSampleRate"); + RNA_def_property_enum_items(prop, quicktime_audio_samplerate_items); + RNA_def_property_ui_text(prop, "Smp Rate", "Sample Rate"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_bitdepth", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.audioBitDepth"); + RNA_def_property_enum_items(prop, quicktime_audio_bitdepth_items); + RNA_def_property_ui_text(prop, "Bit Depth", "Bit Depth"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_resampling_hq", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "qtcodecsettings.audioCodecFlags", QTAUDIO_FLAG_RESAMPLE_NOHQ); + RNA_def_property_ui_text(prop, "HQ", "Use High Quality resampling algorithm"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_codec_isvbr", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "qtcodecsettings.audioCodecFlags", QTAUDIO_FLAG_CODEC_ISCBR); + RNA_def_property_ui_text(prop, "VBR", "Use Variable Bit Rate compression (improves quality at same bitrate)"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_bitrate", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.audioBitRate"); + RNA_def_property_enum_items(prop, quicktime_audio_bitrate_items); + RNA_def_property_ui_text(prop, "Bitrate", "Compressed audio bitrate"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); #endif +#endif #ifdef WITH_FFMPEG /* FFMPEG Video*/ @@ -2335,6 +2444,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Edge", "Draw stylized strokes using Freestyle."); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + /* threads */ prop= RNA_def_property(srna, "threads", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "threads"); RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS); @@ -2348,6 +2458,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Threads Mode", "Determine the amount of render threads used"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + /* motion blur */ prop= RNA_def_property(srna, "motion_blur", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_MBLUR); RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled 3D scene motion blur"); @@ -2359,6 +2470,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Motion Samples", "Number of scene samples to take with motion blur"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + /* border */ prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER); RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size. Note, this disables save_buffers and full_sample"); @@ -2720,7 +2832,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "link", "rna_Scene_object_link"); RNA_def_function_ui_description(func, "Link object to scene."); - RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base."); @@ -2728,7 +2840,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "unlink", "rna_Scene_object_unlink"); RNA_def_function_ui_description(func, "Unlink object from scene."); - RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); + RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene."); RNA_def_property_flag(parm, PROP_REQUIRED); |