2011-02-23 11:52:22 +01:00
|
|
|
/*
|
2008-11-01 00:50:02 +01:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 14:34:04 +01:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-01 00:50:02 +01:00
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation (2008).
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 21:20:01 +01:00
|
|
|
/** \file blender/makesrna/RNA_types.h
|
|
|
|
* \ingroup RNA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2013-05-28 21:35:26 +02:00
|
|
|
#include "../blenlib/BLI_sys_types.h"
|
2010-08-31 13:31:21 +02:00
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#ifndef __RNA_TYPES_H__
|
|
|
|
#define __RNA_TYPES_H__
|
2008-11-01 00:50:02 +01:00
|
|
|
|
2009-03-15 00:17:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-04-07 02:49:39 +02:00
|
|
|
struct ParameterList;
|
|
|
|
struct FunctionRNA;
|
2008-11-24 16:51:55 +01:00
|
|
|
struct PropertyRNA;
|
|
|
|
struct StructRNA;
|
|
|
|
struct BlenderRNA;
|
2009-04-19 15:37:59 +02:00
|
|
|
struct bContext;
|
2011-05-18 12:56:26 +02:00
|
|
|
struct Main;
|
2009-04-19 15:37:59 +02:00
|
|
|
struct ReportList;
|
2008-11-24 16:51:55 +01:00
|
|
|
|
2011-02-27 21:20:01 +01:00
|
|
|
/** Pointer
|
2008-11-07 03:58:25 +01:00
|
|
|
*
|
|
|
|
* RNA pointers are not a single C pointer but include the type,
|
|
|
|
* and a pointer to the ID struct that owns the struct, since
|
|
|
|
* in some cases this information is needed to correctly get/set
|
|
|
|
* the properties and validate them. */
|
|
|
|
|
|
|
|
typedef struct PointerRNA {
|
|
|
|
struct {
|
|
|
|
void *data;
|
|
|
|
} id;
|
|
|
|
|
|
|
|
struct StructRNA *type;
|
|
|
|
void *data;
|
|
|
|
} PointerRNA;
|
|
|
|
|
2009-10-02 01:32:57 +02:00
|
|
|
typedef struct PropertyPointerRNA {
|
|
|
|
PointerRNA ptr;
|
|
|
|
struct PropertyRNA *prop;
|
|
|
|
} PropertyPointerRNA;
|
|
|
|
|
2016-07-30 08:34:01 +02:00
|
|
|
/**
|
|
|
|
* Stored result of a RNA path lookup (as used by anim-system)
|
|
|
|
*/
|
|
|
|
typedef struct PathResolvedRNA {
|
|
|
|
struct PointerRNA ptr;
|
|
|
|
struct PropertyRNA *prop;
|
|
|
|
/* -1 for non-array access */
|
|
|
|
int prop_index;
|
|
|
|
} PathResolvedRNA;
|
|
|
|
|
2008-11-07 03:58:25 +01:00
|
|
|
/* Property */
|
2008-11-01 00:50:02 +01:00
|
|
|
|
|
|
|
typedef enum PropertyType {
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_BOOLEAN = 0,
|
|
|
|
PROP_INT = 1,
|
|
|
|
PROP_FLOAT = 2,
|
|
|
|
PROP_STRING = 3,
|
|
|
|
PROP_ENUM = 4,
|
|
|
|
PROP_POINTER = 5,
|
|
|
|
PROP_COLLECTION = 6,
|
2008-11-01 00:50:02 +01:00
|
|
|
} PropertyType;
|
|
|
|
|
2009-08-11 13:50:40 +02:00
|
|
|
/* also update rna_property_subtype_unit when you change this */
|
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 23:31:05 +02:00
|
|
|
typedef enum PropertyUnit {
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_UNIT_NONE = (0 << 16),
|
|
|
|
PROP_UNIT_LENGTH = (1 << 16), /* m */
|
|
|
|
PROP_UNIT_AREA = (2 << 16), /* m^2 */
|
|
|
|
PROP_UNIT_VOLUME = (3 << 16), /* m^3 */
|
|
|
|
PROP_UNIT_MASS = (4 << 16), /* kg */
|
|
|
|
PROP_UNIT_ROTATION = (5 << 16), /* radians */
|
|
|
|
PROP_UNIT_TIME = (6 << 16), /* frame */
|
|
|
|
PROP_UNIT_VELOCITY = (7 << 16), /* m/s */
|
2013-03-13 18:16:49 +01:00
|
|
|
PROP_UNIT_ACCELERATION = (8 << 16), /* m/(s^2) */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_UNIT_CAMERA = (9 << 16), /* mm */
|
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 23:31:05 +02:00
|
|
|
} PropertyUnit;
|
|
|
|
|
2012-04-10 11:03:45 +02:00
|
|
|
#define RNA_SUBTYPE_UNIT(subtype) ((subtype) & 0x00FF0000)
|
|
|
|
#define RNA_SUBTYPE_VALUE(subtype) ((subtype) & ~0x00FF0000)
|
|
|
|
#define RNA_SUBTYPE_UNIT_VALUE(subtype) ((subtype) >> 16)
|
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 23:31:05 +02:00
|
|
|
|
2009-12-07 01:16:57 +01:00
|
|
|
#define RNA_ENUM_BITFLAG_SIZE 32
|
|
|
|
|
2012-04-10 10:33:30 +02:00
|
|
|
#define RNA_TRANSLATION_PREC_DEFAULT 5
|
|
|
|
|
2017-11-29 15:16:12 +01:00
|
|
|
#define RNA_STACK_ARRAY 32
|
|
|
|
|
2011-09-05 23:01:50 +02:00
|
|
|
/* also update enums in bpy_props.c when adding items here
|
|
|
|
* watch it: these values are written to files as part of
|
|
|
|
* node socket button subtypes!
|
|
|
|
*/
|
2008-11-01 00:50:02 +01:00
|
|
|
typedef enum PropertySubType {
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_NONE = 0,
|
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 23:31:05 +02:00
|
|
|
|
|
|
|
/* strings */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_FILEPATH = 1,
|
|
|
|
PROP_DIRPATH = 2,
|
|
|
|
PROP_FILENAME = 3,
|
|
|
|
PROP_BYTESTRING = 4, /* a string which should be represented as bytes in python, NULL terminated though. */
|
Python i18n API. Many thanks to Campbell and Brecht for the reviews and suggestions!
This commit adds:
* A new bpy.app.translations module giving some info about locales/translation stuff (current active locale, all locales currently known by blender, all translation contexts currently defined, etc.).
* The ability for addons to feature translations, using the (un)register functions of above module.
* Also cleans up "translate py string when storing into RNA prop" by removing "PROP_TRANSLATE" string's subtype, and adding a PROP_STRING_PY_TRANSLATE flag instead (this way it is no more exposed to python...).
Addon translations work with py dictionaries: each addon features a dict {lang: {(context, message): translation, ...}, ...}, which is registered when the addon is enabled (and unregistered when disabled).
Then, when a key (context, message) is not found in regular mo catalog, a cache dict for current locale is built from all registered addon translations, and key is searched in it.
Note: currently addons writers have to do all the work by hand, will add something (probably extend "edit translation" addon) to automate messages extraction from addons soon(ish)! To get a look to expected behavior from addons, have a look at render_copy_settings/__init__.py and render_copy_settings/translations.py (rather stupid example currently, but...). Once we have a complete process, I'll also update relevant wiki pages.
2013-01-20 18:29:07 +01:00
|
|
|
/* 5 was used by "PROP_TRANSLATE" sub-type, which is now a flag. */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_PASSWORD = 6, /* a string which should not be displayed in UI */
|
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 23:31:05 +02:00
|
|
|
|
|
|
|
/* numbers */
|
2013-12-12 18:39:15 +01:00
|
|
|
PROP_PIXEL = 12,
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_UNSIGNED = 13,
|
|
|
|
PROP_PERCENTAGE = 14,
|
|
|
|
PROP_FACTOR = 15,
|
|
|
|
PROP_ANGLE = 16 | PROP_UNIT_ROTATION,
|
|
|
|
PROP_TIME = 17 | PROP_UNIT_TIME,
|
2013-02-12 06:09:35 +01:00
|
|
|
/* distance in 3d space, don't use for pixel distance for eg. */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_DISTANCE = 18 | PROP_UNIT_LENGTH,
|
|
|
|
PROP_DISTANCE_CAMERA = 19 | PROP_UNIT_CAMERA,
|
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 23:31:05 +02:00
|
|
|
|
|
|
|
/* number arrays */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_COLOR = 20,
|
|
|
|
PROP_TRANSLATION = 21 | PROP_UNIT_LENGTH,
|
|
|
|
PROP_DIRECTION = 22,
|
|
|
|
PROP_VELOCITY = 23 | PROP_UNIT_VELOCITY,
|
|
|
|
PROP_ACCELERATION = 24 | PROP_UNIT_ACCELERATION,
|
|
|
|
PROP_MATRIX = 25,
|
|
|
|
PROP_EULER = 26 | PROP_UNIT_ROTATION,
|
|
|
|
PROP_QUATERNION = 27,
|
|
|
|
PROP_AXISANGLE = 28,
|
|
|
|
PROP_XYZ = 29,
|
|
|
|
PROP_XYZ_LENGTH = 29 | PROP_UNIT_LENGTH,
|
|
|
|
PROP_COLOR_GAMMA = 30, /* used for colors which would be color managed before display */
|
|
|
|
PROP_COORDS = 31, /* generic array, no units applied, only that x/y/z/w are used (python vec) */
|
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 23:31:05 +02:00
|
|
|
|
2009-09-09 19:39:19 +02:00
|
|
|
/* booleans */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_LAYER = 40,
|
|
|
|
PROP_LAYER_MEMBER = 41,
|
2008-11-01 00:50:02 +01:00
|
|
|
} PropertySubType;
|
|
|
|
|
2013-08-30 15:24:16 +02:00
|
|
|
/* Make sure enums are updated with these */
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
/* HIGHEST FLAG IN USE: 1 << 31
|
2018-05-01 15:24:17 +02:00
|
|
|
* FREE FLAGS: 11, 13, 14, 15, 30 */
|
2008-11-01 00:50:02 +01:00
|
|
|
typedef enum PropertyFlag {
|
2008-11-07 03:58:25 +01:00
|
|
|
/* editable means the property is editable in the user
|
2009-01-17 14:54:56 +01:00
|
|
|
* interface, properties are editable by default except
|
|
|
|
* for pointers and collections. */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_EDITABLE = (1 << 0),
|
2008-11-07 03:58:25 +01:00
|
|
|
|
2009-07-24 18:41:12 +02:00
|
|
|
/* this property is editable even if it is lib linked,
|
|
|
|
* meaning it will get lost on reload, but it's useful
|
|
|
|
* for editing. */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_LIB_EXCEPTION = (1 << 16),
|
2009-07-24 18:41:12 +02:00
|
|
|
|
2012-03-03 12:45:08 +01:00
|
|
|
/* animatable means the property can be driven by some
|
2008-11-07 03:58:25 +01:00
|
|
|
* other input, be it animation curves, expressions, ..
|
2012-03-03 12:45:08 +01:00
|
|
|
* properties are animatable by default except for pointers
|
2009-01-17 14:54:56 +01:00
|
|
|
* and collections */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_ANIMATABLE = (1 << 1),
|
2008-11-14 15:34:19 +01:00
|
|
|
|
2017-11-29 15:31:31 +01:00
|
|
|
/* Means the property can be overriden by a local 'proxy' of some linked datablock. */
|
2017-12-01 17:33:56 +01:00
|
|
|
PROP_OVERRIDABLE_STATIC = (1 << 2),
|
2018-05-01 15:24:17 +02:00
|
|
|
/* The property supports insertion (collections only). */
|
|
|
|
PROP_OVERRIDABLE_STATIC_INSERTION = (1 << 9),
|
2017-11-29 15:31:31 +01:00
|
|
|
|
2018-03-23 16:30:57 +01:00
|
|
|
/* Forbid usage of this property in comparison (& hence override) code.
|
|
|
|
* Useful e.g. for collections of data like mesh's geometry, particles, etc. */
|
|
|
|
PROP_NO_COMPARISON = (1 << 3),
|
|
|
|
|
2017-01-11 22:11:13 +01:00
|
|
|
/* This flag means when the property's widget is in 'textedit' mode, it will be updated
|
|
|
|
* after every typed char, instead of waiting final validation. Used e.g. for text searchbox.
|
|
|
|
* It will also cause UI_BUT_VALUE_CLEAR to be set for text buttons. We could add an own flag
|
|
|
|
* for search/filter properties, but this works just fine for now. */
|
2017-07-29 00:42:32 +02:00
|
|
|
PROP_TEXTEDIT_UPDATE = (1u << 31),
|
2014-12-25 12:53:13 +01:00
|
|
|
|
2009-06-16 02:52:21 +02:00
|
|
|
/* icon */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_ICONS_CONSECUTIVE = (1 << 12),
|
2009-06-16 02:52:21 +02:00
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 20:40:03 +02:00
|
|
|
/* hidden in the user interface */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_HIDDEN = (1 << 19),
|
2011-06-07 12:54:57 +02:00
|
|
|
/* do not write in presets */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_SKIP_SAVE = (1 << 28),
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 20:40:03 +02:00
|
|
|
|
2014-02-08 20:30:48 +01:00
|
|
|
/* numbers */
|
|
|
|
|
|
|
|
/* each value is related proportionally (object scale, image size) */
|
|
|
|
PROP_PROPORTIONAL = (1 << 26),
|
|
|
|
|
2009-05-29 17:12:31 +02:00
|
|
|
/* pointers */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_ID_REFCOUNT = (1 << 6),
|
2009-10-14 15:20:20 +02:00
|
|
|
|
|
|
|
/* disallow assigning a variable to its self, eg an object tracking its self
|
|
|
|
* only apply this to types that are derived from an ID ()*/
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_ID_SELF_CHECK = (1 << 20),
|
2012-04-09 06:39:47 +02:00
|
|
|
/* use for...
|
|
|
|
* - pointers: in the UI and python so unsetting or setting to None won't work
|
|
|
|
* - strings: so our internal generated get/length/set functions know to do NULL checks before access [#30865] */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_NEVER_NULL = (1 << 18),
|
2010-12-30 13:22:28 +01:00
|
|
|
/* currently only used for UI, this is similar to PROP_NEVER_NULL
|
|
|
|
* except that the value may be NULL at times, used for ObData, where an Empty's will be NULL
|
|
|
|
* but setting NULL on a mesh object is not possible. So, if its not NULL, setting NULL cant be done! */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_NEVER_UNLINK = (1 << 25),
|
2009-05-29 17:12:31 +02:00
|
|
|
|
2017-12-18 10:08:22 +01:00
|
|
|
/* Pointers to data that is not owned by the struct.
|
|
|
|
* Typical example: Bone.parent, Bone.child, etc., and nearly all ID pointers.
|
|
|
|
* This is crucial information for processes that walk the whole data of an ID e.g. (like static override).
|
|
|
|
* Note that all ID pointers are enforced to this by default, this probably will need to be rechecked
|
|
|
|
* (see ugly infamous NodeTrees of mat/tex/scene/etc.). */
|
|
|
|
PROP_PTR_NO_OWNERSHIP = (1 << 7),
|
|
|
|
|
2009-12-22 17:11:11 +01:00
|
|
|
/* flag contains multiple enums.
|
|
|
|
* note: not to be confused with prop->enumbitflags
|
|
|
|
* this exposes the flag as multiple options in python and the UI.
|
|
|
|
*
|
|
|
|
* note: these can't be animated so use with care.
|
2012-03-09 19:28:30 +01:00
|
|
|
*/
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_ENUM_FLAG = (1 << 21),
|
2009-12-07 01:16:57 +01:00
|
|
|
|
2009-12-08 18:23:48 +01:00
|
|
|
/* need context for update function */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_CONTEXT_UPDATE = (1 << 22),
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
PROP_CONTEXT_PROPERTY_UPDATE = PROP_CONTEXT_UPDATE | (1 << 27),
|
|
|
|
|
|
|
|
/* registering */
|
|
|
|
PROP_REGISTER = (1 << 4),
|
|
|
|
PROP_REGISTER_OPTIONAL = PROP_REGISTER | (1 << 5),
|
2009-12-08 18:23:48 +01:00
|
|
|
|
2012-07-17 01:23:33 +02:00
|
|
|
/* Use for arrays or for any data that should not have a reference kept
|
2009-12-28 23:59:09 +01:00
|
|
|
* most common case is functions that return arrays where the array */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_THICK_WRAP = (1 << 23),
|
2009-12-28 23:59:09 +01:00
|
|
|
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
PROP_EXPORT = (1 << 8), /* XXX Is this still used? makesrna.c seems to ignore it currently... */
|
|
|
|
PROP_IDPROPERTY = (1 << 10), /* This is an IDProperty, not a DNA one. */
|
2013-08-30 15:24:16 +02:00
|
|
|
PROP_DYNAMIC = (1 << 17), /* for dynamic arrays, and retvals of type string */
|
|
|
|
PROP_ENUM_NO_CONTEXT = (1 << 24), /* for enum that shouldn't be contextual */
|
2017-11-22 13:52:39 +01:00
|
|
|
PROP_ENUM_NO_TRANSLATE = (1 << 29), /* for enums not to be translated (e.g. viewlayers' names in nodes) */
|
2008-11-01 00:50:02 +01:00
|
|
|
} PropertyFlag;
|
|
|
|
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
/* Function parameters flags.
|
|
|
|
* WARNING: 16bits only. */
|
|
|
|
typedef enum ParameterFlag {
|
|
|
|
PARM_REQUIRED = (1 << 0),
|
|
|
|
PARM_OUTPUT = (1 << 1),
|
|
|
|
PARM_RNAPTR = (1 << 2),
|
|
|
|
/* 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!
|
|
|
|
*/
|
|
|
|
PARM_PYFUNC_OPTIONAL = (1 << 3),
|
|
|
|
} ParameterFlag;
|
|
|
|
|
2014-04-05 14:36:18 +02:00
|
|
|
struct CollectionPropertyIterator;
|
|
|
|
struct Link;
|
|
|
|
typedef int (*IteratorSkipFunc)(struct CollectionPropertyIterator *iter, void *data);
|
|
|
|
|
|
|
|
typedef struct ListBaseIterator {
|
|
|
|
struct Link *link;
|
|
|
|
int flag;
|
|
|
|
IteratorSkipFunc skip;
|
|
|
|
} ListBaseIterator;
|
|
|
|
|
|
|
|
typedef struct ArrayIterator {
|
|
|
|
char *ptr;
|
|
|
|
char *endptr; /* past the last valid pointer, only for comparisons, ignores skipped values */
|
|
|
|
void *free_ptr; /* will be freed if set */
|
|
|
|
int itemsize;
|
|
|
|
|
|
|
|
/* array length with no skip functions applied, take care not to compare against index from animsys
|
|
|
|
* or python indices */
|
|
|
|
int length;
|
|
|
|
|
|
|
|
/* optional skip function, when set the array as viewed by rna can contain only a subset of the members.
|
|
|
|
* this changes indices so quick array index lookups are not possible when skip function is used. */
|
|
|
|
IteratorSkipFunc skip;
|
|
|
|
} ArrayIterator;
|
|
|
|
|
2008-11-01 00:50:02 +01:00
|
|
|
typedef struct CollectionPropertyIterator {
|
2009-02-02 20:57:57 +01:00
|
|
|
/* internal */
|
2008-11-14 18:05:25 +01:00
|
|
|
PointerRNA parent;
|
2009-05-20 11:17:21 +02:00
|
|
|
PointerRNA builtin_parent;
|
2008-11-24 16:51:55 +01:00
|
|
|
struct PropertyRNA *prop;
|
2014-04-05 14:36:18 +02:00
|
|
|
union {
|
|
|
|
ArrayIterator array;
|
|
|
|
ListBaseIterator listbase;
|
2017-04-21 12:31:48 +02:00
|
|
|
void *custom;
|
2014-04-05 14:36:18 +02:00
|
|
|
} internal;
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 21:38:52 +01:00
|
|
|
int idprop;
|
2009-02-02 20:57:57 +01:00
|
|
|
int level;
|
2008-11-14 18:05:25 +01:00
|
|
|
|
2009-02-02 20:57:57 +01:00
|
|
|
/* external */
|
2008-11-14 18:05:25 +01:00
|
|
|
PointerRNA ptr;
|
2011-10-03 03:36:25 +02:00
|
|
|
int valid;
|
2008-11-01 00:50:02 +01:00
|
|
|
} CollectionPropertyIterator;
|
|
|
|
|
2009-03-19 20:03:38 +01:00
|
|
|
typedef struct CollectionPointerLink {
|
|
|
|
struct CollectionPointerLink *next, *prev;
|
|
|
|
PointerRNA ptr;
|
|
|
|
} CollectionPointerLink;
|
|
|
|
|
2016-06-22 18:04:04 +02:00
|
|
|
/* Copy of ListBase for RNA... */
|
|
|
|
typedef struct CollectionListBase {
|
|
|
|
struct CollectionPointerLink *first, *last;
|
|
|
|
} CollectionListBase;
|
|
|
|
|
RNA
Implementation of RNA side of foreach_get/foreach_set,
Campbell will do python code.
Three functions for efficiently setting some property for all
items in a collection. RNA_property_collection_raw_array gives
access to the properties as an array with length, stride, and
type specified, if this is possible, i.e. not when it uses a
ListBase, or if a manual get/set function is implemented.
Two other functions take a C array pointer and get/set it
using the a collection + property name, using efficient array
access if possible, and otherwise using slower RNA iterator.
RNA_property_collection_raw_get
RNA_property_collection_raw_set
The number of type conversion required here got a bit out of
hand, it could be more efficient still if checking for more
cases, but function is already long enough.
Example: http://www.pasteall.org/6362/c
2009-06-29 21:15:51 +02:00
|
|
|
typedef enum RawPropertyType {
|
2012-05-12 13:01:29 +02:00
|
|
|
PROP_RAW_UNSET = -1,
|
2009-08-30 01:05:46 +02:00
|
|
|
PROP_RAW_INT, // XXX - abused for types that are not set, eg. MFace.verts, needs fixing.
|
RNA
Implementation of RNA side of foreach_get/foreach_set,
Campbell will do python code.
Three functions for efficiently setting some property for all
items in a collection. RNA_property_collection_raw_array gives
access to the properties as an array with length, stride, and
type specified, if this is possible, i.e. not when it uses a
ListBase, or if a manual get/set function is implemented.
Two other functions take a C array pointer and get/set it
using the a collection + property name, using efficient array
access if possible, and otherwise using slower RNA iterator.
RNA_property_collection_raw_get
RNA_property_collection_raw_set
The number of type conversion required here got a bit out of
hand, it could be more efficient still if checking for more
cases, but function is already long enough.
Example: http://www.pasteall.org/6362/c
2009-06-29 21:15:51 +02:00
|
|
|
PROP_RAW_SHORT,
|
2009-08-30 01:05:46 +02:00
|
|
|
PROP_RAW_CHAR,
|
|
|
|
PROP_RAW_DOUBLE,
|
|
|
|
PROP_RAW_FLOAT
|
RNA
Implementation of RNA side of foreach_get/foreach_set,
Campbell will do python code.
Three functions for efficiently setting some property for all
items in a collection. RNA_property_collection_raw_array gives
access to the properties as an array with length, stride, and
type specified, if this is possible, i.e. not when it uses a
ListBase, or if a manual get/set function is implemented.
Two other functions take a C array pointer and get/set it
using the a collection + property name, using efficient array
access if possible, and otherwise using slower RNA iterator.
RNA_property_collection_raw_get
RNA_property_collection_raw_set
The number of type conversion required here got a bit out of
hand, it could be more efficient still if checking for more
cases, but function is already long enough.
Example: http://www.pasteall.org/6362/c
2009-06-29 21:15:51 +02:00
|
|
|
} RawPropertyType;
|
|
|
|
|
|
|
|
typedef struct RawArray {
|
|
|
|
void *array;
|
|
|
|
RawPropertyType type;
|
|
|
|
int len;
|
|
|
|
int stride;
|
|
|
|
} RawArray;
|
|
|
|
|
2016-05-08 18:32:54 +02:00
|
|
|
/**
|
|
|
|
* This struct is are typically defined in arrays which define an *enum* for RNA,
|
|
|
|
* which is used by the RNA API both for user-interface and the Python API.
|
|
|
|
*/
|
2008-11-14 19:46:57 +01:00
|
|
|
typedef struct EnumPropertyItem {
|
2016-05-08 18:32:54 +02:00
|
|
|
/** The internal value of the enum, not exposed to users. */
|
2008-11-01 00:50:02 +01:00
|
|
|
int value;
|
2016-05-08 18:32:54 +02:00
|
|
|
/**
|
|
|
|
* Note that identifiers must be unique within the array,
|
|
|
|
* by convention they're upper case with underscores for separators.
|
|
|
|
* - An empty string is used to define menu separators.
|
|
|
|
* - NULL denotes the end of the array of items.
|
|
|
|
*/
|
2008-11-14 19:46:57 +01:00
|
|
|
const char *identifier;
|
2016-05-08 18:32:54 +02:00
|
|
|
/** Optional icon, typically 'ICON_NONE' */
|
2009-06-16 02:52:21 +02:00
|
|
|
int icon;
|
2016-05-08 18:32:54 +02:00
|
|
|
/** Name displayed in the interface. */
|
2008-11-01 00:50:02 +01:00
|
|
|
const char *name;
|
2016-05-08 18:32:54 +02:00
|
|
|
/** Longer description used in the interface. */
|
2008-11-24 13:12:24 +01:00
|
|
|
const char *description;
|
2008-11-14 19:46:57 +01:00
|
|
|
} EnumPropertyItem;
|
2008-11-01 00:50:02 +01:00
|
|
|
|
2013-01-05 15:56:37 +01:00
|
|
|
/* extended versions with PropertyRNA argument */
|
|
|
|
typedef int (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
|
|
|
|
typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
|
|
|
|
typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
|
|
|
|
typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values);
|
|
|
|
typedef int (*IntPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
|
|
|
|
typedef void (*IntPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
|
|
|
|
typedef void (*IntArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
|
|
|
|
typedef void (*IntArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values);
|
|
|
|
typedef void (*IntPropertyRangeFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *min, int *max, int *softmin, int *softmax);
|
|
|
|
typedef float (*FloatPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
|
|
|
|
typedef void (*FloatPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float value);
|
|
|
|
typedef void (*FloatArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *values);
|
|
|
|
typedef void (*FloatArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const float *values);
|
|
|
|
typedef void (*FloatPropertyRangeFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *min, float *max, float *softmin, float *softmax);
|
|
|
|
typedef void (*StringPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, char *value);
|
|
|
|
typedef int (*StringPropertyLengthFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
|
|
|
|
typedef void (*StringPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const char *value);
|
|
|
|
typedef int (*EnumPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
|
|
|
|
typedef void (*EnumPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
|
|
|
|
/* same as PropEnumItemFunc */
|
2017-10-18 06:07:26 +02:00
|
|
|
typedef const EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
|
2009-07-08 17:34:41 +02:00
|
|
|
|
2008-11-17 19:44:06 +01:00
|
|
|
typedef struct PropertyRNA PropertyRNA;
|
2008-11-01 00:50:02 +01:00
|
|
|
|
2009-04-07 02:49:39 +02:00
|
|
|
/* Parameter List */
|
|
|
|
|
2009-07-17 04:31:28 +02:00
|
|
|
typedef struct ParameterList {
|
|
|
|
/* storage for parameters */
|
|
|
|
void *data;
|
|
|
|
|
2011-10-03 03:36:25 +02:00
|
|
|
/* function passed at creation time */
|
|
|
|
struct FunctionRNA *func;
|
|
|
|
|
2010-03-23 16:04:06 +01:00
|
|
|
/* store the parameter size */
|
|
|
|
int alloc_size;
|
|
|
|
|
|
|
|
int arg_count, ret_count;
|
2009-07-17 04:31:28 +02:00
|
|
|
} ParameterList;
|
2009-04-07 02:49:39 +02:00
|
|
|
|
|
|
|
typedef struct ParameterIterator {
|
2009-07-17 04:31:28 +02:00
|
|
|
struct ParameterList *parms;
|
2011-08-15 05:41:31 +02:00
|
|
|
/* PointerRNA funcptr; */ /*UNUSED*/
|
2009-04-07 02:49:39 +02:00
|
|
|
void *data;
|
|
|
|
int size, offset;
|
|
|
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
int valid;
|
|
|
|
} ParameterIterator;
|
|
|
|
|
2010-08-31 13:31:21 +02:00
|
|
|
/* mainly to avoid confusing casts */
|
|
|
|
typedef struct ParameterDynAlloc {
|
|
|
|
intptr_t array_tot; /* important, this breaks when set to an int */
|
|
|
|
void *array;
|
|
|
|
} ParameterDynAlloc;
|
|
|
|
|
2009-04-07 02:49:39 +02:00
|
|
|
/* Function */
|
|
|
|
|
|
|
|
typedef enum FunctionFlag {
|
2018-02-09 12:04:29 +01:00
|
|
|
/***** Options affecting callback signature. *****/
|
|
|
|
/* Those add additionnal parameters at the beginning of the C callback, like that:
|
|
|
|
* rna_my_func([ID *_selfid],
|
|
|
|
* [<DNA_STRUCT> *self|StructRNA *type],
|
|
|
|
* [Main *bmain],
|
|
|
|
* [bContext *C],
|
|
|
|
* [ReportList *reports],
|
|
|
|
* <other RNA-defined parameters>);
|
|
|
|
*/
|
|
|
|
/* Pass ID owning 'self' data (i.e. ptr->id.data, might be same as self in case data is an ID...). */
|
|
|
|
FUNC_USE_SELF_ID = (1 << 11),
|
|
|
|
|
|
|
|
/* Do not pass the object (DNA struct pointer) from which it is called, used to define static or class functions. */
|
|
|
|
FUNC_NO_SELF = (1 << 0),
|
|
|
|
/* Pass RNA type, used to define class functions, only valid when FUNC_NO_SELF is set. */
|
|
|
|
FUNC_USE_SELF_TYPE = (1 << 1),
|
|
|
|
|
|
|
|
/* Pass Main, bContext and/or ReportList. */
|
2013-08-30 15:24:16 +02:00
|
|
|
FUNC_USE_MAIN = (1 << 2),
|
|
|
|
FUNC_USE_CONTEXT = (1 << 3),
|
|
|
|
FUNC_USE_REPORTS = (1 << 4),
|
2009-04-07 02:49:39 +02:00
|
|
|
|
2018-02-09 12:04:29 +01:00
|
|
|
|
|
|
|
/***** Registering of python subclasses. *****/
|
|
|
|
/* This function is part of the registerable class' interface, and can be implemented/redefined in python. */
|
2013-08-30 15:24:16 +02:00
|
|
|
FUNC_REGISTER = (1 << 5),
|
2018-02-09 12:04:29 +01:00
|
|
|
/* Subclasses can choose not to implement this function. */
|
2013-08-30 15:24:16 +02:00
|
|
|
FUNC_REGISTER_OPTIONAL = FUNC_REGISTER | (1 << 6),
|
2018-02-09 12:04:29 +01:00
|
|
|
/* If not set, the python function implementing this call is not allowed to write into data-blocks.
|
|
|
|
* Except for WindowManager and Screen currently, see rna_id_write_error() in bpy_rna.c */
|
|
|
|
FUNC_ALLOW_WRITE = (1 << 12),
|
2009-04-19 15:37:59 +02:00
|
|
|
|
2018-02-09 12:04:29 +01:00
|
|
|
/***** Internal flags. *****/
|
|
|
|
/* UNUSED CURRENTLY? ??? */
|
2013-08-30 15:24:16 +02:00
|
|
|
FUNC_BUILTIN = (1 << 7),
|
2018-02-09 12:04:29 +01:00
|
|
|
/* UNUSED CURRENTLY. ??? */
|
2013-08-30 15:24:16 +02:00
|
|
|
FUNC_EXPORT = (1 << 8),
|
2018-02-09 12:04:29 +01:00
|
|
|
/* Function has been defined at runtime, not statically in RNA source code. */
|
2013-08-30 15:24:16 +02:00
|
|
|
FUNC_RUNTIME = (1 << 9),
|
2018-02-09 12:04:29 +01:00
|
|
|
/* UNUSED CURRENTLY? Function owns its identifier and description strings, and has to free them when deleted. */
|
2013-08-30 15:24:16 +02:00
|
|
|
FUNC_FREE_POINTERS = (1 << 10),
|
2009-04-07 02:49:39 +02:00
|
|
|
} FunctionFlag;
|
|
|
|
|
2009-06-18 21:48:55 +02:00
|
|
|
typedef void (*CallFunc)(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, ParameterList *parms);
|
2009-04-07 02:49:39 +02:00
|
|
|
|
|
|
|
typedef struct FunctionRNA FunctionRNA;
|
|
|
|
|
2008-11-07 03:58:25 +01:00
|
|
|
/* Struct */
|
|
|
|
|
|
|
|
typedef enum StructFlag {
|
2009-05-29 17:12:31 +02:00
|
|
|
/* indicates that this struct is an ID struct, and to use refcounting */
|
2013-08-30 15:24:16 +02:00
|
|
|
STRUCT_ID = (1 << 0),
|
|
|
|
STRUCT_ID_REFCOUNT = (1 << 1),
|
|
|
|
STRUCT_UNDO = (1 << 2), /* defaults on, clear for user preferences and similar */
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 03:23:46 +01:00
|
|
|
|
|
|
|
/* internal flags */
|
2013-08-30 15:24:16 +02:00
|
|
|
STRUCT_RUNTIME = (1 << 3),
|
|
|
|
STRUCT_GENERATED = (1 << 4),
|
|
|
|
STRUCT_FREE_POINTERS = (1 << 5),
|
2015-11-16 05:28:47 +01:00
|
|
|
STRUCT_NO_IDPROPERTIES = (1 << 6), /* Menus and Panels don't need properties */
|
Datablock ID Properties
The absence of datablock properties "will certainly be resolved soon as the need for them is becoming obvious" said the [[http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.67/Python_Nodes|Python Nodes release notes]]. So this patch allows Python scripts to create ID Properties which reference datablocks.
This functionality is implemented for `PointerProperty` and now such properties can be created with Python.
In addition to the standard update callback, `PointerProperty` can have a `poll` callback (standard RNA) which is useful for search menus. For details see the test included in this patch.
Original author: @artfunkel
Alexander (Blend4Web Team)
Reviewers: brecht, artfunkel, mont29, campbellbarton
Reviewed By: mont29, campbellbarton
Subscribers: jta, sergey, campbellbarton, wisaac, poseidon4o, mont29, homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov, fjuhec, sharlybg, cardboard, duarteframos, blueprintrandom, a.romanov, BYOB, disnel, aditiapratama, bliblubli, dfelinto, lukastoenne
Maniphest Tasks: T37754
Differential Revision: https://developer.blender.org/D113
2017-04-13 11:30:03 +02:00
|
|
|
STRUCT_NO_DATABLOCK_IDPROPERTIES = (1 << 7), /* e.g. for Operator */
|
|
|
|
STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES = (1 << 8), /* for PropertyGroup which contains pointers to datablocks */
|
2017-08-31 15:32:21 +02:00
|
|
|
STRUCT_PUBLIC_NAMESPACE = (1 << 9), /* Added to type-map #BlenderRNA.structs_map */
|
|
|
|
STRUCT_PUBLIC_NAMESPACE_INHERIT = (1 << 10), /* All subtypes are added too. */
|
2008-11-07 03:58:25 +01:00
|
|
|
} StructFlag;
|
|
|
|
|
2009-04-19 15:37:59 +02:00
|
|
|
typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);
|
2010-12-07 05:12:15 +01:00
|
|
|
typedef int (*StructCallbackFunc)(struct bContext *C, struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list);
|
2009-04-19 15:37:59 +02:00
|
|
|
typedef void (*StructFreeFunc)(void *data);
|
2012-04-15 09:24:14 +02:00
|
|
|
typedef struct StructRNA *(*StructRegisterFunc)(
|
|
|
|
struct Main *bmain, struct ReportList *reports, void *data, const char *identifier,
|
|
|
|
StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
|
|
|
|
|
2011-05-18 12:56:26 +02:00
|
|
|
typedef void (*StructUnregisterFunc)(struct Main *bmain, struct StructRNA *type);
|
2011-05-18 13:21:10 +02:00
|
|
|
typedef void **(*StructInstanceFunc)(PointerRNA *ptr);
|
2009-04-19 15:37:59 +02:00
|
|
|
|
2008-11-17 19:44:06 +01:00
|
|
|
typedef struct StructRNA StructRNA;
|
2008-11-01 00:50:02 +01:00
|
|
|
|
2008-11-07 03:58:25 +01:00
|
|
|
/* Blender RNA
|
|
|
|
*
|
|
|
|
* Root RNA data structure that lists all struct types. */
|
|
|
|
|
2008-11-17 19:44:06 +01:00
|
|
|
typedef struct BlenderRNA BlenderRNA;
|
2008-11-01 00:50:02 +01:00
|
|
|
|
2009-07-21 22:05:16 +02:00
|
|
|
/* Extending
|
|
|
|
*
|
|
|
|
* This struct must be embedded in *Type structs in
|
|
|
|
* order to make then definable through RNA. */
|
|
|
|
|
|
|
|
typedef struct ExtensionRNA {
|
|
|
|
void *data;
|
|
|
|
StructRNA *srna;
|
2010-12-07 05:12:15 +01:00
|
|
|
StructCallbackFunc call;
|
|
|
|
StructFreeFunc free;
|
2009-07-21 22:05:16 +02:00
|
|
|
} ExtensionRNA;
|
|
|
|
|
2009-03-15 00:17:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#endif /* __RNA_TYPES_H__ */
|