[Bf-blender-cvs] [eb63b32deea] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Sat Jun 30 13:52:23 CEST 2018


Commit: eb63b32deea5772a5947cb6b77d2a89b1d22e6d1
Author: Campbell Barton
Date:   Sat Jun 30 13:52:04 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBeb63b32deea5772a5947cb6b77d2a89b1d22e6d1

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/editors/include/UI_interface.h
index b30ae67a3bd,f4f7945a8eb..dcfb1ac3219
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@@ -1140,23 -1045,9 +1140,23 @@@ void uiItemsFullEnumO_items
  
  void uiItemL(uiLayout *layout, const char *name, int icon); /* label */
  void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); /* label icon for dragging */
- void uiItemM(uiLayout *layout, struct bContext *C, const char *menuname, const char *name, int icon); /* menu */
+ void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon); /* menu */
  void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */
  void uiItemS(uiLayout *layout); /* separator */
 +void uiItemSpacer(uiLayout *layout); /* Special separator. */
 +
 +void uiItemPopoverPanel_ptr(
 +        uiLayout *layout, struct bContext *C,
 +        struct PanelType *pt,
 +        const char *name, int icon);
 +void uiItemPopoverPanel(
 +        uiLayout *layout, struct bContext *C,
 +        int space_id, int region_id, const char *panelname,
 +        const char *name, int icon);
 +void uiItemPopoverPanelFromGroup(
 +        uiLayout *layout, struct bContext *C,
 +        int space_id, int region_id,
 +        const char *context, const char *category);
  
  void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg);
  void uiItemMenuEnumO_ptr(uiLayout *layout, struct bContext *C, struct wmOperatorType *ot, const char *propname, const char *name, int icon);
diff --cc source/blender/editors/interface/interface_templates.c
index 9f5e0b9f26e,4838bdf524e..de5ba65b4a7
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@@ -3941,10 -3523,10 +3941,10 @@@ eAutoPropButsReturn uiTemplateOperatorP
  		PointerRNA op_ptr;
  		uiLayout *row;
  
 -		uiLayoutGetBlock(layout)->ui_operator = op;
 +		block->ui_operator = op;
  
  		row = uiLayoutRow(layout, true);
