GPU Python: Use 'PyC_ParseStringEnum' to parse items

Currently the GPU module for python has different ways to handle enums.
- Organizing items in `PyC_StringEnumItems` arrays and parsing them with `PyC_ParseStringEnum`.
- Using dedicated functions for each type of enum (`bpygpu_ParsePrimType`, `pygpu_ParseVertCompType` and `pygpu_ParseVertFetchMode`).

Although apparently more efficient (especially `pygpu_ParseVertCompType`
which transforms strings into integers for simple comparison), these
dedicated functions duplicate functionality, increase the complexity of
the code and consequently make it less readable.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10456
This commit is contained in:
Germano Cavalcante
2021-02-22 08:26:45 -03:00
committed by Germano Cavalcante
parent 78c3caf3c1
commit 086d70e910
9 changed files with 78 additions and 200 deletions

View File

@@ -20,4 +20,5 @@
#pragma once
extern struct PyC_StringEnumItems bpygpu_primtype_items[];
extern struct PyC_StringEnumItems bpygpu_dataformat_items[];