Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_buttons/buttons_texture.c
| Show First 20 Lines • Show All 570 Lines • ▼ Show 20 Lines | if (user->prop) { | ||||
| if (tex) | if (tex) | ||||
| BLI_snprintf(name, UI_MAX_NAME_STR, " %s - %s", user->name, tex->id.name + 2); | BLI_snprintf(name, UI_MAX_NAME_STR, " %s - %s", user->name, tex->id.name + 2); | ||||
| else | else | ||||
| BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name); | BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name); | ||||
| } | } | ||||
| else | else | ||||
| BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name); | BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name); | ||||
| but = uiDefIconTextBut(block, BUT, 0, user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, | but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, | ||||
| NULL, 0.0, 0.0, 0.0, 0.0, ""); | NULL, 0.0, 0.0, 0.0, 0.0, ""); | ||||
| uiButSetNFunc(but, template_texture_select, MEM_dupallocN(user), NULL); | UI_but_funcN_set(but, template_texture_select, MEM_dupallocN(user), NULL); | ||||
| last_category = user->category; | last_category = user->category; | ||||
| } | } | ||||
| } | } | ||||
| void uiTemplateTextureUser(uiLayout *layout, bContext *C) | void uiTemplateTextureUser(uiLayout *layout, bContext *C) | ||||
| { | { | ||||
| /* texture user selection dropdown menu. the available users have been | /* texture user selection dropdown menu. the available users have been | ||||
| Show All 25 Lines | but = uiDefIconTextMenuBut(block, template_texture_user_menu, NULL, | ||||
| user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, ""); | user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, ""); | ||||
| } | } | ||||
| else { | else { | ||||
| but = uiDefMenuBut(block, template_texture_user_menu, NULL, | but = uiDefMenuBut(block, template_texture_user_menu, NULL, | ||||
| name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, ""); | name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, ""); | ||||
| } | } | ||||
| /* some cosmetic tweaks */ | /* some cosmetic tweaks */ | ||||
| uiButSetMenuFromPulldown(but); | UI_but_type_set_menu_from_pulldown(but); | ||||
| but->flag &= ~UI_ICON_SUBMENU; | but->flag &= ~UI_BUT_ICON_SUBMENU; | ||||
| } | } | ||||
| /************************* Texture Show **************************/ | /************************* Texture Show **************************/ | ||||
| static void template_texture_show(bContext *C, void *data_p, void *prop_p) | static void template_texture_show(bContext *C, void *data_p, void *prop_p) | ||||
| { | { | ||||
| SpaceButs *sbuts = CTX_wm_space_buts(C); | SpaceButs *sbuts = CTX_wm_space_buts(C); | ||||
| ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL; | ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL; | ||||
| Show All 36 Lines | for (user = ct->users.first; user; user = user->next) | ||||
| if (user->ptr.data == ptr->data && user->prop == prop) | if (user->ptr.data == ptr->data && user->prop == prop) | ||||
| break; | break; | ||||
| /* draw button */ | /* draw button */ | ||||
| if (user) { | if (user) { | ||||
| uiBlock *block = uiLayoutGetBlock(layout); | uiBlock *block = uiLayoutGetBlock(layout); | ||||
| uiBut *but; | uiBut *but; | ||||
| but = uiDefIconBut(block, BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y, | but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y, | ||||
| NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab"); | NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab"); | ||||
| uiButSetFunc(but, template_texture_show, user->ptr.data, user->prop); | UI_but_func_set(but, template_texture_show, user->ptr.data, user->prop); | ||||
| } | } | ||||
| } | } | ||||