RNA: move remaining rna files to C++

Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110354
This commit is contained in:
Jacques Lucke
2023-07-21 21:08:05 +02:00
parent 5b2accd26f
commit febe38743c
20 changed files with 1374 additions and 3653 deletions

View File

@@ -11,7 +11,7 @@
* - When renaming the member of a struct which has itself been renamed
* refer to the newer name, not the original.
*
* - Changes here only change generated code for `makesdna.cc` and `makesrna.c`
* - Changes here only change generated code for `makesdna.cc` and `makesrna.cc`
* without impacting Blender's run-time, besides allowing us to use the new names.
*
* - Renaming something that has already been renamed can be done

View File

@@ -123,7 +123,7 @@ typedef enum PropertyScaleType {
#define RNA_STACK_ARRAY 32
/**
* \note Also update enums in bpy_props.c and rna_rna.c when adding items here.
* \note Also update enums in bpy_props.c and rna_rna.cc when adding items here.
* Watch it: these values are written to files as part of node socket button sub-types!
*/
typedef enum PropertySubType {

View File

@@ -12,9 +12,9 @@ if(HAVE_MALLOC_STATS_H)
add_definitions(-DHAVE_MALLOC_STATS_H)
endif()
# files rna_access.cc rna_define.c makesrna.c intentionally excluded.
# files rna_access.cc rna_define.cc makesrna.cc intentionally excluded.
set(DEFSRC
rna_ID.c
rna_ID.cc
rna_action.cc
rna_animation.cc
rna_animviz.cc
@@ -64,8 +64,8 @@ set(DEFSRC
rna_pointcloud.cc
rna_pose.cc
rna_render.cc
rna_rigidbody.c
rna_rna.c
rna_rigidbody.cc
rna_rna.cc
rna_scene.cc
rna_screen.cc
rna_sculpt_paint.cc
@@ -198,8 +198,8 @@ set(SRC_RNA_INC
)
set(SRC
makesrna.c
rna_define.c
makesrna.cc
rna_define.cc
${DEFSRC}
${APISRC}
../../../../intern/clog/clog.c
@@ -490,4 +490,3 @@ set(LIB
)
blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -74,7 +74,7 @@ static int file_older(const char *file1, const char *file2)
return (st1.st_mtime < st2.st_mtime);
}
static const char *makesrna_path = NULL;
static const char *makesrna_path = nullptr;
static const char *path_basename(const char *path)
{
@@ -150,7 +150,7 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
((void)0)
/* End `REN_IF_DIFF`. */
FILE *fp_new = NULL, *fp_org = NULL;
FILE *fp_new = nullptr, *fp_org = nullptr;
int len_new, len_org;
char *arr_new, *arr_org;
int cmp;
@@ -165,12 +165,12 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
fp_org = fopen(orgfile, "rb");
if (fp_org == NULL) {
if (fp_org == nullptr) {
REN_IF_DIFF;
}
/* NOTE(@ideasman42): trick to work around dependency problem.
* The issue is as follows: When `makesrna.c` or any of the `rna_*.c` files being newer than
* The issue is as follows: When `makesrna.cc` or any of the `rna_*.c` files being newer than
* their generated output, the build-system detects that the `rna_*_gen.c` file is out-dated and
* requests the `rna_*_gen.c` files are re-generated (even if this function always returns 0).
* It happens *every* rebuild, slowing incremental builds which isn't practical for development.
@@ -178,8 +178,8 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
* This is only an issue for `Unix Makefiles`, `Ninja` generator doesn't have this problem. */
if (1) {
/* First check if `makesrna.c` is newer than generated files.
* For development on `makesrna.c` you may want to disable this. */
/* First check if `makesrna.cc` is newer than generated files.
* For development on `makesrna.cc` you may want to disable this. */
if (file_older(orgfile, makesrna_source_filepath)) {
REN_IF_DIFF;
}
@@ -199,7 +199,7 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
(int)(makesrna_source_filename - makesrna_source_filepath),
makesrna_source_filepath,
dep_files[pass]);
/* Account for build dependencies, if `makesrna.c` (this file) is newer. */
/* Account for build dependencies, if `makesrna.cc` (this file) is newer. */
if (file_older(orgfile, from_path)) {
REN_IF_DIFF;
}
@@ -210,7 +210,7 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
fp_new = fopen(tmpfile, "rb");
if (fp_new == NULL) {
if (fp_new == nullptr) {
/* Shouldn't happen, just to be safe. */
CLOG_ERROR(&LOG, "open error: \"%s\"", tmpfile);
fclose(fp_org);
@@ -226,15 +226,15 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
if (len_new != len_org) {
fclose(fp_new);
fp_new = NULL;
fp_new = nullptr;
fclose(fp_org);
fp_org = NULL;
fp_org = nullptr;
REN_IF_DIFF;
}
/* Now compare the files: */
arr_new = MEM_mallocN(sizeof(char) * len_new, "rna_cmp_file_new");
arr_org = MEM_mallocN(sizeof(char) * len_org, "rna_cmp_file_org");
arr_new = static_cast<char *>(MEM_mallocN(sizeof(char) * len_new, "rna_cmp_file_new"));
arr_org = static_cast<char *>(MEM_mallocN(sizeof(char) * len_org, "rna_cmp_file_org"));
if (fread(arr_new, sizeof(char), len_new, fp_new) != len_new) {
CLOG_ERROR(&LOG, "unable to read file %s for comparison.", tmpfile);
@@ -244,9 +244,9 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
}
fclose(fp_new);
fp_new = NULL;
fp_new = nullptr;
fclose(fp_org);
fp_org = NULL;
fp_org = nullptr;
cmp = memcmp(arr_new, arr_org, len_new);
@@ -341,21 +341,21 @@ static void rna_sortlist(ListBase *listbase, int (*cmp)(const void *, const void
return;
}
for (size = 0, link = listbase->first; link; link = link->next) {
for (size = 0, link = static_cast<Link *>(listbase->first); link; link = link->next) {
size++;
}
array = MEM_mallocN(sizeof(void *) * size, "rna_sortlist");
for (a = 0, link = listbase->first; link; link = link->next, a++) {
array = static_cast<void **>(MEM_mallocN(sizeof(void *) * size, "rna_sortlist"));
for (a = 0, link = static_cast<Link *>(listbase->first); link; link = link->next, a++) {
array[a] = link;
}
qsort(array, size, sizeof(void *), cmp);
listbase->first = listbase->last = NULL;
listbase->first = listbase->last = nullptr;
for (a = 0; a < size; a++) {
link = array[a];
link->next = link->prev = NULL;
link = static_cast<Link *>(array[a]);
link->next = link->prev = nullptr;
rna_addtail(listbase, link);
}
@@ -367,7 +367,7 @@ static void rna_sortlist(ListBase *listbase, int (*cmp)(const void *, const void
static void rna_print_c_string(FILE *f, const char *str)
{
static const char *escape[] = {
"\''", "\"\"", "\??", "\\\\", "\aa", "\bb", "\ff", "\nn", "\rr", "\tt", "\vv", NULL};
"\''", "\"\"", "\??", "\\\\", "\aa", "\bb", "\ff", "\nn", "\rr", "\tt", "\vv", nullptr};
int i, j;
if (!str) {
@@ -408,7 +408,7 @@ static void rna_print_data_get(FILE *f, PropertyDefRNA *dp)
}
}
static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp))
static void rna_print_id_get(FILE *f, PropertyDefRNA * /*dp*/)
{
fprintf(f, " ID *id = ptr->owner_id;\n");
}
@@ -422,7 +422,7 @@ static void rna_construct_function_name(
static void rna_construct_wrapper_function_name(
char *buffer, int size, const char *structname, const char *propname, const char *type)
{
if (type == NULL || type[0] == '\0') {
if (type == nullptr || type[0] == '\0') {
snprintf(buffer, size, "%s_%s", structname, propname);
}
else {
@@ -432,7 +432,7 @@ static void rna_construct_wrapper_function_name(
void *rna_alloc_from_buffer(const char *buffer, int buffer_len)
{
AllocDefRNA *alloc = MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA");
AllocDefRNA *alloc = static_cast<AllocDefRNA *>(MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA"));
alloc->mem = MEM_mallocN(buffer_len, __func__);
memcpy(alloc->mem, buffer, buffer_len);
rna_addtail(&DefRNA.allocs, alloc);
@@ -441,7 +441,7 @@ void *rna_alloc_from_buffer(const char *buffer, int buffer_len)
void *rna_calloc(int buffer_len)
{
AllocDefRNA *alloc = MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA");
AllocDefRNA *alloc = static_cast<AllocDefRNA *>(MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA"));
alloc->mem = MEM_callocN(buffer_len, __func__);
rna_addtail(&DefRNA.allocs, alloc);
return alloc->mem;
@@ -453,46 +453,52 @@ static char *rna_alloc_function_name(const char *structname,
{
char buffer[2048];
rna_construct_function_name(buffer, sizeof(buffer), structname, propname, type);
return rna_alloc_from_buffer(buffer, strlen(buffer) + 1);
return static_cast<char *>(rna_alloc_from_buffer(buffer, strlen(buffer) + 1));
}
static StructRNA *rna_find_struct(const char *identifier)
{
StructDefRNA *ds;
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (STREQ(ds->srna->identifier, identifier)) {
return ds->srna;
}
}
return NULL;
return nullptr;
}
static const char *rna_find_type(const char *type)
{
StructDefRNA *ds;
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (ds->dnaname && STREQ(ds->dnaname, type)) {
return ds->srna->identifier;
}
}
return NULL;
return nullptr;
}
static const char *rna_find_dna_type(const char *type)
{
StructDefRNA *ds;
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (STREQ(ds->srna->identifier, type)) {
return ds->dnaname;
}
}
return NULL;
return nullptr;
}
static const char *rna_type_type_name(PropertyRNA *prop)
@@ -519,7 +525,7 @@ static const char *rna_type_type_name(PropertyRNA *prop)
return "const char *";
}
default:
return NULL;
return nullptr;
}
}
@@ -612,10 +618,10 @@ static const char *rna_enum_id_from_pointer(const EnumPropertyItem *item)
}
#include "RNA_enum_items.h"
#undef RNA_MAKESRNA
return NULL;
return nullptr;
}
static const char *rna_function_string(const void *func)
template<typename T> static const char *rna_function_string(T *func)
{
return (func) ? (const char *)func : "NULL";
}
@@ -677,15 +683,15 @@ static char *rna_def_property_get_func(
{
char *func;
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
if (!manualfunc) {
if (!dp->dnastructname || !dp->dnaname) {
CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
DefRNA.error = true;
return NULL;
return nullptr;
}
/* Type check. */
@@ -702,7 +708,7 @@ static char *rna_def_property_get_func(
dp->dnatype,
RNA_property_typename(prop->type));
DefRNA.error = true;
return NULL;
return nullptr;
}
}
}
@@ -715,7 +721,7 @@ static char *rna_def_property_get_func(
dp->dnatype,
RNA_property_typename(prop->type));
DefRNA.error = true;
return NULL;
return nullptr;
}
}
else if (ELEM(prop->type, PROP_INT, PROP_ENUM)) {
@@ -727,7 +733,7 @@ static char *rna_def_property_get_func(
dp->dnatype,
RNA_property_typename(prop->type));
DefRNA.error = true;
return NULL;
return nullptr;
}
}
}
@@ -740,7 +746,7 @@ static char *rna_def_property_get_func(
CLOG_ERROR(
&LOG, "\"%s.%s\", range for log scale < 0.", srna->identifier, prop->identifier);
DefRNA.error = true;
return NULL;
return nullptr;
}
}
if (prop->type == PROP_INT) {
@@ -751,7 +757,7 @@ static char *rna_def_property_get_func(
CLOG_ERROR(
&LOG, "\"%s.%s\", range for log scale <= 0.", srna->identifier, prop->identifier);
DefRNA.error = true;
return NULL;
return nullptr;
}
}
}
@@ -1126,19 +1132,16 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
}
}
static char *rna_def_property_search_func(FILE *f,
StructRNA *srna,
PropertyRNA *prop,
PropertyDefRNA *UNUSED(dp),
const char *manualfunc)
static char *rna_def_property_search_func(
FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA * /*dp*/, const char *manualfunc)
{
char *func;
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
if (!manualfunc) {
return NULL;
return nullptr;
}
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "search");
@@ -1164,10 +1167,10 @@ static char *rna_def_property_set_func(
char *func;
if (!(prop->flag & PROP_EDITABLE)) {
return NULL;
return nullptr;
}
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
if (!manualfunc) {
@@ -1176,7 +1179,7 @@ static char *rna_def_property_set_func(
CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
DefRNA.error = true;
}
return NULL;
return nullptr;
}
}
@@ -1259,7 +1262,7 @@ static char *rna_def_property_set_func(
}
else {
PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL;
StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : nullptr;
if (type && (type->flag & STRUCT_ID)) {
fprintf(f, " if (value.data) {\n");
fprintf(f, " id_lib_extern((ID *)value.data);\n");
@@ -1381,7 +1384,7 @@ static char *rna_def_property_set_func(
}
#ifdef USE_RNA_RANGE_CHECK
if (dp->dnaname && manualfunc == NULL) {
if (dp->dnaname && manualfunc == nullptr) {
if (dp->dnaarraylength == 1) {
rna_clamp_value_range_check(f, prop, "data->", dp->dnaname);
}
@@ -1460,7 +1463,7 @@ static char *rna_def_property_set_func(
}
#ifdef USE_RNA_RANGE_CHECK
if (dp->dnaname && manualfunc == NULL) {
if (dp->dnaname && manualfunc == nullptr) {
rna_clamp_value_range_check(f, prop, "data->", dp->dnaname);
}
#endif
@@ -1476,10 +1479,10 @@ static char *rna_def_property_set_func(
static char *rna_def_property_length_func(
FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
{
char *func = NULL;
char *func = nullptr;
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
if (prop->type == PROP_STRING) {
@@ -1487,7 +1490,7 @@ static char *rna_def_property_length_func(
if (!dp->dnastructname || !dp->dnaname) {
CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
DefRNA.error = true;
return NULL;
return nullptr;
}
}
@@ -1520,7 +1523,7 @@ static char *rna_def_property_length_func(
(!(dp->dnalengthname || dp->dnalengthfixed) || !dp->dnaname)) {
CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
DefRNA.error = true;
return NULL;
return nullptr;
}
}
@@ -1561,15 +1564,15 @@ static char *rna_def_property_begin_func(
{
char *func, *getfunc;
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
if (!manualfunc) {
if (!dp->dnastructname || !dp->dnaname) {
CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
DefRNA.error = true;
return NULL;
return nullptr;
}
}
@@ -1600,12 +1603,12 @@ static char *rna_def_property_begin_func(
dp->dnalengthname);
}
else {
fprintf(
f,
"\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n",
dp->dnaname,
dp->dnaname,
dp->dnalengthfixed);
fprintf(f,
"\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, "
"NULL);\n",
dp->dnaname,
dp->dnaname,
dp->dnalengthfixed);
}
}
}
@@ -1643,13 +1646,13 @@ static char *rna_def_property_lookup_int_func(FILE *f,
* so the index can only be checked against the length when there is no 'skip' function. */
char *func;
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
if (!manualfunc) {
if (!dp->dnastructname || !dp->dnaname) {
return NULL;
return nullptr;
}
/* only supported in case of standard next functions */
@@ -1658,7 +1661,7 @@ static char *rna_def_property_lookup_int_func(FILE *f,
else if (STREQ(nextfunc, "rna_iterator_listbase_next")) {
}
else {
return NULL;
return nullptr;
}
}
@@ -1783,13 +1786,13 @@ static char *rna_def_property_lookup_string_func(FILE *f,
PropertyRNA *item_name_prop;
const int namebuflen = 1024;
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
if (!manualfunc) {
if (!dp->dnastructname || !dp->dnaname) {
return NULL;
return nullptr;
}
/* only supported for collection items with name properties */
@@ -1802,7 +1805,7 @@ static char *rna_def_property_lookup_string_func(FILE *f,
}
}
else {
return NULL;
return nullptr;
}
}
@@ -1882,20 +1885,17 @@ static char *rna_def_property_lookup_string_func(FILE *f,
return func;
}
static char *rna_def_property_next_func(FILE *f,
StructRNA *srna,
PropertyRNA *prop,
PropertyDefRNA *UNUSED(dp),
const char *manualfunc)
static char *rna_def_property_next_func(
FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA * /*dp*/, const char *manualfunc)
{
char *func, *getfunc;
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
if (!manualfunc) {
return NULL;
return nullptr;
}
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next");
@@ -1915,16 +1915,13 @@ static char *rna_def_property_next_func(FILE *f,
return func;
}
static char *rna_def_property_end_func(FILE *f,
StructRNA *srna,
PropertyRNA *prop,
PropertyDefRNA *UNUSED(dp),
const char *manualfunc)
static char *rna_def_property_end_func(
FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA * /*dp*/, const char *manualfunc)
{
char *func;
if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) {
return NULL;
if (prop->flag & PROP_IDPROPERTY && manualfunc == nullptr) {
return nullptr;
}
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end");
@@ -1993,16 +1990,16 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
rna_set_raw_property(dp, prop);
}
bprop->get = (void *)rna_def_property_get_func(
f, srna, prop, dp, (const char *)bprop->get);
bprop->set = (void *)rna_def_property_set_func(
f, srna, prop, dp, (const char *)bprop->set);
bprop->get = reinterpret_cast<PropBooleanGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)bprop->get));
bprop->set = reinterpret_cast<PropBooleanSetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)bprop->set));
}
else {
bprop->getarray = (void *)rna_def_property_get_func(
f, srna, prop, dp, (const char *)bprop->getarray);
bprop->setarray = (void *)rna_def_property_set_func(
f, srna, prop, dp, (const char *)bprop->setarray);
bprop->getarray = reinterpret_cast<PropBooleanArrayGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)bprop->getarray));
bprop->setarray = reinterpret_cast<PropBooleanArraySetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)bprop->setarray));
}
break;
}
@@ -2014,20 +2011,20 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
rna_set_raw_property(dp, prop);
}
iprop->get = (void *)rna_def_property_get_func(
f, srna, prop, dp, (const char *)iprop->get);
iprop->set = (void *)rna_def_property_set_func(
f, srna, prop, dp, (const char *)iprop->set);
iprop->get = reinterpret_cast<PropIntGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)iprop->get));
iprop->set = reinterpret_cast<PropIntSetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)iprop->set));
}
else {
if (!iprop->getarray && !iprop->setarray) {
rna_set_raw_property(dp, prop);
}
iprop->getarray = (void *)rna_def_property_get_func(
f, srna, prop, dp, (const char *)iprop->getarray);
iprop->setarray = (void *)rna_def_property_set_func(
f, srna, prop, dp, (const char *)iprop->setarray);
iprop->getarray = reinterpret_cast<PropIntArrayGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)iprop->getarray));
iprop->setarray = reinterpret_cast<PropIntArraySetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)iprop->setarray));
}
break;
}
@@ -2039,20 +2036,20 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
rna_set_raw_property(dp, prop);
}
fprop->get = (void *)rna_def_property_get_func(
f, srna, prop, dp, (const char *)fprop->get);
fprop->set = (void *)rna_def_property_set_func(
f, srna, prop, dp, (const char *)fprop->set);
fprop->get = reinterpret_cast<PropFloatGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)fprop->get));
fprop->set = reinterpret_cast<PropFloatSetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)fprop->set));
}
else {
if (!fprop->getarray && !fprop->setarray) {
rna_set_raw_property(dp, prop);
}
fprop->getarray = (void *)rna_def_property_get_func(
f, srna, prop, dp, (const char *)fprop->getarray);
fprop->setarray = (void *)rna_def_property_set_func(
f, srna, prop, dp, (const char *)fprop->setarray);
fprop->getarray = reinterpret_cast<PropFloatArrayGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)fprop->getarray));
fprop->setarray = reinterpret_cast<PropFloatArraySetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)fprop->setarray));
}
break;
}
@@ -2063,26 +2060,32 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
rna_set_raw_property(dp, prop);
}
eprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)eprop->get);
eprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)eprop->set);
eprop->get = reinterpret_cast<PropEnumGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)eprop->get));
eprop->set = reinterpret_cast<PropEnumSetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)eprop->set));
break;
}
case PROP_STRING: {
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
sprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)sprop->get);
sprop->length = (void *)rna_def_property_length_func(
f, srna, prop, dp, (const char *)sprop->length);
sprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)sprop->set);
sprop->search = (void *)rna_def_property_search_func(
f, srna, prop, dp, (const char *)sprop->search);
sprop->get = reinterpret_cast<PropStringGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)sprop->get));
sprop->length = reinterpret_cast<PropStringLengthFunc>(
rna_def_property_length_func(f, srna, prop, dp, (const char *)sprop->length));
sprop->set = reinterpret_cast<PropStringSetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)sprop->set));
sprop->search = reinterpret_cast<StringPropertySearchFunc>(
rna_def_property_search_func(f, srna, prop, dp, (const char *)sprop->search));
break;
}
case PROP_POINTER: {
PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
pprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)pprop->get);
pprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)pprop->set);
pprop->get = reinterpret_cast<PropPointerGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)pprop->get));
pprop->set = reinterpret_cast<PropPointerSetFunc>(
rna_def_property_set_func(f, srna, prop, dp, (const char *)pprop->set));
if (!pprop->type) {
CLOG_ERROR(
&LOG, "%s.%s, pointer must have a struct type.", srna->identifier, prop->identifier);
@@ -2097,15 +2100,15 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
if (cprop->length) {
/* always generate if we have a manual implementation */
cprop->length = (void *)rna_def_property_length_func(
f, srna, prop, dp, (const char *)cprop->length);
cprop->length = reinterpret_cast<PropCollectionLengthFunc>(
rna_def_property_length_func(f, srna, prop, dp, (const char *)cprop->length));
}
else if (dp->dnatype && STREQ(dp->dnatype, "ListBase")) {
/* pass */
}
else if (dp->dnalengthname || dp->dnalengthfixed) {
cprop->length = (void *)rna_def_property_length_func(
f, srna, prop, dp, (const char *)cprop->length);
cprop->length = reinterpret_cast<PropCollectionLengthFunc>(
rna_def_property_length_func(f, srna, prop, dp, (const char *)cprop->length));
}
/* test if we can allow raw array access, if it is using our standard
@@ -2118,16 +2121,20 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
}
}
cprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)cprop->get);
cprop->begin = (void *)rna_def_property_begin_func(
f, srna, prop, dp, (const char *)cprop->begin);
cprop->next = (void *)rna_def_property_next_func(
f, srna, prop, dp, (const char *)cprop->next);
cprop->end = (void *)rna_def_property_end_func(f, srna, prop, dp, (const char *)cprop->end);
cprop->lookupint = (void *)rna_def_property_lookup_int_func(
f, srna, prop, dp, (const char *)cprop->lookupint, nextfunc);
cprop->lookupstring = (void *)rna_def_property_lookup_string_func(
f, srna, prop, dp, (const char *)cprop->lookupstring, item_type);
cprop->get = reinterpret_cast<PropCollectionGetFunc>(
rna_def_property_get_func(f, srna, prop, dp, (const char *)cprop->get));
cprop->begin = reinterpret_cast<PropCollectionBeginFunc>(
rna_def_property_begin_func(f, srna, prop, dp, (const char *)cprop->begin));
cprop->next = reinterpret_cast<PropCollectionNextFunc>(
rna_def_property_next_func(f, srna, prop, dp, (const char *)cprop->next));
cprop->end = reinterpret_cast<PropCollectionEndFunc>(
rna_def_property_end_func(f, srna, prop, dp, (const char *)cprop->end));
cprop->lookupint = reinterpret_cast<PropCollectionLookupIntFunc>(
rna_def_property_lookup_int_func(
f, srna, prop, dp, (const char *)cprop->lookupint, nextfunc));
cprop->lookupstring = reinterpret_cast<PropCollectionLookupStringFunc>(
rna_def_property_lookup_string_func(
f, srna, prop, dp, (const char *)cprop->lookupstring, item_type));
if (!(prop->flag & PROP_IDPROPERTY)) {
if (!cprop->begin) {
@@ -2325,7 +2332,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
return;
}
/* Disabled for now to avoid MSVC compiler error due to large file size. */
/* Disabled for now to avoid MSVC compiler error due to large file size. */
#if 0
if (prop->name && prop->description && prop->description[0] != '\0') {
fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description);
@@ -2500,9 +2507,9 @@ static const char *rna_parameter_type_cpp_name(PropertyRNA *prop)
}
static void rna_def_struct_function_prototype_cpp(FILE *f,
StructRNA *UNUSED(srna),
StructRNA * /*srna*/,
FunctionDefRNA *dfunc,
const char *namespace,
const char *cpp_namespace,
int close_prototype)
{
PropertyDefRNA *dp;
@@ -2516,8 +2523,8 @@ static void rna_def_struct_function_prototype_cpp(FILE *f,
retval_type = rna_parameter_type_cpp_name(dp->prop);
}
if (namespace && namespace[0]) {
fprintf(f, "\tinline %s %s::%s(", retval_type, namespace, rna_safe_id(func->identifier));
if (cpp_namespace && cpp_namespace[0]) {
fprintf(f, "\tinline %s %s::%s(", retval_type, cpp_namespace, rna_safe_id(func->identifier));
}
else {
fprintf(f, "\tinline %s %s(", retval_type, rna_safe_id(func->identifier));
@@ -2531,7 +2538,7 @@ static void rna_def_struct_function_prototype_cpp(FILE *f,
WRITE_PARAM("Context C");
}
for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first); dp; dp = dp->next) {
int type, flag, flag_parameter, pout;
const char *ptrstr;
@@ -2598,13 +2605,13 @@ static void rna_def_struct_function_prototype_cpp(FILE *f,
static void rna_def_struct_function_header_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
{
if (dfunc->call) {
/* Disabled for now to avoid MSVC compiler error due to large file size. */
/* Disabled for now to avoid MSVC compiler error due to large file size. */
#if 0
FunctionRNA *func = dfunc->func;
fprintf(f, "\n\t/* %s */\n", func->description);
#endif
rna_def_struct_function_prototype_cpp(f, srna, dfunc, NULL, 1);
rna_def_struct_function_prototype_cpp(f, srna, dfunc, nullptr, 1);
}
}
@@ -2789,7 +2796,7 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func
WRITE_PARAM("NULL");
}
dp = dfunc->cont.properties.first;
dp = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first);
for (; dp; dp = dp->next) {
if (dp->prop == func->c_ret) {
continue;
@@ -2962,7 +2969,7 @@ static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Functio
WRITE_PARAM("reports");
}
dparm = dfunc->cont.properties.first;
dparm = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first);
for (; dparm; dparm = dparm->next) {
if (dparm->prop == func->c_ret) {
continue;
@@ -2990,7 +2997,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
PropertyType type;
const char *funcname, *valstr;
const char *ptrstr;
const bool has_data = (dfunc->cont.properties.first != NULL);
const bool has_data = (dfunc->cont.properties.first != nullptr);
int flag, flag_parameter, pout, cptr, first;
srna = dsrna->srna;
@@ -3030,7 +3037,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
fprintf(f, "\tstruct StructRNA *_type;\n");
}
dparm = dfunc->cont.properties.first;
dparm = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first);
for (; dparm; dparm = dparm->next) {
type = dparm->prop->type;
flag = dparm->prop->flag;
@@ -3114,7 +3121,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
fprintf(f, "\t_data = (char *)_parms->data;\n");
}
dparm = dfunc->cont.properties.first;
dparm = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first);
for (; dparm; dparm = dparm->next) {
type = dparm->prop->type;
flag = dparm->prop->flag;
@@ -3239,7 +3246,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
fprintf(f, "reports");
}
dparm = dfunc->cont.properties.first;
dparm = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first);
for (; dparm; dparm = dparm->next) {
if (dparm->prop == func->c_ret) {
continue;
@@ -3289,7 +3296,9 @@ static void rna_auto_types(void)
StructDefRNA *ds;
PropertyDefRNA *dp;
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
/* DNA name for Screen is patched in 2.5, we do the reverse here. */
if (ds->dnaname) {
if (STREQ(ds->dnaname, "Screen")) {
@@ -3303,7 +3312,7 @@ static void rna_auto_types(void)
}
}
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(ds->cont.properties.first); dp; dp = dp->next) {
if (dp->dnastructname) {
if (STREQ(dp->dnastructname, "Screen")) {
dp->dnastructname = "bScreen";
@@ -3352,11 +3361,15 @@ static void rna_sort(BlenderRNA *brna)
rna_sortlist(&brna->structs, cmp_struct);
rna_sortlist(&DefRNA.structs, cmp_def_struct);
for (srna = brna->structs.first; srna; srna = srna->cont.next) {
for (srna = static_cast<StructRNA *>(brna->structs.first); srna;
srna = static_cast<StructRNA *>(srna->cont.next))
{
rna_sortlist(&srna->cont.properties, cmp_property);
}
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
rna_sortlist(&ds->cont.properties, cmp_def_property);
}
}
@@ -3451,7 +3464,7 @@ static const char *rna_property_subtypename(PropertySubType type)
default: {
/* in case we don't have a type preset that includes the subtype */
if (RNA_SUBTYPE_UNIT(type)) {
return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type));
return rna_property_subtypename(PropertySubType(type & ~RNA_SUBTYPE_UNIT(type)));
}
return "PROP_SUBTYPE_UNKNOWN";
}
@@ -3496,7 +3509,9 @@ static void rna_generate_struct_rna_prototypes(BlenderRNA *brna, FILE *f)
{
StructRNA *srna;
for (srna = brna->structs.first; srna; srna = srna->cont.next) {
for (srna = static_cast<StructRNA *>(brna->structs.first); srna;
srna = static_cast<StructRNA *>(srna->cont.next))
{
fprintf(f, "extern struct StructRNA RNA_%s;\n", srna->identifier);
}
fprintf(f, "\n");
@@ -3508,8 +3523,8 @@ static void rna_generate_blender(BlenderRNA *brna, FILE *f)
fprintf(f,
"BlenderRNA BLENDER_RNA = {\n"
"\t.structs = {");
srna = brna->structs.first;
"\t/*structs*/ {");
srna = static_cast<StructRNA *>(brna->structs.first);
if (srna) {
fprintf(f, "&RNA_%s, ", srna->identifier);
}
@@ -3517,7 +3532,7 @@ static void rna_generate_blender(BlenderRNA *brna, FILE *f)
fprintf(f, "NULL, ");
}
srna = brna->structs.last;
srna = static_cast<StructRNA *>(brna->structs.last);
if (srna) {
fprintf(f, "&RNA_%s},\n", srna->identifier);
}
@@ -3526,8 +3541,8 @@ static void rna_generate_blender(BlenderRNA *brna, FILE *f)
}
fprintf(f,
"\t.structs_map = NULL,\n"
"\t.structs_len = 0,\n"
"\t/*structs_map*/ NULL,\n"
"\t/*structs_len*/ 0,\n"
"};\n\n");
}
@@ -3535,15 +3550,19 @@ static void rna_generate_external_property_prototypes(BlenderRNA *brna, FILE *f)
{
rna_generate_struct_rna_prototypes(brna, f);
for (StructRNA *srna = brna->structs.first; srna; srna = srna->cont.next) {
for (PropertyRNA *prop = srna->cont.properties.first; prop; prop = prop->next) {
for (StructRNA *srna = static_cast<StructRNA *>(brna->structs.first); srna;
srna = static_cast<StructRNA *>(srna->cont.next))
{
for (PropertyRNA *prop = static_cast<PropertyRNA *>(srna->cont.properties.first); prop;
prop = prop->next)
{
fprintf(f, "extern struct PropertyRNA rna_%s_%s;\n", srna->identifier, prop->identifier);
}
fprintf(f, "\n");
}
}
static void rna_generate_internal_property_prototypes(BlenderRNA *UNUSED(brna),
static void rna_generate_internal_property_prototypes(BlenderRNA * /*brna*/,
StructRNA *srna,
FILE *f)
{
@@ -3553,7 +3572,7 @@ static void rna_generate_internal_property_prototypes(BlenderRNA *UNUSED(brna),
base = srna->base;
while (base) {
fprintf(f, "\n");
for (prop = base->cont.properties.first; prop; prop = prop->next) {
for (prop = static_cast<PropertyRNA *>(base->cont.properties.first); prop; prop = prop->next) {
fprintf(f,
"%s%s rna_%s_%s;\n",
"RNA_EXTERN_C_OR_EXTERN ",
@@ -3568,7 +3587,7 @@ static void rna_generate_internal_property_prototypes(BlenderRNA *UNUSED(brna),
fprintf(f, "\n");
}
for (prop = srna->cont.properties.first; prop; prop = prop->next) {
for (prop = static_cast<PropertyRNA *>(srna->cont.properties.first); prop; prop = prop->next) {
fprintf(f,
"RNA_EXTERN_C %s rna_%s_%s;\n",
rna_property_structname(prop->type),
@@ -3578,14 +3597,14 @@ static void rna_generate_internal_property_prototypes(BlenderRNA *UNUSED(brna),
fprintf(f, "\n");
}
static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna),
static void rna_generate_parameter_prototypes(BlenderRNA * /*brna*/,
StructRNA *srna,
FunctionRNA *func,
FILE *f)
{
PropertyRNA *parm;
for (parm = func->cont.properties.first; parm; parm = parm->next) {
for (parm = static_cast<PropertyRNA *>(func->cont.properties.first); parm; parm = parm->next) {
fprintf(f,
"%s%s rna_%s_%s_%s;\n",
"extern ",
@@ -3607,7 +3626,9 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
base = srna->base;
while (base) {
for (func = base->functions.first; func; func = func->cont.next) {
for (func = static_cast<FunctionRNA *>(base->functions.first); func;
func = static_cast<FunctionRNA *>(func->cont.next))
{
fprintf(f,
"%s%s rna_%s_%s_func;\n",
"extern ",
@@ -3624,7 +3645,9 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
base = base->base;
}
for (func = srna->functions.first; func; func = func->cont.next) {
for (func = static_cast<FunctionRNA *>(srna->functions.first); func;
func = static_cast<FunctionRNA *>(func->cont.next))
{
fprintf(
f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", srna->identifier, func->identifier);
rna_generate_parameter_prototypes(brna, srna, func, f);
@@ -3652,7 +3675,9 @@ static void rna_generate_static_parameter_prototypes(FILE *f,
func = dfunc->func;
/* return type */
for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) {
for (dparm = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first); dparm;
dparm = dparm->next)
{
if (dparm->prop == func->c_ret) {
if (dparm->prop->arraydimension) {
fprintf(f, "XXX no array return types yet"); /* XXX not supported */
@@ -3674,7 +3699,7 @@ static void rna_generate_static_parameter_prototypes(FILE *f,
}
/* function name */
if (name_override == NULL || name_override[0] == '\0') {
if (name_override == nullptr || name_override[0] == '\0') {
fprintf(f, "%s(", dfunc->call);
}
else {
@@ -3737,7 +3762,9 @@ static void rna_generate_static_parameter_prototypes(FILE *f,
}
/* defined parameters */
for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) {
for (dparm = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first); dparm;
dparm = dparm->next)
{
type = dparm->prop->type;
flag = dparm->prop->flag;
flag_parameter = dparm->prop->flag_parameter;
@@ -3805,7 +3832,7 @@ static void rna_generate_static_parameter_prototypes(FILE *f,
}
}
static void rna_generate_static_function_prototypes(BlenderRNA *UNUSED(brna),
static void rna_generate_static_function_prototypes(BlenderRNA * /*brna*/,
StructRNA *srna,
FILE *f)
{
@@ -3813,7 +3840,9 @@ static void rna_generate_static_function_prototypes(BlenderRNA *UNUSED(brna),
FunctionDefRNA *dfunc;
int first = 1;
for (func = srna->functions.first; func; func = func->cont.next) {
for (func = static_cast<FunctionRNA *>(srna->functions.first); func;
func = static_cast<FunctionRNA *>(func->cont.next))
{
dfunc = rna_find_function_def(func);
if (dfunc->call) {
@@ -3822,7 +3851,7 @@ static void rna_generate_static_function_prototypes(BlenderRNA *UNUSED(brna),
first = 0;
}
rna_generate_static_parameter_prototypes(f, srna, dfunc, NULL, 1);
rna_generate_static_parameter_prototypes(f, srna, dfunc, nullptr, 1);
}
}
@@ -3838,14 +3867,18 @@ static void rna_generate_struct_prototypes(FILE *f)
int all_structures = 0;
/* structures definitions */
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
for (dfunc = static_cast<FunctionDefRNA *>(ds->functions.first); dfunc;
dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.next))
{
if (dfunc->call) {
for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(dfunc->cont.properties.first); dp; dp = dp->next) {
if (dp->prop->type == PROP_POINTER) {
int a, found = 0;
const char *struct_name = rna_parameter_type_name(dp->prop);
if (struct_name == NULL) {
if (struct_name == nullptr) {
printf("No struct found for property '%s'\n", dp->prop->identifier);
exit(1);
}
@@ -3881,11 +3914,13 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
char *strnest = (char *)"", *errnest = (char *)"";
bool freenest = 0;
if (nest != NULL) {
if (nest != nullptr) {
int len = strlen(nest);
strnest = MEM_mallocN(sizeof(char) * len + 2, "rna_generate_property -> strnest");
errnest = MEM_mallocN(sizeof(char) * len + 2, "rna_generate_property -> errnest");
strnest = static_cast<char *>(
MEM_mallocN(sizeof(char) * len + 2, "rna_generate_property -> strnest"));
errnest = static_cast<char *>(
MEM_mallocN(sizeof(char) * len + 2, "rna_generate_property -> errnest"));
strnest[0] = '_';
memcpy(strnest + 1, nest, len + 1);
@@ -3904,7 +3939,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
if (eprop->item) {
/* Inline the enum if this is not a defined in "RNA_enum_items.h". */
const char *item_global_id = rna_enum_id_from_pointer(eprop->item);
if (item_global_id == NULL) {
if (item_global_id == nullptr) {
fprintf(f,
"static const EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t",
srna->identifier,
@@ -4295,7 +4330,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_function_string(eprop->set_ex));
if (eprop->item) {
const char *item_global_id = rna_enum_id_from_pointer(eprop->item);
if (item_global_id != NULL) {
if (item_global_id != nullptr) {
fprintf(f, "%s, ", item_global_id);
}
else {
@@ -4354,7 +4389,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
}
}
static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
static void rna_generate_struct(BlenderRNA * /*brna*/, StructRNA *srna, FILE *f)
{
FunctionRNA *func;
FunctionDefRNA *dfunc;
@@ -4363,12 +4398,14 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
fprintf(f, "/* %s */\n", srna->name);
for (prop = srna->cont.properties.first; prop; prop = prop->next) {
rna_generate_property(f, srna, NULL, prop);
for (prop = static_cast<PropertyRNA *>(srna->cont.properties.first); prop; prop = prop->next) {
rna_generate_property(f, srna, nullptr, prop);
}
for (func = srna->functions.first; func; func = func->cont.next) {
for (parm = func->cont.properties.first; parm; parm = parm->next) {
for (func = static_cast<FunctionRNA *>(srna->functions.first); func;
func = static_cast<FunctionRNA *>(func->cont.next))
{
for (parm = static_cast<PropertyRNA *>(func->cont.properties.first); parm; parm = parm->next) {
rna_generate_property(f, srna, func->identifier, parm);
}
@@ -4395,7 +4432,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
fprintf(f, "\tNULL,\n");
parm = func->cont.properties.first;
parm = static_cast<PropertyRNA *>(func->cont.properties.first);
if (parm) {
fprintf(f,
"\t{(PropertyRNA *)&rna_%s_%s_%s, ",
@@ -4407,7 +4444,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
fprintf(f, "\t{NULL, ");
}
parm = func->cont.properties.last;
parm = static_cast<PropertyRNA *>(func->cont.properties.last);
if (parm) {
fprintf(f,
"(PropertyRNA *)&rna_%s_%s_%s}},\n",
@@ -4465,7 +4502,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
fprintf(f, "\tNULL,\n");
prop = srna->cont.properties.first;
prop = static_cast<PropertyRNA *>(srna->cont.properties.first);
if (prop) {
fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s, ", srna->identifier, prop->identifier);
}
@@ -4473,7 +4510,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
fprintf(f, "\t{NULL, ");
}
prop = srna->cont.properties.last;
prop = static_cast<PropertyRNA *>(srna->cont.properties.last);
if (prop) {
fprintf(f, "(PropertyRNA *)&rna_%s_%s}},\n", srna->identifier, prop->identifier);
}
@@ -4538,7 +4575,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
DefRNA.error = true;
}
func = srna->functions.first;
func = static_cast<FunctionRNA *>(srna->functions.first);
if (func) {
fprintf(f, "\t{(FunctionRNA *)&rna_%s_%s_func, ", srna->identifier, func->identifier);
}
@@ -4546,7 +4583,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
fprintf(f, "\t{NULL, ");
}
func = srna->functions.last;
func = static_cast<FunctionRNA *>(srna->functions.last);
if (func) {
fprintf(f, "(FunctionRNA *)&rna_%s_%s_func}\n", srna->identifier, func->identifier);
}
@@ -4559,89 +4596,89 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
fprintf(f, "\n");
}
typedef struct RNAProcessItem {
struct RNAProcessItem {
const char *filename;
const char *api_filename;
void (*define)(BlenderRNA *brna);
} RNAProcessItem;
};
static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_rna.c", NULL, RNA_def_rna},
{"rna_ID.c", NULL, RNA_def_ID},
{"rna_rna.cc", nullptr, RNA_def_rna},
{"rna_ID.cc", nullptr, RNA_def_ID},
{"rna_texture.cc", "rna_texture_api.cc", RNA_def_texture},
{"rna_action.cc", "rna_action_api.cc", RNA_def_action},
{"rna_animation.cc", "rna_animation_api.cc", RNA_def_animation},
{"rna_animviz.cc", NULL, RNA_def_animviz},
{"rna_animviz.cc", nullptr, RNA_def_animviz},
{"rna_armature.cc", "rna_armature_api.cc", RNA_def_armature},
{"rna_attribute.cc", NULL, RNA_def_attribute},
{"rna_asset.cc", NULL, RNA_def_asset},
{"rna_boid.cc", NULL, RNA_def_boid},
{"rna_brush.cc", NULL, RNA_def_brush},
{"rna_cachefile.cc", NULL, RNA_def_cachefile},
{"rna_attribute.cc", nullptr, RNA_def_attribute},
{"rna_asset.cc", nullptr, RNA_def_asset},
{"rna_boid.cc", nullptr, RNA_def_boid},
{"rna_brush.cc", nullptr, RNA_def_brush},
{"rna_cachefile.cc", nullptr, RNA_def_cachefile},
{"rna_camera.cc", "rna_camera_api.cc", RNA_def_camera},
{"rna_cloth.cc", NULL, RNA_def_cloth},
{"rna_collection.cc", NULL, RNA_def_collections},
{"rna_color.cc", NULL, RNA_def_color},
{"rna_constraint.cc", NULL, RNA_def_constraint},
{"rna_context.cc", NULL, RNA_def_context},
{"rna_cloth.cc", nullptr, RNA_def_cloth},
{"rna_collection.cc", nullptr, RNA_def_collections},
{"rna_color.cc", nullptr, RNA_def_color},
{"rna_constraint.cc", nullptr, RNA_def_constraint},
{"rna_context.cc", nullptr, RNA_def_context},
{"rna_curve.cc", "rna_curve_api.cc", RNA_def_curve},
{"rna_dynamicpaint.cc", NULL, RNA_def_dynamic_paint},
{"rna_dynamicpaint.cc", nullptr, RNA_def_dynamic_paint},
{"rna_fcurve.cc", "rna_fcurve_api.cc", RNA_def_fcurve},
{"rna_gpencil_legacy.cc", NULL, RNA_def_gpencil},
{"rna_grease_pencil.cc", NULL, RNA_def_grease_pencil},
{"rna_curves.cc", NULL, RNA_def_curves},
{"rna_gpencil_legacy.cc", nullptr, RNA_def_gpencil},
{"rna_grease_pencil.cc", nullptr, RNA_def_grease_pencil},
{"rna_curves.cc", nullptr, RNA_def_curves},
{"rna_image.cc", "rna_image_api.cc", RNA_def_image},
{"rna_key.cc", NULL, RNA_def_key},
{"rna_light.cc", NULL, RNA_def_light},
{"rna_key.cc", nullptr, RNA_def_key},
{"rna_light.cc", nullptr, RNA_def_light},
{"rna_lattice.cc", "rna_lattice_api.cc", RNA_def_lattice},
{"rna_layer.cc", NULL, RNA_def_view_layer},
{"rna_linestyle.cc", NULL, RNA_def_linestyle},
{"rna_layer.cc", nullptr, RNA_def_view_layer},
{"rna_linestyle.cc", nullptr, RNA_def_linestyle},
{"rna_main.cc", "rna_main_api.cc", RNA_def_main},
{"rna_fluid.cc", NULL, RNA_def_fluid},
{"rna_fluid.cc", nullptr, RNA_def_fluid},
{"rna_material.cc", "rna_material_api.cc", RNA_def_material},
{"rna_mesh.cc", "rna_mesh_api.cc", RNA_def_mesh},
{"rna_meta.cc", "rna_meta_api.cc", RNA_def_meta},
{"rna_modifier.cc", NULL, RNA_def_modifier},
{"rna_gpencil_legacy_modifier.cc", NULL, RNA_def_greasepencil_modifier},
{"rna_shader_fx.cc", NULL, RNA_def_shader_fx},
{"rna_nla.cc", NULL, RNA_def_nla},
{"rna_nodetree.cc", NULL, RNA_def_nodetree},
{"rna_node_socket.cc", NULL, RNA_def_node_socket_subtypes},
{"rna_modifier.cc", nullptr, RNA_def_modifier},
{"rna_gpencil_legacy_modifier.cc", nullptr, RNA_def_greasepencil_modifier},
{"rna_shader_fx.cc", nullptr, RNA_def_shader_fx},
{"rna_nla.cc", nullptr, RNA_def_nla},
{"rna_nodetree.cc", nullptr, RNA_def_nodetree},
{"rna_node_socket.cc", nullptr, RNA_def_node_socket_subtypes},
{"rna_object.cc", "rna_object_api.cc", RNA_def_object},
{"rna_object_force.cc", NULL, RNA_def_object_force},
{"rna_depsgraph.cc", NULL, RNA_def_depsgraph},
{"rna_packedfile.cc", NULL, RNA_def_packedfile},
{"rna_palette.cc", NULL, RNA_def_palette},
{"rna_particle.cc", NULL, RNA_def_particle},
{"rna_pointcloud.cc", NULL, RNA_def_pointcloud},
{"rna_object_force.cc", nullptr, RNA_def_object_force},
{"rna_depsgraph.cc", nullptr, RNA_def_depsgraph},
{"rna_packedfile.cc", nullptr, RNA_def_packedfile},
{"rna_palette.cc", nullptr, RNA_def_palette},
{"rna_particle.cc", nullptr, RNA_def_particle},
{"rna_pointcloud.cc", nullptr, RNA_def_pointcloud},
{"rna_pose.cc", "rna_pose_api.cc", RNA_def_pose},
{"rna_curveprofile.cc", NULL, RNA_def_profile},
{"rna_lightprobe.cc", NULL, RNA_def_lightprobe},
{"rna_render.cc", NULL, RNA_def_render},
{"rna_rigidbody.c", NULL, RNA_def_rigidbody},
{"rna_curveprofile.cc", nullptr, RNA_def_profile},
{"rna_lightprobe.cc", nullptr, RNA_def_lightprobe},
{"rna_render.cc", nullptr, RNA_def_render},
{"rna_rigidbody.cc", nullptr, RNA_def_rigidbody},
{"rna_scene.cc", "rna_scene_api.cc", RNA_def_scene},
{"rna_screen.cc", NULL, RNA_def_screen},
{"rna_sculpt_paint.cc", NULL, RNA_def_sculpt_paint},
{"rna_screen.cc", nullptr, RNA_def_screen},
{"rna_sculpt_paint.cc", nullptr, RNA_def_sculpt_paint},
{"rna_sequencer.cc", "rna_sequencer_api.cc", RNA_def_sequencer},
{"rna_space.cc", "rna_space_api.cc", RNA_def_space},
{"rna_speaker.cc", NULL, RNA_def_speaker},
{"rna_test.c", NULL, RNA_def_test},
{"rna_speaker.cc", nullptr, RNA_def_speaker},
{"rna_test.c", nullptr, RNA_def_test},
{"rna_text.cc", "rna_text_api.cc", RNA_def_text},
{"rna_timeline.cc", NULL, RNA_def_timeline_marker},
{"rna_timeline.cc", nullptr, RNA_def_timeline_marker},
{"rna_sound.cc", "rna_sound_api.cc", RNA_def_sound},
{"rna_ui.cc", "rna_ui_api.cc", RNA_def_ui},
{"rna_userdef.cc", NULL, RNA_def_userdef},
{"rna_userdef.cc", nullptr, RNA_def_userdef},
{"rna_vfont.cc", "rna_vfont_api.cc", RNA_def_vfont},
{"rna_volume.cc", NULL, RNA_def_volume},
{"rna_volume.cc", nullptr, RNA_def_volume},
{"rna_wm.cc", "rna_wm_api.cc", RNA_def_wm},
{"rna_wm_gizmo.cc", "rna_wm_gizmo_api.cc", RNA_def_wm_gizmo},
{"rna_workspace.cc", "rna_workspace_api.cc", RNA_def_workspace},
{"rna_world.cc", NULL, RNA_def_world},
{"rna_movieclip.cc", NULL, RNA_def_movieclip},
{"rna_tracking.cc", NULL, RNA_def_tracking},
{"rna_mask.cc", NULL, RNA_def_mask},
{"rna_xr.cc", NULL, RNA_def_xr},
{NULL, NULL},
{"rna_world.cc", nullptr, RNA_def_world},
{"rna_movieclip.cc", nullptr, RNA_def_movieclip},
{"rna_tracking.cc", nullptr, RNA_def_tracking},
{"rna_mask.cc", nullptr, RNA_def_mask},
{"rna_xr.cc", nullptr, RNA_def_xr},
{nullptr, nullptr},
};
static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const char *api_filename)
@@ -4698,8 +4735,8 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
fprintf(f, "# define RNA_EXTERN_C_OR_EXTERN extern\n");
fprintf(f, "#endif\n");
/* we want the included C files to have warnings enabled but for the generated code
* ignore unused-parameter warnings which are hard to prevent */
/* we want the included C files to have warnings enabled but for the generated code
* ignore unused-parameter warnings which are hard to prevent */
#if defined(__GNUC__) || defined(__clang__)
fprintf(f, "#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n\n");
#endif
@@ -4712,28 +4749,36 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
fprintf(f, "/* Auto-generated Functions. */\n\n");
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (!filename || ds->filename == filename) {
rna_generate_internal_property_prototypes(brna, ds->srna, f);
rna_generate_function_prototypes(brna, ds->srna, f);
}
}
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (!filename || ds->filename == filename) {
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(ds->cont.properties.first); dp; dp = dp->next) {
rna_def_property_funcs(f, ds->srna, dp);
}
}
}
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (!filename || ds->filename == filename) {
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(ds->cont.properties.first); dp; dp = dp->next) {
rna_def_property_wrapper_funcs(f, ds, dp);
}
for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
for (dfunc = static_cast<FunctionDefRNA *>(ds->functions.first); dfunc;
dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.next))
{
rna_def_function_wrapper_funcs(f, ds, dfunc);
rna_def_function_funcs(f, ds, dfunc);
}
@@ -4742,22 +4787,24 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
}
}
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (!filename || ds->filename == filename) {
rna_generate_struct(brna, ds->srna, f);
}
}
if (filename && STREQ(filename, "rna_ID.c")) {
if (filename && STREQ(filename, "rna_ID.cc")) {
/* this is ugly, but we cannot have c files compiled for both
* makesrna and blender with some build systems at the moment */
fprintf(f, "#include \"rna_define.c\"\n\n");
fprintf(f, "#include \"rna_define.cc\"\n\n");
rna_generate_blender(brna, f);
}
}
static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
static void rna_generate_header(BlenderRNA * /*brna*/, FILE *f)
{
StructDefRNA *ds;
PropertyDefRNA *dp;
@@ -4789,7 +4836,9 @@ static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
fprintf(f, " property##_end(&rna_macro_iter); \\\n");
fprintf(f, " }\n\n");
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
srna = ds->srna;
fprintf(f, "/**************** %s ****************/\n\n", srna->name);
@@ -4800,11 +4849,13 @@ static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
}
fprintf(f, "\n");
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(ds->cont.properties.first); dp; dp = dp->next) {
rna_def_property_funcs_header(f, ds->srna, dp);
}
for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
for (dfunc = static_cast<FunctionDefRNA *>(ds->functions.first); dfunc;
dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.next))
{
rna_def_function_funcs_header(f, ds->srna, dfunc);
}
}
@@ -5023,7 +5074,7 @@ static const char *cpp_classes =
" operator const PointerRNA&() { return ptr; }\n"
" bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n"
" operator void*() { return ptr.data; }\n"
" operator bool() const { return ptr.data != NULL; }\n"
" operator bool() const { return ptr.data != nullptr; }\n"
"\n"
" bool operator==(const Pointer &other) const { return ptr.data == other.ptr.data; }\n"
" bool operator!=(const Pointer &other) const { return ptr.data != other.ptr.data; }\n"
@@ -5054,10 +5105,11 @@ static const char *cpp_classes =
" T *data;\n"
" int length;\n"
"\n"
" DynamicArray() : data(NULL), length(0) {}\n"
" DynamicArray(int new_length) : data(NULL), length(new_length) { data = (T "
" DynamicArray() : data(nullptr), length(0) {}\n"
" DynamicArray(int new_length) : data(nullptr), length(new_length) { data = (T "
"*)malloc(sizeof(T) * new_length); }\n"
" DynamicArray(const DynamicArray<T>& other) : data(NULL), length(0) { copy_from(other); "
" DynamicArray(const DynamicArray<T>& other) : data(nullptr), length(0) { "
"copy_from(other); "
"}\n"
" const DynamicArray<T>& operator = (const DynamicArray<T>& other) { copy_from(other); "
"return *this; }\n"
@@ -5195,33 +5247,35 @@ static void rna_generate_header_class_cpp(StructDefRNA *ds, FILE *f)
"\t%s(const PointerRNA &ptr_arg) :\n\t\t%s(ptr_arg)",
srna->identifier,
(srna->base) ? srna->base->identifier : "Pointer");
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(ds->cont.properties.first); dp; dp = dp->next) {
if (rna_is_collection_prop(dp->prop)) {
fprintf(f, ",\n\t\t%s(ptr_arg)", dp->prop->identifier);
}
}
fprintf(f, "\n\t\t{}\n\n");
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(ds->cont.properties.first); dp; dp = dp->next) {
rna_def_property_funcs_header_cpp(f, ds->srna, dp);
}
fprintf(f, "\n");
for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
for (dfunc = static_cast<FunctionDefRNA *>(ds->functions.first); dfunc;
dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.next))
{
rna_def_struct_function_header_cpp(f, srna, dfunc);
}
fprintf(f, "};\n\n");
}
static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
static void rna_generate_header_cpp(BlenderRNA * /*brna*/, FILE *f)
{
StructDefRNA *ds;
PropertyDefRNA *dp;
StructRNA *srna;
FunctionDefRNA *dfunc;
const char *first_collection_func_struct = NULL;
const char *collection_func_structs[256] = {NULL};
const char *first_collection_func_struct = nullptr;
const char *collection_func_structs[256] = {nullptr};
int all_collection_func_structs = 0;
int max_collection_func_structs = sizeof(collection_func_structs) /
sizeof(collection_func_structs[0]) -
@@ -5243,20 +5297,24 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
fprintf(f, "/**************** Declarations ****************/\n\n");
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
fprintf(f, "class %s;\n", ds->srna->identifier);
}
fprintf(f, "\n");
/* first get list of all structures used as collection functions, so they'll be declared first */
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
for (dp = static_cast<PropertyDefRNA *>(ds->cont.properties.first); dp; dp = dp->next) {
if (rna_is_collection_prop(dp->prop)) {
PropertyRNA *prop = dp->prop;
if (prop->srna) {
/* store name of structure which first uses custom functions for collections */
if (first_collection_func_struct == NULL) {
if (first_collection_func_struct == nullptr) {
first_collection_func_struct = ds->srna->identifier;
}
@@ -5279,14 +5337,18 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
* - all the rest structures
* such an order prevents usage of non-declared classes
*/
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
srna = ds->srna;
if (STREQ(srna->identifier, first_collection_func_struct)) {
StructDefRNA *ds2;
StructRNA *srna2;
for (ds2 = DefRNA.structs.first; ds2; ds2 = ds2->cont.next) {
for (ds2 = static_cast<StructDefRNA *>(DefRNA.structs.first); ds2;
ds2 = static_cast<StructDefRNA *>(ds2->cont.next))
{
srna2 = ds2->srna;
if (rna_is_collection_functions_struct(collection_func_structs, srna2->identifier)) {
@@ -5313,16 +5375,20 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
fprintf(f, "namespace BL {\n");
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
srna = ds->srna;
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
for (dp = static_cast<PropertyDefRNA *>(ds->cont.properties.first); dp; dp = dp->next) {
rna_def_property_funcs_impl_cpp(f, ds->srna, dp);
}
fprintf(f, "\n");
for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
for (dfunc = static_cast<FunctionDefRNA *>(ds->functions.first); dfunc;
dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.next))
{
rna_def_struct_function_impl_cpp(f, srna, dfunc);
}
@@ -5344,7 +5410,7 @@ static void make_bad_file(const char *file, int line)
}
/**
* \param extern_outfile: Directory to put public headers into. Can be NULL, in which case
* \param extern_outfile: Directory to put public headers into. Can be nullptr, in which case
* everything is put into \a outfile.
*/
static int rna_preprocess(const char *outfile, const char *public_header_outfile)
@@ -5372,7 +5438,9 @@ static int rna_preprocess(const char *outfile, const char *public_header_outfile
fprintf(stderr, "Error: DefRNA.animate left disabled in %s\n", PROCESS_ITEMS[i].filename);
}
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (!ds->filename) {
ds->filename = PROCESS_ITEMS[i].filename;
}
@@ -5409,7 +5477,7 @@ static int rna_preprocess(const char *outfile, const char *public_header_outfile
fclose(file);
status = (DefRNA.error != 0);
replace_if_different(deffile, NULL);
replace_if_different(deffile, nullptr);
}
/* create internal rna struct prototype header file */
@@ -5464,7 +5532,7 @@ static int rna_preprocess(const char *outfile, const char *public_header_outfile
/* avoid unneeded rebuilds */
deps[0] = PROCESS_ITEMS[i].filename;
deps[1] = PROCESS_ITEMS[i].api_filename;
deps[2] = NULL;
deps[2] = nullptr;
replace_if_different(deffile, deps);
}
@@ -5489,7 +5557,7 @@ static int rna_preprocess(const char *outfile, const char *public_header_outfile
}
}
replace_if_different(deffile, NULL);
replace_if_different(deffile, nullptr);
rna_sort(brna);
@@ -5513,7 +5581,7 @@ static int rna_preprocess(const char *outfile, const char *public_header_outfile
}
}
replace_if_different(deffile, NULL);
replace_if_different(deffile, nullptr);
/* free RNA */
RNA_define_free(brna);
@@ -5550,7 +5618,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Running makesrna\n");
}
makesrna_path = argv[0];
return_status = rna_preprocess(argv[1], (argc > 2) ? argv[2] : NULL);
return_status = rna_preprocess(argv[1], (argc > 2) ? argv[2] : nullptr);
}
CLG_exit();

View File

@@ -1,2431 +0,0 @@
/* SPDX-FileCopyrightText: 2023 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup RNA
*/
#include <stdio.h>
#include <stdlib.h>
#include "DNA_ID.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_vfont_types.h"
#include "BLI_utildefines.h"
#include "BKE_icons.h"
#include "BKE_lib_id.h"
#include "BKE_main_namemap.h"
#include "BKE_object.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "WM_types.h"
#include "rna_internal.h"
/* enum of ID-block types
* NOTE: need to keep this in line with the other defines for these
*/
const EnumPropertyItem rna_enum_id_type_items[] = {
{ID_AC, "ACTION", ICON_ACTION, "Action", ""},
{ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armature", ""},
{ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brush", ""},
{ID_CF, "CACHEFILE", ICON_FILE, "Cache File", ""},
{ID_CA, "CAMERA", ICON_CAMERA_DATA, "Camera", ""},
{ID_GR, "COLLECTION", ICON_OUTLINER_COLLECTION, "Collection", ""},
{ID_CU_LEGACY, "CURVE", ICON_CURVE_DATA, "Curve", ""},
{ID_CV, "CURVES", ICON_CURVES_DATA, "Curves", ""},
{ID_VF, "FONT", ICON_FONT_DATA, "Font", ""},
{ID_GD_LEGACY, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil (legacy)", ""},
{ID_GP, "GREASEPENCIL_V3", ICON_GREASEPENCIL, "Grease Pencil", ""},
{ID_IM, "IMAGE", ICON_IMAGE_DATA, "Image", ""},
{ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""},
{ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""},
{ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""},
{ID_LA, "LIGHT", ICON_LIGHT_DATA, "Light", ""},
{ID_LP, "LIGHT_PROBE", ICON_LIGHTPROBE_CUBEMAP, "Light Probe", ""},
{ID_LS, "LINESTYLE", ICON_LINE_DATA, "Line Style", ""},
{ID_MSK, "MASK", ICON_MOD_MASK, "Mask", ""},
{ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""},
{ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""},
{ID_MB, "META", ICON_META_DATA, "Metaball", ""},
{ID_MC, "MOVIECLIP", ICON_TRACKER, "Movie Clip", ""},
{ID_NT, "NODETREE", ICON_NODETREE, "Node Tree", ""},
{ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""},
{ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""},
{ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""},
{ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""},
{ID_PT, "POINTCLOUD", ICON_POINTCLOUD_DATA, "Point Cloud", ""},
{ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""},
{ID_SO, "SOUND", ICON_SOUND, "Sound", ""},
{ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""},
{ID_TXT, "TEXT", ICON_TEXT, "Text", ""},
{ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""},
{ID_VO, "VOLUME", ICON_VOLUME_DATA, "Volume", ""},
{ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""},
{ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""},
{ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_override_library_property_operation_items[] = {
{LIBOVERRIDE_OP_NOOP,
"NOOP",
0,
"No-Op",
"Does nothing, prevents adding actual overrides (NOT USED)"},
{LIBOVERRIDE_OP_REPLACE,
"REPLACE",
0,
"Replace",
"Replace value of reference by overriding one"},
{LIBOVERRIDE_OP_ADD,
"DIFF_ADD",
0,
"Differential",
"Stores and apply difference between reference and local value (NOT USED)"},
{LIBOVERRIDE_OP_SUBTRACT,
"DIFF_SUB",
0,
"Differential",
"Stores and apply difference between reference and local value (NOT USED)"},
{LIBOVERRIDE_OP_MULTIPLY,
"FACT_MULTIPLY",
0,
"Factor",
"Stores and apply multiplication factor between reference and local value (NOT USED)"},
{LIBOVERRIDE_OP_INSERT_AFTER,
"INSERT_AFTER",
0,
"Insert After",
"Insert a new item into collection after the one referenced in subitem_reference_name or "
"_index"},
{LIBOVERRIDE_OP_INSERT_BEFORE,
"INSERT_BEFORE",
0,
"Insert Before",
"Insert a new item into collection before the one referenced in subitem_reference_name or "
"_index (NOT USED)"},
{0, NULL, 0, NULL, NULL},
};
/**
* \note Uses #IDFilterEnumPropertyItem, not EnumPropertyItem, to support 64 bit items.
*/
const struct IDFilterEnumPropertyItem rna_enum_id_type_filter_items[] = {
/* Datablocks */
{FILTER_ID_AC, "filter_action", ICON_ACTION, "Actions", "Show Action data-blocks"},
{FILTER_ID_AR,
"filter_armature",
ICON_ARMATURE_DATA,
"Armatures",
"Show Armature data-blocks"},
{FILTER_ID_BR, "filter_brush", ICON_BRUSH_DATA, "Brushes", "Show Brushes data-blocks"},
{FILTER_ID_CA, "filter_camera", ICON_CAMERA_DATA, "Cameras", "Show Camera data-blocks"},
{FILTER_ID_CF, "filter_cachefile", ICON_FILE, "Cache Files", "Show Cache File data-blocks"},
{FILTER_ID_CU_LEGACY, "filter_curve", ICON_CURVE_DATA, "Curves", "Show Curve data-blocks"},
{FILTER_ID_GD_LEGACY,
"filter_grease_pencil",
ICON_GREASEPENCIL,
"Grease Pencil",
"Show Grease pencil data-blocks"},
{FILTER_ID_GR,
"filter_group",
ICON_OUTLINER_COLLECTION,
"Collections",
"Show Collection data-blocks"},
{FILTER_ID_CV,
"filter_curves",
ICON_CURVES_DATA,
"Hair Curves",
"Show/hide Curves data-blocks"},
{FILTER_ID_IM, "filter_image", ICON_IMAGE_DATA, "Images", "Show Image data-blocks"},
{FILTER_ID_LA, "filter_light", ICON_LIGHT_DATA, "Lights", "Show Light data-blocks"},
{FILTER_ID_LP,
"filter_light_probe",
ICON_OUTLINER_DATA_LIGHTPROBE,
"Light Probes",
"Show Light Probe data-blocks"},
{FILTER_ID_LS,
"filter_linestyle",
ICON_LINE_DATA,
"Freestyle Linestyles",
"Show Freestyle's Line Style data-blocks"},
{FILTER_ID_LT, "filter_lattice", ICON_LATTICE_DATA, "Lattices", "Show Lattice data-blocks"},
{FILTER_ID_MA,
"filter_material",
ICON_MATERIAL_DATA,
"Materials",
"Show Material data-blocks"},
{FILTER_ID_MB, "filter_metaball", ICON_META_DATA, "Metaballs", "Show Metaball data-blocks"},
{FILTER_ID_MC,
"filter_movie_clip",
ICON_TRACKER,
"Movie Clips",
"Show Movie Clip data-blocks"},
{FILTER_ID_ME, "filter_mesh", ICON_MESH_DATA, "Meshes", "Show Mesh data-blocks"},
{FILTER_ID_MSK, "filter_mask", ICON_MOD_MASK, "Masks", "Show Mask data-blocks"},
{FILTER_ID_NT, "filter_node_tree", ICON_NODETREE, "Node Trees", "Show Node Tree data-blocks"},
{FILTER_ID_OB, "filter_object", ICON_OBJECT_DATA, "Objects", "Show Object data-blocks"},
{FILTER_ID_PA,
"filter_particle_settings",
ICON_PARTICLE_DATA,
"Particles Settings",
"Show Particle Settings data-blocks"},
{FILTER_ID_PAL, "filter_palette", ICON_COLOR, "Palettes", "Show Palette data-blocks"},
{FILTER_ID_PC,
"filter_paint_curve",
ICON_CURVE_BEZCURVE,
"Paint Curves",
"Show Paint Curve data-blocks"},
{FILTER_ID_PT,
"filter_pointcloud",
ICON_POINTCLOUD_DATA,
"Point Clouds",
"Show/hide Point Cloud data-blocks"},
{FILTER_ID_SCE, "filter_scene", ICON_SCENE_DATA, "Scenes", "Show Scene data-blocks"},
{FILTER_ID_SPK, "filter_speaker", ICON_SPEAKER, "Speakers", "Show Speaker data-blocks"},
{FILTER_ID_SO, "filter_sound", ICON_SOUND, "Sounds", "Show Sound data-blocks"},
{FILTER_ID_TE, "filter_texture", ICON_TEXTURE_DATA, "Textures", "Show Texture data-blocks"},
{FILTER_ID_TXT, "filter_text", ICON_TEXT, "Texts", "Show Text data-blocks"},
{FILTER_ID_VF, "filter_font", ICON_FONT_DATA, "Fonts", "Show Font data-blocks"},
{FILTER_ID_VO, "filter_volume", ICON_VOLUME_DATA, "Volumes", "Show/hide Volume data-blocks"},
{FILTER_ID_WO, "filter_world", ICON_WORLD_DATA, "Worlds", "Show World data-blocks"},
{FILTER_ID_WS,
"filter_work_space",
ICON_WORKSPACE,
"Workspaces",
"Show workspace data-blocks"},
{0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
# include "DNA_anim_types.h"
# include "BLI_listbase.h"
# include "BLI_math_base.h"
# include "BKE_anim_data.h"
# include "BKE_global.h" /* XXX, remove me */
# include "BKE_idprop.h"
# include "BKE_idtype.h"
# include "BKE_lib_override.h"
# include "BKE_lib_query.h"
# include "BKE_lib_remap.h"
# include "BKE_library.h"
# include "BKE_material.h"
# include "BKE_vfont.h"
# include "DEG_depsgraph.h"
# include "DEG_depsgraph_build.h"
# include "DEG_depsgraph_query.h"
# include "ED_asset.h"
# include "WM_api.h"
# ifdef WITH_PYTHON
# include "BPY_extern.h"
# endif
void rna_ID_override_library_property_operation_refname_get(PointerRNA *ptr, char *value)
{
IDOverrideLibraryPropertyOperation *opop = ptr->data;
strcpy(value, (opop->subitem_reference_name == NULL) ? "" : opop->subitem_reference_name);
}
int rna_ID_override_library_property_operation_refname_length(PointerRNA *ptr)
{
IDOverrideLibraryPropertyOperation *opop = ptr->data;
return (opop->subitem_reference_name == NULL) ? 0 : strlen(opop->subitem_reference_name);
}
void rna_ID_override_library_property_operation_locname_get(PointerRNA *ptr, char *value)
{
IDOverrideLibraryPropertyOperation *opop = ptr->data;
strcpy(value, (opop->subitem_local_name == NULL) ? "" : opop->subitem_local_name);
}
int rna_ID_override_library_property_operation_locname_length(PointerRNA *ptr)
{
IDOverrideLibraryPropertyOperation *opop = ptr->data;
return (opop->subitem_local_name == NULL) ? 0 : strlen(opop->subitem_local_name);
}
/* name functions that ignore the first two ID characters */
void rna_ID_name_get(PointerRNA *ptr, char *value)
{
ID *id = (ID *)ptr->data;
strcpy(value, id->name + 2);
}
int rna_ID_name_length(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
return strlen(id->name + 2);
}
void rna_ID_name_set(PointerRNA *ptr, const char *value)
{
ID *id = (ID *)ptr->data;
BKE_main_namemap_remove_name(G_MAIN, id, id->name + 2);
BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2);
BLI_assert(BKE_id_is_in_global_main(id));
BLI_libblock_ensure_unique_name(G_MAIN, id->name);
if (GS(id->name) == ID_OB) {
Object *ob = (Object *)id;
if (ob->type == OB_MBALL) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
}
}
static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
ID *id = (ID *)ptr->data;
if (GS(id->name) == ID_VF) {
VFont *vfont = (VFont *)id;
if (BKE_vfont_is_builtin(vfont)) {
return 0;
}
}
else if (!BKE_id_is_in_global_main(id)) {
return 0;
}
return PROP_EDITABLE;
}
void rna_ID_name_full_get(PointerRNA *ptr, char *value)
{
ID *id = (ID *)ptr->data;
BKE_id_full_name_get(value, id, 0);
}
int rna_ID_name_full_length(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
char name[MAX_ID_FULL_NAME];
BKE_id_full_name_get(name, id, 0);
return strlen(name);
}
static bool rna_ID_is_evaluated_get(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
return (DEG_get_original_id(id) != id);
}
static PointerRNA rna_ID_original_get(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
return rna_pointer_inherit_refine(ptr, &RNA_ID, DEG_get_original_id(id));
}
short RNA_type_to_ID_code(const StructRNA *type)
{
const StructRNA *base_type = RNA_struct_base_child_of(type, &RNA_ID);
if (UNLIKELY(base_type == NULL)) {
return 0;
}
if (base_type == &RNA_Action) {
return ID_AC;
}
if (base_type == &RNA_Armature) {
return ID_AR;
}
if (base_type == &RNA_Brush) {
return ID_BR;
}
if (base_type == &RNA_CacheFile) {
return ID_CF;
}
if (base_type == &RNA_Camera) {
return ID_CA;
}
if (base_type == &RNA_Curve) {
return ID_CU_LEGACY;
}
if (base_type == &RNA_GreasePencil) {
return ID_GD_LEGACY;
}
if (base_type == &RNA_Collection) {
return ID_GR;
}
if (base_type == &RNA_Image) {
return ID_IM;
}
if (base_type == &RNA_Key) {
return ID_KE;
}
if (base_type == &RNA_Light) {
return ID_LA;
}
if (base_type == &RNA_Library) {
return ID_LI;
}
if (base_type == &RNA_FreestyleLineStyle) {
return ID_LS;
}
if (base_type == &RNA_Curves) {
return ID_CV;
}
if (base_type == &RNA_Lattice) {
return ID_LT;
}
if (base_type == &RNA_Material) {
return ID_MA;
}
if (base_type == &RNA_MetaBall) {
return ID_MB;
}
if (base_type == &RNA_MovieClip) {
return ID_MC;
}
if (base_type == &RNA_Mesh) {
return ID_ME;
}
if (base_type == &RNA_Mask) {
return ID_MSK;
}
if (base_type == &RNA_NodeTree) {
return ID_NT;
}
if (base_type == &RNA_Object) {
return ID_OB;
}
if (base_type == &RNA_ParticleSettings) {
return ID_PA;
}
if (base_type == &RNA_Palette) {
return ID_PAL;
}
if (base_type == &RNA_PaintCurve) {
return ID_PC;
}
if (base_type == &RNA_PointCloud) {
return ID_PT;
}
if (base_type == &RNA_LightProbe) {
return ID_LP;
}
if (base_type == &RNA_Scene) {
return ID_SCE;
}
if (base_type == &RNA_Screen) {
return ID_SCR;
}
if (base_type == &RNA_Sound) {
return ID_SO;
}
if (base_type == &RNA_Speaker) {
return ID_SPK;
}
if (base_type == &RNA_Texture) {
return ID_TE;
}
if (base_type == &RNA_Text) {
return ID_TXT;
}
if (base_type == &RNA_VectorFont) {
return ID_VF;
}
if (base_type == &RNA_Volume) {
return ID_VO;
}
if (base_type == &RNA_WorkSpace) {
return ID_WS;
}
if (base_type == &RNA_World) {
return ID_WO;
}
if (base_type == &RNA_WindowManager) {
return ID_WM;
}
return 0;
}
StructRNA *ID_code_to_RNA_type(short idcode)
{
/* NOTE: this switch doesn't use a 'default',
* so adding new ID's causes a warning. */
switch ((ID_Type)idcode) {
case ID_AC:
return &RNA_Action;
case ID_AR:
return &RNA_Armature;
case ID_BR:
return &RNA_Brush;
case ID_CA:
return &RNA_Camera;
case ID_CF:
return &RNA_CacheFile;
case ID_CU_LEGACY:
return &RNA_Curve;
case ID_GD_LEGACY:
return &RNA_GreasePencil;
case ID_GP:
return &RNA_GreasePencilv3;
break;
case ID_GR:
return &RNA_Collection;
case ID_CV:
return &RNA_Curves;
case ID_IM:
return &RNA_Image;
case ID_KE:
return &RNA_Key;
case ID_LA:
return &RNA_Light;
case ID_LI:
return &RNA_Library;
case ID_LS:
return &RNA_FreestyleLineStyle;
case ID_LT:
return &RNA_Lattice;
case ID_MA:
return &RNA_Material;
case ID_MB:
return &RNA_MetaBall;
case ID_MC:
return &RNA_MovieClip;
case ID_ME:
return &RNA_Mesh;
case ID_MSK:
return &RNA_Mask;
case ID_NT:
return &RNA_NodeTree;
case ID_OB:
return &RNA_Object;
case ID_PA:
return &RNA_ParticleSettings;
case ID_PAL:
return &RNA_Palette;
case ID_PC:
return &RNA_PaintCurve;
case ID_PT:
return &RNA_PointCloud;
case ID_LP:
return &RNA_LightProbe;
case ID_SCE:
return &RNA_Scene;
case ID_SCR:
return &RNA_Screen;
case ID_SO:
return &RNA_Sound;
case ID_SPK:
return &RNA_Speaker;
case ID_TE:
return &RNA_Texture;
case ID_TXT:
return &RNA_Text;
case ID_VF:
return &RNA_VectorFont;
case ID_VO:
return &RNA_Volume;
case ID_WM:
return &RNA_WindowManager;
case ID_WO:
return &RNA_World;
case ID_WS:
return &RNA_WorkSpace;
/* deprecated */
case ID_IP:
break;
}
return &RNA_ID;
}
StructRNA *rna_ID_refine(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
return ID_code_to_RNA_type(GS(id->name));
}
IDProperty **rna_ID_idprops(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
return &id->properties;
}
int rna_ID_is_runtime_editable(PointerRNA *ptr, const char **r_info)
{
ID *id = (ID *)ptr->data;
/* TODO: This should be abstracted in a BKE function or define, somewhat related to #88555. */
if (id->tag & (LIB_TAG_NO_MAIN | LIB_TAG_TEMP_MAIN | LIB_TAG_LOCALIZED |
LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT | LIB_TAG_COPIED_ON_WRITE))
{
*r_info =
"Cannot edit 'runtime' status of non-blendfile data-blocks, as they are by definition "
"always runtime";
return 0;
}
return PROP_EDITABLE;
}
bool rna_ID_is_runtime_get(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
/* TODO: This should be abstracted in a BKE function or define, somewhat related to #88555. */
if (id->tag & (LIB_TAG_NO_MAIN | LIB_TAG_TEMP_MAIN | LIB_TAG_LOCALIZED |
LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT | LIB_TAG_COPIED_ON_WRITE))
{
return true;
}
return (id->tag & LIB_TAG_RUNTIME) != 0;
}
void rna_ID_fake_user_set(PointerRNA *ptr, bool value)
{
ID *id = (ID *)ptr->data;
if (value) {
id_fake_user_set(id);
}
else {
id_fake_user_clear(id);
}
}
void rna_ID_extra_user_set(PointerRNA *ptr, bool value)
{
ID *id = (ID *)ptr->data;
if (value) {
id_us_ensure_real(id);
}
else {
id_us_clear_real(id);
}
}
IDProperty **rna_PropertyGroup_idprops(PointerRNA *ptr)
{
return (IDProperty **)&ptr->data;
}
bool rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type)
{
RNA_struct_free(&BLENDER_RNA, type);
return true;
}
StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain),
ReportList *reports,
void *data,
const char *identifier,
StructValidateFunc validate,
StructCallbackFunc UNUSED(call),
StructFreeFunc UNUSED(free))
{
PointerRNA dummy_ptr;
/* create dummy pointer */
RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummy_ptr);
/* validate the python class */
if (validate(&dummy_ptr, data, NULL) != 0) {
return NULL;
}
/* NOTE: it looks like there is no length limit on the srna id since its
* just a char pointer, but take care here, also be careful that python
* owns the string pointer which it could potentially free while blender
* is running. */
if (BLI_strnlen(identifier, MAX_IDPROP_NAME) == MAX_IDPROP_NAME) {
BKE_reportf(reports,
RPT_ERROR,
"Registering id property class: '%s' is too long, maximum length is %d",
identifier,
MAX_IDPROP_NAME);
return NULL;
}
return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */
}
StructRNA *rna_PropertyGroup_refine(PointerRNA *ptr)
{
return ptr->type;
}
static ID *rna_ID_evaluated_get(ID *id, struct Depsgraph *depsgraph)
{
return DEG_get_evaluated_id(depsgraph, id);
}
static ID *rna_ID_copy(ID *id, Main *bmain)
{
ID *newid = BKE_id_copy_for_use_in_bmain(bmain, id);
if (newid != NULL) {
id_us_min(newid);
}
WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
return newid;
}
static void rna_ID_asset_mark(ID *id)
{
if (ED_asset_mark_id(id)) {
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_ADDED, NULL);
}
}
static void rna_ID_asset_generate_preview(ID *id, bContext *C)
{
ED_asset_generate_preview(C, id);
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_EDITED, NULL);
}
static void rna_ID_asset_clear(ID *id)
{
if (ED_asset_clear_id(id)) {
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_REMOVED, NULL);
}
}
static void rna_ID_asset_data_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports)
{
ID *destination = ptr->data;
/* Avoid marking as asset by assigning. This should be done with `.asset_mark()`.
* This is just for clarity of the API, and to accommodate future changes. */
if (destination->asset_data == NULL) {
BKE_report(reports,
RPT_ERROR,
"Asset data can only be assigned to assets. Use asset_mark() to mark as an asset");
return;
}
const AssetMetaData *asset_data = value.data;
if (asset_data == NULL) {
/* Avoid clearing the asset data on assets. Un-marking as asset should be done with
* `.asset_clear()`. This is just for clarity of the API, and to accommodate future changes. */
BKE_report(reports, RPT_ERROR, "Asset data cannot be None");
return;
}
const bool assigned_ok = ED_asset_copy_to_id(asset_data, destination);
if (!assigned_ok) {
BKE_reportf(
reports, RPT_ERROR, "'%s' is of a type that cannot be an asset", destination->name + 2);
return;
}
WM_main_add_notifier(NC_ASSET | NA_EDITED, NULL);
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
}
static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
{
if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
return NULL;
}
if (remap_local_usages) {
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true);
}
ID *local_id = NULL;
# ifdef WITH_PYTHON
BPy_BEGIN_ALLOW_THREADS;
# endif
local_id = BKE_lib_override_library_create_from_id(bmain, id, remap_local_usages);
# ifdef WITH_PYTHON
BPy_END_ALLOW_THREADS;
# endif
if (remap_local_usages) {
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
}
WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
return local_id;
}
static ID *rna_ID_override_hierarchy_create(ID *id,
Main *bmain,
Scene *scene,
ViewLayer *view_layer,
ID *id_instance_hint,
bool do_fully_editable)
{
if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
return NULL;
}
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
ID *id_root_override = NULL;
# ifdef WITH_PYTHON
BPy_BEGIN_ALLOW_THREADS;
# endif
BKE_lib_override_library_create(bmain,
scene,
view_layer,
NULL,
id,
id,
id_instance_hint,
&id_root_override,
do_fully_editable);
# ifdef WITH_PYTHON
BPy_END_ALLOW_THREADS;
# endif
WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
return id_root_override;
}
static void rna_ID_override_template_create(ID *id, ReportList *reports)
{
if (!U.experimental.use_override_templates) {
BKE_report(reports, RPT_ERROR, "Override template experimental feature is disabled");
return;
}
if (ID_IS_LINKED(id)) {
BKE_report(reports, RPT_ERROR, "Unable to create override template for linked data-blocks");
return;
}
if (ID_IS_OVERRIDE_LIBRARY(id)) {
BKE_report(
reports, RPT_ERROR, "Unable to create override template for overridden data-blocks");
return;
}
BKE_lib_override_library_template_create(id);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
}
static void rna_ID_override_library_operations_update(ID *id,
IDOverrideLibrary *UNUSED(override_library),
Main *bmain,
ReportList *reports)
{
if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
return;
}
if (ID_IS_LINKED(id)) {
BKE_reportf(reports, RPT_ERROR, "ID '%s' is linked, cannot edit its overrides", id->name);
return;
}
BKE_lib_override_library_operations_create(bmain, id, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
}
static void rna_ID_override_library_reset(ID *id,
IDOverrideLibrary *UNUSED(override_library),
Main *bmain,
ReportList *reports,
bool do_hierarchy,
bool set_system_override)
{
if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
return;
}
if (do_hierarchy) {
BKE_lib_override_library_id_hierarchy_reset(bmain, id, set_system_override);
}
else {
BKE_lib_override_library_id_reset(bmain, id, set_system_override);
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
}
static void rna_ID_override_library_destroy(ID *id,
IDOverrideLibrary *UNUSED(override_library),
Main *bmain,
ReportList *reports,
bool do_hierarchy)
{
if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
BKE_reportf(reports, RPT_ERROR, "ID '%s' isn't an override", id->name);
return;
}
if (do_hierarchy) {
BKE_lib_override_library_delete(bmain, id);
}
else {
BKE_libblock_remap(bmain, id, id->override_library->reference, ID_REMAP_SKIP_INDIRECT_USAGE);
BKE_id_delete(bmain, id);
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
}
static IDOverrideLibraryProperty *rna_ID_override_library_properties_add(
IDOverrideLibrary *override_library, ReportList *reports, const char rna_path[])
{
bool created;
IDOverrideLibraryProperty *result = BKE_lib_override_library_property_get(
override_library, rna_path, &created);
if (!created) {
BKE_report(reports, RPT_DEBUG, "No new override property created, property already exists");
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
return result;
}
static void rna_ID_override_library_properties_remove(IDOverrideLibrary *override_library,
ReportList *reports,
IDOverrideLibraryProperty *override_property)
{
if (BLI_findindex(&override_library->properties, override_property) == -1) {
BKE_report(reports, RPT_ERROR, "Override property cannot be removed");
return;
}
BKE_lib_override_library_property_delete(override_library, override_property);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
}
static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_operations_add(
IDOverrideLibraryProperty *override_property,
ReportList *reports,
int operation,
const char *subitem_refname,
const char *subitem_locname,
int subitem_refindex,
int subitem_locindex)
{
bool created;
bool strict;
IDOverrideLibraryPropertyOperation *result = BKE_lib_override_library_property_operation_get(
override_property,
operation,
subitem_refname,
subitem_locname,
subitem_refindex,
subitem_locindex,
false,
&strict,
&created);
if (!created) {
BKE_report(reports, RPT_DEBUG, "No new override operation created, operation already exists");
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
return result;
}
static void rna_ID_override_library_property_operations_remove(
IDOverrideLibraryProperty *override_property,
ReportList *reports,
IDOverrideLibraryPropertyOperation *override_operation)
{
if (BLI_findindex(&override_property->operations, override_operation) == -1) {
BKE_report(reports, RPT_ERROR, "Override operation cannot be removed");
return;
}
BKE_lib_override_library_property_operation_delete(override_property, override_operation);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
}
static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag)
{
/* XXX, new function for this! */
# if 0
if (ob->type == OB_FONT) {
Curve *cu = ob->data;
freedisplist(&cu->disp);
BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL);
}
# endif
if (flag == 0) {
/* pass */
}
else {
int allow_flag = 0;
/* ensure flag us correct for the type */
switch (GS(id->name)) {
case ID_OB:
/* TODO(sergey): This is kind of difficult to predict since different
* object types supports different flags. Maybe does not worth checking
* for this at all. Or maybe let dependency graph to return whether
* the tag was valid or not. */
allow_flag = ID_RECALC_ALL;
break;
/* Could add particle updates later */
# if 0
case ID_PA:
allow_flag = OB_RECALC_ALL | PSYS_RECALC;
break;
# endif
case ID_AC:
allow_flag = ID_RECALC_ANIMATION;
break;
default:
if (id_can_have_animdata(id)) {
allow_flag = ID_RECALC_ANIMATION;
}
}
if (flag & ~allow_flag) {
StructRNA *srna = ID_code_to_RNA_type(GS(id->name));
BKE_reportf(reports,
RPT_ERROR,
"%s is not compatible with %s 'refresh' options",
RNA_struct_identifier(srna),
allow_flag ? "the specified" : "any");
return;
}
}
DEG_id_tag_update_ex(bmain, id, flag);
}
static void rna_ID_user_clear(ID *id)
{
id_fake_user_clear(id);
id->us = 0; /* don't save */
}
static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id)
{
if ((GS(id->name) == GS(new_id->name)) && (id != new_id)) {
/* For now, do not allow remapping data in linked data from here... */
BKE_libblock_remap(
bmain, id, new_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE);
WM_main_add_notifier(NC_WINDOW, NULL);
}
}
static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool UNUSED(clear_proxy))
{
if (ID_IS_LINKED(self)) {
BKE_lib_id_make_local(bmain, self, 0);
}
else if (ID_IS_OVERRIDE_LIBRARY_REAL(self)) {
BKE_lib_override_library_make_local(self);
}
ID *ret_id = self->newid ? self->newid : self;
BKE_id_newptr_and_tag_clear(self);
return ret_id;
}
static AnimData *rna_ID_animation_data_create(ID *id, Main *bmain)
{
AnimData *adt = BKE_animdata_ensure_id(id);
DEG_relations_tag_update(bmain);
return adt;
}
static void rna_ID_animation_data_free(ID *id, Main *bmain)
{
BKE_animdata_free(id, true);
DEG_relations_tag_update(bmain);
}
# ifdef WITH_PYTHON
void **rna_ID_instance(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
return &id->py_instance;
}
# endif
static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
IDProperty *prop = (IDProperty *)ptr->data;
rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, NULL);
}
static int rna_IDPArray_length(PointerRNA *ptr)
{
IDProperty *prop = (IDProperty *)ptr->data;
return prop->len;
}
int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr)
{
ID *id = ptr->owner_id;
short *totcol = BKE_id_material_len_p(id);
Material *mat_id = (Material *)assign_ptr->owner_id;
if (totcol && (key >= 0 && key < *totcol)) {
BLI_assert(BKE_id_is_in_global_main(id));
BLI_assert(BKE_id_is_in_global_main(&mat_id->id));
BKE_id_material_assign(G_MAIN, id, mat_id, key + 1);
return 1;
}
else {
return 0;
}
}
static void rna_IDMaterials_append_id(ID *id, Main *bmain, Material *ma)
{
BKE_id_material_append(bmain, id, ma);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
}
static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports, int index_i)
{
Material *ma;
short *totcol = BKE_id_material_len_p(id);
const short totcol_orig = *totcol;
if (index_i < 0) {
index_i += (*totcol);
}
if ((index_i < 0) || (index_i >= (*totcol))) {
BKE_report(reports, RPT_ERROR, "Index out of range");
return NULL;
}
ma = BKE_id_material_pop(bmain, id, index_i);
if (*totcol == totcol_orig) {
BKE_report(reports, RPT_ERROR, "No material to removed");
return NULL;
}
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
return ma;
}
static void rna_IDMaterials_clear_id(ID *id, Main *bmain)
{
BKE_id_material_clear(bmain, id);
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
}
static void rna_Library_filepath_set(PointerRNA *ptr, const char *value)
{
Library *lib = (Library *)ptr->data;
BLI_assert(BKE_id_is_in_global_main(&lib->id));
BKE_library_filepath_set(G_MAIN, lib, value);
}
/* ***** ImagePreview ***** */
static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
if ((value && (prv_img->flag[size] & PRV_USER_EDITED)) ||
(!value && !(prv_img->flag[size] & PRV_USER_EDITED)))
{
return;
}
if (value) {
prv_img->flag[size] |= PRV_USER_EDITED;
}
else {
prv_img->flag[size] &= ~PRV_USER_EDITED;
}
prv_img->flag[size] |= PRV_CHANGED;
BKE_previewimg_clear_single(prv_img, size);
}
static void rna_ImagePreview_size_get(PointerRNA *ptr, int *values, enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
BKE_previewimg_ensure(prv_img, size);
values[0] = prv_img->w[size];
values[1] = prv_img->h[size];
}
static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
BKE_previewimg_clear_single(prv_img, size);
if (values[0] && values[1]) {
prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(uint), "prv_rect");
prv_img->w[size] = values[0];
prv_img->h[size] = values[1];
}
prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED);
}
static int rna_ImagePreview_pixels_get_length(const PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION],
enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
BKE_previewimg_ensure(prv_img, size);
length[0] = prv_img->w[size] * prv_img->h[size];
return length[0];
}
static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
BKE_previewimg_ensure(prv_img, size);
memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(uint));
}
static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(uint));
prv_img->flag[size] |= PRV_USER_EDITED;
}
static int rna_ImagePreview_pixels_float_get_length(const PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION],
enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
BLI_assert(sizeof(uint) == 4);
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
BKE_previewimg_ensure(prv_img, size);
length[0] = prv_img->w[size] * prv_img->h[size] * 4;
return length[0];
}
static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
uchar *data = (uchar *)prv_img->rect[size];
const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
size_t i;
BLI_assert(sizeof(uint) == 4);
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
BKE_previewimg_ensure(prv_img, size);
for (i = 0; i < len; i++) {
values[i] = data[i] * (1.0f / 255.0f);
}
}
static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr,
const float *values,
enum eIconSizes size)
{
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
uchar *data = (uchar *)prv_img->rect[size];
const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
size_t i;
BLI_assert(sizeof(uint) == 4);
if (id != NULL) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
for (i = 0; i < len; i++) {
data[i] = unit_float_to_uchar_clamp(values[i]);
}
prv_img->flag[size] |= PRV_USER_EDITED;
}
static void rna_ImagePreview_is_image_custom_set(PointerRNA *ptr, bool value)
{
rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_size_get(PointerRNA *ptr, int *values)
{
rna_ImagePreview_size_get(ptr, values, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_size_set(PointerRNA *ptr, const int *values)
{
rna_ImagePreview_size_set(ptr, values, ICON_SIZE_PREVIEW);
}
static int rna_ImagePreview_image_pixels_get_length(const PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION])
{
return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_pixels_get(PointerRNA *ptr, int *values)
{
rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_pixels_set(PointerRNA *ptr, const int *values)
{
rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_PREVIEW);
}
static int rna_ImagePreview_image_pixels_float_get_length(const PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION])
{
return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_pixels_float_get(PointerRNA *ptr, float *values)
{
rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_pixels_float_set(PointerRNA *ptr, const float *values)
{
rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_is_icon_custom_set(PointerRNA *ptr, bool value)
{
rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_size_get(PointerRNA *ptr, int *values)
{
rna_ImagePreview_size_get(ptr, values, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_size_set(PointerRNA *ptr, const int *values)
{
rna_ImagePreview_size_set(ptr, values, ICON_SIZE_ICON);
}
static int rna_ImagePreview_icon_pixels_get_length(const PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION])
{
return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_pixels_get(PointerRNA *ptr, int *values)
{
rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_pixels_set(PointerRNA *ptr, const int *values)
{
rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_ICON);
}
static int rna_ImagePreview_icon_pixels_float_get_length(const PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION])
{
return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_pixels_float_get(PointerRNA *ptr, float *values)
{
rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_pixels_float_set(PointerRNA *ptr, const float *values)
{
rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_ICON);
}
static int rna_ImagePreview_icon_id_get(PointerRNA *ptr)
{
/* Using a callback here allows us to only generate icon matching
* that preview when icon_id is requested. */
return BKE_icon_preview_ensure(ptr->owner_id, (PreviewImage *)(ptr->data));
}
static void rna_ImagePreview_icon_reload(PreviewImage *prv)
{
/* will lazy load on next use, but only in case icon is not user-modified! */
if (!(prv->flag[ICON_SIZE_ICON] & PRV_USER_EDITED) &&
!(prv->flag[ICON_SIZE_PREVIEW] & PRV_USER_EDITED))
{
BKE_previewimg_clear(prv);
}
}
static PointerRNA rna_IDPreview_get(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
PreviewImage *prv_img = BKE_previewimg_id_get(id);
return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img);
}
static IDProperty **rna_IDPropertyWrapPtr_idprops(PointerRNA *ptr)
{
if (ptr == NULL) {
return NULL;
}
return (IDProperty **)&ptr->data;
}
static void rna_Library_version_get(PointerRNA *ptr, int *value)
{
Library *lib = (Library *)ptr->data;
value[0] = lib->versionfile / 100;
value[1] = lib->versionfile % 100;
value[2] = lib->subversionfile;
}
static void rna_Library_reload(Library *lib, bContext *C, ReportList *reports)
{
# ifdef WITH_PYTHON
BPy_BEGIN_ALLOW_THREADS;
# endif
WM_lib_reload(lib, C, reports);
# ifdef WITH_PYTHON
BPy_END_ALLOW_THREADS;
# endif
}
#else
static void rna_def_ID_properties(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
/* this is struct is used for holding the virtual
* PropertyRNA's for ID properties */
srna = RNA_def_struct(brna, "PropertyGroupItem", NULL);
RNA_def_struct_sdna(srna, "IDProperty");
RNA_def_struct_ui_text(
srna, "ID Property", "Property that stores arbitrary, user defined properties");
/* IDP_STRING */
prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
/* IDP_INT */
prop = RNA_def_property(srna, "int", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
prop = RNA_def_property(srna, "int_array", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_array(prop, 1);
/* IDP_FLOAT */
prop = RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
prop = RNA_def_property(srna, "float_array", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_array(prop, 1);
/* IDP_DOUBLE */
prop = RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
prop = RNA_def_property(srna, "double_array", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_array(prop, 1);
/* IDP_BOOLEAN */
prop = RNA_def_property(srna, "bool", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
prop = RNA_def_property(srna, "bool_array", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_array(prop, 1);
/* IDP_GROUP */
prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "PropertyGroup");
prop = RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_struct_type(prop, "PropertyGroup");
prop = RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "PropertyGroup");
RNA_def_property_collection_funcs(prop,
"rna_IDPArray_begin",
"rna_iterator_array_next",
"rna_iterator_array_end",
"rna_iterator_array_get",
"rna_IDPArray_length",
NULL,
NULL,
NULL);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
/* never tested, maybe its useful to have this? */
# if 0
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
# endif
/* IDP_ID */
prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY | PROP_EDITABLE);
RNA_def_property_struct_type(prop, "ID");
/* ID property groups > level 0, since level 0 group is merged
* with native RNA properties. the builtin_properties will take
* care of the properties here */
srna = RNA_def_struct(brna, "PropertyGroup", NULL);
RNA_def_struct_sdna(srna, "IDPropertyGroup");
RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties");
RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops");
RNA_def_struct_register_funcs(
srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", NULL);
RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine");
/* important so python types can have their name used in list views
* however this isn't perfect because it overrides how python would set the name
* when we only really want this so RNA_def_struct_name_property() is set to something useful */
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
}
static void rna_def_ID_materials(BlenderRNA *brna)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
/* For mesh/meta-ball/curve materials. */
srna = RNA_def_struct(brna, "IDMaterials", NULL);
RNA_def_struct_sdna(srna, "ID");
RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
func = RNA_def_function(srna, "append", "rna_IDMaterials_append_id");
RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Add a new material to the data-block");
parm = RNA_def_pointer(func, "material", "Material", "", "Material to add");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Remove a material from the data-block");
parm = RNA_def_int(
func, "index", -1, -MAXMAT, MAXMAT, "", "Index of material to remove", 0, MAXMAT);
parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id");
RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Remove all materials from the data-block");
}
static void rna_def_image_preview(BlenderRNA *brna)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ImagePreview", NULL);
RNA_def_struct_sdna(srna, "PreviewImage");
RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon");
prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set");
RNA_def_property_ui_text(prop,
"Custom Image",
"True if this preview image has been modified by py script, "
"and is no more auto-generated by Blender");
prop = RNA_def_int_vector(
srna, "image_size", 2, NULL, 0, 0, "Image Size", "Width and height in pixels", 0, 0);
RNA_def_property_subtype(prop, PROP_PIXEL);
RNA_def_property_int_funcs(
prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL);
prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always 32-bit RGBA)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length");
RNA_def_property_int_funcs(
prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL);
prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_ui_text(
prop, "Float Image Pixels", "Image pixels components, as floats (RGBA concatenated values)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length");
RNA_def_property_float_funcs(prop,
"rna_ImagePreview_image_pixels_float_get",
"rna_ImagePreview_image_pixels_float_set",
NULL);
prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set");
RNA_def_property_ui_text(prop,
"Custom Icon",
"True if this preview icon has been modified by py script, "
"and is no more auto-generated by Blender");
prop = RNA_def_int_vector(
srna, "icon_size", 2, NULL, 0, 0, "Icon Size", "Width and height in pixels", 0, 0);
RNA_def_property_subtype(prop, PROP_PIXEL);
RNA_def_property_int_funcs(
prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL);
prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always 32-bit RGBA)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length");
RNA_def_property_int_funcs(
prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL);
prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_ui_text(
prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length");
RNA_def_property_float_funcs(prop,
"rna_ImagePreview_icon_pixels_float_get",
"rna_ImagePreview_icon_pixels_float_set",
NULL);
prop = RNA_def_int(srna,
"icon_id",
0,
INT_MIN,
INT_MAX,
"Icon ID",
"Unique integer identifying this preview as an icon (zero means invalid)",
INT_MIN,
INT_MAX);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL);
func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload");
RNA_def_function_ui_description(func, "Reload the preview from its source path");
}
static void rna_def_ID_override_library_property_operation(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem override_library_property_flag_items[] = {
{LIBOVERRIDE_OP_FLAG_MANDATORY,
"MANDATORY",
0,
"Mandatory",
"For templates, prevents the user from removing predefined operation (NOT USED)"},
{LIBOVERRIDE_OP_FLAG_LOCKED,
"LOCKED",
0,
"Locked",
"Prevents the user from modifying that override operation (NOT USED)"},
{LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE,
"IDPOINTER_MATCH_REFERENCE",
0,
"Match Reference",
"The ID pointer overridden by this operation is expected to match the reference hierarchy"},
{0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperation", NULL);
RNA_def_struct_ui_text(srna,
"ID Library Override Property Operation",
"Description of an override operation over an overridden property");
prop = RNA_def_enum(srna,
"operation",
rna_enum_override_library_property_operation_items,
LIBOVERRIDE_OP_REPLACE,
"Operation",
"What override operation is performed");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
prop = RNA_def_enum(
srna, "flag", override_library_property_flag_items, 0, "Flags", "Optional flags (NOT USED)");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
prop = RNA_def_string(srna,
"subitem_reference_name",
NULL,
INT_MAX,
"Subitem Reference Name",
"Used to handle insertions into collection");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
RNA_def_property_string_funcs(prop,
"rna_ID_override_library_property_operation_refname_get",
"rna_ID_override_library_property_operation_refname_length",
NULL);
prop = RNA_def_string(srna,
"subitem_local_name",
NULL,
INT_MAX,
"Subitem Local Name",
"Used to handle insertions into collection");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
RNA_def_property_string_funcs(prop,
"rna_ID_override_library_property_operation_locname_get",
"rna_ID_override_library_property_operation_locname_length",
NULL);
prop = RNA_def_int(srna,
"subitem_reference_index",
-1,
-1,
INT_MAX,
"Subitem Reference Index",
"Used to handle insertions into collection",
-1,
INT_MAX);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
prop = RNA_def_int(srna,
"subitem_local_index",
-1,
-1,
INT_MAX,
"Subitem Local Index",
"Used to handle insertions into collection",
-1,
INT_MAX);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
}
static void rna_def_ID_override_library_property_operations(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "IDOverrideLibraryPropertyOperations");
srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperations", NULL);
RNA_def_struct_sdna(srna, "IDOverrideLibraryProperty");
RNA_def_struct_ui_text(srna, "Override Operations", "Collection of override operations");
/* Add Property */
func = RNA_def_function(srna, "add", "rna_ID_override_library_property_operations_add");
RNA_def_function_ui_description(func, "Add a new operation");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_enum(func,
"operation",
rna_enum_override_library_property_operation_items,
LIBOVERRIDE_OP_REPLACE,
"Operation",
"What override operation is performed");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(func,
"subitem_reference_name",
NULL,
INT_MAX,
"Subitem Reference Name",
"Used to handle insertions into collection");
parm = RNA_def_string(func,
"subitem_local_name",
NULL,
INT_MAX,
"Subitem Local Name",
"Used to handle insertions into collection");
parm = RNA_def_int(func,
"subitem_reference_index",
-1,
-1,
INT_MAX,
"Subitem Reference Index",
"Used to handle insertions into collection",
-1,
INT_MAX);
parm = RNA_def_int(func,
"subitem_local_index",
-1,
-1,
INT_MAX,
"Subitem Local Index",
"Used to handle insertions into collection",
-1,
INT_MAX);
parm = RNA_def_pointer(func,
"property",
"IDOverrideLibraryPropertyOperation",
"New Operation",
"Created operation");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "remove", "rna_ID_override_library_property_operations_remove");
RNA_def_function_ui_description(func, "Remove and delete an operation");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_pointer(func,
"operation",
"IDOverrideLibraryPropertyOperation",
"Operation",
"Override operation to be deleted");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_ID_override_library_property(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "IDOverrideLibraryProperty", NULL);
RNA_def_struct_ui_text(
srna, "ID Library Override Property", "Description of an overridden property");
/* String pointer, we *should* add get/set/etc.
* But NULL rna_path would be a nasty bug anyway. */
prop = RNA_def_string(srna,
"rna_path",
NULL,
INT_MAX,
"RNA Path",
"RNA path leading to that property, from owning ID");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
prop = RNA_def_collection(srna,
"operations",
"IDOverrideLibraryPropertyOperation",
"Operations",
"List of overriding operations for a property");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
rna_def_ID_override_library_property_operations(brna, prop);
rna_def_ID_override_library_property_operation(brna);
}
static void rna_def_ID_override_library_properties(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "IDOverrideLibraryProperties");
srna = RNA_def_struct(brna, "IDOverrideLibraryProperties", NULL);
RNA_def_struct_sdna(srna, "IDOverrideLibrary");
RNA_def_struct_ui_text(srna, "Override Properties", "Collection of override properties");
/* Add Property */
func = RNA_def_function(srna, "add", "rna_ID_override_library_properties_add");
RNA_def_function_ui_description(
func, "Add a property to the override library when it doesn't exist yet");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_pointer(func,
"property",
"IDOverrideLibraryProperty",
"New Property",
"Newly created override property or existing one");
RNA_def_function_return(func, parm);
parm = RNA_def_string(
func, "rna_path", NULL, 256, "RNA Path", "RNA-Path of the property to add");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "remove", "rna_ID_override_library_properties_remove");
RNA_def_function_ui_description(func, "Remove and delete a property");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_pointer(func,
"property",
"IDOverrideLibraryProperty",
"Property",
"Override property to be deleted");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_ID_override_library(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
FunctionRNA *func;
srna = RNA_def_struct(brna, "IDOverrideLibrary", NULL);
RNA_def_struct_ui_text(
srna, "ID Library Override", "Struct gathering all data needed by overridden linked IDs");
prop = RNA_def_pointer(
srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_pointer(
srna,
"hierarchy_root",
"ID",
"Hierarchy Root ID",
"Library override ID used as root of the override hierarchy this ID is a member of");
prop = RNA_def_boolean(srna,
"is_in_hierarchy",
true,
"Is In Hierarchy",
"Whether this library override is defined as part of a library "
"hierarchy, or as a single, isolated and autonomous override");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LIBOVERRIDE_FLAG_NO_HIERARCHY);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
prop = RNA_def_boolean(srna,
"is_system_override",
false,
"Is System Override",
"Whether this library override exists only for the override hierarchy, "
"or if it is actually editable by the user");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIBOVERRIDE_FLAG_SYSTEM_DEFINED);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
prop = RNA_def_collection(srna,
"properties",
"IDOverrideLibraryProperty",
"Properties",
"List of overridden properties");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
rna_def_ID_override_library_properties(brna, prop);
/* Update function. */
func = RNA_def_function(srna, "operations_update", "rna_ID_override_library_operations_update");
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
RNA_def_function_ui_description(func,
"Update the library override operations based on the "
"differences between this override ID and its reference");
func = RNA_def_function(srna, "reset", "rna_ID_override_library_reset");
RNA_def_function_ui_description(func,
"Reset this override to match again its linked reference ID");
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
RNA_def_boolean(
func,
"do_hierarchy",
true,
"",
"Also reset all the dependencies of this override to match their reference linked IDs");
RNA_def_boolean(func,
"set_system_override",
false,
"",
"Reset all user-editable overrides as (non-editable) system overrides");
func = RNA_def_function(srna, "destroy", "rna_ID_override_library_destroy");
RNA_def_function_ui_description(
func, "Delete this override ID and remap its usages to its linked reference ID instead");
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
RNA_def_boolean(func,
"do_hierarchy",
true,
"",
"Also delete all the dependencies of this override and remap their usages to "
"their reference linked IDs");
rna_def_ID_override_library_property(brna);
}
static void rna_def_ID(BlenderRNA *brna)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *prop, *parm;
static const EnumPropertyItem update_flag_items[] = {
{ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""},
{ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""},
{ID_RECALC_ANIMATION, "TIME", 0, "Time", ""},
{0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ID", NULL);
RNA_def_struct_ui_text(
srna,
"ID",
"Base type for data-blocks, defining a unique name, linking from other libraries "
"and garbage collection");
RNA_def_struct_flag(srna, STRUCT_ID | STRUCT_ID_REFCOUNT);
RNA_def_struct_refine_func(srna, "rna_ID_refine");
RNA_def_struct_idprops_func(srna, "rna_ID_idprops");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "Unique data-block ID name");
RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
RNA_def_property_editable_func(prop, "rna_ID_name_editable");
RNA_def_property_update(prop, NC_ID | NA_RENAME, NULL);
RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE);
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "name_full", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(
prop, "Full Name", "Unique data-block ID name, including library one is any");
RNA_def_property_string_funcs(prop, "rna_ID_name_full_get", "rna_ID_name_full_length", NULL);
RNA_def_property_string_maxlength(prop, MAX_ID_FULL_NAME);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "is_evaluated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(
prop,
"Is Evaluated",
"Whether this ID is runtime-only, evaluated data-block, or actual data from .blend file");
RNA_def_property_boolean_funcs(prop, "rna_ID_is_evaluated_get", NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "original", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "ID");
RNA_def_property_ui_text(
prop,
"Original ID",
"Actual data-block from .blend file (Main database) that generated that evaluated one");
RNA_def_property_pointer_funcs(prop, "rna_ID_original_get", NULL, NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "us");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Users", "Number of times this data-block is referenced");
prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER);
RNA_def_property_ui_text(prop, "Fake User", "Save this data-block even if it has no users");
RNA_def_property_ui_icon(prop, ICON_FAKE_USER_OFF, true);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
prop = RNA_def_property(srna, "use_extra_user", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_EXTRAUSER);
RNA_def_property_ui_text(
prop,
"Extra User",
"Indicates whether an extra user is set or not (mainly for internal/debug usages)");
RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_extra_user_set");
prop = RNA_def_property(srna, "is_embedded_data", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_EMBEDDED_DATA);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop,
"Embedded Data",
"This data-block is not an independent one, but is actually a sub-data of another ID "
"(typical example: root node trees or master collections)");
prop = RNA_def_property(srna, "is_missing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_MISSING);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop,
"Missing Data",
"This data-block is a place-holder for missing linked data (i.e. it is "
"[an override of] a linked data that could not be found anymore)");
prop = RNA_def_property(srna, "is_runtime_data", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_RUNTIME);
RNA_def_property_editable_func(prop, "rna_ID_is_runtime_editable");
RNA_def_property_boolean_funcs(prop, "rna_ID_is_runtime_get", NULL);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_ui_text(prop,
"Runtime Data",
"This data-block is runtime data, i.e. it won't be saved in .blend "
"file. Note that e.g. evaluated IDs are always runtime, so this value "
"is only editable for data-blocks in Main data-base");
prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_DOIT);
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
RNA_def_property_ui_text(prop,
"Tag",
"Tools can use this to tag data for their own purposes "
"(initial state is undefined)");
prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_INDIRECT);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly");
prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "lib");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from");
prop = RNA_def_pointer(srna,
"library_weak_reference",
"LibraryWeakReference",
"Library Weak Reference",
"Weak reference to a data-block in another library .blend file (used to "
"re-use already appended data instead of appending new copies)");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
prop = RNA_def_property(srna, "asset_data", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, NULL, "rna_ID_asset_data_set", NULL, NULL);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_ui_text(prop, "Asset Data", "Additional data for an asset data-block");
prop = RNA_def_pointer(
srna, "override_library", "IDOverrideLibrary", "Library Override", "Library override data");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop,
PROPOVERRIDE_NO_COMPARISON | PROPOVERRIDE_OVERRIDABLE_LIBRARY);
prop = RNA_def_pointer(srna,
"preview",
"ImagePreview",
"Preview",
"Preview image and icon of this data-block (always None if not supported "
"for this type of data)");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL);
/* functions */
func = RNA_def_function(srna, "evaluated_get", "rna_ID_evaluated_get");
RNA_def_function_ui_description(
func, "Get corresponding evaluated ID from the given dependency graph");
parm = RNA_def_pointer(
func, "depsgraph", "Depsgraph", "", "Dependency graph to perform lookup in");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "copy", "rna_ID_copy");
RNA_def_function_ui_description(
func,
"Create a copy of this data-block (not supported for all data-blocks). "
"The result is added to the Blend-File Data (Main database), with all references to other "
"data-blocks ensured to be from within the same Blend-File Data");
RNA_def_function_flag(func, FUNC_USE_MAIN);
parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "asset_mark", "rna_ID_asset_mark");
RNA_def_function_ui_description(
func,
"Enable easier reuse of the data-block through the Asset Browser, with the help of "
"customizable metadata (like previews, descriptions and tags)");
func = RNA_def_function(srna, "asset_clear", "rna_ID_asset_clear");
RNA_def_function_ui_description(
func,
"Delete all asset metadata and turn the asset data-block back into a normal data-block");
func = RNA_def_function(srna, "asset_generate_preview", "rna_ID_asset_generate_preview");
RNA_def_function_ui_description(
func, "Generate preview image (might be scheduled in a background thread)");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
func = RNA_def_function(srna, "override_create", "rna_ID_override_create");
RNA_def_function_ui_description(func,
"Create an overridden local copy of this linked data-block (not "
"supported for all data-blocks)");
RNA_def_function_flag(func, FUNC_USE_MAIN);
parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID");
RNA_def_function_return(func, parm);
RNA_def_boolean(func,
"remap_local_usages",
false,
"",
"Whether local usages of the linked ID should be remapped to the new "
"library override of it");
func = RNA_def_function(srna, "override_hierarchy_create", "rna_ID_override_hierarchy_create");
RNA_def_function_ui_description(
func,
"Create an overridden local copy of this linked data-block, and most of its dependencies "
"when it is a Collection or and Object");
RNA_def_function_flag(func, FUNC_USE_MAIN);
parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the root ID");
RNA_def_function_return(func, parm);
parm = RNA_def_pointer(
func, "scene", "Scene", "", "In which scene the new overrides should be instantiated");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_pointer(func,
"view_layer",
"ViewLayer",
"",
"In which view layer the new overrides should be instantiated");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
RNA_def_pointer(func,
"reference",
"ID",
"",
"Another ID (usually an Object or Collection) used as a hint to decide where to "
"instantiate the new overrides");
RNA_def_boolean(func,
"do_fully_editable",
false,
"",
"Make all library overrides generated by this call fully editable by the user "
"(none will be 'system overrides')");
func = RNA_def_function(srna, "override_template_create", "rna_ID_override_template_create");
RNA_def_function_ui_description(func, "Create an override template for this ID");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
RNA_def_function_ui_description(func,
"Clear the user count of a data-block so its not saved, "
"on reload the data will be removed");
func = RNA_def_function(srna, "user_remap", "rna_ID_user_remap");
RNA_def_function_ui_description(
func, "Replace all usage in the .blend file of this ID by new given one");
RNA_def_function_flag(func, FUNC_USE_MAIN);
parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
func = RNA_def_function(srna, "make_local", "rna_ID_make_local");
RNA_def_function_ui_description(
func,
"Make this datablock local, return local one "
"(may be a copy of the original, in case it is also indirectly used)");
RNA_def_function_flag(func, FUNC_USE_MAIN);
parm = RNA_def_boolean(func, "clear_proxy", true, "", "Deprecated, has no effect");
parm = RNA_def_pointer(func, "id", "ID", "", "This ID, or the new ID if it was copied");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "user_of_id", "BKE_library_ID_use_ID");
RNA_def_function_ui_description(func,
"Count the number of times that ID uses/references given one");
parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_int(func,
"count",
0,
0,
INT_MAX,
"",
"Number of usages/references of given id by current data-block",
0,
INT_MAX);
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create");
RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(
func, "Create animation data to this ID, note that not all ID types support this");
parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free");
RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Clear animation on this ID");
func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag");
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
RNA_def_function_ui_description(func,
"Tag the ID to update its display data, "
"e.g. when calling :class:`bpy.types.Scene.update`");
RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform");
func = RNA_def_function(srna, "preview_ensure", "BKE_previewimg_id_ensure");
RNA_def_function_ui_description(func,
"Ensure that this ID has preview data (if ID type supports it)");
parm = RNA_def_pointer(
func, "preview_image", "ImagePreview", "", "The existing or created preview");
RNA_def_function_return(func, parm);
# ifdef WITH_PYTHON
RNA_def_struct_register_funcs(srna, NULL, NULL, "rna_ID_instance");
# endif
}
static void rna_def_library(BlenderRNA *brna)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Library", "ID");
RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked");
RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "filepath");
RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set");
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Library");
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_ui_text(prop, "Parent", "");
prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
RNA_def_property_ui_text(prop, "Packed File", "");
prop = RNA_def_int_vector(srna,
"version",
3,
NULL,
0,
INT_MAX,
"Version",
"Version of Blender the library .blend was saved with",
0,
INT_MAX);
RNA_def_property_int_funcs(prop, "rna_Library_version_get", NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_THICK_WRAP);
func = RNA_def_function(srna, "reload", "rna_Library_reload");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks");
}
static void rna_def_library_weak_reference(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "LibraryWeakReference", NULL);
RNA_def_struct_ui_text(
srna,
"LibraryWeakReference",
"Read-only external reference to a linked data-block and its library file");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "library_filepath");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
prop = RNA_def_property(srna, "id_name", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "library_id_name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop,
"ID name",
"Full ID name in the library .blend file (including the two leading 'id type' chars)");
}
/**
* \attention This is separate from the above. It allows for RNA functions to
* return an IDProperty *. See MovieClip.metadata for a usage example.
*/
static void rna_def_idproperty_wrap_ptr(BlenderRNA *brna)
{
StructRNA *srna;
srna = RNA_def_struct(brna, "IDPropertyWrapPtr", NULL);
RNA_def_struct_idprops_func(srna, "rna_IDPropertyWrapPtr_idprops");
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
}
void RNA_def_ID(BlenderRNA *brna)
{
StructRNA *srna;
/* built-in unknown type */
srna = RNA_def_struct(brna, "UnknownType", NULL);
RNA_def_struct_ui_text(
srna, "Unknown Type", "Stub RNA type used for pointers to unknown or internal data");
/* built-in any type */
srna = RNA_def_struct(brna, "AnyType", NULL);
RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data");
rna_def_ID(brna);
rna_def_ID_override_library(brna);
rna_def_image_preview(brna);
rna_def_ID_properties(brna);
rna_def_ID_materials(brna);
rna_def_library(brna);
rna_def_library_weak_reference(brna);
rna_def_idproperty_wrap_ptr(brna);
}
#endif

