[Bf-committers] Blender 2.8 Python Meeting Notes

Campbell Barton ideasman42 at gmail.com
Tue Jun 26 18:22:44 CEST 2018


Hi, here are meeting notes from the code-quest Python meeting,
topics mostly covered task:
https://developer.blender.org/T47811

Which proposes changes for 2.8.

Rationale for some changes aren't listed here,
see the task for details.


Keyword Only Arguments
======================

For generated RNA API, and by convention in Blender's API's
any optional keyword arguments are to be keyword only arguments.

- Bastien handles.


Remove 'register_module'
========================

Scripts must register classes.

- Campbell handles.


Remove 'addons' from 'sys.path'
===============================

Allow for package manager to handle many addons w/o polluting module namespace.

- Campbell handles.


Use Python's @ Matrix Multiply Operator
=======================================

Meeting agrees to follow Python/NumPy conventions for
vector, matrix, quaternion multiplication. However we will
need to allow time (some months at least) for addons to be
upgraded before adding back '*' as element-wise multiply.
Introducing both at once would be very confusing.

- Campbell handles.


Object Selection
================

Use internal 'Base' struct to access selection,
the RNA API needs to match logic in C for storage of selection.

- Brecht handles.

Handler 'bpy.app.handlers.scene_update_pre'
===========================================

This was being mis-used because of a bug causing it to run constantly.

API's to replace this can be:

- A timer API to run Python code at less frequent intervals,
  encourage timers to run less frequently,
  the timer must be explicitly told to run again each time
  (avoiding timers being left enabled)

  - Bastien handles.

- Another use case use synchronizing data
  a depsgraph API needs to handle this.

  - Sergey handles.

f-strings
=========

Replace existing "%" string formatting with f-strings or the format method.

- Campbell handles.


Follow pep8 for Function Calls
==============================

For function calls (especially for bpy.props.*) we use 8 spaces,
should be 4 (can be mostly auto-formatted).

- Campbell handles.


Type Hints
==========

Encourage use of type hints for complex addon's.

Use may be investigated for other modules,
however we should take care not to add startup overhead unless this
gives big benefits.

- Sybren handles.


Drawing API
===========

- Drawing (gawain)

  Move into gpu module, we can extend as needed.

  Keep "bgl" but deprecate it since we can't ensure OpenGL API's will
be kept longer term,
  we will try to provide functionality via the GPU module where possible.

- Campbell handles (ongoing development).


Material Import/Export
======================

For import export addons, we would like to read/write basic material
options from the node tree
(diffuse image, specular color... etc).

- Brecht handles.


Blender/Python API Test Cases
=============================

To validate Blender's Python API is working, we've defined a minimum set of
addons which should be working before we call others to port scripts.

- Export uv layout.
- Import images as planes.
- Demo Mode.
- BlenderID.
- 3D Print Toolbox.

- Bastien, Campbell & Sybren handle.


-- 
- Campbell


More information about the Bf-committers mailing list