- removed undefined operators from view3d menu, the error prints
  ("undefined operator") is currently a real error; later on when
  operators are more dynamically defined it can be feature.

- made uiMenuContext() work locally, only on the items as defined
  after this call.
This commit is contained in:
2009-02-03 10:41:48 +00:00
parent 658ac7225f
commit afe28a1a61
3 changed files with 31 additions and 29 deletions

View File

@@ -1819,7 +1819,7 @@ static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle,
y1 -= MENU_BUTTON_HEIGHT;
}
else if(item->type==MENU_ITEM_OPNAME_BOOL) {
but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
but= uiDefIconTextButO(block, BUTM, item->opname, item->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
RNA_boolean_set(uiButGetOperatorPtrRNA(but), item->propname, item->boolval);
y1 -= MENU_BUTTON_HEIGHT;
@@ -1831,19 +1831,19 @@ static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle,
name= ui_menu_enumpropname(item->opname, item->propname, item->enumval);
BLI_strncpy(bname, name, sizeof(bname));
but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, bname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
but= uiDefIconTextButO(block, BUTM, item->opname, item->opcontext, item->icon, bname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
RNA_enum_set(uiButGetOperatorPtrRNA(but), item->propname, item->enumval);
y1 -= MENU_BUTTON_HEIGHT;
}
else if(item->type==MENU_ITEM_OPNAME_FLOAT) {
but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
but= uiDefIconTextButO(block, BUTM, item->opname, item->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
RNA_float_set(uiButGetOperatorPtrRNA(but), item->propname, item->fltval);
y1 -= MENU_BUTTON_HEIGHT;
}
else if(item->type==MENU_ITEM_OPNAME) {
uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
uiDefIconTextButO(block, BUTM, item->opname, item->opcontext, item->icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
y1 -= MENU_BUTTON_HEIGHT;
}
else if(item->type==MENU_ITEM_RNA_BOOL) {
@@ -1954,7 +1954,8 @@ static uiMenuItem *ui_menu_add_item(uiMenuItem *head, const char *name, int icon
else
item->icon= ICON_BLANK1;
item->retval= argval;
item->opcontext= WM_OP_EXEC_REGION_WIN;
item->opcontext= head->opcontext;
BLI_addtail(&head->items, item);

View File

@@ -116,9 +116,6 @@
/* XXX port over */
static void handle_view3d_lock(void) {}
static void allqueue(int x, int y) {}
static void persptoetsen(int x) {}
static void fly(void) {}
static void editmesh_align_view_to_selected(void *x, int y) {}
static void countall(void) {}
extern void borderselect();
static int retopo_mesh_paint_check() {return 0;}
@@ -248,6 +245,7 @@ void do_layer_buttons(bContext *C, short event)
allqueue(REDRAWNLA, 0);
}
#if 0
static void do_view3d_view_camerasmenu(bContext *C, void *arg, int event)
{
Scene *scene= CTX_data_scene(C);
@@ -278,7 +276,7 @@ static void do_view3d_view_camerasmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
#if 0
static uiBlock *view3d_view_camerasmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
@@ -311,6 +309,8 @@ static uiBlock *view3d_view_camerasmenu(bContext *C, ARegion *ar, void *arg_unus
return block;
}
#endif
#if 0
static void do_view3d_view_cameracontrolsmenu(bContext *C, void *arg, int event)
{
switch(event) {
@@ -366,6 +366,7 @@ static void do_view3d_view_cameracontrolsmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
static uiBlock *view3d_view_cameracontrolsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
/* static short tog=0; */
@@ -456,7 +457,7 @@ static void do_view3d_view_alignviewmenu(bContext *C, void *arg, int event)
}
allqueue(REDRAWVIEW3D, 0);
}
#if 0
static uiBlock *view3d_view_alignviewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
/* static short tog=0; */
@@ -483,18 +484,15 @@ static uiBlock *view3d_view_alignviewmenu(bContext *C, ARegion *ar, void *arg_un
uiTextBoundsBlock(block, 50);
return block;
}
#ifndef DISABLE_PYTHON
// XXX static void do_view3d_view_spacehandlers(bContext *C, void *arg, int event)
//{
//}
#endif
#if 0
static uiBlock *view3d_view_spacehandlers(bContext *C, ARegion *ar, void *arg_unused)
{
/* XXX */
return NULL;
}
#endif /* DISABLE_PYTHON */
static void do_view3d_viewmenu(bContext *C, void *arg, int event)
{
@@ -553,12 +551,13 @@ static void do_view3d_viewmenu(bContext *C, void *arg, int event)
}
allqueue(REDRAWVIEW3D, 1);
}
#endif
static void view3d_view_viewnavmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
uiMenuItemO(head, "VIEW3D_OT_view_fly_mode", ICON_BLANK1);
// uiMenuItemO(head, "VIEW3D_OT_view_fly_mode", ICON_BLANK1);
uiMenuSeparator(head);
// uiMenuSeparator(head);
uiMenuItemEnumO(head, "VIEW3D_OT_view_orbit", "type", V3D_VIEW_STEPLEFT);
uiMenuItemEnumO(head, "VIEW3D_OT_view_orbit", "type", V3D_VIEW_STEPRIGHT);
@@ -590,13 +589,13 @@ static void view3d_viewmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
uiMenuItemO(head, "VIEW3D_OT_toggle_transform_orientations_panel", ICON_MENU_PANEL); // Transform Orientations...
uiMenuItemO(head, "VIEW3D_OT_toggle_render_preview_panel", ICON_MENU_PANEL); // render preview...
uiMenuItemO(head, "VIEW3D_OT_toggle_view_properties_panel", ICON_MENU_PANEL); // View Properties....
uiMenuItemO(head, "VIEW3D_OT_toggle_background_image_panel", ICON_MENU_PANEL); // Background Image....
uiMenuItemO(head, "VIEW3D_OT_toggle_grease_pencil_panel", ICON_MENU_PANEL); // Grease Pencil....
// uiMenuItemO(head, "VIEW3D_OT_toggle_transform_orientations_panel", ICON_MENU_PANEL); // Transform Orientations...
// uiMenuItemO(head, "VIEW3D_OT_toggle_render_preview_panel", ICON_MENU_PANEL); // render preview...
// uiMenuItemO(head, "VIEW3D_OT_toggle_view_properties_panel", ICON_MENU_PANEL); // View Properties....
// uiMenuItemO(head, "VIEW3D_OT_toggle_background_image_panel", ICON_MENU_PANEL); // Background Image....
// uiMenuItemO(head, "VIEW3D_OT_toggle_grease_pencil_panel", ICON_MENU_PANEL); // Grease Pencil....
uiMenuSeparator(head);
// uiMenuSeparator(head);
uiMenuItemEnumO(head, "VIEW3D_OT_viewnumpad", "view", V3D_VIEW_CAMERA);
uiMenuItemEnumO(head, "VIEW3D_OT_viewnumpad", "view", V3D_VIEW_TOP);
@@ -611,14 +610,14 @@ static void view3d_viewmenu(bContext *C, uiMenuItem *head, void *arg_unused)
uiMenuSeparator(head);
uiMenuItemO(head, "VIEW3D_OT_view_show_all_layers", ICON_BLANK1);
// uiMenuItemO(head, "VIEW3D_OT_view_show_all_layers", ICON_BLANK1);
uiMenuSeparator(head);
// uiMenuSeparator(head);
uiMenuItemO(head, "VIEW3D_OT_view_local_view", ICON_BLANK1);
uiMenuItemO(head, "VIEW3D_OT_view_global_view", ICON_BLANK1);
// uiMenuItemO(head, "VIEW3D_OT_view_local_view", ICON_BLANK1);
// uiMenuItemO(head, "VIEW3D_OT_view_global_view", ICON_BLANK1);
uiMenuSeparator(head);
// uiMenuSeparator(head);
uiMenuLevel(head, "View Navigation", view3d_view_viewnavmenu);
uiMenuLevel(head, "Align View", view3d_view_alignviewmenu);

View File

@@ -45,10 +45,12 @@ struct wmWindowManager;
/* context to call operator in for WM_operator_name_call */
enum {
/* if there's invoke, call it, otherwise exec */
WM_OP_INVOKE_DEFAULT,
WM_OP_INVOKE_REGION_WIN,
WM_OP_INVOKE_AREA,
WM_OP_INVOKE_SCREEN,
/* only call exec */
WM_OP_EXEC_DEFAULT,
WM_OP_EXEC_REGION_WIN,
WM_OP_EXEC_AREA,