[Bf-python] displaying current scene fps in addon preference?

CoDEmanX codemanx at gmx.de
Fri Feb 7 17:29:39 CET 2014


Hi,

if it MUST be the same as in the project, why do you add it as property 
to the panel in the first place???

You could simply display it to the user as a note, e.g.

   render = context.scene.render
   fps = render.fps / render.fps_base
   layout.label("FPS: %.3f" % fps)


BTW: to do the rounding on a FloatProperty just for display (value 
remains the same internally, it's only a display option up to how many 
decimal places shall show), do:

   FloatProperty(..., precision=3)


You could also add the fps property/properties of the scene to your 
panel, e.g.

   layout.prop(context.scene.render, "fps")

Changes here will be the same as to directly in the render settings.


Or set your own FloatProperty to the scene's fps (or whatever) on invoke:

http://www.pasteall.org/49343/python


Am 07.02.2014 16:58, schrieb flavio soares:
> Hello,
>
> In an addon with preferences, is there a way of displaying the project's
> current scene fps inside a box as default, instead of some fixed number?
>
> This is the image of the preferences box
> <http://florestavermelha.files.wordpress.com/2014/02/revolver.jpg>.
>
> The current code is this:
>
> prop_fps = FloatProperty(
>          name="FPS (Beware!)",
>          description="Transcoded videos will have this FPS - \
>                      this *MUST* be the same as your project",
>          default=24.00
>      )
>
>
> The idea would be to show the result of this:
>
> render  =  bpy.context.scene.render
>
> fps  =  round((render.fps  /  render.fps_base),  3)
>
>
> Just in case, full code is here
> <https://github.com/szaszak/blender_velvets/blob/master/velvet_revolver.py>,
> addon is already functional.
>
> thanks for the help!
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>



More information about the Bf-python mailing list