forked from bartvdbraak/blender
a705f64245
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.
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
|
|
import bpy
|
|
|
|
class OUTLINER_HT_header(bpy.types.Header):
|
|
__space_type__ = "OUTLINER"
|
|
__idname__ = "OUTLINER_HT_header"
|
|
|
|
def draw(self, context):
|
|
so = context.space_data
|
|
sce = context.scene
|
|
layout = self.layout
|
|
|
|
layout.template_header()
|
|
|
|
if context.area.show_menus:
|
|
row = layout.row(align=True)
|
|
row.itemM("OUTLINER_MT_view")
|
|
|
|
row = layout.row()
|
|
row.itemR(so, "display_mode", text="")
|
|
|
|
if so.display_mode == 'DATABLOCKS':
|
|
row = layout.row(align=True)
|
|
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.keyingset_add_selected", text="", icon=31)
|
|
row.itemO("outliner.keyingset_remove_selected", text="", icon=32)
|
|
|
|
row.itemO("anim.insert_keyframe", text="", icon=514)
|
|
row.itemO("anim.delete_keyframe", text="", icon=513)
|
|
|
|
|
|
class OUTLINER_MT_view(bpy.types.Menu):
|
|
__space_type__ = "OUTLINER"
|
|
__label__ = "View"
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
so = context.space_data
|
|
|
|
col = layout.column()
|
|
col.itemR(so, "show_restriction_columns")
|
|
#layout.itemO("text.new")
|
|
|
|
bpy.types.register(OUTLINER_HT_header)
|
|
bpy.types.register(OUTLINER_MT_view)
|
|
|