diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 657 |
1 files changed, 609 insertions, 48 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d8feebaa129..810d83a8ddf 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -36,6 +36,8 @@ #include "DNA_userdef_types.h" #include "DNA_world_types.h" +#include "IMB_imbuf_types.h" + #include "BLI_math.h" #include "BLF_translation.h" @@ -45,6 +47,8 @@ #include "BKE_paint.h" #include "BKE_scene.h" +#include "GPU_extensions.h" + #include "RNA_define.h" #include "RNA_enum_types.h" @@ -82,6 +86,11 @@ EnumPropertyItem exr_codec_items[] = { {R_IMF_EXR_CODEC_ZIP, "ZIP", 0, "ZIP (lossless)", ""}, {R_IMF_EXR_CODEC_PIZ, "PIZ", 0, "PIZ (lossless)", ""}, {R_IMF_EXR_CODEC_RLE, "RLE", 0, "RLE (lossless)", ""}, + {R_IMF_EXR_CODEC_ZIPS, "ZIPS", 0, "ZIPS (lossless)", ""}, + {R_IMF_EXR_CODEC_B44, "B44", 0, "B44 (lossy)", ""}, + {R_IMF_EXR_CODEC_B44A, "B44A", 0, "B44A (lossy)", ""}, + {R_IMF_EXR_CODEC_DWAA, "DWAA", 0, "DWAA (lossy)", ""}, + {R_IMF_EXR_CODEC_DWAB, "DWAB", 0, "DWAB (lossy)", ""}, {0, NULL, 0, NULL, NULL} }; #endif @@ -125,6 +134,7 @@ EnumPropertyItem proportional_falloff_curve_only_items[] = { {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"}, {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"}, {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"}, + {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "Inverse Square falloff"}, {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"}, {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"}, {0, NULL, 0, NULL, NULL} @@ -210,13 +220,13 @@ EnumPropertyItem snap_uv_element_items[] = { #endif #ifdef WITH_OPENEXR -# define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \ +# define R_IMF_ENUM_EXR_MULTILAYER {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \ "OpenEXR MultiLayer", \ "Output image in multilayer OpenEXR format"}, # define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \ "Output image in OpenEXR format"}, #else -# define R_IMF_ENUM_EXR_MULTI +# define R_IMF_ENUM_EXR_MULTILAYER # define R_IMF_ENUM_EXR #endif @@ -245,7 +255,7 @@ EnumPropertyItem snap_uv_element_items[] = { {0, "", 0, " ", NULL}, \ R_IMF_ENUM_CINEON \ R_IMF_ENUM_DPX \ - R_IMF_ENUM_EXR_MULTI \ + R_IMF_ENUM_EXR_MULTILAYER \ R_IMF_ENUM_EXR \ R_IMF_ENUM_HDR \ R_IMF_ENUM_TIFF \ @@ -329,6 +339,62 @@ EnumPropertyItem bake_save_mode_items[] = { {0, NULL, 0, NULL, NULL} }; +#define R_IMF_VIEWS_ENUM_IND {R_IMF_VIEWS_INDIVIDUAL, "INDIVIDUAL", 0, "Individual", \ + "Individual files for each view with the prefix as defined by the scene views"}, +#define R_IMF_VIEWS_ENUM_S3D {R_IMF_VIEWS_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", \ + "Single file with an encoded stereo pair"}, +#define R_IMF_VIEWS_ENUM_MV {R_IMF_VIEWS_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", "Single file with all the views"}, + +EnumPropertyItem views_format_items[] = { + R_IMF_VIEWS_ENUM_IND + R_IMF_VIEWS_ENUM_S3D + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem views_format_multilayer_items[] = { + R_IMF_VIEWS_ENUM_IND + R_IMF_VIEWS_ENUM_MV + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem views_format_multiview_items[] = { + R_IMF_VIEWS_ENUM_IND + R_IMF_VIEWS_ENUM_S3D + R_IMF_VIEWS_ENUM_MV + {0, NULL, 0, NULL, NULL} +}; + +#undef R_IMF_VIEWS_ENUM_IND +#undef R_IMF_VIEWS_ENUM_S3D +#undef R_IMF_VIEWS_ENUM_MV + +EnumPropertyItem stereo3d_display_items[] = { + {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", + "Render views for left and right eyes as two differently filtered colors in a single image " + "(anaglyph glasses are required)"}, + {S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace", + "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"}, + {S3D_DISPLAY_PAGEFLIP, "TIMESEQUENTIAL", 0, "Time Sequential", + "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is required)"}, + {S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"}, + {S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem stereo3d_anaglyph_type_items[] = { + {S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""}, + {S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""}, + {S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem stereo3d_interlace_type_items[] = { + {S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""}, + {S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""}, + {S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include "DNA_anim_types.h" @@ -533,13 +599,13 @@ static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - sound_update_fps(scene); + BKE_sound_update_fps(scene); BKE_sequencer_update_sound_bounds_all(scene); } static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - sound_update_scene_listener(scene); + BKE_sound_update_scene_listener(scene); } static void rna_Scene_volume_set(PointerRNA *ptr, float value) @@ -548,7 +614,7 @@ static void rna_Scene_volume_set(PointerRNA *ptr, float value) scene->audio.volume = value; if (scene->sound_scene) - sound_set_scene_volume(scene, value); + BKE_sound_set_scene_volume(scene, value); } static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) @@ -649,7 +715,7 @@ static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value) static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; - sound_seek_scene(bmain, scene); + BKE_sound_seek_scene(bmain, scene); } static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr) @@ -716,6 +782,26 @@ static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter) iter->valid = (internal->link != NULL); } +static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter, void *UNUSED(data)) +{ + ListBaseIterator *internal = &iter->internal.listbase; + SceneRenderView *srv = (SceneRenderView *)internal->link; + + if ((STREQ(srv->name, STEREO_LEFT_NAME)) || + (STREQ(srv->name, STEREO_RIGHT_NAME))) + { + return 0; + } + + return 1; +}; + +static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + RenderData *rd = (RenderData *)ptr->data; + rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip); +} + static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("render"); @@ -818,8 +904,8 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ID *id = ptr->id.data; if (id && GS(id->name) == ID_SCE) { @@ -830,8 +916,8 @@ static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNU } } -static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; ID *id = ptr->id.data; @@ -875,8 +961,8 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUS } } -static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; @@ -938,6 +1024,54 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNU } } +static EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +{ + ImageFormatData *imf = (ImageFormatData *)ptr->data; + + if (imf == NULL) { + return views_format_items; + } + else if (imf->imtype == R_IMF_IMTYPE_OPENEXR) { + return views_format_multiview_items; + } + else if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) { + return views_format_multilayer_items; + } + else { + return views_format_items; + } +} + +#ifdef WITH_OPENEXR + /* OpenEXR */ + +static EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +{ + ImageFormatData *imf = (ImageFormatData *)ptr->data; + + EnumPropertyItem *item = NULL; + int i = 1, totitem = 0; + + if (imf->depth == 16) + return exr_codec_items; /* All compression types are defined for halfs */ + + for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) { + if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) { + continue; /* B44 and B44A are not defined for 32 bit floats */ + } + + RNA_enum_item_add(&item, &totitem, &exr_codec_items[i]); + } + + RNA_enum_item_end(&item, &totitem); + *r_free = true; + + return item; +} + +#endif static int rna_SceneRender_file_ext_length(PointerRNA *ptr) { RenderData *rd = (RenderData *)ptr->data; @@ -969,8 +1103,8 @@ static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, in settings->codecType = quicktime_videocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -1007,8 +1141,8 @@ static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *pt settings->audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -1068,8 +1202,8 @@ static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value rd->actlay = min_ff(value, num_layers - 1); } -static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max, - int *UNUSED(softmin), int *UNUSED(softmax)) +static void rna_RenderSettings_active_layer_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) { RenderData *rd = (RenderData *)ptr->data; @@ -1104,8 +1238,8 @@ static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), con return srl; } -static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, - PointerRNA *srl_ptr) +static void rna_RenderLayer_remove( + ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, PointerRNA *srl_ptr) { SceneRenderLayer *srl = srl_ptr->data; Scene *scene = (Scene *)id; @@ -1122,6 +1256,70 @@ static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); } +static int rna_RenderSettings_active_view_index_get(PointerRNA *ptr) +{ + RenderData *rd = (RenderData *)ptr->data; + return rd->actview; +} + +static void rna_RenderSettings_active_view_index_set(PointerRNA *ptr, int value) +{ + RenderData *rd = (RenderData *)ptr->data; + rd->actview = value; +} + +static void rna_RenderSettings_active_view_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) +{ + RenderData *rd = (RenderData *)ptr->data; + + *min = 0; + *max = max_ii(0, BLI_listbase_count(&rd->views) - 1); +} + +static PointerRNA rna_RenderSettings_active_view_get(PointerRNA *ptr) +{ + RenderData *rd = (RenderData *)ptr->data; + SceneRenderView *srv = BLI_findlink(&rd->views, rd->actview); + + return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderView, srv); +} + +static void rna_RenderSettings_active_view_set(PointerRNA *ptr, PointerRNA value) +{ + RenderData *rd = (RenderData *)ptr->data; + SceneRenderView *srv = (SceneRenderView *)value.data; + const int index = BLI_findindex(&rd->views, srv); + if (index != -1) rd->actview = index; +} + +static SceneRenderView *rna_RenderView_new(ID *id, RenderData *UNUSED(rd), const char *name) +{ + Scene *scene = (Scene *)id; + SceneRenderView *srv = BKE_scene_add_render_view(scene, name); + + WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); + + return srv; +} + +static void rna_RenderView_remove( + ID *id, RenderData *UNUSED(rd), Main *UNUSED(bmain), ReportList *reports, PointerRNA *srv_ptr) +{ + SceneRenderView *srv = srv_ptr->data; + Scene *scene = (Scene *)id; + + if (!BKE_scene_remove_render_view(scene, srv)) { + BKE_reportf(reports, RPT_ERROR, "Render view '%s' could not be removed from scene '%s'", + srv->name, scene->id.name + 2); + return; + } + + RNA_POINTER_INVALIDATE(srv_ptr); + + WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); +} + static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) { RenderData *rd = (RenderData *)ptr->data; @@ -1131,8 +1329,8 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); } -static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static EnumPropertyItem *rna_RenderSettings_engine_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { RenderEngineType *type; EnumPropertyItem *item = NULL; @@ -1215,7 +1413,7 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) } /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename(NULL, "render.layers", oldname, rl->name); + BKE_animdata_fix_paths_rename_all(NULL, "render.layers", oldname, rl->name); } static char *rna_SceneRenderLayer_path(PointerRNA *ptr) @@ -1227,6 +1425,34 @@ static char *rna_SceneRenderLayer_path(PointerRNA *ptr) return BLI_sprintfN("render.layers[\"%s\"]", name_esc); } +static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value) +{ + Scene *scene = (Scene *)ptr->id.data; + SceneRenderView *rv = (SceneRenderView *)ptr->data; + BLI_strncpy_utf8(rv->name, value, sizeof(rv->name)); + BLI_uniquename(&scene->r.views, rv, DATA_("RenderView"), '.', offsetof(SceneRenderView, name), sizeof(rv->name)); +} + +static char *rna_SceneRenderView_path(PointerRNA *ptr) +{ + SceneRenderView *srv = (SceneRenderView *)ptr->data; + return BLI_sprintfN("render.views[\"%s\"]", srv->name); +} + +static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value) +{ + RenderData *rd = (RenderData *)ptr->data; + + if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && + value == SCE_VIEWS_FORMAT_STEREO_3D) + { + /* make sure the actview is visible */ + if (rd->actview > 1) rd->actview = 1; + } + + rd->views_format = value; +} + static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) { return (BLI_listbase_count(&R_engines) > 1); @@ -1388,7 +1614,7 @@ static void rna_Scene_use_audio_set(PointerRNA *ptr, int value) else scene->audio.flag &= ~AUDIO_MUTE; - sound_mute_scene(scene, value); + BKE_sound_mute_scene(scene, value); } static int rna_Scene_sync_mode_get(PointerRNA *ptr) @@ -1602,10 +1828,11 @@ static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value lineset->linestyle->id.us++; } -static FreestyleLineSet *rna_FreestyleSettings_lineset_add(ID *id, FreestyleSettings *config, const char *name) +static FreestyleLineSet *rna_FreestyleSettings_lineset_add( + ID *id, FreestyleSettings *config, Main *bmain, const char *name) { Scene *scene = (Scene *)id; - FreestyleLineSet *lineset = BKE_freestyle_lineset_add((FreestyleConfig *)config, name); + FreestyleLineSet *lineset = BKE_freestyle_lineset_add(bmain, (FreestyleConfig *)config, name); DAG_id_tag_update(&scene->id, 0); WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); @@ -1613,8 +1840,8 @@ static FreestyleLineSet *rna_FreestyleSettings_lineset_add(ID *id, FreestyleSett return lineset; } -static void rna_FreestyleSettings_lineset_remove(ID *id, FreestyleSettings *config, ReportList *reports, - PointerRNA *lineset_ptr) +static void rna_FreestyleSettings_lineset_remove( + ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *lineset_ptr) { FreestyleLineSet *lineset = lineset_ptr->data; Scene *scene = (Scene *)id; @@ -1637,8 +1864,8 @@ static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset); } -static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, int *min, int *max, - int *UNUSED(softmin), int *UNUSED(softmax)) +static void rna_FreestyleSettings_active_lineset_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; @@ -1669,8 +1896,8 @@ static FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, Freestyle return module; } -static void rna_FreestyleSettings_module_remove(ID *id, FreestyleSettings *config, ReportList *reports, - PointerRNA *module_ptr) +static void rna_FreestyleSettings_module_remove( + ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *module_ptr) { Scene *scene = (Scene *)id; FreestyleModuleConfig *module = module_ptr->data; @@ -1679,7 +1906,7 @@ static void rna_FreestyleSettings_module_remove(ID *id, FreestyleSettings *confi if (module->script) BKE_reportf(reports, RPT_ERROR, "Style module '%s' could not be removed", module->script->id.name + 2); else - BKE_reportf(reports, RPT_ERROR, "Style module could not be removed"); + BKE_report(reports, RPT_ERROR, "Style module could not be removed"); return; } @@ -1711,6 +1938,44 @@ static void rna_GPUFXSettings_fx_update(Main *UNUSED(bmain), Scene *UNUSED(scene BKE_screen_gpu_fx_validate(fx_settings); } +static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value) +{ + GPUDOFSettings *dofsettings = (GPUDOFSettings *)ptr->data; + + if (value < 3 && dofsettings->num_blades > 2) + dofsettings->num_blades = 0; + else if (value > 0 && dofsettings->num_blades == 0) + dofsettings->num_blades = 3; + else + dofsettings->num_blades = value; +} + +static void rna_Stereo3dFormat_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + ID *id = ptr->id.data; + + if (id && GS(id->name) == ID_IM) { + Image *ima = (Image *)id; + ImBuf *ibuf; + void *lock; + + if ((ima->flag & IMA_IS_STEREO) == 0) + return; + + ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + + if (ibuf) { + BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE); + } + BKE_image_release_ibuf(ima, ibuf, lock); + } +} + +static int rna_gpu_is_hq_supported_get(PointerRNA *UNUSED(ptr)) +{ + return GPU_instanced_drawing_support() && GPU_geometry_shader_support(); +} + #else static void rna_def_transform_orientation(BlenderRNA *brna) @@ -1796,9 +2061,11 @@ static void rna_def_tool_settings(BlenderRNA *brna) static EnumPropertyItem gpencil_source_3d_items[] = { {GP_TOOL_SOURCE_SCENE, "SCENE", 0, "Scene", - "Grease Pencil data attached to the current scene is used, unless the active object already has Grease Pencil data (i.e. for old files)"}, + "Grease Pencil data attached to the current scene is used, " + "unless the active object already has Grease Pencil data (i.e. for old files)"}, {GP_TOOL_SOURCE_OBJECT, "OBJECT", 0, "Object", - "Grease Pencil datablocks attached to the active object are used (required using pre 2.73 add-ons, e.g. BSurfaces)"}, + "Grease Pencil datablocks attached to the active object are used " + "(required using pre 2.73 add-ons, e.g. BSurfaces)"}, {0, NULL, 0, NULL, NULL} }; @@ -1856,6 +2123,10 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "particle"); RNA_def_property_ui_text(prop, "Particle Edit", ""); + prop = RNA_def_property(srna, "hair_edit", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "hair_edit"); + RNA_def_property_ui_text(prop, "Hair Edit", ""); + prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1); RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting"); @@ -1906,6 +2177,22 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + prop = RNA_def_property(srna, "use_proportional_action", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "proportional_action", 0); + RNA_def_property_ui_text(prop, "Proportional Editing Actions", "Proportional editing in action editor"); + RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + + prop = RNA_def_property(srna, "use_proportional_fcurve", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "proportional_fcurve", 0); + RNA_def_property_ui_text(prop, "Proportional Editing FCurves", "Proportional editing in FCurve editor"); + RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + + prop = RNA_def_property(srna, "lock_markers", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "lock_markers", 0); + RNA_def_property_ui_text(prop, "Lock Markers", "Prevent marker editing"); + prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "prop_mode"); RNA_def_property_enum_items(prop, proportional_falloff_items); @@ -2086,7 +2373,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME); - RNA_def_property_ui_text(prop, "Autoname Bones", "Automatically generate values to replace &N and &S suffix placeholders in template names"); + RNA_def_property_ui_text(prop, "Autoname Bones", + "Automatically generate values to replace &N and &S suffix placeholders in template names"); prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "skgen_num_string"); @@ -2813,7 +3101,7 @@ static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "new", "rna_FreestyleSettings_lineset_add"); RNA_def_function_ui_description(func, "Add a line set to scene render layer Freestyle settings"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID); parm = RNA_def_string(func, "name", "LineSet", 0, "", "New name for the line set (not unique)"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Newly created line set"); @@ -2974,12 +3262,14 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); RNA_def_property_enum_items(prop, face_mark_condition_items); - RNA_def_property_ui_text(prop, "Face Mark Condition", "Specify a feature edge selection condition based on face marks"); + RNA_def_property_ui_text(prop, "Face Mark Condition", + "Specify a feature edge selection condition based on face marks"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE); - RNA_def_property_ui_text(prop, "Silhouette", "Select silhouettes (edges at the boundary of visible and hidden faces)"); + RNA_def_property_ui_text(prop, "Silhouette", + "Select silhouettes (edges at the boundary of visible and hidden faces)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE); @@ -2989,12 +3279,14 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE); - RNA_def_property_ui_text(prop, "Crease", "Select crease edges (those between two faces making an angle smaller than the Crease Angle)"); + RNA_def_property_ui_text(prop, "Crease", + "Select crease edges (those between two faces making an angle smaller than the Crease Angle)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY); - RNA_def_property_ui_text(prop, "Ridge & Valley", "Select ridges and valleys (boundary lines between convex and concave areas of surface)"); + RNA_def_property_ui_text(prop, "Ridge & Valley", + "Select ridges and valleys (boundary lines between convex and concave areas of surface)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE); @@ -3014,7 +3306,8 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR); - RNA_def_property_ui_text(prop, "External Contour", "Select external contours (outer silhouettes of occluding and occluded objects)"); + RNA_def_property_ui_text(prop, "External Contour", + "Select external contours (outer silhouettes of occluding and occluded objects)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); prop = RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE); @@ -3163,7 +3456,8 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_view_map_cache", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_VIEW_MAP_CACHE); - RNA_def_property_ui_text(prop, "View Map Cache", "Keep the computed view map and avoid re-calculating it if mesh geometry is unchanged"); + RNA_def_property_ui_text(prop, "View Map Cache", + "Keep the computed view map and avoid re-calculating it if mesh geometry is unchanged"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_view_map_cache_update"); prop = RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE); @@ -3204,36 +3498,42 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "cellsize"); RNA_def_property_ui_range(prop, 0.1, 1, 1, 2); + RNA_def_property_float_default(prop, 0.3f); RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "cellheight"); RNA_def_property_ui_range(prop, 0.1, 1, 1, 2); + RNA_def_property_float_default(prop, 0.2f); RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentheight"); RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); + RNA_def_property_float_default(prop, 2.0f); RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentradius"); RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); + RNA_def_property_float_default(prop, 0.6f); RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb"); RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); + RNA_def_property_float_default(prop, 0.9f); RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "agentmaxslope"); RNA_def_property_range(prop, 0, M_PI_2); + RNA_def_property_float_default(prop, M_PI_4); RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3241,42 +3541,49 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionminsize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); + RNA_def_property_float_default(prop, 8.0f); RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionmergesize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); + RNA_def_property_float_default(prop, 20.0f); RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "edgemaxlen"); RNA_def_property_ui_range(prop, 0, 50, 1, 2); + RNA_def_property_float_default(prop, 12.0f); RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "edgemaxerror"); RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2); + RNA_def_property_float_default(prop, 1.3f); RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vertsperpoly"); RNA_def_property_ui_range(prop, 3, 12, 1, -1); + RNA_def_property_int_default(prop, 6); RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "detailsampledist"); RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2); + RNA_def_property_float_default(prop, 6.0f); RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror"); RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error"); RNA_def_property_update(prop, NC_SCENE, NULL); } @@ -3488,12 +3795,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "xplay"); RNA_def_property_range(prop, 4, 10000); + RNA_def_property_int_default(prop, 640); RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "yplay"); RNA_def_property_range(prop, 4, 10000); + RNA_def_property_int_default(prop, 480); RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3510,12 +3819,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "depth"); RNA_def_property_range(prop, 8, 32); + RNA_def_property_int_default(prop, 32); RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "exitkey"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_enum_default(prop, ESCKEY); RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL); RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3530,6 +3841,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "freqplay"); RNA_def_property_range(prop, 4, 2000); + RNA_def_property_int_default(prop, 60); RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3567,12 +3879,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "stereomode"); RNA_def_property_enum_items(prop, stereo_modes_items); + RNA_def_property_enum_default(prop, STEREO_ANAGLYPH); RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "eyeseparation"); RNA_def_property_range(prop, 0.01, 5.0); + RNA_def_property_float_default(prop, 0.1f); RNA_def_property_ui_text(prop, "Eye Separation", "Set the distance between the eyes - the camera focal distance/30 should be fine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3587,18 +3901,21 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "dome_tessellation", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dome.res"); RNA_def_property_ui_range(prop, 1, 8, 1, 1); + RNA_def_property_int_default(prop, 4); RNA_def_property_ui_text(prop, "Tessellation", "Tessellation level - check the generated mesh in wireframe mode"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dome.resbuf"); RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 2); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed"); RNA_def_property_update(prop, NC_SCENE, NULL); prop = RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dome.angle"); RNA_def_property_ui_range(prop, 90, 250, 1, 1); + RNA_def_property_int_default(prop, 180); RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3619,6 +3936,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "physicsEngine"); RNA_def_property_enum_items(prop, physics_engine_items); + RNA_def_property_enum_default(prop, WOPHY_BULLET); RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3626,6 +3944,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "gravity"); RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2); RNA_def_property_range(prop, 0.0, 10000.0); + RNA_def_property_float_default(prop, 9.8f); RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3633,6 +3952,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); + RNA_def_property_int_default(prop, 128); RNA_def_property_ui_text(prop, "Occlusion Resolution", "Size of the occlusion buffer, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3641,6 +3961,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "ticrate"); RNA_def_property_ui_range(prop, 1, 60, 1, 1); RNA_def_property_range(prop, 1, 10000); + RNA_def_property_int_default(prop, 60); RNA_def_property_ui_text(prop, "Frames Per Second", "Nominal number of game frames per second " "(physics fixed timestep = 1/fps, independently of actual frame rate)"); @@ -3650,6 +3971,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); RNA_def_property_range(prop, 1, 10000); RNA_def_property_ui_range(prop, 1, 50, 1, 1); + RNA_def_property_int_default(prop, 5); RNA_def_property_ui_text(prop, "Max Logic Steps", "Maximum number of logic frame per game frame if graphics slows down the game, " "higher value allows better synchronization with physics"); @@ -3659,6 +3981,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "maxphystep"); RNA_def_property_range(prop, 1, 10000); RNA_def_property_ui_range(prop, 1, 50, 1, 1); + RNA_def_property_int_default(prop, 5); RNA_def_property_ui_text(prop, "Max Physics Steps", "Maximum number of physics step per game frame if graphics slows down the game, " "higher value allows physics to keep up with realtime"); @@ -3668,6 +3991,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "physubstep"); RNA_def_property_range(prop, 1, 50); RNA_def_property_ui_range(prop, 1, 5, 1, 1); + RNA_def_property_int_default(prop, 1); RNA_def_property_ui_text(prop, "Physics Sub Steps", "Number of simulation substep per physic timestep, " "higher value give better physics precision"); @@ -3677,6 +4001,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "lineardeactthreshold"); RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3); RNA_def_property_range(prop, 0.001, 10000.0); + RNA_def_property_float_default(prop, 0.8f); RNA_def_property_ui_text(prop, "Deactivation Linear Threshold", "Linear velocity that an object must be below before the deactivation timer can start"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3685,6 +4010,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "angulardeactthreshold"); RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3); RNA_def_property_range(prop, 0.001, 10000.0); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Deactivation Angular Threshold", "Angular velocity that an object must be below before the deactivation timer can start"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3828,6 +4154,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "level_height", PROP_FLOAT, PROP_ACCELERATION); RNA_def_property_float_sdna(prop, NULL, "levelHeight"); RNA_def_property_range(prop, 0.0f, 200.0f); + RNA_def_property_float_default(prop, 2.0f); RNA_def_property_ui_text(prop, "Level height", "Max difference in heights of obstacles to enable their interaction"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -3845,6 +4172,21 @@ static void rna_def_scene_game_data(BlenderRNA *brna) /* Nestled Data */ rna_def_scene_game_recast_data(brna); + + /* LoD */ + prop = RNA_def_property(srna, "use_scene_hysteresis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "lodflag", SCE_LOD_USE_HYST); + RNA_def_property_ui_text(prop, "Hysteresis", "Use LoD Hysteresis setting for the scene"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop = RNA_def_property(srna, "scene_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE); + RNA_def_property_int_sdna(prop, NULL, "scehysteresis"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_range(prop, 0, 100, 10, 1); + RNA_def_property_int_default(prop, 10); + RNA_def_property_ui_text(prop, "Hysteresis %", + "Minimum distance change required to transition to the previous level of detail"); + RNA_def_property_update(prop, NC_SCENE, NULL); } static void rna_def_gpu_dof_fx(BlenderRNA *brna) @@ -3876,10 +4218,28 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "fstop", PROP_FLOAT, PROP_NONE); - RNA_def_property_ui_text(prop, "Viewport F-stop", "F-stop for dof effect"); + RNA_def_property_ui_text(prop, "F-stop", "F-stop for dof effect"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.1f, 128.0f, 10, 1); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "blades", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "num_blades"); + RNA_def_property_ui_text(prop, "Blades", "Blades for dof effect"); + RNA_def_property_range(prop, 0, 16); + RNA_def_property_int_funcs(prop, NULL, "rna_GPUDOFSettings_blades_set", NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "use_high_quality", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "high_quality", 1); + RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "is_hq_supported", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_gpu_is_hq_supported_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); } static void rna_def_gpu_ssao_fx(BlenderRNA *brna) @@ -3939,7 +4299,8 @@ static void rna_def_gpu_fx(BlenderRNA *brna) prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_DOF); - RNA_def_property_ui_text(prop, "Depth Of Field", "Use depth of field on viewport using the values from active camera"); + RNA_def_property_ui_text(prop, "Depth Of Field", + "Use depth of field on viewport using the values from active camera"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUFXSettings_fx_update"); @@ -4023,6 +4384,138 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); } +/* Render Views - MultiView */ +static void rna_def_scene_render_view(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SceneRenderView", NULL); + RNA_def_struct_ui_text(srna, "Scene Render View", "Render viewpoint for 3D stereo and multiview rendering"); + RNA_def_struct_ui_icon(srna, ICON_RESTRICT_RENDER_OFF); + RNA_def_struct_path_func(srna, "rna_SceneRenderView_path"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderView_name_set"); + RNA_def_property_ui_text(prop, "Name", "Render view name"); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "file_suffix", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "suffix"); + RNA_def_property_ui_text(prop, "File Suffix", "Suffix added to the render images for this view"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "camera_suffix", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "suffix"); + RNA_def_property_ui_text(prop, "Camera Suffix", + "Suffix to identify the cameras to use, and added to the render images for this view"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "viewflag", SCE_VIEW_DISABLE); + RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render view"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); +} + +static void rna_def_render_views(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "RenderViews"); + srna = RNA_def_struct(brna, "RenderViews", NULL); + RNA_def_struct_sdna(srna, "RenderData"); + RNA_def_struct_ui_text(srna, "Render Views", "Collection of render views"); + + prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "actview"); + RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_view_index_get", + "rna_RenderSettings_active_view_index_set", + "rna_RenderSettings_active_view_index_range"); + RNA_def_property_ui_text(prop, "Active View Index", "Active index in render view array"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "SceneRenderView"); + RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_view_get", + "rna_RenderSettings_active_view_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_ui_text(prop, "Active Render View", "Active Render View"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + func = RNA_def_function(srna, "new", "rna_RenderView_new"); + RNA_def_function_ui_description(func, "Add a render view to scene"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + parm = RNA_def_string(func, "name", "RenderView", 0, "", "New name for the marker (not unique)"); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "result", "SceneRenderView", "", "Newly created render view"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_RenderView_remove"); + RNA_def_function_ui_description(func, "Remove a render view"); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID); + parm = RNA_def_pointer(func, "view", "SceneRenderView", "", "Render view to remove"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); +} + +static void rna_def_image_format_stereo3d_format(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem stereo3d_display_items[] = { + {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", + "Render views for left and right eyes as two differently filtered colors in a single image " + "(anaglyph glasses are required)"}, + {S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace", + "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"}, + {S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"}, + {S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "Stereo3dFormat", NULL); + RNA_def_struct_sdna(srna, "Stereo3dFormat"); + RNA_def_struct_clear_flag(srna, STRUCT_UNDO); + RNA_def_struct_ui_text(srna, "Stereo Output", "Settings for stereo output"); + + prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "display_mode"); + RNA_def_property_enum_items(prop, stereo3d_display_items); + RNA_def_property_ui_text(prop, "Stereo Mode", ""); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, stereo3d_anaglyph_type_items); + RNA_def_property_ui_text(prop, "Anaglyph Type", ""); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, stereo3d_interlace_type_items); + RNA_def_property_ui_text(prop, "Interlace Type", ""); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP); + RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED); + RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); + + prop = RNA_def_property(srna, "use_squeezed_frame", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SQUEEZED_FRAME); + RNA_def_property_ui_text(prop, "Squeezed Frame", "Combine both views in a squeezed image"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update"); +} + /* use for render output and image save operator, * note: there are some cases where the members act differently when this is * used from a scene, video formats can only be selected for render output @@ -4042,6 +4535,8 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + rna_def_image_format_stereo3d_format(brna); + srna = RNA_def_struct(brna, "ImageFormatSettings", NULL); RNA_def_struct_sdna(srna, "ImageFormatData"); RNA_def_struct_nested(brna, srna, "Scene"); @@ -4107,9 +4602,9 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "exr_codec"); RNA_def_property_enum_items(prop, exr_codec_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_exr_codec_itemf"); RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - #endif #ifdef WITH_OPENJPEG @@ -4161,6 +4656,20 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "G", "Log conversion gamma"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + /* multiview */ + prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "views_format"); + RNA_def_property_enum_items(prop, views_format_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_views_format_itemf"); + RNA_def_property_ui_text(prop, "Views Format", "Format of multiview media"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format"); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "Stereo3dFormat"); + RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d"); + /* color management */ prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "view_settings"); @@ -4563,6 +5072,16 @@ static void rna_def_scene_render_data(BlenderRNA *brna) "resolution to 480 pixels"}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem views_format_items[] = { + {SCE_VIEWS_FORMAT_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", + "Single stereo camera system, adjust the stereo settings in the camera panel"}, + {SCE_VIEWS_FORMAT_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", + "Multi camera system, adjust the cameras individually"}, + {0, NULL, 0, NULL, NULL} + }; + + + rna_def_scene_ffmpeg_settings(brna); #ifdef WITH_QUICKTIME rna_def_scene_quicktime_settings(brna); @@ -5245,6 +5764,32 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + /* views (stereoscopy et al) */ + prop = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "SceneRenderView"); + RNA_def_property_ui_text(prop, "Render Views", ""); + rna_def_render_views(brna, prop); + + prop = RNA_def_property(srna, "stereo_views", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "views", NULL); + RNA_def_property_collection_funcs(prop, "rna_RenderSettings_stereoViews_begin", "rna_iterator_listbase_next", + "rna_iterator_listbase_end", "rna_iterator_listbase_get", + NULL, NULL, NULL, NULL); + RNA_def_property_struct_type(prop, "SceneRenderView"); + RNA_def_property_ui_text(prop, "Render Views", ""); + + prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_MULTIVIEW); + RNA_def_property_ui_text(prop, "Multiple Views", "Use multiple views in the scene"); + RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, views_format_items); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Setup Stereo Mode", ""); + RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_views_format_set", NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + /* engine */ prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, engine_items); @@ -5286,6 +5831,17 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage"); RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + prop = RNA_def_property(srna, "simplify_subdivision_render", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf_render"); + RNA_def_property_ui_range(prop, 0, 6, 1, -1); + RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level during rendering"); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + + prop = RNA_def_property(srna, "simplify_child_particles_render", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "simplify_particles_render"); + RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage during rendering"); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + prop = RNA_def_property(srna, "simplify_shadow_samples", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "simplify_shadowsamples"); RNA_def_property_ui_range(prop, 1, 16, 1, -1); @@ -5979,6 +6535,11 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ColorManagedSequencerColorspaceSettings"); RNA_def_property_ui_text(prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in"); + /* Dependency Graph */ + prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Depsgraph"); + RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data"); + /* Nestled Data */ /* *** Non-Animated *** */ RNA_define_animate_sdna(false); @@ -5995,8 +6556,8 @@ void RNA_def_scene(BlenderRNA *brna) /* *** Animated *** */ rna_def_scene_render_data(brna); rna_def_scene_render_layer(brna); - rna_def_gpu_fx(brna); + rna_def_scene_render_view(brna); /* Scene API */ RNA_api_scene(srna); |