Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-08-27 01:11:52 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-08-27 01:11:52 +0400
commit1679cd7f966b5441bd02e8960ece398ee1980c7f (patch)
treec9c7334bbd62463ff3bdf501e1f82e64bb6ab9f7 /source/blender/makesrna/RNA_types.h
parent03dbae07d346dcfb5cdaeeeea3585f642cd90d31 (diff)
This commit adds optional parameters for pyfunc implementations of RNA API (i.e. callbacks, e.g. draw functions of panels, uiLists, or exec/poll/etc. of operators). Thanks to Brecht for he review!
Any parameter after the first flagged with PROP_PYFUNC_OPTIONAL will be considered as optional, hence the python code does not have to define/use it. This will ease API evolutions by avoiding to break existing code when adding non-essential new parameters. Note: this will need some update to API doc generation, patch is ready, will have it reviewed by Campbell asap.
Diffstat (limited to 'source/blender/makesrna/RNA_types.h')
-rw-r--r--source/blender/makesrna/RNA_types.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 69cb2caf058..ff9a7ef1d22 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -146,7 +146,7 @@ typedef enum PropertySubType {
} PropertySubType;
/* Make sure enums are updated with thses */
-/* HIGHEST FLAG IN USE: 1 << 29 */
+/* HIGHEST FLAG IN USE: 1 << 30 */
typedef enum PropertyFlag {
/* editable means the property is editable in the user
* interface, properties are editable by default except
@@ -172,10 +172,16 @@ typedef enum PropertyFlag {
/* do not write in presets */
PROP_SKIP_SAVE = (1 << 28),
- /* function paramater flags */
+ /* function parameter flags */
PROP_REQUIRED = (1 << 2),
PROP_OUTPUT = (1 << 3),
PROP_RNAPTR = (1 << 11),
+ /* This allows for non-breaking API updates, when adding non-critical new parameter to a callback function.
+ * This way, old py code defining funcs without that parameter would still work.
+ * WARNING: any parameter after the first PYFUNC_OPTIONAL one will be considered as optional!
+ * NOTE: only for input parameters!
+ */
+ PROP_PYFUNC_OPTIONAL = (1 << 30),
/* registering */
PROP_REGISTER = (1 << 4),
PROP_REGISTER_OPTIONAL = (1 << 4) | (1 << 5),