diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 117 |
1 files changed, 84 insertions, 33 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 969d1f2075e..9bbe37b5187 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -88,7 +88,7 @@ const EnumPropertyItem rna_enum_space_type_items[] = { {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""}, /* General. */ - RNA_ENUM_ITEM_HEADING("General", NULL), + RNA_ENUM_ITEM_HEADING(N_("General"), NULL), {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, @@ -108,7 +108,7 @@ const EnumPropertyItem rna_enum_space_type_items[] = { {SPACE_CLIP, "CLIP_EDITOR", ICON_TRACKER, "Movie Clip Editor", "Motion tracking tools"}, /* Animation. */ - RNA_ENUM_ITEM_HEADING("Animation", NULL), + RNA_ENUM_ITEM_HEADING(N_("Animation"), NULL), #if 0 {SPACE_ACTION, "TIMELINE", @@ -125,7 +125,7 @@ const EnumPropertyItem rna_enum_space_type_items[] = { {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "Nonlinear Animation", "Combine and layer Actions"}, /* Scripting. */ - RNA_ENUM_ITEM_HEADING("Scripting", NULL), + RNA_ENUM_ITEM_HEADING(N_("Scripting"), NULL), {SPACE_TEXT, "TEXT_EDITOR", ICON_TEXT, @@ -153,7 +153,7 @@ const EnumPropertyItem rna_enum_space_type_items[] = { "screen for general status information"}, /* Data. */ - RNA_ENUM_ITEM_HEADING("Data", NULL), + RNA_ENUM_ITEM_HEADING(N_("Data"), NULL), {SPACE_OUTLINER, "OUTLINER", ICON_OUTLINER, @@ -435,28 +435,31 @@ static const EnumPropertyItem rna_enum_studio_light_items[] = { }; static const EnumPropertyItem rna_enum_view3dshading_render_pass_type_items[] = { - RNA_ENUM_ITEM_HEADING("General", NULL), + RNA_ENUM_ITEM_HEADING(N_("General"), NULL), {EEVEE_RENDER_PASS_COMBINED, "COMBINED", 0, "Combined", ""}, {EEVEE_RENDER_PASS_EMIT, "EMISSION", 0, "Emission", ""}, {EEVEE_RENDER_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""}, {EEVEE_RENDER_PASS_AO, "AO", 0, "Ambient Occlusion", ""}, {EEVEE_RENDER_PASS_SHADOW, "SHADOW", 0, "Shadow", ""}, - RNA_ENUM_ITEM_HEADING("Light", NULL), + RNA_ENUM_ITEM_HEADING(N_("Light"), NULL), {EEVEE_RENDER_PASS_DIFFUSE_LIGHT, "DIFFUSE_LIGHT", 0, "Diffuse Light", ""}, {EEVEE_RENDER_PASS_DIFFUSE_COLOR, "DIFFUSE_COLOR", 0, "Diffuse Color", ""}, {EEVEE_RENDER_PASS_SPECULAR_LIGHT, "SPECULAR_LIGHT", 0, "Specular Light", ""}, {EEVEE_RENDER_PASS_SPECULAR_COLOR, "SPECULAR_COLOR", 0, "Specular Color", ""}, {EEVEE_RENDER_PASS_VOLUME_LIGHT, "VOLUME_LIGHT", 0, "Volume Light", ""}, - RNA_ENUM_ITEM_HEADING("Effects", NULL), + RNA_ENUM_ITEM_HEADING(N_("Effects"), NULL), {EEVEE_RENDER_PASS_BLOOM, "BLOOM", 0, "Bloom", ""}, - RNA_ENUM_ITEM_HEADING("Data", NULL), + RNA_ENUM_ITEM_HEADING(N_("Data"), NULL), {EEVEE_RENDER_PASS_NORMAL, "NORMAL", 0, "Normal", ""}, {EEVEE_RENDER_PASS_MIST, "MIST", 0, "Mist", ""}, + {EEVEE_RENDER_PASS_CRYPTOMATTE_OBJECT, "CryptoObject", 0, "CryptoObject", ""}, + {EEVEE_RENDER_PASS_CRYPTOMATTE_ASSET, "CryptoAsset", 0, "CryptoAsset", ""}, + {EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL, "CryptoMaterial", 0, "CryptoMaterial", ""}, - RNA_ENUM_ITEM_HEADING("Shader AOV", NULL), + RNA_ENUM_ITEM_HEADING(N_("Shader AOV"), NULL), {EEVEE_RENDER_PASS_AOV, "AOV", 0, "AOV", ""}, {0, NULL, 0, NULL, NULL}, @@ -1100,7 +1103,7 @@ static bool rna_RegionView3D_is_orthographic_side_view_get(PointerRNA *ptr) return RV3D_VIEW_IS_AXIS(rv3d->view); } -static void rna_RegionView3D_is_orthographic_side_view_set(PointerRNA *ptr, int value) +static void rna_RegionView3D_is_orthographic_side_view_set(PointerRNA *ptr, bool value) { RegionView3D *rv3d = (RegionView3D *)(ptr->data); const bool was_axis_view = RV3D_VIEW_IS_AXIS(rv3d->view); @@ -1423,6 +1426,7 @@ static const EnumPropertyItem *rna_3DViewShading_render_pass_itemf(bContext *C, const bool bloom_enabled = scene->eevee.flag & SCE_EEVEE_BLOOM_ENABLED; const bool aov_available = BKE_view_layer_has_valid_aov(view_layer); + const bool eevee_next_active = STREQ(scene->r.engine, "BLENDER_EEVEE_NEXT"); int totitem = 0; EnumPropertyItem *result = NULL; @@ -1443,6 +1447,12 @@ static const EnumPropertyItem *rna_3DViewShading_render_pass_itemf(bContext *C, aov_template.value++; } } + else if (ELEM(item->value, + EEVEE_RENDER_PASS_CRYPTOMATTE_OBJECT, + EEVEE_RENDER_PASS_CRYPTOMATTE_ASSET, + EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL) && + !eevee_next_active) { + } else if (!((!bloom_enabled && (item->value == EEVEE_RENDER_PASS_BLOOM || STREQ(item->name, "Effects"))) || (!aov_available && STREQ(item->name, "Shader AOV")))) { @@ -1519,7 +1529,7 @@ static void rna_SpaceView3D_use_local_collections_update(bContext *C, PointerRNA View3D *v3d = (View3D *)ptr->data; if (ED_view3d_local_collections_set(bmain, v3d)) { - BKE_layer_collection_local_sync(view_layer, v3d); + BKE_layer_collection_local_sync(scene, view_layer, v3d); DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); } } @@ -1609,7 +1619,7 @@ static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerR } } -static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, int value) +static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, bool value) { SpaceImage *sima = (SpaceImage *)(ptr->data); @@ -1663,8 +1673,10 @@ static bool rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr) Object *obedit = NULL; wmWindow *win = ED_screen_window_find(screen, G_MAIN->wm.first); if (win != NULL) { + Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + BKE_view_layer_synced_ensure(scene, view_layer); + obedit = BKE_view_layer_edit_object_get(view_layer); } return ED_space_image_show_uvedit(sima, obedit); } @@ -1676,8 +1688,10 @@ static bool rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr) Object *obedit = NULL; wmWindow *win = ED_screen_window_find(screen, G_MAIN->wm.first); if (win != NULL) { + Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + BKE_view_layer_synced_ensure(scene, view_layer); + obedit = BKE_view_layer_edit_object_get(view_layer); } return ED_space_image_check_show_maskedit(sima, obedit); } @@ -1872,6 +1886,15 @@ static void rna_SpaceUVEditor_tile_grid_shape_set(PointerRNA *ptr, const int *va } } +static void rna_SpaceUVEditor_custom_grid_subdiv_set(PointerRNA *ptr, const int *values) +{ + SpaceImage *data = (SpaceImage *)(ptr->data); + + for (int i = 0; i < 2; i++) { + data->custom_grid_subdiv[i] = CLAMPIS(values[i], 1, 5000); + } +} + /* Space Text Editor */ static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, bool value) @@ -2174,10 +2197,12 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr) { SpaceAction *saction = (SpaceAction *)(ptr->data); + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Main *bmain = CTX_data_main(C); - Object *obact = OBACT(view_layer); + BKE_view_layer_synced_ensure(scene, view_layer); + Object *obact = BKE_view_layer_active_object_get(view_layer); if (obact == NULL) { return; } @@ -2249,8 +2274,10 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr) { SpaceAction *saction = (SpaceAction *)(ptr->data); ScrArea *area = CTX_wm_area(C); + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Object *obact = OBACT(view_layer); + BKE_view_layer_synced_ensure(scene, view_layer); + Object *obact = BKE_view_layer_active_object_get(view_layer); /* special exceptions for ShapeKey Editor mode */ if (saction->mode == SACTCONT_SHAPEKEY) { @@ -3513,10 +3540,10 @@ static void rna_def_space_image_uv(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - static const EnumPropertyItem pixel_snap_mode_items[] = { - {SI_PIXEL_SNAP_DISABLED, "DISABLED", 0, "Disabled", "Don't snap to pixels"}, - {SI_PIXEL_SNAP_CORNER, "CORNER", 0, "Corner", "Snap to pixel corners"}, - {SI_PIXEL_SNAP_CENTER, "CENTER", 0, "Center", "Snap to pixel centers"}, + static const EnumPropertyItem pixel_round_mode_items[] = { + {SI_PIXEL_ROUND_DISABLED, "DISABLED", 0, "Disabled", "Don't round to pixels"}, + {SI_PIXEL_ROUND_CORNER, "CORNER", 0, "Corner", "Round to pixel corners"}, + {SI_PIXEL_ROUND_CENTER, "CENTER", 0, "Center", "Round to pixel centers"}, {0, NULL, 0, NULL, NULL}, }; @@ -3546,6 +3573,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch"); RNA_def_property_enum_items(prop, dt_uvstretch_items); RNA_def_property_ui_text(prop, "Display Stretch Type", "Type of stretch to display"); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MESH); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE); @@ -3586,15 +3614,24 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop, "Tile Grid Shape", "How many tiles will be shown in the background"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); + prop = RNA_def_property(srna, "show_grid_over_image", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_GRID_OVER_IMAGE); + RNA_def_property_boolean_default(prop, true); + RNA_def_property_ui_text(prop, "Grid Over Image", "Show the grid over the image"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); + prop = RNA_def_property(srna, "use_custom_grid", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CUSTOM_GRID); RNA_def_property_boolean_default(prop, true); RNA_def_property_ui_text(prop, "Custom Grid", "Use a grid with a user-defined number of steps"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); - prop = RNA_def_property(srna, "custom_grid_subdivisions", PROP_INT, PROP_NONE); + prop = RNA_def_property(srna, "custom_grid_subdivisions", PROP_INT, PROP_XYZ); RNA_def_property_int_sdna(prop, NULL, "custom_grid_subdiv"); + RNA_def_property_array(prop, 2); + RNA_def_property_int_default(prop, 10); RNA_def_property_range(prop, 1, 5000); + RNA_def_property_int_funcs(prop, NULL, "rna_SpaceUVEditor_custom_grid_subdiv_set", NULL); RNA_def_property_ui_text( prop, "Dynamic Grid Size", "Number of grid units in UV space that make one UV Unit"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); @@ -3605,11 +3642,9 @@ static void rna_def_space_image_uv(BlenderRNA *brna) RNA_def_property_ui_text(prop, "UV Opacity", "Opacity of UV overlays"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); - /* TODO: move edge and face drawing options here from `G.f`. */ - - prop = RNA_def_property(srna, "pixel_snap_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, pixel_snap_mode_items); - RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixels while editing"); + prop = RNA_def_property(srna, "pixel_round_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, pixel_round_mode_items); + RNA_def_property_ui_text(prop, "Round to Pixels", "Round UVs to pixels while editing"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE); @@ -3979,6 +4014,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) prop = RNA_def_property(srna, "cavity_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, cavity_type_items); RNA_def_property_ui_text(prop, "Cavity Type", "Way to display the cavity shading"); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_EDITOR_VIEW3D); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL); prop = RNA_def_property(srna, "curvature_ridge_factor", PROP_FLOAT, PROP_FACTOR); @@ -4199,6 +4235,14 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Shader AOV Name", "Name of the active Shader AOV"); RNA_def_property_flag(prop, PROP_HIDDEN); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "use_compositor", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_COMPOSITOR); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_boolean_default(prop, false); + RNA_def_property_ui_text( + prop, "Compositor", "Preview the compositor output inside the viewport"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL); } static void rna_def_space_view3d_overlay(BlenderRNA *brna) @@ -4554,7 +4598,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) RNA_def_property_enum_items(prop, rna_enum_curve_display_handle_items); RNA_def_property_ui_text( prop, "Display Handles", "Limit the display of curve handles in edit mode"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update"); prop = RNA_def_property(srna, "show_curve_normals", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CU_NORMALS); @@ -4727,6 +4771,13 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Opacity", "Vertex Paint mix factor"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update"); + + /* Developer Debug overlay */ + + prop = RNA_def_property(srna, "use_debug_freeze_view_culling", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "debug_flag", V3D_DEBUG_FREEZE_CULLING); + RNA_def_property_ui_text(prop, "Freeze Culling", "Freeze view culling bounds"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); } static void rna_def_space_view3d(BlenderRNA *brna) @@ -5901,7 +5952,7 @@ static void rna_def_space_text(BlenderRNA *brna) prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "lheight"); - RNA_def_property_range(prop, 8, 32); + RNA_def_property_range(prop, 1, 256); /* Large range since Hi-DPI scales down size. */ RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL); @@ -5982,7 +6033,7 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceAction"); RNA_def_struct_ui_text(srna, "Space Dope Sheet Editor", "Dope Sheet space data"); - rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI)); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD)); /* data */ prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); @@ -6295,7 +6346,7 @@ static void rna_def_space_nla(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceNla"); RNA_def_struct_ui_text(srna, "Space Nla Editor", "NLA editor space data"); - rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI)); + rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD)); /* display */ prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE); @@ -6395,7 +6446,7 @@ static void rna_def_space_console(BlenderRNA *brna) /* display */ prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE); /* copied from text editor */ RNA_def_property_int_sdna(prop, NULL, "lheight"); - RNA_def_property_range(prop, 8, 32); + RNA_def_property_range(prop, 1, 256); /* Large range since Hi-DPI scales down size. */ RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text"); RNA_def_property_update(prop, 0, "rna_SpaceConsole_rect_update"); @@ -6585,7 +6636,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna) static const EnumPropertyItem display_size_items[] = { {64, "TINY", 0, "Tiny", ""}, {96, "SMALL", 0, "Small", ""}, - {128, "NORMAL", 0, "Regular", ""}, + {128, "NORMAL", 0, "Medium", ""}, {192, "LARGE", 0, "Large", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -6599,7 +6650,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Title", "Title for the file browser"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - /* Use BYTESTRING rather than DIRPATH as subtype so UI code doesn't add OT_directory_browse + /* Use BYTESTRING rather than DIRPATH as sub-type so UI code doesn't add OT_directory_browse * button when displaying this prop in the file browser (it would just open a file browser). That * should be the only effective difference between the two. */ prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_BYTESTRING); |