View File

@@ -71,7 +71,7 @@ const EnumPropertyItem rna_enum_id_type_items[] = {
{ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""},
{ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""},
{ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem rna_enum_override_library_property_operation_items[] = {
@@ -112,7 +112,7 @@ static const EnumPropertyItem rna_enum_override_library_property_operation_items
"Insert Before",
"Insert a new item into collection before the one referenced in subitem_reference_name or "
"_index (NOT USED)"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/**
@@ -202,7 +202,7 @@ const IDFilterEnumPropertyItem rna_enum_id_type_filter_items[] = {
ICON_WORKSPACE,
"Workspaces",
"Show workspace data-blocks"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
#ifdef RNA_RUNTIME
@@ -237,26 +237,30 @@ const IDFilterEnumPropertyItem rna_enum_id_type_filter_items[] = {
void rna_ID_override_library_property_operation_refname_get(PointerRNA *ptr, char *value)
{
IDOverrideLibraryPropertyOperation *opop = ptr->data;
strcpy(value, (opop->subitem_reference_name == NULL) ? "" : opop->subitem_reference_name);
IDOverrideLibraryPropertyOperation *opop = static_cast<IDOverrideLibraryPropertyOperation *>(
ptr->data);
strcpy(value, (opop->subitem_reference_name == nullptr) ? "" : opop->subitem_reference_name);
}
int rna_ID_override_library_property_operation_refname_length(PointerRNA *ptr)
{
IDOverrideLibraryPropertyOperation *opop = ptr->data;
return (opop->subitem_reference_name == NULL) ? 0 : strlen(opop->subitem_reference_name);
IDOverrideLibraryPropertyOperation *opop = static_cast<IDOverrideLibraryPropertyOperation *>(
ptr->data);
return (opop->subitem_reference_name == nullptr) ? 0 : strlen(opop->subitem_reference_name);
}
void rna_ID_override_library_property_operation_locname_get(PointerRNA *ptr, char *value)
{
IDOverrideLibraryPropertyOperation *opop = ptr->data;
strcpy(value, (opop->subitem_local_name == NULL) ? "" : opop->subitem_local_name);
IDOverrideLibraryPropertyOperation *opop = static_cast<IDOverrideLibraryPropertyOperation *>(
ptr->data);
strcpy(value, (opop->subitem_local_name == nullptr) ? "" : opop->subitem_local_name);
}
int rna_ID_override_library_property_operation_locname_length(PointerRNA *ptr)
{
IDOverrideLibraryPropertyOperation *opop = ptr->data;
return (opop->subitem_local_name == NULL) ? 0 : strlen(opop->subitem_local_name);
IDOverrideLibraryPropertyOperation *opop = static_cast<IDOverrideLibraryPropertyOperation *>(
ptr->data);
return (opop->subitem_local_name == nullptr) ? 0 : strlen(opop->subitem_local_name);
}
/* name functions that ignore the first two ID characters */
@@ -288,7 +292,7 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value)
}
}
static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info))
static int rna_ID_name_editable(PointerRNA *ptr, const char ** /*r_info*/)
{
ID *id = (ID *)ptr->data;
@@ -336,7 +340,7 @@ static PointerRNA rna_ID_original_get(PointerRNA *ptr)
short RNA_type_to_ID_code(const StructRNA *type)
{
const StructRNA *base_type = RNA_struct_base_child_of(type, &RNA_ID);
if (UNLIKELY(base_type == NULL)) {
if (UNLIKELY(base_type == nullptr)) {
return 0;
}
if (base_type == &RNA_Action) {
@@ -621,28 +625,28 @@ IDProperty **rna_PropertyGroup_idprops(PointerRNA *ptr)
return (IDProperty **)&ptr->data;
}
bool rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type)
bool rna_PropertyGroup_unregister(Main * /*bmain*/, StructRNA *type)
{
RNA_struct_free(&BLENDER_RNA, type);
return true;
}
StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain),
StructRNA *rna_PropertyGroup_register(Main * /*bmain*/,
ReportList *reports,
void *data,
const char *identifier,
StructValidateFunc validate,
StructCallbackFunc UNUSED(call),
StructFreeFunc UNUSED(free))
StructCallbackFunc /*call*/,
StructFreeFunc /*free*/)
{
PointerRNA dummy_ptr;
/* create dummy pointer */
RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummy_ptr);
RNA_pointer_create(nullptr, &RNA_PropertyGroup, nullptr, &dummy_ptr);
/* validate the python class */
if (validate(&dummy_ptr, data, NULL) != 0) {
return NULL;
if (validate(&dummy_ptr, data, nullptr) != 0) {
return nullptr;
}
/* NOTE: it looks like there is no length limit on the srna id since its
@@ -655,7 +659,7 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain),
"Registering id property class: '%s' is too long, maximum length is %d",
identifier,
MAX_IDPROP_NAME);
return NULL;
return nullptr;
}
return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */
@@ -675,11 +679,11 @@ static ID *rna_ID_copy(ID *id, Main *bmain)
{
ID *newid = BKE_id_copy_for_use_in_bmain(bmain, id);
if (newid != NULL) {
if (newid != nullptr) {
id_us_min(newid);
}
WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
WM_main_add_notifier(NC_ID | NA_ADDED, nullptr);
return newid;
}
@@ -687,8 +691,8 @@ static ID *rna_ID_copy(ID *id, Main *bmain)
static void rna_ID_asset_mark(ID *id)
{
if (ED_asset_mark_id(id)) {
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_ADDED, NULL);
WM_main_add_notifier(NC_ID | NA_EDITED, nullptr);
WM_main_add_notifier(NC_ASSET | NA_ADDED, nullptr);
}
}
@@ -696,33 +700,33 @@ static void rna_ID_asset_generate_preview(ID *id, bContext *C)
{
ED_asset_generate_preview(C, id);
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_EDITED, NULL);
WM_main_add_notifier(NC_ID | NA_EDITED, nullptr);
WM_main_add_notifier(NC_ASSET | NA_EDITED, nullptr);
}
static void rna_ID_asset_clear(ID *id)
{
if (ED_asset_clear_id(id)) {
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_REMOVED, NULL);
WM_main_add_notifier(NC_ID | NA_EDITED, nullptr);
WM_main_add_notifier(NC_ASSET | NA_REMOVED, nullptr);
}
}
static void rna_ID_asset_data_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
{
ID *destination = ptr->data;
ID *destination = static_cast<ID *>(ptr->data);
/* Avoid marking as asset by assigning. This should be done with `.asset_mark()`.
* This is just for clarity of the API, and to accommodate future changes. */
if (destination->asset_data == NULL) {
if (destination->asset_data == nullptr) {
BKE_report(reports,
RPT_ERROR,
"Asset data can only be assigned to assets. Use asset_mark() to mark as an asset");
return;
}
const AssetMetaData *asset_data = value.data;
if (asset_data == NULL) {
const AssetMetaData *asset_data = static_cast<const AssetMetaData *>(value.data);
if (asset_data == nullptr) {
/* Avoid clearing the asset data on assets. Un-marking as asset should be done with
* `.asset_clear()`. This is just for clarity of the API, and to accommodate future changes. */
BKE_report(reports, RPT_ERROR, "Asset data cannot be None");
@@ -736,21 +740,21 @@ static void rna_ID_asset_data_set(PointerRNA *ptr, PointerRNA value, ReportList
return;
}
WM_main_add_notifier(NC_ASSET | NA_EDITED, NULL);
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_EDITED, nullptr);
WM_main_add_notifier(NC_ID | NA_EDITED, nullptr);
}
static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
{
if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
return NULL;
return nullptr;
}
if (remap_local_usages) {
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true);
}
ID *local_id = NULL;
ID *local_id = nullptr;
# ifdef WITH_PYTHON
BPy_BEGIN_ALLOW_THREADS;
# endif
@@ -765,8 +769,8 @@ static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
}
WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_ID | NA_ADDED, nullptr);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
return local_id;
}
@@ -779,12 +783,12 @@ static ID *rna_ID_override_hierarchy_create(ID *id,
bool do_fully_editable)
{
if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
return NULL;
return nullptr;
}
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
ID *id_root_override = NULL;
ID *id_root_override = nullptr;
# ifdef WITH_PYTHON
BPy_BEGIN_ALLOW_THREADS;
@@ -793,7 +797,7 @@ static ID *rna_ID_override_hierarchy_create(ID *id,
BKE_lib_override_library_create(bmain,
scene,
view_layer,
NULL,
nullptr,
id,
id,
id_instance_hint,
@@ -804,8 +808,8 @@ static ID *rna_ID_override_hierarchy_create(ID *id,
BPy_END_ALLOW_THREADS;
# endif
WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_ID | NA_ADDED, nullptr);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
return id_root_override;
}
@@ -827,11 +831,11 @@ static void rna_ID_override_template_create(ID *id, ReportList *reports)
}
BKE_lib_override_library_template_create(id);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
}
static void rna_ID_override_library_operations_update(ID *id,
IDOverrideLibrary *UNUSED(override_library),
IDOverrideLibrary * /*override_library*/,
Main *bmain,
ReportList *reports)
{
@@ -845,13 +849,13 @@ static void rna_ID_override_library_operations_update(ID *id,
return;
}
BKE_lib_override_library_operations_create(bmain, id, NULL);
BKE_lib_override_library_operations_create(bmain, id, nullptr);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
}
static void rna_ID_override_library_reset(ID *id,
IDOverrideLibrary *UNUSED(override_library),
IDOverrideLibrary * /*override_library*/,
Main *bmain,
ReportList *reports,
bool do_hierarchy,
@@ -869,11 +873,11 @@ static void rna_ID_override_library_reset(ID *id,
BKE_lib_override_library_id_reset(bmain, id, set_system_override);
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
}
static void rna_ID_override_library_destroy(ID *id,
IDOverrideLibrary *UNUSED(override_library),
IDOverrideLibrary * /*override_library*/,
Main *bmain,
ReportList *reports,
bool do_hierarchy)
@@ -891,7 +895,7 @@ static void rna_ID_override_library_destroy(ID *id,
BKE_id_delete(bmain, id);
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
}
static IDOverrideLibraryProperty *rna_ID_override_library_properties_add(
@@ -905,7 +909,7 @@ static IDOverrideLibraryProperty *rna_ID_override_library_properties_add(
BKE_report(reports, RPT_DEBUG, "No new override property created, property already exists");
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
return result;
}
@@ -920,7 +924,7 @@ static void rna_ID_override_library_properties_remove(IDOverrideLibrary *overrid
BKE_lib_override_library_property_delete(override_library, override_property);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
}
static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_operations_add(
@@ -948,7 +952,7 @@ static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_oper
BKE_report(reports, RPT_DEBUG, "No new override operation created, operation already exists");
}
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
return result;
}
@@ -964,18 +968,18 @@ static void rna_ID_override_library_property_operations_remove(
BKE_lib_override_library_property_operation_delete(override_property, override_operation);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
}
static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag)
{
/* XXX, new function for this! */
/* XXX, new function for this! */
# if 0
if (ob->type == OB_FONT) {
Curve *cu = ob->data;
freedisplist(&cu->disp);
BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL);
}
if (ob->type == OB_FONT) {
Curve *cu = ob->data;
freedisplist(&cu->disp);
BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, nullptr);
}
# endif
if (flag == 0) {
@@ -993,11 +997,10 @@ static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag
* the tag was valid or not. */
allow_flag = ID_RECALC_ALL;
break;
/* Could add particle updates later */
/* Could add particle updates later */
# if 0
case ID_PA:
allow_flag = OB_RECALC_ALL | PSYS_RECALC;
break;
case ID_PA: allow_flag = OB_RECALC_ALL | PSYS_RECALC;
break;
# endif
case ID_AC:
allow_flag = ID_RECALC_ANIMATION;
@@ -1035,11 +1038,11 @@ static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id)
BKE_libblock_remap(
bmain, id, new_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE);
WM_main_add_notifier(NC_WINDOW, NULL);
WM_main_add_notifier(NC_WINDOW, nullptr);
}
}
static ID *rna_ID_make_local(ID *self, Main *bmain, bool UNUSED(clear_proxy))
static ID *rna_ID_make_local(ID *self, Main *bmain, bool /*clear_proxy*/)
{
if (ID_IS_LINKED(self)) {
BKE_lib_id_make_local(bmain, self, 0);
@@ -1077,7 +1080,7 @@ void **rna_ID_instance(PointerRNA *ptr)
static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
IDProperty *prop = (IDProperty *)ptr->data;
rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, NULL);
rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, nullptr);
}
static int rna_IDPArray_length(PointerRNA *ptr)
@@ -1121,14 +1124,14 @@ static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports
if ((index_i < 0) || (index_i >= (*totcol))) {
BKE_report(reports, RPT_ERROR, "Index out of range");
return NULL;
return nullptr;
}
ma = BKE_id_material_pop(bmain, id, index_i);
if (*totcol == totcol_orig) {
BKE_report(reports, RPT_ERROR, "No material to removed");
return NULL;
return nullptr;
}
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
@@ -1161,7 +1164,7 @@ static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIco
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
@@ -1188,7 +1191,7 @@ static void rna_ImagePreview_size_get(PointerRNA *ptr, int *values, enum eIconSi
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
@@ -1203,14 +1206,15 @@ static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum e
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
BKE_previewimg_clear_single(prv_img, size);
if (values[0] && values[1]) {
prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(uint), "prv_rect");
prv_img->rect[size] = static_cast<unsigned int *>(
MEM_callocN(values[0] * values[1] * sizeof(uint), "prv_rect"));
prv_img->w[size] = values[0];
prv_img->h[size] = values[1];
@@ -1226,7 +1230,7 @@ static int rna_ImagePreview_pixels_get_length(const PointerRNA *ptr,
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
@@ -1242,7 +1246,7 @@ static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIcon
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
@@ -1256,7 +1260,7 @@ static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum
ID *id = ptr->owner_id;
PreviewImage *prv_img = (PreviewImage *)ptr->data;
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
@@ -1273,7 +1277,7 @@ static int rna_ImagePreview_pixels_float_get_length(const PointerRNA *ptr,
BLI_assert(sizeof(uint) == 4);
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
@@ -1295,7 +1299,7 @@ static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, en
BLI_assert(sizeof(uint) == 4);
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
@@ -1319,7 +1323,7 @@ static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr,
BLI_assert(sizeof(uint) == 4);
if (id != NULL) {
if (id != nullptr) {
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
@@ -1449,8 +1453,8 @@ static PointerRNA rna_IDPreview_get(PointerRNA *ptr)
static IDProperty **rna_IDPropertyWrapPtr_idprops(PointerRNA *ptr)
{
if (ptr == NULL) {
return NULL;
if (ptr == nullptr) {
return nullptr;
}
return (IDProperty **)&ptr->data;
}
@@ -1485,7 +1489,7 @@ static void rna_def_ID_properties(BlenderRNA *brna)
/* this is struct is used for holding the virtual
* PropertyRNA's for ID properties */
srna = RNA_def_struct(brna, "PropertyGroupItem", NULL);
srna = RNA_def_struct(brna, "PropertyGroupItem", nullptr);
RNA_def_struct_sdna(srna, "IDProperty");
RNA_def_struct_ui_text(
srna, "ID Property", "Property that stores arbitrary, user defined properties");
@@ -1544,18 +1548,18 @@ static void rna_def_ID_properties(BlenderRNA *brna)
"rna_iterator_array_end",
"rna_iterator_array_get",
"rna_IDPArray_length",
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
/* never tested, maybe its useful to have this? */
/* never tested, maybe its useful to have this? */
# if 0
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
# endif
/* IDP_ID */
@@ -1566,12 +1570,12 @@ static void rna_def_ID_properties(BlenderRNA *brna)
/* ID property groups > level 0, since level 0 group is merged
* with native RNA properties. the builtin_properties will take
* care of the properties here */
srna = RNA_def_struct(brna, "PropertyGroup", NULL);
srna = RNA_def_struct(brna, "PropertyGroup", nullptr);
RNA_def_struct_sdna(srna, "IDPropertyGroup");
RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties");
RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops");
RNA_def_struct_register_funcs(
srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", NULL);
srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", nullptr);
RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine");
/* important so python types can have their name used in list views
@@ -1591,7 +1595,7 @@ static void rna_def_ID_materials(BlenderRNA *brna)
PropertyRNA *parm;
/* For mesh/meta-ball/curve materials. */
srna = RNA_def_struct(brna, "IDMaterials", NULL);
srna = RNA_def_struct(brna, "IDMaterials", nullptr);
RNA_def_struct_sdna(srna, "ID");
RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
@@ -1599,7 +1603,7 @@ static void rna_def_ID_materials(BlenderRNA *brna)
RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Add a new material to the data-block");
parm = RNA_def_pointer(func, "material", "Material", "", "Material to add");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
@@ -1620,75 +1624,75 @@ static void rna_def_image_preview(BlenderRNA *brna)
FunctionRNA *func;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ImagePreview", NULL);
srna = RNA_def_struct(brna, "ImagePreview", nullptr);
RNA_def_struct_sdna(srna, "PreviewImage");
RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon");
prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_ImagePreview_is_image_custom_set");
RNA_def_property_ui_text(prop,
"Custom Image",
"True if this preview image has been modified by py script, "
"and is no more auto-generated by Blender");
prop = RNA_def_int_vector(
srna, "image_size", 2, NULL, 0, 0, "Image Size", "Width and height in pixels", 0, 0);
srna, "image_size", 2, nullptr, 0, 0, "Image Size", "Width and height in pixels", 0, 0);
RNA_def_property_subtype(prop, PROP_PIXEL);
RNA_def_property_int_funcs(
prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL);
prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", nullptr);
prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_multi_array(prop, 1, nullptr);
RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always 32-bit RGBA)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length");
RNA_def_property_int_funcs(
prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL);
prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", nullptr);
prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_multi_array(prop, 1, nullptr);
RNA_def_property_ui_text(
prop, "Float Image Pixels", "Image pixels components, as floats (RGBA concatenated values)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length");
RNA_def_property_float_funcs(prop,
"rna_ImagePreview_image_pixels_float_get",
"rna_ImagePreview_image_pixels_float_set",
NULL);
nullptr);
prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_ImagePreview_is_icon_custom_set");
RNA_def_property_ui_text(prop,
"Custom Icon",
"True if this preview icon has been modified by py script, "
"and is no more auto-generated by Blender");
prop = RNA_def_int_vector(
srna, "icon_size", 2, NULL, 0, 0, "Icon Size", "Width and height in pixels", 0, 0);
srna, "icon_size", 2, nullptr, 0, 0, "Icon Size", "Width and height in pixels", 0, 0);
RNA_def_property_subtype(prop, PROP_PIXEL);
RNA_def_property_int_funcs(
prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL);
prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", nullptr);
prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_multi_array(prop, 1, nullptr);
RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always 32-bit RGBA)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length");
RNA_def_property_int_funcs(
prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL);
prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", nullptr);
prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_multi_array(prop, 1, nullptr);
RNA_def_property_ui_text(
prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length");
RNA_def_property_float_funcs(prop,
"rna_ImagePreview_icon_pixels_float_get",
"rna_ImagePreview_icon_pixels_float_set",
NULL);
nullptr);
prop = RNA_def_int(srna,
"icon_id",
@@ -1700,7 +1704,7 @@ static void rna_def_image_preview(BlenderRNA *brna)
INT_MIN,
INT_MAX);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", nullptr, nullptr);
func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload");
RNA_def_function_ui_description(func, "Reload the preview from its source path");
@@ -1722,10 +1726,15 @@ static void rna_def_ID_override_library_property_operation(BlenderRNA *brna)
0,
"Locked",
"Prevents the user from modifying that override operation (NOT USED)"},
{0, NULL, 0, NULL, NULL},
{LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE,
"IDPOINTER_MATCH_REFERENCE",
0,
"Match Reference",
"The ID pointer overridden by this operation is expected to match the reference hierarchy"},
{0, nullptr, 0, nullptr, nullptr},
};
srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperation", NULL);
srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperation", nullptr);
RNA_def_struct_ui_text(srna,
"ID Library Override Property Operation",
"Description of an override operation over an overridden property");
@@ -1744,7 +1753,7 @@ static void rna_def_ID_override_library_property_operation(BlenderRNA *brna)
prop = RNA_def_string(srna,
"subitem_reference_name",
NULL,
nullptr,
INT_MAX,
"Subitem Reference Name",
"Used to handle insertions into collection");
@@ -1752,11 +1761,11 @@ static void rna_def_ID_override_library_property_operation(BlenderRNA *brna)
RNA_def_property_string_funcs(prop,
"rna_ID_override_library_property_operation_refname_get",
"rna_ID_override_library_property_operation_refname_length",
NULL);
nullptr);
prop = RNA_def_string(srna,
"subitem_local_name",
NULL,
nullptr,
INT_MAX,
"Subitem Local Name",
"Used to handle insertions into collection");
@@ -1764,7 +1773,7 @@ static void rna_def_ID_override_library_property_operation(BlenderRNA *brna)
RNA_def_property_string_funcs(prop,
"rna_ID_override_library_property_operation_locname_get",
"rna_ID_override_library_property_operation_locname_length",
NULL);
nullptr);
prop = RNA_def_int(srna,
"subitem_reference_index",
@@ -1796,7 +1805,7 @@ static void rna_def_ID_override_library_property_operations(BlenderRNA *brna, Pr
PropertyRNA *parm;
RNA_def_property_srna(cprop, "IDOverrideLibraryPropertyOperations");
srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperations", NULL);
srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperations", nullptr);
RNA_def_struct_sdna(srna, "IDOverrideLibraryProperty");
RNA_def_struct_ui_text(srna, "Override Operations", "Collection of override operations");
@@ -1810,16 +1819,16 @@ static void rna_def_ID_override_library_property_operations(BlenderRNA *brna, Pr
LIBOVERRIDE_OP_REPLACE,
"Operation",
"What override operation is performed");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_string(func,
"subitem_reference_name",
NULL,
nullptr,
INT_MAX,
"Subitem Reference Name",
"Used to handle insertions into collection");
parm = RNA_def_string(func,
"subitem_local_name",
NULL,
nullptr,
INT_MAX,
"Subitem Local Name",
"Used to handle insertions into collection");
@@ -1856,7 +1865,7 @@ static void rna_def_ID_override_library_property_operations(BlenderRNA *brna, Pr
"IDOverrideLibraryPropertyOperation",
"Operation",
"Override operation to be deleted");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
}
static void rna_def_ID_override_library_property(BlenderRNA *brna)
@@ -1864,15 +1873,15 @@ static void rna_def_ID_override_library_property(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "IDOverrideLibraryProperty", NULL);
srna = RNA_def_struct(brna, "IDOverrideLibraryProperty", nullptr);
RNA_def_struct_ui_text(
srna, "ID Library Override Property", "Description of an overridden property");
/* String pointer, we *should* add get/set/etc.
* But NULL rna_path would be a nasty bug anyway. */
* But nullptr rna_path would be a nasty bug anyway. */
prop = RNA_def_string(srna,
"rna_path",
NULL,
nullptr,
INT_MAX,
"RNA Path",
"RNA path leading to that property, from owning ID");
@@ -1883,7 +1892,7 @@ static void rna_def_ID_override_library_property(BlenderRNA *brna)
"IDOverrideLibraryPropertyOperation",
"Operations",
"List of overriding operations for a property");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
rna_def_ID_override_library_property_operations(brna, prop);
rna_def_ID_override_library_property_operation(brna);
@@ -1896,7 +1905,7 @@ static void rna_def_ID_override_library_properties(BlenderRNA *brna, PropertyRNA
PropertyRNA *parm;
RNA_def_property_srna(cprop, "IDOverrideLibraryProperties");
srna = RNA_def_struct(brna, "IDOverrideLibraryProperties", NULL);
srna = RNA_def_struct(brna, "IDOverrideLibraryProperties", nullptr);
RNA_def_struct_sdna(srna, "IDOverrideLibrary");
RNA_def_struct_ui_text(srna, "Override Properties", "Collection of override properties");
@@ -1912,8 +1921,8 @@ static void rna_def_ID_override_library_properties(BlenderRNA *brna, PropertyRNA
"Newly created override property or existing one");
RNA_def_function_return(func, parm);
parm = RNA_def_string(
func, "rna_path", NULL, 256, "RNA Path", "RNA-Path of the property to add");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func, "rna_path", nullptr, 256, "RNA Path", "RNA-Path of the property to add");
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
func = RNA_def_function(srna, "remove", "rna_ID_override_library_properties_remove");
RNA_def_function_ui_description(func, "Remove and delete a property");
@@ -1923,7 +1932,7 @@ static void rna_def_ID_override_library_properties(BlenderRNA *brna, PropertyRNA
"IDOverrideLibraryProperty",
"Property",
"Override property to be deleted");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
}
static void rna_def_ID_override_library(BlenderRNA *brna)
@@ -1932,13 +1941,13 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
PropertyRNA *prop;
FunctionRNA *func;
srna = RNA_def_struct(brna, "IDOverrideLibrary", NULL);
srna = RNA_def_struct(brna, "IDOverrideLibrary", nullptr);
RNA_def_struct_ui_text(
srna, "ID Library Override", "Struct gathering all data needed by overridden linked IDs");
prop = RNA_def_pointer(
srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
RNA_def_pointer(
srna,
@@ -1953,8 +1962,8 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
"Is In Hierarchy",
"Whether this library override is defined as part of a library "
"hierarchy, or as a single, isolated and autonomous override");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LIBOVERRIDE_FLAG_NO_HIERARCHY);
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", LIBOVERRIDE_FLAG_NO_HIERARCHY);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
prop = RNA_def_boolean(srna,
@@ -1963,8 +1972,8 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
"Is System Override",
"Whether this library override exists only for the override hierarchy, "
"or if it is actually editable by the user");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIBOVERRIDE_FLAG_SYSTEM_DEFINED);
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIBOVERRIDE_FLAG_SYSTEM_DEFINED);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
prop = RNA_def_collection(srna,
@@ -1972,7 +1981,7 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
"IDOverrideLibraryProperty",
"Properties",
"List of overridden properties");
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
rna_def_ID_override_library_properties(brna, prop);
/* Update function. */
@@ -2022,10 +2031,10 @@ static void rna_def_ID(BlenderRNA *brna)
{ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""},
{ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""},
{ID_RECALC_ANIMATION, "TIME", 0, "Time", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
srna = RNA_def_struct(brna, "ID", NULL);
srna = RNA_def_struct(brna, "ID", nullptr);
RNA_def_struct_ui_text(
srna,
"ID",
@@ -2040,14 +2049,14 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
RNA_def_property_editable_func(prop, "rna_ID_name_editable");
RNA_def_property_update(prop, NC_ID | NA_RENAME, NULL);
RNA_def_property_update(prop, NC_ID | NA_RENAME, nullptr);
RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE);
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "name_full", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(
prop, "Full Name", "Unique data-block ID name, including library one is any");
RNA_def_property_string_funcs(prop, "rna_ID_name_full_get", "rna_ID_name_full_length", NULL);
RNA_def_property_string_funcs(prop, "rna_ID_name_full_get", "rna_ID_name_full_length", nullptr);
RNA_def_property_string_maxlength(prop, MAX_ID_FULL_NAME);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -2056,7 +2065,7 @@ static void rna_def_ID(BlenderRNA *brna)
prop,
"Is Evaluated",
"Whether this ID is runtime-only, evaluated data-block, or actual data from .blend file");
RNA_def_property_boolean_funcs(prop, "rna_ID_is_evaluated_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_ID_is_evaluated_get", nullptr);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "original", PROP_POINTER, PROP_NONE);
@@ -2065,32 +2074,32 @@ static void rna_def_ID(BlenderRNA *brna)
prop,
"Original ID",
"Actual data-block from .blend file (Main database) that generated that evaluated one");
RNA_def_property_pointer_funcs(prop, "rna_ID_original_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(prop, "rna_ID_original_get", nullptr, nullptr, nullptr);
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "us");
RNA_def_property_int_sdna(prop, nullptr, "us");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Users", "Number of times this data-block is referenced");
prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIB_FAKEUSER);
RNA_def_property_ui_text(prop, "Fake User", "Save this data-block even if it has no users");
RNA_def_property_ui_icon(prop, ICON_FAKE_USER_OFF, true);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
RNA_def_property_boolean_funcs(prop, nullptr, "rna_ID_fake_user_set");
prop = RNA_def_property(srna, "use_extra_user", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_EXTRAUSER);
RNA_def_property_boolean_sdna(prop, nullptr, "tag", LIB_TAG_EXTRAUSER);
RNA_def_property_ui_text(
prop,
"Extra User",
"Indicates whether an extra user is set or not (mainly for internal/debug usages)");
RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_extra_user_set");
RNA_def_property_boolean_funcs(prop, nullptr, "rna_ID_extra_user_set");
prop = RNA_def_property(srna, "is_embedded_data", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_EMBEDDED_DATA);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIB_EMBEDDED_DATA);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop,
@@ -2099,7 +2108,7 @@ static void rna_def_ID(BlenderRNA *brna)
"(typical example: root node trees or master collections)");
prop = RNA_def_property(srna, "is_missing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_MISSING);
RNA_def_property_boolean_sdna(prop, nullptr, "tag", LIB_TAG_MISSING);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop,
"Missing Data",
@@ -2107,9 +2116,9 @@ static void rna_def_ID(BlenderRNA *brna)
"[an override of] a linked data that could not be found anymore)");
prop = RNA_def_property(srna, "is_runtime_data", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_RUNTIME);
RNA_def_property_boolean_sdna(prop, nullptr, "tag", LIB_TAG_RUNTIME);
RNA_def_property_editable_func(prop, "rna_ID_is_runtime_editable");
RNA_def_property_boolean_funcs(prop, "rna_ID_is_runtime_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_ID_is_runtime_get", nullptr);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_ui_text(prop,
"Runtime Data",
@@ -2118,7 +2127,7 @@ static void rna_def_ID(BlenderRNA *brna)
"is only editable for data-blocks in Main data-base");
prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_DOIT);
RNA_def_property_boolean_sdna(prop, nullptr, "tag", LIB_TAG_DOIT);
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
RNA_def_property_ui_text(prop,
"Tag",
@@ -2126,12 +2135,12 @@ static void rna_def_ID(BlenderRNA *brna)
"(initial state is undefined)");
prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_INDIRECT);
RNA_def_property_boolean_sdna(prop, nullptr, "tag", LIB_TAG_INDIRECT);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly");
prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "lib");
RNA_def_property_pointer_sdna(prop, nullptr, "lib");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from");
@@ -2147,7 +2156,7 @@ static void rna_def_ID(BlenderRNA *brna)
prop = RNA_def_property(srna, "asset_data", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, NULL, "rna_ID_asset_data_set", NULL, NULL);
RNA_def_property_pointer_funcs(prop, nullptr, "rna_ID_asset_data_set", nullptr, nullptr);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_ui_text(prop, "Asset Data", "Additional data for an asset data-block");
@@ -2165,7 +2174,7 @@ static void rna_def_ID(BlenderRNA *brna)
"for this type of data)");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", nullptr, nullptr, nullptr);
/* functions */
func = RNA_def_function(srna, "evaluated_get", "rna_ID_evaluated_get");
@@ -2293,7 +2302,7 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(
func, "Create animation data to this ID, note that not all ID types support this");
parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or nullptr");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free");
@@ -2315,7 +2324,7 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_function_return(func, parm);
# ifdef WITH_PYTHON
RNA_def_struct_register_funcs(srna, NULL, NULL, "rna_ID_instance");
RNA_def_struct_register_funcs(srna, nullptr, nullptr, "rna_ID_instance");
# endif
}
@@ -2330,9 +2339,9 @@ static void rna_def_library(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "filepath");
RNA_def_property_string_sdna(prop, nullptr, "filepath");
RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set");
RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Library_filepath_set");
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Library");
@@ -2340,20 +2349,20 @@ static void rna_def_library(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Parent", "");
prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
RNA_def_property_pointer_sdna(prop, nullptr, "packedfile");
RNA_def_property_ui_text(prop, "Packed File", "");
prop = RNA_def_int_vector(srna,
"version",
3,
NULL,
nullptr,
0,
INT_MAX,
"Version",
"Version of Blender the library .blend was saved with",
0,
INT_MAX);
RNA_def_property_int_funcs(prop, "rna_Library_version_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_Library_version_get", nullptr, nullptr);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_THICK_WRAP);
@@ -2367,19 +2376,19 @@ static void rna_def_library_weak_reference(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "LibraryWeakReference", NULL);
srna = RNA_def_struct(brna, "LibraryWeakReference", nullptr);
RNA_def_struct_ui_text(
srna,
"LibraryWeakReference",
"Read-only external reference to a linked data-block and its library file");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "library_filepath");
RNA_def_property_string_sdna(prop, nullptr, "library_filepath");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
prop = RNA_def_property(srna, "id_name", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "library_id_name");
RNA_def_property_string_sdna(prop, nullptr, "library_id_name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop,
@@ -2395,7 +2404,7 @@ static void rna_def_idproperty_wrap_ptr(BlenderRNA *brna)
{
StructRNA *srna;
srna = RNA_def_struct(brna, "IDPropertyWrapPtr", NULL);
srna = RNA_def_struct(brna, "IDPropertyWrapPtr", nullptr);
RNA_def_struct_idprops_func(srna, "rna_IDPropertyWrapPtr_idprops");
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
}
@@ -2405,12 +2414,12 @@ void RNA_def_ID(BlenderRNA *brna)
StructRNA *srna;
/* built-in unknown type */
srna = RNA_def_struct(brna, "UnknownType", NULL);
srna = RNA_def_struct(brna, "UnknownType", nullptr);
RNA_def_struct_ui_text(
srna, "Unknown Type", "Stub RNA type used for pointers to unknown or internal data");
/* built-in any type */
srna = RNA_def_struct(brna, "AnyType", NULL);
srna = RNA_def_struct(brna, "AnyType", nullptr);
RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data");
rna_def_ID(brna);

View File

@@ -1874,7 +1874,7 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
RNA_def_property_collection_funcs(prop,
nullptr,
nullptr,

View File

@@ -461,7 +461,7 @@ static void rna_def_curves(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
RNA_def_property_collection_funcs(prop,
nullptr,
nullptr,

View File

@@ -50,16 +50,16 @@ static CLG_LogRef LOG = {"rna.define"};
/* Global used during defining */
BlenderDefRNA DefRNA = {
.sdna = NULL,
.structs = {NULL, NULL},
.allocs = {NULL, NULL},
.laststruct = NULL,
.error = 0,
.silent = false,
.preprocess = false,
.verify = true,
.animate = true,
.make_overridable = false,
/*sdna*/ nullptr,
/*structs*/ {nullptr, nullptr},
/*allocs*/ {nullptr, nullptr},
/*laststruct*/ nullptr,
/*error*/ 0,
/*silent*/ false,
/*preprocess*/ false,
/*verify*/ true,
/*animate*/ true,
/*make_overridable*/ false,
};
#ifndef RNA_RUNTIME
@@ -110,15 +110,15 @@ static void print_default_info(const PropertyDefRNA *dp)
void rna_addtail(ListBase *listbase, void *vlink)
{
Link *link = vlink;
Link *link = static_cast<Link *>(vlink);
link->next = NULL;
link->prev = listbase->last;
link->next = nullptr;
link->prev = static_cast<Link *>(listbase->last);
if (listbase->last) {
((Link *)listbase->last)->next = link;
}
if (listbase->first == NULL) {
if (listbase->first == nullptr) {
listbase->first = link;
}
listbase->last = link;
@@ -126,7 +126,7 @@ void rna_addtail(ListBase *listbase, void *vlink)
static void rna_remlink(ListBase *listbase, void *vlink)
{
Link *link = vlink;
Link *link = static_cast<Link *>(vlink);
if (link->next) {
link->next->prev = link->prev;
@@ -147,14 +147,14 @@ PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier)
{
Link *link;
for (link = listbase->first; link; link = link->next) {
for (link = static_cast<Link *>(listbase->first); link; link = link->next) {
PropertyRNA *prop = ((PropertyDefRNA *)link)->prop;
if (prop && STREQ(prop->identifier, identifier)) {
return (PropertyDefRNA *)link;
}
}
return NULL;
return nullptr;
}
void rna_freelinkN(ListBase *listbase, void *vlink)
@@ -167,12 +167,12 @@ void rna_freelistN(ListBase *listbase)
{
Link *link, *next;
for (link = listbase->first; link; link = next) {
for (link = static_cast<Link *>(listbase->first); link; link = next) {
next = link->next;
MEM_freeN(link);
}
listbase->first = listbase->last = NULL;
listbase->first = listbase->last = nullptr;
}
static void rna_brna_structs_add(BlenderRNA *brna, StructRNA *srna)
@@ -192,11 +192,11 @@ static void rna_brna_structs_remove_and_free(BlenderRNA *brna, StructRNA *srna)
{
if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) && brna->structs_map) {
if (srna->identifier[0] != '\0') {
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, nullptr, nullptr);
}
}
RNA_def_struct_free_pointers(NULL, srna);
RNA_def_struct_free_pointers(nullptr, srna);
if (srna->flag & STRUCT_RUNTIME) {
rna_freelinkN(&brna->structs, srna);
@@ -212,8 +212,8 @@ static int DNA_struct_find_nr_wrapper(const SDNA *sdna, const char *struct_name)
/* We may support this at some point but for now we don't. */
BLI_assert_unreachable();
#else
struct_name = BLI_ghash_lookup_default(
g_version_data.struct_map_static_from_alias, struct_name, (void *)struct_name);
struct_name = static_cast<const char *>(BLI_ghash_lookup_default(
g_version_data.struct_map_static_from_alias, struct_name, (void *)struct_name));
#endif
return DNA_struct_find_nr(sdna, struct_name);
}
@@ -225,17 +225,17 @@ StructDefRNA *rna_find_struct_def(StructRNA *srna)
if (!DefRNA.preprocess) {
/* we should never get here */
CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
return nullptr;
}
dsrna = DefRNA.structs.last;
for (; dsrna; dsrna = dsrna->cont.prev) {
dsrna = static_cast<StructDefRNA *>(DefRNA.structs.last);
for (; dsrna; dsrna = static_cast<StructDefRNA *>(dsrna->cont.prev)) {
if (dsrna->srna == srna) {
return dsrna;
}
}
return NULL;
return nullptr;
}
PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop)
@@ -246,20 +246,20 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop)
if (!DefRNA.preprocess) {
/* we should never get here */
CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
return nullptr;
}
dsrna = rna_find_struct_def(srna);
dprop = dsrna->cont.properties.last;
dprop = static_cast<PropertyDefRNA *>(dsrna->cont.properties.last);
for (; dprop; dprop = dprop->prev) {
if (dprop->prop == prop) {
return dprop;
}
}
dsrna = DefRNA.structs.last;
for (; dsrna; dsrna = dsrna->cont.prev) {
dprop = dsrna->cont.properties.last;
dsrna = static_cast<StructDefRNA *>(DefRNA.structs.last);
for (; dsrna; dsrna = static_cast<StructDefRNA *>(dsrna->cont.prev)) {
dprop = static_cast<PropertyDefRNA *>(dsrna->cont.properties.last);
for (; dprop; dprop = dprop->prev) {
if (dprop->prop == prop) {
return dprop;
@@ -267,7 +267,7 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop)
}
}
return NULL;
return nullptr;
}
#if 0
@@ -278,7 +278,7 @@ static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop)
if (!DefRNA.preprocess) {
/* we should never get here */
CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
return nullptr;
}
dprop = rna_find_struct_property_def(DefRNA.laststruct, prop);
@@ -291,7 +291,7 @@ static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop)
return dprop;
}
return NULL;
return nullptr;
}
#endif
@@ -303,28 +303,28 @@ FunctionDefRNA *rna_find_function_def(FunctionRNA *func)
if (!DefRNA.preprocess) {
/* we should never get here */
CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
return nullptr;
}
dsrna = rna_find_struct_def(DefRNA.laststruct);
dfunc = dsrna->functions.last;
for (; dfunc; dfunc = dfunc->cont.prev) {
dfunc = static_cast<FunctionDefRNA *>(dsrna->functions.last);
for (; dfunc; dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.prev)) {
if (dfunc->func == func) {
return dfunc;
}
}
dsrna = DefRNA.structs.last;
for (; dsrna; dsrna = dsrna->cont.prev) {
dfunc = dsrna->functions.last;
for (; dfunc; dfunc = dfunc->cont.prev) {
dsrna = static_cast<StructDefRNA *>(DefRNA.structs.last);
for (; dsrna; dsrna = static_cast<StructDefRNA *>(dsrna->cont.prev)) {
dfunc = static_cast<FunctionDefRNA *>(dsrna->functions.last);
for (; dfunc; dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.prev)) {
if (dfunc->func == func) {
return dfunc;
}
}
}
return NULL;
return nullptr;
}
PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm)
@@ -336,13 +336,13 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm)
if (!DefRNA.preprocess) {
/* we should never get here */
CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
return nullptr;
}
dsrna = rna_find_struct_def(DefRNA.laststruct);
dfunc = dsrna->functions.last;
for (; dfunc; dfunc = dfunc->cont.prev) {
dparm = dfunc->cont.properties.last;
dfunc = static_cast<FunctionDefRNA *>(dsrna->functions.last);
for (; dfunc; dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.prev)) {
dparm = static_cast<PropertyDefRNA *>(dfunc->cont.properties.last);
for (; dparm; dparm = dparm->prev) {
if (dparm->prop == parm) {
return dparm;
@@ -350,11 +350,11 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm)
}
}
dsrna = DefRNA.structs.last;
for (; dsrna; dsrna = dsrna->cont.prev) {
dfunc = dsrna->functions.last;
for (; dfunc; dfunc = dfunc->cont.prev) {
dparm = dfunc->cont.properties.last;
dsrna = static_cast<StructDefRNA *>(DefRNA.structs.last);
for (; dsrna; dsrna = static_cast<StructDefRNA *>(dsrna->cont.prev)) {
dfunc = static_cast<FunctionDefRNA *>(dsrna->functions.last);
for (; dfunc; dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.prev)) {
dparm = static_cast<PropertyDefRNA *>(dfunc->cont.properties.last);
for (; dparm; dparm = dparm->prev) {
if (dparm->prop == parm) {
return dparm;
@@ -363,7 +363,7 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm)
}
}
return NULL;
return nullptr;
}
static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont)
@@ -374,7 +374,7 @@ static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont)
if (!DefRNA.preprocess) {
/* we should never get here */
CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
return nullptr;
}
ds = rna_find_struct_def((StructRNA *)cont);
@@ -387,19 +387,19 @@ static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont)
return &dfunc->cont;
}
return NULL;
return nullptr;
}
/* DNA utility function for looking up members */
typedef struct DNAStructMember {
struct DNAStructMember {
const char *type;
const char *name;
int arraylength;
int pointerlevel;
int offset;
int size;
} DNAStructMember;
};
static int rna_member_cmp(const char *name, const char *oname)
{
@@ -544,7 +544,7 @@ static bool rna_validate_identifier(const char *identifier, bool property, const
"and", "as", "assert", "async", "await", "break", "class", "continue", "def",
"del", "elif", "else", "except", "finally", "for", "from", "global", "if",
"import", "in", "is", "lambda", "nonlocal", "not", "or", "pass", "raise",
"return", "try", "while", "with", "yield", NULL,
"return", "try", "while", "with", "yield", nullptr,
};
if (!isalpha(identifier[0])) {
@@ -589,7 +589,7 @@ static bool rna_validate_identifier(const char *identifier, bool property, const
"values",
"items",
"get",
NULL,
nullptr,
};
for (a = 0; kwlist_prop[a]; a++) {
@@ -613,7 +613,7 @@ void RNA_identifier_sanitize(char *identifier, int property)
"and", "as", "assert", "break", "class", "continue", "def", "del",
"elif", "else", "except", "finally", "for", "from", "global", "if",
"import", "in", "is", "lambda", "nonlocal", "not", "or", "pass",
"raise", "return", "try", "while", "with", "yield", NULL,
"raise", "return", "try", "while", "with", "yield", nullptr,
};
if (!isalpha(identifier[0])) {
@@ -661,7 +661,7 @@ void RNA_identifier_sanitize(char *identifier, int property)
"values",
"items",
"get",
NULL,
nullptr,
};
for (a = 0; kwlist_prop[a]; a++) {
@@ -682,8 +682,8 @@ BlenderRNA *RNA_create(void)
{
BlenderRNA *brna;
brna = MEM_callocN(sizeof(BlenderRNA), "BlenderRNA");
const char *error_message = NULL;
brna = static_cast<BlenderRNA *>(MEM_callocN(sizeof(BlenderRNA), "BlenderRNA"));
const char *error_message = nullptr;
BLI_listbase_clear(&DefRNA.structs);
brna->structs_map = BLI_ghash_str_new_ex(__func__, 2048);
@@ -692,7 +692,7 @@ BlenderRNA *RNA_create(void)
DefRNA.preprocess = true;
DefRNA.sdna = DNA_sdna_from_data(DNAstr, DNAlen, false, false, &error_message);
if (DefRNA.sdna == NULL) {
if (DefRNA.sdna == nullptr) {
CLOG_ERROR(&LOG, "Failed to decode SDNA: %s.", error_message);
DefRNA.error = true;
}
@@ -701,25 +701,30 @@ BlenderRNA *RNA_create(void)
DNA_sdna_alias_data_ensure(DefRNA.sdna);
#ifndef RNA_RUNTIME
DNA_alias_maps(DNA_RENAME_STATIC_FROM_ALIAS, &g_version_data.struct_map_static_from_alias, NULL);
DNA_alias_maps(
DNA_RENAME_STATIC_FROM_ALIAS, &g_version_data.struct_map_static_from_alias, nullptr);
#endif
return brna;
}
void RNA_define_free(BlenderRNA *UNUSED(brna))
void RNA_define_free(BlenderRNA * /*brna*/)
{
StructDefRNA *ds;
FunctionDefRNA *dfunc;
AllocDefRNA *alloc;
for (alloc = DefRNA.allocs.first; alloc; alloc = alloc->next) {
for (alloc = static_cast<AllocDefRNA *>(DefRNA.allocs.first); alloc; alloc = alloc->next) {
MEM_freeN(alloc->mem);
}
rna_freelistN(&DefRNA.allocs);
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
for (dfunc = static_cast<FunctionDefRNA *>(ds->functions.first); dfunc;
dfunc = static_cast<FunctionDefRNA *>(dfunc->cont.next))
{
rna_freelistN(&dfunc->cont.properties);
}
@@ -731,7 +736,7 @@ void RNA_define_free(BlenderRNA *UNUSED(brna))
if (DefRNA.sdna) {
DNA_sdna_free(DefRNA.sdna);
DefRNA.sdna = NULL;
DefRNA.sdna = nullptr;
}
DefRNA.error = false;
@@ -765,11 +770,11 @@ void RNA_define_fallback_property_update(int noteflag, const char *updatefunc)
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *rna_ext)
{
#ifdef RNA_RUNTIME
rna_ext->free(rna_ext->data); /* Decrefs the PyObject that the `srna` owns. */
RNA_struct_blender_type_set(srna, NULL); /* FIXME: this gets accessed again. */
rna_ext->free(rna_ext->data); /* Decrefs the PyObject that the `srna` owns. */
RNA_struct_blender_type_set(srna, nullptr); /* FIXME: this gets accessed again. */
/* NULL the srna's value so RNA_struct_free won't complain of a leak */
RNA_struct_py_type_set(srna, NULL);
/* nullptr the srna's value so RNA_struct_free won't complain of a leak */
RNA_struct_py_type_set(srna, nullptr);
#else
(void)srna;
@@ -792,7 +797,7 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
}
# endif
for (prop = srna->cont.properties.first; prop; prop = nextprop) {
for (prop = static_cast<PropertyRNA *>(srna->cont.properties.first); prop; prop = nextprop) {
nextprop = prop->next;
RNA_def_property_free_pointers(prop);
@@ -802,10 +807,10 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
}
}
for (func = srna->functions.first; func; func = nextfunc) {
nextfunc = func->cont.next;
for (func = static_cast<FunctionRNA *>(srna->functions.first); func; func = nextfunc) {
nextfunc = static_cast<FunctionRNA *>(func->cont.next);
for (parm = func->cont.properties.first; parm; parm = nextparm) {
for (parm = static_cast<PropertyRNA *>(func->cont.properties.first); parm; parm = nextparm) {
nextparm = parm->next;
RNA_def_property_free_pointers(parm);
@@ -833,14 +838,18 @@ void RNA_free(BlenderRNA *brna)
StructRNA *srna, *nextsrna;
FunctionRNA *func;
BLI_ghash_free(brna->structs_map, NULL, NULL);
brna->structs_map = NULL;
BLI_ghash_free(brna->structs_map, nullptr, nullptr);
brna->structs_map = nullptr;
if (DefRNA.preprocess) {
RNA_define_free(brna);
for (srna = brna->structs.first; srna; srna = srna->cont.next) {
for (func = srna->functions.first; func; func = func->cont.next) {
for (srna = static_cast<StructRNA *>(brna->structs.first); srna;
srna = static_cast<StructRNA *>(srna->cont.next))
{
for (func = static_cast<FunctionRNA *>(srna->functions.first); func;
func = static_cast<FunctionRNA *>(func->cont.next))
{
rna_freelistN(&func->cont.properties);
}
@@ -853,15 +862,15 @@ void RNA_free(BlenderRNA *brna)
MEM_freeN(brna);
}
else {
for (srna = brna->structs.first; srna; srna = nextsrna) {
nextsrna = srna->cont.next;
for (srna = static_cast<StructRNA *>(brna->structs.first); srna; srna = nextsrna) {
nextsrna = static_cast<StructRNA *>(srna->cont.next);
RNA_struct_free(brna, srna);
}
}
#ifndef RNA_RUNTIME
BLI_ghash_free(g_version_data.struct_map_static_from_alias, NULL, NULL);
g_version_data.struct_map_static_from_alias = NULL;
BLI_ghash_free(g_version_data.struct_map_static_from_alias, nullptr, nullptr);
g_version_data.struct_map_static_from_alias = nullptr;
#endif
}
@@ -891,23 +900,25 @@ static StructDefRNA *rna_find_def_struct(StructRNA *srna)
{
StructDefRNA *ds;
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
for (ds = static_cast<StructDefRNA *>(DefRNA.structs.first); ds;
ds = static_cast<StructDefRNA *>(ds->cont.next))
{
if (ds->srna == srna) {
return ds;
}
}
return NULL;
return nullptr;
}
StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
{
StructRNA *srna;
StructDefRNA *ds = NULL, *dsfrom = NULL;
StructDefRNA *ds = nullptr, *dsfrom = nullptr;
PropertyRNA *prop;
if (DefRNA.preprocess) {
const char *error = NULL;
const char *error = nullptr;
if (!rna_validate_identifier(identifier, false, &error)) {
CLOG_ERROR(&LOG, "struct identifier \"%s\" error - %s", identifier, error);
@@ -915,17 +926,17 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
}
}
srna = MEM_callocN(sizeof(StructRNA), "StructRNA");
srna = static_cast<StructRNA *>(MEM_callocN(sizeof(StructRNA), "StructRNA"));
DefRNA.laststruct = srna;
if (srnafrom) {
/* Copy from struct to derive stuff, a bit clumsy since we can't
* use #MEM_dupallocN, data structs may not be allocated but builtin. */
memcpy(srna, srnafrom, sizeof(StructRNA));
srna->cont.prophash = NULL;
srna->cont.prophash = nullptr;
BLI_listbase_clear(&srna->cont.properties);
BLI_listbase_clear(&srna->functions);
srna->py_type = NULL;
srna->py_type = nullptr;
srna->base = srnafrom;
@@ -959,7 +970,7 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
rna_brna_structs_add(brna, srna);
if (DefRNA.preprocess) {
ds = MEM_callocN(sizeof(StructDefRNA), "StructDefRNA");
ds = static_cast<StructDefRNA *>(MEM_callocN(sizeof(StructDefRNA), "StructDefRNA"));
ds->srna = srna;
rna_addtail(&DefRNA.structs, ds);
@@ -993,10 +1004,10 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
"rna_builtin_properties_next",
"rna_iterator_listbase_end",
"rna_builtin_properties_get",
NULL,
NULL,
nullptr,
nullptr,
"rna_builtin_properties_lookup_string",
NULL);
nullptr);
}
else {
#ifdef RNA_RUNTIME
@@ -1014,7 +1025,7 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
if (DefRNA.preprocess) {
RNA_def_property_struct_type(prop, "Struct");
RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", nullptr, nullptr, nullptr);
}
else {
#ifdef RNA_RUNTIME
@@ -1030,7 +1041,7 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
{
StructRNA *srnafrom = NULL;
StructRNA *srnafrom = nullptr;
/* only use RNA_def_struct() while pre-processing, otherwise use RNA_def_struct_ptr() */
BLI_assert(DefRNA.preprocess);
@@ -1038,7 +1049,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
if (from) {
/* find struct to derive from */
/* Inline RNA_struct_find(...) because it won't link from here. */
srnafrom = BLI_ghash_lookup(brna->structs_map, from);
srnafrom = static_cast<StructRNA *>(BLI_ghash_lookup(brna->structs_map, from));
if (!srnafrom) {
CLOG_ERROR(&LOG, "struct %s not found to define %s.", from, identifier);
DefRNA.error = true;
@@ -1059,9 +1070,9 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
ds = rna_find_def_struct(srna);
/* There are far too many structs which initialize without valid DNA struct names,
* this can't be checked without adding an option to disable
* (tested this and it means changes all over - Campbell) */
/* There are far too many structs which initialize without valid DNA struct names,
* this can't be checked without adding an option to disable
* (tested this and it means changes all over - Campbell) */
#if 0
if (DNA_struct_find_nr_wrapper(DefRNA.sdna, structname) == -1) {
if (!DefRNA.silent) {
@@ -1109,7 +1120,7 @@ void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
CLOG_ERROR(&LOG, "\"%s.%s\", must be a string property.", srna->identifier, prop->identifier);
DefRNA.error = true;
}
else if (srna->nameproperty != NULL) {
else if (srna->nameproperty != nullptr) {
CLOG_ERROR(
&LOG, "\"%s.%s\", name property is already set.", srna->identifier, prop->identifier);
DefRNA.error = true;
@@ -1124,7 +1135,7 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct
StructRNA *srnafrom;
/* find struct to derive from */
srnafrom = BLI_ghash_lookup(brna->structs_map, structname);
srnafrom = static_cast<StructRNA *>(BLI_ghash_lookup(brna->structs_map, structname));
if (!srnafrom) {
CLOG_ERROR(&LOG, "struct %s not found for %s.", structname, srna->identifier);
DefRNA.error = true;
@@ -1216,7 +1227,7 @@ void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *id
if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
if (identifier != srna->identifier) {
if (srna->identifier[0] != '\0') {
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, nullptr, nullptr);
}
if (identifier[0] != '\0') {
BLI_ghash_insert(brna->structs_map, (void *)identifier, srna);
@@ -1239,7 +1250,7 @@ void RNA_def_struct_identifier_no_struct_map(StructRNA *srna, const char *identi
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
{
DESCR_CHECK(description, srna->identifier, NULL);
DESCR_CHECK(description, srna->identifier, nullptr);
srna->name = name;
srna->description = description;
@@ -1263,13 +1274,13 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
int subtype)
{
// StructRNA *srna = DefRNA.laststruct; /* Invalid for Python defined props. */
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
ContainerDefRNA *dcont;
PropertyDefRNA *dprop = NULL;
PropertyDefRNA *dprop = nullptr;
PropertyRNA *prop;
if (DefRNA.preprocess) {
const char *error = NULL;
const char *error = nullptr;
if (!rna_validate_identifier(identifier, true, &error)) {
CLOG_ERROR(
@@ -1285,12 +1296,12 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
DefRNA.error = true;
}
dprop = MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA");
dprop = static_cast<PropertyDefRNA *>(MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA"));
rna_addtail(&dcont->properties, dprop);
}
else {
#ifndef NDEBUG
const char *error = NULL;
const char *error = nullptr;
if (!rna_validate_identifier(identifier, true, &error)) {
CLOG_ERROR(&LOG,
"runtime property identifier \"%s.%s\" - %s",
@@ -1302,7 +1313,8 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
#endif
}
prop = MEM_callocN(rna_property_type_sizeof(type), "PropertyRNA");
prop = static_cast<PropertyRNA *>(
MEM_callocN(rna_property_type_sizeof(PropertyType(type)), "PropertyRNA"));
switch (type) {
case PROP_BOOLEAN:
@@ -1361,7 +1373,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
}
case PROP_STRING: {
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
/* By default don't allow NULL string args, callers may clear. */
/* By default don't allow nullptr string args, callers may clear. */
RNA_def_property_flag(prop, PROP_NEVER_NULL);
sprop->defaultvalue = "";
break;
@@ -1375,7 +1387,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
default:
CLOG_ERROR(&LOG, "\"%s.%s\", invalid property type.", CONTAINER_RNA_ID(cont), identifier);
DefRNA.error = true;
return NULL;
return nullptr;
}
if (DefRNA.preprocess) {
@@ -1385,13 +1397,13 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
prop->magic = RNA_MAGIC;
prop->identifier = identifier;
prop->type = type;
prop->subtype = subtype;
prop->type = PropertyType(type);
prop->subtype = PropertySubType(subtype);
prop->name = identifier;
prop->description = "";
prop->translation_context = BLT_I18NCONTEXT_DEFAULT_BPYRNA;
/* a priori not raw editable */
prop->rawtype = -1;
prop->rawtype = RawPropertyType(-1);
if (!ELEM(type, PROP_COLLECTION, PROP_POINTER)) {
prop->flag = PROP_EDITABLE;
@@ -1414,7 +1426,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
#endif
if (type == PROP_STRING) {
/* used so generated 'get/length/set' functions skip a NULL check
/* used so generated 'get/length/set' functions skip a nullptr check
* in some cases we want it */
RNA_def_property_flag(prop, PROP_NEVER_NULL);
}
@@ -1423,40 +1435,40 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
switch (type) {
case PROP_BOOLEAN:
DefRNA.silent = true;
RNA_def_property_boolean_sdna(prop, NULL, identifier, 0);
RNA_def_property_boolean_sdna(prop, nullptr, identifier, 0);
DefRNA.silent = false;
break;
case PROP_INT: {
DefRNA.silent = true;
RNA_def_property_int_sdna(prop, NULL, identifier);
RNA_def_property_int_sdna(prop, nullptr, identifier);
DefRNA.silent = false;
break;
}
case PROP_FLOAT: {
DefRNA.silent = true;
RNA_def_property_float_sdna(prop, NULL, identifier);
RNA_def_property_float_sdna(prop, nullptr, identifier);
DefRNA.silent = false;
break;
}
case PROP_STRING: {
DefRNA.silent = true;
RNA_def_property_string_sdna(prop, NULL, identifier);
RNA_def_property_string_sdna(prop, nullptr, identifier);
DefRNA.silent = false;
break;
}
case PROP_ENUM:
DefRNA.silent = true;
RNA_def_property_enum_sdna(prop, NULL, identifier);
RNA_def_property_enum_sdna(prop, nullptr, identifier);
DefRNA.silent = false;
break;
case PROP_POINTER:
DefRNA.silent = true;
RNA_def_property_pointer_sdna(prop, NULL, identifier);
RNA_def_property_pointer_sdna(prop, nullptr, identifier);
DefRNA.silent = false;
break;
case PROP_COLLECTION:
DefRNA.silent = true;
RNA_def_property_collection_sdna(prop, NULL, identifier, NULL);
RNA_def_property_collection_sdna(prop, nullptr, identifier, nullptr);
DefRNA.silent = false;
break;
}
@@ -1473,9 +1485,9 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
/* Override handling. */
if (DefRNA.preprocess) {
prop->override_diff = (RNAPropOverrideDiff) "rna_property_override_diff_default";
prop->override_store = (RNAPropOverrideStore) "rna_property_override_store_default";
prop->override_apply = (RNAPropOverrideApply) "rna_property_override_apply_default";
prop->override_diff = (RNAPropOverrideDiff)(void *)"rna_property_override_diff_default";
prop->override_store = (RNAPropOverrideStore)(void *)"rna_property_override_store_default";
prop->override_apply = (RNAPropOverrideApply)(void *)"rna_property_override_apply_default";
}
/* TODO: do we want that for runtime-defined stuff too? Id say no, but... maybe yes :/ */
@@ -1647,7 +1659,7 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
{
DESCR_CHECK(description, prop->identifier, NULL);
DESCR_CHECK(description, prop->identifier, nullptr);
prop->name = name;
prop->description = description;
@@ -2008,7 +2020,7 @@ void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array)
case PROP_INT: {
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
#ifndef RNA_RUNTIME
if (iprop->defaultarray != NULL) {
if (iprop->defaultarray != nullptr) {
CLOG_ERROR(&LOG, "\"%s.%s\", set from DNA.", srna->identifier, prop->identifier);
}
#endif
@@ -2051,7 +2063,7 @@ void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
case PROP_FLOAT: {
FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
#ifndef RNA_RUNTIME
if (fprop->defaultarray != NULL) {
if (fprop->defaultarray != nullptr) {
CLOG_ERROR(&LOG, "\"%s.%s\", set from DNA.", srna->identifier, prop->identifier);
}
#endif
@@ -2073,9 +2085,9 @@ void RNA_def_property_string_default(PropertyRNA *prop, const char *value)
case PROP_STRING: {
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
if (value == NULL) {
if (value == nullptr) {
CLOG_ERROR(&LOG,
"\"%s.%s\", NULL string passed (don't call in this case).",
"\"%s.%s\", nullptr string passed (don't call in this case).",
srna->identifier,
prop->identifier);
DefRNA.error = true;
@@ -2092,7 +2104,7 @@ void RNA_def_property_string_default(PropertyRNA *prop, const char *value)
break;
}
#ifndef RNA_RUNTIME
if (sprop->defaultvalue != NULL && sprop->defaultvalue[0]) {
if (sprop->defaultvalue != nullptr && sprop->defaultvalue[0]) {
CLOG_ERROR(&LOG, "\"%s.%s\", set from DNA.", srna->identifier, prop->identifier);
}
#endif
@@ -2173,8 +2185,8 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop,
PropertyDefRNA *dp;
dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
if (dp == NULL) {
return NULL;
if (dp == nullptr) {
return nullptr;
}
ds = rna_find_struct_def((StructRNA *)dp->cont);
@@ -2189,7 +2201,7 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop,
int dnaoffset = 0;
if (!rna_find_sdna_member(DefRNA.sdna, structname, propname, &smember, &dnaoffset)) {
if (DefRNA.silent) {
return NULL;
return nullptr;
}
if (!DefRNA.verify) {
/* some basic values to survive even with sdna info */
@@ -2210,7 +2222,7 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop,
propname,
prop->identifier);
DefRNA.error = true;
return NULL;
return nullptr;
}
if (smember.arraylength > 1) {
@@ -2416,7 +2428,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const
const void *default_data_end = POINTER_OFFSET(default_data, dp->dnasize);
const int size_final = sizeof(int) * prop->totarraylength;
if (STREQ(dp->dnatype, "char")) {
int *defaultarray = rna_calloc(size_final);
int *defaultarray = static_cast<int *>(rna_calloc(size_final));
for (int i = 0; i < prop->totarraylength && default_data < default_data_end; i++) {
defaultarray[i] = *(const char *)default_data;
default_data = POINTER_OFFSET(default_data, sizeof(char));
@@ -2425,7 +2437,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const
}
else if (STREQ(dp->dnatype, "short")) {
int *defaultarray = rna_calloc(size_final);
int *defaultarray = static_cast<int *>(rna_calloc(size_final));
for (int i = 0; i < prop->totarraylength && default_data < default_data_end; i++) {
defaultarray[i] = (prop->subtype != PROP_UNSIGNED) ? *(const short *)default_data :
*(const ushort *)default_data;
@@ -2434,7 +2446,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const
iprop->defaultarray = defaultarray;
}
else if (STREQ(dp->dnatype, "int")) {
int *defaultarray = rna_calloc(size_final);
int *defaultarray = static_cast<int *>(rna_calloc(size_final));
memcpy(defaultarray, default_data, MIN2(size_final, dp->dnasize));
iprop->defaultarray = defaultarray;
}
@@ -2545,7 +2557,7 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons
if (prop->totarraylength > 0) {
if (STREQ(dp->dnatype, "float")) {
const int size_final = sizeof(float) * prop->totarraylength;
float *defaultarray = rna_calloc(size_final);
float *defaultarray = static_cast<float *>(rna_calloc(size_final));
memcpy(defaultarray, default_data, MIN2(size_final, dp->dnasize));
fprop->defaultarray = defaultarray;
}
@@ -2727,7 +2739,7 @@ void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, con
const void *default_data = DNA_default_table[SDNAnr];
if (default_data) {
default_data = POINTER_OFFSET(default_data, dp->dnaoffset);
sprop->defaultvalue = default_data;
sprop->defaultvalue = static_cast<const char *>(default_data);
if (debugSRNA_defaults) {
fprintf(stderr, "value=\"%s\", ", sprop->defaultvalue);
@@ -2801,9 +2813,9 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop,
}
if (dp->dnatype && STREQ(dp->dnatype, "ListBase")) {
cprop->next = (PropCollectionNextFunc) "rna_iterator_listbase_next";
cprop->get = (PropCollectionGetFunc) "rna_iterator_listbase_get";
cprop->end = (PropCollectionEndFunc) "rna_iterator_listbase_end";
cprop->next = (PropCollectionNextFunc)(void *)"rna_iterator_listbase_next";
cprop->get = (PropCollectionGetFunc)(void *)"rna_iterator_listbase_get";
cprop->end = (PropCollectionEndFunc)(void *)"rna_iterator_listbase_end";
}
}
@@ -2830,14 +2842,14 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop,
prop->totarraylength = 0;
}
cprop->next = (PropCollectionNextFunc) "rna_iterator_array_next";
cprop->end = (PropCollectionEndFunc) "rna_iterator_array_end";
cprop->next = (PropCollectionNextFunc)(void *)"rna_iterator_array_next";
cprop->end = (PropCollectionEndFunc)(void *)"rna_iterator_array_end";
if (dp->dnapointerlevel >= 2) {
cprop->get = (PropCollectionGetFunc) "rna_iterator_array_dereference_get";
cprop->get = (PropCollectionGetFunc)(void *)"rna_iterator_array_dereference_get";
}
else {
cprop->get = (PropCollectionGetFunc) "rna_iterator_array_get";
cprop->get = (PropCollectionGetFunc)(void *)"rna_iterator_array_get";
}
}
else {
@@ -2914,13 +2926,13 @@ void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func)
{
prop->update = (void *)func;
prop->update = (UpdateFunc)func;
}
void RNA_def_property_poll_runtime(PropertyRNA *prop, const void *func)
{
if (prop->type == PROP_POINTER) {
((PointerPropertyRNA *)prop)->poll = (void *)func;
((PointerPropertyRNA *)prop)->poll = (PropPointerPollFunc)func;
}
else {
CLOG_ERROR(&LOG, "%s is not a Pointer Property.", prop->identifier);
@@ -3335,7 +3347,7 @@ void RNA_def_property_string_search_func(PropertyRNA *prop,
case PROP_STRING: {
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
sprop->search = (StringPropertySearchFunc)search;
if (search != NULL) {
if (search != nullptr) {
sprop->search_flag = search_flag | PROP_STRING_SEARCH_SUPPORTED;
}
break;
@@ -3381,7 +3393,7 @@ void RNA_def_property_string_search_func_runtime(PropertyRNA *prop,
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
sprop->search = search_fn;
if (search_fn != NULL) {
if (search_fn != nullptr) {
sprop->search_flag = search_flag | PROP_STRING_SEARCH_SUPPORTED;
}
}
@@ -3477,7 +3489,7 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop,
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
{
const char *error = NULL;
const char *error = nullptr;
if (!rna_validate_identifier(type, false, &error)) {
CLOG_ERROR(&LOG, "struct identifier \"%s\" error - %s", type, error);
DefRNA.error = true;
@@ -3500,7 +3512,7 @@ PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
@@ -3517,7 +3529,7 @@ PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
@@ -3539,7 +3551,7 @@ PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER);
@@ -3561,7 +3573,7 @@ PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER_MEMBER);
@@ -3583,7 +3595,7 @@ PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_XYZ); /* XXX */
@@ -3608,7 +3620,7 @@ PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_,
int softmin,
int softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -3635,7 +3647,7 @@ PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_,
int softmin,
int softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -3667,7 +3679,7 @@ PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_,
int softmin,
int softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -3695,10 +3707,10 @@ PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
BLI_assert(default_value == NULL || default_value[0]);
BLI_assert(default_value == nullptr || default_value[0]);
prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE);
if (maxlen != 0) {
@@ -3719,10 +3731,10 @@ PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
BLI_assert(default_value == NULL || default_value[0]);
BLI_assert(default_value == nullptr || default_value[0]);
prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILEPATH);
if (maxlen != 0) {
@@ -3743,10 +3755,10 @@ PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
BLI_assert(default_value == NULL || default_value[0]);
BLI_assert(default_value == nullptr || default_value[0]);
prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_DIRPATH);
if (maxlen != 0) {
@@ -3767,10 +3779,10 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
BLI_assert(default_value == NULL || default_value[0]);
BLI_assert(default_value == nullptr || default_value[0]);
prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILENAME);
if (maxlen != 0) {
@@ -3791,12 +3803,12 @@ PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
if (items == NULL) {
CLOG_ERROR(&LOG, "items not allowed to be NULL.");
return NULL;
if (items == nullptr) {
CLOG_ERROR(&LOG, "items not allowed to be nullptr.");
return nullptr;
}
prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
@@ -3814,12 +3826,12 @@ PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
if (items == NULL) {
CLOG_ERROR(&LOG, "items not allowed to be NULL.");
return NULL;
if (items == nullptr) {
CLOG_ERROR(&LOG, "items not allowed to be nullptr.");
return nullptr;
}
prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
@@ -3847,7 +3859,7 @@ PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_,
float softmin,
float softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -3874,7 +3886,7 @@ PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_,
float softmin,
float softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -3934,7 +3946,7 @@ PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_,
float softmin,
float softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -3967,7 +3979,7 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_,
float softmin,
float softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
const int length[2] = {rows, columns};
@@ -4028,7 +4040,7 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_,
float softmin,
float softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -4042,7 +4054,7 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_,
}
else {
/* RNA_def_property_float_default must be called outside */
BLI_assert(default_value == NULL);
BLI_assert(default_value == nullptr);
}
if (hardmin != hardmax) {
RNA_def_property_range(prop, hardmin, hardmax);
@@ -4088,7 +4100,7 @@ PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_,
float softmin,
float softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -4119,7 +4131,7 @@ PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_,
float softmin,
float softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -4155,7 +4167,7 @@ PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_,
float softmin,
float softmax)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
ASSERT_SOFT_HARD_LIMITS;
@@ -4177,7 +4189,7 @@ PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
@@ -4193,7 +4205,7 @@ PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
@@ -4212,7 +4224,7 @@ PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
@@ -4228,7 +4240,7 @@ PropertyRNA *RNA_def_collection_runtime(StructOrFunctionRNA *cont_,
const char *ui_name,
const char *ui_description)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop;
prop = RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
@@ -4247,14 +4259,14 @@ static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier)
FunctionDefRNA *dfunc;
if (DefRNA.preprocess) {
const char *error = NULL;
const char *error = nullptr;
if (!rna_validate_identifier(identifier, false, &error)) {
CLOG_ERROR(&LOG, "function identifier \"%s\" - %s", identifier, error);
DefRNA.error = true;
}
}
func = MEM_callocN(sizeof(FunctionRNA), "FunctionRNA");
func = static_cast<FunctionRNA *>(MEM_callocN(sizeof(FunctionRNA), "FunctionRNA"));
func->identifier = identifier;
func->description = identifier;
@@ -4262,7 +4274,7 @@ static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier)
if (DefRNA.preprocess) {
dsrna = rna_find_struct_def(srna);
dfunc = MEM_callocN(sizeof(FunctionDefRNA), "FunctionDefRNA");
dfunc = static_cast<FunctionDefRNA *>(MEM_callocN(sizeof(FunctionDefRNA), "FunctionDefRNA"));
rna_addtail(&dsrna->functions, dfunc);
dfunc->func = func;
}
@@ -4280,7 +4292,7 @@ FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const cha
if (BLI_findstring_ptr(&srna->functions, identifier, offsetof(FunctionRNA, identifier))) {
CLOG_ERROR(&LOG, "%s.%s already defined.", srna->identifier, identifier);
return NULL;
return nullptr;
}
func = rna_def_function(srna, identifier);
@@ -4331,13 +4343,13 @@ void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
return;
}
BLI_assert(func->c_ret == NULL);
BLI_assert(func->c_ret == nullptr);
func->c_ret = ret;
RNA_def_function_output(func, ret);
}
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
void RNA_def_function_output(FunctionRNA * /*func*/, PropertyRNA *ret)
{
ret->flag_parameter |= PARM_OUTPUT;
}
@@ -4441,15 +4453,16 @@ void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropert
int tot = *totitem;
if (tot == 0) {
*items = MEM_callocN(sizeof(EnumPropertyItem[8]), __func__);
/* Ensure we get crashes on missing calls to 'RNA_enum_item_end', see #74227. */
*items = static_cast<EnumPropertyItem *>(MEM_callocN(sizeof(EnumPropertyItem[8]), __func__));
/* Ensure we get crashes on missing calls to 'RNA_enum_item_end', see #74227. */
#ifdef DEBUG
memset(*items, 0xff, sizeof(EnumPropertyItem[8]));
#endif
}
else if (tot >= 8 && (tot & (tot - 1)) == 0) {
/* Power of two > 8. */
*items = MEM_recallocN_id(*items, sizeof(EnumPropertyItem) * tot * 2, __func__);
*items = static_cast<EnumPropertyItem *>(
MEM_recallocN_id(*items, sizeof(EnumPropertyItem) * tot * 2, __func__));
#ifdef DEBUG
memset((*items) + tot, 0xff, sizeof(EnumPropertyItem) * tot);
#endif
@@ -4489,7 +4502,7 @@ void RNA_enum_items_add_value(EnumPropertyItem **items,
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
{
static const EnumPropertyItem empty = {0, NULL, 0, NULL, NULL};
static const EnumPropertyItem empty = {0, nullptr, 0, nullptr, nullptr};
RNA_enum_item_add(items, totitem, &empty);
}
@@ -4519,8 +4532,8 @@ void RNA_def_struct_free_pointers(BlenderRNA *brna, StructRNA *srna)
if (srna->flag & STRUCT_FREE_POINTERS) {
if (srna->identifier) {
if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
if (brna != NULL) {
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
if (brna != nullptr) {
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, nullptr, nullptr);
}
}
MEM_freeN((void *)srna->identifier);
@@ -4560,7 +4573,7 @@ void RNA_def_func_free_pointers(FunctionRNA *func)
void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA *prop)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
int a;
/* annoying since we just added this to a hash, could make this add the correct key to the hash
@@ -4568,7 +4581,7 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
if (prop->identifier) {
if (cont->prophash) {
prop->identifier = BLI_strdup(prop->identifier);
BLI_ghash_reinsert(cont->prophash, (void *)prop->identifier, prop, NULL, NULL);
BLI_ghash_reinsert(cont->prophash, (void *)prop->identifier, prop, nullptr, nullptr);
}
else {
prop->identifier = BLI_strdup(prop->identifier);
@@ -4587,7 +4600,8 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
if (bprop->defaultarray) {
bool *array = MEM_mallocN(sizeof(bool) * prop->totarraylength, "RNA_def_property_store");
bool *array = static_cast<bool *>(
MEM_mallocN(sizeof(bool) * prop->totarraylength, "RNA_def_property_store"));
memcpy(array, bprop->defaultarray, sizeof(bool) * prop->totarraylength);
bprop->defaultarray = array;
}
@@ -4597,7 +4611,8 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
if (iprop->defaultarray) {
int *array = MEM_mallocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store");
int *array = static_cast<int *>(
MEM_mallocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store"));
memcpy(array, iprop->defaultarray, sizeof(int) * prop->totarraylength);
iprop->defaultarray = array;
}
@@ -4607,8 +4622,8 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
if (eprop->item) {
EnumPropertyItem *array = MEM_mallocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1),
"RNA_def_property_store");
EnumPropertyItem *array = static_cast<EnumPropertyItem *>(MEM_mallocN(
sizeof(EnumPropertyItem) * (eprop->totitem + 1), "RNA_def_property_store"));
memcpy(array, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1));
eprop->item = array;
@@ -4630,7 +4645,8 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
if (fprop->defaultarray) {
float *array = MEM_mallocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store");
float *array = static_cast<float *>(
MEM_mallocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store"));
memcpy(array, fprop->defaultarray, sizeof(float) * prop->totarraylength);
fprop->defaultarray = array;
}
@@ -4650,7 +4666,7 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
prop->flag_internal |= PROP_INTERN_FREE_POINTERS;
}
static void (*g_py_data_clear_fn)(PropertyRNA *prop) = NULL;
static void (*g_py_data_clear_fn)(PropertyRNA *prop) = nullptr;
/**
* Set the callback used to decrement the user count of a property.
@@ -4742,11 +4758,11 @@ void RNA_def_property_free_pointers(PropertyRNA *prop)
static void rna_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
if (prop->flag_internal & PROP_INTERN_RUNTIME) {
if (cont->prophash) {
BLI_ghash_remove(cont->prophash, prop->identifier, NULL, NULL);
BLI_ghash_remove(cont->prophash, prop->identifier, nullptr, nullptr);
}
RNA_def_property_free_pointers(prop);
@@ -4759,20 +4775,22 @@ static void rna_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop)
static PropertyRNA *rna_def_property_find_py_id(ContainerRNA *cont, const char *identifier)
{
for (PropertyRNA *prop = cont->properties.first; prop; prop = prop->next) {
for (PropertyRNA *prop = static_cast<PropertyRNA *>(cont->properties.first); prop;
prop = prop->next)
{
if (STREQ(prop->identifier, identifier)) {
return prop;
}
}
return NULL;
return nullptr;
}
/* NOTE: only intended for removing dynamic props. */
int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *identifier)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop = rna_def_property_find_py_id(cont, identifier);
if (prop != NULL) {
if (prop != nullptr) {
if (prop->flag_internal & PROP_INTERN_RUNTIME) {
rna_def_property_free(cont, prop);
return 1;
@@ -4788,9 +4806,9 @@ int RNA_def_property_free_identifier_deferred_prepare(StructOrFunctionRNA *cont_
const char *identifier,
void **r_handle)
{
ContainerRNA *cont = cont_;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop = rna_def_property_find_py_id(cont, identifier);
if (prop != NULL) {
if (prop != nullptr) {
if (prop->flag_internal & PROP_INTERN_RUNTIME) {
*r_handle = prop;
return 1;
@@ -4804,8 +4822,8 @@ int RNA_def_property_free_identifier_deferred_prepare(StructOrFunctionRNA *cont_
void RNA_def_property_free_identifier_deferred_finish(StructOrFunctionRNA *cont_, void *handle)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop = handle;
ContainerRNA *cont = static_cast<ContainerRNA *>(cont_);
PropertyRNA *prop = static_cast<PropertyRNA *>(handle);
BLI_assert(BLI_findindex(&cont->properties, prop) != -1);
BLI_assert(prop->flag_internal & PROP_INTERN_RUNTIME);
rna_def_property_free(cont, prop);

View File

@@ -2474,7 +2474,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
RNA_def_property_collection_funcs(prop,
nullptr,
nullptr,

View File

@@ -505,7 +505,7 @@ typedef struct CollectionPropertyRNA {
struct StructRNA *item_type; /* the type of this item */
} CollectionPropertyRNA;
/* changes to this struct require updating rna_generate_struct in makesrna.c */
/* changes to this struct require updating rna_generate_struct in makesrna.cc */
struct StructRNA {
/* structs are containers of properties */
ContainerRNA cont;

View File

@@ -2620,7 +2620,7 @@ void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_override_funcs(prop, nullptr, nullptr, "rna_Mesh_materials_override_apply");
RNA_def_property_collection_funcs(prop,

View File

@@ -398,7 +398,7 @@ static void rna_def_metaball(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
RNA_def_property_collection_funcs(prop,
nullptr,
nullptr,

View File

@@ -194,7 +194,7 @@ static void rna_def_pointcloud(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
RNA_def_property_collection_funcs(prop,
nullptr,
nullptr,

View File

@@ -39,7 +39,7 @@ const EnumPropertyItem rna_enum_rigidbody_object_type_items[] = {
0,
"Passive",
"Object is directly controlled by animation system"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* collision shapes of objects in rigid body sim */
@@ -70,7 +70,7 @@ const EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = {
ICON_MESH_DATA,
"Compound Parent",
"Combines all of its direct rigid body children into one rigid object"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* collision shapes of constraints in rigid body sim */
@@ -103,7 +103,7 @@ const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[] = {
"Generic Spring",
"Restrict translation and rotation to specified axes with springs"},
{RBC_TYPE_MOTOR, "MOTOR", ICON_NONE, "Motor", "Drive rigid body around or along an axis"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* bullet spring type */
@@ -118,7 +118,7 @@ static const EnumPropertyItem rna_enum_rigidbody_constraint_spring_type_items[]
ICON_NONE,
"Blender 2.8",
"New implementation available since 2.8"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
#ifndef RNA_RUNTIME
@@ -127,7 +127,7 @@ static const EnumPropertyItem rigidbody_mesh_source_items[] = {
{RBO_MESH_BASE, "BASE", 0, "Base", "Base mesh"},
{RBO_MESH_DEFORM, "DEFORM", 0, "Deform", "Deformations (shape keys, deform modifiers)"},
{RBO_MESH_FINAL, "FINAL", 0, "Final", "All modifiers"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
#endif
@@ -143,14 +143,14 @@ static const EnumPropertyItem rigidbody_mesh_source_items[] = {
/* ******************************** */
static void rna_RigidBodyWorld_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_RigidBodyWorld_reset(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
BKE_rigidbody_cache_reset(rbw);
}
static char *rna_RigidBodyWorld_path(const PointerRNA *UNUSED(ptr))
static char *rna_RigidBodyWorld_path(const PointerRNA * /*ptr*/)
{
return BLI_strdup("rigidbody_world");
}
@@ -163,7 +163,8 @@ static void rna_RigidBodyWorld_num_solver_iterations_set(PointerRNA *ptr, int va
# ifdef WITH_BULLET
if (rbw->shared->physics_world) {
RB_dworld_set_solver_iterations(rbw->shared->physics_world, value);
RB_dworld_set_solver_iterations(static_cast<rbDynamicsWorld *>(rbw->shared->physics_world),
value);
}
# endif
}
@@ -176,7 +177,7 @@ static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, bool value)
# ifdef WITH_BULLET
if (rbw->shared->physics_world) {
RB_dworld_set_split_impulse(rbw->shared->physics_world, value);
RB_dworld_set_split_impulse(static_cast<rbDynamicsWorld *>(rbw->shared->physics_world), value);
}
# endif
}
@@ -201,9 +202,9 @@ static void rna_RigidBodyWorld_constraints_collection_update(Main *bmain,
/* ******************************** */
static void rna_RigidBodyOb_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
static void rna_RigidBodyOb_reset(Main * /*bmain*/, Scene *scene, PointerRNA * /*ptr*/)
{
if (scene != NULL) {
if (scene != nullptr) {
RigidBodyWorld *rbw = scene->rigidbody_world;
BKE_rigidbody_cache_reset(rbw);
}
@@ -219,9 +220,9 @@ static void rna_RigidBodyOb_shape_update(Main *bmain, Scene *scene, PointerRNA *
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
static void rna_RigidBodyOb_shape_reset(Main * /*bmain*/, Scene *scene, PointerRNA *ptr)
{
if (scene != NULL) {
if (scene != nullptr) {
RigidBodyWorld *rbw = scene->rigidbody_world;
BKE_rigidbody_cache_reset(rbw);
}
@@ -242,7 +243,7 @@ static void rna_RigidBodyOb_mesh_source_update(Main *bmain, Scene *scene, Pointe
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
static char *rna_RigidBodyOb_path(const PointerRNA *UNUSED(ptr))
static char *rna_RigidBodyOb_path(const PointerRNA * /*ptr*/)
{
/* NOTE: this hardcoded path should work as long as only Objects have this */
return BLI_strdup("rigid_body");
@@ -273,8 +274,8 @@ static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, bool value)
# ifdef WITH_BULLET
/* update kinematic state if necessary - only needed for active bodies */
if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
RB_body_set_kinematic_state(rbo->shared->physics_object, !value);
RB_body_set_mass(static_cast<rbRigidBody *>(rbo->shared->physics_object), RBO_GET_MASS(rbo));
RB_body_set_kinematic_state(static_cast<rbRigidBody *>(rbo->shared->physics_object), !value);
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
# endif
@@ -289,7 +290,7 @@ static void rna_RigidBodyOb_mass_set(PointerRNA *ptr, float value)
# ifdef WITH_BULLET
/* only active bodies need mass update */
if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
RB_body_set_mass(static_cast<rbRigidBody *>(rbo->shared->physics_object), RBO_GET_MASS(rbo));
}
# endif
}
@@ -302,7 +303,7 @@ static void rna_RigidBodyOb_friction_set(PointerRNA *ptr, float value)
# ifdef WITH_BULLET
if (rbo->shared->physics_object) {
RB_body_set_friction(rbo->shared->physics_object, value);
RB_body_set_friction(static_cast<rbRigidBody *>(rbo->shared->physics_object), value);
}
# endif
}
@@ -314,7 +315,7 @@ static void rna_RigidBodyOb_restitution_set(PointerRNA *ptr, float value)
rbo->restitution = value;
# ifdef WITH_BULLET
if (rbo->shared->physics_object) {
RB_body_set_restitution(rbo->shared->physics_object, value);
RB_body_set_restitution(static_cast<rbRigidBody *>(rbo->shared->physics_object), value);
}
# endif
}
@@ -327,7 +328,8 @@ static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value)
# ifdef WITH_BULLET
if (rbo->shared->physics_shape) {
RB_shape_set_margin(rbo->shared->physics_shape, RBO_GET_MARGIN(rbo));
RB_shape_set_margin(static_cast<rbCollisionShape *>(rbo->shared->physics_shape),
RBO_GET_MARGIN(rbo));
}
# endif
}
@@ -357,8 +359,8 @@ static void rna_RigidBodyOb_kinematic_state_set(PointerRNA *ptr, bool value)
# ifdef WITH_BULLET
/* update kinematic state if necessary */
if (rbo->shared->physics_object) {
RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
RB_body_set_kinematic_state(rbo->shared->physics_object, value);
RB_body_set_mass(static_cast<rbRigidBody *>(rbo->shared->physics_object), RBO_GET_MASS(rbo));
RB_body_set_kinematic_state(static_cast<rbRigidBody *>(rbo->shared->physics_object), value);
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
# endif
@@ -373,7 +375,7 @@ static void rna_RigidBodyOb_activation_state_set(PointerRNA *ptr, bool value)
# ifdef WITH_BULLET
/* update activation state if necessary - only active bodies can be deactivated */
if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_activation_state(rbo->shared->physics_object, value);
RB_body_set_activation_state(static_cast<rbRigidBody *>(rbo->shared->physics_object), value);
}
# endif
}
@@ -387,7 +389,8 @@ static void rna_RigidBodyOb_linear_sleepThresh_set(PointerRNA *ptr, float value)
# ifdef WITH_BULLET
/* only active bodies need sleep threshold update */
if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_linear_sleep_thresh(rbo->shared->physics_object, value);
RB_body_set_linear_sleep_thresh(static_cast<rbRigidBody *>(rbo->shared->physics_object),
value);
}
# endif
}
@@ -401,7 +404,8 @@ static void rna_RigidBodyOb_angular_sleepThresh_set(PointerRNA *ptr, float value
# ifdef WITH_BULLET
/* only active bodies need sleep threshold update */
if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_angular_sleep_thresh(rbo->shared->physics_object, value);
RB_body_set_angular_sleep_thresh(static_cast<rbRigidBody *>(rbo->shared->physics_object),
value);
}
# endif
}
@@ -415,7 +419,7 @@ static void rna_RigidBodyOb_linear_damping_set(PointerRNA *ptr, float value)
# ifdef WITH_BULLET
/* only active bodies need damping update */
if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_linear_damping(rbo->shared->physics_object, value);
RB_body_set_linear_damping(static_cast<rbRigidBody *>(rbo->shared->physics_object), value);
}
# endif
}
@@ -429,12 +433,12 @@ static void rna_RigidBodyOb_angular_damping_set(PointerRNA *ptr, float value)
# ifdef WITH_BULLET
/* only active bodies need damping update */
if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_angular_damping(rbo->shared->physics_object, value);
RB_body_set_angular_damping(static_cast<rbRigidBody *>(rbo->shared->physics_object), value);
}
# endif
}
static char *rna_RigidBodyCon_path(const PointerRNA *UNUSED(ptr))
static char *rna_RigidBodyCon_path(const PointerRNA * /*ptr*/)
{
/* NOTE: this hardcoded path should work as long as only Objects have this */
return BLI_strdup("rigid_body_constraint");
@@ -464,7 +468,7 @@ static void rna_RigidBodyCon_enabled_set(PointerRNA *ptr, bool value)
# ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_enabled(rbc->physics_constraint, value);
RB_constraint_set_enabled(static_cast<rbConstraint *>(rbc->physics_constraint), value);
}
# endif
}
@@ -486,7 +490,8 @@ static void rna_RigidBodyCon_use_breaking_set(PointerRNA *ptr, bool value)
rbc->flag |= RBC_FLAG_USE_BREAKING;
# ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_breaking_threshold(rbc->physics_constraint, rbc->breaking_threshold);
RB_constraint_set_breaking_threshold(static_cast<rbConstraint *>(rbc->physics_constraint),
rbc->breaking_threshold);
}
# endif
}
@@ -494,7 +499,8 @@ static void rna_RigidBodyCon_use_breaking_set(PointerRNA *ptr, bool value)
rbc->flag &= ~RBC_FLAG_USE_BREAKING;
# ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_breaking_threshold(rbc->physics_constraint, FLT_MAX);
RB_constraint_set_breaking_threshold(static_cast<rbConstraint *>(rbc->physics_constraint),
FLT_MAX);
}
# endif
}
@@ -508,7 +514,8 @@ static void rna_RigidBodyCon_breaking_threshold_set(PointerRNA *ptr, float value
# ifdef WITH_BULLET
if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_USE_BREAKING)) {
RB_constraint_set_breaking_threshold(rbc->physics_constraint, value);
RB_constraint_set_breaking_threshold(static_cast<rbConstraint *>(rbc->physics_constraint),
value);
}
# endif
}
@@ -521,7 +528,8 @@ static void rna_RigidBodyCon_override_solver_iterations_set(PointerRNA *ptr, boo
rbc->flag |= RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
# ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_solver_iterations(rbc->physics_constraint, rbc->num_solver_iterations);
RB_constraint_set_solver_iterations(static_cast<rbConstraint *>(rbc->physics_constraint),
rbc->num_solver_iterations);
}
# endif
}
@@ -529,7 +537,8 @@ static void rna_RigidBodyCon_override_solver_iterations_set(PointerRNA *ptr, boo
rbc->flag &= ~RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
# ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_solver_iterations(rbc->physics_constraint, -1);
RB_constraint_set_solver_iterations(static_cast<rbConstraint *>(rbc->physics_constraint),
-1);
}
# endif
}
@@ -543,7 +552,8 @@ static void rna_RigidBodyCon_num_solver_iterations_set(PointerRNA *ptr, int valu
# ifdef WITH_BULLET
if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS)) {
RB_constraint_set_solver_iterations(rbc->physics_constraint, value);
RB_constraint_set_solver_iterations(static_cast<rbConstraint *>(rbc->physics_constraint),
value);
}
# endif
}
@@ -557,10 +567,12 @@ static void rna_RigidBodyCon_do_set_spring_stiffness(RigidBodyCon *rbc,
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & flag)) {
switch (rbc->spring_type) {
case RBC_SPRING_TYPE1:
RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, axis, value);
RB_constraint_set_stiffness_6dof_spring(
static_cast<rbConstraint *>(rbc->physics_constraint), axis, value);
break;
case RBC_SPRING_TYPE2:
RB_constraint_set_stiffness_6dof_spring2(rbc->physics_constraint, axis, value);
RB_constraint_set_stiffness_6dof_spring2(
static_cast<rbConstraint *>(rbc->physics_constraint), axis, value);
break;
}
}
@@ -642,10 +654,12 @@ static void rna_RigidBodyCon_do_set_spring_damping(RigidBodyCon *rbc,
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & flag)) {
switch (rbc->spring_type) {
case RBC_SPRING_TYPE1:
RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, axis, value);
RB_constraint_set_damping_6dof_spring(
static_cast<rbConstraint *>(rbc->physics_constraint), axis, value);
break;
case RBC_SPRING_TYPE2:
RB_constraint_set_damping_6dof_spring2(rbc->physics_constraint, axis, value);
RB_constraint_set_damping_6dof_spring2(
static_cast<rbConstraint *>(rbc->physics_constraint), axis, value);
break;
}
}
@@ -723,7 +737,7 @@ static void rna_RigidBodyCon_motor_lin_max_impulse_set(PointerRNA *ptr, float va
# ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
RB_constraint_set_max_impulse_motor(
rbc->physics_constraint, value, rbc->motor_ang_max_impulse);
static_cast<rbConstraint *>(rbc->physics_constraint), value, rbc->motor_ang_max_impulse);
}
# endif
}
@@ -736,7 +750,7 @@ static void rna_RigidBodyCon_use_motor_lin_set(PointerRNA *ptr, bool value)
# ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_enable_motor(rbc->physics_constraint,
RB_constraint_set_enable_motor(static_cast<rbConstraint *>(rbc->physics_constraint),
rbc->flag & RBC_FLAG_USE_MOTOR_LIN,
rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
}
@@ -751,7 +765,7 @@ static void rna_RigidBodyCon_use_motor_ang_set(PointerRNA *ptr, bool value)
# ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_enable_motor(rbc->physics_constraint,
RB_constraint_set_enable_motor(static_cast<rbConstraint *>(rbc->physics_constraint),
rbc->flag & RBC_FLAG_USE_MOTOR_LIN,
rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
}
@@ -766,8 +780,9 @@ static void rna_RigidBodyCon_motor_lin_target_velocity_set(PointerRNA *ptr, floa
# ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
RB_constraint_set_target_velocity_motor(
rbc->physics_constraint, value, rbc->motor_ang_target_velocity);
RB_constraint_set_target_velocity_motor(static_cast<rbConstraint *>(rbc->physics_constraint),
value,
rbc->motor_ang_target_velocity);
}
# endif
}
@@ -781,7 +796,7 @@ static void rna_RigidBodyCon_motor_ang_max_impulse_set(PointerRNA *ptr, float va
# ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
RB_constraint_set_max_impulse_motor(
rbc->physics_constraint, rbc->motor_lin_max_impulse, value);
static_cast<rbConstraint *>(rbc->physics_constraint), rbc->motor_lin_max_impulse, value);
}
# endif
}
@@ -794,8 +809,9 @@ static void rna_RigidBodyCon_motor_ang_target_velocity_set(PointerRNA *ptr, floa
# ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
RB_constraint_set_target_velocity_motor(
rbc->physics_constraint, rbc->motor_lin_target_velocity, value);
RB_constraint_set_target_velocity_motor(static_cast<rbConstraint *>(rbc->physics_constraint),
rbc->motor_lin_target_velocity,
value);
}
# endif
}
@@ -814,9 +830,9 @@ static void rna_RigidBodyWorld_convex_sweep_test(RigidBodyWorld *rbw,
# ifdef WITH_BULLET
RigidBodyOb *rob = object->rigidbody_object;
if (rbw->shared->physics_world != NULL && rob->shared->physics_object != NULL) {
RB_world_convex_sweep_test(rbw->shared->physics_world,
rob->shared->physics_object,
if (rbw->shared->physics_world != nullptr && rob->shared->physics_object != nullptr) {
RB_world_convex_sweep_test(static_cast<rbDynamicsWorld *>(rbw->shared->physics_world),
static_cast<rbRigidBody *>(rob->shared->physics_object),
ray_start,
ray_end,
r_location,
@@ -843,7 +859,7 @@ static void rna_RigidBodyWorld_convex_sweep_test(RigidBodyWorld *rbw,
static PointerRNA rna_RigidBodyWorld_PointCache_get(PointerRNA *ptr)
{
RigidBodyWorld *rbw = ptr->data;
RigidBodyWorld *rbw = static_cast<RigidBodyWorld *>(ptr->data);
return rna_pointer_inherit_refine(ptr, &RNA_PointCache, rbw->shared->pointcache);
}
@@ -857,7 +873,7 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
FunctionRNA *func;
PropertyRNA *parm;
srna = RNA_def_struct(brna, "RigidBodyWorld", NULL);
srna = RNA_def_struct(brna, "RigidBodyWorld", nullptr);
RNA_def_struct_sdna(srna, "RigidBodyWorld");
RNA_def_struct_ui_text(
srna, "Rigid Body World", "Self-contained rigid body simulation environment and settings");
@@ -866,7 +882,7 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
/* groups */
prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_pointer_sdna(prop, NULL, "group");
RNA_def_property_pointer_sdna(prop, nullptr, "group");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK | PROP_ID_REFCOUNT);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(
@@ -883,13 +899,13 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
/* booleans */
prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBW_FLAG_MUTED);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", RBW_FLAG_MUTED);
RNA_def_property_ui_text(prop, "Enabled", "Simulation will be evaluated");
RNA_def_property_update(prop, NC_SCENE, NULL);
RNA_def_property_update(prop, NC_SCENE, nullptr);
/* time scale */
prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "time_scale");
RNA_def_property_float_sdna(prop, nullptr, "time_scale");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
RNA_def_property_float_default(prop, 1.0f);
@@ -898,7 +914,7 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
/* timestep */
prop = RNA_def_property(srna, "substeps_per_frame", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "substeps_per_frame");
RNA_def_property_int_sdna(prop, nullptr, "substeps_per_frame");
RNA_def_property_range(prop, 1, SHRT_MAX);
RNA_def_property_ui_range(prop, 1, 1000, 1, -1);
RNA_def_property_int_default(prop, 10);
@@ -911,11 +927,12 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
/* constraint solver iterations */
prop = RNA_def_property(srna, "solver_iterations", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
RNA_def_property_int_sdna(prop, nullptr, "num_solver_iterations");
RNA_def_property_range(prop, 1, 1000);
RNA_def_property_ui_range(prop, 10, 100, 1, -1);
RNA_def_property_int_default(prop, 10);
RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyWorld_num_solver_iterations_set", NULL);
RNA_def_property_int_funcs(
prop, nullptr, "rna_RigidBodyWorld_num_solver_iterations_set", nullptr);
RNA_def_property_ui_text(
prop,
"Solver Iterations",
@@ -925,8 +942,8 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
/* split impulse */
prop = RNA_def_property(srna, "use_split_impulse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBW_FLAG_USE_SPLIT_IMPULSE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyWorld_split_impulse_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBW_FLAG_USE_SPLIT_IMPULSE);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyWorld_split_impulse_set");
RNA_def_property_ui_text(
prop,
"Split Impulse",
@@ -937,7 +954,8 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
/* cache */
prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_funcs(prop, "rna_RigidBodyWorld_PointCache_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(
prop, "rna_RigidBodyWorld_PointCache_get", nullptr, nullptr, nullptr);
RNA_def_property_struct_type(prop, "PointCache");
RNA_def_property_ui_text(prop, "Point Cache", "");
@@ -956,47 +974,47 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
parm = RNA_def_pointer(
func, "object", "Object", "", "Rigidbody object with a convex collision shape");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
/* ray start and end */
parm = RNA_def_float_vector(func, "start", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_float_vector(func, "end", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_float_vector(func, "start", 3, nullptr, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_float_vector(func, "end", 3, nullptr, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_float_vector(func,
"object_location",
3,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Location",
"The hit location of this sweep test",
-1e4,
1e4);
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
RNA_def_function_output(func, parm);
parm = RNA_def_float_vector(func,
"hitpoint",
3,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Hitpoint",
"The hit location of this sweep test",
-1e4,
1e4);
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
RNA_def_function_output(func, parm);
parm = RNA_def_float_vector(func,
"normal",
3,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Normal",
"The face normal at the sweep test hit location",
-1e4,
1e4);
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
RNA_def_function_output(func, parm);
parm = RNA_def_int(func,
"has_hit",
@@ -1015,7 +1033,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "RigidBodyObject", NULL);
srna = RNA_def_struct(brna, "RigidBodyObject", nullptr);
RNA_def_struct_sdna(srna, "RigidBodyOb");
RNA_def_struct_ui_text(
srna, "Rigid Body Object", "Settings for object participating in Rigid Body Simulation");
@@ -1023,15 +1041,15 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
/* Enums */
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_sdna(prop, nullptr, "type");
RNA_def_property_enum_items(prop, rna_enum_rigidbody_object_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_type_set", NULL);
RNA_def_property_enum_funcs(prop, nullptr, "rna_RigidBodyOb_type_set", nullptr);
RNA_def_property_ui_text(prop, "Type", "Role of object in Rigid Body Simulations");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "mesh_source", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mesh_source");
RNA_def_property_enum_sdna(prop, nullptr, "mesh_source");
RNA_def_property_enum_items(prop, rigidbody_mesh_source_items);
RNA_def_property_ui_text(
prop, "Mesh Source", "Source of the mesh used to create collision shape");
@@ -1040,38 +1058,38 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
/* booleans */
prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBO_FLAG_DISABLED);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_disabled_set");
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", RBO_FLAG_DISABLED);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyOb_disabled_set");
RNA_def_property_ui_text(prop, "Enabled", "Rigid Body actively participates to the simulation");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shape");
RNA_def_property_enum_sdna(prop, nullptr, "shape");
RNA_def_property_enum_items(prop, rna_enum_rigidbody_object_shape_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_shape_set", NULL);
RNA_def_property_enum_funcs(prop, nullptr, "rna_RigidBodyOb_shape_set", nullptr);
RNA_def_property_ui_text(
prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_update");
prop = RNA_def_property(srna, "kinematic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_KINEMATIC);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_kinematic_state_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBO_FLAG_KINEMATIC);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyOb_kinematic_state_set");
RNA_def_property_ui_text(
prop, "Kinematic", "Allow rigid body to be controlled by the animation system");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEFORM);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBO_FLAG_USE_DEFORM);
RNA_def_property_ui_text(prop, "Deforming", "Rigid body deforms during simulation");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
/* Physics Parameters */
prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
RNA_def_property_float_sdna(prop, NULL, "mass");
RNA_def_property_float_sdna(prop, nullptr, "mass");
RNA_def_property_range(prop, 0.001f, FLT_MAX); /* range must always be positive (and non-zero) */
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_mass_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyOb_mass_set", nullptr);
RNA_def_property_ui_text(prop, "Mass", "How much the object 'weighs' irrespective of gravity");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
@@ -1080,9 +1098,9 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
/* Dynamics Parameters - Deactivation */
prop = RNA_def_property(srna, "use_deactivation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEACTIVATION);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBO_FLAG_USE_DEACTIVATION);
RNA_def_property_boolean_default(prop, true);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_activation_state_set");
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyOb_activation_state_set");
RNA_def_property_ui_text(
prop,
"Enable Deactivation",
@@ -1091,29 +1109,29 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_start_deactivated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_START_DEACTIVATED);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBO_FLAG_START_DEACTIVATED);
RNA_def_property_ui_text(
prop, "Start Deactivated", "Deactivate rigid body at the start of the simulation");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "deactivate_linear_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
RNA_def_property_float_sdna(prop, NULL, "lin_sleep_thresh");
RNA_def_property_float_sdna(prop, nullptr, "lin_sleep_thresh");
RNA_def_property_range(
prop, FLT_MIN, FLT_MAX); /* range must always be positive (and non-zero) */
RNA_def_property_float_default(prop, 0.4f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_sleepThresh_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyOb_linear_sleepThresh_set", nullptr);
RNA_def_property_ui_text(prop,
"Linear Velocity Deactivation Threshold",
"Linear Velocity below which simulation stops simulating object");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "deactivate_angular_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
RNA_def_property_float_sdna(prop, NULL, "ang_sleep_thresh");
RNA_def_property_float_sdna(prop, nullptr, "ang_sleep_thresh");
RNA_def_property_range(
prop, FLT_MIN, FLT_MAX); /* range must always be positive (and non-zero) */
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_sleepThresh_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyOb_angular_sleepThresh_set", nullptr);
RNA_def_property_ui_text(prop,
"Angular Velocity Deactivation Threshold",
"Angular Velocity below which simulation stops simulating object");
@@ -1121,39 +1139,39 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
/* Dynamics Parameters - Damping Parameters */
prop = RNA_def_property(srna, "linear_damping", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "lin_damping");
RNA_def_property_float_sdna(prop, nullptr, "lin_damping");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_float_default(prop, 0.04f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_damping_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyOb_linear_damping_set", nullptr);
RNA_def_property_ui_text(
prop, "Linear Damping", "Amount of linear velocity that is lost over time");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "angular_damping", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "ang_damping");
RNA_def_property_float_sdna(prop, nullptr, "ang_damping");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_float_default(prop, 0.1f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_damping_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyOb_angular_damping_set", nullptr);
RNA_def_property_ui_text(
prop, "Angular Damping", "Amount of angular velocity that is lost over time");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
/* Collision Parameters - Surface Parameters */
prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "friction");
RNA_def_property_float_sdna(prop, nullptr, "friction");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_friction_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyOb_friction_set", nullptr);
RNA_def_property_ui_text(prop, "Friction", "Resistance of object to movement");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "restitution", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "restitution");
RNA_def_property_float_sdna(prop, nullptr, "restitution");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
RNA_def_property_float_default(prop, 0.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_restitution_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyOb_restitution_set", nullptr);
RNA_def_property_ui_text(prop,
"Bounciness",
"Tendency of object to bounce after colliding with another "
@@ -1162,7 +1180,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
/* Collision Parameters - Sensitivity */
prop = RNA_def_property(srna, "use_margin", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_MARGIN);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBO_FLAG_USE_MARGIN);
RNA_def_property_boolean_default(prop, false);
RNA_def_property_ui_text(
prop,
@@ -1171,11 +1189,11 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "margin");
RNA_def_property_float_sdna(prop, nullptr, "margin");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3);
RNA_def_property_float_default(prop, 0.04f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_collision_margin_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyOb_collision_margin_set", nullptr);
RNA_def_property_ui_text(
prop,
"Collision Margin",
@@ -1184,9 +1202,9 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
prop = RNA_def_property(srna, "collision_collections", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "col_groups", 1);
RNA_def_property_boolean_sdna(prop, nullptr, "col_groups", 1);
RNA_def_property_array(prop, 20);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_collision_collections_set");
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyOb_collision_collections_set");
RNA_def_property_ui_text(
prop, "Collision Collections", "Collision collections rigid body belongs to");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
@@ -1198,7 +1216,7 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "RigidBodyConstraint", NULL);
srna = RNA_def_struct(brna, "RigidBodyConstraint", nullptr);
RNA_def_struct_sdna(srna, "RigidBodyCon");
RNA_def_struct_ui_text(srna,
"Rigid Body Constraint",
@@ -1207,43 +1225,43 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
/* Enums */
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_sdna(prop, nullptr, "type");
RNA_def_property_enum_items(prop, rna_enum_rigidbody_constraint_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyCon_type_set", NULL);
RNA_def_property_enum_funcs(prop, nullptr, "rna_RigidBodyCon_type_set", nullptr);
RNA_def_property_ui_text(prop, "Type", "Type of Rigid Body Constraint");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spring_type");
RNA_def_property_enum_sdna(prop, nullptr, "spring_type");
RNA_def_property_enum_items(prop, rna_enum_rigidbody_constraint_spring_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyCon_spring_type_set", NULL);
RNA_def_property_enum_funcs(prop, nullptr, "rna_RigidBodyCon_spring_type_set", nullptr);
RNA_def_property_ui_text(prop, "Spring Type", "Which implementation of spring to use");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_ENABLED);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_enabled_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_ENABLED);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyCon_enabled_set");
RNA_def_property_ui_text(prop, "Enabled", "Enable this constraint");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "disable_collisions", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_DISABLE_COLLISIONS);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_disable_collisions_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_DISABLE_COLLISIONS);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyCon_disable_collisions_set");
RNA_def_property_ui_text(
prop, "Disable Collisions", "Disable collisions between constrained rigid bodies");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "object1", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ob1");
RNA_def_property_pointer_sdna(prop, nullptr, "ob1");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "Object 1", "First Rigid Body Object to be constrained");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "object2", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ob2");
RNA_def_property_pointer_sdna(prop, nullptr, "ob2");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "Object 2", "Second Rigid Body Object to be constrained");
@@ -1251,18 +1269,18 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
/* Breaking Threshold */
prop = RNA_def_property(srna, "use_breaking", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_BREAKING);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_breaking_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_BREAKING);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyCon_use_breaking_set");
RNA_def_property_ui_text(
prop, "Breakable", "Constraint can be broken if it receives an impulse above the threshold");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "breaking_threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "breaking_threshold");
RNA_def_property_float_sdna(prop, nullptr, "breaking_threshold");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 100.0, 2);
RNA_def_property_float_default(prop, 10.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_breaking_threshold_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyCon_breaking_threshold_set", nullptr);
RNA_def_property_ui_text(prop,
"Breaking Threshold",
"Impulse threshold that must be reached for the constraint to break");
@@ -1270,19 +1288,19 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
/* Solver Iterations */
prop = RNA_def_property(srna, "use_override_solver_iterations", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_override_solver_iterations_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyCon_override_solver_iterations_set");
RNA_def_property_ui_text(prop,
"Override Solver Iterations",
"Override the number of solver iterations for this constraint");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "solver_iterations", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
RNA_def_property_int_sdna(prop, nullptr, "num_solver_iterations");
RNA_def_property_range(prop, 1, 1000);
RNA_def_property_ui_range(prop, 1, 100, 1, -1);
RNA_def_property_int_default(prop, 10);
RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyCon_num_solver_iterations_set", NULL);
RNA_def_property_int_funcs(prop, nullptr, "rna_RigidBodyCon_num_solver_iterations_set", nullptr);
RNA_def_property_ui_text(
prop,
"Solver Iterations",
@@ -1292,290 +1310,300 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
/* Limits */
prop = RNA_def_property(srna, "use_limit_lin_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_X);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_LIMIT_LIN_X);
RNA_def_property_ui_text(prop, "X Axis", "Limit translation on X axis");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_limit_lin_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Y);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_LIMIT_LIN_Y);
RNA_def_property_ui_text(prop, "Y Axis", "Limit translation on Y axis");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_limit_lin_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Z);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_LIMIT_LIN_Z);
RNA_def_property_ui_text(prop, "Z Axis", "Limit translation on Z axis");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_limit_ang_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_X);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_LIMIT_ANG_X);
RNA_def_property_ui_text(prop, "X Angle", "Limit rotation around X axis");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_limit_ang_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Y);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_LIMIT_ANG_Y);
RNA_def_property_ui_text(prop, "Y Angle", "Limit rotation around Y axis");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_limit_ang_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Z);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_LIMIT_ANG_Z);
RNA_def_property_ui_text(prop, "Z Angle", "Limit rotation around Z axis");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_spring_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_X);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_SPRING_X);
RNA_def_property_ui_text(prop, "X Spring", "Enable spring on X axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_spring_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Y);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_SPRING_Y);
RNA_def_property_ui_text(prop, "Y Spring", "Enable spring on Y axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_spring_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Z);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_SPRING_Z);
RNA_def_property_ui_text(prop, "Z Spring", "Enable spring on Z axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_spring_ang_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_X);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_SPRING_ANG_X);
RNA_def_property_ui_text(prop, "X Angle Spring", "Enable spring on X rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_spring_ang_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_Y);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_SPRING_ANG_Y);
RNA_def_property_ui_text(prop, "Y Angle Spring", "Enable spring on Y rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_spring_ang_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_Z);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_SPRING_ANG_Z);
RNA_def_property_ui_text(prop, "Z Angle Spring", "Enable spring on Z rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_motor_lin", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_LIN);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_lin_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_MOTOR_LIN);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyCon_use_motor_lin_set");
RNA_def_property_ui_text(prop, "Linear Motor", "Enable linear motor");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "use_motor_ang", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_ANG);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_ang_set");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RBC_FLAG_USE_MOTOR_ANG);
RNA_def_property_boolean_funcs(prop, nullptr, "rna_RigidBodyCon_use_motor_ang_set");
RNA_def_property_ui_text(prop, "Angular Motor", "Enable angular motor");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_lin_x_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_lower");
RNA_def_property_float_sdna(prop, nullptr, "limit_lin_x_lower");
RNA_def_property_float_default(prop, -1.0f);
RNA_def_property_ui_text(prop, "Lower X Limit", "Lower limit of X axis translation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_lin_x_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_upper");
RNA_def_property_float_sdna(prop, nullptr, "limit_lin_x_upper");
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Upper X Limit", "Upper limit of X axis translation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_lin_y_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_lower");
RNA_def_property_float_sdna(prop, nullptr, "limit_lin_y_lower");
RNA_def_property_float_default(prop, -1.0f);
RNA_def_property_ui_text(prop, "Lower Y Limit", "Lower limit of Y axis translation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_lin_y_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_upper");
RNA_def_property_float_sdna(prop, nullptr, "limit_lin_y_upper");
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Upper Y Limit", "Upper limit of Y axis translation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_lin_z_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_lower");
RNA_def_property_float_sdna(prop, nullptr, "limit_lin_z_lower");
RNA_def_property_float_default(prop, -1.0f);
RNA_def_property_ui_text(prop, "Lower Z Limit", "Lower limit of Z axis translation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_lin_z_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_upper");
RNA_def_property_float_sdna(prop, nullptr, "limit_lin_z_upper");
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Upper Z Limit", "Upper limit of Z axis translation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_ang_x_lower", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_lower");
RNA_def_property_float_sdna(prop, nullptr, "limit_ang_x_lower");
RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
RNA_def_property_float_default(prop, -M_PI_4);
RNA_def_property_ui_text(prop, "Lower X Angle Limit", "Lower limit of X axis rotation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_ang_x_upper", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_upper");
RNA_def_property_float_sdna(prop, nullptr, "limit_ang_x_upper");
RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
RNA_def_property_float_default(prop, M_PI_4);
RNA_def_property_ui_text(prop, "Upper X Angle Limit", "Upper limit of X axis rotation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_ang_y_lower", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_lower");
RNA_def_property_float_sdna(prop, nullptr, "limit_ang_y_lower");
RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
RNA_def_property_float_default(prop, -M_PI_4);
RNA_def_property_ui_text(prop, "Lower Y Angle Limit", "Lower limit of Y axis rotation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_ang_y_upper", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_upper");
RNA_def_property_float_sdna(prop, nullptr, "limit_ang_y_upper");
RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
RNA_def_property_float_default(prop, M_PI_4);
RNA_def_property_ui_text(prop, "Upper Y Angle Limit", "Upper limit of Y axis rotation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_ang_z_lower", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_lower");
RNA_def_property_float_sdna(prop, nullptr, "limit_ang_z_lower");
RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
RNA_def_property_float_default(prop, -M_PI_4);
RNA_def_property_ui_text(prop, "Lower Z Angle Limit", "Lower limit of Z axis rotation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "limit_ang_z_upper", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_upper");
RNA_def_property_float_sdna(prop, nullptr, "limit_ang_z_upper");
RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
RNA_def_property_float_default(prop, M_PI_4);
RNA_def_property_ui_text(prop, "Upper Z Angle Limit", "Upper limit of Z axis rotation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_stiffness_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_x");
RNA_def_property_float_sdna(prop, nullptr, "spring_stiffness_x");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 10.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_x_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyCon_spring_stiffness_x_set", nullptr);
RNA_def_property_ui_text(prop, "X Axis Stiffness", "Stiffness on the X axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_stiffness_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_y");
RNA_def_property_float_sdna(prop, nullptr, "spring_stiffness_y");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 10.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_y_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyCon_spring_stiffness_y_set", nullptr);
RNA_def_property_ui_text(prop, "Y Axis Stiffness", "Stiffness on the Y axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_stiffness_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_z");
RNA_def_property_float_sdna(prop, nullptr, "spring_stiffness_z");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 10.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_z_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyCon_spring_stiffness_z_set", nullptr);
RNA_def_property_ui_text(prop, "Z Axis Stiffness", "Stiffness on the Z axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_stiffness_ang_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_x");
RNA_def_property_float_sdna(prop, nullptr, "spring_stiffness_ang_x");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 10.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_x_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_spring_stiffness_ang_x_set", nullptr);
RNA_def_property_ui_text(prop, "X Angle Stiffness", "Stiffness on the X rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_stiffness_ang_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_y");
RNA_def_property_float_sdna(prop, nullptr, "spring_stiffness_ang_y");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 10.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_y_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_spring_stiffness_ang_y_set", nullptr);
RNA_def_property_ui_text(prop, "Y Angle Stiffness", "Stiffness on the Y rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_stiffness_ang_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_z");
RNA_def_property_float_sdna(prop, nullptr, "spring_stiffness_ang_z");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 10.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_z_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_spring_stiffness_ang_z_set", nullptr);
RNA_def_property_ui_text(prop, "Z Angle Stiffness", "Stiffness on the Z rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_damping_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_damping_x");
RNA_def_property_float_sdna(prop, nullptr, "spring_damping_x");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_x_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyCon_spring_damping_x_set", nullptr);
RNA_def_property_ui_text(prop, "Damping X", "Damping on the X axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_damping_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_damping_y");
RNA_def_property_float_sdna(prop, nullptr, "spring_damping_y");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_y_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyCon_spring_damping_y_set", nullptr);
RNA_def_property_ui_text(prop, "Damping Y", "Damping on the Y axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_damping_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_damping_z");
RNA_def_property_float_sdna(prop, nullptr, "spring_damping_z");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_z_set", NULL);
RNA_def_property_float_funcs(prop, nullptr, "rna_RigidBodyCon_spring_damping_z_set", nullptr);
RNA_def_property_ui_text(prop, "Damping Z", "Damping on the Z axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_damping_ang_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_x");
RNA_def_property_float_sdna(prop, nullptr, "spring_damping_ang_x");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_x_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_spring_damping_ang_x_set", nullptr);
RNA_def_property_ui_text(prop, "Damping X Angle", "Damping on the X rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_damping_ang_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_y");
RNA_def_property_float_sdna(prop, nullptr, "spring_damping_ang_y");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_y_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_spring_damping_ang_y_set", nullptr);
RNA_def_property_ui_text(prop, "Damping Y Angle", "Damping on the Y rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "spring_damping_ang_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_z");
RNA_def_property_float_sdna(prop, nullptr, "spring_damping_ang_z");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_z_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_spring_damping_ang_z_set", nullptr);
RNA_def_property_ui_text(prop, "Damping Z Angle", "Damping on the Z rotational axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "motor_lin_target_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
RNA_def_property_float_sdna(prop, NULL, "motor_lin_target_velocity");
RNA_def_property_float_sdna(prop, nullptr, "motor_lin_target_velocity");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_target_velocity_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_motor_lin_target_velocity_set", nullptr);
RNA_def_property_ui_text(prop, "Target Velocity", "Target linear motor velocity");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "motor_lin_max_impulse", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "motor_lin_max_impulse");
RNA_def_property_float_sdna(prop, nullptr, "motor_lin_max_impulse");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_max_impulse_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_motor_lin_max_impulse_set", nullptr);
RNA_def_property_ui_text(prop, "Max Impulse", "Maximum linear motor impulse");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "motor_ang_target_velocity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "motor_ang_target_velocity");
RNA_def_property_float_sdna(prop, nullptr, "motor_ang_target_velocity");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_target_velocity_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_motor_ang_target_velocity_set", nullptr);
RNA_def_property_ui_text(prop, "Target Velocity", "Target angular motor velocity");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "motor_ang_max_impulse", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "motor_ang_max_impulse");
RNA_def_property_float_sdna(prop, nullptr, "motor_ang_max_impulse");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_max_impulse_set", NULL);
RNA_def_property_float_funcs(
prop, nullptr, "rna_RigidBodyCon_motor_ang_max_impulse_set", nullptr);
RNA_def_property_ui_text(prop, "Max Impulse", "Maximum angular motor impulse");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
}

View File

@@ -27,14 +27,14 @@
/* Reuse for dynamic types. */
const EnumPropertyItem DummyRNA_NULL_items[] = {
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* Reuse for dynamic types with default value. */
const EnumPropertyItem DummyRNA_DEFAULT_items[] = {
{0, "DEFAULT", 0, "Default", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/** \} */
@@ -51,7 +51,7 @@ const EnumPropertyItem rna_enum_property_type_items[] = {
{PROP_ENUM, "ENUM", 0, "Enumeration", ""},
{PROP_POINTER, "POINTER", 0, "Pointer", ""},
{PROP_COLLECTION, "COLLECTION", 0, "Collection", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* Wraps multiple enums onto a single line in a way that is difficult to read.
@@ -104,21 +104,21 @@ const EnumPropertyItem rna_enum_property_subtype_string_items[] = {
RNA_ENUM_PROPERTY_SUBTYPE_STRING_ITEMS,
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
const EnumPropertyItem rna_enum_property_subtype_number_items[] = {
RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ITEMS,
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
const EnumPropertyItem rna_enum_property_subtype_number_array_items[] = {
RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ARRAY_ITEMS,
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
const EnumPropertyItem rna_enum_property_subtype_items[] = {
@@ -133,7 +133,7 @@ const EnumPropertyItem rna_enum_property_subtype_items[] = {
/* Number array. */
RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ARRAY_ITEMS,
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
const EnumPropertyItem rna_enum_property_unit_items[] = {
@@ -150,7 +150,7 @@ const EnumPropertyItem rna_enum_property_unit_items[] = {
{PROP_UNIT_CAMERA, "CAMERA", 0, "Camera", ""},
{PROP_UNIT_POWER, "POWER", 0, "Power", ""},
{PROP_UNIT_TEMPERATURE, "TEMPERATURE", 0, "Temperature", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
const EnumPropertyItem rna_enum_property_flag_items[] = {
@@ -159,13 +159,13 @@ const EnumPropertyItem rna_enum_property_flag_items[] = {
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
{PROP_LIB_EXCEPTION, "LIBRARY_EDITABLE", 0, "Library Editable", ""},
{PROP_PROPORTIONAL, "PROPORTIONAL", 0, "Adjust values proportionally to each other", ""},
{PROP_TEXTEDIT_UPDATE,
{int(PROP_TEXTEDIT_UPDATE),
"TEXTEDIT_UPDATE",
0,
"Update on every keystroke in textedit 'mode'",
""},
{PROP_PATH_OUTPUT, "OUTPUT_PATH", 0, "Output Path", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/** Only for enum type properties. */
@@ -175,7 +175,7 @@ const EnumPropertyItem rna_enum_property_flag_enum_items[] = {
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
{PROP_LIB_EXCEPTION, "LIBRARY_EDITABLE", 0, "Library Editable", ""},
{PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
const EnumPropertyItem rna_enum_property_override_flag_items[] = {
@@ -184,7 +184,7 @@ const EnumPropertyItem rna_enum_property_override_flag_items[] = {
0,
"Library Overridable",
"Make that property editable in library overrides of linked data-blocks"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
const EnumPropertyItem rna_enum_property_override_flag_collection_items[] = {
@@ -203,7 +203,7 @@ const EnumPropertyItem rna_enum_property_override_flag_collection_items[] = {
0,
"Use Insertion",
"Allow users to add new items in that collection in library overrides"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
const EnumPropertyItem rna_enum_property_string_search_flag_items[] = {
@@ -214,7 +214,7 @@ const EnumPropertyItem rna_enum_property_string_search_flag_items[] = {
"Suggestion",
"Search results are suggestions (other values may be entered)"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/** \} */
@@ -299,7 +299,8 @@ static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data)
/* function to skip any id properties that are already known by RNA,
* for the second loop where we go over unknown id properties */
do {
for (prop = ptype->cont.properties.first; prop; prop = prop->next) {
for (prop = static_cast<PropertyRNA *>(ptype->cont.properties.first); prop; prop = prop->next)
{
if ((prop->flag_internal & PROP_INTERN_BUILTIN) == 0 &&
STREQ(prop->identifier, idprop->name)) {
return 1;
@@ -310,7 +311,7 @@ static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data)
return 0;
}
static int rna_property_builtin(CollectionPropertyIterator *UNUSED(iter), void *data)
static int rna_property_builtin(CollectionPropertyIterator * /*iter*/, void *data)
{
PropertyRNA *prop = (PropertyRNA *)data;
@@ -319,7 +320,7 @@ static int rna_property_builtin(CollectionPropertyIterator *UNUSED(iter), void *
return (prop->flag_internal & PROP_INTERN_BUILTIN);
}
static int rna_function_builtin(CollectionPropertyIterator *UNUSED(iter), void *data)
static int rna_function_builtin(CollectionPropertyIterator * /*iter*/, void *data)
{
FunctionRNA *func = (FunctionRNA *)data;
@@ -472,7 +473,7 @@ static void rna_Struct_property_tags_begin(CollectionPropertyIterator *iter, Poi
uint tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0;
rna_iterator_array_begin(
iter, (void *)tag_defines, sizeof(EnumPropertyItem), tag_count, 0, NULL);
iter, (void *)tag_defines, sizeof(EnumPropertyItem), tag_count, 0, nullptr);
}
/* Builtin properties iterator re-uses the Struct properties iterator, only
@@ -488,10 +489,10 @@ void rna_builtin_properties_begin(CollectionPropertyIterator *iter, PointerRNA *
newptr.data = ptr->type;
if (ptr->type->flag & STRUCT_ID) {
newptr.owner_id = ptr->data;
newptr.owner_id = static_cast<ID *>(ptr->data);
}
else {
newptr.owner_id = NULL;
newptr.owner_id = nullptr;
}
iter->parent = newptr;
@@ -514,13 +515,13 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point
{
StructRNA *srna;
PropertyRNA *prop;
PointerRNA propptr = {NULL};
PointerRNA propptr = {nullptr};
srna = ptr->type;
do {
if (srna->cont.prophash) {
prop = BLI_ghash_lookup(srna->cont.prophash, (void *)key);
prop = static_cast<PropertyRNA *>(BLI_ghash_lookup(srna->cont.prophash, (void *)key));
if (prop) {
propptr.type = &RNA_Property;
@@ -531,7 +532,8 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point
}
}
else {
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) && STREQ(prop->identifier, key)) {
propptr.type = &RNA_Property;
propptr.data = prop;
@@ -682,8 +684,8 @@ static bool rna_Property_overridable_get(PointerRNA *ptr)
IDProperty *idprop = rna_idproperty_check(&prop, ptr);
return idprop != NULL ? (idprop->flag & IDP_FLAG_OVERRIDABLE_LIBRARY) != 0 :
(prop->flag_override & PROPOVERRIDE_OVERRIDABLE_LIBRARY) != 0;
return idprop != nullptr ? (idprop->flag & IDP_FLAG_OVERRIDABLE_LIBRARY) != 0 :
(prop->flag_override & PROPOVERRIDE_OVERRIDABLE_LIBRARY) != 0;
}
static bool rna_Property_use_output_get(PointerRNA *ptr)
@@ -742,12 +744,12 @@ static bool rna_Property_is_path_output_flag_get(PointerRNA *ptr)
static int rna_Property_tags_get(PointerRNA *ptr)
{
return RNA_property_tags(ptr->data);
return RNA_property_tags(static_cast<PropertyRNA *>(ptr->data));
}
static const EnumPropertyItem *rna_Property_tags_itemf(bContext *UNUSED(C),
static const EnumPropertyItem *rna_Property_tags_itemf(bContext * /*C*/,
PointerRNA *ptr,
PropertyRNA *UNUSED(prop),
PropertyRNA * /*prop*/,
bool *r_free)
{
PropertyRNA *this_prop = (PropertyRNA *)ptr->data;
@@ -757,7 +759,7 @@ static const EnumPropertyItem *rna_Property_tags_itemf(bContext *UNUSED(C),
int totitem = 0;
for (const EnumPropertyItem *struct_tags = RNA_struct_property_tag_defines(srna);
struct_tags != NULL && struct_tags->identifier != NULL;
struct_tags != nullptr && struct_tags->identifier != nullptr;
struct_tags++)
{
memcpy(&tmp, struct_tags, sizeof(tmp));
@@ -991,8 +993,8 @@ static const EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C,
return DummyRNA_NULL_items;
}
if ((eprop->item_fn == NULL) || (eprop->item_fn == rna_EnumProperty_default_itemf) ||
(ptr->type == &RNA_EnumProperty) || (C == NULL))
if ((eprop->item_fn == nullptr) || (eprop->item_fn == rna_EnumProperty_default_itemf) ||
(ptr->type == &RNA_EnumProperty) || (C == nullptr))
{
if (eprop->item) {
return eprop->item;
@@ -1010,7 +1012,7 @@ static int rna_EnumProperty_default_get(PointerRNA *ptr)
return ((EnumPropertyRNA *)prop)->defaultvalue;
}
static int rna_enum_check_separator(CollectionPropertyIterator *UNUSED(iter), void *data)
static int rna_enum_check_separator(CollectionPropertyIterator * /*iter*/, void *data)
{
EnumPropertyItem *item = (EnumPropertyItem *)data;
@@ -1023,15 +1025,20 @@ static void rna_EnumProperty_items_begin_impl(CollectionPropertyIterator *iter,
{
PropertyRNA *prop = (PropertyRNA *)ptr->data;
// EnumPropertyRNA *eprop; /* UNUSED */
const EnumPropertyItem *item = NULL;
const EnumPropertyItem *item = nullptr;
int totitem;
bool free;
prop = rna_ensure_property(prop);
// eprop = (EnumPropertyRNA *)prop;
RNA_property_enum_items_ex(
NULL, ptr, prop, STREQ(iter->prop->identifier, "enum_items_static"), &item, &totitem, &free);
RNA_property_enum_items_ex(nullptr,
ptr,
prop,
STREQ(iter->prop->identifier, "enum_items_static"),
&item,
&totitem,
&free);
rna_iterator_array_begin(iter, (void *)item, sizeof(EnumPropertyItem), totitem, free, skip_fn);
}
@@ -1043,7 +1050,7 @@ static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, Point
static void rna_EnumProperty_items_ui_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
/* No skip-function, include all "UI" items. */
rna_EnumProperty_items_begin_impl(iter, ptr, NULL);
rna_EnumProperty_items_begin_impl(iter, ptr, nullptr);
}
static void rna_EnumPropertyItem_identifier_get(PointerRNA *ptr, char *value)
@@ -1058,8 +1065,8 @@ static int rna_EnumPropertyItem_identifier_length(PointerRNA *ptr)
static void rna_EnumPropertyItem_name_get(PointerRNA *ptr, char *value)
{
const EnumPropertyItem *eprop = ptr->data;
/* Name can be NULL in the case of separators
const EnumPropertyItem *eprop = static_cast<const EnumPropertyItem *>(ptr->data);
/* Name can be nullptr in the case of separators
* which are exposed via `_bpy.rna_enum_items_static`. */
if (eprop->name) {
strcpy(value, eprop->name);
@@ -1071,7 +1078,7 @@ static void rna_EnumPropertyItem_name_get(PointerRNA *ptr, char *value)
static int rna_EnumPropertyItem_name_length(PointerRNA *ptr)
{
const EnumPropertyItem *eprop = ptr->data;
const EnumPropertyItem *eprop = static_cast<const EnumPropertyItem *>(ptr->data);
if (eprop->name) {
return strlen(eprop->name);
}
@@ -1080,7 +1087,7 @@ static int rna_EnumPropertyItem_name_length(PointerRNA *ptr)
static void rna_EnumPropertyItem_description_get(PointerRNA *ptr, char *value)
{
const EnumPropertyItem *eprop = ptr->data;
const EnumPropertyItem *eprop = static_cast<const EnumPropertyItem *>(ptr->data);
if (eprop->description) {
strcpy(value, eprop->description);
@@ -1178,32 +1185,33 @@ static bool rna_Function_use_self_type_get(PointerRNA *ptr)
/* Blender RNA */
static int rna_struct_is_publc(CollectionPropertyIterator *UNUSED(iter), void *data)
static int rna_struct_is_publc(CollectionPropertyIterator * /*iter*/, void *data)
{
StructRNA *srna = data;
StructRNA *srna = static_cast<StructRNA *>(data);
return !(srna->flag & STRUCT_PUBLIC_NAMESPACE);
}
static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
BlenderRNA *brna = ptr->data;
BlenderRNA *brna = static_cast<BlenderRNA *>(ptr->data);
rna_iterator_listbase_begin(iter, &brna->structs, rna_struct_is_publc);
}
/* optional, for faster lookups */
static int rna_BlenderRNA_structs_length(PointerRNA *ptr)
{
BlenderRNA *brna = ptr->data;
BlenderRNA *brna = static_cast<BlenderRNA *>(ptr->data);
BLI_assert(brna->structs_len == BLI_listbase_count(&brna->structs));
return brna->structs_len;
}
static int rna_BlenderRNA_structs_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
{
BlenderRNA *brna = ptr->data;
StructRNA *srna = index < brna->structs_len ? BLI_findlink(&brna->structs, index) : NULL;
if (srna != NULL) {
RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
BlenderRNA *brna = static_cast<BlenderRNA *>(ptr->data);
StructRNA *srna = static_cast<StructRNA *>(
index < brna->structs_len ? BLI_findlink(&brna->structs, index) : nullptr);
if (srna != nullptr) {
RNA_pointer_create(nullptr, &RNA_Struct, srna, r_ptr);
return true;
}
else {
@@ -1214,10 +1222,10 @@ static int rna_BlenderRNA_structs_lookup_string(PointerRNA *ptr,
const char *key,
PointerRNA *r_ptr)
{
BlenderRNA *brna = ptr->data;
StructRNA *srna = BLI_ghash_lookup(brna->structs_map, (void *)key);
if (srna != NULL) {
RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
BlenderRNA *brna = static_cast<BlenderRNA *>(ptr->data);
StructRNA *srna = static_cast<StructRNA *>(BLI_ghash_lookup(brna->structs_map, (void *)key));
if (srna != nullptr) {
RNA_pointer_create(nullptr, &RNA_Struct, srna, r_ptr);
return true;
}
@@ -1242,21 +1250,21 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop
char *propname_b_buff,
size_t propname_b_buff_size)
{
BLI_assert(propptr_a != NULL);
BLI_assert(propptr_a != nullptr);
bool is_valid_for_diffing = true;
const bool do_force_name = !no_prop_name && r_propname_a != NULL;
const bool do_force_name = !no_prop_name && r_propname_a != nullptr;
if (do_force_name) {
BLI_assert(r_propname_a != NULL);
BLI_assert(r_propname_b != NULL);
BLI_assert(r_propname_a != nullptr);
BLI_assert(r_propname_b != nullptr);
}
*r_is_id = *r_is_null = *r_is_type_diff = false;
/* Beware, PointerRNA_NULL has no type and is considered a 'blank page'! */
if (ELEM(NULL, propptr_a->type, propptr_a->data)) {
if (ELEM(NULL, propptr_b, propptr_b->type, propptr_b->data)) {
if (ELEM(nullptr, propptr_a->type, propptr_a->data)) {
if (ELEM(nullptr, propptr_b, propptr_b->type, propptr_b->data)) {
*r_is_null = true;
}
else {
@@ -1268,12 +1276,12 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop
}
else {
*r_is_id = RNA_struct_is_ID(propptr_a->type);
*r_is_null = (ELEM(NULL, propptr_b, propptr_b->type, propptr_b->data));
*r_is_type_diff = (propptr_b == NULL || propptr_b->type != propptr_a->type);
*r_is_null = (ELEM(nullptr, propptr_b, propptr_b->type, propptr_b->data));
*r_is_type_diff = (propptr_b == nullptr || propptr_b->type != propptr_a->type);
is_valid_for_diffing = !((*r_is_id && no_ownership) || *r_is_null);
}
if (propptr_b == NULL || propptr_a->type != propptr_b->type) {
if (propptr_b == nullptr || propptr_a->type != propptr_b->type) {
*r_is_type_diff = true;
is_valid_for_diffing = false;
// printf("%s: different pointer RNA types\n", rna_path ? rna_path : "<UNKNOWN>");
@@ -1284,20 +1292,20 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop
* This helps a lot in library override case, especially to detect inserted items in collections.
*/
if (!no_prop_name && (is_valid_for_diffing || do_force_name)) {
PropertyRNA *nameprop_a = (propptr_a->type != NULL) ?
PropertyRNA *nameprop_a = (propptr_a->type != nullptr) ?
RNA_struct_name_property(propptr_a->type) :
NULL;
PropertyRNA *nameprop_b = (propptr_b != NULL && propptr_b->type != NULL) ?
nullptr;
PropertyRNA *nameprop_b = (propptr_b != nullptr && propptr_b->type != nullptr) ?
RNA_struct_name_property(propptr_b->type) :
NULL;
nullptr;
int propname_a_len = 0, propname_b_len = 0;
char *propname_a = NULL;
char *propname_b = NULL;
char *propname_a = nullptr;
char *propname_b = nullptr;
char buff_a[4096];
char buff_b[4096];
if (nameprop_a != NULL) {
if (r_propname_a == NULL && propname_a_buff == NULL) {
if (nameprop_a != nullptr) {
if (r_propname_a == nullptr && propname_a_buff == nullptr) {
propname_a_buff = buff_a;
propname_a_buff_size = sizeof(buff_a);
}
@@ -1306,13 +1314,13 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop
propptr_a, nameprop_a, propname_a_buff, propname_a_buff_size, &propname_a_len);
// printf("propname_a = %s\n", propname_a ? propname_a : "<NONE>");
if (r_propname_a != NULL) {
if (r_propname_a != nullptr) {
*r_propname_a = propname_a;
}
}
// else printf("item of type %s a has no name property!\n", propptr_a->type->name);
if (nameprop_b != NULL) {
if (r_propname_b == NULL && propname_b_buff == NULL) {
if (nameprop_b != nullptr) {
if (r_propname_b == nullptr && propname_b_buff == nullptr) {
propname_b_buff = buff_b;
propname_b_buff_size = sizeof(buff_b);
}
@@ -1320,11 +1328,11 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop
propname_b = RNA_property_string_get_alloc(
propptr_b, nameprop_b, propname_b_buff, propname_b_buff_size, &propname_b_len);
if (r_propname_b != NULL) {
if (r_propname_b != nullptr) {
*r_propname_b = propname_b;
}
}
if (propname_a != NULL && propname_b != NULL) {
if (propname_a != nullptr && propname_b != nullptr) {
if (propname_a_len != propname_b_len || propname_a[0] != propname_b[0] ||
!STREQ(propname_a, propname_b))
{
@@ -1363,8 +1371,8 @@ static int rna_property_override_diff_propptr(Main *bmain,
{
BLI_assert(ELEM(property_type, PROP_POINTER, PROP_COLLECTION));
const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 &&
rna_path != NULL;
const bool do_create = override != nullptr && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 &&
rna_path != nullptr;
bool is_id = false;
bool is_null = false;
@@ -1378,33 +1386,33 @@ static int rna_property_override_diff_propptr(Main *bmain,
&is_id,
&is_null,
&is_type_diff,
NULL,
NULL,
nullptr,
nullptr,
0,
NULL,
NULL,
nullptr,
nullptr,
0);
if (is_id) {
/* Owned IDs (the ones we want to actually compare in depth, instead of just comparing pointer
* values) should be always properly tagged as 'virtual' overrides. */
ID *id = propptr_a->owner_id;
if (id != NULL && !ID_IS_OVERRIDE_LIBRARY(id)) {
if (id != nullptr && !ID_IS_OVERRIDE_LIBRARY(id)) {
id = propptr_b->owner_id;
if (id != NULL && !ID_IS_OVERRIDE_LIBRARY(id)) {
id = NULL;
if (id != nullptr && !ID_IS_OVERRIDE_LIBRARY(id)) {
id = nullptr;
}
}
BLI_assert(no_ownership || id == NULL || ID_IS_OVERRIDE_LIBRARY_VIRTUAL(id));
BLI_assert(no_ownership || id == nullptr || ID_IS_OVERRIDE_LIBRARY_VIRTUAL(id));
UNUSED_VARS_NDEBUG(id);
}
if (override) {
if (no_ownership || is_null || is_type_diff || !is_valid_for_diffing) {
/* In case this pointer prop does not own its data (or one is NULL), do not compare structs!
* This is a quite safe path to infinite loop, among other nasty issues.
* Instead, just compare pointers themselves. */
/* In case this pointer prop does not own its data (or one is nullptr), do not compare
* structs! This is a quite safe path to infinite loop, among other nasty issues. Instead,
* just compare pointers themselves. */
const int comp = (propptr_a->data != propptr_b->data);
if (do_create && comp != 0) {
@@ -1413,7 +1421,7 @@ static int rna_property_override_diff_propptr(Main *bmain,
override, rna_path, &created);
/* If not yet overridden, or if we are handling sub-items (inside a collection)... */
if (op != NULL) {
if (op != nullptr) {
if (created || op->rna_prop_type == 0) {
op->rna_prop_type = property_type;
}
@@ -1421,8 +1429,8 @@ static int rna_property_override_diff_propptr(Main *bmain,
BLI_assert(op->rna_prop_type == property_type);
}
IDOverrideLibraryPropertyOperation *opop = NULL;
if (created || rna_itemname_a != NULL || rna_itemname_b != NULL ||
IDOverrideLibraryPropertyOperation *opop = nullptr;
if (created || rna_itemname_a != nullptr || rna_itemname_b != nullptr ||
rna_itemindex_a != -1 || rna_itemindex_b != -1)
{
opop = BKE_lib_override_library_property_operation_get(op,
@@ -1432,7 +1440,7 @@ static int rna_property_override_diff_propptr(Main *bmain,
rna_itemindex_b,
rna_itemindex_a,
true,
NULL,
nullptr,
&created);
/* Do not use BKE_lib_override_library_operations_tag here, we do not want to validate
* as used all of its operations. */
@@ -1447,24 +1455,24 @@ static int rna_property_override_diff_propptr(Main *bmain,
}
if (is_id && no_ownership) {
if (opop == NULL) {
if (opop == nullptr) {
opop = BKE_lib_override_library_property_operation_find(op,
rna_itemname_b,
rna_itemname_a,
rna_itemindex_b,
rna_itemindex_a,
true,
NULL);
nullptr);
opop->tag &= ~LIBOVERRIDE_PROP_OP_TAG_UNUSED;
BLI_assert(opop != NULL);
BLI_assert(opop != nullptr);
}
BLI_assert(propptr_a->data == propptr_a->owner_id);
BLI_assert(propptr_b->data == propptr_b->owner_id);
ID *id_a = propptr_a->data;
ID *id_b = propptr_b->data;
if (ELEM(NULL, id_a, id_b)) {
/* In case one of the pointer is NULL and not the other, we consider that the
ID *id_a = static_cast<ID *>(propptr_a->data);
ID *id_b = static_cast<ID *>(propptr_b->data);
if (ELEM(nullptr, id_a, id_b)) {
/* In case one of the pointer is nullptr and not the other, we consider that the
* override is not matching its reference anymore. */
opop->flag &= ~LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE;
}
@@ -1480,10 +1488,12 @@ static int rna_property_override_diff_propptr(Main *bmain,
"needing resync.\n",
id_a->name);
}
else if (id_a->override_library != NULL && id_a->override_library->reference == id_b) {
else if (id_a->override_library != nullptr &&
id_a->override_library->reference == id_b) {
opop->flag |= LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE;
}
else if (id_b->override_library != NULL && id_b->override_library->reference == id_a) {
else if (id_b->override_library != nullptr &&
id_b->override_library->reference == id_a) {
opop->flag |= LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE;
}
else {
@@ -1496,8 +1506,8 @@ static int rna_property_override_diff_propptr(Main *bmain,
return comp;
}
else {
/* In case we got some array/collection like items identifiers, now is the time to generate a
* proper rna path from those. */
/* In case we got some array/collection like items identifiers, now is the time to generate a
* proper rna path from those. */
# define RNA_PATH_BUFFSIZE 8192
char extended_rna_path_buffer[RNA_PATH_BUFFSIZE];
@@ -1508,8 +1518,8 @@ static int rna_property_override_diff_propptr(Main *bmain,
* (e.g. happens with point cache), in that case too we want to fall back to index.
* Note that we do not need the RNA path for insertion operations. */
if (rna_path) {
if ((rna_itemname_a != NULL && rna_itemname_a[0] != '\0') &&
(rna_itemname_b != NULL && rna_itemname_b[0] != '\0'))
if ((rna_itemname_a != nullptr && rna_itemname_a[0] != '\0') &&
(rna_itemname_b != nullptr && rna_itemname_b[0] != '\0'))
{
BLI_assert(STREQ(rna_itemname_a, rna_itemname_b));
@@ -1518,7 +1528,8 @@ static int rna_property_override_diff_propptr(Main *bmain,
esc_item_name, rna_itemname_a, RNA_PATH_BUFFSIZE);
extended_rna_path_len = rna_path_len + 2 + esc_item_name_len + 2;
if (extended_rna_path_len >= RNA_PATH_BUFFSIZE) {
extended_rna_path = MEM_mallocN(extended_rna_path_len + 1, __func__);
extended_rna_path = static_cast<char *>(
MEM_mallocN(extended_rna_path_len + 1, __func__));
}
memcpy(extended_rna_path, rna_path, rna_path_len);
@@ -1552,7 +1563,8 @@ static int rna_property_override_diff_propptr(Main *bmain,
extended_rna_path_len = rna_path_len + item_index_buff_len + 2;
if (extended_rna_path_len >= RNA_PATH_BUFFSIZE) {
extended_rna_path = MEM_mallocN(extended_rna_path_len + 1, __func__);
extended_rna_path = static_cast<char *>(
MEM_mallocN(extended_rna_path_len + 1, __func__));
}
memcpy(extended_rna_path, rna_path, rna_path_len);
@@ -1577,7 +1589,7 @@ static int rna_property_override_diff_propptr(Main *bmain,
extended_rna_path,
extended_rna_path_len,
override,
flags,
eRNAOverrideMatch(flags),
r_report_flag);
if (!ELEM(extended_rna_path, extended_rna_path_buffer, rna_path)) {
@@ -1630,8 +1642,8 @@ int rna_property_override_diff_default(Main *bmain,
/* NOTE: at this point, we are sure that when len_a is zero,
* we are not handling an (empty) array. */
const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 &&
rna_path != NULL;
const bool do_create = override != nullptr && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 &&
rna_path != nullptr;
const bool no_ownership = (prop_a->rnaprop->flag & PROP_PTR_NO_OWNERSHIP) != 0;
@@ -1643,7 +1655,7 @@ int rna_property_override_diff_default(Main *bmain,
const uint rna_prop_type = RNA_property_type(prop_a->rnaprop);
bool created = false;
IDOverrideLibraryProperty *op = NULL;
IDOverrideLibraryProperty *op = nullptr;
switch (rna_prop_type) {
case PROP_BOOLEAN: {
@@ -1651,10 +1663,12 @@ int rna_property_override_diff_default(Main *bmain,
bool array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
bool *array_a, *array_b;
array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_a, "RNA equals") :
array_stack_a;
array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_b, "RNA equals") :
array_stack_b;
array_a = static_cast<bool *>((len_a > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(bool) * len_a, "RNA equals") :
array_stack_a);
array_b = static_cast<bool *>((len_b > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(bool) * len_b, "RNA equals") :
array_stack_b);
RNA_property_boolean_get_array(ptr_a, rawprop_a, array_a);
RNA_property_boolean_get_array(ptr_b, rawprop_b, array_b);
@@ -1665,9 +1679,9 @@ int rna_property_override_diff_default(Main *bmain,
/* XXX TODO: this will have to be refined to handle array items. */
op = BKE_lib_override_library_property_get(override, rna_path, &created);
if (op != NULL && created) {
if (op != nullptr && created) {
BKE_lib_override_library_property_operation_get(
op, LIBOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
op, LIBOVERRIDE_OP_REPLACE, nullptr, nullptr, -1, -1, true, nullptr, nullptr);
if (*r_report_flag) {
*r_report_flag |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
}
@@ -1694,9 +1708,9 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
op = BKE_lib_override_library_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
if (op != nullptr && created) { /* If not yet overridden... */
BKE_lib_override_library_property_operation_get(
op, LIBOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
op, LIBOVERRIDE_OP_REPLACE, nullptr, nullptr, -1, -1, true, nullptr, nullptr);
if (r_report_flag) {
*r_report_flag |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
}
@@ -1712,10 +1726,12 @@ int rna_property_override_diff_default(Main *bmain,
int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
int *array_a, *array_b;
array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_a, "RNA equals") :
array_stack_a;
array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_b, "RNA equals") :
array_stack_b;
array_a = static_cast<int *>((len_a > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(int) * len_a, "RNA equals") :
array_stack_a);
array_b = static_cast<int *>((len_b > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(int) * len_b, "RNA equals") :
array_stack_b);
RNA_property_int_get_array(ptr_a, rawprop_a, array_a);
RNA_property_int_get_array(ptr_b, rawprop_b, array_b);
@@ -1726,9 +1742,9 @@ int rna_property_override_diff_default(Main *bmain,
/* XXX TODO: this will have to be refined to handle array items. */
op = BKE_lib_override_library_property_get(override, rna_path, &created);
if (op != NULL && created) {
if (op != nullptr && created) {
BKE_lib_override_library_property_operation_get(
op, LIBOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
op, LIBOVERRIDE_OP_REPLACE, nullptr, nullptr, -1, -1, true, nullptr, nullptr);
if (r_report_flag && created) {
*r_report_flag |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
}
@@ -1755,9 +1771,9 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
op = BKE_lib_override_library_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
if (op != nullptr && created) { /* If not yet overridden... */
BKE_lib_override_library_property_operation_get(
op, LIBOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
op, LIBOVERRIDE_OP_REPLACE, nullptr, nullptr, -1, -1, true, nullptr, nullptr);
if (r_report_flag) {
*r_report_flag |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
}
@@ -1773,10 +1789,12 @@ int rna_property_override_diff_default(Main *bmain,
float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
float *array_a, *array_b;
array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(float) * len_a, "RNA equals") :
array_stack_a;
array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(float) * len_b, "RNA equals") :
array_stack_b;
array_a = static_cast<float *>((len_a > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(float) * len_a, "RNA equals") :
array_stack_a);
array_b = static_cast<float *>((len_b > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(float) * len_b, "RNA equals") :
array_stack_b);
RNA_property_float_get_array(ptr_a, rawprop_a, array_a);
RNA_property_float_get_array(ptr_b, rawprop_b, array_b);
@@ -1787,9 +1805,9 @@ int rna_property_override_diff_default(Main *bmain,
/* XXX TODO: this will have to be refined to handle array items. */
op = BKE_lib_override_library_property_get(override, rna_path, &created);
if (op != NULL && created) {
if (op != nullptr && created) {
BKE_lib_override_library_property_operation_get(
op, LIBOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
op, LIBOVERRIDE_OP_REPLACE, nullptr, nullptr, -1, -1, true, nullptr, nullptr);
if (r_report_flag) {
*r_report_flag |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
}
@@ -1816,9 +1834,9 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
op = BKE_lib_override_library_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
if (op != nullptr && created) { /* If not yet overridden... */
BKE_lib_override_library_property_operation_get(
op, LIBOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
op, LIBOVERRIDE_OP_REPLACE, nullptr, nullptr, -1, -1, true, nullptr, nullptr);
if (r_report_flag) {
*r_report_flag |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
}
@@ -1837,9 +1855,9 @@ int rna_property_override_diff_default(Main *bmain,
if (do_create && comp != 0) {
op = BKE_lib_override_library_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
if (op != nullptr && created) { /* If not yet overridden... */
BKE_lib_override_library_property_operation_get(
op, LIBOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
op, LIBOVERRIDE_OP_REPLACE, nullptr, nullptr, -1, -1, true, nullptr, nullptr);
if (r_report_flag) {
*r_report_flag |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
}
@@ -1856,22 +1874,22 @@ int rna_property_override_diff_default(Main *bmain,
ptr_a, rawprop_a, fixed_a, sizeof(fixed_a), &len_str_a);
char *value_b = RNA_property_string_get_alloc(
ptr_b, rawprop_b, fixed_b, sizeof(fixed_b), &len_str_b);
/* TODO: we could do a check on length too,
* but then we would not have a 'real' string comparison...
* Maybe behind a eRNAOverrideMatch flag? */
/* TODO: we could do a check on length too,
* but then we would not have a 'real' string comparison...
* Maybe behind a eRNAOverrideMatch flag? */
# if 0
const int comp = len_str_a < len_str_b ?
-1 :
len_str_a > len_str_b ? 1 : strcmp(value_a, value_b);
const int comp = len_str_a < len_str_b ? -1 :
len_str_a > len_str_b ? 1 :
strcmp(value_a, value_b);
# endif
const int comp = strcmp(value_a, value_b);
if (do_create && comp != 0) {
op = BKE_lib_override_library_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
if (op != nullptr && created) { /* If not yet overridden... */
BKE_lib_override_library_property_operation_get(
op, LIBOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
op, LIBOVERRIDE_OP_REPLACE, nullptr, nullptr, -1, -1, true, nullptr, nullptr);
if (r_report_flag) {
*r_report_flag |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
}
@@ -1906,15 +1924,15 @@ int rna_property_override_diff_default(Main *bmain,
ptr_b->owner_id,
&propptr_a,
&propptr_b,
mode,
eRNACompareMode(mode),
no_ownership,
no_prop_name,
override,
rna_path,
rna_path_len,
PROP_POINTER,
NULL,
NULL,
nullptr,
nullptr,
-1,
-1,
flags,
@@ -1938,21 +1956,21 @@ int rna_property_override_diff_default(Main *bmain,
char buff_a[4096];
char buff_prev_a[4096] = {0};
char buff_b[4096];
char *propname_a = NULL;
char *propname_a = nullptr;
char *prev_propname_a = buff_prev_a;
char *propname_b = NULL;
char *propname_b = nullptr;
if (use_collection_insertion) {
/* We need to clean up all possible existing insertion operations, and then re-generate
* them, otherwise we'd end up with a mess of opop's every time something changes. */
op = BKE_lib_override_library_property_find(override, rna_path);
if (op != NULL) {
if (op != nullptr) {
LISTBASE_FOREACH_MUTABLE (IDOverrideLibraryPropertyOperation *, opop, &op->operations) {
if (ELEM(opop->operation, LIBOVERRIDE_OP_INSERT_AFTER, LIBOVERRIDE_OP_INSERT_BEFORE)) {
BKE_lib_override_library_property_operation_delete(op, opop);
}
}
op = NULL;
op = nullptr;
}
}
@@ -1987,7 +2005,7 @@ int rna_property_override_diff_default(Main *bmain,
if (is_valid_for_insertion) {
/* We still need propname from 'a' item... */
rna_property_override_diff_propptr_validate_diffing(&iter_a.ptr,
NULL,
nullptr,
no_ownership,
no_prop_name,
&is_id,
@@ -2002,7 +2020,7 @@ int rna_property_override_diff_default(Main *bmain,
}
}
/* We do not support insertion of IDs for now, neither handle NULL pointers. */
/* We do not support insertion of IDs for now, neither handle nullptr pointers. */
if (is_id || is_valid_for_diffing) {
is_valid_for_insertion = false;
}
@@ -2045,20 +2063,21 @@ int rna_property_override_diff_default(Main *bmain,
BKE_lib_override_library_property_operation_get(op,
LIBOVERRIDE_OP_INSERT_AFTER,
no_prop_name ? NULL : prev_propname_a,
no_prop_name ? NULL : propname_a,
no_prop_name ? nullptr :
prev_propname_a,
no_prop_name ? nullptr : propname_a,
idx_a - 1,
idx_a,
true,
NULL,
NULL);
nullptr,
nullptr);
# if 0
printf("%s: Adding insertion op override after '%s'/%d\n",
rna_path,
prev_propname_a,
idx_a - 1);
# endif
op = NULL;
op = nullptr;
equals = false;
}
@@ -2069,7 +2088,7 @@ int rna_property_override_diff_default(Main *bmain,
ptr_b->owner_id,
&iter_a.ptr,
&iter_b.ptr,
mode,
eRNACompareMode(mode),
no_ownership,
no_prop_name,
override,
@@ -2091,7 +2110,7 @@ int rna_property_override_diff_default(Main *bmain,
prev_propname_a = buff_prev_a;
}
prev_propname_a[0] = '\0';
if (propname_a != NULL &&
if (propname_a != nullptr &&
BLI_strncpy_rlen(prev_propname_a, propname_a, sizeof(buff_prev_a)) >=
sizeof(buff_prev_a) - 1)
{
@@ -2145,7 +2164,7 @@ int rna_property_override_diff_default(Main *bmain,
break;
}
if (op != NULL) {
if (op != nullptr) {
if (created || op->rna_prop_type == 0) {
op->rna_prop_type = rna_prop_type;
}
@@ -2157,7 +2176,7 @@ int rna_property_override_diff_default(Main *bmain,
return 0;
}
bool rna_property_override_store_default(Main *UNUSED(bmain),
bool rna_property_override_store_default(Main * /*bmain*/,
PointerRNA *ptr_local,
PointerRNA *ptr_reference,
PointerRNA *ptr_storage,
@@ -2201,9 +2220,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
int *array_a, *array_b;
array_a = (len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_a) * len_local, __func__) :
array_stack_a;
array_a = static_cast<int *>((len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_a) * len_local, __func__) :
array_stack_a);
RNA_property_int_get_array(ptr_reference, prop_reference, array_a);
switch (opop->operation) {
@@ -2213,9 +2232,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
const int other_op = opop->operation == LIBOVERRIDE_OP_ADD ? LIBOVERRIDE_OP_SUBTRACT :
LIBOVERRIDE_OP_ADD;
bool do_set = true;
array_b = (len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
array_stack_b;
array_b = static_cast<int *>((len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
array_stack_b);
RNA_property_int_get_array(ptr_local, prop_local, array_b);
for (int i = len_local; i--;) {
array_b[i] = fac * (array_b[i] - array_a[i]);
@@ -2289,9 +2308,9 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
float *array_a, *array_b;
array_a = (len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_a) * len_local, __func__) :
array_stack_a;
array_a = static_cast<float *>((len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_a) * len_local, __func__) :
array_stack_a);
RNA_property_float_get_array(ptr_reference, prop_reference, array_a);
switch (opop->operation) {
@@ -2301,9 +2320,10 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
const int other_op = opop->operation == LIBOVERRIDE_OP_ADD ? LIBOVERRIDE_OP_SUBTRACT :
LIBOVERRIDE_OP_ADD;
bool do_set = true;
array_b = (len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
array_stack_b;
array_b = static_cast<float *>(
(len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
array_stack_b);
RNA_property_float_get_array(ptr_local, prop_local, array_b);
for (int i = len_local; i--;) {
array_b[i] = fac * (array_b[i] - array_a[i]);
@@ -2333,9 +2353,10 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
}
case LIBOVERRIDE_OP_MULTIPLY: {
bool do_set = true;
array_b = (len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
array_stack_b;
array_b = static_cast<float *>(
(len_local > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
array_stack_b);
RNA_property_float_get_array(ptr_local, prop_local, array_b);
for (int i = len_local; i--;) {
array_b[i] = array_a[i] == 0.0f ? array_b[i] : array_b[i] / array_a[i];
@@ -2434,9 +2455,9 @@ bool rna_property_override_apply_default(Main *bmain,
const int len_dst,
const int len_src,
const int len_storage,
PointerRNA *UNUSED(ptr_item_dst),
PointerRNA *UNUSED(ptr_item_src),
PointerRNA *UNUSED(ptr_item_storage),
PointerRNA * /*ptr_item_dst*/,
PointerRNA * /*ptr_item_src*/,
PointerRNA * /*ptr_item_storage*/,
IDOverrideLibraryPropertyOperation *opop)
{
BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage));
@@ -2454,8 +2475,9 @@ bool rna_property_override_apply_default(Main *bmain,
bool array_stack_a[RNA_STACK_ARRAY];
bool *array_a;
array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
array_stack_a;
array_a = static_cast<bool *>((len_dst > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
array_stack_a);
RNA_property_boolean_get_array(ptr_src, prop_src, array_a);
@@ -2490,8 +2512,9 @@ bool rna_property_override_apply_default(Main *bmain,
int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
int *array_a, *array_b;
array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
array_stack_a;
array_a = static_cast<int *>((len_dst > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
array_stack_a);
switch (override_op) {
case LIBOVERRIDE_OP_REPLACE:
@@ -2501,9 +2524,9 @@ bool rna_property_override_apply_default(Main *bmain,
case LIBOVERRIDE_OP_ADD:
case LIBOVERRIDE_OP_SUBTRACT:
RNA_property_int_get_array(ptr_dst, prop_dst, array_a);
array_b = (len_dst > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_dst, __func__) :
array_stack_b;
array_b = static_cast<int *>((len_dst > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_dst, __func__) :
array_stack_b);
RNA_property_int_get_array(ptr_storage, prop_storage, array_b);
if (override_op == LIBOVERRIDE_OP_ADD) {
for (int i = len_dst; i--;) {
@@ -2569,8 +2592,9 @@ bool rna_property_override_apply_default(Main *bmain,
float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
float *array_a, *array_b;
array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
array_stack_a;
array_a = static_cast<float *>((len_dst > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
array_stack_a);
switch (override_op) {
case LIBOVERRIDE_OP_REPLACE:
@@ -2581,9 +2605,9 @@ bool rna_property_override_apply_default(Main *bmain,
case LIBOVERRIDE_OP_SUBTRACT:
case LIBOVERRIDE_OP_MULTIPLY:
RNA_property_float_get_array(ptr_dst, prop_dst, array_a);
array_b = (len_dst > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_dst, __func__) :
array_stack_b;
array_b = static_cast<float *>((len_dst > RNA_STACK_ARRAY) ?
MEM_mallocN(sizeof(*array_b) * len_dst, __func__) :
array_stack_b);
RNA_property_float_get_array(ptr_storage, prop_storage, array_b);
if (override_op == LIBOVERRIDE_OP_ADD) {
for (int i = len_dst; i--;) {
@@ -2676,7 +2700,7 @@ bool rna_property_override_apply_default(Main *bmain,
switch (override_op) {
case LIBOVERRIDE_OP_REPLACE:
RNA_property_pointer_set(ptr_dst, prop_dst, value, NULL);
RNA_property_pointer_set(ptr_dst, prop_dst, value, nullptr);
break;
default:
BLI_assert_msg(0, "Unsupported RNA override operation on pointer");
@@ -2686,7 +2710,7 @@ bool rna_property_override_apply_default(Main *bmain,
}
case PROP_STRING: {
char buff[256];
char *value = RNA_property_string_get_alloc(ptr_src, prop_src, buff, sizeof(buff), NULL);
char *value = RNA_property_string_get_alloc(ptr_src, prop_src, buff, sizeof(buff), nullptr);
switch (override_op) {
case LIBOVERRIDE_OP_REPLACE:
@@ -2718,7 +2742,7 @@ bool rna_property_override_apply_default(Main *bmain,
PointerRNA item_ptr_src, item_ptr_ref, item_ptr_dst;
int item_index_dst;
bool is_valid = false;
if (opop->subitem_local_name != NULL && opop->subitem_local_name[0] != '\0') {
if (opop->subitem_local_name != nullptr && opop->subitem_local_name[0] != '\0') {
/* Find from name. */
int item_index_src, item_index_ref;
if (RNA_property_collection_lookup_string_index(
@@ -2764,8 +2788,8 @@ bool rna_property_override_apply_default(Main *bmain,
* actually implemented for those).
* Currently it is close to impossible to copy arbitrary 'real' RNA data between
* Collection items. */
IDProperty *item_idprop_src = item_ptr_src.data;
IDProperty *item_idprop_dst = item_ptr_dst.data;
IDProperty *item_idprop_src = static_cast<IDProperty *>(item_ptr_src.data);
IDProperty *item_idprop_dst = static_cast<IDProperty *>(item_ptr_dst.data);
IDP_CopyPropertyContent(item_idprop_dst, item_idprop_src);
ret_success = RNA_property_collection_move(
@@ -2785,7 +2809,7 @@ bool rna_property_override_apply_default(Main *bmain,
/* Default apply callback always call property update. */
if (ret_success) {
RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
}
return ret_success;
@@ -2804,13 +2828,13 @@ bool rna_property_override_apply_default(Main *bmain,
static void rna_PrimitiveString_value_get(PointerRNA *ptr, char *result)
{
const PrimitiveStringRNA *data = ptr->data;
const PrimitiveStringRNA *data = static_cast<const PrimitiveStringRNA *>(ptr->data);
strcpy(result, data->value ? data->value : "");
}
static int rna_PrimitiveString_value_length(PointerRNA *ptr)
{
const PrimitiveStringRNA *data = ptr->data;
const PrimitiveStringRNA *data = static_cast<const PrimitiveStringRNA *>(ptr->data);
return data->value ? strlen(data->value) : 0;
}
@@ -2818,7 +2842,7 @@ static int rna_PrimitiveString_value_length(PointerRNA *ptr)
static int rna_PrimitiveInt_value_get(PointerRNA *ptr)
{
const PrimitiveIntRNA *data = ptr->data;
const PrimitiveIntRNA *data = static_cast<const PrimitiveIntRNA *>(ptr->data);
return data->value;
}
@@ -2826,7 +2850,7 @@ static int rna_PrimitiveInt_value_get(PointerRNA *ptr)
static float rna_PrimitiveFloat_value_get(PointerRNA *ptr)
{
const PrimitiveFloatRNA *data = ptr->data;
const PrimitiveFloatRNA *data = static_cast<const PrimitiveFloatRNA *>(ptr->data);
return data->value;
}
@@ -2834,7 +2858,7 @@ static float rna_PrimitiveFloat_value_get(PointerRNA *ptr)
static bool rna_PrimitiveBoolean_value_get(PointerRNA *ptr)
{
const PrimitiveBooleanRNA *data = ptr->data;
const PrimitiveBooleanRNA *data = static_cast<const PrimitiveBooleanRNA *>(ptr->data);
return data->value;
}
@@ -2847,45 +2871,47 @@ static void rna_def_struct(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Struct", NULL);
srna = RNA_def_struct(brna, "Struct", nullptr);
RNA_def_struct_ui_text(srna, "Struct Definition", "RNA structure definition");
RNA_def_struct_ui_icon(srna, ICON_RNA);
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(prop, "rna_Struct_name_get", "rna_Struct_name_length", NULL);
RNA_def_property_string_funcs(prop, "rna_Struct_name_get", "rna_Struct_name_length", nullptr);
RNA_def_property_ui_text(prop, "Name", "Human readable name");
prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_Struct_identifier_get", "rna_Struct_identifier_length", NULL);
prop, "rna_Struct_identifier_get", "rna_Struct_identifier_length", nullptr);
RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_Struct_description_get", "rna_Struct_description_length", NULL);
prop, "rna_Struct_description_get", "rna_Struct_description_length", nullptr);
RNA_def_property_ui_text(prop, "Description", "Description of the Struct's purpose");
prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_Struct_translation_context_get", "rna_Struct_translation_context_length", NULL);
RNA_def_property_string_funcs(prop,
"rna_Struct_translation_context_get",
"rna_Struct_translation_context_length",
nullptr);
RNA_def_property_ui_text(
prop, "Translation Context", "Translation context of the struct's name");
prop = RNA_def_property(srna, "base", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", nullptr, nullptr, nullptr);
RNA_def_property_ui_text(prop, "Base", "Struct definition this is derived from");
prop = RNA_def_property(srna, "nested", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
RNA_def_property_pointer_funcs(prop, "rna_Struct_nested_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(prop, "rna_Struct_nested_get", nullptr, nullptr, nullptr);
RNA_def_property_ui_text(
prop,
"Nested",
@@ -2894,7 +2920,7 @@ static void rna_def_struct(BlenderRNA *brna)
prop = RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "StringProperty");
RNA_def_property_pointer_funcs(prop, "rna_Struct_name_property_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(prop, "rna_Struct_name_property_get", nullptr, nullptr, nullptr);
RNA_def_property_ui_text(prop, "Name Property", "Property that gives the name of the struct");
prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
@@ -2905,10 +2931,10 @@ static void rna_def_struct(BlenderRNA *brna)
"rna_Struct_properties_next",
"rna_iterator_listbase_end",
"rna_Struct_properties_get",
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
RNA_def_property_ui_text(prop, "Properties", "Properties in the struct");
prop = RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE);
@@ -2919,10 +2945,10 @@ static void rna_def_struct(BlenderRNA *brna)
"rna_Struct_functions_next",
"rna_iterator_listbase_end",
"rna_Struct_functions_get",
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
RNA_def_property_ui_text(prop, "Functions", "");
prop = RNA_def_property(srna, "property_tags", PROP_COLLECTION, PROP_NONE);
@@ -2933,10 +2959,10 @@ static void rna_def_struct(BlenderRNA *brna)
"rna_iterator_array_next",
"rna_iterator_array_end",
"rna_iterator_array_get",
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
RNA_def_property_ui_text(
prop, "Property Tags", "Tags that properties can use to influence behavior");
}
@@ -2946,30 +2972,31 @@ static void rna_def_property(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem dummy_prop_tags[] = {
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
srna = RNA_def_struct(brna, "Property", NULL);
srna = RNA_def_struct(brna, "Property", nullptr);
RNA_def_struct_ui_text(srna, "Property Definition", "RNA property definition");
RNA_def_struct_refine_func(srna, "rna_Property_refine");
RNA_def_struct_ui_icon(srna, ICON_RNA);
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(prop, "rna_Property_name_get", "rna_Property_name_length", NULL);
RNA_def_property_string_funcs(
prop, "rna_Property_name_get", "rna_Property_name_length", nullptr);
RNA_def_property_ui_text(prop, "Name", "Human readable name");
prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_Property_identifier_get", "rna_Property_identifier_length", NULL);
prop, "rna_Property_identifier_get", "rna_Property_identifier_length", nullptr);
RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
prop, "rna_Property_description_get", "rna_Property_description_length", nullptr);
RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips");
prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
@@ -2977,65 +3004,65 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_string_funcs(prop,
"rna_Property_translation_context_get",
"rna_Property_translation_context_length",
NULL);
nullptr);
RNA_def_property_ui_text(
prop, "Translation Context", "Translation context of the property's name");
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, rna_enum_property_type_items);
RNA_def_property_enum_funcs(prop, "rna_Property_type_get", NULL, NULL);
RNA_def_property_enum_funcs(prop, "rna_Property_type_get", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Type", "Data type of the property");
prop = RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, rna_enum_property_subtype_items);
RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL, NULL);
RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Subtype", "Semantic interpretation of the property");
prop = RNA_def_property(srna, "srna", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
RNA_def_property_pointer_funcs(prop, "rna_Property_srna_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(prop, "rna_Property_srna_get", nullptr, nullptr, nullptr);
RNA_def_property_ui_text(
prop, "Base", "Struct definition used for properties assigned to this item");
prop = RNA_def_property(srna, "unit", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, rna_enum_property_unit_items);
RNA_def_property_enum_funcs(prop, "rna_Property_unit_get", NULL, NULL);
RNA_def_property_enum_funcs(prop, "rna_Property_unit_get", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Unit", "Type of units for this property");
prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, rna_enum_icon_items);
RNA_def_property_enum_funcs(prop, "rna_Property_icon_get", NULL, NULL);
RNA_def_property_enum_funcs(prop, "rna_Property_icon_get", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Icon", "Icon of the item");
prop = RNA_def_property(srna, "is_readonly", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", nullptr);
RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
prop = RNA_def_property(srna, "is_animatable", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_animatable_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_animatable_get", nullptr);
RNA_def_property_ui_text(prop, "Animatable", "Property is animatable through RNA");
prop = RNA_def_property(srna, "is_overridable", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_overridable_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_overridable_get", nullptr);
RNA_def_property_ui_text(prop, "Overridable", "Property is overridable through RNA");
prop = RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", nullptr);
RNA_def_property_ui_text(
prop, "Required", "False when this property is an optional argument in an RNA function");
prop = RNA_def_property(srna, "is_argument_optional", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_argument_optional_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_argument_optional_get", nullptr);
RNA_def_property_ui_text(
prop,
"Optional Argument",
@@ -3043,64 +3070,64 @@ static void rna_def_property(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_never_none", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_never_none_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_never_none_get", nullptr);
RNA_def_property_ui_text(prop, "Never None", "True when this value can't be set to None");
prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_hidden_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_hidden_get", nullptr);
RNA_def_property_ui_text(prop, "Hidden", "True when the property is hidden");
prop = RNA_def_property(srna, "is_skip_save", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_skip_save_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_skip_save_get", nullptr);
RNA_def_property_ui_text(prop, "Skip Save", "True when the property is not saved in presets");
prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_use_output_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_use_output_get", nullptr);
RNA_def_property_ui_text(
prop, "Return", "True when this property is an output value from an RNA function");
prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_registered_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_registered_get", nullptr);
RNA_def_property_ui_text(
prop, "Registered", "Property is registered as part of type registration");
prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_registered_optional_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_registered_optional_get", nullptr);
RNA_def_property_ui_text(prop,
"Registered Optionally",
"Property is optionally registered as part of type registration");
prop = RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_runtime_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_runtime_get", nullptr);
RNA_def_property_ui_text(prop, "Runtime", "Property has been dynamically created at runtime");
prop = RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_enum_flag_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_enum_flag_get", nullptr);
RNA_def_property_ui_text(prop, "Enum Flag", "True when multiple enums ");
prop = RNA_def_property(srna, "is_library_editable", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_library_editable_flag_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_library_editable_flag_get", nullptr);
RNA_def_property_ui_text(
prop, "Library Editable", "Property is editable from linked instances (changes not saved)");
prop = RNA_def_property(srna, "is_path_output", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_path_output_flag_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_path_output_flag_get", nullptr);
RNA_def_property_ui_text(
prop, "Path Output", "Property is a filename, filepath or directory output");
prop = RNA_def_property(srna, "tags", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, dummy_prop_tags);
RNA_def_property_enum_funcs(prop, "rna_Property_tags_get", NULL, "rna_Property_tags_itemf");
RNA_def_property_enum_funcs(prop, "rna_Property_tags_get", nullptr, "rna_Property_tags_itemf");
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
RNA_def_property_ui_text(
prop, "Tags", "Subset of tags (defined in parent struct) that are set for this property");
@@ -3111,21 +3138,21 @@ static void rna_def_function(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Function", NULL);
srna = RNA_def_struct(brna, "Function", nullptr);
RNA_def_struct_ui_text(srna, "Function Definition", "RNA function definition");
RNA_def_struct_ui_icon(srna, ICON_RNA);
prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_Function_identifier_get", "rna_Function_identifier_length", NULL);
prop, "rna_Function_identifier_get", "rna_Function_identifier_length", nullptr);
RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_Function_description_get", "rna_Function_description_length", NULL);
prop, "rna_Function_description_get", "rna_Function_description_length", nullptr);
RNA_def_property_ui_text(prop, "Description", "Description of the Function's purpose");
prop = RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE);
@@ -3136,21 +3163,21 @@ static void rna_def_function(BlenderRNA *brna)
"rna_iterator_listbase_next",
"rna_iterator_listbase_end",
"rna_iterator_listbase_get",
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function");
prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Function_registered_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Function_registered_get", nullptr);
RNA_def_property_ui_text(
prop, "Registered", "Function is registered as callback as part of type registration");
prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Function_registered_optional_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Function_registered_optional_get", nullptr);
RNA_def_property_ui_text(
prop,
"Registered Optionally",
@@ -3158,7 +3185,7 @@ static void rna_def_function(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Function_no_self_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Function_no_self_get", nullptr);
RNA_def_property_ui_text(
prop,
"No Self",
@@ -3166,7 +3193,7 @@ static void rna_def_function(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_self_type", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Function_use_self_type_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Function_use_self_type_get", nullptr);
RNA_def_property_ui_text(prop,
"Use Self Type",
"Function passes itself type as an argument (becomes a class method "
@@ -3183,13 +3210,13 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type)
switch (type) {
case PROP_BOOLEAN:
RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_get", nullptr);
break;
case PROP_INT:
RNA_def_property_int_funcs(prop, "rna_IntProperty_default_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_IntProperty_default_get", nullptr, nullptr);
break;
case PROP_FLOAT:
RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_get", NULL, NULL);
RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_get", nullptr, nullptr);
break;
default:
break;
@@ -3207,13 +3234,13 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type)
switch (type) {
case PROP_BOOLEAN:
RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_array_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_array_get", nullptr);
break;
case PROP_INT:
RNA_def_property_int_funcs(prop, "rna_IntProperty_default_array_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_IntProperty_default_array_get", nullptr, nullptr);
break;
case PROP_FLOAT:
RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_array_get", NULL, NULL);
RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_array_get", nullptr, nullptr);
break;
default:
break;
@@ -3222,18 +3249,18 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type)
prop = RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited");
prop = RNA_def_property(srna, "array_dimensions", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_array(prop, RNA_MAX_ARRAY_DIMENSION);
RNA_def_property_int_funcs(prop, "rna_Property_array_dimensions_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_Property_array_dimensions_get", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Array Dimensions", "Length of each dimension of the array");
prop = RNA_def_property(srna, "is_array", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_NumberProperty_is_array_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_NumberProperty_is_array_get", nullptr);
RNA_def_property_ui_text(prop, "Is Array", "");
if (type == PROP_BOOLEAN) {
@@ -3243,50 +3270,50 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type)
prop = RNA_def_property(srna, "hard_min", type, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
if (type == PROP_INT) {
RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", nullptr, nullptr);
}
else {
RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_min_get", NULL, NULL);
RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_min_get", nullptr, nullptr);
}
RNA_def_property_ui_text(prop, "Hard Minimum", "Minimum value used by buttons");
prop = RNA_def_property(srna, "hard_max", type, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
if (type == PROP_INT) {
RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", nullptr, nullptr);
}
else {
RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_max_get", NULL, NULL);
RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_max_get", nullptr, nullptr);
}
RNA_def_property_ui_text(prop, "Hard Maximum", "Maximum value used by buttons");
prop = RNA_def_property(srna, "soft_min", type, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
if (type == PROP_INT) {
RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", nullptr, nullptr);
}
else {
RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_min_get", NULL, NULL);
RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_min_get", nullptr, nullptr);
}
RNA_def_property_ui_text(prop, "Soft Minimum", "Minimum value used by buttons");
prop = RNA_def_property(srna, "soft_max", type, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
if (type == PROP_INT) {
RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", nullptr, nullptr);
}
else {
RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_max_get", NULL, NULL);
RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_max_get", nullptr, nullptr);
}
RNA_def_property_ui_text(prop, "Soft Maximum", "Maximum value used by buttons");
prop = RNA_def_property(srna, "step", type, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
if (type == PROP_INT) {
RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", nullptr, nullptr);
}
else {
RNA_def_property_float_funcs(prop, "rna_FloatProperty_step_get", NULL, NULL);
RNA_def_property_float_funcs(prop, "rna_FloatProperty_step_get", nullptr, nullptr);
}
RNA_def_property_ui_text(
prop, "Step", "Step size used by number buttons, for floats 1/100th of the step size");
@@ -3294,7 +3321,7 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type)
if (type == PROP_FLOAT) {
prop = RNA_def_property(srna, "precision", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_FloatProperty_precision_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_FloatProperty_precision_get", nullptr, nullptr);
RNA_def_property_ui_text(prop,
"Precision",
"Number of digits after the dot used by buttons. Fraction is "
@@ -3310,12 +3337,12 @@ static void rna_def_string_property(StructRNA *srna)
prop = RNA_def_property(srna, "default", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_StringProperty_default_get", "rna_StringProperty_default_length", NULL);
prop, "rna_StringProperty_default_get", "rna_StringProperty_default_length", nullptr);
RNA_def_property_ui_text(prop, "Default", "String default value");
prop = RNA_def_property(srna, "length_max", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_StringProperty_max_length_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_StringProperty_max_length_get", nullptr, nullptr);
RNA_def_property_ui_text(
prop, "Maximum Length", "Maximum length of the string, 0 means unlimited");
}
@@ -3327,14 +3354,14 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
/* the itemf func is used instead, keep blender happy */
static const EnumPropertyItem default_dummy_items[] = {
{PROP_NONE, "DUMMY", 0, "Dummy", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
prop = RNA_def_property(srna, "default", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, default_dummy_items);
RNA_def_property_enum_funcs(
prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
prop, "rna_EnumProperty_default_get", nullptr, "rna_EnumProperty_default_itemf");
RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
/* same 'default' but uses 'PROP_ENUM_FLAG' */
@@ -3343,7 +3370,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
RNA_def_property_enum_items(prop, default_dummy_items);
RNA_def_property_enum_funcs(
prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
prop, "rna_EnumProperty_default_get", nullptr, "rna_EnumProperty_default_itemf");
RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
prop = RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE);
@@ -3354,10 +3381,10 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
"rna_iterator_array_next",
"rna_iterator_array_end",
"rna_iterator_array_get",
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
RNA_def_property_ui_text(prop, "Items", "Possible values for the property");
prop = RNA_def_property(srna, "enum_items_static", PROP_COLLECTION, PROP_NONE);
@@ -3368,10 +3395,10 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
"rna_iterator_array_next",
"rna_iterator_array_end",
"rna_iterator_array_get",
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
RNA_def_property_ui_text(
prop,
"Static Items",
@@ -3387,17 +3414,17 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
"rna_iterator_array_next",
"rna_iterator_array_end",
"rna_iterator_array_get",
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
RNA_def_property_ui_text(
prop,
"Static Items with UI Elements",
"Possible values for the property (never calls optional dynamic generation of those). "
"Includes UI elements (separators and section headings)");
srna = RNA_def_struct(brna, "EnumPropertyItem", NULL);
srna = RNA_def_struct(brna, "EnumPropertyItem", nullptr);
RNA_def_struct_ui_text(
srna, "Enum Item Definition", "Definition of a choice in an RNA enum property");
RNA_def_struct_ui_icon(srna, ICON_RNA);
@@ -3405,7 +3432,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_EnumPropertyItem_name_get", "rna_EnumPropertyItem_name_length", NULL);
prop, "rna_EnumPropertyItem_name_get", "rna_EnumPropertyItem_name_length", nullptr);
RNA_def_property_ui_text(prop, "Name", "Human readable name");
prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
@@ -3413,25 +3440,27 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_string_funcs(prop,
"rna_EnumPropertyItem_description_get",
"rna_EnumPropertyItem_description_length",
NULL);
nullptr);
RNA_def_property_ui_text(prop, "Description", "Description of the item's purpose");
prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_EnumPropertyItem_identifier_get", "rna_EnumPropertyItem_identifier_length", NULL);
RNA_def_property_string_funcs(prop,
"rna_EnumPropertyItem_identifier_get",
"rna_EnumPropertyItem_identifier_length",
nullptr);
RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_EnumPropertyItem_value_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_EnumPropertyItem_value_get", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Value", "Value of the item");
prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, rna_enum_icon_items);
RNA_def_property_enum_funcs(prop, "rna_EnumPropertyItem_icon_get", NULL, NULL);
RNA_def_property_enum_funcs(prop, "rna_EnumPropertyItem_icon_get", nullptr, nullptr);
RNA_def_property_ui_text(prop, "Icon", "Icon of the item");
}
@@ -3443,11 +3472,12 @@ static void rna_def_pointer_property(StructRNA *srna, PropertyType type)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
if (type == PROP_POINTER) {
RNA_def_property_pointer_funcs(prop, "rna_PointerProperty_fixed_type_get", NULL, NULL, NULL);
RNA_def_property_pointer_funcs(
prop, "rna_PointerProperty_fixed_type_get", nullptr, nullptr, nullptr);
}
else {
RNA_def_property_pointer_funcs(
prop, "rna_CollectionProperty_fixed_type_get", NULL, NULL, NULL);
prop, "rna_CollectionProperty_fixed_type_get", nullptr, nullptr, nullptr);
}
RNA_def_property_ui_text(prop, "Pointer Type", "Fixed pointer type, empty if variable type");
}
@@ -3460,30 +3490,30 @@ static void rna_def_rna_primitive(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "PrimitiveString", NULL);
srna = RNA_def_struct(brna, "PrimitiveString", nullptr);
RNA_def_struct_ui_text(srna, "String Value", "RNA wrapped string");
prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(
prop, "rna_PrimitiveString_value_get", "rna_PrimitiveString_value_length", NULL);
prop, "rna_PrimitiveString_value_get", "rna_PrimitiveString_value_length", nullptr);
srna = RNA_def_struct(brna, "PrimitiveInt", NULL);
srna = RNA_def_struct(brna, "PrimitiveInt", nullptr);
RNA_def_struct_ui_text(srna, "Primitive Int", "RNA wrapped int");
prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_PrimitiveInt_value_get", NULL, NULL);
RNA_def_property_int_funcs(prop, "rna_PrimitiveInt_value_get", nullptr, nullptr);
srna = RNA_def_struct(brna, "PrimitiveFloat", NULL);
srna = RNA_def_struct(brna, "PrimitiveFloat", nullptr);
RNA_def_struct_ui_text(srna, "Primitive Float", "RNA wrapped float");
prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_float_funcs(prop, "rna_PrimitiveFloat_value_get", NULL, NULL);
RNA_def_property_float_funcs(prop, "rna_PrimitiveFloat_value_get", nullptr, nullptr);
srna = RNA_def_struct(brna, "PrimitiveBoolean", NULL);
srna = RNA_def_struct(brna, "PrimitiveBoolean", nullptr);
RNA_def_struct_ui_text(srna, "Primitive Boolean", "RNA wrapped boolean");
prop = RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_PrimitiveBoolean_value_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_PrimitiveBoolean_value_get", nullptr);
}
void RNA_def_rna(BlenderRNA *brna)
@@ -3544,7 +3574,7 @@ void RNA_def_rna(BlenderRNA *brna)
rna_def_function(brna);
/* Blender RNA */
srna = RNA_def_struct(brna, "BlenderRNA", NULL);
srna = RNA_def_struct(brna, "BlenderRNA", nullptr);
RNA_def_struct_ui_text(srna, "Blender RNA", "Blender RNA structure definitions");
RNA_def_struct_ui_icon(srna, ICON_RNA);
@@ -3556,17 +3586,17 @@ void RNA_def_rna(BlenderRNA *brna)
"rna_iterator_listbase_next",
"rna_iterator_listbase_end",
"rna_iterator_listbase_get",
/* included for speed, can be removed */
/* included for speed, can be removed */
# if 0
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
# else
"rna_BlenderRNA_structs_length",
"rna_BlenderRNA_structs_lookup_int",
"rna_BlenderRNA_structs_lookup_string",
NULL);
nullptr);
# endif
RNA_def_property_ui_text(prop, "Structs", "");

View File

@@ -25,7 +25,7 @@
# include "WM_api.h"
/* Matching function in rna_ID.c */
/* Matching function in rna_ID.cc */
static int rna_VectorFont_filepath_editable(PointerRNA *ptr, const char ** /*r_info*/)
{
VFont *vfont = (VFont *)ptr->owner_id;

View File

@@ -634,7 +634,7 @@ static void rna_def_volume(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
RNA_def_property_collection_funcs(prop,
nullptr,
nullptr,

View File

@@ -39,7 +39,7 @@
static bool bpy_gizmotype_target_property_def(wmGizmoType *gzt, PyObject *item)
{
/* NOTE: names based on `rna_rna.c`. */
/* NOTE: names based on `rna_rna.cc`. */
PyObject *empty_tuple = PyTuple_New(0);
struct {

View File

@@ -3326,7 +3326,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
const char *translation_context = nullptr;
int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX;
int step = 1;
int default_value[RNA_MAX_ARRAY_DIMENSION][PYRNA_STACK_ARRAY] = {0};
int default_value[RNA_MAX_ARRAY_DIMENSION][PYRNA_STACK_ARRAY] = {};
BPyPropArrayLength array_len_info{};
array_len_info.len_total = 3;
PropertyRNA *prop;