python access to operators now hides the _OT_ syntax, eg. SOME_OT_operator -> some.operator

this works for the calling operators from python and using the RNA api.

bpy.ops.CONSOLE_exec() is now bpy.ops.console.exec()

eg.
split.itemO("PARTICLE_OT_editable_set", text="Free Edit") becomes... split.itemO("particle.editable_set", text="Free Edit")

For now any operator thats called checks if its missing _OT_ and assumes its python syntax and converts it before doing the lookup.

bpy.ops is a python class in release/ui/bpy_ops.py which does the fake submodules and conversion, the C operator api is at bpy.__ops__

personally Id still rather rename C id-names not to contain the _OT_ text which would avoid the conversion, its called a lot since the UI has to convert the operators.
This commit is contained in:
Campbell Barton 2009-07-17 12:26:40 +00:00
parent 1ef7293585
commit a705f64245
27 changed files with 485 additions and 305 deletions

107
release/ui/bpy_ops.py Normal file
View File

@ -0,0 +1,107 @@
import bpy
# This class is used for bpy.ops
#
class bpy_ops(object):
'''
Fake module like class.
bpy.ops
'''
def add(self, pyop):
bpy.__ops__.add(pyop)
def remove(self, pyop):
bpy.__ops__.remove(pyop)
def __getattr__(self, module):
'''
gets a bpy.ops submodule
'''
return bpy_ops_submodule(module)
def __dir__(self):
submodules = set()
for id_name in dir(bpy.__ops__):
if id_name.startswith('__'):
continue
id_split = id_name.split('_OT_', 1)
if len(id_split) == 2:
submodules.add(id_split[0].lower())
else:
submodules.add(id_split[0])
return list(submodules)
def __repr__(self):
return "<module like class 'bpy.ops'>"
class bpy_ops_submodule(object):
'''
Utility class to fake submodules.
eg. bpy.ops.object
'''
__keys__ = ('module',)
def __init__(self, module):
self.module = module
def __getattr__(self, func):
'''
gets a bpy.ops.submodule function
'''
return bpy_ops_submodule_op(self.module, func)
def __dir__(self):
functions = set()
module_upper = self.module.upper()
for id_name in dir(bpy.__ops__):
if id_name.startswith('__'):
continue
id_split = id_name.split('_OT_', 1)
if len(id_split) == 2 and module_upper == id_split[0]:
functions.add(id_split[1])
return list(functions)
def __repr__(self):
return "<module like class 'bpy.ops.%s'>" % self.module
class bpy_ops_submodule_op(object):
'''
Utility class to fake submodule operators.
eg. bpy.ops.object.somefunc
'''
__keys__ = ('module', 'func')
def __init__(self, module, func):
self.module = module
self.func = func
def __call__(self, **kw):
# submod.foo -> SUBMOD_OT_foo
id_name = self.module.upper() + '_OT_' + self.func
# Get the operator from
internal_op = getattr(bpy.__ops__, id_name)
# Call the op
return internal_op(**kw)
def __repr__(self):
return "<function bpy.ops.%s.%s at 0x%x'>" % (self.module, self.func, id(self))
bpy.ops = bpy_ops()

View File

@ -52,7 +52,7 @@ class DATA_PT_lattice(DataButtonsPanel):
row.itemR(lat, "interpolation_type_w", expand=True)
row = layout.row()
row.itemO("LATTICE_OT_make_regular")
row.itemO("lattice.make_regular")
row.itemR(lat, "outside")
bpy.types.register(DATA_PT_context_lattice)

View File

