I would like to add a custom frame rate slider in the timeline header, but I can't figure out how to do it.

I've tried to add following line in space_time.py (between line 75 and 77), but nothing happens:

layout.prop(scene, "render.fps", text="")


What am I missing?

Thanks.

• depends on where you added that line.. Jul 23 '15 at 19:22
• In "space_time.py" between lines 75 and 77 Jul 23 '15 at 20:55

Here is how it should be :

layout.prop(scene.render, "fps", text="fps") since the property is fps and it is in scene.render

I'd suggest write an Add-on instead of edit the python files which shipped with blender, simply because you can update Blender as you like.

Also it's fairly simple to append a property or a custom menu to the editor headers. Take a look into the python templates: Text Editor > Templates > Python > UI Menu. Key is to register bpy.types.EDITOR_TYPE.append(draw) and append a custom method to display the property.

### Display a single property

To display a property in the timeline header use: bpy.types.TIME_HT_header.append(draw):

import bpy

def draw_frame_rate_property(self, context):
scene = context.scene
layout = self.layout

# call the property
layout.prop(scene.render, "fps", text="FPS")

def register():

def unregister():

if __name__ == "__main__":
register()


### Display multiple properties as menu

bl_info = {
"name": "Set Frame Rate in Timeline",
"description": "",
"author": "poor",
"version": (0, 0, 1),
"blender": (2, 73, 0),
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Timeline"
}

import bpy

bl_label = "Frame Rate"

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

#frame rate properties
layout.prop(scene.render, "fps_base", text="FPS Base")
layout.prop(scene.render, "fps", text="FPS")

layout = self.layout

def register():
bpy.utils.register_module(__name__)

def unregister():
bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
register()


Note: Use bpy.types.EDITOR_TYPE.prepend() to display the property before the menu:

Further information:

• Thanks, really useful! But the thing is, I also wanted to change the layout of the header elements: i.imgur.com/LF60YIS.png And I guess that wouldn't be possible with an addon, right? Jul 25 '15 at 20:23
• @Zafio Right, you can only append and prepend, adding inbetween existing elements seems to be really hacky at the moment, see the answer (and the comments) of CoDEmanX: blender.stackexchange.com/questions/3393/…
– p2or
Jul 26 '15 at 8:40