UI: Allow label for Template-ID (respecting property split layout)

Adds a `text` parameter to `bpy.types.uiLayout.template_ID()` which
causes a label to be added, as usual. Adding the label also makes the
template respect the `bpy.types.uiLayout.use_property_split` option.

Also fixes wrong layout being used in the template-ID, although I think
that didn't cause issues in practice.

Sergey requested this for usage in the Movie Clip Editor.
This commit is contained in:
Julian Eisel
2019-11-25 19:41:30 +01:00
parent 03cdfc2ff6
commit 5bcb0c9935
8 changed files with 141 additions and 30 deletions

View File

@@ -293,7 +293,8 @@ static int node_resize_area_default(bNode *node, int x, int y)
static void node_draw_buttons_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL);
uiTemplateIDBrowse(
layout, C, ptr, "node_tree", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, NULL);
}
/* XXX Does a bounding box update by iterating over all children.
@@ -770,7 +771,8 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
"IMAGE_OT_open",
NULL,
UI_TEMPLATE_ID_FILTER_ALL,
false);
false,
NULL);
uiItemR(layout, ptr, "interpolation", 0, "", ICON_NONE);
uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
@@ -806,7 +808,8 @@ static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, Poin
"IMAGE_OT_open",
NULL,
UI_TEMPLATE_ID_FILTER_ALL,
false);
false,
NULL);
uiItemR(layout, ptr, "interpolation", 0, "", ICON_NONE);
uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
@@ -1337,7 +1340,8 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
"IMAGE_OT_open",
NULL,
UI_TEMPLATE_ID_FILTER_ALL,
false);
false,
NULL);
if (!node->id) {
return;
}
@@ -1369,7 +1373,7 @@ static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, Pointer
const char *layer_name;
char scene_name[MAX_ID_NAME - 2];
uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
if (!node->id) {
return;
@@ -1489,7 +1493,7 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA
col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "use_preview", 0, NULL, ICON_NONE);
uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "use_zbuffer", 0, NULL, ICON_NONE);
@@ -2107,7 +2111,7 @@ static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), Pointe
static void node_composit_buts_movieclip(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
uiTemplateID(
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
}
static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -2116,7 +2120,7 @@ static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, Point
PointerRNA clipptr;
uiTemplateID(
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
if (!node->id) {
return;
@@ -2132,7 +2136,7 @@ static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, Pointe
bNode *node = ptr->data;
uiTemplateID(
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
if (!node->id) {
return;
@@ -2158,7 +2162,7 @@ static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, Po
bNode *node = ptr->data;
uiTemplateID(
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
if (!node->id) {
return;
@@ -2481,7 +2485,7 @@ static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *p
{
bNode *node = ptr->data;
uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
uiItemR(layout, ptr, "use_feather", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "size_source", 0, "", ICON_NONE);
@@ -2502,7 +2506,7 @@ static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, Point
{
bNode *node = ptr->data;
uiTemplateID(layout, C, ptr, "clip", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
uiTemplateID(layout, C, ptr, "clip", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
if (node->id) {
MovieClip *clip = (MovieClip *)node->id;
@@ -2539,7 +2543,7 @@ static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRN
bNode *node = ptr->data;
uiTemplateID(
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
if (node->id) {
MovieClip *clip = (MovieClip *)node->id;
@@ -2580,7 +2584,7 @@ static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, P
NodePlaneTrackDeformData *data = node->storage;
uiTemplateID(
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL);
if (node->id) {
MovieClip *clip = (MovieClip *)node->id;
@@ -3013,7 +3017,8 @@ static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *p
"IMAGE_OT_open",
NULL,
UI_TEMPLATE_ID_FILTER_ALL,
false);
false,
NULL);
}
static void node_texture_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)