From 81baeec59ba530c53f8db253bb0289825aef2f82 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 6 Nov 2021 16:26:09 +1100 Subject: Cleanup: remove window_manager & editor includes from BLF Remove the need to include the window manager & editor functions in low level font rendering code. - The default font size is now set when changed in the preferences. - Flushing cache is set as a callback. --- source/blender/makesrna/intern/rna_userdef.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 2514a604087..92f7b7d7682 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -265,6 +265,14 @@ static void rna_userdef_theme_update(Main *bmain, Scene *scene, PointerRNA *ptr) rna_userdef_update(bmain, scene, ptr); } +static void rna_userdef_theme_text_style_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + const uiStyle *style = UI_style_get(); + BLF_default_size(style->widgetlabel.points); + + rna_userdef_update(bmain, scene, ptr); +} + static void rna_userdef_gizmo_update(Main *bmain, Scene *scene, PointerRNA *ptr) { WM_reinit_gizmomap_all(bmain); @@ -1131,36 +1139,36 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna) prop = RNA_def_property(srna, "points", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 6, 24); RNA_def_property_ui_text(prop, "Points", "Font size in points"); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_text_style_update"); prop = RNA_def_property(srna, "shadow", PROP_INT, PROP_PIXEL); RNA_def_property_range(prop, 0, 5); RNA_def_property_ui_text(prop, "Shadow Size", "Shadow size (0, 3 and 5 supported)"); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_text_style_update"); prop = RNA_def_property(srna, "shadow_offset_x", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "shadx"); RNA_def_property_range(prop, -10, 10); RNA_def_property_ui_text(prop, "Shadow X Offset", "Shadow offset in pixels"); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_text_style_update"); prop = RNA_def_property(srna, "shadow_offset_y", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "shady"); RNA_def_property_range(prop, -10, 10); RNA_def_property_ui_text(prop, "Shadow Y Offset", "Shadow offset in pixels"); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_text_style_update"); prop = RNA_def_property(srna, "shadow_alpha", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "shadowalpha"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Shadow Alpha", ""); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_text_style_update"); prop = RNA_def_property(srna, "shadow_value", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "shadowcolor"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Shadow Brightness", "Shadow color in gray value"); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_text_style_update"); } static void rna_def_userdef_theme_ui_style(BlenderRNA *brna) -- cgit v1.2.3 From c4ea5cb1a3811cbf685a1542a69b33ba3d6345f1 Mon Sep 17 00:00:00 2001 From: Matheus Santos Date: Sat, 13 Nov 2021 13:49:09 +1100 Subject: Text Editor: Auto close relevant characters Support the ability to close relevant characters like '(', '[' and '{'. It will also delete the pair character if they're empty. Ref D13119 Reviewed By: campbellbarton --- source/blender/makesrna/intern/rna_userdef.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 92f7b7d7682..57fbde08fec 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -5024,6 +5024,14 @@ static void rna_def_userdef_edit(BlenderRNA *brna) "Collection Instance Empty Size", "Display size of the empty when new collection instances are created"); + /* Text Editor */ + + prop = RNA_def_property(srna, "use_text_edit_auto_close", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "text_flag", USER_TEXT_EDIT_AUTO_CLOSE); + RNA_def_property_ui_text( + prop, "Auto Close", "Auto close relevant characters inside the text editor"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL); + /* Undo */ prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE); -- cgit v1.2.3 From 73047c69ea803a35f3eb4082b5ccdc7d2c53514d Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Sat, 13 Nov 2021 09:39:18 -0800 Subject: BLF: Use Floats for Font Point Sizes Allow the use of floating-point values for font point sizes, which allows greater precision and flexibility for text output. See D8960 for more information, details, and justification. Differential Revision: https://developer.blender.org/D8960 Reviewed by Campbell Barton --- source/blender/makesrna/intern/rna_userdef.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 57fbde08fec..9ce1fca164c 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1136,10 +1136,11 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna) RNA_def_struct_clear_flag(srna, STRUCT_UNDO); RNA_def_struct_ui_text(srna, "Font Style", "Theme settings for Font"); - prop = RNA_def_property(srna, "points", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 6, 24); + prop = RNA_def_property(srna, "points", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_range(prop, 6.0f, 32.0f); + RNA_def_property_ui_range(prop, 8.0f, 20.0f, 10.0f, 1); RNA_def_property_ui_text(prop, "Points", "Font size in points"); - RNA_def_property_update(prop, 0, "rna_userdef_theme_text_style_update"); + RNA_def_property_update(prop, 0, "rna_userdef_dpi_update"); prop = RNA_def_property(srna, "shadow", PROP_INT, PROP_PIXEL); RNA_def_property_range(prop, 0, 5); -- cgit v1.2.3 From 07af45eec5870765e7ac66e8639afe41141244b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 16 Nov 2021 16:49:27 +0100 Subject: Asset Browser: hide catalog debug info behind debug option Add a new "experimental" debug option `show_asset_debug_info`, and use that to determine the visibility of the active asset's catalog UUID and simple name. Previously this was only determined by the "Developer Extras" option, which meant it was visible in too many situations. It's not really a "developer extra", and really just a debugging tool, so the new option is more in line with its purpose. Reviewed by: Severin Differential Revision: https://developer.blender.org/D13242 --- source/blender/makesrna/intern/rna_userdef.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 2514a604087..32b3be9ee09 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -6382,6 +6382,12 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) "data-blocks as assets, not just poses"); RNA_def_property_update(prop, 0, "rna_userdef_ui_update"); + prop = RNA_def_property(srna, "show_asset_debug_info", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, + "Asset Debug Info", + "Enable some extra fields in the Asset Browser to aid in debugging"); + RNA_def_property_update(prop, 0, "rna_userdef_ui_update"); + prop = RNA_def_property(srna, "use_override_templates", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_override_templates", 1); RNA_def_property_ui_text( -- cgit v1.2.3 From 1d1855e95f916685fed970904fc37701a4a0e031 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 16 Nov 2021 21:05:30 -0300 Subject: Allow navigating while transforming This feature has been desired for some time: - https://rightclickselect.com/p/ui/Tqbbbc/allow-navigating-while-transforming (See comments); - D1583; - T37427; In short, blocking navigation during transform limits the user to move the object only to visible areas within the screen and hinders the allocation of objects within closed meshes. The node editor is also impaired because some nodes are far between them and the connectors are too small. The only disadvantage of this patch (as I see it) is the conflict with the existing key map: MIDDLEMOUSE: - enable axis constrain in 3D view; WHEELDOWNMOUSE, WHEELUPMOUSE, PAGEUPKEY, PAGEDOWNKEY: - change the threshold of the proportional edit; So the patch solution was to change these keymaps: - MIDDLEMOUSE to Alt+MIDDLEMOUSE; - WHEELDOWNMOUSE, WHEELUPMOUSE, PAGEUPKEY, PAGEDOWNKEY to Alt+(corresponding key); When you use this new keymap for the first time in the proportional edit, it may seem strange due to the custom of using it (both in View2D and View3D). But quickly the user gets used to it. Alternatively we can add an option to the user preferences ([] Allow navigating while transforming). (I'm not much fan of this option). The patch was done on branch2.8. But maybe it's a good idea to apply it to 2.79 Differential Revision: https://developer.blender.org/D2624 --- source/blender/makesrna/intern/rna_userdef.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0e90372cd7b..7e22241234b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -6414,6 +6414,10 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "use_geometry_nodes_legacy", 1); RNA_def_property_ui_text( prop, "Geometry Nodes Legacy", "Enable legacy geometry nodes in the menu"); + + prop = RNA_def_property(srna, "use_navigate_while_transform", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text( + prop, "Navigate While Transform", "Allow Navigation While Transforming"); } static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) -- cgit v1.2.3 From 5e6fdaa07fff907e02b36813ccde0702bad4fb4d Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 16 Nov 2021 21:05:30 -0300 Subject: Revert "Allow navigating while transforming" This reverts commit 1d1855e95f916685fed970904fc37701a4a0e031. --- source/blender/makesrna/intern/rna_userdef.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7e22241234b..0e90372cd7b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -6414,10 +6414,6 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "use_geometry_nodes_legacy", 1); RNA_def_property_ui_text( prop, "Geometry Nodes Legacy", "Enable legacy geometry nodes in the menu"); - - prop = RNA_def_property(srna, "use_navigate_while_transform", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text( - prop, "Navigate While Transform", "Allow Navigation While Transforming"); } static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) -- cgit v1.2.3 From 2a9cfdac7e126e37afb82e15a131717041f3d2f8 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 16 Nov 2021 21:05:30 -0300 Subject: Revert "Revert "Allow navigating while transforming"" This reverts commit 5e6fdaa07fff907e02b36813ccde0702bad4fb4d. --- source/blender/makesrna/intern/rna_userdef.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0e90372cd7b..7e22241234b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -6414,6 +6414,10 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "use_geometry_nodes_legacy", 1); RNA_def_property_ui_text( prop, "Geometry Nodes Legacy", "Enable legacy geometry nodes in the menu"); + + prop = RNA_def_property(srna, "use_navigate_while_transform", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text( + prop, "Navigate While Transform", "Allow Navigation While Transforming"); } static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) -- cgit v1.2.3 From 717a971035071d36af03d65713408f4da1f69cb3 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 18 Nov 2021 13:55:17 -0300 Subject: Revert "Revert "Revert "Allow navigating while transforming""" This reverts commit 2a9cfdac7e126e37afb82e15a131717041f3d2f8. --- source/blender/makesrna/intern/rna_userdef.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7e22241234b..0e90372cd7b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -6414,10 +6414,6 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "use_geometry_nodes_legacy", 1); RNA_def_property_ui_text( prop, "Geometry Nodes Legacy", "Enable legacy geometry nodes in the menu"); - - prop = RNA_def_property(srna, "use_navigate_while_transform", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text( - prop, "Navigate While Transform", "Allow Navigation While Transforming"); } static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) -- cgit v1.2.3 From 0c33411bddfd3e2ab85dbf8411334f18fdaeb460 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 18 Nov 2021 13:55:17 -0300 Subject: Revert "Revert "Revert "Revert "Allow navigating while transforming"""" This reverts commit 717a971035071d36af03d65713408f4da1f69cb3. --- source/blender/makesrna/intern/rna_userdef.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0e90372cd7b..7e22241234b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -6414,6 +6414,10 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "use_geometry_nodes_legacy", 1); RNA_def_property_ui_text( prop, "Geometry Nodes Legacy", "Enable legacy geometry nodes in the menu"); + + prop = RNA_def_property(srna, "use_navigate_while_transform", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text( + prop, "Navigate While Transform", "Allow Navigation While Transforming"); } static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) -- cgit v1.2.3 From f190f2d267df46d25d74009a3c14ac10753d57ca Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 18 Nov 2021 14:19:59 -0300 Subject: Revert fixes --- source/blender/makesrna/intern/rna_userdef.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7e22241234b..0e90372cd7b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -6414,10 +6414,6 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "use_geometry_nodes_legacy", 1); RNA_def_property_ui_text( prop, "Geometry Nodes Legacy", "Enable legacy geometry nodes in the menu"); - - prop = RNA_def_property(srna, "use_navigate_while_transform", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text( - prop, "Navigate While Transform", "Allow Navigation While Transforming"); } static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) -- cgit v1.2.3 From 06ead314b63f068ae9deaed369021b01aa5f1029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 19 Nov 2021 16:04:24 +0100 Subject: Asset Preferences: disallow single file as asset library Asset libraries should be directories on disk. By manually entering a file path it was possible to have a single blend file as asset library, but that was not a designed-for situation, and it doesn't play well with the asset catalog system. --- source/blender/makesrna/intern/rna_userdef.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/makesrna/intern/rna_userdef.c') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 32b3be9ee09..4542f8fa1d7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -344,6 +344,12 @@ static void rna_userdef_asset_library_name_set(PointerRNA *ptr, const char *valu BKE_preferences_asset_library_name_set(&U, library, value); } +static void rna_userdef_asset_library_path_set(PointerRNA *ptr, const char *value) +{ + bUserAssetLibrary *library = (bUserAssetLibrary *)ptr->data; + BKE_preferences_asset_library_path_set(library, value); +} + static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -6092,6 +6098,7 @@ static void rna_def_userdef_filepaths_asset_library(BlenderRNA *brna) prop = RNA_def_property(srna, "path", PROP_STRING, PROP_DIRPATH); RNA_def_property_ui_text( prop, "Path", "Path to a directory with .blend files to use as an asset library"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_userdef_asset_library_path_set"); RNA_def_property_update(prop, 0, "rna_userdef_update"); } -- cgit v1.2.3