From a1aa4a259713f26c32a5fac4adbe0751e0479f5b Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 23 Aug 2019 09:52:12 +0200 Subject: 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 --- source/blender/makesrna/intern/rna_color.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'source/blender/makesrna/intern/rna_color.c') diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 6bfd2b9f63b..011e373cc61 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -164,8 +164,8 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) char *path = NULL; /* handle the cases where a single data-block may have 2 ramp types */ - if (ptr->id.data) { - ID *id = ptr->id.data; + if (ptr->owner_id) { + ID *id = ptr->owner_id; switch (GS(id->name)) { case ID_NT: { @@ -237,8 +237,8 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) /* determine the path from the ID-block to the ramp */ /* FIXME: this is a very slow way to do it, but it will have to suffice... */ - if (ptr->id.data) { - ID *id = ptr->id.data; + if (ptr->owner_id) { + ID *id = ptr->owner_id; switch (GS(id->name)) { case ID_NT: { @@ -286,12 +286,12 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - if (ptr->id.data) { - ID *id = ptr->id.data; + if (ptr->owner_id) { + ID *id = ptr->owner_id; switch (GS(id->name)) { case ID_MA: { - Material *ma = ptr->id.data; + Material *ma = (Material *)ptr->owner_id; DEG_id_tag_update(&ma->id, 0); WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma); @@ -309,20 +309,20 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * break; } case ID_TE: { - Tex *tex = ptr->id.data; + Tex *tex = (Tex *)ptr->owner_id; DEG_id_tag_update(&tex->id, 0); WM_main_add_notifier(NC_TEXTURE, tex); break; } case ID_LS: { - FreestyleLineStyle *linestyle = ptr->id.data; + FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->owner_id; WM_main_add_notifier(NC_LINESTYLE, linestyle); break; } case ID_PA: { - ParticleSettings *part = ptr->id.data; + ParticleSettings *part = (ParticleSettings *)ptr->owner_id; DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO); WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, part); @@ -417,7 +417,7 @@ static void rna_ColorManagedDisplaySettings_display_device_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - ID *id = ptr->id.data; + ID *id = ptr->owner_id; if (!id) { return; @@ -582,7 +582,7 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - ID *id = ptr->id.data; + ID *id = ptr->owner_id; if (GS(id->name) == ID_IM) { Image *ima = (Image *)id; @@ -657,7 +657,7 @@ static char *rna_ColorManagedInputColorspaceSettings_path(PointerRNA *UNUSED(ptr static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { - ID *id = ptr->id.data; + ID *id = ptr->owner_id; if (!id) { return; -- cgit v1.2.3