Fix for incorrect use of DNA_struct_find_nr
Patch T38290 by ldo (Lawrence D'Oliveiro)
This commit is contained in:
@@ -1278,7 +1278,7 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int
|
||||
curSDNAnr = DNA_struct_find_nr(newsdna, type);
|
||||
|
||||
/* init data and alloc */
|
||||
if (curSDNAnr >= 0) {
|
||||
if (curSDNAnr != -1) {
|
||||
spc = newsdna->structs[curSDNAnr];
|
||||
curlen = newsdna->typelens[spc[0]];
|
||||
}
|
||||
@@ -1308,6 +1308,7 @@ int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const ch
|
||||
const int SDNAnr = DNA_struct_find_nr(sdna, stype);
|
||||
const short * const spo = sdna->structs[SDNAnr];
|
||||
char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL);
|
||||
BLI_assert(SDNAnr != -1);
|
||||
return (int)((intptr_t)cp);
|
||||
}
|
||||
|
||||
@@ -1316,7 +1317,7 @@ bool DNA_struct_elem_find(SDNA *sdna, const char *stype, const char *vartype, co
|
||||
|
||||
const int SDNAnr = DNA_struct_find_nr(sdna, stype);
|
||||
|
||||
if (SDNAnr >= 0) {
|
||||
if (SDNAnr != -1) {
|
||||
const short * const spo = sdna->structs[SDNAnr];
|
||||
char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL);
|
||||
|
||||
|
||||
@@ -838,13 +838,17 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
|
||||
|
||||
ds = rna_find_def_struct(srna);
|
||||
|
||||
if (!DNA_struct_find_nr(DefRNA.sdna, structname)) {
|
||||
/* 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(DefRNA.sdna, structname) == -1) {
|
||||
if (!DefRNA.silent) {
|
||||
fprintf(stderr, "%s: %s not found.\n", __func__, structname);
|
||||
DefRNA.error = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
ds->dnaname = structname;
|
||||
}
|
||||
@@ -865,7 +869,7 @@ void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const cha
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DNA_struct_find_nr(DefRNA.sdna, structname)) {
|
||||
if (DNA_struct_find_nr(DefRNA.sdna, structname) == -1) {
|
||||
if (!DefRNA.silent) {
|
||||
fprintf(stderr, "%s: %s not found.\n", __func__, structname);
|
||||
DefRNA.error = 1;
|
||||
|
||||
Reference in New Issue
Block a user