diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 92 |
1 files changed, 57 insertions, 35 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index b647a823929..cc7df54e648 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -92,11 +92,11 @@ static const EnumPropertyItem uv_sculpt_relaxation_items[] = { }; #endif -const EnumPropertyItem rna_enum_snap_target_items[] = { - {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"}, - {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"}, - {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"}, - {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"}, +const EnumPropertyItem rna_enum_snap_source_items[] = { + {SCE_SNAP_SOURCE_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"}, + {SCE_SNAP_SOURCE_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"}, + {SCE_SNAP_SOURCE_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"}, + {SCE_SNAP_SOURCE_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"}, {0, NULL, 0, NULL, NULL}, }; @@ -345,9 +345,9 @@ const EnumPropertyItem rna_enum_curve_fit_method_items[] = { R_IMF_ENUM_JPEG \ R_IMF_ENUM_JPEG2K \ R_IMF_ENUM_TAGA \ - R_IMF_ENUM_TAGA_RAW{0, "", 0, " ", NULL}, \ - R_IMF_ENUM_CINEON R_IMF_ENUM_DPX R_IMF_ENUM_EXR_MULTILAYER R_IMF_ENUM_EXR R_IMF_ENUM_HDR \ - R_IMF_ENUM_TIFF R_IMF_ENUM_WEBP + R_IMF_ENUM_TAGA_RAW \ + RNA_ENUM_ITEM_SEPR_COLUMN, R_IMF_ENUM_CINEON R_IMF_ENUM_DPX R_IMF_ENUM_EXR_MULTILAYER \ + R_IMF_ENUM_EXR R_IMF_ENUM_HDR R_IMF_ENUM_TIFF R_IMF_ENUM_WEBP #ifdef RNA_RUNTIME static const EnumPropertyItem image_only_type_items[] = { @@ -359,11 +359,11 @@ static const EnumPropertyItem image_only_type_items[] = { #endif const EnumPropertyItem rna_enum_image_type_items[] = { - {0, "", 0, N_("Image"), NULL}, + RNA_ENUM_ITEM_HEADING(N_("Image"), NULL), IMAGE_TYPE_ITEMS_IMAGE_ONLY - {0, "", 0, N_("Movie"), NULL}, + RNA_ENUM_ITEM_HEADING(N_("Movie"), NULL), {R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, @@ -447,8 +447,8 @@ const EnumPropertyItem rna_enum_bake_target_items[] = { {R_BAKE_TARGET_VERTEX_COLORS, "VERTEX_COLORS", 0, - "Color Attributes", - "Bake to active color attribute layer on meshes"}, + "Active Color Attribute", + "Bake to the active color attribute on meshes"}, {0, NULL, 0, NULL, NULL}, }; @@ -1100,12 +1100,12 @@ static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter) iter->valid = (internal->link != NULL); } -static char *rna_SceneEEVEE_path(PointerRNA *UNUSED(ptr)) +static char *rna_SceneEEVEE_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("eevee"); } -static char *rna_SceneGpencil_path(PointerRNA *UNUSED(ptr)) +static char *rna_SceneGpencil_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("grease_pencil_settings"); } @@ -1129,17 +1129,17 @@ static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *ite rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip); } -static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_RenderSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("render"); } -static char *rna_BakeSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_BakeSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("render.bake"); } -static char *rna_ImageFormatSettings_path(PointerRNA *ptr) +static char *rna_ImageFormatSettings_path(const PointerRNA *ptr) { ImageFormatData *imf = (ImageFormatData *)ptr->data; ID *id = ptr->owner_id; @@ -1787,10 +1787,11 @@ void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr) rna_Scene_glsl_update(bmain, activescene, ptr); } -static char *rna_ViewLayerEEVEE_path(PointerRNA *ptr) +static char *rna_ViewLayerEEVEE_path(const PointerRNA *ptr) { - ViewLayerEEVEE *view_layer_eevee = (ViewLayerEEVEE *)ptr->data; - ViewLayer *view_layer = (ViewLayer *)((uint8_t *)view_layer_eevee - offsetof(ViewLayer, eevee)); + const ViewLayerEEVEE *view_layer_eevee = (ViewLayerEEVEE *)ptr->data; + const ViewLayer *view_layer = (ViewLayer *)((uint8_t *)view_layer_eevee - + offsetof(ViewLayer, eevee)); char rna_path[sizeof(view_layer->name) * 3]; const size_t view_layer_path_len = rna_ViewLayer_path_buffer_get( @@ -1801,9 +1802,9 @@ static char *rna_ViewLayerEEVEE_path(PointerRNA *ptr) return BLI_strdup(rna_path); } -static char *rna_SceneRenderView_path(PointerRNA *ptr) +static char *rna_SceneRenderView_path(const PointerRNA *ptr) { - SceneRenderView *srv = (SceneRenderView *)ptr->data; + const SceneRenderView *srv = (SceneRenderView *)ptr->data; char srv_name_esc[sizeof(srv->name) * 2]; BLI_str_escape(srv_name_esc, srv->name, sizeof(srv_name_esc)); return BLI_sprintfN("render.views[\"%s\"]", srv_name_esc); @@ -2071,10 +2072,10 @@ static void rna_View3DCursor_matrix_set(PointerRNA *ptr, const float *values) BKE_scene_cursor_from_mat4(cursor, unit_mat, false); } -static char *rna_TransformOrientationSlot_path(PointerRNA *ptr) +static char *rna_TransformOrientationSlot_path(const PointerRNA *ptr) { - Scene *scene = (Scene *)ptr->owner_id; - TransformOrientationSlot *orientation_slot = ptr->data; + const Scene *scene = (Scene *)ptr->owner_id; + const TransformOrientationSlot *orientation_slot = ptr->data; if (!ELEM(NULL, scene, orientation_slot)) { for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) { @@ -2085,11 +2086,11 @@ static char *rna_TransformOrientationSlot_path(PointerRNA *ptr) } /* Should not happen, but in case, just return default path. */ - BLI_assert(0); + BLI_assert_unreachable(); return BLI_strdup("transform_orientation_slots[0]"); } -static char *rna_View3DCursor_path(PointerRNA *UNUSED(ptr)) +static char *rna_View3DCursor_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("cursor"); } @@ -2188,17 +2189,17 @@ static void rna_UnifiedPaintSettings_radius_update(bContext *C, PointerRNA *ptr) rna_UnifiedPaintSettings_update(C, ptr); } -static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_UnifiedPaintSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.unified_paint_settings"); } -static char *rna_CurvePaintSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_CurvePaintSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.curve_paint_settings"); } -static char *rna_SequencerToolSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_SequencerToolSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.sequencer_tool_settings"); } @@ -2222,7 +2223,7 @@ static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr)) } } -static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr)) +static char *rna_MeshStatVis_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.statvis"); } @@ -2260,7 +2261,7 @@ static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), SEQ_cache_cleanup((Scene *)ptr->owner_id); } -static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_ToolSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings"); } @@ -2701,16 +2702,33 @@ static void rna_UnitSettings_system_update(Main *UNUSED(bmain), } } -static char *rna_UnitSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_UnitSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("unit_settings"); } -static char *rna_FFmpegSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_FFmpegSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("render.ffmpeg"); } +# ifdef WITH_FFMPEG +/* FFMpeg Codec setting update hook. */ +static void rna_FFmpegSettings_codec_update(Main *UNUSED(bmain), + Scene *UNUSED(scene), + PointerRNA *ptr) +{ + FFMpegCodecData *codec_data = (FFMpegCodecData *)ptr->data; + if (!ELEM(codec_data->codec, AV_CODEC_ID_H264, AV_CODEC_ID_MPEG4, AV_CODEC_ID_VP9)) { + /* Constant Rate Factor (CRF) setting is only available for H264, + * MPEG4 and WEBM/VP9 codecs. So changing encoder quality mode to + * CBR as CRF is not supported. + */ + codec_data->constant_rate_factor = FFM_CRF_NONE; + } +} +# endif + #else /* Grease Pencil Interpolation tool settings */ @@ -3305,9 +3323,12 @@ static void rna_def_tool_settings(BlenderRNA *brna) "Absolute grid alignment while translating (based on the pivot center)"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid + * previous ambiguity of "target" (now, "source" is geometry to be moved and "target" is + * geometry to which moved geometry is snapped). */ prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "snap_target"); - RNA_def_property_enum_items(prop, rna_enum_snap_target_items); + RNA_def_property_enum_items(prop, rna_enum_snap_source_items); RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ @@ -5918,6 +5939,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, ffmpeg_codec_items); RNA_def_property_enum_default(prop, AV_CODEC_ID_H264); RNA_def_property_ui_text(prop, "Video Codec", "FFmpeg codec to use for video output"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_update"); prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "video_bitrate"); |