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/rna_texture.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/rna_texture.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index e217db484dd..2ab08c82b63 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -186,10 +186,10 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr) static void rna_Texture_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - ID *id = ptr->id.data; + ID *id = ptr->owner_id; if (GS(id->name) == ID_TE) { - Tex *tex = ptr->id.data; + Tex *tex = (Tex *)ptr->owner_id; DEG_id_tag_update(&tex->id, 0); DEG_id_tag_update(&tex->id, ID_RECALC_EDITORS); @@ -197,7 +197,7 @@ static void rna_Texture_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *pt WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, NULL); } else if (GS(id->name) == ID_NT) { - bNodeTree *ntree = ptr->id.data; + bNodeTree *ntree = (bNodeTree *)ptr->owner_id; ED_node_tag_update_nodetree(bmain, ntree, NULL); } } @@ -219,7 +219,7 @@ static void rna_Color_mapping_update(Main *UNUSED(bmain), /* Used for Texture Properties, used (also) for/in Nodes */ static void rna_Texture_nodes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { - Tex *tex = ptr->id.data; + Tex *tex = (Tex *)ptr->owner_id; DEG_id_tag_update(&tex->id, 0); DEG_id_tag_update(&tex->id, ID_RECALC_EDITORS); @@ -235,7 +235,7 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value) void rna_TextureSlot_update(bContext *C, PointerRNA *ptr) { - ID *id = ptr->id.data; + ID *id = ptr->owner_id; DEG_id_tag_update(id, 0); @@ -290,8 +290,8 @@ char *rna_TextureSlot_path(PointerRNA *ptr) * since the name used is the name of the texture assigned, but the texture * may be used multiple times in the same stack */ - if (ptr->id.data) { - if (GS(((ID *)ptr->id.data)->name) == ID_BR) { + if (ptr->owner_id) { + if (GS(ptr->owner_id->name) == ID_BR) { return BLI_strdup("texture_slot"); } else { @@ -299,7 +299,7 @@ char *rna_TextureSlot_path(PointerRNA *ptr) PropertyRNA *prop; /* find the 'textures' property of the ID-struct */ - RNA_id_pointer_create(ptr->id.data, &id_ptr); + RNA_id_pointer_create(ptr->owner_id, &id_ptr); prop = RNA_struct_find_property(&id_ptr, "texture_slots"); /* get an iterator for this property, and try to find the relevant index */ |