|
|
|
|
@@ -4,10 +4,10 @@
|
|
|
|
|
* \ingroup RNA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <cctype>
|
|
|
|
|
#include <cstddef>
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
@@ -58,7 +58,7 @@
|
|
|
|
|
#include "rna_access_internal.h"
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
|
|
|
|
const PointerRNA PointerRNA_NULL = {NULL};
|
|
|
|
|
const PointerRNA PointerRNA_NULL = {nullptr};
|
|
|
|
|
|
|
|
|
|
/* Init/Exit */
|
|
|
|
|
|
|
|
|
|
@@ -70,11 +70,13 @@ void RNA_init(void)
|
|
|
|
|
BLENDER_RNA.structs_map = BLI_ghash_str_new_ex(__func__, 2048);
|
|
|
|
|
BLENDER_RNA.structs_len = 0;
|
|
|
|
|
|
|
|
|
|
for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
|
|
|
|
|
for (srna = static_cast<StructRNA *>(BLENDER_RNA.structs.first); srna;
|
|
|
|
|
srna = static_cast<StructRNA *>(srna->cont.next)) {
|
|
|
|
|
if (!srna->cont.prophash) {
|
|
|
|
|
srna->cont.prophash = BLI_ghash_str_new("RNA_init gh");
|
|
|
|
|
|
|
|
|
|
for (prop = srna->cont.properties.first; prop; prop = prop->next) {
|
|
|
|
|
for (prop = static_cast<PropertyRNA *>(srna->cont.properties.first); prop;
|
|
|
|
|
prop = prop->next) {
|
|
|
|
|
if (!(prop->flag_internal & PROP_INTERN_BUILTIN)) {
|
|
|
|
|
BLI_ghash_insert(srna->cont.prophash, (void *)prop->identifier, prop);
|
|
|
|
|
}
|
|
|
|
|
@@ -90,10 +92,11 @@ void RNA_exit(void)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
|
|
for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
|
|
|
|
|
for (srna = static_cast<StructRNA *>(BLENDER_RNA.structs.first); srna;
|
|
|
|
|
srna = static_cast<StructRNA *>(srna->cont.next)) {
|
|
|
|
|
if (srna->cont.prophash) {
|
|
|
|
|
BLI_ghash_free(srna->cont.prophash, NULL, NULL);
|
|
|
|
|
srna->cont.prophash = NULL;
|
|
|
|
|
BLI_ghash_free(srna->cont.prophash, nullptr, nullptr);
|
|
|
|
|
srna->cont.prophash = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -102,19 +105,19 @@ void RNA_exit(void)
|
|
|
|
|
|
|
|
|
|
/* Pointer */
|
|
|
|
|
|
|
|
|
|
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
|
|
|
|
|
void RNA_main_pointer_create(Main *main, PointerRNA *r_ptr)
|
|
|
|
|
{
|
|
|
|
|
r_ptr->owner_id = NULL;
|
|
|
|
|
r_ptr->owner_id = nullptr;
|
|
|
|
|
r_ptr->type = &RNA_BlendData;
|
|
|
|
|
r_ptr->data = main;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *type, *idtype = NULL;
|
|
|
|
|
StructRNA *type, *idtype = nullptr;
|
|
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
|
PointerRNA tmp = {NULL};
|
|
|
|
|
PointerRNA tmp = {nullptr};
|
|
|
|
|
tmp.data = id;
|
|
|
|
|
idtype = rna_ID_refine(&tmp);
|
|
|
|
|
|
|
|
|
|
@@ -136,7 +139,7 @@ void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
|
|
|
|
|
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
|
|
|
|
|
{
|
|
|
|
|
#if 0 /* UNUSED */
|
|
|
|
|
StructRNA *idtype = NULL;
|
|
|
|
|
StructRNA *idtype = nullptr;
|
|
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
|
PointerRNA tmp = {0};
|
|
|
|
|
@@ -163,13 +166,13 @@ void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
|
|
|
|
|
|
|
|
|
|
bool RNA_pointer_is_null(const PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
return (ptr->data == NULL) || (ptr->owner_id == NULL) || (ptr->type == NULL);
|
|
|
|
|
return (ptr->data == nullptr) || (ptr->owner_id == nullptr) || (ptr->type == nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_pointer_inherit_id(StructRNA *type, PointerRNA *parent, PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
if (type && type->flag & STRUCT_ID) {
|
|
|
|
|
ptr->owner_id = ptr->data;
|
|
|
|
|
ptr->owner_id = static_cast<ID *>(ptr->data);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ptr->owner_id = parent->owner_id;
|
|
|
|
|
@@ -178,7 +181,7 @@ static void rna_pointer_inherit_id(StructRNA *type, PointerRNA *parent, PointerR
|
|
|
|
|
|
|
|
|
|
void RNA_blender_rna_pointer_create(PointerRNA *r_ptr)
|
|
|
|
|
{
|
|
|
|
|
r_ptr->owner_id = NULL;
|
|
|
|
|
r_ptr->owner_id = nullptr;
|
|
|
|
|
r_ptr->type = &RNA_BlenderRNA;
|
|
|
|
|
r_ptr->data = &BLENDER_RNA;
|
|
|
|
|
}
|
|
|
|
|
@@ -238,11 +241,11 @@ void rna_idproperty_touch(IDProperty *idprop)
|
|
|
|
|
IDProperty **RNA_struct_idprops_p(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *type = ptr->type;
|
|
|
|
|
if (type == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
if (type == nullptr) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
if (type->idproperties == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
if (type->idproperties == nullptr) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return type->idproperties(ptr);
|
|
|
|
|
@@ -251,11 +254,11 @@ IDProperty **RNA_struct_idprops_p(PointerRNA *ptr)
|
|
|
|
|
IDProperty *RNA_struct_idprops(PointerRNA *ptr, bool create)
|
|
|
|
|
{
|
|
|
|
|
IDProperty **property_ptr = RNA_struct_idprops_p(ptr);
|
|
|
|
|
if (property_ptr == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
if (property_ptr == nullptr) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (create && *property_ptr == NULL) {
|
|
|
|
|
if (create && *property_ptr == nullptr) {
|
|
|
|
|
IDPropertyTemplate val = {0};
|
|
|
|
|
*property_ptr = IDP_New(IDP_GROUP, &val, __func__);
|
|
|
|
|
}
|
|
|
|
|
@@ -284,7 +287,7 @@ IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_idproperty_free(PointerRNA *ptr, const char *name)
|
|
|
|
|
@@ -415,9 +418,9 @@ static PropertyRNA *typemap[IDP_NUMTYPES] = {
|
|
|
|
|
&rna_PropertyGroupItem_string,
|
|
|
|
|
&rna_PropertyGroupItem_int,
|
|
|
|
|
&rna_PropertyGroupItem_float,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
nullptr,
|
|
|
|
|
nullptr,
|
|
|
|
|
nullptr,
|
|
|
|
|
&rna_PropertyGroupItem_group,
|
|
|
|
|
&rna_PropertyGroupItem_id,
|
|
|
|
|
&rna_PropertyGroupItem_double,
|
|
|
|
|
@@ -426,16 +429,16 @@ static PropertyRNA *typemap[IDP_NUMTYPES] = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static PropertyRNA *arraytypemap[IDP_NUMTYPES] = {
|
|
|
|
|
NULL,
|
|
|
|
|
nullptr,
|
|
|
|
|
&rna_PropertyGroupItem_int_array,
|
|
|
|
|
&rna_PropertyGroupItem_float_array,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
nullptr,
|
|
|
|
|
nullptr,
|
|
|
|
|
nullptr,
|
|
|
|
|
&rna_PropertyGroupItem_collection,
|
|
|
|
|
NULL,
|
|
|
|
|
nullptr,
|
|
|
|
|
&rna_PropertyGroupItem_double_array,
|
|
|
|
|
NULL,
|
|
|
|
|
nullptr,
|
|
|
|
|
(PropertyRNA *)&rna_PropertyGroupItem_bool_array,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -469,15 +472,15 @@ void rna_property_rna_or_id_get(PropertyRNA *prop,
|
|
|
|
|
if (prop->flag & PROP_IDPROPERTY) {
|
|
|
|
|
IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
|
|
|
|
|
|
|
|
|
|
if (idprop != NULL && !rna_idproperty_verify_valid(ptr, prop, idprop)) {
|
|
|
|
|
if (idprop != nullptr && !rna_idproperty_verify_valid(ptr, prop, idprop)) {
|
|
|
|
|
IDProperty *group = RNA_struct_idprops(ptr, 0);
|
|
|
|
|
|
|
|
|
|
IDP_FreeFromGroup(group, idprop);
|
|
|
|
|
idprop = NULL;
|
|
|
|
|
idprop = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r_prop_rna_or_id->idprop = idprop;
|
|
|
|
|
r_prop_rna_or_id->is_set = idprop != NULL && (idprop->flag & IDP_FLAG_GHOST) == 0;
|
|
|
|
|
r_prop_rna_or_id->is_set = idprop != nullptr && (idprop->flag & IDP_FLAG_GHOST) == 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Full static RNA properties are always set. */
|
|
|
|
|
@@ -489,20 +492,20 @@ void rna_property_rna_or_id_get(PropertyRNA *prop,
|
|
|
|
|
/* Given prop may come from the custom properties of another data, ensure we get the one from
|
|
|
|
|
* given data ptr. */
|
|
|
|
|
IDProperty *idprop_evaluated = rna_idproperty_find(ptr, idprop->name);
|
|
|
|
|
if (idprop_evaluated != NULL && idprop->type != idprop_evaluated->type) {
|
|
|
|
|
idprop_evaluated = NULL;
|
|
|
|
|
if (idprop_evaluated != nullptr && idprop->type != idprop_evaluated->type) {
|
|
|
|
|
idprop_evaluated = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r_prop_rna_or_id->idprop = idprop_evaluated;
|
|
|
|
|
r_prop_rna_or_id->is_idprop = true;
|
|
|
|
|
/* Full IDProperties are always set, if it exists. */
|
|
|
|
|
r_prop_rna_or_id->is_set = (idprop_evaluated != NULL);
|
|
|
|
|
r_prop_rna_or_id->is_set = (idprop_evaluated != nullptr);
|
|
|
|
|
|
|
|
|
|
r_prop_rna_or_id->identifier = idprop->name;
|
|
|
|
|
if (idprop->type == IDP_ARRAY) {
|
|
|
|
|
r_prop_rna_or_id->rnaprop = arraytypemap[(int)(idprop->subtype)];
|
|
|
|
|
r_prop_rna_or_id->is_array = true;
|
|
|
|
|
r_prop_rna_or_id->array_len = idprop_evaluated != NULL ? (uint)idprop_evaluated->len : 0;
|
|
|
|
|
r_prop_rna_or_id->array_len = idprop_evaluated != nullptr ? (uint)idprop_evaluated->len : 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
r_prop_rna_or_id->rnaprop = typemap[(int)(idprop->type)];
|
|
|
|
|
@@ -527,7 +530,7 @@ PropertyRNA *rna_ensure_property_realdata(PropertyRNA **prop, PointerRNA *ptr)
|
|
|
|
|
rna_property_rna_or_id_get(*prop, ptr, &prop_rna_or_id);
|
|
|
|
|
|
|
|
|
|
*prop = prop_rna_or_id.rnaprop;
|
|
|
|
|
return (prop_rna_or_id.is_idprop || prop_rna_or_id.idprop != NULL) ?
|
|
|
|
|
return (prop_rna_or_id.is_idprop || prop_rna_or_id.idprop != nullptr) ?
|
|
|
|
|
(PropertyRNA *)prop_rna_or_id.idprop :
|
|
|
|
|
prop_rna_or_id.rnaprop;
|
|
|
|
|
}
|
|
|
|
|
@@ -591,7 +594,7 @@ static const char *rna_ensure_property_name(const PropertyRNA *prop)
|
|
|
|
|
|
|
|
|
|
StructRNA *RNA_struct_find(const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
return BLI_ghash_lookup(BLENDER_RNA.structs_map, identifier);
|
|
|
|
|
return static_cast<StructRNA *>(BLI_ghash_lookup(BLENDER_RNA.structs_map, identifier));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *RNA_struct_identifier(const StructRNA *type)
|
|
|
|
|
@@ -660,7 +663,7 @@ const StructRNA *RNA_struct_base_child_of(const StructRNA *type, const StructRNA
|
|
|
|
|
}
|
|
|
|
|
type = type->base;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RNA_struct_is_ID(const StructRNA *type)
|
|
|
|
|
@@ -729,7 +732,7 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
if (identifier[0] == '[' && identifier[1] == '"') {
|
|
|
|
|
/* id prop lookup, not so common */
|
|
|
|
|
PropertyRNA *r_prop = NULL;
|
|
|
|
|
PropertyRNA *r_prop = nullptr;
|
|
|
|
|
PointerRNA r_ptr; /* only support single level props */
|
|
|
|
|
if (RNA_path_resolve_property(ptr, identifier, &r_ptr, &r_prop) && (r_ptr.type == ptr->type) &&
|
|
|
|
|
(r_ptr.data == ptr->data)) {
|
|
|
|
|
@@ -742,17 +745,17 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
|
|
|
|
|
PointerRNA propptr;
|
|
|
|
|
|
|
|
|
|
if (RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr)) {
|
|
|
|
|
return propptr.data;
|
|
|
|
|
return static_cast<PropertyRNA *>(propptr.data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find the property which uses the given nested struct */
|
|
|
|
|
PropertyRNA *rna_struct_find_nested(PointerRNA *ptr, StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = NULL;
|
|
|
|
|
PropertyRNA *prop = nullptr;
|
|
|
|
|
|
|
|
|
|
RNA_STRUCT_BEGIN (ptr, iprop) {
|
|
|
|
|
/* This assumes that there can only be one user of this nested struct */
|
|
|
|
|
@@ -793,7 +796,7 @@ uint RNA_struct_count_properties(StructRNA *srna)
|
|
|
|
|
PointerRNA struct_ptr;
|
|
|
|
|
uint counter = 0;
|
|
|
|
|
|
|
|
|
|
RNA_pointer_create(NULL, srna, NULL, &struct_ptr);
|
|
|
|
|
RNA_pointer_create(nullptr, srna, nullptr, &struct_ptr);
|
|
|
|
|
|
|
|
|
|
RNA_STRUCT_BEGIN (&struct_ptr, prop) {
|
|
|
|
|
counter++;
|
|
|
|
|
@@ -804,25 +807,26 @@ uint RNA_struct_count_properties(StructRNA *srna)
|
|
|
|
|
return counter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const struct ListBase *RNA_struct_type_properties(StructRNA *srna)
|
|
|
|
|
const ListBase *RNA_struct_type_properties(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
return &srna->cont.properties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyRNA *RNA_struct_type_find_property_no_base(StructRNA *srna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
return BLI_findstring_ptr(&srna->cont.properties, identifier, offsetof(PropertyRNA, identifier));
|
|
|
|
|
return static_cast<PropertyRNA *>(
|
|
|
|
|
BLI_findstring_ptr(&srna->cont.properties, identifier, offsetof(PropertyRNA, identifier)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyRNA *RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
for (; srna; srna = srna->base) {
|
|
|
|
|
PropertyRNA *prop = RNA_struct_type_find_property_no_base(srna, identifier);
|
|
|
|
|
if (prop != NULL) {
|
|
|
|
|
if (prop != nullptr) {
|
|
|
|
|
return prop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FunctionRNA *RNA_struct_find_function(StructRNA *srna, const char *identifier)
|
|
|
|
|
@@ -836,7 +840,7 @@ FunctionRNA *RNA_struct_find_function(StructRNA *srna, const char *identifier)
|
|
|
|
|
return func;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
|
|
/* functional but slow */
|
|
|
|
|
#else
|
|
|
|
|
@@ -844,10 +848,10 @@ FunctionRNA *RNA_struct_find_function(StructRNA *srna, const char *identifier)
|
|
|
|
|
PropertyRNA *iterprop;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
|
|
|
|
|
RNA_pointer_create(NULL, &RNA_Struct, srna, &tptr);
|
|
|
|
|
RNA_pointer_create(nullptr, &RNA_Struct, srna, &tptr);
|
|
|
|
|
iterprop = RNA_struct_find_property(&tptr, "functions");
|
|
|
|
|
|
|
|
|
|
func = NULL;
|
|
|
|
|
func = nullptr;
|
|
|
|
|
|
|
|
|
|
RNA_PROP_BEGIN (&tptr, funcptr, iterprop) {
|
|
|
|
|
if (STREQ(identifier, RNA_function_identifier(funcptr.data))) {
|
|
|
|
|
@@ -879,7 +883,7 @@ StructUnregisterFunc RNA_struct_unregister(StructRNA *type)
|
|
|
|
|
}
|
|
|
|
|
} while ((type = type->base));
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void **RNA_struct_instance(PointerRNA *ptr)
|
|
|
|
|
@@ -892,7 +896,7 @@ void **RNA_struct_instance(PointerRNA *ptr)
|
|
|
|
|
}
|
|
|
|
|
} while ((type = type->base));
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *RNA_struct_py_type_get(StructRNA *srna)
|
|
|
|
|
@@ -923,13 +927,13 @@ char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, i
|
|
|
|
|
return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen, r_len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RNA_struct_available_or_report(ReportList *reports, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
const StructRNA *srna_exists = RNA_struct_find(identifier);
|
|
|
|
|
if (UNLIKELY(srna_exists != NULL)) {
|
|
|
|
|
if (UNLIKELY(srna_exists != nullptr)) {
|
|
|
|
|
/* Use comprehensive string construction since this is such a rare occurrence
|
|
|
|
|
* and information here may cut down time troubleshooting. */
|
|
|
|
|
DynStr *dynstr = BLI_dynstr_new();
|
|
|
|
|
@@ -971,9 +975,9 @@ bool RNA_struct_bl_idname_ok_or_report(ReportList *reports,
|
|
|
|
|
const int report_level = RPT_ERROR;
|
|
|
|
|
const bool failure = false;
|
|
|
|
|
#endif
|
|
|
|
|
if (p == NULL || p == identifier || p + len_sep >= identifier + len_id) {
|
|
|
|
|
if (p == nullptr || p == identifier || p + len_sep >= identifier + len_id) {
|
|
|
|
|
BKE_reportf(reports,
|
|
|
|
|
report_level,
|
|
|
|
|
eReportType(report_level),
|
|
|
|
|
"'%s' does not contain '%s' with prefix and suffix",
|
|
|
|
|
identifier,
|
|
|
|
|
sep);
|
|
|
|
|
@@ -987,8 +991,10 @@ bool RNA_struct_bl_idname_ok_or_report(ReportList *reports,
|
|
|
|
|
for (c = start; c != end; c++) {
|
|
|
|
|
if (((*c >= 'A' && *c <= 'Z') || ((c != start) && (*c >= '0' && *c <= '9')) ||
|
|
|
|
|
((c != start) && (c != last) && (*c == '_'))) == 0) {
|
|
|
|
|
BKE_reportf(
|
|
|
|
|
reports, report_level, "'%s' doesn't have upper case alpha-numeric prefix", identifier);
|
|
|
|
|
BKE_reportf(reports,
|
|
|
|
|
eReportType(report_level),
|
|
|
|
|
"'%s' doesn't have upper case alpha-numeric prefix",
|
|
|
|
|
identifier);
|
|
|
|
|
return failure;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -999,7 +1005,10 @@ bool RNA_struct_bl_idname_ok_or_report(ReportList *reports,
|
|
|
|
|
for (c = start; c != end; c++) {
|
|
|
|
|
if (((*c >= 'A' && *c <= 'Z') || (*c >= 'a' && *c <= 'z') || (*c >= '0' && *c <= '9') ||
|
|
|
|
|
((c != start) && (c != last) && (*c == '_'))) == 0) {
|
|
|
|
|
BKE_reportf(reports, report_level, "'%s' doesn't have an alpha-numeric suffix", identifier);
|
|
|
|
|
BKE_reportf(reports,
|
|
|
|
|
eReportType(report_level),
|
|
|
|
|
"'%s' doesn't have an alpha-numeric suffix",
|
|
|
|
|
identifier);
|
|
|
|
|
return failure;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1042,7 +1051,7 @@ PropertySubType RNA_property_subtype(PropertyRNA *prop)
|
|
|
|
|
|
|
|
|
|
PropertyUnit RNA_property_unit(PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
return RNA_SUBTYPE_UNIT(RNA_property_subtype(prop));
|
|
|
|
|
return PropertyUnit(RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyScaleType RNA_property_ui_scale(PropertyRNA *prop)
|
|
|
|
|
@@ -1482,17 +1491,17 @@ void RNA_property_enum_items_ex(bContext *C,
|
|
|
|
|
|
|
|
|
|
*r_free = false;
|
|
|
|
|
|
|
|
|
|
if (!use_static && (eprop->item_fn != NULL)) {
|
|
|
|
|
if (!use_static && (eprop->item_fn != nullptr)) {
|
|
|
|
|
const bool no_context = (prop->flag & PROP_ENUM_NO_CONTEXT) ||
|
|
|
|
|
((ptr->type->flag & STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID) &&
|
|
|
|
|
(ptr->owner_id == NULL));
|
|
|
|
|
if (C != NULL || no_context) {
|
|
|
|
|
(ptr->owner_id == nullptr));
|
|
|
|
|
if (C != nullptr || no_context) {
|
|
|
|
|
const EnumPropertyItem *item;
|
|
|
|
|
|
|
|
|
|
item = eprop->item_fn(no_context ? NULL : C, ptr, prop, r_free);
|
|
|
|
|
item = eprop->item_fn(no_context ? nullptr : C, ptr, prop, r_free);
|
|
|
|
|
|
|
|
|
|
/* any callbacks returning NULL should be fixed */
|
|
|
|
|
BLI_assert(item != NULL);
|
|
|
|
|
/* any callbacks returning nullptr should be fixed */
|
|
|
|
|
BLI_assert(item != nullptr);
|
|
|
|
|
|
|
|
|
|
if (r_totitem) {
|
|
|
|
|
int tot;
|
|
|
|
|
@@ -1558,7 +1567,8 @@ static void property_enum_translate(PropertyRNA *prop,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nitem = MEM_mallocN(sizeof(EnumPropertyItem) * (tot + 1), "enum_items_gettexted");
|
|
|
|
|
nitem = static_cast<EnumPropertyItem *>(
|
|
|
|
|
MEM_mallocN(sizeof(EnumPropertyItem) * (tot + 1), __func__));
|
|
|
|
|
memcpy(nitem, item, sizeof(EnumPropertyItem) * (tot + 1));
|
|
|
|
|
|
|
|
|
|
*r_free = true;
|
|
|
|
|
@@ -1569,7 +1579,7 @@ static void property_enum_translate(PropertyRNA *prop,
|
|
|
|
|
nitem[i].name = BLT_pgettext(prop->translation_context, nitem[i].name);
|
|
|
|
|
}
|
|
|
|
|
if (nitem[i].description && do_tooltip) {
|
|
|
|
|
nitem[i].description = BLT_pgettext(NULL, nitem[i].description);
|
|
|
|
|
nitem[i].description = BLT_pgettext(nullptr, nitem[i].description);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1604,7 +1614,8 @@ void RNA_property_enum_items_gettexted_all(bContext *C,
|
|
|
|
|
EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
int mem_size = sizeof(EnumPropertyItem) * (eprop->totitem + 1);
|
|
|
|
|
/* first return all items */
|
|
|
|
|
EnumPropertyItem *item_array = MEM_mallocN(mem_size, "enum_gettext_all");
|
|
|
|
|
EnumPropertyItem *item_array = static_cast<EnumPropertyItem *>(
|
|
|
|
|
MEM_mallocN(mem_size, "enum_gettext_all"));
|
|
|
|
|
*r_free = true;
|
|
|
|
|
memcpy(item_array, eprop->item, mem_size);
|
|
|
|
|
|
|
|
|
|
@@ -1612,26 +1623,26 @@ void RNA_property_enum_items_gettexted_all(bContext *C,
|
|
|
|
|
*r_totitem = eprop->totitem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (eprop->item_fn != NULL) {
|
|
|
|
|
if (eprop->item_fn != nullptr) {
|
|
|
|
|
const bool no_context = (prop->flag & PROP_ENUM_NO_CONTEXT) ||
|
|
|
|
|
((ptr->type->flag & STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID) &&
|
|
|
|
|
(ptr->owner_id == NULL));
|
|
|
|
|
if (C != NULL || no_context) {
|
|
|
|
|
(ptr->owner_id == nullptr));
|
|
|
|
|
if (C != nullptr || no_context) {
|
|
|
|
|
const EnumPropertyItem *item;
|
|
|
|
|
int i;
|
|
|
|
|
bool free = false;
|
|
|
|
|
|
|
|
|
|
item = eprop->item_fn(no_context ? NULL : NULL, ptr, prop, &free);
|
|
|
|
|
item = eprop->item_fn(no_context ? nullptr : nullptr, ptr, prop, &free);
|
|
|
|
|
|
|
|
|
|
/* any callbacks returning NULL should be fixed */
|
|
|
|
|
BLI_assert(item != NULL);
|
|
|
|
|
/* any callbacks returning nullptr should be fixed */
|
|
|
|
|
BLI_assert(item != nullptr);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < eprop->totitem; i++) {
|
|
|
|
|
bool exists = false;
|
|
|
|
|
int i_fixed;
|
|
|
|
|
|
|
|
|
|
/* Items that do not exist on list are returned,
|
|
|
|
|
* but have their names/identifiers NULL'ed out. */
|
|
|
|
|
* but have their names/identifiers nullptr'ed out. */
|
|
|
|
|
for (i_fixed = 0; item[i_fixed].identifier; i_fixed++) {
|
|
|
|
|
if (STREQ(item[i_fixed].identifier, item_array[i].identifier)) {
|
|
|
|
|
exists = true;
|
|
|
|
|
@@ -1640,7 +1651,7 @@ void RNA_property_enum_items_gettexted_all(bContext *C,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!exists) {
|
|
|
|
|
item_array[i].name = NULL;
|
|
|
|
|
item_array[i].name = nullptr;
|
|
|
|
|
item_array[i].identifier = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1664,7 +1675,7 @@ bool RNA_property_enum_value(
|
|
|
|
|
bool free;
|
|
|
|
|
bool found;
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, nullptr, &free);
|
|
|
|
|
|
|
|
|
|
if (item) {
|
|
|
|
|
const int i = RNA_enum_from_identifier(item, identifier);
|
|
|
|
|
@@ -1706,7 +1717,7 @@ int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item,
|
|
|
|
|
r_identifier[index++] = item->identifier;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
r_identifier[index] = NULL;
|
|
|
|
|
r_identifier[index] = nullptr;
|
|
|
|
|
return index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1780,10 +1791,10 @@ uint RNA_enum_items_count(const EnumPropertyItem *item)
|
|
|
|
|
bool RNA_property_enum_identifier(
|
|
|
|
|
bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
|
|
|
|
|
{
|
|
|
|
|
const EnumPropertyItem *item = NULL;
|
|
|
|
|
const EnumPropertyItem *item = nullptr;
|
|
|
|
|
bool free;
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, nullptr, &free);
|
|
|
|
|
if (item) {
|
|
|
|
|
bool result;
|
|
|
|
|
result = RNA_enum_identifier(item, value, identifier);
|
|
|
|
|
@@ -1798,10 +1809,10 @@ bool RNA_property_enum_identifier(
|
|
|
|
|
bool RNA_property_enum_name(
|
|
|
|
|
bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
|
|
|
|
|
{
|
|
|
|
|
const EnumPropertyItem *item = NULL;
|
|
|
|
|
const EnumPropertyItem *item = nullptr;
|
|
|
|
|
bool free;
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, nullptr, &free);
|
|
|
|
|
if (item) {
|
|
|
|
|
bool result;
|
|
|
|
|
result = RNA_enum_name(item, value, name);
|
|
|
|
|
@@ -1835,10 +1846,10 @@ bool RNA_property_enum_name_gettexted(
|
|
|
|
|
bool RNA_property_enum_item_from_value(
|
|
|
|
|
bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, EnumPropertyItem *r_item)
|
|
|
|
|
{
|
|
|
|
|
const EnumPropertyItem *item = NULL;
|
|
|
|
|
const EnumPropertyItem *item = nullptr;
|
|
|
|
|
bool free;
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, nullptr, &free);
|
|
|
|
|
if (item) {
|
|
|
|
|
const int i = RNA_enum_from_value(item, value);
|
|
|
|
|
bool result;
|
|
|
|
|
@@ -1877,10 +1888,10 @@ bool RNA_property_enum_item_from_value_gettexted(
|
|
|
|
|
int RNA_property_enum_bitflag_identifiers(
|
|
|
|
|
bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
|
|
|
|
|
{
|
|
|
|
|
const EnumPropertyItem *item = NULL;
|
|
|
|
|
const EnumPropertyItem *item = nullptr;
|
|
|
|
|
bool free;
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, nullptr, &free);
|
|
|
|
|
if (item) {
|
|
|
|
|
int result;
|
|
|
|
|
result = RNA_enum_bitflag_identifiers(item, value, identifier);
|
|
|
|
|
@@ -1933,23 +1944,23 @@ static bool rna_property_editable_do(PointerRNA *ptr,
|
|
|
|
|
PropertyRNA *prop = rna_ensure_property(prop_orig);
|
|
|
|
|
|
|
|
|
|
const char *info = "";
|
|
|
|
|
const int flag = (prop->itemeditable != NULL && index >= 0) ?
|
|
|
|
|
const int flag = (prop->itemeditable != nullptr && index >= 0) ?
|
|
|
|
|
prop->itemeditable(ptr, index) :
|
|
|
|
|
(prop->editable != NULL ? prop->editable(ptr, &info) : prop->flag);
|
|
|
|
|
if (r_info != NULL) {
|
|
|
|
|
(prop->editable != nullptr ? prop->editable(ptr, &info) : prop->flag);
|
|
|
|
|
if (r_info != nullptr) {
|
|
|
|
|
*r_info = info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Early return if the property itself is not editable. */
|
|
|
|
|
if ((flag & PROP_EDITABLE) == 0 || (flag & PROP_REGISTER) != 0) {
|
|
|
|
|
if (r_info != NULL && (*r_info)[0] == '\0') {
|
|
|
|
|
if (r_info != nullptr && (*r_info)[0] == '\0') {
|
|
|
|
|
*r_info = N_("This property is for internal use only and can't be edited");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If there is no owning ID, the property is editable at this point. */
|
|
|
|
|
if (id == NULL) {
|
|
|
|
|
if (id == nullptr) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1959,7 +1970,7 @@ static bool rna_property_editable_do(PointerRNA *ptr,
|
|
|
|
|
if (is_linked_prop_exception) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (r_info != NULL && (*r_info)[0] == '\0') {
|
|
|
|
|
if (r_info != nullptr && (*r_info)[0] == '\0') {
|
|
|
|
|
*r_info = N_("Can't edit this property from a linked data-block");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
@@ -1967,13 +1978,13 @@ static bool rna_property_editable_do(PointerRNA *ptr,
|
|
|
|
|
if (ID_IS_OVERRIDE_LIBRARY(id)) {
|
|
|
|
|
const bool is_liboverride_system = BKE_lib_override_library_is_system_defined(G_MAIN, id);
|
|
|
|
|
if (!RNA_property_overridable_get(ptr, prop_orig)) {
|
|
|
|
|
if (r_info != NULL && (*r_info)[0] == '\0') {
|
|
|
|
|
if (r_info != nullptr && (*r_info)[0] == '\0') {
|
|
|
|
|
*r_info = N_("Can't edit this property from an override data-block");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (is_liboverride_system && !is_linked_prop_exception) {
|
|
|
|
|
if (r_info != NULL && (*r_info)[0] == '\0') {
|
|
|
|
|
if (r_info != nullptr && (*r_info)[0] == '\0') {
|
|
|
|
|
*r_info = N_("Can't edit this property from a system override data-block");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
@@ -1986,7 +1997,7 @@ static bool rna_property_editable_do(PointerRNA *ptr,
|
|
|
|
|
|
|
|
|
|
bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
return rna_property_editable_do(ptr, prop, -1, NULL);
|
|
|
|
|
return rna_property_editable_do(ptr, prop, -1, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char **r_info)
|
|
|
|
|
@@ -2008,7 +2019,7 @@ bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, const int i
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(index >= 0);
|
|
|
|
|
|
|
|
|
|
return rna_property_editable_do(ptr, prop, index, NULL);
|
|
|
|
|
return rna_property_editable_do(ptr, prop, index, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RNA_property_animateable(const PointerRNA *ptr, PropertyRNA *prop)
|
|
|
|
|
@@ -2041,7 +2052,7 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (index = 0; index < len; index++) {
|
|
|
|
|
if (BKE_fcurve_find_by_rna(ptr, prop, index, NULL, NULL, &driven, &special)) {
|
|
|
|
|
if (BKE_fcurve_find_by_rna(ptr, prop, index, nullptr, nullptr, &driven, &special)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -2101,14 +2112,14 @@ static void rna_property_update(
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* if C is NULL, we're updating from animation.
|
|
|
|
|
/* if C is nullptr, we're updating from animation.
|
|
|
|
|
* avoid slow-down from f-curves by not publishing (for now). */
|
|
|
|
|
if (C != NULL) {
|
|
|
|
|
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
|
|
|
|
|
/* we could add NULL check, for now don't */
|
|
|
|
|
if (C != nullptr) {
|
|
|
|
|
wmMsgBus *mbus = CTX_wm_message_bus(C);
|
|
|
|
|
/* we could add nullptr check, for now don't */
|
|
|
|
|
WM_msg_publish_rna(mbus, ptr, prop);
|
|
|
|
|
}
|
|
|
|
|
if (ptr->owner_id != NULL && ((prop->flag & PROP_NO_DEG_UPDATE) == 0)) {
|
|
|
|
|
if (ptr->owner_id != nullptr && ((prop->flag & PROP_NO_DEG_UPDATE) == 0)) {
|
|
|
|
|
const short id_type = GS(ptr->owner_id->name);
|
|
|
|
|
if (ID_TYPE_IS_COW(id_type)) {
|
|
|
|
|
DEG_id_tag_update(ptr->owner_id, ID_RECALC_COPY_ON_WRITE);
|
|
|
|
|
@@ -2139,13 +2150,13 @@ static void rna_property_update(
|
|
|
|
|
DEG_relations_tag_update(bmain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
|
|
|
|
WM_main_add_notifier(NC_WINDOW, nullptr);
|
|
|
|
|
/* Not nice as well, but the only way to make sure material preview
|
|
|
|
|
* is updated with custom nodes.
|
|
|
|
|
*/
|
|
|
|
|
if ((prop->flag & PROP_IDPROPERTY) != 0 && (ptr->owner_id != NULL) &&
|
|
|
|
|
if ((prop->flag & PROP_IDPROPERTY) != 0 && (ptr->owner_id != nullptr) &&
|
|
|
|
|
(GS(ptr->owner_id->name) == ID_NT)) {
|
|
|
|
|
WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL);
|
|
|
|
|
WM_main_add_notifier(NC_MATERIAL | ND_SHADING, nullptr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -2163,8 +2174,8 @@ void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
|
|
|
|
|
|
|
|
|
|
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(bmain != NULL);
|
|
|
|
|
rna_property_update(NULL, bmain, scene, ptr, prop);
|
|
|
|
|
BLI_assert(bmain != nullptr);
|
|
|
|
|
rna_property_update(nullptr, bmain, scene, ptr, prop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
@@ -2304,13 +2315,13 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *va
|
|
|
|
|
else if (idprop->subtype == IDP_INT) {
|
|
|
|
|
/* Some boolean IDProperty arrays might be saved in files as an integer
|
|
|
|
|
* array property, since the boolean IDProperty type was added later. */
|
|
|
|
|
int *values_src = IDP_Array(idprop);
|
|
|
|
|
int *values_src = static_cast<int *>(IDP_Array(idprop));
|
|
|
|
|
for (uint i = 0; i < idprop->len; i++) {
|
|
|
|
|
values[i] = (bool)values_src[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (idprop->subtype == IDP_BOOLEAN) {
|
|
|
|
|
bool *values_src = IDP_Array(idprop);
|
|
|
|
|
bool *values_src = static_cast<bool *>(IDP_Array(idprop));
|
|
|
|
|
for (int i = 0; i < idprop->len; i++) {
|
|
|
|
|
values[i] = values_src[i];
|
|
|
|
|
}
|
|
|
|
|
@@ -2348,7 +2359,7 @@ bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int inde
|
|
|
|
|
else {
|
|
|
|
|
bool *tmparray;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
|
|
|
|
|
tmparray = static_cast<bool *>(MEM_mallocN(sizeof(bool) * len, __func__));
|
|
|
|
|
RNA_property_boolean_get_array(ptr, prop, tmparray);
|
|
|
|
|
value = tmparray[index];
|
|
|
|
|
MEM_freeN(tmparray);
|
|
|
|
|
@@ -2379,7 +2390,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bo
|
|
|
|
|
else if (idprop->subtype == IDP_INT) {
|
|
|
|
|
/* Support writing to integer and boolean IDProperties, since boolean
|
|
|
|
|
RNA properties used to be stored with integer IDProperties. */
|
|
|
|
|
int *values_dst = IDP_Array(idprop);
|
|
|
|
|
int *values_dst = static_cast<int *>(IDP_Array(idprop));
|
|
|
|
|
for (uint i = 0; i < idprop->len; i++) {
|
|
|
|
|
values_dst[i] = (int)values[i];
|
|
|
|
|
}
|
|
|
|
|
@@ -2411,7 +2422,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bo
|
|
|
|
|
if (group) {
|
|
|
|
|
idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
|
|
|
|
|
IDP_AddToGroup(group, idprop);
|
|
|
|
|
int *values_dst = IDP_Array(idprop);
|
|
|
|
|
int *values_dst = static_cast<int *>(IDP_Array(idprop));
|
|
|
|
|
for (uint i = 0; i < idprop->len; i++) {
|
|
|
|
|
values_dst[i] = values[i];
|
|
|
|
|
}
|
|
|
|
|
@@ -2438,7 +2449,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde
|
|
|
|
|
else {
|
|
|
|
|
bool *tmparray;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
|
|
|
|
|
tmparray = static_cast<bool *>(MEM_mallocN(sizeof(bool) * len, __func__));
|
|
|
|
|
RNA_property_boolean_get_array(ptr, prop, tmparray);
|
|
|
|
|
tmparray[index] = value;
|
|
|
|
|
RNA_property_boolean_set_array(ptr, prop, tmparray);
|
|
|
|
|
@@ -2446,7 +2457,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
|
|
|
|
|
bool RNA_property_boolean_get_default(PointerRNA * /*ptr*/, PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
/* TODO: Make defaults work for IDProperties. */
|
|
|
|
|
BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
@@ -2500,7 +2511,7 @@ void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop,
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
rna_property_boolean_fill_default_array_values(
|
|
|
|
|
NULL, 0, ui_data->default_value, idprop->len, values);
|
|
|
|
|
nullptr, 0, ui_data->default_value, idprop->len, values);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -2515,7 +2526,7 @@ void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop,
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
rna_property_boolean_fill_default_array_values(
|
|
|
|
|
NULL, 0, ui_data->default_value, idprop->len, values);
|
|
|
|
|
nullptr, 0, ui_data->default_value, idprop->len, values);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -2549,7 +2560,7 @@ bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop,
|
|
|
|
|
}
|
|
|
|
|
bool *tmparray, value;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
|
|
|
|
|
tmparray = static_cast<bool *>(MEM_mallocN(sizeof(bool) * len, __func__));
|
|
|
|
|
RNA_property_boolean_get_default_array(ptr, prop, tmparray);
|
|
|
|
|
value = tmparray[index];
|
|
|
|
|
MEM_freeN(tmparray);
|
|
|
|
|
@@ -2690,7 +2701,7 @@ void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int va
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (array_len > 32) {
|
|
|
|
|
arr = MEM_mallocN(sizeof(int) * array_len, __func__);
|
|
|
|
|
arr = static_cast<int *>(MEM_mallocN(sizeof(int) * array_len, __func__));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
arr = arr_stack;
|
|
|
|
|
@@ -2725,7 +2736,7 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
|
|
|
|
|
}
|
|
|
|
|
int *tmparray, value;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(int) * len, __func__);
|
|
|
|
|
tmparray = static_cast<int *>(MEM_mallocN(sizeof(int) * len, __func__));
|
|
|
|
|
RNA_property_int_get_array(ptr, prop, tmparray);
|
|
|
|
|
value = tmparray[index];
|
|
|
|
|
MEM_freeN(tmparray);
|
|
|
|
|
@@ -2798,7 +2809,7 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i
|
|
|
|
|
else {
|
|
|
|
|
int *tmparray;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(int) * len, __func__);
|
|
|
|
|
tmparray = static_cast<int *>(MEM_mallocN(sizeof(int) * len, __func__));
|
|
|
|
|
RNA_property_int_get_array(ptr, prop, tmparray);
|
|
|
|
|
tmparray[index] = value;
|
|
|
|
|
RNA_property_int_set_array(ptr, prop, tmparray);
|
|
|
|
|
@@ -2806,7 +2817,7 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RNA_property_int_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
|
|
|
|
|
int RNA_property_int_get_default(PointerRNA * /*ptr*/, PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
|
|
|
|
|
@@ -2859,7 +2870,7 @@ void RNA_property_int_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
rna_property_int_fill_default_array_values(
|
|
|
|
|
NULL, 0, ui_data->default_value, length, values);
|
|
|
|
|
nullptr, 0, ui_data->default_value, length, values);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -2887,7 +2898,7 @@ int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int i
|
|
|
|
|
}
|
|
|
|
|
int *tmparray, value;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(int) * len, __func__);
|
|
|
|
|
tmparray = static_cast<int *>(MEM_mallocN(sizeof(int) * len, __func__));
|
|
|
|
|
RNA_property_int_get_default_array(ptr, prop, tmparray);
|
|
|
|
|
value = tmparray[index];
|
|
|
|
|
MEM_freeN(tmparray);
|
|
|
|
|
@@ -3063,7 +3074,7 @@ void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, floa
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (array_len > 32) {
|
|
|
|
|
arr = MEM_mallocN(sizeof(float) * array_len, __func__);
|
|
|
|
|
arr = static_cast<float *>(MEM_mallocN(sizeof(float) * array_len, __func__));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
arr = arr_stack;
|
|
|
|
|
@@ -3098,7 +3109,7 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
|
|
|
|
|
}
|
|
|
|
|
float *tmparray, value;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(float) * len, __func__);
|
|
|
|
|
tmparray = static_cast<float *>(MEM_mallocN(sizeof(float) * len, __func__));
|
|
|
|
|
RNA_property_float_get_array(ptr, prop, tmparray);
|
|
|
|
|
value = tmparray[index];
|
|
|
|
|
MEM_freeN(tmparray);
|
|
|
|
|
@@ -3182,7 +3193,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index,
|
|
|
|
|
else {
|
|
|
|
|
float *tmparray;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(float) * len, __func__);
|
|
|
|
|
tmparray = static_cast<float *>(MEM_mallocN(sizeof(float) * len, __func__));
|
|
|
|
|
RNA_property_float_get_array(ptr, prop, tmparray);
|
|
|
|
|
tmparray[index] = value;
|
|
|
|
|
RNA_property_float_set_array(ptr, prop, tmparray);
|
|
|
|
|
@@ -3190,7 +3201,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
|
|
|
|
|
float RNA_property_float_get_default(PointerRNA * /*ptr*/, PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
|
|
|
|
|
@@ -3269,7 +3280,7 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
|
|
|
|
|
}
|
|
|
|
|
float *tmparray, value;
|
|
|
|
|
|
|
|
|
|
tmparray = MEM_mallocN(sizeof(float) * len, __func__);
|
|
|
|
|
tmparray = static_cast<float *>(MEM_mallocN(sizeof(float) * len, __func__));
|
|
|
|
|
RNA_property_float_get_default_array(ptr, prop, tmparray);
|
|
|
|
|
value = tmparray[index];
|
|
|
|
|
MEM_freeN(tmparray);
|
|
|
|
|
@@ -3320,7 +3331,7 @@ char *RNA_property_string_get_alloc(
|
|
|
|
|
buf = fixedbuf;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
buf = MEM_mallocN(sizeof(char) * (length + 1), __func__);
|
|
|
|
|
buf = static_cast<char *>(MEM_mallocN(sizeof(char) * (length + 1), __func__));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
|
@@ -3468,7 +3479,7 @@ char *RNA_property_string_get_default_alloc(
|
|
|
|
|
buf = fixedbuf;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
buf = MEM_callocN(sizeof(char) * (length + 1), __func__);
|
|
|
|
|
buf = static_cast<char *>(MEM_callocN(sizeof(char) * (length + 1), __func__));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RNA_property_string_get_default(prop, buf, length + 1);
|
|
|
|
|
@@ -3480,7 +3491,7 @@ char *RNA_property_string_get_default_alloc(
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
|
|
|
|
|
int RNA_property_string_default_length(PointerRNA * /*ptr*/, PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
|
|
|
|
|
@@ -3489,7 +3500,7 @@ int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *pro
|
|
|
|
|
if (idprop->ui_data) {
|
|
|
|
|
BLI_assert(idprop->type == IDP_STRING);
|
|
|
|
|
const IDPropertyUIDataString *ui_data = (const IDPropertyUIDataString *)idprop->ui_data;
|
|
|
|
|
if (ui_data->default_value != NULL) {
|
|
|
|
|
if (ui_data->default_value != nullptr) {
|
|
|
|
|
return strlen(ui_data->default_value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -3506,7 +3517,7 @@ eStringPropertySearchFlag RNA_property_string_search_flag(PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
if (prop->magic != RNA_MAGIC) {
|
|
|
|
|
return false;
|
|
|
|
|
return eStringPropertySearchFlag(0);
|
|
|
|
|
}
|
|
|
|
|
BLI_assert(RNA_property_type(prop) == PROP_STRING);
|
|
|
|
|
if (sprop->search) {
|
|
|
|
|
@@ -3579,7 +3590,7 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RNA_property_enum_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
|
|
|
|
|
int RNA_property_enum_get_default(PointerRNA * /*ptr*/, PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
|
|
|
|
|
@@ -3672,9 +3683,9 @@ void RNA_property_pointer_set(PointerRNA *ptr,
|
|
|
|
|
BLI_assert(RNA_property_type(prop) == PROP_POINTER);
|
|
|
|
|
|
|
|
|
|
/* Check types. */
|
|
|
|
|
if (pprop->set != NULL) {
|
|
|
|
|
if (pprop->set != nullptr) {
|
|
|
|
|
/* Assigning to a real RNA property. */
|
|
|
|
|
if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, pprop->type)) {
|
|
|
|
|
if (ptr_value.type != nullptr && !RNA_struct_is_a(ptr_value.type, pprop->type)) {
|
|
|
|
|
BKE_reportf(reports,
|
|
|
|
|
RPT_ERROR,
|
|
|
|
|
"%s: expected %s type, not %s",
|
|
|
|
|
@@ -3686,7 +3697,7 @@ void RNA_property_pointer_set(PointerRNA *ptr,
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Assigning to an IDProperty disguised as RNA one. */
|
|
|
|
|
if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, &RNA_ID)) {
|
|
|
|
|
if (ptr_value.type != nullptr && !RNA_struct_is_a(ptr_value.type, &RNA_ID)) {
|
|
|
|
|
BKE_reportf(reports,
|
|
|
|
|
RPT_ERROR,
|
|
|
|
|
"%s: expected ID type, not %s",
|
|
|
|
|
@@ -3697,27 +3708,28 @@ void RNA_property_pointer_set(PointerRNA *ptr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We got an existing IDProperty. */
|
|
|
|
|
if (idprop != NULL) {
|
|
|
|
|
if (idprop != nullptr) {
|
|
|
|
|
/* Not-yet-defined ID IDProps have an IDP_GROUP type, not an IDP_ID one - because of reasons?
|
|
|
|
|
* XXX This has to be investigated fully - there might be a good reason for it, but off hands
|
|
|
|
|
* this seems really weird... */
|
|
|
|
|
if (idprop->type == IDP_ID) {
|
|
|
|
|
IDP_AssignID(idprop, ptr_value.data, 0);
|
|
|
|
|
IDP_AssignID(idprop, static_cast<ID *>(ptr_value.data), 0);
|
|
|
|
|
rna_idproperty_touch(idprop);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLI_assert(idprop->type == IDP_GROUP);
|
|
|
|
|
|
|
|
|
|
IDPropertyTemplate val = {.id = ptr_value.data};
|
|
|
|
|
IDPropertyTemplate val{};
|
|
|
|
|
val.id = static_cast<ID *>(ptr_value.data);
|
|
|
|
|
IDProperty *group = RNA_struct_idprops(ptr, true);
|
|
|
|
|
BLI_assert(group != NULL);
|
|
|
|
|
BLI_assert(group != nullptr);
|
|
|
|
|
|
|
|
|
|
IDP_ReplaceInGroup_ex(group, IDP_New(IDP_ID, &val, idprop->name), idprop);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* RNA property. */
|
|
|
|
|
else if (pprop->set) {
|
|
|
|
|
if (!((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
|
|
|
|
|
if (!((prop->flag & PROP_NEVER_NULL) && ptr_value.data == nullptr) &&
|
|
|
|
|
!((prop->flag & PROP_ID_SELF_CHECK) && ptr->owner_id == ptr_value.owner_id)) {
|
|
|
|
|
pprop->set(ptr, ptr_value, reports);
|
|
|
|
|
}
|
|
|
|
|
@@ -3727,7 +3739,7 @@ void RNA_property_pointer_set(PointerRNA *ptr,
|
|
|
|
|
IDPropertyTemplate val = {0};
|
|
|
|
|
IDProperty *group;
|
|
|
|
|
|
|
|
|
|
val.id = ptr_value.data;
|
|
|
|
|
val.id = static_cast<ID *>(ptr_value.data);
|
|
|
|
|
|
|
|
|
|
group = RNA_struct_idprops(ptr, true);
|
|
|
|
|
if (group) {
|
|
|
|
|
@@ -3736,7 +3748,7 @@ void RNA_property_pointer_set(PointerRNA *ptr,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PointerRNA RNA_property_pointer_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
|
|
|
|
|
PointerRNA RNA_property_pointer_get_default(PointerRNA * /*ptr*/, PropertyRNA * /*prop*/)
|
|
|
|
|
{
|
|
|
|
|
// PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
|
|
|
|
|
|
|
|
|
|
@@ -3819,10 +3831,10 @@ void RNA_property_collection_begin(PointerRNA *ptr,
|
|
|
|
|
|
|
|
|
|
if (idprop) {
|
|
|
|
|
rna_iterator_array_begin(
|
|
|
|
|
iter, IDP_IDPArray(idprop), sizeof(IDProperty), idprop->len, 0, NULL);
|
|
|
|
|
iter, IDP_IDPArray(idprop), sizeof(IDProperty), idprop->len, 0, nullptr);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
rna_iterator_array_begin(iter, NULL, sizeof(IDProperty), 0, 0, NULL);
|
|
|
|
|
rna_iterator_array_begin(iter, nullptr, sizeof(IDProperty), 0, 0, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (iter->valid) {
|
|
|
|
|
@@ -3933,7 +3945,7 @@ static bool property_collection_liboverride_editable(PointerRNA *ptr,
|
|
|
|
|
bool *r_is_liboverride)
|
|
|
|
|
{
|
|
|
|
|
ID *id = ptr->owner_id;
|
|
|
|
|
if (id == NULL) {
|
|
|
|
|
if (id == nullptr) {
|
|
|
|
|
*r_is_liboverride = false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@@ -4018,7 +4030,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
|
|
|
|
|
if (!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
|
|
|
|
|
ParameterList params;
|
|
|
|
|
RNA_parameter_list_create(¶ms, ptr, cprop->add);
|
|
|
|
|
RNA_function_call(NULL, NULL, ptr, cprop->add, ¶ms);
|
|
|
|
|
RNA_function_call(nullptr, nullptr, ptr, cprop->add, ¶ms);
|
|
|
|
|
RNA_parameter_list_free(¶ms);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -4038,7 +4050,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
|
|
|
|
|
|
|
|
|
|
r_ptr->data = IDP_GetIndexArray(idprop, idprop->len - 1);
|
|
|
|
|
r_ptr->type = cprop->item_type;
|
|
|
|
|
rna_pointer_inherit_id(NULL, ptr, r_ptr);
|
|
|
|
|
rna_pointer_inherit_id(nullptr, ptr, r_ptr);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
memset(r_ptr, 0, sizeof(*r_ptr));
|
|
|
|
|
@@ -4093,7 +4105,7 @@ bool RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
|
|
|
|
|
if (!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
|
|
|
|
|
ParameterList params;
|
|
|
|
|
RNA_parameter_list_create(¶ms, ptr, cprop->remove);
|
|
|
|
|
RNA_function_call(NULL, NULL, ptr, cprop->remove, ¶ms);
|
|
|
|
|
RNA_function_call(nullptr, nullptr, ptr, cprop->remove, ¶ms);
|
|
|
|
|
RNA_parameter_list_free(¶ms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -4215,14 +4227,14 @@ bool RNA_property_collection_lookup_int_has_fn(PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
|
|
|
|
|
CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
return cprop->lookupint != NULL;
|
|
|
|
|
return cprop->lookupint != nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RNA_property_collection_lookup_string_has_fn(PropertyRNA *prop)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
|
|
|
|
|
CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
|
|
|
|
|
return cprop->lookupstring != NULL;
|
|
|
|
|
return cprop->lookupstring != nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RNA_property_collection_lookup_int(PointerRNA *ptr,
|
|
|
|
|
@@ -4367,7 +4379,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr,
|
|
|
|
|
if (iter.valid) {
|
|
|
|
|
/* get data from array iterator and item property */
|
|
|
|
|
internal = &iter.internal.array;
|
|
|
|
|
arrayp = (iter.valid) ? iter.ptr.data : NULL;
|
|
|
|
|
arrayp = (iter.valid) ? static_cast<char *>(iter.ptr.data) : nullptr;
|
|
|
|
|
|
|
|
|
|
if (internal->skip || !RNA_property_editable(&iter.ptr, itemprop)) {
|
|
|
|
|
/* we might skip some items, so it's not a proper array */
|
|
|
|
|
@@ -4492,7 +4504,7 @@ static int rna_raw_access(ReportList *reports,
|
|
|
|
|
StructRNA *ptype;
|
|
|
|
|
PointerRNA itemptr_base;
|
|
|
|
|
PropertyRNA *itemprop, *iprop;
|
|
|
|
|
PropertyType itemtype = 0;
|
|
|
|
|
PropertyType itemtype = PropertyType(0);
|
|
|
|
|
RawArray in;
|
|
|
|
|
int itemlen = 0;
|
|
|
|
|
|
|
|
|
|
@@ -4505,7 +4517,7 @@ static int rna_raw_access(ReportList *reports,
|
|
|
|
|
ptype = RNA_property_pointer_type(ptr, prop);
|
|
|
|
|
|
|
|
|
|
/* try to get item property pointer */
|
|
|
|
|
RNA_pointer_create(NULL, ptype, NULL, &itemptr_base);
|
|
|
|
|
RNA_pointer_create(nullptr, ptype, nullptr, &itemptr_base);
|
|
|
|
|
itemprop = RNA_struct_find_property(&itemptr_base, propname);
|
|
|
|
|
|
|
|
|
|
if (itemprop) {
|
|
|
|
|
@@ -4525,7 +4537,7 @@ static int rna_raw_access(ReportList *reports,
|
|
|
|
|
|
|
|
|
|
/* dynamic array? need to get length per item */
|
|
|
|
|
if (itemprop->getlength) {
|
|
|
|
|
itemprop = NULL;
|
|
|
|
|
itemprop = nullptr;
|
|
|
|
|
}
|
|
|
|
|
/* try to access as raw array */
|
|
|
|
|
else if (RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
|
|
|
|
|
@@ -4568,7 +4580,7 @@ static int rna_raw_access(ReportList *reports,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
void *tmparray = NULL;
|
|
|
|
|
void *tmparray = nullptr;
|
|
|
|
|
int tmplen = 0;
|
|
|
|
|
int err = 0, j, a = 0;
|
|
|
|
|
int needconv = 1;
|
|
|
|
|
@@ -4670,7 +4682,7 @@ static int rna_raw_access(ReportList *reports,
|
|
|
|
|
/* allocate temporary array if needed */
|
|
|
|
|
if (tmparray && tmplen != itemlen) {
|
|
|
|
|
MEM_freeN(tmparray);
|
|
|
|
|
tmparray = NULL;
|
|
|
|
|
tmparray = nullptr;
|
|
|
|
|
}
|
|
|
|
|
if (!tmparray) {
|
|
|
|
|
tmparray = MEM_callocN(sizeof(float) * itemlen, "RNA tmparray");
|
|
|
|
|
@@ -4681,24 +4693,27 @@ static int rna_raw_access(ReportList *reports,
|
|
|
|
|
if (set) {
|
|
|
|
|
switch (itemtype) {
|
|
|
|
|
case PROP_BOOLEAN: {
|
|
|
|
|
bool *array = static_cast<bool *>(tmparray);
|
|
|
|
|
for (j = 0; j < itemlen; j++, a++) {
|
|
|
|
|
RAW_GET(bool, ((bool *)tmparray)[j], in, a);
|
|
|
|
|
RAW_GET(bool, array[j], in, a);
|
|
|
|
|
}
|
|
|
|
|
RNA_property_boolean_set_array(&itemptr, iprop, tmparray);
|
|
|
|
|
RNA_property_boolean_set_array(&itemptr, iprop, array);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_INT: {
|
|
|
|
|
int *array = static_cast<int *>(tmparray);
|
|
|
|
|
for (j = 0; j < itemlen; j++, a++) {
|
|
|
|
|
RAW_GET(int, ((int *)tmparray)[j], in, a);
|
|
|
|
|
RAW_GET(int, array[j], in, a);
|
|
|
|
|
}
|
|
|
|
|
RNA_property_int_set_array(&itemptr, iprop, tmparray);
|
|
|
|
|
RNA_property_int_set_array(&itemptr, iprop, array);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_FLOAT: {
|
|
|
|
|
float *array = static_cast<float *>(tmparray);
|
|
|
|
|
for (j = 0; j < itemlen; j++, a++) {
|
|
|
|
|
RAW_GET(float, ((float *)tmparray)[j], in, a);
|
|
|
|
|
RAW_GET(float, array[j], in, a);
|
|
|
|
|
}
|
|
|
|
|
RNA_property_float_set_array(&itemptr, iprop, tmparray);
|
|
|
|
|
RNA_property_float_set_array(&itemptr, iprop, array);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
@@ -4708,23 +4723,26 @@ static int rna_raw_access(ReportList *reports,
|
|
|
|
|
else {
|
|
|
|
|
switch (itemtype) {
|
|
|
|
|
case PROP_BOOLEAN: {
|
|
|
|
|
RNA_property_boolean_get_array(&itemptr, iprop, tmparray);
|
|
|
|
|
bool *array = static_cast<bool *>(tmparray);
|
|
|
|
|
RNA_property_boolean_get_array(&itemptr, iprop, array);
|
|
|
|
|
for (j = 0; j < itemlen; j++, a++) {
|
|
|
|
|
RAW_SET(int, in, a, ((bool *)tmparray)[j]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_INT: {
|
|
|
|
|
RNA_property_int_get_array(&itemptr, iprop, tmparray);
|
|
|
|
|
int *array = static_cast<int *>(tmparray);
|
|
|
|
|
RNA_property_int_get_array(&itemptr, iprop, array);
|
|
|
|
|
for (j = 0; j < itemlen; j++, a++) {
|
|
|
|
|
RAW_SET(int, in, a, ((int *)tmparray)[j]);
|
|
|
|
|
RAW_SET(int, in, a, array[j]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_FLOAT: {
|
|
|
|
|
RNA_property_float_get_array(&itemptr, iprop, tmparray);
|
|
|
|
|
float *array = static_cast<float *>(tmparray);
|
|
|
|
|
RNA_property_float_get_array(&itemptr, iprop, array);
|
|
|
|
|
for (j = 0; j < itemlen; j++, a++) {
|
|
|
|
|
RAW_SET(float, in, a, ((float *)tmparray)[j]);
|
|
|
|
|
RAW_SET(float, in, a, array[j]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -4841,10 +4859,10 @@ void rna_iterator_listbase_begin(CollectionPropertyIterator *iter,
|
|
|
|
|
{
|
|
|
|
|
ListBaseIterator *internal = &iter->internal.listbase;
|
|
|
|
|
|
|
|
|
|
internal->link = (lb) ? lb->first : NULL;
|
|
|
|
|
internal->link = (lb) ? static_cast<Link *>(lb->first) : nullptr;
|
|
|
|
|
internal->skip = skip;
|
|
|
|
|
|
|
|
|
|
iter->valid = (internal->link != NULL);
|
|
|
|
|
iter->valid = (internal->link != nullptr);
|
|
|
|
|
|
|
|
|
|
if (skip && iter->valid && skip(iter, internal->link)) {
|
|
|
|
|
rna_iterator_listbase_next(iter);
|
|
|
|
|
@@ -4858,12 +4876,12 @@ void rna_iterator_listbase_next(CollectionPropertyIterator *iter)
|
|
|
|
|
if (internal->skip) {
|
|
|
|
|
do {
|
|
|
|
|
internal->link = internal->link->next;
|
|
|
|
|
iter->valid = (internal->link != NULL);
|
|
|
|
|
iter->valid = (internal->link != nullptr);
|
|
|
|
|
} while (iter->valid && internal->skip(iter, internal->link));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
internal->link = internal->link->next;
|
|
|
|
|
iter->valid = (internal->link != NULL);
|
|
|
|
|
iter->valid = (internal->link != nullptr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -4874,14 +4892,11 @@ void *rna_iterator_listbase_get(CollectionPropertyIterator *iter)
|
|
|
|
|
return internal->link;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rna_iterator_listbase_end(CollectionPropertyIterator *UNUSED(iter))
|
|
|
|
|
void rna_iterator_listbase_end(CollectionPropertyIterator * /*iter*/)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PointerRNA rna_listbase_lookup_int(PointerRNA *ptr,
|
|
|
|
|
StructRNA *type,
|
|
|
|
|
struct ListBase *lb,
|
|
|
|
|
int index)
|
|
|
|
|
PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, ListBase *lb, int index)
|
|
|
|
|
{
|
|
|
|
|
void *data = BLI_findlink(lb, index);
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, type, data);
|
|
|
|
|
@@ -4896,17 +4911,17 @@ void rna_iterator_array_begin(CollectionPropertyIterator *iter,
|
|
|
|
|
{
|
|
|
|
|
ArrayIterator *internal;
|
|
|
|
|
|
|
|
|
|
if (ptr == NULL) {
|
|
|
|
|
if (ptr == nullptr) {
|
|
|
|
|
length = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (length == 0) {
|
|
|
|
|
ptr = NULL;
|
|
|
|
|
ptr = nullptr;
|
|
|
|
|
itemsize = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal = &iter->internal.array;
|
|
|
|
|
internal->ptr = ptr;
|
|
|
|
|
internal->free_ptr = free_ptr ? ptr : NULL;
|
|
|
|
|
internal->ptr = static_cast<char *>(ptr);
|
|
|
|
|
internal->free_ptr = free_ptr ? ptr : nullptr;
|
|
|
|
|
internal->endptr = ((char *)ptr) + length * itemsize;
|
|
|
|
|
internal->itemsize = itemsize;
|
|
|
|
|
internal->skip = skip;
|
|
|
|
|
@@ -5161,7 +5176,7 @@ bool RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const cha
|
|
|
|
|
int i;
|
|
|
|
|
bool cmp = false;
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item, nullptr, &free);
|
|
|
|
|
i = RNA_enum_from_identifier(item, enumname);
|
|
|
|
|
if (i != -1) {
|
|
|
|
|
cmp = (item[i].value == RNA_property_enum_get(ptr, prop));
|
|
|
|
|
@@ -5244,10 +5259,10 @@ char *RNA_string_get_alloc(
|
|
|
|
|
return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen, r_len);
|
|
|
|
|
}
|
|
|
|
|
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
|
|
|
|
|
if (r_len != NULL) {
|
|
|
|
|
if (r_len != nullptr) {
|
|
|
|
|
*r_len = 0;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RNA_string_length(PointerRNA *ptr, const char *name)
|
|
|
|
|
@@ -5290,7 +5305,7 @@ void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
|
|
|
|
|
PropertyRNA *prop = RNA_struct_find_property(ptr, name);
|
|
|
|
|
|
|
|
|
|
if (prop) {
|
|
|
|
|
RNA_property_pointer_set(ptr, prop, ptr_value, NULL);
|
|
|
|
|
RNA_property_pointer_set(ptr, prop, ptr_value, nullptr);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
|
|
|
|
|
@@ -5372,7 +5387,7 @@ bool RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, bool use_ghost)
|
|
|
|
|
prop = rna_ensure_property(prop);
|
|
|
|
|
if (prop->flag & PROP_IDPROPERTY) {
|
|
|
|
|
IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
|
|
|
|
|
return ((idprop != NULL) && (use_ghost == false || !(idprop->flag & IDP_FLAG_GHOST)));
|
|
|
|
|
return ((idprop != nullptr) && (use_ghost == false || !(idprop->flag & IDP_FLAG_GHOST)));
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@@ -5382,7 +5397,7 @@ bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
|
|
|
|
|
prop = rna_ensure_property(prop);
|
|
|
|
|
if (prop->flag & PROP_IDPROPERTY) {
|
|
|
|
|
IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
|
|
|
|
|
return ((idprop != NULL) && !(idprop->flag & IDP_FLAG_GHOST));
|
|
|
|
|
return ((idprop != nullptr) && !(idprop->flag & IDP_FLAG_GHOST));
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@@ -5479,7 +5494,7 @@ char *RNA_pointer_as_string_id(bContext *C, PointerRNA *ptr)
|
|
|
|
|
|
|
|
|
|
static char *rna_pointer_as_string__bldata(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
if (ptr->type == NULL || ptr->owner_id == NULL) {
|
|
|
|
|
if (ptr->type == nullptr || ptr->owner_id == nullptr) {
|
|
|
|
|
return BLI_strdup("None");
|
|
|
|
|
}
|
|
|
|
|
if (RNA_struct_is_ID(ptr->type)) {
|
|
|
|
|
@@ -5494,7 +5509,7 @@ char *RNA_pointer_as_string(bContext *C,
|
|
|
|
|
PointerRNA *ptr_prop)
|
|
|
|
|
{
|
|
|
|
|
IDProperty *prop;
|
|
|
|
|
if (ptr_prop->data == NULL) {
|
|
|
|
|
if (ptr_prop->data == nullptr) {
|
|
|
|
|
return BLI_strdup("None");
|
|
|
|
|
}
|
|
|
|
|
if ((prop = rna_idproperty_check(&prop_ptr, ptr)) && prop->type != IDP_ID) {
|
|
|
|
|
@@ -5511,7 +5526,7 @@ char *RNA_pointer_as_string_keywords_ex(bContext *C,
|
|
|
|
|
const int max_prop_length,
|
|
|
|
|
PropertyRNA *iterprop)
|
|
|
|
|
{
|
|
|
|
|
const char *arg_name = NULL;
|
|
|
|
|
const char *arg_name = nullptr;
|
|
|
|
|
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
@@ -5521,7 +5536,7 @@ char *RNA_pointer_as_string_keywords_ex(bContext *C,
|
|
|
|
|
int flag, flag_parameter;
|
|
|
|
|
|
|
|
|
|
RNA_PROP_BEGIN (ptr, propptr, iterprop) {
|
|
|
|
|
prop = propptr.data;
|
|
|
|
|
prop = static_cast<PropertyRNA *>(propptr.data);
|
|
|
|
|
|
|
|
|
|
flag = RNA_property_flag(prop);
|
|
|
|
|
flag_parameter = RNA_parameter_flag(prop);
|
|
|
|
|
@@ -5607,7 +5622,7 @@ char *RNA_function_as_string_keywords(bContext *C,
|
|
|
|
|
PointerRNA funcptr;
|
|
|
|
|
PropertyRNA *iterprop;
|
|
|
|
|
|
|
|
|
|
RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
|
|
|
|
|
RNA_pointer_create(nullptr, &RNA_Function, func, &funcptr);
|
|
|
|
|
|
|
|
|
|
iterprop = RNA_struct_find_property(&funcptr, "parameters");
|
|
|
|
|
|
|
|
|
|
@@ -5625,30 +5640,29 @@ static const char *bool_as_py_string(const int var)
|
|
|
|
|
static void *rna_array_as_string_alloc(
|
|
|
|
|
int type, int len, PointerRNA *ptr, PropertyRNA *prop, void **r_buf_end)
|
|
|
|
|
{
|
|
|
|
|
void *buf_ret = NULL;
|
|
|
|
|
switch (type) {
|
|
|
|
|
case PROP_BOOLEAN: {
|
|
|
|
|
bool *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
|
|
|
|
|
bool *buf = static_cast<bool *>(MEM_mallocN(sizeof(*buf) * len, __func__));
|
|
|
|
|
RNA_property_boolean_get_array(ptr, prop, buf);
|
|
|
|
|
*r_buf_end = buf + len;
|
|
|
|
|
break;
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
case PROP_INT: {
|
|
|
|
|
int *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
|
|
|
|
|
int *buf = static_cast<int *>(MEM_mallocN(sizeof(*buf) * len, __func__));
|
|
|
|
|
RNA_property_int_get_array(ptr, prop, buf);
|
|
|
|
|
*r_buf_end = buf + len;
|
|
|
|
|
break;
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
case PROP_FLOAT: {
|
|
|
|
|
float *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
|
|
|
|
|
float *buf = static_cast<float *>(MEM_mallocN(sizeof(*buf) * len, __func__));
|
|
|
|
|
RNA_property_float_get_array(ptr, prop, buf);
|
|
|
|
|
*r_buf_end = buf + len;
|
|
|
|
|
break;
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
BLI_assert_unreachable();
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
return buf_ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_array_as_string_elem(int type, void **buf_p, int len, DynStr *dynstr)
|
|
|
|
|
@@ -5658,7 +5672,7 @@ static void rna_array_as_string_elem(int type, void **buf_p, int len, DynStr *dy
|
|
|
|
|
const int end = len - 1;
|
|
|
|
|
switch (type) {
|
|
|
|
|
case PROP_BOOLEAN: {
|
|
|
|
|
bool *buf = *buf_p;
|
|
|
|
|
bool *buf = static_cast<bool *>(*buf_p);
|
|
|
|
|
for (int i = 0; i < len; i++, buf++) {
|
|
|
|
|
BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%s, " : "%s", bool_as_py_string(*buf));
|
|
|
|
|
}
|
|
|
|
|
@@ -5666,7 +5680,7 @@ static void rna_array_as_string_elem(int type, void **buf_p, int len, DynStr *dy
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_INT: {
|
|
|
|
|
int *buf = *buf_p;
|
|
|
|
|
int *buf = static_cast<int *>(*buf_p);
|
|
|
|
|
for (int i = 0; i < len; i++, buf++) {
|
|
|
|
|
BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%d, " : "%d", *buf);
|
|
|
|
|
}
|
|
|
|
|
@@ -5674,7 +5688,7 @@ static void rna_array_as_string_elem(int type, void **buf_p, int len, DynStr *dy
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_FLOAT: {
|
|
|
|
|
float *buf = *buf_p;
|
|
|
|
|
float *buf = static_cast<float *>(*buf_p);
|
|
|
|
|
for (int i = 0; i < len; i++, buf++) {
|
|
|
|
|
BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%g, " : "%g", *buf);
|
|
|
|
|
}
|
|
|
|
|
@@ -5778,8 +5792,10 @@ char *RNA_property_as_string(
|
|
|
|
|
int length;
|
|
|
|
|
|
|
|
|
|
length = RNA_property_string_length(ptr, prop);
|
|
|
|
|
buf = MEM_mallocN(sizeof(char) * (length + 1), "RNA_property_as_string");
|
|
|
|
|
buf_esc = MEM_mallocN(sizeof(char) * (length * 2 + 1), "RNA_property_as_string esc");
|
|
|
|
|
buf = static_cast<char *>(
|
|
|
|
|
MEM_mallocN(sizeof(char) * (length + 1), "RNA_property_as_string"));
|
|
|
|
|
buf_esc = static_cast<char *>(
|
|
|
|
|
MEM_mallocN(sizeof(char) * (length * 2 + 1), "RNA_property_as_string esc"));
|
|
|
|
|
RNA_property_string_get(ptr, prop, buf);
|
|
|
|
|
BLI_str_escape(buf_esc, buf, length * 2 + 1);
|
|
|
|
|
MEM_freeN(buf);
|
|
|
|
|
@@ -5800,7 +5816,7 @@ char *RNA_property_as_string(
|
|
|
|
|
|
|
|
|
|
BLI_dynstr_append(dynstr, "{");
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free);
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &item_array, nullptr, &free);
|
|
|
|
|
if (item_array) {
|
|
|
|
|
const EnumPropertyItem *item = item_array;
|
|
|
|
|
bool is_first = true;
|
|
|
|
|
@@ -5896,21 +5912,21 @@ int RNA_function_flag(FunctionRNA *func)
|
|
|
|
|
|
|
|
|
|
int RNA_function_defined(FunctionRNA *func)
|
|
|
|
|
{
|
|
|
|
|
return func->call != NULL;
|
|
|
|
|
return func->call != nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyRNA *RNA_function_get_parameter(PointerRNA *UNUSED(ptr), FunctionRNA *func, int index)
|
|
|
|
|
PropertyRNA *RNA_function_get_parameter(PointerRNA * /*ptr*/, FunctionRNA *func, int index)
|
|
|
|
|
{
|
|
|
|
|
return BLI_findlink(&func->cont.properties, index);
|
|
|
|
|
return static_cast<PropertyRNA *>(BLI_findlink(&func->cont.properties, index));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PropertyRNA *RNA_function_find_parameter(PointerRNA *UNUSED(ptr),
|
|
|
|
|
PropertyRNA *RNA_function_find_parameter(PointerRNA * /*ptr*/,
|
|
|
|
|
FunctionRNA *func,
|
|
|
|
|
const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
parm = func->cont.properties.first;
|
|
|
|
|
parm = static_cast<PropertyRNA *>(func->cont.properties.first);
|
|
|
|
|
for (; parm; parm = parm->next) {
|
|
|
|
|
if (STREQ(RNA_property_identifier(parm), identifier)) {
|
|
|
|
|
break;
|
|
|
|
|
@@ -5933,7 +5949,7 @@ int RNA_parameter_flag(PropertyRNA *prop)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ParameterList *RNA_parameter_list_create(ParameterList *parms,
|
|
|
|
|
PointerRNA *UNUSED(ptr),
|
|
|
|
|
PointerRNA * /*ptr*/,
|
|
|
|
|
FunctionRNA *func)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
@@ -5945,7 +5961,7 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms,
|
|
|
|
|
parms->ret_count = 0;
|
|
|
|
|
|
|
|
|
|
/* allocate data */
|
|
|
|
|
for (parm = func->cont.properties.first; parm; parm = parm->next) {
|
|
|
|
|
for (parm = static_cast<PropertyRNA *>(func->cont.properties.first); parm; parm = parm->next) {
|
|
|
|
|
alloc_size += rna_parameter_size_pad(rna_parameter_size(parm));
|
|
|
|
|
|
|
|
|
|
if (parm->flag_parameter & PARM_OUTPUT) {
|
|
|
|
|
@@ -5963,14 +5979,14 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms,
|
|
|
|
|
/* set default values */
|
|
|
|
|
data = parms->data;
|
|
|
|
|
|
|
|
|
|
for (parm = func->cont.properties.first; parm; parm = parm->next) {
|
|
|
|
|
for (parm = static_cast<PropertyRNA *>(func->cont.properties.first); parm; parm = parm->next) {
|
|
|
|
|
size = rna_parameter_size(parm);
|
|
|
|
|
|
|
|
|
|
/* set length to 0, these need to be set later, see bpy_array.c's py_to_array */
|
|
|
|
|
if (parm->flag & PROP_DYNAMIC) {
|
|
|
|
|
ParameterDynAlloc *data_alloc = data;
|
|
|
|
|
ParameterDynAlloc *data_alloc = static_cast<ParameterDynAlloc *>(data);
|
|
|
|
|
data_alloc->array_tot = 0;
|
|
|
|
|
data_alloc->array = NULL;
|
|
|
|
|
data_alloc->array = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(parm->flag_parameter & PARM_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
|
|
|
|
|
@@ -5978,7 +5994,7 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms,
|
|
|
|
|
case PROP_BOOLEAN:
|
|
|
|
|
if (parm->arraydimension) {
|
|
|
|
|
rna_property_boolean_get_default_array_values(
|
|
|
|
|
&null_ptr, (BoolPropertyRNA *)parm, data);
|
|
|
|
|
&null_ptr, (BoolPropertyRNA *)parm, static_cast<bool *>(data));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
memcpy(data, &((BoolPropertyRNA *)parm)->defaultvalue, size);
|
|
|
|
|
@@ -5986,7 +6002,8 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms,
|
|
|
|
|
break;
|
|
|
|
|
case PROP_INT:
|
|
|
|
|
if (parm->arraydimension) {
|
|
|
|
|
rna_property_int_get_default_array_values(&null_ptr, (IntPropertyRNA *)parm, data);
|
|
|
|
|
rna_property_int_get_default_array_values(
|
|
|
|
|
&null_ptr, (IntPropertyRNA *)parm, static_cast<int *>(data));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
memcpy(data, &((IntPropertyRNA *)parm)->defaultvalue, size);
|
|
|
|
|
@@ -5994,7 +6011,8 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms,
|
|
|
|
|
break;
|
|
|
|
|
case PROP_FLOAT:
|
|
|
|
|
if (parm->arraydimension) {
|
|
|
|
|
rna_property_float_get_default_array_values(&null_ptr, (FloatPropertyRNA *)parm, data);
|
|
|
|
|
rna_property_float_get_default_array_values(
|
|
|
|
|
&null_ptr, (FloatPropertyRNA *)parm, static_cast<float *>(data));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
memcpy(data, &((FloatPropertyRNA *)parm)->defaultvalue, size);
|
|
|
|
|
@@ -6033,14 +6051,15 @@ void RNA_parameter_list_free(ParameterList *parms)
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
int tot;
|
|
|
|
|
|
|
|
|
|
parm = parms->func->cont.properties.first;
|
|
|
|
|
parm = static_cast<PropertyRNA *>(parms->func->cont.properties.first);
|
|
|
|
|
for (tot = 0; parm; parm = parm->next) {
|
|
|
|
|
if (parm->type == PROP_COLLECTION) {
|
|
|
|
|
BLI_freelistN((ListBase *)((char *)parms->data + tot));
|
|
|
|
|
}
|
|
|
|
|
else if (parm->flag & PROP_DYNAMIC) {
|
|
|
|
|
/* for dynamic arrays and strings, data is a pointer to an array */
|
|
|
|
|
ParameterDynAlloc *data_alloc = (void *)(((char *)parms->data) + tot);
|
|
|
|
|
ParameterDynAlloc *data_alloc = static_cast<ParameterDynAlloc *>(
|
|
|
|
|
(void *)(((char *)parms->data) + tot));
|
|
|
|
|
if (data_alloc->array) {
|
|
|
|
|
MEM_freeN(data_alloc->array);
|
|
|
|
|
}
|
|
|
|
|
@@ -6050,9 +6069,9 @@ void RNA_parameter_list_free(ParameterList *parms)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MEM_freeN(parms->data);
|
|
|
|
|
parms->data = NULL;
|
|
|
|
|
parms->data = nullptr;
|
|
|
|
|
|
|
|
|
|
parms->func = NULL;
|
|
|
|
|
parms->func = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RNA_parameter_list_size(const ParameterList *parms)
|
|
|
|
|
@@ -6073,11 +6092,11 @@ int RNA_parameter_list_ret_count(const ParameterList *parms)
|
|
|
|
|
void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter)
|
|
|
|
|
{
|
|
|
|
|
/* may be useful but unused now */
|
|
|
|
|
// RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); /* UNUSED */
|
|
|
|
|
// RNA_pointer_create(nullptr, &RNA_Function, parms->func, &iter->funcptr); /* UNUSED */
|
|
|
|
|
|
|
|
|
|
iter->parms = parms;
|
|
|
|
|
iter->parm = parms->func->cont.properties.first;
|
|
|
|
|
iter->valid = iter->parm != NULL;
|
|
|
|
|
iter->parm = static_cast<PropertyRNA *>(parms->func->cont.properties.first);
|
|
|
|
|
iter->valid = iter->parm != nullptr;
|
|
|
|
|
iter->offset = 0;
|
|
|
|
|
|
|
|
|
|
if (iter->valid) {
|
|
|
|
|
@@ -6090,7 +6109,7 @@ void RNA_parameter_list_next(ParameterIterator *iter)
|
|
|
|
|
{
|
|
|
|
|
iter->offset += rna_parameter_size_pad(iter->size);
|
|
|
|
|
iter->parm = iter->parm->next;
|
|
|
|
|
iter->valid = iter->parm != NULL;
|
|
|
|
|
iter->valid = iter->parm != nullptr;
|
|
|
|
|
|
|
|
|
|
if (iter->valid) {
|
|
|
|
|
iter->size = rna_parameter_size(iter->parm);
|
|
|
|
|
@@ -6098,7 +6117,7 @@ void RNA_parameter_list_next(ParameterIterator *iter)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_parameter_list_end(ParameterIterator *UNUSED(iter))
|
|
|
|
|
void RNA_parameter_list_end(ParameterIterator * /*iter*/)
|
|
|
|
|
{
|
|
|
|
|
/* nothing to do */
|
|
|
|
|
}
|
|
|
|
|
@@ -6118,7 +6137,7 @@ void RNA_parameter_get(ParameterList *parms, PropertyRNA *parm, void **value)
|
|
|
|
|
if (iter.valid) {
|
|
|
|
|
if (parm->flag & PROP_DYNAMIC) {
|
|
|
|
|
/* for dynamic arrays and strings, data is a pointer to an array */
|
|
|
|
|
ParameterDynAlloc *data_alloc = iter.data;
|
|
|
|
|
ParameterDynAlloc *data_alloc = static_cast<ParameterDynAlloc *>(iter.data);
|
|
|
|
|
*value = data_alloc->array;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
@@ -6126,7 +6145,7 @@ void RNA_parameter_get(ParameterList *parms, PropertyRNA *parm, void **value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
*value = NULL;
|
|
|
|
|
*value = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RNA_parameter_list_end(&iter);
|
|
|
|
|
@@ -6136,7 +6155,7 @@ void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
parm = parms->func->cont.properties.first;
|
|
|
|
|
parm = static_cast<PropertyRNA *>(parms->func->cont.properties.first);
|
|
|
|
|
for (; parm; parm = parm->next) {
|
|
|
|
|
if (STREQ(RNA_property_identifier(parm), identifier)) {
|
|
|
|
|
break;
|
|
|
|
|
@@ -6163,7 +6182,7 @@ void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *valu
|
|
|
|
|
if (iter.valid) {
|
|
|
|
|
if (parm->flag & PROP_DYNAMIC) {
|
|
|
|
|
/* for dynamic arrays and strings, data is a pointer to an array */
|
|
|
|
|
ParameterDynAlloc *data_alloc = iter.data;
|
|
|
|
|
ParameterDynAlloc *data_alloc = static_cast<ParameterDynAlloc *>(iter.data);
|
|
|
|
|
size_t size = 0;
|
|
|
|
|
switch (parm->type) {
|
|
|
|
|
case PROP_STRING:
|
|
|
|
|
@@ -6198,7 +6217,7 @@ void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, cons
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
parm = parms->func->cont.properties.first;
|
|
|
|
|
parm = static_cast<PropertyRNA *>(parms->func->cont.properties.first);
|
|
|
|
|
for (; parm; parm = parm->next) {
|
|
|
|
|
if (STREQ(RNA_property_identifier(parm), identifier)) {
|
|
|
|
|
break;
|
|
|
|
|
@@ -6251,9 +6270,7 @@ void RNA_parameter_dynamic_length_set(ParameterList *parms, PropertyRNA *parm, i
|
|
|
|
|
RNA_parameter_list_end(&iter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RNA_parameter_dynamic_length_get_data(ParameterList *UNUSED(parms),
|
|
|
|
|
PropertyRNA *parm,
|
|
|
|
|
void *data)
|
|
|
|
|
int RNA_parameter_dynamic_length_get_data(ParameterList * /*parms*/, PropertyRNA *parm, void *data)
|
|
|
|
|
{
|
|
|
|
|
if (parm->flag & PROP_DYNAMIC) {
|
|
|
|
|
return (int)((ParameterDynAlloc *)data)->array_tot;
|
|
|
|
|
@@ -6261,7 +6278,7 @@ int RNA_parameter_dynamic_length_get_data(ParameterList *UNUSED(parms),
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_parameter_dynamic_length_set_data(ParameterList *UNUSED(parms),
|
|
|
|
|
void RNA_parameter_dynamic_length_set_data(ParameterList * /*parms*/,
|
|
|
|
|
PropertyRNA *parm,
|
|
|
|
|
void *data,
|
|
|
|
|
int length)
|
|
|
|
|
@@ -6514,9 +6531,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr,
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (link = lb->first; link; link = link->next) {
|
|
|
|
|
clink = MEM_callocN(sizeof(CollectionPointerLink), "CCollectionPointerLink");
|
|
|
|
|
RNA_pointer_create(NULL, srna, link, &clink->ptr);
|
|
|
|
|
for (link = static_cast<Link *>(lb->first); link; link = link->next) {
|
|
|
|
|
clink = MEM_cnew<CollectionPointerLink>(__func__);
|
|
|
|
|
RNA_pointer_create(nullptr, srna, link, &clink->ptr);
|
|
|
|
|
BLI_addtail(clb, clink);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -6550,11 +6567,11 @@ int RNA_function_call_direct_va(bContext *C,
|
|
|
|
|
PropertyRNA *pret, *parm;
|
|
|
|
|
PropertyType type;
|
|
|
|
|
int i, ofs, flen, flag_parameter, len, alen, err = 0;
|
|
|
|
|
const char *tid, *fid, *pid = NULL;
|
|
|
|
|
const char *tid, *fid, *pid = nullptr;
|
|
|
|
|
char ftype;
|
|
|
|
|
void **retdata = NULL;
|
|
|
|
|
void **retdata = nullptr;
|
|
|
|
|
|
|
|
|
|
RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
|
|
|
|
|
RNA_pointer_create(nullptr, &RNA_Function, func, &funcptr);
|
|
|
|
|
|
|
|
|
|
tid = RNA_struct_identifier(ptr->type);
|
|
|
|
|
fid = RNA_function_identifier(func);
|
|
|
|
|
@@ -6569,7 +6586,7 @@ int RNA_function_call_direct_va(bContext *C,
|
|
|
|
|
flag_parameter = RNA_parameter_flag(parm);
|
|
|
|
|
|
|
|
|
|
if (parm == pret) {
|
|
|
|
|
retdata = iter.data;
|
|
|
|
|
retdata = static_cast<void **>(iter.data);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (flag_parameter & PARM_OUTPUT) {
|
|
|
|
|
@@ -6613,19 +6630,19 @@ int RNA_function_call_direct_va(bContext *C,
|
|
|
|
|
case PROP_ENUM: {
|
|
|
|
|
int arg = va_arg(args, int);
|
|
|
|
|
err = rna_function_parameter_parse(
|
|
|
|
|
&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
|
|
|
|
|
&funcptr, parm, type, ftype, len, iter.data, &arg, nullptr, tid, fid, pid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_FLOAT: {
|
|
|
|
|
double arg = va_arg(args, double);
|
|
|
|
|
err = rna_function_parameter_parse(
|
|
|
|
|
&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
|
|
|
|
|
&funcptr, parm, type, ftype, len, iter.data, &arg, nullptr, tid, fid, pid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_STRING: {
|
|
|
|
|
const char *arg = va_arg(args, char *);
|
|
|
|
|
err = rna_function_parameter_parse(
|
|
|
|
|
&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
|
|
|
|
|
&funcptr, parm, type, ftype, len, iter.data, &arg, nullptr, tid, fid, pid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_POINTER: {
|
|
|
|
|
@@ -6645,7 +6662,7 @@ int RNA_function_call_direct_va(bContext *C,
|
|
|
|
|
default: {
|
|
|
|
|
/* handle errors */
|
|
|
|
|
err = rna_function_parameter_parse(
|
|
|
|
|
&funcptr, parm, type, ftype, len, iter.data, NULL, NULL, tid, fid, pid);
|
|
|
|
|
&funcptr, parm, type, ftype, len, iter.data, nullptr, nullptr, tid, fid, pid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -6686,19 +6703,19 @@ int RNA_function_call_direct_va(bContext *C,
|
|
|
|
|
case PROP_ENUM: {
|
|
|
|
|
int *arg = va_arg(args, int *);
|
|
|
|
|
err = rna_function_parameter_parse(
|
|
|
|
|
&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
|
|
|
|
|
&funcptr, parm, type, ftype, len, arg, retdata, nullptr, tid, fid, pid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_FLOAT: {
|
|
|
|
|
float *arg = va_arg(args, float *);
|
|
|
|
|
err = rna_function_parameter_parse(
|
|
|
|
|
&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
|
|
|
|
|
&funcptr, parm, type, ftype, len, arg, retdata, nullptr, tid, fid, pid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_STRING: {
|
|
|
|
|
char **arg = va_arg(args, char **);
|
|
|
|
|
err = rna_function_parameter_parse(
|
|
|
|
|
&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
|
|
|
|
|
&funcptr, parm, type, ftype, len, arg, retdata, nullptr, tid, fid, pid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case PROP_POINTER: {
|
|
|
|
|
@@ -6718,7 +6735,7 @@ int RNA_function_call_direct_va(bContext *C,
|
|
|
|
|
default: {
|
|
|
|
|
/* handle errors */
|
|
|
|
|
err = rna_function_parameter_parse(
|
|
|
|
|
&funcptr, parm, type, ftype, len, NULL, NULL, NULL, tid, fid, pid);
|
|
|
|
|
&funcptr, parm, type, ftype, len, nullptr, nullptr, nullptr, tid, fid, pid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -6767,7 +6784,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
|
|
|
|
|
case PROP_BOOLEAN:
|
|
|
|
|
if (len) {
|
|
|
|
|
if (index == -1) {
|
|
|
|
|
bool *tmparray = MEM_callocN(sizeof(bool) * len, "reset_defaults - boolean");
|
|
|
|
|
bool *tmparray = static_cast<bool *>(MEM_callocN(sizeof(bool) * len, __func__));
|
|
|
|
|
|
|
|
|
|
RNA_property_boolean_get_default_array(ptr, prop, tmparray);
|
|
|
|
|
RNA_property_boolean_set_array(ptr, prop, tmparray);
|
|
|
|
|
@@ -6787,7 +6804,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
|
|
|
|
|
case PROP_INT:
|
|
|
|
|
if (len) {
|
|
|
|
|
if (index == -1) {
|
|
|
|
|
int *tmparray = MEM_callocN(sizeof(int) * len, "reset_defaults - int");
|
|
|
|
|
int *tmparray = static_cast<int *>(MEM_callocN(sizeof(int) * len, __func__));
|
|
|
|
|
|
|
|
|
|
RNA_property_int_get_default_array(ptr, prop, tmparray);
|
|
|
|
|
RNA_property_int_set_array(ptr, prop, tmparray);
|
|
|
|
|
@@ -6807,7 +6824,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
|
|
|
|
|
case PROP_FLOAT:
|
|
|
|
|
if (len) {
|
|
|
|
|
if (index == -1) {
|
|
|
|
|
float *tmparray = MEM_callocN(sizeof(float) * len, "reset_defaults - float");
|
|
|
|
|
float *tmparray = static_cast<float *>(MEM_callocN(sizeof(float) * len, __func__));
|
|
|
|
|
|
|
|
|
|
RNA_property_float_get_default_array(ptr, prop, tmparray);
|
|
|
|
|
RNA_property_float_set_array(ptr, prop, tmparray);
|
|
|
|
|
@@ -6831,7 +6848,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case PROP_STRING: {
|
|
|
|
|
char *value = RNA_property_string_get_default_alloc(ptr, prop, NULL, 0, NULL);
|
|
|
|
|
char *value = RNA_property_string_get_default_alloc(ptr, prop, nullptr, 0, nullptr);
|
|
|
|
|
RNA_property_string_set(ptr, prop, value);
|
|
|
|
|
MEM_freeN(value);
|
|
|
|
|
return true;
|
|
|
|
|
@@ -6839,7 +6856,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
|
|
|
|
|
|
|
|
|
|
case PROP_POINTER: {
|
|
|
|
|
PointerRNA value = RNA_property_pointer_get_default(ptr, prop);
|
|
|
|
|
RNA_property_pointer_set(ptr, prop, value, NULL);
|
|
|
|
|
RNA_property_pointer_set(ptr, prop, value, nullptr);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -6873,6 +6890,10 @@ bool RNA_property_assign_default(PointerRNA *ptr, PropertyRNA *prop)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_PYTHON
|
|
|
|
|
extern "C" void PyC_LineSpit(void);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void _RNA_warning(const char *format, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list args;
|
|
|
|
|
@@ -6888,14 +6909,13 @@ void _RNA_warning(const char *format, ...)
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_PYTHON
|
|
|
|
|
{
|
|
|
|
|
extern void PyC_LineSpit(void);
|
|
|
|
|
PyC_LineSpit();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RNA_path_resolved_create(PointerRNA *ptr,
|
|
|
|
|
struct PropertyRNA *prop,
|
|
|
|
|
PropertyRNA *prop,
|
|
|
|
|
const int prop_index,
|
|
|
|
|
PathResolvedRNA *r_anim_rna)
|
|
|
|
|
{
|
|
|
|
|
@@ -6927,5 +6947,5 @@ const char *RNA_struct_state_owner_get(void)
|
|
|
|
|
if (rna_struct_state_owner[0]) {
|
|
|
|
|
return rna_struct_state_owner;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|