diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-08-23 10:52:12 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-08-23 10:52:12 +0300 |
commit | a1aa4a259713f26c32a5fac4adbe0751e0479f5b (patch) | |
tree | 0737940d32513ad8e2458760c81ad7c1c61e1ce6 /source/blender/makesrna/intern/makesrna.c | |
parent | 232049dd9408e15d2082181e60ddd775b375ff19 (diff) |
RNA: Cleanup PointerRNA struct
The old layout of `PointerRNA` was confusing for historic reasons:
```
typedef struct PointerRNA {
struct {
void *data;
} id;
struct StructRNA *type;
void *data;
} PointerRNA;
```
This patch updates it to:
```
typedef struct PointerRNA {
struct ID *owner_id;
struct StructRNA *type;
void *data;
} PointerRNA;
```
Throughout the code base `id.data` was replaced with `owner_id`.
Furthermore, many explicit pointer type casts were added which
were implicit before. Some type casts to `ID *` were removed.
Reviewers: brecht, campbellbarton
Differential Revision: https://developer.blender.org/D5558
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 3b9fa40fcae..5aaddc30e07 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -389,7 +389,7 @@ static void rna_print_data_get(FILE *f, PropertyDefRNA *dp) static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp)) { - fprintf(f, " ID *id = ptr->id.data;\n"); + fprintf(f, " ID *id = ptr->owner_id;\n"); } static void rna_construct_function_name( @@ -2470,7 +2470,7 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func dsrna = rna_find_struct_def(srna); if (func->flag & FUNC_USE_SELF_ID) { - WRITE_PARAM("(::ID *) ptr.id.data"); + WRITE_PARAM("(::ID *) ptr.owner_id"); } if ((func->flag & FUNC_NO_SELF) == 0) { @@ -2579,7 +2579,7 @@ static void rna_def_struct_function_impl_cpp(FILE *f, StructRNA *srna, FunctionD } else { fprintf(f, - "\t\tRNA_pointer_create((::ID *) ptr.id.data, &RNA_%s, retdata, &result);\n", + "\t\tRNA_pointer_create((::ID *) ptr.owner_id, &RNA_%s, retdata, &result);\n", (const char *)pprop->type); } } @@ -2792,7 +2792,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA /* assign self */ if (func->flag & FUNC_USE_SELF_ID) { - fprintf(f, "\t_selfid = (struct ID *)_ptr->id.data;\n"); + fprintf(f, "\t_selfid = (struct ID *)_ptr->owner_id;\n"); } if ((func->flag & FUNC_NO_SELF) == 0) { |