diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 206ff45b2b3..c0b2843d62b 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -687,7 +687,7 @@ void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, const char struct PointerRNA *root_ptr, const char *text); uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr); -void uiTemplatePreview(uiLayout *layout, struct ID *id, struct ID *parent, struct MTex *slot); +void uiTemplatePreview(uiLayout *layout, struct ID *id, int show_buttons, struct ID *parent, struct MTex *slot); void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int expand); void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index d9541e33040..9ad06464353 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1055,7 +1055,7 @@ static void do_preview_buttons(bContext *C, void *arg, int event) } } -void uiTemplatePreview(uiLayout *layout, ID *id, ID *parent, MTex *slot) +void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, MTex *slot) { uiLayout *row, *col; uiBlock *block; @@ -1103,7 +1103,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, ID *parent, MTex *slot) uiBlockSetHandleFunc(block, do_preview_buttons, NULL); /* add buttons */ - if(pid) { + if (pid && show_buttons) { if(GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) { if(GS(pid->name) == ID_MA) ma= (Material*)pid; else ma= (Material*)pparent; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index f2df5c92aae..378d6455fe7 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -327,6 +327,7 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps, etc."); parm= RNA_def_pointer(func, "id", "ID", "", "ID datablock."); RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_boolean(func, "show_buttons", 1, "", "Show preview buttons?"); RNA_def_pointer(func, "parent", "ID", "", "ID datablock."); RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot."); diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index e1683fe972e..9ef25174a27 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -314,7 +314,7 @@ void uiTemplateHeader(struct uiLayout *layout, struct bContext *C, int menus){} void uiTemplateID(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, char *newop, char *unlinkop){} struct uiLayout *uiTemplateModifier(struct uiLayout *layout, struct PointerRNA *ptr){return (struct uiLayout *) NULL;} struct uiLayout *uiTemplateConstraint(struct uiLayout *layout, struct PointerRNA *ptr){return (struct uiLayout *) NULL;} -void uiTemplatePreview(struct uiLayout *layout, struct ID *id, struct ID *parent, struct MTex *slot){} +void uiTemplatePreview(struct uiLayout *layout, struct ID *id, int show_buttons, struct ID *parent, struct MTex *slot){} void uiTemplateIDPreview(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols){} void uiTemplateCurveMapping(struct uiLayout *layout, struct CurveMapping *cumap, int type, int compact){} void uiTemplateColorRamp(struct uiLayout *layout, struct ColorBand *coba, int expand){}