patch [#24800] Make scene type buttons from material preview optional

from Wenzel Jakob (wenzel)
This commit is contained in:
Campbell Barton 2010-11-19 07:46:23 +00:00
parent ab72823917
commit 3066d82662
4 changed files with 5 additions and 4 deletions

@ -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);

@ -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;

@ -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.");

@ -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){}