Page MenuHome

(2.5) python menus for the view3d header
Closed, ArchivedPublicPATCH

Description

this patch adds a context function to retrieve the "mode string" and make them available to python so that view3d header can have python menus

it's just a first pass to see if I get it right...

what I've done so far:
- created CTX_data_mode_string() to find out what mode we're in (accessible as a string from RNA as context.mode_string)

- wrapped view3d_header.c:view3d_select_*menu() so they can be used from python as layout.view3d_select_*menu()

- defined view3d "select" menus in python (using wrapped functions)

- moved mode-switch for select menus from view3d_header.c:view3d_header_pulldowns() to python

- implemented the "select" menu for mesh editmode in python as a test

Event Timeline

new version of the patch

all "Select" menus have been implemented in python
editmode_armature and posemode still need the C function... is there a way to use uiItemFullO from python?

Instead of checking the mode_string with if/elif the header now lookup the menu by name, to do this I had to change the strings in CTX_data_mode_string(), some of them where too long and the resulting bpy.types.Menu class names didn't get registered.

another update

- rebased to rev 22472
- I've removed C functions that have been ported to python
- select menus are looked for in bpy.types instead of static list
- there's an error in objectmode select menu that I haven't looked into yet (uiItemEnumO_string: OBJECT_OT_select_grouped.type, enum not found.)

Patch in SVN. Thank you :)

Thomas Dinges (dingto) changed the task status from Unknown Status to Unknown Status.Aug 15 2009, 9:46 PM