Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-22 07:30:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-22 07:30:07 +0400
commitb1667911ef88e067817cb1702695a0d1e350dd78 (patch)
tree303dff319b59b89516127c065f9486e4dfd53975 /source/blender/editors/util
parent6964b5a6c48f2fab19b4ce5a52ba23525a5f05eb (diff)
reduce operator lookups in the UI (could do 4 hash lookups per button).
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/ed_util.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 73322a8292d..a40c6cfa42f 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -58,6 +58,7 @@
#include "UI_resources.h"
#include "WM_types.h"
+#include "WM_api.h"
#include "RNA_access.h"
@@ -165,12 +166,13 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
uiPopupMenu *pup;
uiLayout *layout;
char line[FILE_MAX + 100];
+ wmOperatorType *ot = WM_operatortype_find(opname, 1);
pup= uiPupMenuBegin(C, "Unpack file", ICON_NONE);
layout= uiPupMenuLayout(pup);
strcpy(line, "Remove Pack");
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_REMOVE);
RNA_string_set(&props_ptr, "id", id_name);
@@ -184,29 +186,29 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
switch(checkPackedFile(local_name, pf)) {
case PF_NOFILE:
BLI_snprintf(line, sizeof(line), "Create %s", local_name);
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
RNA_string_set(&props_ptr, "id", id_name);
break;
case PF_EQUAL:
BLI_snprintf(line, sizeof(line), "Use %s (identical)", local_name);
- //uiItemEnumO(layout, opname, line, 0, "method", PF_USE_LOCAL);
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ //uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
RNA_string_set(&props_ptr, "id", id_name);
break;
case PF_DIFFERS:
BLI_snprintf(line, sizeof(line), "Use %s (differs)", local_name);
- //uiItemEnumO(layout, opname, line, 0, "method", PF_USE_LOCAL);
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ //uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
RNA_string_set(&props_ptr, "id", id_name);
BLI_snprintf(line, sizeof(line), "Overwrite %s", local_name);
- //uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_LOCAL);
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ //uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_LOCAL);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
RNA_string_set(&props_ptr, "id", id_name);
break;
@@ -217,28 +219,28 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
switch(checkPackedFile(abs_name, pf)) {
case PF_NOFILE:
BLI_snprintf(line, sizeof(line), "Create %s", abs_name);
- //uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_ORIGINAL);
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ //uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
RNA_string_set(&props_ptr, "id", id_name);
break;
case PF_EQUAL:
BLI_snprintf(line, sizeof(line), "Use %s (identical)", abs_name);
- //uiItemEnumO(layout, opname, line, 0, "method", PF_USE_ORIGINAL);
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ //uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
RNA_string_set(&props_ptr, "id", id_name);
break;
case PF_DIFFERS:
BLI_snprintf(line, sizeof(line), "Use %s (differs)", abs_name);
- //uiItemEnumO(layout, opname, line, 0, "method", PF_USE_ORIGINAL);
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ //uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
RNA_string_set(&props_ptr, "id", id_name);
BLI_snprintf(line, sizeof(line), "Overwrite %s", abs_name);
- //uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_ORIGINAL);
- props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ //uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
+ props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
RNA_string_set(&props_ptr, "id", id_name);
break;