@ -68,15 +68,15 @@ class DATA_PT_materials(DataButtonsPanel):
row.template_list(ob, "materials", ob, "active_material_index")
col = row.column(align=True)
col.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("object.material_slot_add", icon="ICON_ZOOMIN", text="")
col.itemO("object.material_slot_remove", icon="ICON_ZOOMOUT", text="")
if context.edit_object:
row = layout.row(align=True)
row.itemO("OBJECT_OT_material_slot_assign", text="Assign")
row.itemO("OBJECT_OT_material_slot_select", text="Select")
row.itemO("OBJECT_OT_material_slot_deselect", text="Deselect")
row.itemO("object.material_slot_assign", text="Assign")
row.itemO("object.material_slot_select", text="Select")
row.itemO("object.material_slot_deselect", text="Deselect")
"""
layout.itemS()
@ -87,8 +87,8 @@ class DATA_PT_materials(DataButtonsPanel):
row.template_list(ob, "materials", ob, "active_material_index", compact=True)
subrow = row.row(align=True)
subrow.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
subrow.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
subrow.itemO("object.material_slot_add", icon="ICON_ZOOMIN", text="")
subrow.itemO("object.material_slot_remove", icon="ICON_ZOOMOUT", text="")
"""
class DATA_PT_vertex_groups(DataButtonsPanel):
@ -107,20 +107,20 @@ class DATA_PT_vertex_groups(DataButtonsPanel):
row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index")
col = row.column(align=True)
col.itemO("OBJECT_OT_vertex_group_add", icon="ICON_ZOOMIN", text="")
col.itemO("OBJECT_OT_vertex_group_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("object.vertex_group_add", icon="ICON_ZOOMIN", text="")
col.itemO("object.vertex_group_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("OBJECT_OT_vertex_group_copy", icon="ICON_BLANK1", text="")
col.itemO("object.vertex_group_copy", icon="ICON_BLANK1", text="")
if ob.data.users > 1:
col.itemO("OBJECT_OT_vertex_group_copy_to_linked", icon="ICON_BLANK1", text="")
col.itemO("object.vertex_group_copy_to_linked", icon="ICON_BLANK1", text="")
if context.edit_object:
row = layout.row(align=True)
row.itemO("OBJECT_OT_vertex_group_assign", text="Assign")
row.itemO("OBJECT_OT_vertex_group_remove_from", text="Remove")
row.itemO("OBJECT_OT_vertex_group_select", text="Select")
row.itemO("OBJECT_OT_vertex_group_deselect", text="Deselect")
row.itemO("object.vertex_group_assign", text="Assign")
row.itemO("object.vertex_group_remove_from", text="Remove")
row.itemO("object.vertex_group_select", text="Select")
row.itemO("object.vertex_group_deselect", text="Deselect")
layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight")
@ -143,8 +143,8 @@ class DATA_PT_shape_keys(DataButtonsPanel):
col = row.column()
subcol = col.column(align=True)
subcol.itemO("OBJECT_OT_shape_key_add", icon="ICON_ZOOMIN", text="")
subcol.itemO("OBJECT_OT_shape_key_remove", icon="ICON_ZOOMOUT", text="")
subcol.itemO("object.shape_key_add", icon="ICON_ZOOMIN", text="")
subcol.itemO("object.shape_key_remove", icon="ICON_ZOOMOUT", text="")
if kb:
col.itemS()
@ -189,8 +189,8 @@ class DATA_PT_uv_texture(DataButtonsPanel):
row.template_list(me, "uv_textures", me, "active_uv_texture_index")
col = row.column(align=True)
col.itemO("MESH_OT_uv_texture_add", icon="ICON_ZOOMIN", text="")
col.itemO("MESH_OT_uv_texture_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("mesh.uv_texture_add", icon="ICON_ZOOMIN", text="")
col.itemO("mesh.uv_texture_remove", icon="ICON_ZOOMOUT", text="")
class DATA_PT_vertex_colors(DataButtonsPanel):
__idname__ = "DATA_PT_vertex_colors"
@ -205,8 +205,8 @@ class DATA_PT_vertex_colors(DataButtonsPanel):
row.template_list(me, "vertex_colors", me, "active_vertex_color_index")
col = row.column(align=True)
col.itemO("MESH_OT_vertex_color_add", icon="ICON_ZOOMIN", text="")
col.itemO("MESH_OT_vertex_color_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("mesh.vertex_color_add", icon="ICON_ZOOMIN", text="")
col.itemO("mesh.vertex_color_remove", icon="ICON_ZOOMOUT", text="")
bpy.types.register(DATA_PT_context_mesh)
bpy.types.register(DATA_PT_mesh)

View File

@ -15,7 +15,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout = self.layout
row = layout.row()
row.item_menu_enumO("OBJECT_OT_modifier_add", "type")
row.item_menu_enumO("object.modifier_add", "type")
row.itemL();
for md in ob.modifiers:
@ -264,7 +264,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "invert")
layout.itemS()
layout.itemO("OBJECT_OT_modifier_mdef_bind", text="Bind")
layout.itemO("object.modifier_mdef_bind", text="Bind")
row = layout.row()
row.itemR(md, "precision")
row.itemR(md, "dynamic")
@ -289,7 +289,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
def multires(self, layout, ob, md):
layout.itemR(md, "subdivision_type")
layout.itemO("OBJECT_OT_multires_subdivide", text="Subdivide")
layout.itemO("object.multires_subdivide", text="Subdivide")
layout.itemR(md, "level")
def particleinstance(self, layout, ob, md):

View File

@ -40,13 +40,13 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
row.template_list(ob, "materials", ob, "active_material_index")
col = row.column(align=True)
col.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("object.material_slot_add", icon="ICON_ZOOMIN", text="")
col.itemO("object.material_slot_remove", icon="ICON_ZOOMOUT", text="")
split = layout.split(percentage=0.65)
if ob and slot:
split.template_ID(slot, "material", new="MATERIAL_OT_new")
split.template_ID(slot, "material", new="material.new")
row = split.row()
row.itemR(slot, "link", expand=True)
elif mat:

View File

@ -110,8 +110,8 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.itemR(con, "sizez", text="Z")
row = layout.row()
row.itemO("CONSTRAINT_OT_childof_set_inverse")
row.itemO("CONSTRAINT_OT_childof_clear_inverse")
row.itemO("constraint.childof_set_inverse")
row.itemO("constraint.childof_clear_inverse")
def track_to(self, layout, con):
self.target_template(layout, con)
@ -521,7 +521,7 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel):
layout = self.layout
row = layout.row()
row.item_menu_enumO("OBJECT_OT_constraint_add", "type")
row.item_menu_enumO("objects.constraint_add", "type")
row.itemL();
for con in ob.constraints:
@ -542,7 +542,7 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
layout = self.layout
row = layout.row()
row.item_menu_enumO("POSE_OT_constraint_add", "type")
row.item_menu_enumO("pose.constraint_add", "type")
row.itemL();
for con in pchan.constraints:

View File

@ -65,7 +65,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
ob = context.object
split = layout.split()
split.item_menu_enumO("OBJECT_OT_group_add", "group", text="Add to Group")
split.item_menu_enumO("object.group_add", "group", text="Add to Group")
split.itemL()
for group in bpy.data.groups:
@ -76,7 +76,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
row = col.box().row()
row.itemR(group, "name", text="")
row.itemO("OBJECT_OT_group_remove", text="", icon="VICON_X")
row.itemO("object.group_remove", text="", icon="VICON_X")
split = col.box().split()
split.column().itemR(group, "layer", text="Dupli")

View File

@ -36,13 +36,13 @@ class PARTICLE_PT_particles(ParticleButtonsPanel):
row.template_list(ob, "particle_systems", ob, "active_particle_system_index")
col = row.column(align=True)
col.itemO("OBJECT_OT_particle_system_add", icon="ICON_ZOOMIN", text="")
col.itemO("OBJECT_OT_particle_system_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("object.particle_system_add", icon="ICON_ZOOMIN", text="")
col.itemO("object.particle_system_remove", icon="ICON_ZOOMOUT", text="")
if psys:
split = layout.split(percentage=0.65)
split.template_ID(psys, "settings", new="PARTICLE_OT_new")
split.template_ID(psys, "settings", new="particle.new")
#row = layout.row()
#row.itemL(text="Viewport")
@ -65,9 +65,9 @@ class PARTICLE_PT_particles(ParticleButtonsPanel):
split = layout.split(percentage=0.65)
if part.type=='HAIR':
if psys.editable==True:
split.itemO("PARTICLE_OT_editable_set", text="Free Edit")
split.itemO("particle.editable_set", text="Free Edit")
else:
split.itemO("PARTICLE_OT_editable_set", text="Make Editable")
split.itemO("particle.editable_set", text="Make Editable")
row = split.row()
row.enabled = particle_panel_enabled(psys)
row.itemR(part, "hair_step")
@ -149,17 +149,17 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
row = layout.row()
if cache.baked == True:
row.itemO("PTCACHE_OT_free_bake_particle_system", text="Free Bake")
row.itemO("ptcache.free_bake_particle_system", text="Free Bake")
else:
row.item_booleanO("PTCACHE_OT_cache_particle_system", "bake", True, text="Bake")
row.item_booleanO("ptcache.cache_particle_system", "bake", True, text="Bake")
subrow = row.row()
subrow.enabled = (cache.frames_skipped or cache.outdated) and particle_panel_enabled(psys)
subrow.itemO("PTCACHE_OT_cache_particle_system", text="Calculate to Current Frame")
subrow.itemO("ptcache.cache_particle_system", text="Calculate to Current Frame")
row = layout.row()
row.enabled = particle_panel_enabled(psys)
row.itemO("PTCACHE_OT_bake_from_particles_cache", text="Current Cache to Bake")
row.itemO("ptcache.bake_from_particles_cache", text="Current Cache to Bake")
row.itemR(cache, "step");
row = layout.row()
@ -172,9 +172,9 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
layout.itemS()
row = layout.row()
row.item_booleanO("PTCACHE_OT_bake_all", "bake", True, text="Bake All Dynamics")
row.itemO("PTCACHE_OT_free_bake_all", text="Free All Bakes")
layout.itemO("PTCACHE_OT_bake_all", text="Update All Dynamics to current frame")
row.item_booleanO("ptcache.bake_all", "bake", True, text="Bake All Dynamics")
row.itemO("ptcache.free_bake_all", text="Free All Bakes")
layout.itemO("ptcache.bake_all", text="Update All Dynamics to current frame")
# for particles these are figured out automatically
#row.itemR(cache, "start_frame")
@ -294,12 +294,12 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
col = row.column()
subrow = col.row()
subcol = subrow.column(align=True)
subcol.itemO("PARTICLE_OT_new_keyed_target", icon="ICON_ZOOMIN", text="")
subcol.itemO("PARTICLE_OT_remove_keyed_target", icon="ICON_ZOOMOUT", text="")
subcol.itemO("particle.new_keyed_target", icon="ICON_ZOOMIN", text="")
subcol.itemO("particle.remove_keyed_target", icon="ICON_ZOOMOUT", text="")
subrow = col.row()
subcol = subrow.column(align=True)
subcol.itemO("PARTICLE_OT_keyed_target_move_up", icon="VICON_MOVE_UP", text="")
subcol.itemO("PARTICLE_OT_keyed_target_move_down", icon="VICON_MOVE_DOWN", text="")
subcol.itemO("particle.keyed_target_move_up", icon="VICON_MOVE_UP", text="")
subcol.itemO("particle.keyed_target_move_down", icon="VICON_MOVE_DOWN", text="")
key = psys.active_keyed_target
if key:

View File

@ -25,14 +25,14 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
if md:
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.itemO("OBJECT_OT_modifier_remove", text="Remove")
split.itemO("object.modifier_remove", text="Remove")
row = split.row(align=True)
row.itemR(md, "render", text="")
row.itemR(md, "realtime", text="")
else:
# add modifier
split.item_enumO("OBJECT_OT_modifier_add", "type", "CLOTH", text="Add")
split.item_enumO("object.modifier_add", "type", "CLOTH", text="Add")
split.itemL()
if md:
@ -97,17 +97,17 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
row = layout.row()
if cache.baked == True:
row.itemO("PTCACHE_OT_free_bake_cloth", text="Free Bake")
row.itemO("ptcache.free_bake_cloth", text="Free Bake")
else:
row.item_booleanO("PTCACHE_OT_cache_cloth", "bake", True, text="Bake")
row.item_booleanO("ptcache.cache_cloth", "bake", True, text="Bake")
subrow = row.row()
subrow.enabled = cache.frames_skipped or cache.outdated
subrow.itemO("PTCACHE_OT_cache_cloth", text="Calculate to Current Frame")
subrow.itemO("ptcache.cache_cloth", text="Calculate to Current Frame")
row = layout.row()
#row.enabled = particle_panel_enabled(psys)
row.itemO("PTCACHE_OT_bake_from_cloth_cache", text="Current Cache to Bake")
row.itemO("ptcache.bake_from_cloth_cache", text="Current Cache to Bake")
row.itemR(cache, "step");
row = layout.row()
@ -120,9 +120,9 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
layout.itemS()
row = layout.row()
row.itemO("PTCACHE_OT_bake_all", "bake", True, text="Bake All Dynamics")
row.itemO("PTCACHE_OT_free_bake_all", text="Free All Bakes")
layout.itemO("PTCACHE_OT_bake_all", text="Update All Dynamics to current frame")
row.itemO("ptcache.bake_all", "bake", True, text="Bake All Dynamics")
row.itemO("ptcache.free_bake_all", text="Free All Bakes")
layout.itemO("ptcache.bake_all", text="Update All Dynamics to current frame")
class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
__idname__ = "PHYSICS_PT_clothcollision"

View File

@ -25,7 +25,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
if md:
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.itemO("OBJECT_OT_modifier_remove", text="Remove")
split.itemO("object.modifier_remove", text="Remove")
row = split.row(align=True)
row.itemR(md, "render", text="")
@ -35,7 +35,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
else:
# add modifier
split.item_enumO("OBJECT_OT_modifier_add", "type", "FLUID_SIMULATION", text="Add")
split.item_enumO("object.modifier_add", "type", "FLUID_SIMULATION", text="Add")
split.itemL()
fluid = None
@ -56,7 +56,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
row.item_enumR(fluid, "type", "CONTROL")
if fluid.type == 'DOMAIN':
layout.itemO("FLUID_OT_bake", text="BAKE")
layout.itemO("fluid.bake", text="BAKE")
split = layout.split()
col = split.column()

View File

@ -25,14 +25,14 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
if md:
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.itemO("OBJECT_OT_modifier_remove", text="Remove")
split.itemO("object.modifier_remove", text="Remove")
row = split.row(align=True)
row.itemR(md, "render", text="")
row.itemR(md, "realtime", text="")
else:
# add modifier
split.item_enumO("OBJECT_OT_modifier_add", "type", "SOFTBODY", text="Add")
split.item_enumO("object.modifier_add", "type", "SOFTBODY", text="Add")
split.itemL("")
if md:

View File

@ -14,8 +14,8 @@ class RENDER_PT_render(RenderButtonsPanel):
rd = context.scene.render_data
row = layout.row()
row.itemO("SCREEN_OT_render", text="Image", icon='ICON_IMAGE_COL')
row.item_booleanO("SCREEN_OT_render", "anim", True, text="Animation", icon='ICON_SEQUENCE')
row.itemO("screen.render", text="Image", icon='ICON_IMAGE_COL')
row.item_booleanO("screen.render", "anim", True, text="Animation", icon='ICON_SEQUENCE')
layout.itemR(rd, "display_mode", text="Display")
@ -32,8 +32,8 @@ class RENDER_PT_layers(RenderButtonsPanel):
row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
col = row.column(align=True)
col.itemO("SCENE_OT_render_layer_add", icon="ICON_ZOOMIN", text="")
col.itemO("SCENE_OT_render_layer_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("scene.render_layer_add", icon="ICON_ZOOMIN", text="")
col.itemO("scene.render_layer_remove", icon="ICON_ZOOMOUT", text="")
rl = rd.layers[rd.active_layer_index]

View File

@ -46,15 +46,15 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
row.template_list(wo, "textures", wo, "active_texture_index")
"""if ma or la or wo:
col = row.column(align=True)
col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="")
#col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
col.itemO("texture.new", icon="ICON_ZOOMIN", text="")
#col.itemO("object.material_slot_remove", icon="ICON_ZOOMOUT", text="")
"""
split = layout.split(percentage=0.65)
if ma or la or wo:
if slot:
split.template_ID(slot, "texture", new="TEXTURE_OT_new")
split.template_ID(slot, "texture", new="texture.new")
else:
split.itemS()

View File

@ -34,7 +34,7 @@ class WORLD_PT_context_world(WorldButtonsPanel):
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="WORLD_OT_new")
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")

View File

@ -1,6 +1,9 @@
import bpy
import bpy_ops # XXX - should not need to do this
del bpy_ops
class CONSOLE_HT_header(bpy.types.Header):
__space_type__ = "CONSOLE"
__idname__ = "CONSOLE_HT_header"
@ -36,11 +39,11 @@ class CONSOLE_MT_console(bpy.types.Menu):
sc = context.space_data
layout.column()
layout.itemO("CONSOLE_OT_clear")
layout.itemO("console.clear")
def add_scrollback(text, text_type):
for l in text.split('\n'):
bpy.ops.CONSOLE_OT_scrollback_append(text=l.replace('\t', ' '), type=text_type)
bpy.ops.console.scrollback_append(text=l.replace('\t', ' '), type=text_type)
def get_console(console_id):
'''
@ -148,13 +151,13 @@ class CONSOLE_OT_exec(bpy.types.Operator):
stdout.truncate(0)
stderr.truncate(0)
bpy.ops.CONSOLE_OT_scrollback_append(text = sc.prompt+line, type='INPUT')
bpy.ops.console.scrollback_append(text = sc.prompt+line, type='INPUT')
if is_multiline: sc.prompt = self.PROMPT_MULTI
else: sc.prompt = self.PROMPT
# insert a new blank line
bpy.ops.CONSOLE_OT_history_append(text="", current_character=0)
bpy.ops.console.history_append(text="", current_character=0)
# Insert the output into the editor
# not quite correct because the order might have changed, but ok 99% of the time.

View File

@ -19,10 +19,10 @@ class FILEBROWSER_HT_header(bpy.types.Header):
row.itemM("FILEBROWSER_MT_bookmarks")
row = layout.row(align=True)
row.itemO("FILE_OT_parent", text="", icon='ICON_FILE_PARENT')
row.itemO("FILE_OT_refresh", text="", icon='ICON_FILE_REFRESH')
row.itemO("FILE_OT_previous", text="", icon='ICON_PREV_KEYFRAME')
row.itemO("FILE_OT_next", text="", icon='ICON_NEXT_KEYFRAME')
row.itemO("file.parent", text="", icon='ICON_FILE_PARENT')
row.itemO("file.refresh", text="", icon='ICON_FILE_REFRESH')
row.itemO("file.previous", text="", icon='ICON_PREV_KEYFRAME')
row.itemO("file.next", text="", icon='ICON_NEXT_KEYFRAME')
layout.itemR(params, "display", expand=True, text="")
layout.itemR(params, "sort", expand=True, text="")
@ -49,8 +49,8 @@ class FILEBROWSER_MT_directory(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("FILE_OT_refresh", text="Refresh", icon='ICON_FILE_REFRESH')
layout.itemO("FILE_OT_parent", text="Parent", icon='ICON_FILE_PARENT')
layout.itemO("file.refresh", text="Refresh", icon='ICON_FILE_REFRESH')
layout.itemO("file.parent", text="Parent", icon='ICON_FILE_PARENT')
class FILEBROWSER_MT_bookmarks(bpy.types.Menu):
__space_type__ = "FILE_BROWSER"
@ -59,7 +59,7 @@ class FILEBROWSER_MT_bookmarks(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("FILE_OT_add_bookmark", text="Add current directory", icon='ICON_BOOKMARKS')
layout.itemO("file.add_bookmark", text="Add current directory", icon='ICON_BOOKMARKS')
bpy.types.register(FILEBROWSER_HT_header)

View File

@ -13,7 +13,7 @@ class IMAGE_MT_view(bpy.types.Menu):
show_uvedit = sima.show_uvedit
layout.itemO("IMAGE_OT_properties", icon="ICON_MENU_PANEL")
layout.itemO("image.properties", icon="ICON_MENU_PANEL")
layout.itemS()
@ -23,8 +23,8 @@ class IMAGE_MT_view(bpy.types.Menu):
layout.itemS()
layout.itemO("IMAGE_OT_view_zoom_in")
layout.itemO("IMAGE_OT_view_zoom_out")
layout.itemO("image.view_zoom_in")
layout.itemO("image.view_zoom_out")
layout.itemS()
@ -32,15 +32,15 @@ class IMAGE_MT_view(bpy.types.Menu):
for a, b in ratios:
text = "Zoom %d:%d" % (a, b)
layout.item_floatO("IMAGE_OT_view_zoom_ratio", "ratio", a/b, text=text)
layout.item_floatO("image.view_zoom_ratio", "ratio", a/b, text=text)
layout.itemS()
if show_uvedit:
layout.itemO("IMAGE_OT_view_selected")
layout.itemO("image.view_selected")
layout.itemO("IMAGE_OT_view_all")
layout.itemO("SCREEN_OT_screen_full_area")
layout.itemO("image.view_all")
layout.itemO("screen.screen_full_area")
class IMAGE_MT_select(bpy.types.Menu):
__space_type__ = "IMAGE_EDITOR"
@ -49,19 +49,19 @@ class IMAGE_MT_select(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("UV_OT_select_border")
layout.item_booleanO("UV_OT_select_border", "pinned", True)
layout.itemO("uv.select_border")
layout.item_booleanO("uv.select_border", "pinned", True)
layout.itemS()
layout.itemO("UV_OT_select_all_toggle")
layout.itemO("UV_OT_select_inverse")
layout.itemO("UV_OT_unlink_selection")
layout.itemO("uv.select_all_toggle")
layout.itemO("uv.select_inverse")
layout.itemO("uv.unlink_selection")
layout.itemS()
layout.itemO("UV_OT_select_pinned")
layout.itemO("UV_OT_select_linked")
layout.itemO("uv.select_pinned")
layout.itemO("uv.select_linked")
class IMAGE_MT_image(bpy.types.Menu):
__space_type__ = "IMAGE_EDITOR"
@ -72,35 +72,35 @@ class IMAGE_MT_image(bpy.types.Menu):
sima = context.space_data
ima = sima.image
layout.itemO("IMAGE_OT_new")
layout.itemO("IMAGE_OT_open")
layout.itemO("image.new")
layout.itemO("image.open")
show_render = sima.show_render
if ima:
if show_render:
layout.itemO("IMAGE_OT_replace")
layout.itemO("IMAGE_OT_reload")
layout.itemO("image.replace")
layout.itemO("image.reload")
layout.itemO("IMAGE_OT_save")
layout.itemO("IMAGE_OT_save_as")
layout.itemO("image.save")
layout.itemO("image.save_as")
if ima.source == "SEQUENCE":
layout.itemO("IMAGE_OT_save_sequence")
layout.itemO("image.save_sequence")
if not show_render:
layout.itemS()
if ima.packed_file:
layout.itemO("IMAGE_OT_unpack")
layout.itemO("image.unpack")
else:
layout.itemO("IMAGE_OT_pack")
layout.itemO("image.pack")
# only for dirty && specific image types, perhaps
# this could be done in operator poll too
if ima.dirty:
if ima.source in ("FILE", "GENERATED") and ima.type != "MULTILAYER":
layout.item_booleanO("IMAGE_OT_pack", "as_png", True, text="Pack As PNG")
layout.item_booleanO("image.pack", "as_png", True, text="Pack As PNG")
layout.itemS()
@ -113,9 +113,9 @@ class IMAGE_MT_uvs_showhide(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("UV_OT_reveal")
layout.itemO("UV_OT_hide")
layout.item_booleanO("UV_OT_hide", "unselected", True)
layout.itemO("uv.reveal")
layout.itemO("uv.hide")
layout.item_booleanO("uv.hide", "unselected", True)
class IMAGE_MT_uvs_transform(bpy.types.Menu):
__space_type__ = "IMAGE_EDITOR"
@ -124,9 +124,9 @@ class IMAGE_MT_uvs_transform(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.item_enumO("TFM_OT_transform", "mode", "TRANSLATION")
layout.item_enumO("TFM_OT_transform", "mode", "ROTATION")
layout.item_enumO("TFM_OT_transform", "mode", "RESIZE")
layout.item_enumO("tfm.transform", "mode", "TRANSLATION")
layout.item_enumO("tfm.transform", "mode", "ROTATION")
layout.item_enumO("tfm.transform", "mode", "RESIZE")
class IMAGE_MT_uvs_mirror(bpy.types.Menu):
__space_type__ = "IMAGE_EDITOR"
@ -135,8 +135,8 @@ class IMAGE_MT_uvs_mirror(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.item_enumO("UV_OT_mirror", "axis", "MIRROR_X") # "X Axis", M,
layout.item_enumO("UV_OT_mirror", "axis", "MIRROR_Y") # "Y Axis", M,
layout.item_enumO("uv.mirror", "axis", "MIRROR_X") # "X Axis", M,
layout.item_enumO("uv.mirror", "axis", "MIRROR_Y") # "Y Axis", M,
class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
__space_type__ = "IMAGE_EDITOR"
@ -145,8 +145,8 @@ class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("UV_OT_weld") # W, 1
layout.items_enumO("UV_OT_align", "axis") # W, 2/3/4
layout.itemO("uv.weld") # W, 1
layout.items_enumO("uv.align", "axis") # W, 2/3/4
class IMAGE_MT_uvs(bpy.types.Menu):
@ -165,16 +165,16 @@ class IMAGE_MT_uvs(bpy.types.Menu):
layout.itemS()
layout.itemR(uv, "live_unwrap")
layout.itemO("UV_OT_unwrap")
layout.item_booleanO("UV_OT_pin", "clear", True, text="Unpin")
layout.itemO("UV_OT_pin")
layout.itemO("uv.unwrap")
layout.item_booleanO("uv.pin", "clear", True, text="Unpin")
layout.itemO("uv.pin")
layout.itemS()
layout.itemO("UV_OT_pack_islands")
layout.itemO("UV_OT_average_islands_scale")
layout.itemO("UV_OT_minimize_stretch")
layout.itemO("UV_OT_stitch")
layout.itemO("uv.pack_islands")
layout.itemO("uv.average_islands_scale")
layout.itemO("uv.minimize_stretch")
layout.itemO("uv.stitch")
layout.itemS()
@ -223,7 +223,7 @@ class IMAGE_HT_header(bpy.types.Header):
if show_uvedit:
row.itemM("IMAGE_MT_uvs")
layout.template_ID(sima, "image", new="IMAGE_OT_new", open="IMAGE_OT_open")
layout.template_ID(sima, "image", new="image.new", open="image.open")
"""
/* image select */
@ -290,9 +290,9 @@ class IMAGE_HT_header(bpy.types.Header):
row = layout.row(align=True)
if ima.type == "COMPOSITE":
row.itemO("IMAGE_OT_record_composite", icon="ICON_REC")
row.itemO("image.record_composite", icon="ICON_REC")
if ima.type == "COMPOSITE" and ima.source in ("MOVIE", "SEQUENCE"):
row.itemO("IMAGE_OT_play_composite", icon="ICON_PLAY")
row.itemO("image.play_composite", icon="ICON_PLAY")
layout.itemR(sima, "update_automatically", text="")

View File

@ -20,8 +20,8 @@ class INFO_HT_header(bpy.types.Header):
row.itemM("INFO_MT_render")
row.itemM("INFO_MT_help")
layout.template_ID(context.window, "screen") #, new="SCREEN_OT_new", open="SCREEN_OT_unlink")
layout.template_ID(context.screen, "scene") #, new="SCENE_OT_new", unlink="SCENE_OT_unlink")
layout.template_ID(context.window, "screen") #, new="screen.new", open="scene.unlink")
layout.template_ID(context.screen, "scene") #, new="screen.new", unlink="scene.unlink")
layout.itemS()
@ -36,16 +36,16 @@ class INFO_MT_file(bpy.types.Menu):
layout = self.layout
layout.operator_context = "EXEC_AREA"
layout.itemO("WM_OT_read_homefile")
layout.itemO("wm.read_homefile")
layout.operator_context = "INVOKE_AREA"
layout.itemO("WM_OT_open_mainfile")
layout.itemO("wm.open_mainfile")
layout.itemS()
layout.operator_context = "EXEC_AREA"
layout.itemO("WM_OT_save_mainfile")
layout.itemO("wm.save_mainfile")
layout.operator_context = "INVOKE_AREA"
layout.itemO("WM_OT_save_as_mainfile")
layout.itemO("wm.save_as_mainfile")
layout.itemS()
@ -58,15 +58,15 @@ class INFO_MT_file_external_data(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("FILE_OT_pack_all", text="Pack into .blend file")
layout.itemO("FILE_OT_unpack_all", text="Unpack into Files...")
layout.itemO("file.pack_all", text="Pack into .blend file")
layout.itemO("file.unpack_all", text="Unpack into Files...")
layout.itemS()
layout.itemO("FILE_OT_make_paths_relative")
layout.itemO("FILE_OT_make_paths_absolute")
layout.itemO("FILE_OT_report_missing_files")
layout.itemO("FILE_OT_find_missing_files")
layout.itemO("file.make_paths_relative")
layout.itemO("file.make_paths_absolute")
layout.itemO("file.report_missing_files")
layout.itemO("file.find_missing_files")
class INFO_MT_add(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
@ -444,7 +444,7 @@ class INFO_PT_bottombar(bpy.types.Panel):
split = layout.split(percentage=0.8)
split.itemL(text="")
split.itemO("WM_OT_save_homefile", text="Save As Default")
split.itemO("wm.save_homefile", text="Save As Default")
bpy.types.register(INFO_HT_header)

View File

@ -21,18 +21,18 @@ class OUTLINER_HT_header(bpy.types.Header):
if so.display_mode == 'DATABLOCKS':
row = layout.row(align=True)
row.itemO("ANIM_OT_keyingset_add_new", text="", icon=31)
row.itemO("anim.keyingset_add_new", text="", icon=31)
# row.itemR(sce, "active_keyingset", text="KS: ")
# ks = sce.keyingsets[sce.active_keyingset - 1]
# row.itemR(ks, "name", text="")
## row.itemR(sce, "keyingsets")
row = layout.row()
row.itemO("OUTLINER_OT_keyingset_add_selected", text="", icon=31)
row.itemO("OUTLINER_OT_keyingset_remove_selected", text="", icon=32)
row.itemO("outliner.keyingset_add_selected", text="", icon=31)
row.itemO("outliner.keyingset_remove_selected", text="", icon=32)
row.itemO("ANIM_OT_insert_keyframe", text="", icon=514)
row.itemO("ANIM_OT_delete_keyframe", text="", icon=513)
row.itemO("anim.insert_keyframe", text="", icon=514)
row.itemO("anim.delete_keyframe", text="", icon=513)
class OUTLINER_MT_view(bpy.types.Menu):
@ -45,7 +45,7 @@ class OUTLINER_MT_view(bpy.types.Menu):
col = layout.column()
col.itemR(so, "show_restriction_columns")
#layout.itemO("TEXT_OT_new")
#layout.itemO("text.new")
bpy.types.register(OUTLINER_HT_header)
bpy.types.register(OUTLINER_MT_view)

View File

@ -31,7 +31,7 @@ class SEQUENCER_HT_header(bpy.types.Header):
row.itemM("SEQUENCER_MT_add")
row.itemM("SEQUENCER_MT_strip")
layout.itemS()
row.itemO("SEQUENCER_OT_reload")
row.itemO("sequencer.reload")
else:
row.itemR(st, "display_channel") # text="Chan"
@ -74,8 +74,8 @@ class SEQUENCER_MT_view(bpy.types.Menu):
"""
layout.itemS()
layout.itemO("SEQUENCER_OT_view_all")
layout.itemO("SEQUENCER_OT_view_selected")
layout.itemO("sequencer.view_all")
layout.itemO("sequencer.view_selected")
layout.itemS()
"""
@ -110,16 +110,16 @@ class SEQUENCER_MT_select(bpy.types.Menu):
st = context.space_data
layout.column()
layout.item_enumO("SEQUENCER_OT_select_active_side", "side", 'LEFT', text="Strips to the Left")
layout.item_enumO("SEQUENCER_OT_select_active_side", "side", 'RIGHT', text="Strips to the Right")
layout.item_enumO("sequencer.select_active_side", "side", 'LEFT', text="Strips to the Left")
layout.item_enumO("sequencer.select_active_side", "side", 'RIGHT', text="Strips to the Right")
layout.itemS()
layout.item_enumO("SEQUENCER_OT_select_handles", "side", 'BOTH', text="Surrounding Handles")
layout.item_enumO("SEQUENCER_OT_select_handles", "side", 'LEFT', text="Left Handle")
layout.item_enumO("SEQUENCER_OT_select_handles", "side", 'RIGHT', text="Right Handle")
layout.item_enumO("sequencer.select_handles", "side", 'BOTH', text="Surrounding Handles")
layout.item_enumO("sequencer.select_handles", "side", 'LEFT', text="Left Handle")
layout.item_enumO("sequencer.select_handles", "side", 'RIGHT', text="Right Handle")
layout.itemS()
layout.itemO("SEQUENCER_OT_select_linked")
layout.itemO("SEQUENCER_OT_select_all_toggle")
layout.itemO("SEQUENCER_OT_select_inverse")
layout.itemO("sequencer.select_linked")
layout.itemO("sequencer.select_all_toggle")
layout.itemO("sequencer.select_inverse")
class SEQUENCER_MT_marker(bpy.types.Menu):
__space_type__ = "SEQUENCE_EDITOR"
@ -130,14 +130,14 @@ class SEQUENCER_MT_marker(bpy.types.Menu):
st = context.space_data
layout.column()
layout.itemO("SEQUENCER_OT_sound_strip_add", text="Add Marker|Ctrl Alt M")
layout.itemO("SEQUENCER_OT_sound_strip_add", text="Duplicate Marker|Ctrl Shift D")
layout.itemO("SEQUENCER_OT_sound_strip_add", text="Delete Marker|Shift X")
layout.itemO("sequencer.sound_strip_add", text="Add Marker|Ctrl Alt M")
layout.itemO("sequencer.sound_strip_add", text="Duplicate Marker|Ctrl Shift D")
layout.itemO("sequencer.sound_strip_add", text="Delete Marker|Shift X")
layout.itemS()
layout.itemO("SEQUENCER_OT_sound_strip_add", text="(Re)Name Marker|Ctrl M")
layout.itemO("SEQUENCER_OT_sound_strip_add", text="Grab/Move Marker|Ctrl G")
layout.itemO("sequencer.sound_strip_add", text="(Re)Name Marker|Ctrl M")
layout.itemO("sequencer.sound_strip_add", text="Grab/Move Marker|Ctrl G")
layout.itemS()
layout.itemO("SEQUENCER_OT_sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
layout.itemO("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
class SEQUENCER_MT_add(bpy.types.Menu):
__space_type__ = "SEQUENCE_EDITOR"
@ -148,12 +148,12 @@ class SEQUENCER_MT_add(bpy.types.Menu):
st = context.space_data
layout.column()
layout.itemO("SEQUENCER_OT_scene_strip_add", text="Scene")
layout.itemO("SEQUENCER_OT_movie_strip_add", text="Movie")
layout.item_booleanO("SEQUENCER_OT_movie_strip_add", "sound", True, text="Movie & Sound") # FFMPEG ONLY
layout.itemO("SEQUENCER_OT_image_strip_add", text="Image")
layout.itemO("SEQUENCER_OT_sound_strip_add", text="Sound (Ram)")
layout.item_booleanO("SEQUENCER_OT_sound_strip_add", "hd", True, text="Sound (Streaming)") # FFMPEG ONLY
layout.itemO("sequencer.scene_strip_add", text="Scene")
layout.itemO("sequencer.movie_strip_add", text="Movie")
layout.item_booleanO("sequencer.movie_strip_add", "sound", True, text="Movie & Sound") # FFMPEG ONLY
layout.itemO("sequencer.image_strip_add", text="Image")
layout.itemO("sequencer.sound_strip_add", text="Sound (Ram)")
layout.item_booleanO("sequencer.sound_strip_add", "hd", True, text="Sound (Streaming)") # FFMPEG ONLY
layout.itemM("SEQUENCER_MT_add_effect")
@ -167,19 +167,19 @@ class SEQUENCER_MT_add_effect(bpy.types.Menu):
st = context.space_data
self.layout.column()
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'ADD')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'SUBTRACT')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'ALPHA_OVER')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'ALPHA_UNDER')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'GAMMA_CROSS')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'MULTIPLY')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'OVER_DROP')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'PLUGIN')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'WIPE')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'GLOW')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'TRANSFORM')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'COLOR')
self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", 'type', 'SPEED')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'ADD')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'SUBTRACT')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'ALPHA_OVER')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'ALPHA_UNDER')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'GAMMA_CROSS')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'MULTIPLY')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'OVER_DROP')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'PLUGIN')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'WIPE')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'GLOW')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'TRANSFORM')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'COLOR')
self.layout.item_enumO("sequencer.effect_strip_add", 'type', 'SPEED')
class SEQUENCER_MT_strip(bpy.types.Menu):
__space_type__ = "SEQUENCE_EDITOR"
@ -192,18 +192,18 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
layout.column()
layout.item_enumO("TFM_OT_transform", "mode", 'TRANSLATION', text="Grab/Move")
layout.item_enumO("TFM_OT_transform", "mode", 'TIME_EXTEND', text="Grab/Extend from frame")
# uiItemO(layout, NULL, 0, "SEQUENCER_OT_strip_snap"); // TODO - add this operator
layout.item_enumO("tfm.transform", "mode", 'TRANSLATION', text="Grab/Move")
layout.item_enumO("tfm.transform", "mode", 'TIME_EXTEND', text="Grab/Extend from frame")
# uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
layout.itemS()
layout.item_enumO("SEQUENCER_OT_cut", "type", 'HARD', text="Cut (hard) at frame")
layout.item_enumO("SEQUENCER_OT_cut", "type", 'SOFT', text="Cut (soft) at frame")
layout.itemO("SEQUENCER_OT_images_separate")
layout.item_enumO("sequencer.cut", "type", 'HARD', text="Cut (hard) at frame")
layout.item_enumO("sequencer.cut", "type", 'SOFT', text="Cut (soft) at frame")
layout.itemO("sequencer.images_separate")
layout.itemS()
layout.itemO("SEQUENCER_OT_duplicate")
layout.itemO("SEQUENCER_OT_delete")
layout.itemO("sequencer.duplicate")
layout.itemO("sequencer.delete")
strip = act_strip(context)
@ -212,39 +212,39 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
if stype=='EFFECT':
layout.itemS()
layout.itemO("SEQUENCER_OT_effect_change")
layout.itemO("SEQUENCER_OT_effect_reassign_inputs")
layout.itemO("sequencer.effect_change")
layout.itemO("sequencer.effect_reassign_inputs")
elif stype=='IMAGE':
layout.itemS()
layout.itemO("SEQUENCER_OT_image_change")
layout.itemO("sequencer.image_change")
elif stype=='SCENE':
layout.itemS()
layout.itemO("SEQUENCER_OT_scene_change", text="Change Scene")
layout.itemO("sequencer.scene_change", text="Change Scene")
elif stype=='MOVIE':
layout.itemS()
layout.itemO("SEQUENCER_OT_movie_change")
layout.itemO("sequencer.movie_change")
layout.itemS()
layout.itemO("SEQUENCER_OT_meta_make")
layout.itemO("SEQUENCER_OT_meta_separate")
layout.itemO("sequencer.meta_make")
layout.itemO("sequencer.meta_separate")
#if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
# uiItemS(layout);
# uiItemO(layout, NULL, 0, "SEQUENCER_OT_meta_toggle");
# uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
#}
layout.itemS()
layout.itemO("SEQUENCER_OT_reload")
layout.itemO("sequencer.reload")
layout.itemS()
layout.itemO("SEQUENCER_OT_lock")
layout.itemO("SEQUENCER_OT_unlock")
layout.itemO("SEQUENCER_OT_mute")
layout.itemO("SEQUENCER_OT_unmute")
layout.itemO("sequencer.lock")
layout.itemO("sequencer.unlock")
layout.itemO("sequencer.mute")
layout.itemO("sequencer.unmute")
layout.item_booleanO("SEQUENCER_OT_mute", "unselected", 1, text="Mute Deselected Strips")
layout.item_booleanO("sequencer.mute", "unselected", 1, text="Mute Deselected Strips")
layout.itemO("SEQUENCER_OT_snap")
layout.itemO("sequencer.snap")
# Panels
class SequencerButtonsPanel(bpy.types.Panel):

View File

@ -22,14 +22,14 @@ class TEXT_HT_header(bpy.types.Header):
if text and text.modified:
row = layout.row()
# row.color(redalert)
row.itemO("TEXT_OT_resolve_conflict", text="", icon='ICON_HELP')
row.itemO("text.resolve_conflict", text="", icon='ICON_HELP')
row = layout.row(align=True)
row.itemR(st, "line_numbers", text="")
row.itemR(st, "word_wrap", text="")
row.itemR(st, "syntax_highlight", text="")
layout.template_ID(st, "text", new="TEXT_OT_new", unlink="TEXT_OT_unlink")
layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
if text:
row = layout.row()
@ -76,18 +76,18 @@ class TEXT_PT_find(bpy.types.Panel):
col = layout.column(align=True)
row = col.row()
row.itemR(st, "find_text", text="")
row.itemO("TEXT_OT_find_set_selected", text="", icon='ICON_TEXT')
col.itemO("TEXT_OT_find")
row.itemO("text.find_set_selected", text="", icon='ICON_TEXT')
col.itemO("text.find")
# replace
col = layout.column(align=True)
row = col.row()
row.itemR(st, "replace_text", text="")
row.itemO("TEXT_OT_replace_set_selected", text="", icon='ICON_TEXT')
col.itemO("TEXT_OT_replace")
row.itemO("text.replace_set_selected", text="", icon='ICON_TEXT')
col.itemO("text.replace")
# mark
layout.itemO("TEXT_OT_mark_all")
layout.itemO("text.mark_all")
# settings
row = layout.row()
@ -104,25 +104,25 @@ class TEXT_MT_text(bpy.types.Menu):
text = st.text
layout.column()
layout.itemO("TEXT_OT_new")
layout.itemO("TEXT_OT_open")
layout.itemO("text.new")
layout.itemO("text.open")
if text:
layout.itemO("TEXT_OT_reload")
layout.itemO("text.reload")
layout.column()
layout.itemO("TEXT_OT_save")
layout.itemO("TEXT_OT_save_as")
layout.itemO("text.save")
layout.itemO("text.save_as")
if text.filename != "":
layout.itemO("TEXT_OT_make_internal")
layout.itemO("text.make_internal")
layout.column()
layout.itemO("TEXT_OT_run_script")
layout.itemO("text.run_script")
#ifndef DISABLE_PYTHON
# XXX if(BPY_is_pyconstraint(text))
# XXX uiMenuItemO(head, 0, "TEXT_OT_refresh_pyconstraints");
# XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints");
#endif
#ifndef DISABLE_PYTHON
@ -138,8 +138,8 @@ class TEXT_MT_edit_view(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.item_enumO("TEXT_OT_move", "type", "FILE_TOP", text="Top of File")
layout.item_enumO("TEXT_OT_move", "type", "FILE_BOTTOM", text="Bottom of File")
layout.item_enumO("text.move", "type", "FILE_TOP", text="Top of File")
layout.item_enumO("text.move", "type", "FILE_BOTTOM", text="Bottom of File")
class TEXT_MT_edit_select(bpy.types.Menu):
__space_type__ = "TEXT_EDITOR"
@ -148,8 +148,8 @@ class TEXT_MT_edit_select(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("TEXT_OT_select_all")
layout.itemO("TEXT_OT_select_line")
layout.itemO("text.select_all")
layout.itemO("text.select_line")
class TEXT_MT_edit_markers(bpy.types.Menu):
__space_type__ = "TEXT_EDITOR"
@ -158,9 +158,9 @@ class TEXT_MT_edit_markers(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("TEXT_OT_markers_clear")
layout.itemO("TEXT_OT_next_marker")
layout.itemO("TEXT_OT_previous_marker")
layout.itemO("text.markers_clear")
layout.itemO("text.next_marker")
layout.itemO("text.previous_marker")
class TEXT_MT_format(bpy.types.Menu):
__space_type__ = "TEXT_EDITOR"
@ -169,17 +169,17 @@ class TEXT_MT_format(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("TEXT_OT_indent")
layout.itemO("TEXT_OT_unindent")
layout.itemO("text.indent")
layout.itemO("text.unindent")
layout.itemS()
layout.itemO("TEXT_OT_comment")
layout.itemO("TEXT_OT_uncomment")
layout.itemO("text.comment")
layout.itemO("text.uncomment")
layout.itemS()
layout.item_menu_enumO("TEXT_OT_convert_whitespace", "type")
layout.item_menu_enumO("text.convert_whitespace", "type")
class TEXT_MT_edit_to3d(bpy.types.Menu):
__space_type__ = "TEXT_EDITOR"
@ -188,8 +188,8 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.item_booleanO("TEXT_OT_to_3d_object", "split_lines", False, text="One Object");
layout.item_booleanO("TEXT_OT_to_3d_object", "split_lines", True, text="One Object Per Line");
layout.item_booleanO("text.to_3d_object", "split_lines", False, text="One Object");
layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line");
class TEXT_MT_edit(bpy.types.Menu):
__space_type__ = "TEXT_EDITOR"
@ -202,14 +202,14 @@ class TEXT_MT_edit(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("ED_OT_undo")
layout.itemO("ED_OT_redo")
layout.itemO("ed.undo")
layout.itemO("ed.redo")
layout.itemS()
layout.itemO("TEXT_OT_cut")
layout.itemO("TEXT_OT_copy")
layout.itemO("TEXT_OT_paste")
layout.itemO("text.cut")
layout.itemO("text.copy")
layout.itemO("text.paste")
layout.itemS()
@ -219,8 +219,8 @@ class TEXT_MT_edit(bpy.types.Menu):
layout.itemS()
layout.itemO("TEXT_OT_jump")
layout.itemO("TEXT_OT_properties")
layout.itemO("text.jump")
layout.itemO("text.properties")
layout.itemS()

View File

@ -8,19 +8,19 @@ class VIEW3D_MT_view_navigation(bpy.types.Menu):
def draw(self, context):
layout = self.layout
# layout.itemO("VIEW3D_OT_view_fly_mode")
# layout.itemO("view3d.view_fly_mode")
# layout.itemS()
layout.items_enumO("VIEW3D_OT_view_orbit", "type")
layout.items_enumO("view3d.view_orbit", "type")
layout.itemS()
layout.items_enumO("VIEW3D_OT_view_pan", "type")
layout.items_enumO("view3d.view_pan", "type")
layout.itemS()
layout.item_floatO("VIEW3D_OT_zoom", "delta", 1.0, text="Zoom In")
layout.item_floatO("VIEW3D_OT_zoom", "delta", -1.0, text="Zoom Out")
layout.item_floatO("view3d.zoom", "delta", 1.0, text="Zoom In")
layout.item_floatO("view3d.zoom", "delta", -1.0, text="Zoom Out")
class VIEW3D_MT_view(bpy.types.Menu):
__space_type__ = "VIEW_3D"
@ -29,30 +29,30 @@ class VIEW3D_MT_view(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemO("VIEW3D_OT_properties", icon="ICON_MENU_PANEL")
layout.itemO("VIEW3D_OT_toolbar", icon="ICON_MENU_PANEL")
layout.itemO("view3d.properties", icon="ICON_MENU_PANEL")
layout.itemO("view3d.toolbar", icon="ICON_MENU_PANEL")
layout.itemS()
layout.item_enumO("VIEW3D_OT_viewnumpad", "type", "CAMERA")
layout.item_enumO("VIEW3D_OT_viewnumpad", "type", "TOP")
layout.item_enumO("VIEW3D_OT_viewnumpad", "type", "FRONT")
layout.item_enumO("VIEW3D_OT_viewnumpad", "type", "RIGHT")
layout.item_enumO("view3d.viewnumpad", "type", "CAMERA")
layout.item_enumO("view3d.viewnumpad", "type", "TOP")
layout.item_enumO("view3d.viewnumpad", "type", "FRONT")
layout.item_enumO("view3d.viewnumpad", "type", "RIGHT")
# layout.itemM("VIEW3D_MT_view_cameras", text="Cameras")
layout.itemS()
layout.itemO("VIEW3D_OT_view_persportho")
layout.itemO("view3d.view_persportho")
layout.itemS()
# layout.itemO("VIEW3D_OT_view_show_all_layers")
# layout.itemO("view3d.view_show_all_layers")
# layout.itemS()
# layout.itemO("VIEW3D_OT_view_local_view")
# layout.itemO("VIEW3D_OT_view_global_view")
# layout.itemO("view3d.view_local_view")
# layout.itemO("view3d.view_global_view")
# layout.itemS()
@ -63,17 +63,17 @@ class VIEW3D_MT_view(bpy.types.Menu):
layout.operator_context = "INVOKE_REGION_WIN"
layout.itemO("VIEW3D_OT_clip_border")
layout.itemO("VIEW3D_OT_zoom_border")
layout.itemO("view3d.clip_border")
layout.itemO("view3d.zoom_border")
layout.itemS()
layout.itemO("VIEW3D_OT_view_center")
layout.itemO("VIEW3D_OT_view_all")
layout.itemO("view3d.view_center")
layout.itemO("view3d.view_all")
layout.itemS()
layout.itemO("SCREEN_OT_screen_full_area")
layout.itemO("screen.screen_full_area")
class VIEW3D_HT_header(bpy.types.Header):
__space_type__ = "VIEW_3D"

View File

@ -15,12 +15,12 @@ class VIEW3D_PT_tools_objectmode(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("OBJECT_OT_duplicate")
layout.row().itemO("OBJECT_OT_delete")
layout.row().itemO("OBJECT_OT_mesh_add")
layout.row().itemO("OBJECT_OT_curve_add")
layout.row().itemO("OBJECT_OT_text_add")
layout.row().itemO("OBJECT_OT_surface_add")
layout.row().itemO("object.duplicate")
layout.row().itemO("object.delete")
layout.row().itemO("object.mesh_add")
layout.row().itemO("object.curve_add")
layout.row().itemO("object.text_add")
layout.row().itemO("object.surface_add")
# ********** default tools for editmode_mesh ****************
@ -36,14 +36,14 @@ class VIEW3D_PT_tools_editmode_mesh(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("MESH_OT_duplicate")
layout.row().itemO("MESH_OT_delete")
layout.row().itemO("MESH_OT_spin")
layout.row().itemO("MESH_OT_screw")
layout.row().itemO("MESH_OT_primitive_plane_add")
layout.row().itemO("MESH_OT_primitive_cube_add")
layout.row().itemO("MESH_OT_primitive_circle_add")
layout.row().itemO("MESH_OT_primitive_cylinder_add")
layout.row().itemO("mesh.duplicate")
layout.row().itemO("mesh.delete")
layout.row().itemO("mesh.spin")
layout.row().itemO("mesh.screw")
layout.row().itemO("mesh.primitive_plane_add")
layout.row().itemO("mesh.primitive_cube_add")
layout.row().itemO("mesh.primitive_circle_add")
layout.row().itemO("mesh.primitive_cylinder_add")
# ********** default tools for editmode_curve ****************
@ -59,10 +59,10 @@ class VIEW3D_PT_tools_editmode_curve(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("CURVE_OT_duplicate")
layout.row().itemO("CURVE_OT_delete")
layout.row().itemO("OBJECT_OT_curve_add")
layout.row().itemO("CURVE_OT_subdivide")
layout.row().itemO("curve.duplicate")
layout.row().itemO("curve.delete")
layout.row().itemO("object.curve_add")
layout.row().itemO("curve.subdivide")
# ********** default tools for editmode_surface ****************
@ -78,10 +78,10 @@ class VIEW3D_PT_tools_editmode_surface(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("CURVE_OT_duplicate")
layout.row().itemO("CURVE_OT_delete")
layout.row().itemO("OBJECT_OT_surface_add")
layout.row().itemO("CURVE_OT_subdivide")
layout.row().itemO("curve.duplicate")
layout.row().itemO("curve.delete")
layout.row().itemO("object.surface_add")
layout.row().itemO("curve.subdivide")
# ********** default tools for editmode_text ****************
@ -97,10 +97,10 @@ class VIEW3D_PT_tools_editmode_text(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("FONT_OT_text_copy")
layout.row().itemO("FONT_OT_text_paste")
layout.row().itemO("FONT_OT_case_set")
layout.row().itemO("FONT_OT_style_toggle")
layout.row().itemO("font.text_copy")
layout.row().itemO("font.text_paste")
layout.row().itemO("font.case_set")
layout.row().itemO("font.style_toggle")
# ********** default tools for editmode_armature ****************
@ -116,10 +116,10 @@ class VIEW3D_PT_tools_editmode_armature(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("ARMATURE_OT_duplicate_selected")
layout.row().itemO("ARMATURE_OT_bone_primitive_add")
layout.row().itemO("ARMATURE_OT_delete")
layout.row().itemO("ARMATURE_OT_parent_clear")
layout.row().itemO("armature.duplicate_selected")
layout.row().itemO("armature.bone_primitive_add")
layout.row().itemO("armature.delete")
layout.row().itemO("armature.parent_clear")
# ********** default tools for editmode_mball ****************
@ -167,10 +167,10 @@ class VIEW3D_PT_tools_posemode(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("POSE_OT_hide")
layout.row().itemO("POSE_OT_reveal")
layout.row().itemO("POSE_OT_rot_clear")
layout.row().itemO("POSE_OT_loc_clear")
layout.row().itemO("pose.hide")
layout.row().itemO("pose.reveal")
layout.row().itemO("pose.rot_clear")
layout.row().itemO("pose.loc_clear")
# ********** default tools for sculptmode ****************
@ -186,7 +186,7 @@ class VIEW3D_PT_tools_sculptmode(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("SCULPT_OT_radial_control")
layout.row().itemO("sculpt.radial_control")
# ********** default tools for weightpaint ****************
@ -202,7 +202,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("PAINT_OT_weight_paint_radial_control")
layout.row().itemO("paint.weight_paint_radial_control")
# ********** default tools for vertexpaint ****************
@ -218,7 +218,7 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("PAINT_OT_vertex_paint_radial_control")
layout.row().itemO("paint.vertex_paint_radial_control")
# ********** default tools for texturepaint ****************
@ -234,7 +234,7 @@ class VIEW3D_PT_tools_texturepaint(View3DPanel):
def draw(self, context):
layout = self.layout
layout.row().itemO("PAINT_OT_texture_paint_radial_control")
layout.row().itemO("paint.texture_paint_radial_control")
bpy.types.register(VIEW3D_PT_tools_objectmode)

View File

@ -65,7 +65,7 @@ static void bpy_init_modules( void )
/* PyModule_AddObject( mod, "doc", BPY_rna_doc() ); */
PyModule_AddObject( mod, "types", BPY_rna_types() );
PyModule_AddObject( mod, "props", BPY_rna_props() );
PyModule_AddObject( mod, "ops", BPY_operator_module() );
PyModule_AddObject( mod, "__ops__", BPY_operator_module() ); /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */
PyModule_AddObject( mod, "ui", BPY_ui_module() ); // XXX very experimental, consider this a test, especially PyCObject is not meant to be permanent
/* add the module so we can import it */

View File

@ -436,9 +436,16 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
PyObject *pyrna_func_to_py(BPy_StructRNA *pyrna, FunctionRNA *func)
{
static PyMethodDef func_meth = {"<generic rna function>", (PyCFunction)pyrna_func_call, METH_VARARGS|METH_KEYWORDS, "python rna function"};
PyObject *self= PyTuple_New(2);
PyObject *self;
PyObject *ret;
if(func==NULL) {
PyErr_Format( PyExc_RuntimeError, "%.200s: type attempted to get NULL function", RNA_struct_identifier(pyrna->ptr.type));
return NULL;
}
self= PyTuple_New(2);
PyTuple_SET_ITEM(self, 0, (PyObject *)pyrna);
Py_INCREF(pyrna);
@ -1912,6 +1919,17 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
const char *parm_id;
void *retdata= NULL;
/* Should never happen but it does in rare cases */
if(self_ptr==NULL) {
PyErr_SetString(PyExc_RuntimeError, "rna functions internal rna pointer is NULL, this is a bug. aborting");
return NULL;
}
if(self_func==NULL) {
PyErr_Format(PyExc_RuntimeError, "%.200s.???(): rna function internal function is NULL, this is a bug. aborting", RNA_struct_identifier(self_ptr->type));
return NULL;
}
/* setup */
RNA_pointer_create(NULL, &RNA_Function, self_func, &funcptr);

View File

@ -149,6 +149,8 @@ void WM_operator_properties_free(struct PointerRNA *ptr);
/* operator as a python command (resultuing string must be free'd) */
char *WM_operator_pystring(struct wmOperator *op);
void WM_operator_bl_idname(char *to, char *from);
void WM_operator_bl_idname(char *to, char *from);
/* default operator callbacks for border/circle/lasso */
int WM_border_select_invoke (struct bContext *C, struct wmOperator *op, struct wmEvent *event);

View File

@ -30,6 +30,8 @@
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include "DNA_ID.h"
#include "DNA_screen_types.h"
@ -82,17 +84,21 @@ static ListBase global_ops= {NULL, NULL};
/* ************ operator API, exported ********** */
wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
{
wmOperatorType *ot;
char idname_bl[OP_MAX_TYPENAME]; // XXX, needed to support python style names without the _OT_ syntax
WM_operator_bl_idname(idname_bl, idname);
for(ot= global_ops.first; ot; ot= ot->next) {
if(strncmp(ot->idname, idname, OP_MAX_TYPENAME)==0)
if(strncmp(ot->idname, idname_bl, OP_MAX_TYPENAME)==0)
return ot;
}
if(!quiet)
printf("search for unknown operator %s\n", idname);
printf("search for unknown operator %s, %s\n", idname_bl, idname);
return NULL;
}
@ -101,8 +107,11 @@ wmOperatorType *WM_operatortype_exists(const char *idname)
{
wmOperatorType *ot;
char idname_bl[OP_MAX_TYPENAME]; // XXX, needed to support python style names without the _OT_ syntax
WM_operator_bl_idname(idname_bl, idname);
for(ot= global_ops.first; ot; ot= ot->next) {
if(strncmp(ot->idname, idname, OP_MAX_TYPENAME)==0)
if(strncmp(ot->idname, idname_bl, OP_MAX_TYPENAME)==0)
return ot;
}
return NULL;
@ -152,11 +161,51 @@ int WM_operatortype_remove(const char *idname)
return 1;
}
/* SOME_OT_op -> some.op */
void WM_operator_py_idname(char *to, char *from)
{
char *sep= strstr(from, "_OT_");
if(sep) {
int i, ofs= (sep-from);
for(i=0; i<ofs; i++)
to[i]= tolower(from[i]);
to[ofs] = '.';
BLI_strncpy(to+(ofs+1), sep+4, OP_MAX_TYPENAME);
}
else {
/* should not happen but support just incase */
BLI_strncpy(to, from, OP_MAX_TYPENAME);
}
}
/* some.op -> SOME_OT_op */
void WM_operator_bl_idname(char *to, char *from)
{
char *sep= strstr(from, ".");
if(sep) {
int i, ofs= (sep-from);
for(i=0; i<ofs; i++)
to[i]= toupper(from[i]);
BLI_strncpy(to+ofs, "_OT_", OP_MAX_TYPENAME);
BLI_strncpy(to+(ofs+4), sep+1, OP_MAX_TYPENAME);
}
else {
/* should not happen but support just incase */
BLI_strncpy(to, from, OP_MAX_TYPENAME);
}
}
/* print a string representation of the operator, with the args that it runs
* so python can run it again */
char *WM_operator_pystring(wmOperator *op)
{
const char *arg_name= NULL;
char idname_py[OP_MAX_TYPENAME];
PropertyRNA *prop, *iterprop;
@ -165,7 +214,8 @@ char *WM_operator_pystring(wmOperator *op)
char *cstring, *buf;
int first_iter=1;
BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", op->idname);
WM_operator_py_idname(idname_py, op->idname);
BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", idname_py);
iterprop= RNA_struct_iterator_property(op->ptr->type);