Merge branch 'master' into blender2.8
This commit is contained in:
commit
f20bb6c63f
|
@ -40,7 +40,7 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, Panel):
|
|||
layout.template_ID(space, "pin_id")
|
||||
else:
|
||||
row = layout.row()
|
||||
row.template_ID(context.view_layer.objects, "active")
|
||||
row.template_ID(context.view_layer.objects, "active", filter='AVAILABLE')
|
||||
|
||||
|
||||
class OBJECT_PT_transform(ObjectButtonsPanel, Panel):
|
||||
|
|
|
@ -671,6 +671,15 @@ void UI_but_string_info_get(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0
|
|||
#define UI_ID_OVERRIDE (1 << 11)
|
||||
#define UI_ID_FULL (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL)
|
||||
|
||||
/**
|
||||
* Ways to limit what is displayed in ID-search popup.
|
||||
* \note We may want to add LOCAL, LIBRARY ... as needed.
|
||||
*/
|
||||
enum {
|
||||
UI_TEMPLATE_ID_FILTER_ALL = 0,
|
||||
UI_TEMPLATE_ID_FILTER_AVAILABLE = 1,
|
||||
};
|
||||
|
||||
int UI_icon_from_id(struct ID *id);
|
||||
int UI_icon_from_report_type(int type);
|
||||
|
||||
|
@ -926,12 +935,15 @@ uiLayout *uiLayoutRadial(uiLayout *layout);
|
|||
|
||||
/* templates */
|
||||
void uiTemplateHeader(uiLayout *layout, struct bContext *C);
|
||||
void uiTemplateID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
|
||||
const char *newop, const char *openop, const char *unlinkop);
|
||||
void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
|
||||
const char *newop, const char *openop, const char *unlinkop);
|
||||
void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
|
||||
const char *newop, const char *openop, const char *unlinkop, int rows, int cols);
|
||||
void uiTemplateID(
|
||||
uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
|
||||
const char *newop, const char *openop, const char *unlinkop, int filter);
|
||||
void uiTemplateIDBrowse(
|
||||
uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
|
||||
const char *newop, const char *openop, const char *unlinkop, int filter);
|
||||
void uiTemplateIDPreview(
|
||||
uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
|
||||
const char *newop, const char *openop, const char *unlinkop, int rows, int cols, int filter);
|
||||
void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
|
||||
const char *proptypename, const char *text);
|
||||
void uiTemplateSearch(
|
||||
|
|
|
@ -232,6 +232,8 @@ typedef struct TemplateID {
|
|||
PropertyRNA *prop;
|
||||
|
||||
ListBase *idlb;
|
||||
short idcode;
|
||||
short filter;
|
||||
int prv_rows, prv_cols;
|
||||
bool preview;
|
||||
} TemplateID;
|
||||
|
@ -251,60 +253,134 @@ static void id_search_call_cb(bContext *C, void *arg_template, void *item)
|
|||
}
|
||||
}
|
||||
|
||||
static bool id_search_add(
|
||||
const bContext *C, TemplateID *template_ui,
|
||||
const int flag, const char *str, uiSearchItems *items,
|
||||
ID *id)
|
||||
{
|
||||
ID *id_from = template_ui->ptr.id.data;
|
||||
|
||||
if (!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
|
||||
|
||||
/* use filter */
|
||||
if (RNA_property_type(template_ui->prop) == PROP_POINTER) {
|
||||
PointerRNA ptr;
|
||||
RNA_id_pointer_create(id, &ptr);
|
||||
if (RNA_property_pointer_poll(&template_ui->ptr, template_ui->prop, &ptr) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* hide dot-datablocks, but only if filter does not force it visible */
|
||||
if (U.uiflag & USER_HIDE_DOT) {
|
||||
if ((id->name[2] == '.') && (str[0] != '.')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (*str == '\0' || BLI_strcasestr(id->name + 2, str)) {
|
||||
/* +1 is needed because BKE_id_ui_prefix used 3 letter prefix
|
||||
* followed by ID_NAME-2 characters from id->name
|
||||
*/
|
||||
char name_ui[MAX_ID_NAME + 1];
|
||||
BKE_id_ui_prefix(name_ui, id);
|
||||
|
||||
int iconid = ui_id_icon_get(C, id, template_ui->preview);
|
||||
|
||||
if (false == UI_search_item_add(items, name_ui, id, iconid)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ID Search browse menu, do the search */
|
||||
static void id_search_cb(const bContext *C, void *arg_template, const char *str, uiSearchItems *items)
|
||||
{
|
||||
TemplateID *template_ui = (TemplateID *)arg_template;
|
||||
ListBase *lb = template_ui->idlb;
|
||||
ID *id, *id_from = template_ui->ptr.id.data;
|
||||
int iconid;
|
||||
ID *id;
|
||||
int flag = RNA_property_flag(template_ui->prop);
|
||||
|
||||
/* ID listbase */
|
||||
for (id = lb->first; id; id = id->next) {
|
||||
if (!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
|
||||
|
||||
/* use filter */
|
||||
if (RNA_property_type(template_ui->prop) == PROP_POINTER) {
|
||||
PointerRNA ptr;
|
||||
RNA_id_pointer_create(id, &ptr);
|
||||
if (RNA_property_pointer_poll(&template_ui->ptr, template_ui->prop, &ptr) == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* hide dot-datablocks, but only if filter does not force it visible */
|
||||
if (U.uiflag & USER_HIDE_DOT)
|
||||
if ((id->name[2] == '.') && (str[0] != '.'))
|
||||
continue;
|
||||
|
||||
if (*str == '\0' || BLI_strcasestr(id->name + 2, str)) {
|
||||
/* +1 is needed because BKE_id_ui_prefix used 3 letter prefix
|
||||
* followed by ID_NAME-2 characters from id->name
|
||||
*/
|
||||
char name_ui[MAX_ID_NAME + 1];
|
||||
BKE_id_ui_prefix(name_ui, id);
|
||||
|
||||
iconid = ui_id_icon_get(C, id, template_ui->preview);
|
||||
|
||||
if (false == UI_search_item_add(items, name_ui, id, iconid))
|
||||
break;
|
||||
}
|
||||
if (!id_search_add(C, template_ui, flag, str, items, id)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use id tags for filtering.
|
||||
*/
|
||||
static void id_search_cb_tagged(const bContext *C, void *arg_template, const char *str, uiSearchItems *items)
|
||||
{
|
||||
TemplateID *template_ui = (TemplateID *)arg_template;
|
||||
ListBase *lb = template_ui->idlb;
|
||||
ID *id;
|
||||
int flag = RNA_property_flag(template_ui->prop);
|
||||
|
||||
/* ID listbase */
|
||||
for (id = lb->first; id; id = id->next) {
|
||||
if (id->tag & LIB_TAG_DOIT) {
|
||||
if (!id_search_add(C, template_ui, flag, str, items, id)) {
|
||||
break;
|
||||
}
|
||||
id->tag &= ~LIB_TAG_DOIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of 'id_search_cb' that lists scene objects.
|
||||
*/
|
||||
static void id_search_cb_objects_from_scene(const bContext *C, void *arg_template, const char *str, uiSearchItems *items)
|
||||
{
|
||||
TemplateID *template_ui = (TemplateID *)arg_template;
|
||||
ListBase *lb = template_ui->idlb;
|
||||
Scene *scene = NULL;
|
||||
ID *id_from = template_ui->ptr.id.data;
|
||||
|
||||
if (id_from && GS(id_from->name) == ID_SCE) {
|
||||
scene = (Scene *)id_from;
|
||||
}
|
||||
else {
|
||||
scene = CTX_data_scene(C);
|
||||
}
|
||||
|
||||
BKE_main_id_flag_listbase(lb, LIB_TAG_DOIT, false);
|
||||
|
||||
FOREACH_SCENE_OBJECT(scene, ob_iter)
|
||||
{
|
||||
ob_iter->id.tag |= LIB_TAG_DOIT;
|
||||
}
|
||||
FOREACH_SCENE_OBJECT_END
|
||||
id_search_cb_tagged(C, arg_template, str, items);
|
||||
}
|
||||
|
||||
/* ID Search browse menu, open */
|
||||
static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
|
||||
{
|
||||
static TemplateID template_ui;
|
||||
PointerRNA active_item_ptr;
|
||||
void (*id_search_cb_p)(const bContext *, void *, const char *, uiSearchItems *) = id_search_cb;
|
||||
|
||||
/* arg_litem is malloced, can be freed by parent button */
|
||||
template_ui = *((TemplateID *)arg_litem);
|
||||
active_item_ptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop);
|
||||
|
||||
if (template_ui.filter) {
|
||||
/* Currently only used for objects. */
|
||||
if (template_ui.idcode == ID_OB) {
|
||||
if (template_ui.filter == UI_TEMPLATE_ID_FILTER_AVAILABLE) {
|
||||
id_search_cb_p = id_search_cb_objects_from_scene;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return template_common_search_menu(
|
||||
C, ar, id_search_cb, &template_ui, id_search_call_cb, active_item_ptr.data,
|
||||
C, ar, id_search_cb_p, &template_ui, id_search_call_cb, active_item_ptr.data,
|
||||
template_ui.prv_rows, template_ui.prv_cols);
|
||||
}
|
||||
|
||||
|
@ -496,7 +572,7 @@ static const char *template_id_context(StructRNA *type)
|
|||
#endif
|
||||
|
||||
static void template_ID(
|
||||
bContext *C, uiLayout *layout, TemplateID *template_ui, StructRNA *type, short idcode, int flag,
|
||||
bContext *C, uiLayout *layout, TemplateID *template_ui, StructRNA *type, int flag,
|
||||
const char *newop, const char *openop, const char *unlinkop)
|
||||
{
|
||||
uiBut *but;
|
||||
|
@ -704,15 +780,15 @@ static void template_ID(
|
|||
}
|
||||
}
|
||||
|
||||
if (idcode == ID_TE)
|
||||
if (template_ui->idcode == ID_TE) {
|
||||
uiTemplateTextureShow(layout, C, &template_ui->ptr, template_ui->prop);
|
||||
|
||||
}
|
||||
UI_block_align_end(block);
|
||||
}
|
||||
|
||||
static void ui_template_id(
|
||||
uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
|
||||
const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols)
|
||||
const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols, int filter)
|
||||
{
|
||||
TemplateID *template_ui;
|
||||
PropertyRNA *prop;
|
||||
|
@ -732,6 +808,13 @@ static void ui_template_id(
|
|||
template_ui->prv_rows = prv_rows;
|
||||
template_ui->prv_cols = prv_cols;
|
||||
|
||||
if ((flag & UI_ID_PIN) == 0) {
|
||||
template_ui->filter = filter;
|
||||
}
|
||||
else {
|
||||
template_ui->filter = 0;
|
||||
}
|
||||
|
||||
if (newop)
|
||||
flag |= UI_ID_ADD_NEW;
|
||||
if (openop)
|
||||
|
@ -739,14 +822,15 @@ static void ui_template_id(
|
|||
|
||||
type = RNA_property_pointer_type(ptr, prop);
|
||||
idcode = RNA_type_to_ID_code(type);
|
||||
template_ui->idcode = idcode;
|
||||
template_ui->idlb = which_libbase(CTX_data_main(C), idcode);
|
||||
|
||||
|
||||
/* create UI elements for this template
|
||||
* - template_ID makes a copy of the template data and assigns it to the relevant buttons
|
||||
*/
|
||||
if (template_ui->idlb) {
|
||||
uiLayoutRow(layout, true);
|
||||
template_ID(C, layout, template_ui, type, idcode, flag, newop, openop, unlinkop);
|
||||
template_ID(C, layout, template_ui, type, flag, newop, openop, unlinkop);
|
||||
}
|
||||
|
||||
MEM_freeN(template_ui);
|
||||
|
@ -754,25 +838,25 @@ static void ui_template_id(
|
|||
|
||||
void uiTemplateID(
|
||||
uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
|
||||
const char *openop, const char *unlinkop)
|
||||
const char *openop, const char *unlinkop, int filter)
|
||||
{
|
||||
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop,
|
||||
UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0);
|
||||
UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0, filter);
|
||||
}
|
||||
|
||||
void uiTemplateIDBrowse(
|
||||
uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
|
||||
const char *openop, const char *unlinkop)
|
||||
const char *openop, const char *unlinkop, int filter)
|
||||
{
|
||||
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME, 0, 0);
|
||||
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME, 0, 0, filter);
|
||||
}
|
||||
|
||||
void uiTemplateIDPreview(
|
||||
uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
|
||||
const char *openop, const char *unlinkop, int rows, int cols)
|
||||
const char *openop, const char *unlinkop, int rows, int cols, int filter)
|
||||
{
|
||||
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop,
|
||||
UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols);
|
||||
UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols, filter);
|
||||
}
|
||||
|
||||
/************************ ID Chooser Template ***************************/
|
||||
|
@ -4375,7 +4459,7 @@ void uiTemplateCacheFile(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
|
|||
|
||||
uiLayoutSetContextPointer(layout, "edit_cachefile", &fileptr);
|
||||
|
||||
uiTemplateID(layout, C, ptr, propname, NULL, "CACHEFILE_OT_open", NULL);
|
||||
uiTemplateID(layout, C, ptr, propname, NULL, "CACHEFILE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (!file) {
|
||||
return;
|
||||
|
|
|
@ -107,7 +107,7 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
|
|||
uiLayoutSetContextPointer(layout, "edit_movieclip", &clipptr);
|
||||
|
||||
if (!compact)
|
||||
uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open", NULL);
|
||||
uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (clip) {
|
||||
uiLayout *col;
|
||||
|
|
|
@ -871,8 +871,11 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
|
|||
uiLayoutSetContextPointer(layout, "edit_image", &imaptr);
|
||||
uiLayoutSetContextPointer(layout, "edit_image_user", userptr);
|
||||
|
||||
if (!compact)
|
||||
uiTemplateID(layout, C, ptr, propname, ima ? NULL : "IMAGE_OT_new", "IMAGE_OT_open", NULL);
|
||||
if (!compact) {
|
||||
uiTemplateID(
|
||||
layout, C, ptr, propname,
|
||||
ima ? NULL : "IMAGE_OT_new", "IMAGE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
}
|
||||
|
||||
if (ima) {
|
||||
UI_block_funcN_set(block, rna_update_cb, MEM_dupallocN(cb), NULL);
|
||||
|
|
|
@ -2011,7 +2011,7 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C)
|
|||
{
|
||||
uiLayout *row, *col;
|
||||
|
||||
uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL);
|
||||
uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
if (!RNA_pointer_get(ptr, "sound").data) {
|
||||
uiItemL(layout, IFACE_("Select a sound from the list or load a new one"), ICON_NONE);
|
||||
return;
|
||||
|
|
|
@ -285,7 +285,9 @@ static void nla_panel_animdata(const bContext *C, Panel *pa)
|
|||
/* Active Action Properties ------------------------------------- */
|
||||
/* action */
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiTemplateID(row, (bContext *)C, &adt_ptr, "action", "ACTION_OT_new", NULL, "NLA_OT_action_unlink");
|
||||
uiTemplateID(
|
||||
row, (bContext *)C, &adt_ptr, "action",
|
||||
"ACTION_OT_new", NULL, "NLA_OT_action_unlink", UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
/* extrapolation */
|
||||
row = uiLayoutRow(layout, true);
|
||||
|
|
|
@ -284,7 +284,7 @@ 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);
|
||||
uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
}
|
||||
|
||||
/* XXX Does a bounding box update by iterating over all children.
|
||||
|
@ -681,7 +681,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA
|
|||
bNode *node = ptr->data;
|
||||
uiLayout *col;
|
||||
|
||||
uiTemplateID(layout, C, ptr, "material", "MATERIAL_OT_new", NULL, NULL);
|
||||
uiTemplateID(layout, C, ptr, "material", "MATERIAL_OT_new", NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (!node->id) return;
|
||||
|
||||
|
@ -778,7 +778,7 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
|
|||
PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
|
||||
|
||||
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
||||
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
|
||||
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "interpolation", 0, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
|
||||
|
@ -807,7 +807,9 @@ static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, Poin
|
|||
PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
|
||||
|
||||
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
||||
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
|
||||
uiTemplateID(
|
||||
layout, C, ptr, "image",
|
||||
NULL, "IMAGE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr);
|
||||
|
||||
|
@ -823,7 +825,9 @@ static void node_shader_buts_tex_environment_ex(uiLayout *layout, bContext *C, P
|
|||
Image *ima = imaptr.data;
|
||||
|
||||
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
||||
uiTemplateID(layout, C, ptr, "image", ima ? NULL : "IMAGE_OT_new", "IMAGE_OT_open", NULL);
|
||||
uiTemplateID(
|
||||
layout, C, ptr, "image",
|
||||
ima ? NULL : "IMAGE_OT_new", "IMAGE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (!ima)
|
||||
return;
|
||||
|
@ -1250,7 +1254,9 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
|
|||
|
||||
RNA_pointer_create((ID *)ptr->id.data, &RNA_ImageUser, node->storage, &iuserptr);
|
||||
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
||||
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
|
||||
uiTemplateID(
|
||||
layout, C, ptr, "image",
|
||||
NULL, "IMAGE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
if (!node->id) return;
|
||||
|
||||
imaptr = RNA_pointer_get(ptr, "image");
|
||||
|
@ -1280,7 +1286,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);
|
||||
uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (!node->id) return;
|
||||
|
||||
|
@ -1394,7 +1400,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);
|
||||
uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, ptr, "use_zbuffer", 0, NULL, ICON_NONE);
|
||||
|
@ -1961,7 +1967,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);
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
}
|
||||
|
||||
static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
|
@ -1969,7 +1975,7 @@ static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, Point
|
|||
bNode *node = ptr->data;
|
||||
PointerRNA clipptr;
|
||||
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (!node->id)
|
||||
return;
|
||||
|
@ -1983,7 +1989,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);
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (!node->id)
|
||||
return;
|
||||
|
@ -2007,7 +2013,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);
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (!node->id)
|
||||
return;
|
||||
|
@ -2315,7 +2321,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);
|
||||
uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
uiItemR(layout, ptr, "use_antialiasing", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, ptr, "use_feather", 0, NULL, ICON_NONE);
|
||||
|
||||
|
@ -2337,7 +2343,7 @@ static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, Point
|
|||
{
|
||||
bNode *node = ptr->data;
|
||||
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, NULL, NULL);
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (node->id) {
|
||||
MovieClip *clip = (MovieClip *) node->id;
|
||||
|
@ -2373,7 +2379,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);
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (node->id) {
|
||||
MovieClip *clip = (MovieClip *) node->id;
|
||||
|
@ -2413,7 +2419,7 @@ static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, P
|
|||
bNode *node = ptr->data;
|
||||
NodePlaneTrackDeformData *data = node->storage;
|
||||
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
|
||||
uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
|
||||
if (node->id) {
|
||||
MovieClip *clip = (MovieClip *) node->id;
|
||||
|
@ -2791,7 +2797,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
|
|||
|
||||
static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
|
||||
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
|
||||
}
|
||||
|
||||
static void node_texture_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
|
|
|
@ -454,6 +454,12 @@ void RNA_api_ui_layout(StructRNA *srna)
|
|||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static const EnumPropertyItem id_template_filter_items[] = {
|
||||
{UI_TEMPLATE_ID_FILTER_ALL, "ALL", 0, "All", ""},
|
||||
{UI_TEMPLATE_ID_FILTER_AVAILABLE, "AVAILABLE", 0, "Available", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static float node_socket_color_default[] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
|
||||
/* simple layout specifiers */
|
||||
|
@ -685,7 +691,9 @@ void RNA_api_ui_layout(StructRNA *srna)
|
|||
RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
|
||||
RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
|
||||
RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
|
||||
|
||||
RNA_def_enum(func, "filter", id_template_filter_items, UI_TEMPLATE_ID_FILTER_ALL,
|
||||
"", "Optionally limit the items which can be selected");
|
||||
|
||||
func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
api_ui_item_rna_common(func);
|
||||
|
@ -694,7 +702,9 @@ void RNA_api_ui_layout(StructRNA *srna)
|
|||
RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
|
||||
RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
|
||||
RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
|
||||
|
||||
RNA_def_enum(func, "filter", id_template_filter_items, UI_TEMPLATE_ID_FILTER_ALL,
|
||||
"", "Optionally limit the items which can be selected");
|
||||
|
||||
func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
|
||||
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
|
|
|
@ -256,6 +256,7 @@ void WM_operator_view3d_unit_defaults(struct bContext *C, struct wmOperator *op
|
|||
int WM_operator_smooth_viewtx_get(const struct wmOperator *op);
|
||||
int WM_menu_invoke_ex(struct bContext *C, struct wmOperator *op, int opcontext);
|
||||
int WM_menu_invoke (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||
void WM_menu_name_call(struct bContext *C, const char *menu_name, short context);
|
||||
int WM_enum_search_invoke_previews(struct bContext *C, struct wmOperator *op, short prv_cols, short prv_rows);
|
||||
int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||
/* invoke callback, confirm menu + exec */
|
||||
|
|
|
@ -1458,6 +1458,19 @@ int WM_operator_name_call(bContext *C, const char *opstring, short context, Poin
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call an existent menu. The menu can be created in C or Python.
|
||||
*/
|
||||
void WM_menu_name_call(bContext *C, const char *menu_name, short context)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find("WM_OT_call_menu", false);
|
||||
PointerRNA ptr;
|
||||
WM_operator_properties_create_ptr(&ptr, ot);
|
||||
RNA_string_set(&ptr, "name", menu_name);
|
||||
WM_operator_name_call_ptr(C, ot, context, &ptr);
|
||||
WM_operator_properties_free(&ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to #WM_operator_name_call called with #WM_OP_EXEC_DEFAULT context.
|
||||
*
|
||||
|
|
|
@ -680,12 +680,12 @@ void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset,
|
|||
void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *proptypename, const char *text) RET_NONE
|
||||
void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *root_ptr, const char *text) RET_NONE
|
||||
void uiTemplateHeader(struct uiLayout *layout, struct bContext *C) RET_NONE
|
||||
void uiTemplateID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop) RET_NONE
|
||||
void uiTemplateID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter) RET_NONE
|
||||
struct uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr) RET_NULL
|
||||
struct uiLayout *uiTemplateConstraint(struct uiLayout *layout, struct PointerRNA *ptr) RET_NULL
|
||||
void uiTemplatePreview(struct uiLayout *layout, struct bContext *C, struct ID *id, int show_buttons, struct ID *parent,
|
||||
struct MTex *slot, const char *preview_id) RET_NONE
|
||||
void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols) RET_NONE
|
||||
void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols, int filter) RET_NONE
|
||||
void uiTemplateSearch(
|
||||
uiLayout *layout, struct bContext *C,
|
||||
PointerRNA *ptr, const char *propname,
|
||||
|
|
Loading…
Reference in New Issue