30 # define snprintf _snprintf
55 #define TMP_EXT ".tmp"
59 static int file_older(
const char *file1,
const char *file2)
63 printf(
"compare: %s %s\n", file1, file2);
66 if (stat(file1, &st1)) {
69 if (stat(file2, &st2)) {
73 return (st1.st_mtime < st2.st_mtime);
81 const char *name_override,
94 #define WRITE_PARAM(param) \
105 #define REN_IF_DIFF \
107 FILE *file_test = fopen(orgfile, "rb"); \
116 if (remove(orgfile) != 0) { \
117 CLOG_ERROR(&LOG, "remove error (%s): \"%s\"", strerror(errno), orgfile); \
122 if (rename(tmpfile, orgfile) != 0) { \
123 CLOG_ERROR(&LOG, "rename error (%s): \"%s\" -> \"%s\"", strerror(errno), tmpfile, orgfile); \
131 FILE *fp_new =
NULL, *fp_org =
NULL;
132 int len_new, len_org;
133 char *arr_new, *arr_org;
138 strcpy(orgfile, tmpfile);
139 orgfile[strlen(orgfile) - strlen(
TMP_EXT)] =
'\0';
141 fp_org = fopen(orgfile,
"rb");
143 if (fp_org ==
NULL) {
164 for (pass = 0; dep_files[pass]; pass++) {
165 const char from_path[4096] = __FILE__;
169 p1 = strrchr(from_path,
'/');
170 p2 = strrchr(from_path,
'\\');
171 strcpy((p1 > p2 ? p1 : p2) + 1, dep_files[pass]);
181 fp_new = fopen(tmpfile,
"rb");
183 if (fp_new ==
NULL) {
190 fseek(fp_new, 0
L, SEEK_END);
191 len_new = ftell(fp_new);
192 fseek(fp_new, 0
L, SEEK_SET);
193 fseek(fp_org, 0
L, SEEK_END);
194 len_org = ftell(fp_org);
195 fseek(fp_org, 0
L, SEEK_SET);
197 if (len_new != len_org) {
206 arr_new =
MEM_mallocN(
sizeof(
char) * len_new,
"rna_cmp_file_new");
207 arr_org =
MEM_mallocN(
sizeof(
char) * len_org,
"rna_cmp_file_org");
209 if (fread(arr_new,
sizeof(
char), len_new, fp_new) != len_new) {
210 CLOG_ERROR(&
LOG,
"unable to read file %s for comparison.", tmpfile);
212 if (fread(arr_org,
sizeof(
char), len_org, fp_org) != len_org) {
213 CLOG_ERROR(&
LOG,
"unable to read file %s for comparison.", orgfile);
221 cmp = memcmp(arr_new, arr_org, len_new);
239 if (
STREQ(
id,
"default")) {
240 return "default_value";
242 if (
STREQ(
id,
"operator")) {
243 return "operator_value";
245 if (
STREQ(
id,
"new")) {
248 if (
STREQ(
id,
"co_return")) {
250 return "coord_return";
285 return strcmp(propa->
name, propb->
name);
314 for (
size = 0, link = listbase->
first; link; link = link->
next) {
319 for (
a = 0, link = listbase->
first; link; link = link->
next,
a++) {
339 static const char *escape[] = {
340 "\''",
"\"\"",
"\??",
"\\\\",
"\aa",
"\bb",
"\ff",
"\nn",
"\rr",
"\tt",
"\vv",
NULL};
349 for (i = 0;
str[i]; i++) {
350 for (j = 0; escape[j]; j++) {
351 if (
str[i] == escape[j][0]) {
357 fprintf(f,
"\\%c", escape[j][1]);
360 fprintf(f,
"%c",
str[i]);
370 " %s *data = (%s *)(((%s *)ptr->data)->%s);\n",
383 fprintf(f,
" ID *id = ptr->owner_id;\n");
387 char *
buffer,
int size,
const char *structname,
const char *propname,
const char *
type)
393 char *
buffer,
int size,
const char *structname,
const char *propname,
const char *
type)
421 const char *propname,
470 switch (prop->
type) {
489 return "const char *";
532 switch (parm->
type) {
542 return "CollectionListBase";
545 return "<error, no type specified>";
579 #define DEF_ENUM(id) \
581 return STRINGIFY(id); \
590 return (func) ? (
const char *)func :
"NULL";
595 if (num == -FLT_MAX) {
596 fprintf(f,
"-FLT_MAX");
598 else if (num == FLT_MAX) {
599 fprintf(f,
"FLT_MAX");
602 fprintf(f,
"%.1ff", num);
605 fprintf(f,
"%.10ff", num);
611 if (num == INT_MIN) {
612 fprintf(f,
"INT_MIN");
614 else if (num == INT_MAX) {
615 fprintf(f,
"INT_MAX");
618 fprintf(f,
"INT64_MIN");
621 fprintf(f,
"INT64_MAX");
623 else if (num < INT_MIN || num > INT_MAX) {
624 fprintf(f,
"%" PRId64 "LL", num);
627 fprintf(f,
"%d", (
int)num);
655 "%s.%s is a '%s' but wrapped as type '%s'.",
668 "%s.%s is a '%s' but wrapped as type '%s'.",
680 "%s.%s is a '%s' but wrapped as type '%s'.",
717 switch (prop->
type) {
720 fprintf(f,
"void %s(PointerRNA *ptr, char *value)\n", func);
723 fprintf(f,
" %s(ptr, value);\n", manualfunc);
727 const char *string_copy_func =
736 fprintf(f,
" if (data->%s == NULL) {\n", dp->
dnaname);
737 fprintf(f,
" *value = '\\0';\n");
738 fprintf(f,
" return;\n");
741 " %s(value, data->%s, strlen(data->%s) + 1);\n",
750 " %s(value, data->%s, %d);\n",
757 " %s(value, data->%s, sizeof(data->%s));\n",
768 fprintf(f,
"PointerRNA %s(PointerRNA *ptr)\n", func);
771 fprintf(f,
" return %s(ptr);\n", manualfunc);
778 " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n",
779 (
const char *)pprop->
type,
784 " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n",
785 (
const char *)pprop->
type,
795 fprintf(f,
"static PointerRNA %s(CollectionPropertyIterator *iter)\n", func);
799 "rna_iterator_listbase_get",
800 "rna_iterator_array_get",
801 "rna_iterator_array_dereference_get")) {
803 " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n",
808 fprintf(f,
" return %s(iter);\n", manualfunc);
817 fprintf(f,
"void %s(PointerRNA *ptr, %s values[])\n", func,
rna_type_type(prop));
821 "void %s(PointerRNA *ptr, %s values[%u])\n",
829 fprintf(f,
" %s(ptr, values);\n", manualfunc);
837 fprintf(f,
" unsigned int arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
838 fprintf(f,
" unsigned int i;\n");
839 fprintf(f,
" unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
840 fprintf(f,
" for (i = 0; i < len; i++) {\n");
844 fprintf(f,
" unsigned int i;\n\n");
845 fprintf(f,
" for (i = 0; i < %u; i++) {\n", prop->
totarraylength);
851 " values[i] = %s((data->%s & (",
855 fprintf(f,
" << i)) != 0);\n");
859 " values[i] = (%s)%s((&data->%s)[i]);\n",
868 " values[i] = %s((data->%s[i] & ",
872 fprintf(f,
") != 0);\n");
876 " values[i] = (%s)(data->%s[i] * (1.0f / 255.0f));\n",
882 " values[i] = (%s)%s(((%s *)data->%s)[i]);\n",
890 " values[i] = (%s)%s((data->%s)[i]);\n",
901 fprintf(f,
"%s %s(PointerRNA *ptr)\n",
rna_type_type(prop), func);
905 fprintf(f,
" return %s(ptr);\n", manualfunc);
913 fprintf(f,
") != 0);\n");
916 fprintf(f,
" return ((data->%s) & ", dp->
dnaname);
922 " return (%s)%s(data->%s);\n",
944 " float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, "
947 " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
955 " int prop_clamp_min = INT_MIN, prop_clamp_max = INT_MAX, prop_soft_min, "
958 " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
964 #ifdef USE_RNA_RANGE_CHECK
965 static void rna_clamp_value_range_check(FILE *f,
967 const char *dnaname_prefix,
973 " { BLI_STATIC_ASSERT("
974 "(TYPEOF_MAX(%s%s) >= %d) && "
975 "(TYPEOF_MIN(%s%s) <= %d), "
976 "\"invalid limits\"); }\n",
994 fprintf(f,
"CLAMPIS(values[i], ");
997 fprintf(f,
"CLAMPIS(value, ");
1000 fprintf(f,
"prop_clamp_min, prop_clamp_max);");
1016 fprintf(f,
"CLAMPIS(values[i], ");
1019 fprintf(f,
"CLAMPIS(value, ");
1022 fprintf(f,
"prop_clamp_min, prop_clamp_max);");
1035 fprintf(f,
"values[i];\n");
1038 fprintf(f,
"value;\n");
1046 const char *manualfunc)
1061 "const bContext *C, "
1063 "PropertyRNA *prop, "
1064 "const char *edit_text, "
1065 "StringPropertySearchVisitFunc visit_fn, "
1066 "void *visit_user_data)\n",
1069 fprintf(f,
"\n %s(C, ptr, prop, edit_text, visit_fn, visit_user_data);\n", manualfunc);
1070 fprintf(f,
"}\n\n");
1098 switch (prop->
type) {
1101 fprintf(f,
"void %s(PointerRNA *ptr, const char *value)\n", func);
1104 fprintf(f,
" %s(ptr, value);\n", manualfunc);
1108 const char *string_copy_func =
1118 f,
" if (data->%s != NULL) { MEM_freeN(data->%s); }\n", dp->
dnaname, dp->
dnaname);
1119 fprintf(f,
" const int length = strlen(value);\n");
1120 fprintf(f,
" if (length > 0) {\n");
1121 fprintf(f,
" data->%s = MEM_mallocN(length + 1, __func__);\n", dp->
dnaname);
1122 fprintf(f,
" %s(data->%s, value, length + 1);\n", string_copy_func, dp->
dnaname);
1123 fprintf(f,
" } else { data->%s = NULL; }\n", dp->
dnaname);
1129 " %s(data->%s, value, %d);\n",
1136 " %s(data->%s, value, sizeof(data->%s));\n",
1143 fprintf(f,
"}\n\n");
1147 fprintf(f,
"void %s(PointerRNA *ptr, PointerRNA value, struct ReportList *reports)\n", func);
1150 fprintf(f,
" %s(ptr, value, reports);\n", manualfunc);
1157 fprintf(f,
" if (id == value.data) {\n");
1158 fprintf(f,
" return;\n");
1163 fprintf(f,
"\n if (data->%s) {\n", dp->
dnaname);
1164 fprintf(f,
" id_us_min((ID *)data->%s);\n", dp->
dnaname);
1166 fprintf(f,
" if (value.data) {\n");
1167 fprintf(f,
" id_us_plus((ID *)value.data);\n");
1174 fprintf(f,
" if (value.data) {\n");
1175 fprintf(f,
" id_lib_extern((ID *)value.data);\n");
1180 fprintf(f,
" data->%s = value.data;\n", dp->
dnaname);
1182 fprintf(f,
"}\n\n");
1188 fprintf(f,
"void %s(PointerRNA *ptr, const %s values[])\n", func,
rna_type_type(prop));
1192 "void %s(PointerRNA *ptr, const %s values[%u])\n",
1200 fprintf(f,
" %s(ptr, values);\n", manualfunc);
1208 fprintf(f,
" unsigned int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
1209 fprintf(f,
" unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
1211 fprintf(f,
" for (i = 0; i < len; i++) {\n");
1215 fprintf(f,
" unsigned int i;\n\n");
1217 fprintf(f,
" for (i = 0; i < %u; i++) {\n", prop->
totarraylength);
1223 " if (%svalues[i]) { data->%s |= (",
1227 fprintf(f,
" << i); }\n");
1228 fprintf(f,
" else { data->%s &= ~(", dp->
dnaname);
1230 fprintf(f,
" << i); }\n");
1241 " if (%svalues[i]) { data->%s[i] |= ",
1245 fprintf(f,
"; }\n");
1246 fprintf(f,
" else { data->%s[i] &= ~", dp->
dnaname);
1248 fprintf(f,
"; }\n");
1252 f,
" data->%s[i] = unit_float_to_uchar_clamp(values[i]);\n", dp->
dnaname);
1257 " ((%s *)data->%s)[i] = %s",
1264 " (data->%s)[i] = %s",
1274 #ifdef USE_RNA_RANGE_CHECK
1277 rna_clamp_value_range_check(f, prop,
"data->", dp->
dnaname);
1280 rna_clamp_value_range_check(f, prop,
"*data->", dp->
dnaname);
1285 fprintf(f,
"}\n\n");
1288 fprintf(f,
"void %s(PointerRNA *ptr, %s value)\n", func,
rna_type_type(prop));
1292 fprintf(f,
" %s(ptr, value);\n", manualfunc);
1298 " if (%svalue) { data->%s |= ",
1302 fprintf(f,
"; }\n");
1303 fprintf(f,
" else { data->%s &= ~", dp->
dnaname);
1305 fprintf(f,
"; }\n");
1308 fprintf(f,
" data->%s &= ~", dp->
dnaname);
1311 fprintf(f,
" data->%s |= value;\n", dp->
dnaname);
1320 #ifdef USE_RNA_RANGE_CHECK
1322 rna_clamp_value_range_check(f, prop,
"data->", dp->
dnaname);
1326 fprintf(f,
"}\n\n");
1354 fprintf(f,
"int %s(PointerRNA *ptr)\n", func);
1357 fprintf(f,
" return %s(ptr);\n", manualfunc);
1364 " return (data->%s == NULL) ? 0 : strlen(data->%s);\n",
1370 fprintf(f,
" return strlen(data->%s);\n", dp->
dnaname);
1373 fprintf(f,
"}\n\n");
1387 fprintf(f,
"int %s(PointerRNA *ptr)\n", func);
1390 fprintf(f,
" return %s(ptr);\n", manualfunc);
1398 fprintf(f,
" return ");
1401 fprintf(f,
" return (data->%s == NULL) ? 0 : ", dp->
dnaname);
1411 fprintf(f,
"}\n\n");
1420 char *func, *getfunc;
1436 fprintf(f,
"void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
1443 fprintf(f,
"\n memset(iter, 0, sizeof(*iter));\n");
1444 fprintf(f,
" iter->parent = *ptr;\n");
1449 fprintf(f,
"\n %s(iter, ptr);\n", manualfunc);
1454 "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, "
1463 "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n",
1472 fprintf(f,
"\n %s(iter, ptr);\n", manualfunc);
1475 fprintf(f,
"\n rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->
dnaname);
1478 fprintf(f,
"\n rna_iterator_listbase_begin(iter, data->%s, NULL);\n", dp->
dnaname);
1484 fprintf(f,
"\n if (iter->valid) {\n");
1485 fprintf(f,
" iter->ptr = %s(iter);", getfunc);
1486 fprintf(f,
"\n }\n");
1488 fprintf(f,
"}\n\n");
1497 const char *manualfunc,
1498 const char *nextfunc)
1514 if (
STREQ(nextfunc,
"rna_iterator_array_next")) {
1516 else if (
STREQ(nextfunc,
"rna_iterator_listbase_next")) {
1525 fprintf(f,
"int %s(PointerRNA *ptr, int index, PointerRNA *r_ptr)\n", func);
1529 fprintf(f,
"\n return %s(ptr, index, r_ptr);\n", manualfunc);
1530 fprintf(f,
"}\n\n");
1534 fprintf(f,
" int found = 0;\n");
1535 fprintf(f,
" CollectionPropertyIterator iter;\n\n");
1538 fprintf(f,
" if (iter.valid) {\n");
1540 if (
STREQ(nextfunc,
"rna_iterator_array_next")) {
1541 fprintf(f,
" ArrayIterator *internal = &iter.internal.array;\n");
1542 fprintf(f,
" if (index < 0 || index >= internal->length) {\n");
1543 fprintf(f,
"#ifdef __GNUC__\n");
1545 " printf(\"Array iterator out of range: %%s (index %%d)\\n\", __func__, "
1547 fprintf(f,
"#else\n");
1548 fprintf(f,
" printf(\"Array iterator out of range: (index %%d)\\n\", index);\n");
1549 fprintf(f,
"#endif\n");
1551 fprintf(f,
" else if (internal->skip) {\n");
1552 fprintf(f,
" while (index-- > 0 && iter.valid) {\n");
1553 fprintf(f,
" rna_iterator_array_next(&iter);\n");
1555 fprintf(f,
" found = (index == -1 && iter.valid);\n");
1557 fprintf(f,
" else {\n");
1558 fprintf(f,
" internal->ptr += internal->itemsize * index;\n");
1559 fprintf(f,
" found = 1;\n");
1562 else if (
STREQ(nextfunc,
"rna_iterator_listbase_next")) {
1563 fprintf(f,
" ListBaseIterator *internal = &iter.internal.listbase;\n");
1564 fprintf(f,
" if (internal->skip) {\n");
1565 fprintf(f,
" while (index-- > 0 && iter.valid) {\n");
1566 fprintf(f,
" rna_iterator_listbase_next(&iter);\n");
1568 fprintf(f,
" found = (index == -1 && iter.valid);\n");
1570 fprintf(f,
" else {\n");
1571 fprintf(f,
" while (index-- > 0 && internal->link) {\n");
1572 fprintf(f,
" internal->link = internal->link->next;\n");
1574 fprintf(f,
" found = (index == -1 && internal->link);\n");
1579 " if (found) { *r_ptr = %s_%s_get(&iter); }\n",
1582 fprintf(f,
" }\n\n");
1585 fprintf(f,
" return found;\n");
1589 item_type = (cprop->item_type) ? (
const char *)cprop->item_type :
"UnknownType";
1594 "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, "
1604 "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n",
1614 "\n return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n",
1620 "\n return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n",
1627 fprintf(f,
"}\n\n");
1636 const char *manualfunc,
1637 const char *item_type)
1642 const int namebuflen = 1024;
1657 item_name_base = item_srna;
1659 item_name_base = item_name_base->
base;
1669 fprintf(f,
"int %s(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)\n", func);
1673 fprintf(f,
" return %s(ptr, key, r_ptr);\n", manualfunc);
1674 fprintf(f,
"}\n\n");
1682 " extern int %s_%s_length(PointerRNA *);\n",
1686 " extern void %s_%s_get(PointerRNA *, char *);\n\n",
1690 fprintf(f,
" bool found = false;\n");
1691 fprintf(f,
" CollectionPropertyIterator iter;\n");
1692 fprintf(f,
" char namebuf[%d];\n", namebuflen);
1693 fprintf(f,
" char *name;\n\n");
1697 fprintf(f,
" while (iter.valid) {\n");
1698 fprintf(f,
" if (iter.ptr.data) {\n");
1700 " int namelen = %s_%s_length(&iter.ptr);\n",
1703 fprintf(f,
" if (namelen < %d) {\n", namebuflen);
1705 " %s_%s_get(&iter.ptr, namebuf);\n",
1708 fprintf(f,
" if (strcmp(namebuf, key) == 0) {\n");
1709 fprintf(f,
" found = true;\n");
1710 fprintf(f,
" *r_ptr = iter.ptr;\n");
1711 fprintf(f,
" break;\n");
1714 fprintf(f,
" else {\n");
1715 fprintf(f,
" name = MEM_mallocN(namelen+1, \"name string\");\n");
1717 " %s_%s_get(&iter.ptr, name);\n",
1720 fprintf(f,
" if (strcmp(name, key) == 0) {\n");
1721 fprintf(f,
" MEM_freeN(name);\n\n");
1722 fprintf(f,
" found = true;\n");
1723 fprintf(f,
" *r_ptr = iter.ptr;\n");
1724 fprintf(f,
" break;\n");
1726 fprintf(f,
" else {\n");
1727 fprintf(f,
" MEM_freeN(name);\n");
1735 fprintf(f,
" return found;\n");
1736 fprintf(f,
"}\n\n");
1745 const char *manualfunc)
1747 char *func, *getfunc;
1759 fprintf(f,
"void %s(CollectionPropertyIterator *iter)\n", func);
1761 fprintf(f,
" %s(iter);\n", manualfunc);
1765 fprintf(f,
"\n if (iter->valid) {\n");
1766 fprintf(f,
" iter->ptr = %s(iter);", getfunc);
1767 fprintf(f,
"\n }\n");
1769 fprintf(f,
"}\n\n");
1778 const char *manualfunc)
1788 fprintf(f,
"void %s(CollectionPropertyIterator *iter)\n", func);
1791 fprintf(f,
" %s(iter);\n", manualfunc);
1793 fprintf(f,
"}\n\n");
1842 switch (prop->
type) {
1852 f, srna, prop, dp, (
const char *)bprop->
get);
1854 f, srna, prop, dp, (
const char *)bprop->
set);
1858 f, srna, prop, dp, (
const char *)bprop->
getarray);
1860 f, srna, prop, dp, (
const char *)bprop->
setarray);
1868 if (!iprop->
get && !iprop->
set) {
1873 f, srna, prop, dp, (
const char *)iprop->
get);
1875 f, srna, prop, dp, (
const char *)iprop->
set);
1883 f, srna, prop, dp, (
const char *)iprop->
getarray);
1885 f, srna, prop, dp, (
const char *)iprop->
setarray);
1893 if (!fprop->
get && !fprop->
set) {
1898 f, srna, prop, dp, (
const char *)fprop->
get);
1900 f, srna, prop, dp, (
const char *)fprop->
set);
1908 f, srna, prop, dp, (
const char *)fprop->
getarray);
1910 f, srna, prop, dp, (
const char *)fprop->
setarray);
1917 if (!eprop->
get && !eprop->
set) {
1930 f, srna, prop, dp, (
const char *)sprop->
length);
1933 f, srna, prop, dp, (
const char *)sprop->
search);
1950 const char *nextfunc = (
const char *)cprop->
next;
1951 const char *item_type = (
const char *)cprop->
item_type;
1956 f, srna, prop, dp, (
const char *)cprop->
length);
1963 f, srna, prop, dp, (
const char *)cprop->
length);
1968 if (cprop->
next && cprop->
get) {
1969 if (
STREQ((
const char *)cprop->
next,
"rna_iterator_array_next") &&
1970 STREQ((
const char *)cprop->
get,
"rna_iterator_array_get")) {
1977 f, srna, prop, dp, (
const char *)cprop->
begin);
1979 f, srna, prop, dp, (
const char *)cprop->
next);
1982 f, srna, prop, dp, (
const char *)cprop->
lookupint, nextfunc);
1984 f, srna, prop, dp, (
const char *)cprop->
lookupstring, item_type);
1987 if (!cprop->
begin) {
1989 "%s.%s, collection must have a begin function.",
1996 "%s.%s, collection must have a next function.",
2003 "%s.%s, collection must have a get function.",
2011 "%s.%s, collection must have a struct type.",
2034 switch (prop->
type) {
2037 fprintf(f,
"bool %sget(PointerRNA *ptr);\n", func);
2038 fprintf(f,
"void %sset(PointerRNA *ptr, bool value);\n", func);
2041 fprintf(f,
"void %sget(PointerRNA *ptr, bool values[%u]);\n", func, prop->
totarraylength);
2043 "void %sset(PointerRNA *ptr, const bool values[%u]);\n",
2048 fprintf(f,
"void %sget(PointerRNA *ptr, bool values[]);\n", func);
2049 fprintf(f,
"void %sset(PointerRNA *ptr, const bool values[]);\n", func);
2055 fprintf(f,
"int %sget(PointerRNA *ptr);\n", func);
2056 fprintf(f,
"void %sset(PointerRNA *ptr, int value);\n", func);
2059 fprintf(f,
"void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->
totarraylength);
2061 f,
"void %sset(PointerRNA *ptr, const int values[%u]);\n", func, prop->
totarraylength);
2064 fprintf(f,
"void %sget(PointerRNA *ptr, int values[]);\n", func);
2065 fprintf(f,
"void %sset(PointerRNA *ptr, const int values[]);\n", func);
2071 fprintf(f,
"float %sget(PointerRNA *ptr);\n", func);
2072 fprintf(f,
"void %sset(PointerRNA *ptr, float value);\n", func);
2075 fprintf(f,
"void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->
totarraylength);
2077 "void %sset(PointerRNA *ptr, const float values[%u]);\n",
2082 fprintf(f,
"void %sget(PointerRNA *ptr, float values[]);\n", func);
2083 fprintf(f,
"void %sset(PointerRNA *ptr, const float values[]);", func);
2092 fprintf(f,
"enum {\n");
2094 for (i = 0; i < eprop->
totitem; i++) {
2097 "\t%s_%s_%s = %d,\n",
2105 fprintf(f,
"};\n\n");
2108 fprintf(f,
"int %sget(PointerRNA *ptr);\n", func);
2109 fprintf(f,
"void %sset(PointerRNA *ptr, int value);\n", func);
2121 fprintf(f,
"void %sget(PointerRNA *ptr, char *value);\n", func);
2122 fprintf(f,
"int %slength(PointerRNA *ptr);\n", func);
2123 fprintf(f,
"void %sset(PointerRNA *ptr, const char *value);\n", func);
2128 fprintf(f,
"PointerRNA %sget(PointerRNA *ptr);\n", func);
2134 fprintf(f,
"void %sbegin(CollectionPropertyIterator *iter, PointerRNA *ptr);\n", func);
2135 fprintf(f,
"void %snext(CollectionPropertyIterator *iter);\n", func);
2136 fprintf(f,
"void %send(CollectionPropertyIterator *iter);\n", func);
2138 fprintf(f,
"int %slength(PointerRNA *ptr);\n", func);
2141 fprintf(f,
"int %slookup_int(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n", func);
2145 "int %slookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n",
2153 char funcname[2048];
2156 fprintf(f,
"int %s(PointerRNA *ptr, int *arraylen);\n", funcname);
2165 char funcname[2048];
2187 else if (prop->
name) {
2188 fprintf(f,
"\t/* %s */\n", prop->
name);
2191 fprintf(f,
"\t/* */\n");
2195 switch (prop->
type) {
2203 "\tinline Array<bool, %u> %s(void);\n",
2207 "\tinline void %s(bool values[%u]);",
2224 "\tinline Array<int, %u> %s(void);\n",
2228 "\tinline void %s(int values[%u]);",
2245 "\tinline Array<float, %u> %s(void);\n",
2249 "\tinline void %s(float values[%u]);",
2266 for (i = 0; i < eprop->
totitem; i++) {
2269 "\t\t%s_%s = %d,\n",
2276 fprintf(f,
"\t};\n");
2280 "\tinline %s_enum %s(void);\n",
2284 "\tinline void %s(%s_enum value);",
2308 const char *collection_funcs =
"DefaultCollectionFunctions";
2317 "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)",
2322 (cprop->
length ?
"true" :
"false"),
2328 "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)",
2333 (cprop->
length ?
"true" :
"false"),
2350 return (
const char *)pprop->
type;
2358 const char *
namespace,
2359 int close_prototype)
2365 const char *retval_type =
"void";
2372 if (
namespace &&
namespace[0]) {
2388 int type, flag, flag_parameter, pout;
2402 ptrstr = pout ?
"*" :
"";
2405 ptrstr = pout ?
"**" :
"*";
2409 ptrstr = pout ?
"*" :
"";
2418 ptrstr = pout ?
"*" :
"";
2446 if (close_prototype) {
2474 switch (prop->
type) {
2481 "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)",
2488 "\tBOOLEAN_DYNAMIC_ARRAY_PROPERTY(%s, %s)",
2500 "\tINT_ARRAY_PROPERTY(%s, %u, %s)",
2507 "\tINT_DYNAMIC_ARRAY_PROPERTY(%s, %s)",
2519 "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)",
2526 "\tFLOAT_DYNAMIC_ARRAY_PROPERTY(%s, %s)",
2534 "\tENUM_PROPERTY(%s_enum, %s, %s)",
2550 "\tPOINTER_PROPERTY(%s, %s, %s)",
2551 (
const char *)pprop->
type,
2557 "\tPOINTER_PROPERTY(%s, %s, %s)",
2570 "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)",
2571 (
const char *)cprop->type,
2574 (cprop->
length ?
"true" :
"false"),
2580 "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)",
2584 (cprop->
length ?
"true" :
"false"),
2601 char funcname[2048];
2608 fprintf(f,
"%s(", funcname);
2619 fprintf(f,
"(::%s *) this->ptr.data", dsrna->
dnafromname);
2622 fprintf(f,
"(::%s *) this->ptr.data", dsrna->
dnaname);
2625 fprintf(f,
"(::%s *) this->ptr.data", srna->
identifier);
2630 fprintf(f,
"this->ptr.type");
2646 for (; dp; dp = dp->
next) {
2670 "(::%s **) &%s->ptr.data",
2683 "(::%s *) %s.ptr.data",
2717 fprintf(f,
"\t\tPointerRNA result;\n");
2724 fprintf(f,
"\t\tRNA_id_pointer_create((::ID *) retdata, &result);\n");
2728 "\t\tRNA_pointer_create((::ID *) ptr.owner_id, &RNA_%s, retdata, &result);\n",
2729 (
const char *)pprop->
type);
2733 fprintf(f,
"\t\tresult = ");
2737 fprintf(f,
"\t\treturn %s(result);\n", (
const char *)pprop->
type);
2740 fprintf(f,
"\t\treturn ");
2749 fprintf(f,
"\t}\n\n");
2755 char funcname[2048];
2758 fprintf(f,
"int %s(PointerRNA *ptr, int *arraylen)\n", funcname);
2761 fprintf(f,
"}\n\n");
2772 char funcname[2048];
2783 fprintf(f,
"\n{\n");
2786 fprintf(f,
"\treturn %s(", dfunc->
call);
2789 fprintf(f,
"\t%s(", dfunc->
call);
2818 for (; dparm; dparm = dparm->
next) {
2834 fprintf(f,
"}\n\n");
2843 const char *funcname, *valstr;
2846 int flag, flag_parameter, pout, cptr, first;
2859 "void %s(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)",
2861 fprintf(f,
"\n{\n");
2866 fprintf(f,
"\tstruct ID *_selfid;\n");
2871 fprintf(f,
"\tstruct %s *_self;\n", dsrna->
dnafromname);
2874 fprintf(f,
"\tstruct %s *_self;\n", dsrna->
dnaname);
2877 fprintf(f,
"\tstruct %s *_self;\n", srna->
identifier);
2881 fprintf(f,
"\tstruct StructRNA *_type;\n");
2885 for (; dparm; dparm = dparm->
next) {
2898 ptrstr = pout ?
"*" :
"";
2901 ptrstr = pout ?
"**" :
"*";
2919 ptrstr = pout ?
"*" :
"";
2924 fprintf(f,
"\tint %s%s_len;\n", pout ?
"*" :
"", dparm->
prop->
identifier);
2936 fprintf(f,
"\tchar *_data");
2938 fprintf(f,
", *_retdata");
2946 fprintf(f,
"\t_selfid = (struct ID *)_ptr->owner_id;\n");
2951 fprintf(f,
"\t_self = (struct %s *)_ptr->data;\n", dsrna->
dnafromname);
2954 fprintf(f,
"\t_self = (struct %s *)_ptr->data;\n", dsrna->
dnaname);
2957 fprintf(f,
"\t_self = (struct %s *)_ptr->data;\n", srna->
identifier);
2961 fprintf(f,
"\t_type = _ptr->type;\n");
2965 fprintf(f,
"\t_data = (char *)_parms->data;\n");
2969 for (; dparm; dparm = dparm->
next) {
2977 fprintf(f,
"\t_retdata = _data;\n");
2980 const char *data_str;
3012 "\t%s_len = %s((ParameterDynAlloc *)_data)->array_tot;\n",
3014 pout ?
"(int *)&" :
"(int)");
3015 data_str =
"(&(((ParameterDynAlloc *)_data)->array))";
3023 fprintf(f,
"%s", valstr);
3045 fprintf(f,
"%s(", dfunc->
call);
3050 fprintf(f,
"_selfid");
3058 fprintf(f,
"_self");
3065 fprintf(f,
"_type");
3074 fprintf(f,
"CTX_data_main(C)");
3090 fprintf(f,
"reports");
3094 for (; dparm; dparm = dparm->
next) {
3122 "\t*((%s%s %s*)_retdata) = %s;\n",
3130 fprintf(f,
"}\n\n");
3150 ds->
dnaname =
"CollectionObject";
3216 return "BoolPropertyRNA";
3218 return "IntPropertyRNA";
3220 return "FloatPropertyRNA";
3222 return "StringPropertyRNA";
3224 return "EnumPropertyRNA";
3226 return "PointerPropertyRNA";
3228 return "CollectionPropertyRNA";
3230 return "UnknownPropertyRNA";
3240 return "PROP_FILEPATH";
3242 return "PROP_FILENAME";
3244 return "PROP_DIRPATH";
3246 return "PROP_PIXEL";
3248 return "PROP_BYTESTRING";
3250 return "PROP_UNSIGNED";
3252 return "PROP_PERCENTAGE";
3254 return "PROP_FACTOR";
3256 return "PROP_ANGLE";
3260 return "PROP_TIME_ABSOLUTE";
3262 return "PROP_DISTANCE";
3264 return "PROP_DISTANCE_CAMERA";
3266 return "PROP_COLOR";
3268 return "PROP_TRANSLATION";
3270 return "PROP_DIRECTION";
3272 return "PROP_MATRIX";
3274 return "PROP_EULER";
3276 return "PROP_QUATERNION";
3278 return "PROP_AXISANGLE";
3280 return "PROP_VELOCITY";
3282 return "PROP_ACCELERATION";
3286 return "PROP_COLOR_GAMMA";
3288 return "PROP_COORDS";
3290 return "PROP_LAYER";
3292 return "PROP_LAYER_MEMBER";
3294 return "PROP_PASSWORD";
3296 return "PROP_POWER";
3298 return "PROP_TEMPERATURE";
3304 return "PROP_SUBTYPE_UNKNOWN";
3313 return "PROP_UNIT_NONE";
3315 return "PROP_UNIT_LENGTH";
3317 return "PROP_UNIT_AREA";
3319 return "PROP_UNIT_VOLUME";
3321 return "PROP_UNIT_MASS";
3323 return "PROP_UNIT_ROTATION";
3325 return "PROP_UNIT_TIME";
3327 return "PROP_UNIT_TIME_ABSOLUTE";
3329 return "PROP_UNIT_VELOCITY";
3331 return "PROP_UNIT_ACCELERATION";
3333 return "PROP_UNIT_CAMERA";
3335 return "PROP_UNIT_POWER";
3337 return "PROP_UNIT_TEMPERATURE";
3339 return "PROP_UNIT_UNKNOWN";
3348 fprintf(f,
"extern struct StructRNA RNA_%s;\n", srna->
identifier);
3358 "BlenderRNA BLENDER_RNA = {\n"
3365 fprintf(f,
"NULL, ");
3373 fprintf(f,
"NULL},\n");
3377 "\t.structs_map = NULL,\n"
3378 "\t.structs_len = 0,\n"
3406 "%s%s rna_%s_%s;\n",
3438 "%s%s rna_%s_%s_%s;\n",
3460 "%s%s rna_%s_%s_func;\n",
3489 const char *name_override,
3490 int close_prototype)
3496 int flag, flag_parameter, pout, cptr, first;
3506 fprintf(f,
"XXX no array return types yet");
3521 fprintf(f,
"void ");
3525 if (name_override ==
NULL || name_override[0] ==
'\0') {
3526 fprintf(f,
"%s(", dfunc->
call);
3529 fprintf(f,
"%s(", name_override);
3536 fprintf(f,
"struct ID *_selfid");
3545 fprintf(f,
"struct %s *_self", dsrna->
dnafromname);
3548 fprintf(f,
"struct %s *_self", dsrna->
dnaname);
3551 fprintf(f,
"struct %s *_self", srna->
identifier);
3559 fprintf(f,
"struct StructRNA *_type");
3568 fprintf(f,
"Main *bmain");
3576 fprintf(f,
"bContext *C");
3584 fprintf(f,
"ReportList *reports");
3601 ptrstr = pout ?
"*" :
"";
3604 ptrstr = pout ?
"**" :
"*";
3614 ptrstr = pout ?
"*" :
"";
3623 fprintf(f,
"int %s%s_len, ", pout ?
"*" :
"", dparm->
prop->
identifier);
3651 if (close_prototype) {
3669 fprintf(f,
"/* Repeated prototypes to detect errors */\n\n");
3685 const char *structures[2048];
3686 int all_structures = 0;
3696 if (struct_name ==
NULL) {
3697 printf(
"No struct found for property '%s'\n", dp->
prop->
identifier);
3701 for (
a = 0;
a < all_structures;
a++) {
3702 if (
STREQ(struct_name, structures[
a])) {
3709 fprintf(f,
"struct %s;\n", struct_name);
3711 if (all_structures >=
ARRAY_SIZE(structures)) {
3712 printf(
"Array size to store all structures names is too small\n");
3716 structures[all_structures++] = struct_name;
3729 char *strnest = (
char *)
"", *errnest = (
char *)
"";
3730 int len, freenest = 0;
3735 strnest =
MEM_mallocN(
sizeof(
char) * (
len + 2),
"rna_generate_property -> strnest");
3736 errnest =
MEM_mallocN(
sizeof(
char) * (
len + 2),
"rna_generate_property -> errnest");
3738 strcpy(strnest,
"_");
3739 strcat(strnest, nest);
3740 strcpy(errnest,
".");
3741 strcat(errnest, nest);
3746 switch (prop->
type) {
3749 int i, defaultfound = 0, totflag = 0;
3754 if (item_global_id ==
NULL) {
3756 "static const EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t",
3762 for (i = 0; i < eprop->
totitem; i++) {
3763 fprintf(f,
"{%d, ", eprop->
item[i].
value);
3766 fprintf(f,
"%d, ", eprop->
item[i].
icon);
3770 fprintf(f,
"},\n\t");
3784 fprintf(f,
"{0, NULL, 0, NULL, NULL}\n};\n\n");
3787 for (i = 0; i < eprop->
totitem; i++) {
3804 "%s%s.%s, enum default includes unused bits (%d).",
3815 "%s%s.%s, enum default is not in items.",
3825 "%s%s.%s, enum must have items defined.",
3839 "static bool rna_%s%s_%s_default[%u] = {\n\t",
3853 fprintf(f,
",\n\t");
3857 fprintf(f,
"\n};\n\n");
3867 "static int rna_%s%s_%s_default[%u] = {\n\t",
3881 fprintf(f,
",\n\t");
3885 fprintf(f,
"\n};\n\n");
3895 "static float rna_%s%s_%s_default[%u] = {\n\t",
3909 fprintf(f,
",\n\t");
3913 fprintf(f,
"\n};\n\n");
3946 "%s rna_%s%s_%s = {\n",
3957 fprintf(f,
"\t{NULL, ");
3964 fprintf(f,
"NULL,\n");
3966 fprintf(f,
"\t%d, ", prop->
magic);
3969 ", %d, %d, %d, %d, %d, ",
3976 fprintf(f,
",\n\t");
3978 fprintf(f,
",\n\t");
3979 fprintf(f,
"%d, ", prop->
icon);
3983 "\t%s, %s | %s, %s, %u, {%u, %u, %u}, %u,\n",
3994 "\t%s%s, %d, %s, %s, %s, %s, %s,\n",
4008 fprintf(f,
"\t0, -1");
4013 fprintf(f,
", &RNA_%s", (
const char *)prop->
srna);
4016 fprintf(f,
", NULL");
4021 switch (prop->
type) {
4025 "\t%s, %s, %s, %s, %s, %s, %s, %s, %d, ",
4039 fprintf(f,
"NULL\n");
4046 "\t%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,\n\t",
4075 fprintf(f,
"NULL\n");
4082 "\t%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, ",
4113 fprintf(f,
"NULL\n");
4120 "\t%s, %s, %s, %s, %s, %s, %s, %d, %d, ",
4137 "\t%s, %s, %s, %s, %s, ",
4145 if (item_global_id !=
NULL) {
4146 fprintf(f,
"%s, ", item_global_id);
4153 fprintf(f,
"NULL, ");
4161 "\t%s, %s, %s, %s,",
4167 fprintf(f,
"&RNA_%s\n", (
const char *)pprop->
type);
4170 fprintf(f,
"NULL\n");
4177 "\t%s, %s, %s, %s, %s, %s, %s, %s, ",
4187 fprintf(f,
"&RNA_%s\n", (
const char *)cprop->
item_type);
4190 fprintf(f,
"NULL\n");
4196 fprintf(f,
"};\n\n");
4211 fprintf(f,
"/* %s */\n", srna->
name);
4222 fprintf(f,
"%s%s rna_%s_%s_func = {\n",
"",
"FunctionRNA", srna->
identifier, func->
identifier);
4226 "\t{(FunctionRNA *)&rna_%s_%s_func, ",
4231 fprintf(f,
"\t{NULL, ");
4235 "(FunctionRNA *)&rna_%s_%s_func,\n",
4240 fprintf(f,
"NULL,\n");
4243 fprintf(f,
"\tNULL,\n");
4248 "\t{(PropertyRNA *)&rna_%s_%s_%s, ",
4254 fprintf(f,
"\t{NULL, ");
4260 "(PropertyRNA *)&rna_%s_%s_%s}},\n",
4266 fprintf(f,
"NULL}},\n");
4271 fprintf(f,
", %d, ", func->
flag);
4277 fprintf(f,
"\t%s,\n", dfunc->
gencall);
4280 fprintf(f,
"\tNULL,\n");
4285 "\t(PropertyRNA *)&rna_%s_%s_%s\n",
4291 fprintf(f,
"\tNULL\n");
4298 fprintf(f,
"StructRNA RNA_%s = {\n", srna->
identifier);
4301 fprintf(f,
"\t{(ContainerRNA *)&RNA_%s, ", ((
StructRNA *)srna->
cont.
next)->identifier);
4304 fprintf(f,
"\t{NULL, ");
4307 fprintf(f,
"(ContainerRNA *)&RNA_%s,\n", ((
StructRNA *)srna->
cont.
prev)->identifier);
4310 fprintf(f,
"NULL,\n");
4313 fprintf(f,
"\tNULL,\n");
4320 fprintf(f,
"\t{NULL, ");
4328 fprintf(f,
"NULL}},\n");
4332 fprintf(f,
", NULL, NULL");
4333 fprintf(f,
", %d, NULL, ", srna->
flag);
4335 fprintf(f,
",\n\t");
4337 fprintf(f,
",\n\t");
4339 fprintf(f,
", %d,\n", srna->
icon);
4351 fprintf(f,
"\tNULL, ");
4359 fprintf(f,
"(PropertyRNA *)&rna_%s_rna_properties,\n", base->
identifier);
4365 fprintf(f,
"\tNULL,\n");
4372 fprintf(f,
"\tNULL,\n");
4384 &
LOG,
"%s has a register function, must also have refine function.", srna->
identifier);
4393 fprintf(f,
"\t{NULL, ");
4401 fprintf(f,
"NULL}\n");
4471 #ifdef WITH_SIMULATION_DATABLOCK
4503 "/* Automatically generated struct definitions for the Data API.\n"
4504 " * Do not edit manually, changes will be overwritten. */\n\n"
4505 "#define RNA_RUNTIME\n\n");
4507 fprintf(f,
"#include <float.h>\n");
4508 fprintf(f,
"#include <stdio.h>\n");
4509 fprintf(f,
"#include <limits.h>\n");
4510 fprintf(f,
"#include <string.h>\n\n");
4511 fprintf(f,
"#include <stddef.h>\n\n");
4513 fprintf(f,
"#include \"MEM_guardedalloc.h\"\n\n");
4515 fprintf(f,
"#include \"DNA_ID.h\"\n");
4516 fprintf(f,
"#include \"DNA_scene_types.h\"\n");
4517 fprintf(f,
"#include \"DNA_node_types.h\"\n");
4519 fprintf(f,
"#include \"BLI_blenlib.h\"\n\n");
4520 fprintf(f,
"#include \"BLI_utildefines.h\"\n\n");
4522 fprintf(f,
"#include \"BKE_context.h\"\n");
4523 fprintf(f,
"#include \"BKE_lib_id.h\"\n");
4524 fprintf(f,
"#include \"BKE_main.h\"\n");
4525 fprintf(f,
"#include \"BKE_report.h\"\n");
4527 fprintf(f,
"#include \"RNA_define.h\"\n");
4528 fprintf(f,
"#include \"RNA_types.h\"\n");
4529 fprintf(f,
"#include \"rna_internal.h\"\n\n");
4532 fprintf(f,
"#include \"rna_prototypes_gen.h\"\n\n");
4535 fprintf(f,
"#include \"%s\"\n", filename);
4538 fprintf(f,
"#include \"%s\"\n", api_filename);
4544 #if defined(__GNUC__) || defined(__clang__)
4545 fprintf(f,
"#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n\n");
4548 fprintf(f,
"/* Auto-generated Functions. */\n\n");
4551 if (!filename || ds->
filename == filename) {
4558 if (!filename || ds->
filename == filename) {
4566 if (!filename || ds->
filename == filename) {
4581 if (!filename || ds->
filename == filename) {
4586 if (filename &&
STREQ(filename,
"rna_ID.c")) {
4589 fprintf(f,
"#include \"rna_define.c\"\n\n");
4602 fprintf(f,
"\n#ifndef __RNA_BLENDER_H__\n");
4603 fprintf(f,
"#define __RNA_BLENDER_H__\n\n");
4606 "/* Automatically generated function declarations for the Data API.\n"
4607 " * Do not edit manually, changes will be overwritten. */\n\n");
4609 fprintf(f,
"#include \"RNA_types.h\"\n\n");
4610 fprintf(f,
"#include \"DNA_node_types.h\"\n\n");
4612 fprintf(f,
"#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
4614 fprintf(f,
"#define FOREACH_BEGIN(property, sptr, itemptr) \\\n");
4615 fprintf(f,
" { \\\n");
4616 fprintf(f,
" CollectionPropertyIterator rna_macro_iter; \\\n");
4618 " for (property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; "
4619 "property##_next(&rna_macro_iter)) { \\\n");
4620 fprintf(f,
" itemptr = rna_macro_iter.ptr;\n\n");
4622 fprintf(f,
"#define FOREACH_END(property) \\\n");
4623 fprintf(f,
" } \\\n");
4624 fprintf(f,
" property##_end(&rna_macro_iter); \\\n");
4625 fprintf(f,
" }\n\n");
4630 fprintf(f,
"/**************** %s ****************/\n\n", srna->
name);
4633 fprintf(f,
"extern StructRNA RNA_%s;\n", srna->
identifier);
4647 fprintf(f,
"#ifdef __cplusplus\n}\n#endif\n\n");
4649 fprintf(f,
"#endif /* __RNA_BLENDER_H__ */\n\n");
4655 "#include <stdlib.h> /* for malloc */\n"
4656 "#include <string>\n"
4657 "#include <string.h> /* for memcpy */\n"
4661 "#define BOOLEAN_PROPERTY(sname, identifier) \\\n"
4662 " inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: "
4664 " inline void sname::identifier(bool value) { sname##_##identifier##_set(&ptr, value); }\n"
4666 "#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
4667 " inline Array<bool, size> sname::identifier(void) \\\n"
4668 " { Array<bool, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
4669 " inline void sname::identifier(bool values[size]) \\\n"
4670 " { sname##_##identifier##_set(&ptr, values); } \\\n"
4672 "#define BOOLEAN_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
4673 " inline DynamicArray<bool> sname::identifier(void) { \\\n"
4674 " int arraylen[3]; \\\n"
4675 " int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
4676 " DynamicArray<bool> ar(len); \\\n"
4677 " sname##_##identifier##_get(&ptr, ar.data); \\\n"
4678 " return ar; } \\\n"
4679 " inline void sname::identifier(bool values[]) \\\n"
4680 " { sname##_##identifier##_set(&ptr, values); } \\\n"
4682 "#define INT_PROPERTY(sname, identifier) \\\n"
4683 " inline int sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
4684 " inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
4686 "#define INT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
4687 " inline Array<int, size> sname::identifier(void) \\\n"
4688 " { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
4689 " inline void sname::identifier(int values[size]) \\\n"
4690 " { sname##_##identifier##_set(&ptr, values); } \\\n"
4692 "#define INT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
4693 " inline DynamicArray<int> sname::identifier(void) { \\\n"
4694 " int arraylen[3]; \\\n"
4695 " int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
4696 " DynamicArray<int> ar(len); \\\n"
4697 " sname##_##identifier##_get(&ptr, ar.data); \\\n"
4698 " return ar; } \\\n"
4699 " inline void sname::identifier(int values[]) \\\n"
4700 " { sname##_##identifier##_set(&ptr, values); } \\\n"
4702 "#define FLOAT_PROPERTY(sname, identifier) \\\n"
4703 " inline float sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
4704 " inline void sname::identifier(float value) { sname##_##identifier##_set(&ptr, value); }\n"
4706 "#define FLOAT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
4707 " inline Array<float, size> sname::identifier(void) \\\n"
4708 " { Array<float, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
4709 " inline void sname::identifier(float values[size]) \\\n"
4710 " { sname##_##identifier##_set(&ptr, values); } \\\n"
4712 "#define FLOAT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
4713 " inline DynamicArray<float> sname::identifier(void) { \\\n"
4714 " int arraylen[3]; \\\n"
4715 " int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
4716 " DynamicArray<float> ar(len); \\\n"
4717 " sname##_##identifier##_get(&ptr, ar.data); \\\n"
4718 " return ar; } \\\n"
4719 " inline void sname::identifier(float values[]) \\\n"
4720 " { sname##_##identifier##_set(&ptr, values); } \\\n"
4722 "#define ENUM_PROPERTY(type, sname, identifier) \\\n"
4723 " inline sname::type sname::identifier(void) { return "
4724 "(type)sname##_##identifier##_get(&ptr); } \\\n"
4725 " inline void sname::identifier(sname::type value) { sname##_##identifier##_set(&ptr, "
4728 "#define STRING_PROPERTY(sname, identifier) \\\n"
4729 " inline std::string sname::identifier(void) { \\\n"
4730 " int len = sname##_##identifier##_length(&ptr); \\\n"
4731 " std::string str; str.resize(len); \\\n"
4732 " sname##_##identifier##_get(&ptr, &str[0]); return str; } \\\n"
4733 " inline void sname::identifier(const std::string& value) { \\\n"
4734 " sname##_##identifier##_set(&ptr, value.c_str()); } \\\n"
4736 "#define POINTER_PROPERTY(type, sname, identifier) \\\n"
4737 " inline type sname::identifier(void) { return type(sname##_##identifier##_get(&ptr)); }\n"
4739 "#define COLLECTION_PROPERTY_LENGTH_false(sname, identifier) \\\n"
4740 " inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
4742 " CollectionPropertyIterator iter; \\\n"
4743 " int length = 0; \\\n"
4744 " sname##_##identifier##_begin(&iter, ptr); \\\n"
4745 " while (iter.valid) { \\\n"
4746 " sname##_##identifier##_next(&iter); \\\n"
4749 " sname##_##identifier##_end(&iter); \\\n"
4750 " return length; \\\n"
4752 "#define COLLECTION_PROPERTY_LENGTH_true(sname, identifier) \\\n"
4753 " inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
4754 " { return sname##_##identifier##_length(ptr); } \n"
4756 "#define COLLECTION_PROPERTY_EMPTY_false(sname, identifier) \\\n"
4757 " inline static bool sname##_##identifier##_empty_wrap(PointerRNA *ptr) \\\n"
4759 " CollectionPropertyIterator iter; \\\n"
4760 " sname##_##identifier##_begin(&iter, ptr); \\\n"
4761 " bool empty = !iter.valid; \\\n"
4762 " sname##_##identifier##_end(&iter); \\\n"
4763 " return empty; \\\n"
4765 "#define COLLECTION_PROPERTY_EMPTY_true(sname, identifier) \\\n"
4766 " inline static bool sname##_##identifier##_empty_wrap(PointerRNA *ptr) \\\n"
4767 " { return sname##_##identifier##_length(ptr) == 0; } \n"
4769 "#define COLLECTION_PROPERTY_LOOKUP_INT_false(sname, identifier) \\\n"
4770 " inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, "
4771 "PointerRNA *r_ptr) \\\n"
4773 " CollectionPropertyIterator iter; \\\n"
4774 " int i = 0, found = 0; \\\n"
4775 " sname##_##identifier##_begin(&iter, ptr); \\\n"
4776 " while (iter.valid) { \\\n"
4777 " if (i == key) { \\\n"
4778 " *r_ptr = iter.ptr; \\\n"
4782 " sname##_##identifier##_next(&iter); \\\n"
4785 " sname##_##identifier##_end(&iter); \\\n"
4786 " if (!found) { \\\n"
4787 " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
4789 " return found; \\\n"
4791 "#define COLLECTION_PROPERTY_LOOKUP_INT_true(sname, identifier) \\\n"
4792 " inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, "
4793 "PointerRNA *r_ptr) \\\n"
4795 " int found = sname##_##identifier##_lookup_int(ptr, key, r_ptr); \\\n"
4796 " if (!found) { \\\n"
4797 " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
4799 " return found; \\\n"
4801 "#define COLLECTION_PROPERTY_LOOKUP_STRING_false(sname, identifier) \\\n"
4802 " inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char "
4803 "*key, PointerRNA *r_ptr) \\\n"
4805 " CollectionPropertyIterator iter; \\\n"
4806 " int found = 0; \\\n"
4807 " PropertyRNA *item_name_prop = RNA_struct_name_property(ptr->type); \\\n"
4808 " sname##_##identifier##_begin(&iter, ptr); \\\n"
4809 " while (iter.valid && !found) { \\\n"
4810 " char name_fixed[32]; \\\n"
4811 " const char *name; \\\n"
4812 " int name_length; \\\n"
4813 " name = RNA_property_string_get_alloc(&iter.ptr, item_name_prop, name_fixed, "
4814 "sizeof(name_fixed), &name_length); \\\n"
4815 " if (!strncmp(name, key, name_length)) { \\\n"
4816 " *r_ptr = iter.ptr; \\\n"
4819 " if (name_fixed != name) { \\\n"
4820 " MEM_freeN((void *) name); \\\n"
4822 " sname##_##identifier##_next(&iter); \\\n"
4824 " sname##_##identifier##_end(&iter); \\\n"
4825 " if (!found) { \\\n"
4826 " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
4828 " return found; \\\n"
4830 "#define COLLECTION_PROPERTY_LOOKUP_STRING_true(sname, identifier) \\\n"
4831 " inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char "
4832 "*key, PointerRNA *r_ptr) \\\n"
4834 " int found = sname##_##identifier##_lookup_string(ptr, key, r_ptr); \\\n"
4835 " if (!found) { \\\n"
4836 " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
4838 " return found; \\\n"
4840 "#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, "
4841 "has_lookup_int, has_lookup_string) \\\n"
4842 " typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n"
4843 " sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n"
4844 " COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n"
4845 " COLLECTION_PROPERTY_EMPTY_##has_length(sname, identifier) \\\n"
4846 " COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n"
4847 " COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n"
4848 " CollectionRef<sname, type, sname##_##identifier##_begin, \\\n"
4849 " sname##_##identifier##_next, sname##_##identifier##_end, \\\n"
4850 " sname##_##identifier##_length_wrap, \\\n"
4851 " sname##_##identifier##_empty_wrap, \\\n"
4852 " sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, "
4853 "collection_funcs> identifier;\n"
4857 " Pointer(const PointerRNA &p) : ptr(p) { }\n"
4858 " operator const PointerRNA&() { return ptr; }\n"
4859 " bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n"
4860 " operator void*() { return ptr.data; }\n"
4861 " operator bool() { return ptr.data != NULL; }\n"
4863 " bool operator==(const Pointer &other) const { return ptr.data == other.ptr.data; }\n"
4864 " bool operator!=(const Pointer &other) const { return ptr.data != other.ptr.data; }\n"
4865 " bool operator<(const Pointer &other) const { return ptr.data < other.ptr.data; }\n"
4867 " PointerRNA ptr;\n"
4871 "template<typename T, int Tsize>\n"
4877 " Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); }\n"
4878 " const Array<T, Tsize>& operator = (const Array<T, Tsize>& other) { memcpy(data, "
4879 "other.data, sizeof(T) * Tsize); "
4882 " operator T*() { return data; }\n"
4883 " operator const T*() const { return data; }\n"
4886 "template<typename T>\n"
4887 "class DynamicArray {\n"
4892 " DynamicArray() : data(NULL), length(0) {}\n"
4893 " DynamicArray(int new_length) : data(NULL), length(new_length) { data = (T "
4894 "*)malloc(sizeof(T) * new_length); }\n"
4895 " DynamicArray(const DynamicArray<T>& other) : data(NULL), length(0) { copy_from(other); "
4897 " const DynamicArray<T>& operator = (const DynamicArray<T>& other) { copy_from(other); "
4900 " ~DynamicArray() { if (data) free(data); }\n"
4902 " operator T*() { return data; }\n"
4905 " void copy_from(const DynamicArray<T>& other) {\n"
4906 " if (data) free(data);\n"
4907 " data = (T *)malloc(sizeof(T) * other.length);\n"
4908 " memcpy(data, other.data, sizeof(T) * other.length);\n"
4909 " length = other.length;\n"
4913 "typedef void (*TBeginFunc)(CollectionPropertyIterator *iter, PointerRNA *ptr);\n"
4914 "typedef void (*TNextFunc)(CollectionPropertyIterator *iter);\n"
4915 "typedef void (*TEndFunc)(CollectionPropertyIterator *iter);\n"
4916 "typedef int (*TLengthFunc)(PointerRNA *ptr);\n"
4917 "typedef bool (*TEmptyFunc)(PointerRNA *ptr);\n"
4918 "typedef int (*TLookupIntFunc)(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n"
4919 "typedef int (*TLookupStringFunc)(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n"
4921 "template<typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n"
4922 "class CollectionIterator {\n"
4924 " CollectionIterator() : iter(), t(iter.ptr), init(false) { iter.valid = false; }\n"
4925 " CollectionIterator(const PointerRNA &ptr) : CollectionIterator() { this->begin(ptr); }\n"
4926 " ~CollectionIterator(void) { if (init) Tend(&iter); };\n"
4928 " CollectionIterator(const CollectionIterator &other) = delete;\n"
4929 " CollectionIterator(CollectionIterator &&other) = delete;\n"
4930 " CollectionIterator &operator=(const CollectionIterator &other) = delete;\n"
4931 " CollectionIterator &operator=(CollectionIterator &&other) = delete;\n"
4933 " operator bool(void)\n"
4934 " { return iter.valid != 0; }\n"
4935 " const CollectionIterator<T, Tbegin, Tnext, Tend>& operator++() { Tnext(&iter); t = "
4936 "T(iter.ptr); return *this; }\n"
4938 " T& operator*(void) { return t; }\n"
4939 " T* operator->(void) { return &t; }\n"
4940 " bool operator == (const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
4941 "{ return iter.valid == other.iter.valid; }\n"
4942 " bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
4943 "{ return iter.valid != other.iter.valid; }\n"
4945 " void begin(const Pointer &ptr)\n"
4946 " { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA *)&ptr.ptr); t = T(iter.ptr); init = "
4950 " CollectionPropertyIterator iter;\n"
4955 "template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n"
4956 " TLengthFunc Tlength, TEmptyFunc Tempty, TLookupIntFunc Tlookup_int,\n"
4957 " TLookupStringFunc Tlookup_string, typename Tcollection_funcs>\n"
4958 "class CollectionRef : public Tcollection_funcs {\n"
4960 " CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
4962 " void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
4963 " { iter.begin(ptr); }\n"
4964 " CollectionIterator<T, Tbegin, Tnext, Tend> begin()\n"
4965 " { return CollectionIterator<T, Tbegin, Tnext, Tend>(ptr); }\n"
4966 " CollectionIterator<T, Tbegin, Tnext, Tend> end()\n"
4967 " { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n"
4970 " { return Tlength(&ptr); }\n"
4972 " { return Tempty(&ptr); }\n"
4973 " T operator[](int key)\n"
4974 " { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return T(r_ptr); }\n"
4975 " T operator[](const std::string &key)\n"
4976 " { PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return T(r_ptr); }\n"
4979 " PointerRNA ptr;\n"
4982 "class DefaultCollectionFunctions {\n"
4984 " DefaultCollectionFunctions(const PointerRNA & /*p*/) {}\n"
5001 const char *struct_name)
5003 int a = 0, found = 0;
5005 while (collection_structs[
a]) {
5006 if (
STREQ(collection_structs[
a], struct_name)) {
5022 fprintf(f,
"/**************** %s ****************/\n\n", srna->
name);
5025 "class %s : public %s {\n",
5028 fprintf(f,
"public:\n");
5030 "\t%s(const PointerRNA &ptr_arg) :\n\t\t%s(ptr_arg)",
5038 fprintf(f,
"\n\t\t{}\n\n");
5049 fprintf(f,
"};\n\n");
5058 const char *first_collection_func_struct =
NULL;
5059 const char *collection_func_structs[256] = {
NULL};
5060 int all_collection_func_structs = 0;
5061 int max_collection_func_structs =
sizeof(collection_func_structs) /
5062 sizeof(collection_func_structs[0]) -
5065 fprintf(f,
"\n#ifndef __RNA_BLENDER_CPP_H__\n");
5066 fprintf(f,
"#define __RNA_BLENDER_CPP_H__\n\n");
5069 "/* Automatically generated classes for the Data API.\n"
5070 " * Do not edit manually, changes will be overwritten. */\n\n");
5072 fprintf(f,
"#include \"RNA_blender.h\"\n");
5073 fprintf(f,
"#include \"RNA_types.h\"\n");
5074 fprintf(f,
"#include \"RNA_access.h\"\n");
5075 fprintf(f,
"#include \"DNA_node_types.h\"\n");
5079 fprintf(f,
"/**************** Declarations ****************/\n\n");
5094 if (first_collection_func_struct ==
NULL) {
5099 if (all_collection_func_structs >= max_collection_func_structs) {
5100 printf(
"Array size to store all collection structures names is too small\n");
5104 collection_func_structs[all_collection_func_structs++] = (
char *)prop->
srna;
5138 fprintf(f,
"} /* namespace BL */\n");
5141 fprintf(f,
"/**************** Implementation ****************/\n");
5144 fprintf(f,
"/* Structure prototypes */\n\n");
5145 fprintf(f,
"extern \"C\" {\n");
5147 fprintf(f,
"}\n\n");
5149 fprintf(f,
"namespace BL {\n");
5167 fprintf(f,
"}\n\n#endif /* __RNA_BLENDER_CPP_H__ */\n\n");
5172 FILE *fp = fopen(
file,
"w");
5174 "#error \"Error! can't make correct RNA file from %s:%d, "
5175 "check DNA properties.\"\n",
5192 const char *deps[3];
5194 if (!public_header_outfile) {
5195 public_header_outfile = outfile;
5207 fprintf(stderr,
"Error: DefRNA.animate left disabled in %s\n",
PROCESS_ITEMS[i].filename);
5223 strcpy(deffile, public_header_outfile);
5224 strcat(deffile,
"RNA_prototypes.h" TMP_EXT);
5228 file = fopen(deffile,
"w");
5230 fprintf(stderr,
"Unable to open file: %s\n", deffile);
5235 "/* Automatically generated RNA property declarations, to statically reference \n"
5236 " * properties as `rna_[struct-name]_[property-name]`.\n"
5238 " * DO NOT EDIT MANUALLY, changes will be overwritten.\n"
5241 fprintf(
file,
"#pragma once\n\n");
5242 fprintf(
file,
"#ifdef __cplusplus\n extern \"C\" {\n#endif\n\n");
5244 fprintf(
file,
"#ifdef __cplusplus\n }\n#endif\n");
5252 strcpy(deffile, outfile);
5253 strcat(deffile,
"rna_prototypes_gen.h");
5257 file = fopen(deffile,
"w");
5259 fprintf(stderr,
"Unable to open file: %s\n", deffile);
5264 "/* Automatically generated function declarations for the Data API.\n"
5265 " * Do not edit manually, changes will be overwritten. */\n\n");
5273 strcpy(deffile, outfile);
5275 deffile[strlen(deffile) - 2] =
'\0';
5276 strcat(deffile,
"_gen.c" TMP_EXT);
5282 file = fopen(deffile,
"w");
5285 fprintf(stderr,
"Unable to open file: %s\n", deffile);
5304 strcpy(deffile, outfile);
5305 strcat(deffile,
"RNA_blender_cpp.h" TMP_EXT);
5311 file = fopen(deffile,
"w");
5314 fprintf(stderr,
"Unable to open file: %s\n", deffile);
5329 strcpy(deffile, outfile);
5330 strcat(deffile,
"RNA_blender.h" TMP_EXT);
5336 file = fopen(deffile,
"w");
5339 fprintf(stderr,
"Unable to open file: %s\n", deffile);
5360 fprintf(stderr,
"%s", errorStr);
5366 int return_status = 0;
5378 fprintf(stderr,
"Usage: %s outdirectory [public header outdirectory]/\n", argv[0]);
5383 fprintf(stderr,
"Running makesrna\n");
5391 return return_status;
#define CLOG_ERROR(clg_ref,...)
void CLG_output_use_basename_set(int value)
void CLG_level_set(int level)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define IS_DNATYPE_BOOLEAN_COMPAT(_str)
#define IS_DNATYPE_FLOAT_COMPAT(_str)
#define IS_DNATYPE_INT_COMPAT(_str)
@ PROP_UNIT_TIME_ABSOLUTE
#define RNA_SUBTYPE_UNIT(subtype)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SyclQueue void void size_t num_bytes void
define("MAT_AOV_SUPPORT") .image_array_out(6
ccl_global float * buffer
void MEM_init_memleak_detection()
static void rna_def_struct_function_header_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
static void rna_print_data_get(FILE *f, PropertyDefRNA *dp)
static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc)
static char * rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
static void rna_generate_static_function_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
static void rna_generate_internal_property_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
static char * rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *nextfunc)
static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
static const char * rna_parameter_type_cpp_name(PropertyRNA *prop)
static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp))
static void rna_print_c_string(FILE *f, const char *str)
void * rna_calloc(int buffer_len)
static void rna_set_raw_offset(FILE *f, StructRNA *srna, PropertyRNA *prop)
static const char * rna_type_type_name(PropertyRNA *prop)
static int replace_if_different(const char *tmpfile, const char *dep_files[])
static char * rna_alloc_function_name(const char *structname, const char *propname, const char *type)
static void rna_float_print(FILE *f, float num)
int main(int argc, char **argv)
static const char * rna_find_dna_type(const char *type)
static RNAProcessItem PROCESS_ITEMS[]
static const char * cpp_classes
static void mem_error_cb(const char *errorStr)
static int rna_enum_bitmask(PropertyRNA *prop)
static void rna_generate_header_class_cpp(StructDefRNA *ds, FILE *f)
static void rna_auto_types(void)
static const char * rna_type_type(PropertyRNA *prop)
static char * rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp), const char *manualfunc)
static void rna_generate_blender(BlenderRNA *brna, FILE *f)
static const char * rna_safe_id(const char *id)
static void rna_def_struct_function_impl_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
static int cmp_def_struct(const void *a, const void *b)
static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
static int file_older(const char *file1, const char *file2)
static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc)
static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop)
static int rna_color_quantize(PropertyRNA *prop, PropertyDefRNA *dp)
static char * rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
static void rna_sort(BlenderRNA *brna)
void BLI_system_backtrace(FILE *fp)
static void rna_def_function_funcs_header(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
static void rna_clamp_value_range(FILE *f, PropertyRNA *prop)
#define WRITE_PARAM(param)
static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *UNUSED(srna), FunctionDefRNA *dfunc, const char *namespace, int close_prototype)
struct RNAProcessItem RNAProcessItem
static void rna_generate_struct_rna_prototypes(BlenderRNA *brna, FILE *f)
static int rna_is_collection_functions_struct(const char **collection_structs, const char *struct_name)
static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc, const char *name_override, int close_prototype)
static int cmp_def_property(const void *a, const void *b)
static char * rna_def_property_search_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp), const char *manualfunc)
static const char * rna_function_string(const void *func)
static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
static const char * rna_property_structname(PropertyType type)
static const char * rna_property_subtype_unit(PropertySubType type)
static const char * rna_type_struct(PropertyRNA *prop)
static const char * makesrna_path
static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
static const char * rna_enum_id_from_pointer(const EnumPropertyItem *item)
static void rna_generate_external_property_prototypes(BlenderRNA *brna, FILE *f)
static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FunctionRNA *func, FILE *f)
static int cmp_property(const void *a, const void *b)
static StructRNA * rna_find_struct(const char *identifier)
static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna, FILE *f)
static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
void * rna_alloc_from_buffer(const char *buffer, int buffer_len)
static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
static void rna_construct_function_name(char *buffer, int size, const char *structname, const char *propname, const char *type)
static void rna_int_print(FILE *f, int64_t num)
static void rna_sortlist(ListBase *listbase, int(*cmp)(const void *, const void *))
static void rna_generate_struct_prototypes(FILE *f)
static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const char *api_filename)
static const char * rna_parameter_type_name(PropertyRNA *parm)
static void rna_def_property_wrapper_funcs(FILE *f, StructDefRNA *dsrna, PropertyDefRNA *dp)
static int rna_is_collection_prop(PropertyRNA *prop)
static const char * rna_find_type(const char *type)
static char * rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *item_type)
static char * rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp), const char *manualfunc)
static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
static int cmp_struct(const void *a, const void *b)
static const char * rna_property_subtypename(PropertySubType type)
static void rna_set_raw_property(PropertyDefRNA *dp, PropertyRNA *prop)
static char * rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
static void rna_construct_wrapper_function_name(char *buffer, int size, const char *structname, const char *propname, const char *type)
static char * rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
static void make_bad_file(const char *file, int line)
static int rna_preprocess(const char *outfile, const char *public_header_outfile)
void(* MEM_freeN)(void *vmemh)
void(* MEM_set_error_callback)(void(*func)(const char *))
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
bool remove(void *owner, const AttributeIDRef &attribute_id)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void RNA_def_ID(BlenderRNA *brna)
void RNA_def_action(BlenderRNA *brna)
void RNA_def_animation(BlenderRNA *brna)
void RNA_def_animviz(BlenderRNA *brna)
void RNA_def_armature(BlenderRNA *brna)
void RNA_def_asset(BlenderRNA *brna)
void RNA_def_attribute(BlenderRNA *brna)
void RNA_def_boid(BlenderRNA *brna)
void RNA_def_brush(BlenderRNA *brna)
void RNA_def_cachefile(BlenderRNA *brna)
void RNA_def_camera(BlenderRNA *brna)
void RNA_def_cloth(BlenderRNA *brna)
void RNA_def_collections(BlenderRNA *brna)
void RNA_def_color(BlenderRNA *brna)
void RNA_def_constraint(BlenderRNA *brna)
void RNA_def_context(BlenderRNA *brna)
void RNA_def_curve(BlenderRNA *brna)
void RNA_def_profile(BlenderRNA *brna)
void RNA_def_curves(BlenderRNA *brna)
StructDefRNA * rna_find_struct_def(StructRNA *srna)
PropertyDefRNA * rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop)
void RNA_free(BlenderRNA *brna)
int rna_parameter_size(PropertyRNA *parm)
void RNA_define_free(BlenderRNA *UNUSED(brna))
FunctionDefRNA * rna_find_function_def(FunctionRNA *func)
PropertyDefRNA * rna_find_parameter_def(PropertyRNA *parm)
BlenderRNA * RNA_create(void)
const char * RNA_property_typename(PropertyType type)
int rna_parameter_size_pad(const int size)
void rna_addtail(ListBase *listbase, void *vlink)
void RNA_def_depsgraph(BlenderRNA *brna)
void RNA_def_dynamic_paint(BlenderRNA *brna)
void RNA_def_fcurve(BlenderRNA *brna)
void RNA_def_fluid(BlenderRNA *brna)
void RNA_def_gpencil(BlenderRNA *brna)
void RNA_def_greasepencil_modifier(BlenderRNA *brna)
void RNA_def_image(BlenderRNA *brna)
void RNA_def_lattice(struct BlenderRNA *brna)
void RNA_def_linestyle(struct BlenderRNA *brna)
void RNA_def_texture(struct BlenderRNA *brna)
void RNA_def_meta(struct BlenderRNA *brna)
void RNA_def_sequencer(struct BlenderRNA *brna)
void RNA_def_rna(struct BlenderRNA *brna)
void RNA_def_movieclip(struct BlenderRNA *brna)
void RNA_def_text(struct BlenderRNA *brna)
void RNA_def_particle(struct BlenderRNA *brna)
void RNA_def_render(struct BlenderRNA *brna)
void RNA_def_wm(struct BlenderRNA *brna)
void RNA_def_palette(struct BlenderRNA *brna)
void RNA_def_volume(struct BlenderRNA *brna)
void RNA_def_test(struct BlenderRNA *brna)
void RNA_def_shader_fx(struct BlenderRNA *brna)
void RNA_def_tracking(struct BlenderRNA *brna)
void RNA_def_nla(struct BlenderRNA *brna)
void RNA_def_rigidbody(struct BlenderRNA *brna)
void RNA_def_xr(struct BlenderRNA *brna)
void RNA_def_sound(struct BlenderRNA *brna)
void RNA_def_ui(struct BlenderRNA *brna)
void RNA_def_material(struct BlenderRNA *brna)
void RNA_def_key(struct BlenderRNA *brna)
void RNA_def_space(struct BlenderRNA *brna)
void RNA_def_view_layer(struct BlenderRNA *brna)
void RNA_def_mask(struct BlenderRNA *brna)
void RNA_def_mesh(struct BlenderRNA *brna)
void RNA_def_light(struct BlenderRNA *brna)
void RNA_def_pose(struct BlenderRNA *brna)
void RNA_def_world(struct BlenderRNA *brna)
void RNA_def_sculpt_paint(struct BlenderRNA *brna)
void RNA_def_timeline_marker(struct BlenderRNA *brna)
void RNA_def_object(struct BlenderRNA *brna)
void RNA_def_nodetree(struct BlenderRNA *brna)
void RNA_def_lightprobe(struct BlenderRNA *brna)
void RNA_def_userdef(struct BlenderRNA *brna)
void RNA_def_object_force(struct BlenderRNA *brna)
void RNA_def_simulation(struct BlenderRNA *brna)
void RNA_def_scene(struct BlenderRNA *brna)
void RNA_def_vfont(struct BlenderRNA *brna)
void RNA_def_wm_gizmo(struct BlenderRNA *brna)
void RNA_def_screen(struct BlenderRNA *brna)
void RNA_def_modifier(struct BlenderRNA *brna)
void RNA_def_pointcloud(struct BlenderRNA *brna)
void RNA_def_packedfile(struct BlenderRNA *brna)
void RNA_def_speaker(struct BlenderRNA *brna)
void RNA_def_workspace(struct BlenderRNA *brna)
void RNA_def_main(struct BlenderRNA *brna)
@ PROP_INTERN_PTR_OWNERSHIP_FORCED
const EnumPropertyItem DummyRNA_NULL_items[]
PropBooleanArraySetFuncEx setarray_ex
PropBooleanArrayGetFuncEx getarray_ex
PropBooleanArraySetFunc setarray
const bool * defaultarray
PropBooleanSetFuncEx set_ex
PropBooleanGetFuncEx get_ex
PropBooleanArrayGetFunc getarray
PropCollectionNextFunc next
PropCollectionLookupStringFunc lookupstring
PropCollectionLengthFunc length
struct StructRNA * item_type
PropCollectionLookupIntFunc lookupint
PropCollectionBeginFunc begin
PropCollectionAssignIntFunc assignint
PropCollectionEndFunc end
PropCollectionGetFunc get
const EnumPropertyItem * item
const char * native_enum_type
PropFloatSetFuncEx set_ex
PropertyScaleType ui_scale_type
PropFloatRangeFuncEx range_ex
PropFloatArrayGetFuncEx getarray_ex
PropFloatArraySetFuncEx setarray_ex
PropFloatArrayGetFunc getarray
const float * defaultarray
PropFloatArraySetFunc setarray
PropFloatGetFuncEx get_ex
PropIntRangeFuncEx range_ex
PropIntArrayGetFunc getarray
PropIntArrayGetFuncEx getarray_ex
PropIntArraySetFunc setarray
PropIntArraySetFuncEx setarray_ex
PropertyScaleType ui_scale_type
PropPointerTypeFunc type_fn
const char * dnastructfromprop
const char * dnastructname
struct PropertyDefRNA * next
const char * dnalengthname
struct PropertyRNA * prop
const char * dnastructfromname
ItemEditableFunc itemeditable
PropArrayLengthGetFunc getlength
const char * translation_context
RNAPropOverrideApply override_apply
unsigned int arraydimension
struct PropertyRNA * next
RNAPropOverrideStore override_store
RNAPropOverrideDiff override_diff
struct PropertyRNA * prev
unsigned int arraylength[RNA_MAX_ARRAY_DIMENSION]
unsigned int totarraylength
void(* define)(BlenderRNA *brna)
const char * api_filename
const char * defaultvalue
PropStringLengthFuncEx length_ex
PropStringLengthFunc length
PropStringGetFuncEx get_ex
PropStringSetFuncEx set_ex
StringPropertySearchFunc search
eStringPropertySearchFlag search_flag
StructUnregisterFunc unreg
StructInstanceFunc instance
struct StructRNA * nested
const char * translation_context
PropertyRNA * nameproperty
IDPropertiesFunc idproperties
PropertyRNA * iteratorproperty