Blender V5.0
rna_internal_types.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include <optional>
12#include <string>
13
14#include "BLI_vector_set.hh"
15
16#include "DNA_listBase.h"
17
18#include "RNA_access.hh"
19#include "RNA_define.hh"
20#include "RNA_types.hh"
21
22struct BlenderRNA;
24struct ContainerRNA;
25struct FunctionRNA;
26struct GHash;
29struct IDProperty;
30struct Main;
31struct PointerRNA;
32struct PropertyRNA;
33struct ReportList;
34struct Scene;
35struct StructRNA;
36struct bContext;
37
38/* Function Callbacks */
39
50using UpdateFunc = void (*)(Main *bmain, Scene *active_scene, PointerRNA *ptr);
53
54using EditableFunc = int (*)(const PointerRNA *ptr, const char **r_info);
55using ItemEditableFunc = int (*)(const PointerRNA *ptr, int index);
58using StructPathFunc = std::optional<std::string> (*)(const PointerRNA *ptr);
59using PropUINameFunc = const char *(*)(const PointerRNA *ptr,
60 const PropertyRNA *prop,
61 bool do_translate);
62
65using PropBooleanSetFunc = void (*)(PointerRNA *ptr, bool value);
66using PropBooleanArrayGetFunc = void (*)(PointerRNA *ptr, bool *values);
67using PropBooleanArraySetFunc = void (*)(PointerRNA *ptr, const bool *values);
68using PropIntGetFunc = int (*)(PointerRNA *ptr);
69using PropIntSetFunc = void (*)(PointerRNA *ptr, int value);
70using PropIntArrayGetFunc = void (*)(PointerRNA *ptr, int *values);
71using PropIntArraySetFunc = void (*)(PointerRNA *ptr, const int *values);
72using PropIntRangeFunc = void (*)(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
74using PropFloatSetFunc = void (*)(PointerRNA *ptr, float value);
75using PropFloatArrayGetFunc = void (*)(PointerRNA *ptr, float *values);
76using PropFloatArraySetFunc = void (*)(PointerRNA *ptr, const float *values);
78 void (*)(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax);
79using PropStringGetFunc = void (*)(PointerRNA *ptr, char *value);
81using PropStringSetFunc = void (*)(PointerRNA *ptr, const char *value);
82using PropEnumGetFunc = int (*)(PointerRNA *ptr);
83using PropEnumSetFunc = void (*)(PointerRNA *ptr, int value);
86 PropertyRNA *prop,
87 bool *r_free);
90using PropPointerSetFunc = void (*)(PointerRNA *ptr, const PointerRNA value, ReportList *reports);
91using PropPointerPollFunc = bool (*)(PointerRNA *ptr, const PointerRNA value);
93 const PointerRNA value,
94 const PropertyRNA *prop);
100using PropCollectionLookupIntFunc = bool (*)(PointerRNA *ptr, int key, PointerRNA *r_ptr);
102 const char *key,
103 PointerRNA *r_ptr);
105 int key,
106 const PointerRNA *assign_ptr);
107
108/* Extended versions with #PropertyRNA argument. */
109/* NOTE: All extended get/set callbacks will always get a 'real' PropertyRNA `prop` pointer, never
110 * an 'IDProperty as PropertyRNA' one (i.e. when called, the given `prop` is the RNA result of a
111 * call to `rna_property_rna_or_id_get` or one of its wrappers). */
112
114using PropBooleanSetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, bool value);
115using PropBooleanArrayGetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, bool *values);
116using PropBooleanArraySetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, const bool *values);
118using PropIntSetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, int value);
119using PropIntArrayGetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, int *values);
120using PropIntArraySetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, const int *values);
122 void (*)(PointerRNA *ptr, PropertyRNA *prop, int *min, int *max, int *softmin, int *softmax);
124using PropFloatSetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, float value);
125using PropFloatArrayGetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, float *values);
126using PropFloatArraySetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, const float *values);
127using PropFloatRangeFuncEx = void (*)(
128 PointerRNA *ptr, PropertyRNA *prop, float *min, float *max, float *softmin, float *softmax);
129using PropStringGetFuncEx = std::string (*)(PointerRNA *ptr, PropertyRNA *prop);
131using PropStringSetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, const std::string &value);
133using PropEnumSetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, int value);
134
135/* Transform step (applied after getting, or before setting the value). Currently only used by
136 * `bpy`, more details in the documentation of #BPyPropStore. */
137/* NOTE: All transform get/set callbacks will always get a 'real' PropertyRNA `prop` pointer, never
138 * an 'IDProperty as PropertyRNA' one (i.e. when called, the given `prop` is the RNA result of a
139 * call to `rna_property_rna_or_id_get` or one of its wrappers). */
140
157
158/* Handling override operations, and also comparison. */
159
217
263using RNAPropOverrideDiff = void (*)(Main *bmain, RNAPropertyOverrideDiffContext &rnadiff_ctx);
264
275using RNAPropOverrideStore = bool (*)(Main *bmain,
276 PointerRNA *ptr_local,
277 PointerRNA *ptr_reference,
278 PointerRNA *ptr_storage,
279 PropertyRNA *prop_local,
280 PropertyRNA *prop_reference,
281 PropertyRNA *prop_storage,
282 int len_local,
283 int len_reference,
284 int len_storage,
286
326using RNAPropOverrideApply = bool (*)(Main *bmain, RNAPropertyOverrideApplyContext &rnaapply_ctx);
327
331
339
344 const char *identifier;
345
347 int flag;
348
350 const char *description;
351
354
361};
362
456
458{
459 return prop->identifier;
460}
461
482
483/* Property Types. */
484
508
539
572
609
631
643
659
744
760
761#define CONTAINER_RNA_ID(cont) (*(const char **)(((ContainerRNA *)(cont)) + 1))
unsigned int uint
These structs are the foundation for all linked lists in the library system.
eRNAOverrideApplyFlag
@ RNA_OVERRIDE_APPLY_FLAG_NOP
eRNAOverrideMatch
eRNACompareMode
@ RNA_EQ_COMPARE
eRNAOverrideMatchResult
#define RNA_MAX_ARRAY_DIMENSION
Definition RNA_define.hh:27
void(*)(PointerRNA *ptr, PropertyRNA *prop, const float *new_values, const float *curr_values, bool is_set, float *r_values) FloatArrayPropertySetTransformFunc
Definition RNA_types.hh:745
float(*)(PointerRNA *ptr, PropertyRNA *prop, float value, bool is_set) FloatPropertyGetTransformFunc
Definition RNA_types.hh:733
PropertyScaleType
Definition RNA_types.hh:203
void(*)(PointerRNA *ptr, PropertyRNA *prop, const int *new_values, const int *curr_values, bool is_set, int *r_values) IntArrayPropertySetTransformFunc
Definition RNA_types.hh:722
int(*)(PointerRNA *ptr, PropertyRNA *prop, int value, bool is_set) EnumPropertyGetTransformFunc
Definition RNA_types.hh:823
int(*)(PointerRNA *ptr, PropertyRNA *prop, int value, bool is_set) IntPropertyGetTransformFunc
Definition RNA_types.hh:712
void(*)(PointerRNA *ptr, PropertyRNA *prop, const bool *new_values, const bool *curr_values, bool is_set, bool *r_values) BooleanArrayPropertySetTransformFunc
Definition RNA_types.hh:703
eStringPropertySearchFlag
Definition RNA_types.hh:778
StructRNA *(*)(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) StructRegisterFunc
Definition RNA_types.hh:991
void(*)( PointerRNA *ptr, PropertyRNA *prop, const bool *curr_values, bool is_set, bool *r_values) BooleanArrayPropertyGetTransformFunc
Definition RNA_types.hh:701
PropertyType
Definition RNA_types.hh:161
void(*)( PointerRNA *ptr, PropertyRNA *prop, const float *curr_values, bool is_set, float *r_values) FloatArrayPropertyGetTransformFunc
Definition RNA_types.hh:743
std::string(*)(PointerRNA *ptr, PropertyRNA *prop, const std::string &value, bool is_set) StringPropertyGetTransformFunc
Definition RNA_types.hh:759
bool(*)(Main *bmain, StructRNA *type) StructUnregisterFunc
Definition RNA_types.hh:999
void(*)(const bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *edit_text, blender::FunctionRef< void(StringPropertySearchVisitParams)> visit_fn) StringPropertySearchFunc
Definition RNA_types.hh:806
bool(*)(PointerRNA *ptr, PropertyRNA *prop, bool value, bool is_set) BooleanPropertyGetTransformFunc
Definition RNA_types.hh:690
int(*)(PointerRNA *ptr, PropertyRNA *prop, int new_value, int curr_value, bool is_set) IntPropertySetTransformFunc
Definition RNA_types.hh:716
void(*)( PointerRNA *ptr, PropertyRNA *prop, const int *curr_values, bool is_set, int *r_values) IntArrayPropertyGetTransformFunc
Definition RNA_types.hh:720
float(*)(PointerRNA *ptr, PropertyRNA *prop, float new_value, float curr_value, bool is_set) FloatPropertySetTransformFunc
Definition RNA_types.hh:737
bool(*)(PointerRNA *ptr, PropertyRNA *prop, bool new_value, bool curr_value, bool is_set) BooleanPropertySetTransformFunc
Definition RNA_types.hh:694
int(*)(PointerRNA *ptr, PropertyRNA *prop, int new_value, int curr_value, bool is_set) EnumPropertySetTransformFunc
Definition RNA_types.hh:827
PropertyPathTemplateType
Definition RNA_types.hh:484
void(*)(bContext *C, ReportList *reports, PointerRNA *ptr, ParameterList *parms) CallFunc
Definition RNA_types.hh:945
std::string(*)(PointerRNA *ptr, PropertyRNA *prop, const std::string &new_value, const std::string &curr_value, bool is_set) StringPropertySetTransformFunc
Definition RNA_types.hh:763
RawPropertyType
Definition RNA_types.hh:622
std::optional< std::string >(*)(const bContext *C, PointerRNA *ptr, PropertyRNA *prop) StringPropertyPathFilterFunc
Definition RNA_types.hh:817
void **(*)(PointerRNA *ptr) StructInstanceFunc
PropertySubType
Definition RNA_types.hh:232
#define C
Definition RandGen.cpp:29
nullptr float
float length(VecOp< float, D >) RET
VectorSet< T, InlineBufferCapacity, DefaultProbingStrategy, CustomIDHash< T, GetIDFn >, CustomIDEqual< T, GetIDFn > > CustomIDVectorSet
IntPropertyGetTransformFunc PropIntGetTransformFunc
bool(*)(Main *bmain, RNAPropertyOverrideApplyContext &rnaapply_ctx) RNAPropOverrideApply
EnumPropertySetTransformFunc PropEnumSetTransformFunc
StructRNA *(*)(PointerRNA *ptr) StructRefineFunc
IDProperty **(*)(PointerRNA *ptr) IDPropertiesFunc
BooleanPropertyGetTransformFunc PropBooleanGetTransformFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, const int *values) PropIntArraySetFuncEx
int(*)(PointerRNA *ptr, PropertyRNA *prop) PropStringLengthFuncEx
bool(*)(PointerRNA *ptr, const PointerRNA value, const PropertyRNA *prop) PropPointerPollFuncPy
const char *(*)(const PointerRNA *ptr, const PropertyRNA *prop, bool do_translate) PropUINameFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, int value) PropEnumSetFuncEx
void(*)(PointerRNA *ptr, PropertyRNA *prop, int value) PropIntSetFuncEx
void(*)(PointerRNA *ptr, bool *values) PropBooleanArrayGetFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, bool value) PropBooleanSetFuncEx
void(*)(CollectionPropertyIterator *iter) PropCollectionNextFunc
int(*)(PointerRNA *ptr) PropStringLengthFunc
void(*)(CollectionPropertyIterator *iter, PointerRNA *ptr) PropCollectionBeginFunc
void(*)(bContext *C, PointerRNA *ptr, PropertyRNA *prop) ContextPropUpdateFunc
bool(*)(PointerRNA *ptr, int key, PointerRNA *r_ptr) PropCollectionLookupIntFunc
PointerRNA(*)(CollectionPropertyIterator *iter) PropCollectionGetFunc
void(*)(bContext *C, PointerRNA *ptr) ContextUpdateFunc
void(*)( PointerRNA *ptr, PropertyRNA *prop, float *min, float *max, float *softmin, float *softmax) PropFloatRangeFuncEx
void(*)(PointerRNA *ptr, const PointerRNA value, ReportList *reports) PropPointerSetFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, const bool *values) PropBooleanArraySetFuncEx
PropertyFlagIntern
@ PROP_INTERN_BUILTIN
@ PROP_INTERN_RAW_ACCESS
@ PROP_INTERN_PTR_OWNERSHIP_FORCED
@ PROP_INTERN_FREE_POINTERS
@ PROP_INTERN_RAW_ARRAY
@ PROP_INTERN_RUNTIME
@ PROP_INTERN_PTR_ID_REFCOUNT_FORCED
FloatPropertyGetTransformFunc PropFloatGetTransformFunc
int(*)(const PointerRNA *ptr, int index) ItemEditableFunc
bool(*)(PointerRNA *ptr, PropertyRNA *prop) PropBooleanGetFuncEx
void(*)(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) PropFloatRangeFunc
void(*)(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) PropIntRangeFunc
StringPropertySetTransformFunc PropStringSetTransformFunc
EnumPropertyGetTransformFunc PropEnumGetTransformFunc
IntArrayPropertySetTransformFunc PropIntArraySetTransformFunc
bool(*)(PointerRNA *ptr, int key, const PointerRNA *assign_ptr) PropCollectionAssignIntFunc
BooleanPropertySetTransformFunc PropBooleanSetTransformFunc
FloatArrayPropertySetTransformFunc PropFloatArraySetTransformFunc
void(*)(PointerRNA *ptr, int value) PropEnumSetFunc
int(*)(PointerRNA *ptr) PropEnumGetFunc
IntPropertySetTransformFunc PropIntSetTransformFunc
void(*)(Main *bmain, Scene *active_scene, PointerRNA *ptr) UpdateFunc
int(*)(const PointerRNA *ptr, const char **r_info) EditableFunc
int(*)(PointerRNA *ptr, PropertyRNA *prop) PropEnumGetFuncEx
void(*)(PointerRNA *ptr, PropertyRNA *prop, float value) PropFloatSetFuncEx
void(*)(PointerRNA *ptr, int value) PropIntSetFunc
int(*)(const PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) PropArrayLengthGetFunc
FloatArrayPropertyGetTransformFunc PropFloatArrayGetTransformFunc
std::string(*)(PointerRNA *ptr, PropertyRNA *prop) PropStringGetFuncEx
BooleanArrayPropertyGetTransformFunc PropBooleanArrayGetTransformFunc
PointerRNA(*)(PointerRNA *ptr) PropPointerGetFunc
bool(*)(PointerRNA *ptr, const PointerRNA value) PropPointerPollFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, int *min, int *max, int *softmin, int *softmax) PropIntRangeFuncEx
const EnumPropertyItem *(*)(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) PropEnumItemFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, const float *values) PropFloatArraySetFuncEx
void(*)(PointerRNA *ptr, PropertyRNA *prop, float *values) PropFloatArrayGetFuncEx
IntArrayPropertyGetTransformFunc PropIntArrayGetTransformFunc
void(*)(PointerRNA *ptr, const float *values) PropFloatArraySetFunc
void(*)(Main *bmain, RNAPropertyOverrideDiffContext &rnadiff_ctx) RNAPropOverrideDiff
void(*)(PointerRNA *ptr, char *value) PropStringGetFunc
void(*)(PointerRNA *ptr, bool value) PropBooleanSetFunc
bool(*)(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) PropCollectionLookupStringFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, const std::string &value) PropStringSetFuncEx
std::optional< std::string >(*)(const PointerRNA *ptr) StructPathFunc
StructRNA *(*)(PointerRNA *ptr) PropPointerTypeFunc
int(*)(PointerRNA *ptr) PropCollectionLengthFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, int *values) PropIntArrayGetFuncEx
StringPropertyGetTransformFunc PropStringGetTransformFunc
BooleanArrayPropertySetTransformFunc PropBooleanArraySetTransformFunc
void(*)(PointerRNA *ptr, PropertyRNA *prop, bool *values) PropBooleanArrayGetFuncEx
void(*)(PointerRNA *ptr, const bool *values) PropBooleanArraySetFunc
bool(*)(PointerRNA *ptr) PropBooleanGetFunc
FloatPropertySetTransformFunc PropFloatSetTransformFunc
bool(*)(Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage, int len_local, int len_reference, int len_storage, IDOverrideLibraryPropertyOperation *opop) RNAPropOverrideStore
void(*)(PointerRNA *ptr, int *values) PropIntArrayGetFunc
void(*)(PointerRNA *ptr, float value) PropFloatSetFunc
void(*)(PointerRNA *ptr, const int *values) PropIntArraySetFunc
int(*)(PointerRNA *ptr, PropertyRNA *prop) PropIntGetFuncEx
int(*)(PointerRNA *ptr) PropIntGetFunc
float(*)(PointerRNA *ptr, PropertyRNA *prop) PropFloatGetFuncEx
void(*)(PointerRNA *ptr, const char *value) PropStringSetFunc
float(*)(PointerRNA *ptr) PropFloatGetFunc
void(*)(PointerRNA *ptr, float *values) PropFloatArrayGetFunc
void(*)(CollectionPropertyIterator *iter) PropCollectionEndFunc
#define min(a, b)
Definition sort.cc:36
unsigned int structs_len
PropBooleanArrayGetTransformFunc getarray_transform
PropBooleanGetFuncEx get_default
PropBooleanSetTransformFunc set_transform
PropBooleanArraySetFuncEx setarray_ex
PropBooleanArrayGetFuncEx getarray_ex
PropBooleanGetTransformFunc get_transform
PropBooleanArraySetFunc setarray
const bool * defaultarray
PropBooleanArrayGetFuncEx get_default_array
PropBooleanSetFunc set
PropBooleanGetFunc get
PropBooleanSetFuncEx set_ex
PropBooleanGetFuncEx get_ex
PropBooleanArraySetTransformFunc setarray_transform
PropBooleanArrayGetFunc getarray
PropCollectionNextFunc next
PropCollectionLookupStringFunc lookupstring
PropCollectionLengthFunc length
PropCollectionLookupIntFunc lookupint
PropCollectionBeginFunc begin
PropCollectionAssignIntFunc assignint
PropCollectionEndFunc end
PropCollectionGetFunc get
blender::CustomIDVectorSet< PropertyRNA *, PropertyRNAIdentifierGetter > * prop_lookup_set
const EnumPropertyItem * item
PropEnumSetFuncEx set_ex
PropEnumGetTransformFunc get_transform
PropEnumGetFuncEx get_default
PropEnumGetFunc get
const char * native_enum_type
PropEnumItemFunc item_fn
PropEnumSetTransformFunc set_transform
PropEnumGetFuncEx get_ex
PropEnumSetFunc set
PropFloatSetTransformFunc set_transform
PropFloatSetFuncEx set_ex
PropertyScaleType ui_scale_type
PropFloatGetFunc get
PropFloatRangeFuncEx range_ex
PropFloatArrayGetTransformFunc getarray_transform
PropFloatArrayGetFuncEx getarray_ex
PropFloatArraySetFuncEx setarray_ex
PropFloatArrayGetFunc getarray
PropFloatGetFuncEx get_default
PropFloatArraySetTransformFunc setarray_transform
PropFloatGetTransformFunc get_transform
PropFloatSetFunc set
const float * defaultarray
PropFloatRangeFunc range
PropFloatArraySetFunc setarray
PropFloatGetFuncEx get_ex
PropFloatArrayGetFuncEx get_default_array
const char * identifier
PropertyRNA * c_ret
ContainerRNA cont
const char * description
PropIntRangeFuncEx range_ex
PropIntArrayGetFunc getarray
PropIntArrayGetFuncEx getarray_ex
PropIntArraySetTransformFunc setarray_transform
PropIntRangeFunc range
PropIntArraySetFunc setarray
PropIntGetFuncEx get_ex
PropIntArrayGetFuncEx get_default_array
PropIntSetTransformFunc set_transform
PropIntArraySetFuncEx setarray_ex
PropIntGetTransformFunc get_transform
PropertyScaleType ui_scale_type
PropIntArrayGetTransformFunc getarray_transform
PropIntGetFuncEx get_default
PropIntSetFuncEx set_ex
PropPointerTypeFunc type_fn
PropPointerGetFunc get
PropPointerPollFunc poll
PropPointerSetFunc set
blender::StringRef operator()(const PropertyRNA *prop) const
ItemEditableFunc itemeditable
PropArrayLengthGetFunc getlength
const char * translation_context
RNAPropOverrideApply override_apply
unsigned int arraydimension
PropertyRNA * prev
const DeprecatedRNA * deprecated
EditableFunc editable
PropertyPathTemplateType path_template_type
RNAPropOverrideStore override_store
PropUINameFunc ui_name_func
PropertyRNA * next
RNAPropOverrideDiff override_diff
PropertySubType subtype
unsigned int arraylength[RNA_MAX_ARRAY_DIMENSION]
const char * description
const char * name
unsigned int totarraylength
const char * identifier
RawPropertyType rawtype
PropertyType type
IDOverrideLibraryProperty * liboverride_property
IDOverrideLibraryPropertyOperation * liboverride_operation
eRNAOverrideMatchResult report_flag
StringPropertyPathFilterFunc path_filter
PropStringSetFunc set
PropStringLengthFuncEx length_ex
PropStringLengthFunc length
PropStringGetFuncEx get_ex
PropStringSetFuncEx set_ex
PropStringGetTransformFunc get_transform
PropStringSetTransformFunc set_transform
PropStringGetFunc get
StringPropertySearchFunc search
eStringPropertySearchFlag search_flag
StructRNA * nested
StructRegisterFunc reg
StructUnregisterFunc unreg
const char * name
const char * identifier
StructInstanceFunc instance
ContainerRNA cont
const char * translation_context
const EnumPropertyItem * prop_tag_defines
PropertyRNA * nameproperty
const char * description
IDPropertiesFunc idproperties
PropertyRNA * iteratorproperty
StructRNA * base
StructRefineFunc refine
IDPropertiesFunc system_idproperties
StructPathFunc path
max
Definition text_draw.cc:251
PointerRNA * ptr
Definition wm_files.cc:4238