Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_templates.c
| Show First 20 Lines • Show All 387 Lines • ▼ Show 20 Lines | static bool id_search_add(const bContext *C, TemplateID *template_ui, uiSearchItems *items, ID *id) | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* ID Search browse menu, do the search */ | /* ID Search browse menu, do the search */ | ||||
| static void id_search_cb(const bContext *C, | static void id_search_cb(const bContext *C, | ||||
| void *arg_template, | void *arg_template, | ||||
| const char *str, | const char *str, | ||||
| uiSearchItems *items) | uiSearchItems *items, | ||||
| const bool UNUSED(is_first)) | |||||
| { | { | ||||
| TemplateID *template_ui = (TemplateID *)arg_template; | TemplateID *template_ui = (TemplateID *)arg_template; | ||||
| ListBase *lb = template_ui->idlb; | ListBase *lb = template_ui->idlb; | ||||
| const int flag = RNA_property_flag(template_ui->prop); | const int flag = RNA_property_flag(template_ui->prop); | ||||
| StringSearch *search = BLI_string_search_new(); | StringSearch *search = BLI_string_search_new(); | ||||
| /* ID listbase */ | /* ID listbase */ | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** | /** | ||||
| * A version of 'id_search_cb' that lists scene objects. | * A version of 'id_search_cb' that lists scene objects. | ||||
| */ | */ | ||||
| static void id_search_cb_objects_from_scene(const bContext *C, | static void id_search_cb_objects_from_scene(const bContext *C, | ||||
| void *arg_template, | void *arg_template, | ||||
| const char *str, | const char *str, | ||||
| uiSearchItems *items) | uiSearchItems *items, | ||||
| const bool UNUSED(is_first)) | |||||
| { | { | ||||
| TemplateID *template_ui = (TemplateID *)arg_template; | TemplateID *template_ui = (TemplateID *)arg_template; | ||||
| ListBase *lb = template_ui->idlb; | ListBase *lb = template_ui->idlb; | ||||
| Scene *scene = NULL; | Scene *scene = NULL; | ||||
| ID *id_from = template_ui->ptr.owner_id; | ID *id_from = template_ui->ptr.owner_id; | ||||
| if (id_from && GS(id_from->name) == ID_SCE) { | if (id_from && GS(id_from->name) == ID_SCE) { | ||||
| scene = (Scene *)id_from; | scene = (Scene *)id_from; | ||||
| Show All 37 Lines | |||||
| } | } | ||||
| /* ID Search browse menu, open */ | /* ID Search browse menu, open */ | ||||
| static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem) | static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem) | ||||
| { | { | ||||
| static TemplateID template_ui; | static TemplateID template_ui; | ||||
| PointerRNA active_item_ptr; | PointerRNA active_item_ptr; | ||||
| void (*id_search_update_fn)( | void (*id_search_update_fn)( | ||||
| const bContext *, void *, const char *, uiSearchItems *) = id_search_cb; | const bContext *, void *, const char *, uiSearchItems *, const bool) = id_search_cb; | ||||
| /* arg_litem is malloced, can be freed by parent button */ | /* arg_litem is malloced, can be freed by parent button */ | ||||
| template_ui = *((TemplateID *)arg_litem); | template_ui = *((TemplateID *)arg_litem); | ||||
| active_item_ptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop); | active_item_ptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop); | ||||
| if (template_ui.filter) { | if (template_ui.filter) { | ||||
| /* Currently only used for objects. */ | /* Currently only used for objects. */ | ||||
| if (template_ui.idcode == ID_OB) { | if (template_ui.idcode == ID_OB) { | ||||
| ▲ Show 20 Lines • Show All 6,799 Lines • Show Last 20 Lines | |||||