Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_scene.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 918 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | ||||
| { | { | ||||
| Scene *scene = (Scene *)ptr->owner_id; | Scene *scene = (Scene *)ptr->owner_id; | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME | ID_RECALC_SEQUENCER_STRIPS); | DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME | ID_RECALC_SEQUENCER_STRIPS); | ||||
| } | } | ||||
| static const char *rna_Scene_statistics_string_get(Scene *UNUSED(scene), | |||||
| Main *bmain, | |||||
| bContext *C, | |||||
| ViewLayer *view_layer) | |||||
| { | |||||
| const char statistics_status_bar_flag = STATUSBAR_SHOW_STATS | STATUSBAR_SHOW_MEMORY | | |||||
| STATUSBAR_SHOW_VERSION; | |||||
| return ED_info_statistics_string( | |||||
| bmain, CTX_wm_screen(C), CTX_data_scene(C), view_layer, statistics_status_bar_flag); | |||||
Severin: If the view layer is an input argument, you can't just assume that it's from the context's… | |||||
| } | |||||
| static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) | static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images; | scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images; | ||||
| } | } | ||||
| static void rna_Scene_frame_current_set(PointerRNA *ptr, int value) | static void rna_Scene_frame_current_set(PointerRNA *ptr, int value) | ||||
| { | { | ||||
| Scene *data = (Scene *)ptr->data; | Scene *data = (Scene *)ptr->data; | ||||
| ▲ Show 20 Lines • Show All 6,337 Lines • ▼ Show 20 Lines | static void rna_def_scene_gpencil(BlenderRNA *brna) | ||||
| RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); | ||||
| } | } | ||||
| void RNA_def_scene(BlenderRNA *brna) | void RNA_def_scene(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | |||||
| PropertyRNA *parm; | |||||
| static const EnumPropertyItem audio_distance_model_items[] = { | static const EnumPropertyItem audio_distance_model_items[] = { | ||||
| {0, "NONE", 0, "None", "No distance attenuation"}, | {0, "NONE", 0, "None", "No distance attenuation"}, | ||||
| {1, "INVERSE", 0, "Inverse", "Inverse distance model"}, | {1, "INVERSE", 0, "Inverse", "Inverse distance model"}, | ||||
| {2, "INVERSE_CLAMPED", 0, "Inverse Clamped", "Inverse distance model with clamping"}, | {2, "INVERSE_CLAMPED", 0, "Inverse Clamped", "Inverse distance model with clamping"}, | ||||
| {3, "LINEAR", 0, "Linear", "Linear distance model"}, | {3, "LINEAR", 0, "Linear", "Linear distance model"}, | ||||
| {4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping"}, | {4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping"}, | ||||
| {5, "EXPONENT", 0, "Exponent", "Exponent distance model"}, | {5, "EXPONENT", 0, "Exponent", "Exponent distance model"}, | ||||
| {6, "EXPONENT_CLAMPED", 0, "Exponent Clamped", "Exponent distance model with clamping"}, | {6, "EXPONENT_CLAMPED", 0, "Exponent Clamped", "Exponent distance model with clamping"}, | ||||
| ▲ Show 20 Lines • Show All 375 Lines • ▼ Show 20 Lines | # endif | ||||
| prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_float_sdna(prop, NULL, "audio.volume"); | RNA_def_property_float_sdna(prop, NULL, "audio.volume"); | ||||
| RNA_def_property_range(prop, 0.0f, 100.0f); | RNA_def_property_range(prop, 0.0f, 100.0f); | ||||
| RNA_def_property_ui_text(prop, "Volume", "Audio volume"); | RNA_def_property_ui_text(prop, "Volume", "Audio volume"); | ||||
| RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); | RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); | ||||
| RNA_def_property_update(prop, NC_SCENE, NULL); | RNA_def_property_update(prop, NC_SCENE, NULL); | ||||
| RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update"); | RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update"); | ||||
| /* Statistics */ | |||||
| func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get"); | |||||
| RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT); | |||||
| parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "View Layer", ""); | |||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | |||||
| parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", ""); | |||||
| RNA_def_function_return(func, parm); | |||||
| /* Grease Pencil */ | /* Grease Pencil */ | ||||
| prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "gpd"); | RNA_def_property_pointer_sdna(prop, NULL, "gpd"); | ||||
| RNA_def_property_struct_type(prop, "GreasePencil"); | RNA_def_property_struct_type(prop, "GreasePencil"); | ||||
| RNA_def_property_pointer_funcs( | RNA_def_property_pointer_funcs( | ||||
| prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll"); | prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll"); | ||||
| RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); | RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); | ||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); | RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); | ||||
| ▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines | |||||
If the view layer is an input argument, you can't just assume that it's from the context's scene. At least it should use the scene it's called the function through (the unused scene arg above). Even better would be if there was proper validation if the scene - view-layer combination is valid.