UI: Gray out labels for non-editable linked items

Similar to !145387, disable layout when rna property is non editable.
Let the widget code handle the theme of the label in
front of the non-editable property. Also do it separately inside
`v3d_object_dimension_buts` for transform properties of N-panel

Resolves #146290

Pull Request: https://projects.blender.org/blender/blender/pulls/146565
This commit is contained in:
Pratik Borhade
2025-09-28 07:06:21 +02:00
committed by Pratik Borhade
parent 8e934e7af0
commit 8de2e6f9fb
2 changed files with 10 additions and 1 deletions

View File

@@ -2100,6 +2100,10 @@ void uiLayout::prop(PointerRNA *ptr,
uiLayout *layout_sub = &layout_split->column(true);
layout_sub->space_ = 0;
if (!RNA_property_editable(ptr, prop)) {
layout_split->enabled_set(false);
}
if (!use_prop_sep_split_label) {
/* Pass */
}

View File

@@ -1594,7 +1594,8 @@ static void v3d_editvertex_buts(
static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d, Object *ob)
{
uiBlock *block = (layout) ? layout->absolute_block() : nullptr;
uiBlock *block = (layout) ? layout->block() : nullptr;
uiLayout &sub_layout = layout->absolute(false);
TransformProperties *tfp = v3d_transform_props_ensure(v3d);
const bool is_editable = ID_IS_EDITABLE(&ob->id);
@@ -1609,6 +1610,10 @@ static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d
copy_v3_v3(tfp->ob_scale_orig, ob->scale);
copy_m4_m4(tfp->ob_obmat_orig, ob->object_to_world().ptr());
if (!is_editable) {
sub_layout.enabled_set(false);
}
uiDefBut(block,
ButType::Label,
0,