From a50ca6a1cd72aa0556d74dd4a54de25bf2eeadcb Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 1 Sep 2022 13:55:20 +0200 Subject: Fix T100687: Geometry Attribute Convert crashes in sculpt mode Since above commit, `BKE_id_attributes_active_get` would also return "internal" attributes like ".hide_poly" or ".hide_vert". As a consequence, a couple of poll functions dont return false anymore (attribute remove, attribute convert), allowing these operators to execute, but acting on this "internal" layers is just asking for trouble. In the UI, we dont see these attributes, because `MESH_UL_attributes` checks `is_internal`, same thing we do now in `BKE_id_attributes_active_get`. Maniphest Tasks: T100687 Differential Revision: https://developer.blender.org/D15833 --- source/blender/blenkernel/intern/attribute.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc index 495a2c82332..e9593b49047 100644 --- a/source/blender/blenkernel/intern/attribute.cc +++ b/source/blender/blenkernel/intern/attribute.cc @@ -473,7 +473,7 @@ CustomDataLayer *BKE_id_attributes_active_get(ID *id) for (int i = 0; i < customdata->totlayer; i++) { CustomDataLayer *layer = &customdata->layers[i]; if (CD_MASK_PROP_ALL & CD_TYPE_AS_MASK(layer->type)) { - if (index == active_index) { + if (index == active_index && BKE_attribute_allow_procedural_access(layer->name)) { return layer; } index++; -- cgit v1.2.3 From a631dc55756b9c1a9835bf5b06f5d57f388f1277 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 1 Sep 2022 10:52:15 +0200 Subject: Fix T100731: Keymap Editor context menu crash Caused by {rB3f3d82cfe9ce} Since above commit, a `uiRNACollectionSearch` may contain a NULL `search_prop`, crashing the menu entry for "Jump To Target" (`ui_jump_to_target_button_poll`). Now safeguard against this with a NULL check (getting search callbacks to work for "Jump To Target" can be investigated in master). Maniphest Tasks: T100731 Differential Revision: https://developer.blender.org/D15832 --- source/blender/editors/interface/interface_ops.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 865aed01aa1..7a7496fb071 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1566,8 +1566,13 @@ static bool jump_to_target_button(bContext *C, bool poll) char str_buf[MAXBONENAME]; char *str_ptr = RNA_property_string_get_alloc(&ptr, prop, str_buf, sizeof(str_buf), NULL); - int found = RNA_property_collection_lookup_string( - &coll_search->search_ptr, coll_search->search_prop, str_ptr, &target_ptr); + int found = 0; + /* Jump to target only works with search properties currently, not search callbacks yet. + * See ui_but_add_search. */ + if (coll_search->search_prop != NULL) { + found = RNA_property_collection_lookup_string( + &coll_search->search_ptr, coll_search->search_prop, str_ptr, &target_ptr); + } if (str_ptr != str_buf) { MEM_freeN(str_ptr); -- cgit v1.2.3