Page MenuHome

Timer: Generic BLI_timer with Python wrapper

Authored by Jacques Lucke (JacquesLucke) on Nov 26 2018, 2:46 PM.



The Python interface is almost the same as in D3990. I just renamed add/remove to register/unregister and added a new is_registered method.

Diff Detail

rB Blender

Event Timeline

  • support for non-persistent callbacks

Non-persistent callbacks are the default now, so they will be unregistered when a new file is loaded.
Instead of making an persistent decorator, I made this a new argument to the register function to make it easier to use.
I can also make it a decorator to conform with however I think making it a parameter is the better solution.

  • Cleanup: style
  • Remove unnecessary intermediate node allocation

Generally seems fine, made some minor changes.

One thing that seems odd is how the Python API uses the identifier.

Why not have the Python function it's self be the unique handle thats used to register?

Made a patch for this, see: P837 (uses uintptr_t, could also use const void *).

For most C users, they can use any pointer as the handle to register/unregister.

The function pointer when there is only ever one instance can work or a memory pointer they own would also be fine.

  • C-API now accepts custom uuid, Python API no longer exposes identifier
  • Cleanup: 'Timer' is very generic name for something specific
  • rename identifier to uuid + api doc fixes
This revision is now accepted and ready to land.Nov 26 2018, 8:22 PM
This revision was automatically updated to reflect the committed changes.