- 		uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NONE);
+ 		uiItemM(row, "WM_MT_operator_presets", NULL, ICON_NONE);
  
  		wmOperatorType *ot = WM_operatortype_find("WM_OT_operator_preset_add", false);
  		uiItemFullO_ptr(row, ot, "", ICON_ZOOMIN, NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
diff --cc source/blender/editors/screen/screen_user_menu.c
index f36bceaa129,00000000000..382f6cac474
mode 100644,000000..100644
--- a/source/blender/editors/screen/screen_user_menu.c
+++ b/source/blender/editors/screen/screen_user_menu.c
@@@ -1,196 -1,0 +1,195 @@@
 +/*
 + * ***** BEGIN GPL LICENSE BLOCK *****
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * The Original Code is Copyright (C) 2009 Blender Foundation.
 + * All rights reserved.
 + *
 + *
 + * Contributor(s): Blender Foundation
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + */
 +
 +/** \file blender/editors/screen/screen_user_menu.c
 + *  \ingroup spview3d
 + */
 +
 +#include <string.h>
 +#include <stdio.h>
 +#include <math.h>
 +#include <float.h>
 +
 +#include "DNA_scene_types.h"
 +
 +#include "MEM_guardedalloc.h"
 +
 +#include "BLI_utildefines.h"
 +#include "BLI_listbase.h"
 +#include "BLI_string.h"
 +
 +#include "BLT_translation.h"
 +
 +#include "BKE_blender_user_menu.h"
 +#include "BKE_context.h"
 +#include "BKE_screen.h"
 +#include "BKE_idprop.h"
 +
 +#include "WM_api.h"
 +#include "WM_types.h"
 +
 +#include "ED_screen.h"
 +
 +#include "UI_interface.h"
 +#include "UI_resources.h"
 +
 +/* -------------------------------------------------------------------- */
 +/** \name Menu Type
 + * \{ */
 +
 +bUserMenu *ED_screen_user_menu_find(bContext *C)
 +{
 +	SpaceLink *sl = CTX_wm_space_data(C);
 +	const char *context = CTX_data_mode_string(C);
 +	return BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context);
 +}
 +
 +bUserMenu *ED_screen_user_menu_ensure(bContext *C)
 +{
 +	SpaceLink *sl = CTX_wm_space_data(C);
 +	const char *context = CTX_data_mode_string(C);
 +	return BKE_blender_user_menu_ensure(&U.user_menus, sl->spacetype, context);
 +}
 +
 +/** \} */
 +
 +/* -------------------------------------------------------------------- */
 +/** \name Menu Item
 + * \{ */
 +
 +bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(
 +        ListBase *lb,
 +        const wmOperatorType *ot, IDProperty *prop, short opcontext)
 +{
 +	for (bUserMenuItem *umi = lb->first; umi; umi = umi->next) {
 +		if (umi->type == USER_MENU_TYPE_OPERATOR) {
 +			bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)umi;
 +			if (STREQ(ot->idname, umi_op->opname) &&
 +			    (opcontext == umi_op->opcontext) &&
 +			    (IDP_EqualsProperties(prop, umi_op->prop)))
 +			{
 +				return umi_op;
 +			}
 +		}
 +	}
 +	return NULL;
 +}
 +
 +struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu(
 +        struct ListBase *lb,
 +        const struct MenuType *mt)
 +{
 +	for (bUserMenuItem *umi = lb->first; umi; umi = umi->next) {
 +		if (umi->type == USER_MENU_TYPE_MENU) {
 +			bUserMenuItem_Menu *umi_mt = (bUserMenuItem_Menu *)umi;
 +			if (STREQ(mt->idname, umi_mt->mt_idname)) {
 +				return umi_mt;
 +			}
 +		}
 +	}
 +	return NULL;
 +}
 +
 +void ED_screen_user_menu_item_add_operator(
 +        ListBase *lb, const char *ui_name,
 +        const wmOperatorType *ot, const IDProperty *prop, short opcontext)
 +{
 +	bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)BKE_blender_user_menu_item_add(lb, USER_MENU_TYPE_OPERATOR);
 +	umi_op->opcontext = opcontext;
 +	if (!STREQ(ui_name, ot->name)) {
 +		STRNCPY(umi_op->item.ui_name, ui_name);
 +	}
 +	STRNCPY(umi_op->opname, ot->idname);
 +	umi_op->prop = prop ? IDP_CopyProperty(prop) : NULL;
 +}
 +
 +void ED_screen_user_menu_item_add_menu(
 +        ListBase *lb, const char *ui_name,
 +        const MenuType *mt)
 +{
 +	bUserMenuItem_Menu *umi_mt = (bUserMenuItem_Menu *)BKE_blender_user_menu_item_add(lb, USER_MENU_TYPE_MENU);
 +	if (!STREQ(ui_name, mt->idname)) {
 +		STRNCPY(umi_mt->item.ui_name, ui_name);
 +	}
 +	STRNCPY(umi_mt->mt_idname, mt->idname);
 +}
 +
 +void ED_screen_user_menu_item_remove(ListBase *lb, bUserMenuItem *umi)
 +{
 +	BLI_remlink(lb, umi);
 +	BKE_blender_user_menu_item_free(umi);
 +}
 +
 +/** \} */
 +
 +/* -------------------------------------------------------------------- */
 +/** \name Menu Definition
 + * \{ */
 +
 +static void screen_user_menu_draw(const bContext *C, Menu *menu)
 +{
 +	SpaceLink *sl = CTX_wm_space_data(C);
 +	const char *context = CTX_data_mode_string(C);
 +	bUserMenu *um_array[] = {
 +		BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context),
 +		(sl->spacetype != SPACE_TOPBAR) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_TOPBAR, context) : NULL,
 +	};
 +	for (int um_index = 0; um_index < ARRAY_SIZE(um_array); um_index++) {
 +		bUserMenu *um = um_array[um_index];
 +		if (um == NULL) {
 +			continue;
 +		}
 +		for (bUserMenuItem *umi = um->items.first; umi; umi = umi->next) {
 +			if (umi->type == USER_MENU_TYPE_OPERATOR) {
 +				bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)umi;
 +				IDProperty *prop = umi_op->prop ? IDP_CopyProperty(umi_op->prop) : NULL;
 +				uiItemFullO(
 +				        menu->layout, umi_op->opname, umi->ui_name[0] ? umi->ui_name : NULL,
 +				        ICON_NONE, prop, umi_op->opcontext, 0, NULL);
 +			}
 +			else if (umi->type == USER_MENU_TYPE_MENU) {
 +				bUserMenuItem_Menu *umi_mt = (bUserMenuItem_Menu *)umi;
- 				uiItemM(
- 				        menu->layout, NULL, umi_mt->mt_idname, umi->ui_name[0] ? umi->ui_name : NULL,
++				uiItemM(menu->layout, umi_mt->mt_idname, umi->ui_name[0] ? umi->ui_name : NULL,
 +				        ICON_NONE);
 +			}
 +			else if (umi->type == USER_MENU_TYPE_SEP) {
 +				uiItemS(menu->layout);
 +			}
 +		}
 +	}
 +}
 +
 +void ED_screen_user_menu_register(void)
 +{
 +	MenuType *mt = MEM_callocN(sizeof(MenuType), __func__);
 +	strcpy(mt->idname, "SCREEN_MT_user_menu");
 +	strcpy(mt->label, "Quick Favorites");
 +	strcpy(mt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
 +	mt->draw = screen_user_menu_draw;
 +	WM_menutype_add(mt);
 +}
 +
 +/** \} */
diff --cc source/blender/makesrna/intern/rna_ui_api.c
index 943e6c2e31f,328c6dd3eea..f960cff1cd2
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@@ -272,32 -272,9 +272,32 @@@ static void rna_uiItemM
  		icon = icon_value;
  	}
  
- 	uiItemM(layout, C, menuname, name, icon);
+ 	uiItemM(layout, menuname, name, icon);
  }
  
 +static void rna_uiItemPopoverPanel(
 +        uiLayout *layout, bContext *C,
 +        int space_type, int region_type, const char *panel_type,
 +        const char *name, const char *text_ctxt,
 +        int translate, int icon, int icon_value)
 +{
 +	/* Get translated name (label). */
 +	name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
 +
 +	if (icon_value && !icon) {
 +		icon = icon_value;
 +	}
 +
 +	uiItemPopoverPanel(layout, C, space_type, region_type, panel_type, name, icon);
 +}
 +
 +static void rna_uiItemPopoverPanelFromGroup(
 +        uiLayout *layout, bContext *C,
 +        int space_id, int region_id, const char *context, const char *category)
 +{
 +	uiItemPopoverPanelFromGroup(layout, C, space_id, region_id, context, category);
 +}
 +
  static void rna_uiTemplateAnyID(
          uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
          const char *name, const char *text_ctxt, int translate)



More information about the Bf-blender-cvs mailing list