Changing names of the 3d view directions in the appropriate scripts?

Hello all together.

We know that Blender defines the view presets for the 3D View from the user’s perspective.

As an example choosing ‘left’ from the view menu (or shortcut ctrl+numpad 3) offers a view ‘from the left side’. Blender shows me the side of the object that lies left viewed from my front perspective.

Apparently I think (or see) different than others. Anyway this interpretation of view directions doesn’t match to what I mean if I want to look at an object ‘from the left side’ and therefor I would like to change the shortcuts for operations like this.

If I want to look at an object from the left side I mean that I want to see the left side of the object. For the default preferences in Blender this means ‘right’ (the side of the object that is ‘right hand side’ from the user’s front perspective.

So I would define ‘numpad 3’ as ‘left’ in order to make the object rotate to the left so I can see the right side of the object. ‘ctrl+numpad 3’ would be ‘right’ then in order to make the object turn to the right so I can see the left side of the object.

My point now:

A) After changing the shortcuts the names of the view directions stay the same for the time beeing. How can I change the names in the appropriate script that way that ‘right’ is displayed when typing ‘numpad 3’ and ‘left’ is displayed when typing ‘ctrl+numpad 3’?

B)
How can I change the names of the directions in the script for the appropriate pie menu in 2.72 also?

C)
Last but not least: How can I change the positions of the entries for the view directions in the appropriate pie menu? In any case I would have to move the ‘right’ button to the right side and the ‘left’ button to the left side after changing the names.

I would be really grateful for help and support.

animax

PS: Please excuse my poor English.

You would have to change the labels in the C code of Blender and compile your own version, as the viewnumpad operator is not python-defined.

The menu itself it python-defined however, so you could do some cosmetics in startup\bl_ui\space_view3d.py:

class VIEW3D_MT_view(Menu):
    bl_label = "View"

    def draw(self, context):
        layout = self.layout

        layout.operator("view3d.properties", icon='MENU_PANEL')
        layout.operator("view3d.toolshelf", icon='MENU_PANEL')

        layout.separator()

        layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
        layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
        layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
        layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
        layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
        layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
        layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'

You would have to overrule the labels in a pie menu as well.

Note that you can’t do this as addon, unless you replace the entire menu (which I highly discourage, it may even leak memory).

Thanks a lot.

Compiling seems to require much work. I’ve never done that before. It looks like I will have to get used to blenders default settings.

I have an other question referred to your answer. Do I have the option to change the order of the rows which specify the positions of the buttons in the pie menu for the shading mode for example and can you tell me the location of the pie menus official addon’s script in 2.72?

Well, if you replace e.g.

    pie.operator_enum("mesh.select_mode", "type")

with

    pie.operator("mesh.select_mode", icon='VERTEXSEL').type = 'VERT'
    pie.operator("mesh.select_mode", icon='EDGESEL').type = 'EDGE'
    pie.operator("mesh.select_mode", icon='FACESEL').type = 'FACE'

then yes, the order of operator() calls determines the order in the radial menu.

Go to user prefs > addons and search for “pie”, it will tell you the path (… scripts\addons\ui_pie_menus_official.py)

Thank you.

Well the expression you mention in your answer

pie.operator_enum(“mesh.select_mode”, “type”)

is found by opening ‘Templates > Python > Ui Pie Menu’ in the text editor inside blender but not in the addon.

I know there is a tutorial by Sebastian König which describes how to script your own pie menus. In this tutorial Sebastian uses the template I mention above.

But I am looking for the expressions which determine the default menus (snap, pivot, manipulator, view, shade and mode). I have been searching for a while but can’t identify them in the addon. Do you know which script contains those expressions?

Thank you.

The expression

pie.operator_enum(“mesh.select_mode”, “type”)

is part of the script

templates > Python > Ui Pie Menu

one can find in the text editor in blender.

I know that there is the option to code one’s own scripts. But I am looking for the lines that determine the default pie menus which come with 2.72 as the mentioned addon (snap, pivot, manipulator, view, shade and mode).

Can you tell me where I can find the appropriate parts of the script?

EDIT:

Your expression

pie.operator(“mesh.select_mode”, icon=‘VERTEXSEL’).type = ‘VERT’
pie.operator(“mesh.select_mode”, icon=‘EDGESEL’).type = ‘EDGE’
pie.operator(“mesh.select_mode”, icon=‘FACESEL’).type = ‘FACE’

didn’t work. I found out that

pie.operator(“mesh.select_mode”, text=‘Vertices’)
pie.operator(“mesh.select_mode”, text=‘Edges’)
pie.operator(“mesh.select_mode”, text=‘Faces’)

would be the appropriate expression wouldn’t it?

Or

pie.operator(“mesh.select_mode”, icon=‘VERTEXSEL’, text=‘Vertices’)
pie.operator(“mesh.select_mode”, icon=‘EDGESEL’, text=‘Edges’)
pie.operator(“mesh.select_mode”, icon=‘FACESEL’, text=‘Faces’)

if you want to include display of the icons.

Thank you.

The expression

pie.operator_enum(“mesh.select_mode”, “type”)

is part of the script

templates > Python > Ui Pie Menu

one can find in the text editor in blender.

But I am looking for the lines that determine the default pie menus which come with 2.72 as the mentioned addon (snap, pivot, manipulator, view, shade and mode).

Can you tell me where I can find the appropriate parts of the script?

I believe you wanna know how operator_enum() works… well, it’s hardcoded, check the C source if you want to know more about it. You can’t change the behavior (and thus the order of the items) with python, unless you create new enums yourself to control the order.

My code works fine here, and the .type = * is really important, you must not remove it…