Fix T39692: Text fields in datablocks editor are broken

Make RNAPointer props un-editable here, we simply cannot handle this.

Also correct previous commit, asking for autonaming for all items was a bit extreme,
this is only needed for enums!
This commit is contained in:
Bastien Montagne 2014-04-27 22:33:05 +02:00
parent 8dcb1e9f70
commit f328f45e22
Notes: blender-bot 2023-02-14 10:48:33 +01:00
Referenced by issue #39692, Text fields in datablocks editor are broken
1 changed files with 16 additions and 5 deletions

View File

@ -755,17 +755,28 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
if (tselem->type == TSE_RNA_PROPERTY) {
ptr = &te->rnaptr;
prop = te->directdata;
if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem, soops)))) {
uiDefAutoButR(block, ptr, prop, -1, NULL, ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
UI_UNIT_Y - 1);
if (!TSELEM_OPEN(tselem, soops)) {
if (RNA_property_type(prop) == PROP_POINTER) {
uiBut *but = uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys,
OL_RNA_COL_SIZEX, UI_UNIT_Y - 1);
uiButSetFlag(but, UI_BUT_DISABLED);
}
else if (RNA_property_type(prop) == PROP_ENUM) {
uiDefAutoButR(block, ptr, prop, -1, NULL, ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
UI_UNIT_Y - 1);
}
else {
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
UI_UNIT_Y - 1);
}
}
}
else if (tselem->type == TSE_RNA_ARRAY_ELEM) {
ptr = &te->rnaptr;
prop = te->directdata;
uiDefAutoButR(block, ptr, prop, te->index, NULL, ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
UI_UNIT_Y - 1);
}
}