Beispiel #1
0
static PointerRNA rna_uiItemO(
        uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
        bool translate, int icon, bool emboss, bool depress, int icon_value)
{
	wmOperatorType *ot;

	ot = WM_operatortype_find(opname, 0); /* print error next */
	if (!ot || !ot->srna) {
		RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
		return PointerRNA_NULL;
	}

	/* Get translated name (label). */
	name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);

	if (icon_value && !icon) {
		icon = icon_value;
	}
	int flag = (emboss) ? 0 : UI_ITEM_R_NO_BG;
	flag |= (depress) ? UI_ITEM_O_DEPRESS : 0;

	PointerRNA opptr;
	uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag, &opptr);
	return opptr;
}
Beispiel #2
0
static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
                              int translate, int icon, int emboss)
{
	wmOperatorType *ot;
	int flag;

	ot = WM_operatortype_find(opname, 0); /* print error next */
	if (!ot || !ot->srna) {
		RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
		return PointerRNA_NULL;
	}

	/* Get translated name (label). */
	name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);

	flag = UI_ITEM_O_RETURN_PROPS;
	flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;

	return uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
}
Beispiel #3
0
static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, int icon, int emboss)
{
    int flag = UI_ITEM_O_RETURN_PROPS;
    flag |= (emboss)? 0: UI_ITEM_R_NO_BG;
    return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
}
Beispiel #4
0
static int rna_UILayout_op_context_get(PointerRNA *ptr)
{
	return uiLayoutGetOperatorContext(ptr->data);
}