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_gpencil.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source/blender/makesrna/intern/rna_gpencil.c') diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 5313607d4ea..bd3321377d3 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -144,13 +144,13 @@ static EnumPropertyItem rna_enum_gpencil_caps_modes_items[] = { static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { - DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY); + DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); } static void rna_GPencil_autolock(Main *bmain, Scene *scene, PointerRNA *ptr) { - bGPdata *gpd = (bGPdata *)ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; bGPDlayer *gpl = NULL; if (gpd->flag & GP_DATA_AUTOLOCK_LAYERS) { @@ -182,7 +182,7 @@ static void rna_GPencil_autolock(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_GPencil_editmode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { - bGPdata *gpd = (bGPdata *)ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); /* Notify all places where GPencil data lives that the editing state is different */ @@ -194,7 +194,7 @@ static void UNUSED_FUNCTION(rna_GPencil_onion_skinning_update)(Main *bmain, Scene *scene, PointerRNA *ptr) { - bGPdata *gpd = (bGPdata *)ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; bGPDlayer *gpl; bool enabled = false; @@ -362,7 +362,7 @@ static bool rna_GPencilLayer_is_parented_get(PointerRNA *ptr) static PointerRNA rna_GPencil_active_layer_get(PointerRNA *ptr) { - bGPdata *gpd = ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */ bGPDlayer *gl; @@ -385,7 +385,7 @@ static void rna_GPencil_active_layer_set(PointerRNA *ptr, PointerRNA value, struct ReportList *UNUSED(reports)) { - bGPdata *gpd = ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; /* Don't allow setting active layer to NULL if layers exist * as this breaks various tools. Tools should be used instead @@ -414,7 +414,7 @@ static void rna_GPencil_active_layer_set(PointerRNA *ptr, static int rna_GPencil_active_layer_index_get(PointerRNA *ptr) { - bGPdata *gpd = (bGPdata *)ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd); return BLI_findindex(&gpd->layers, gpl); @@ -422,7 +422,7 @@ static int rna_GPencil_active_layer_index_get(PointerRNA *ptr) static void rna_GPencil_active_layer_index_set(PointerRNA *ptr, int value) { - bGPdata *gpd = (bGPdata *)ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; bGPDlayer *gpl = BLI_findlink(&gpd->layers, value); BKE_gpencil_layer_setactive(gpd, gpl); @@ -435,7 +435,7 @@ static void rna_GPencil_active_layer_index_set(PointerRNA *ptr, int value) static void rna_GPencil_active_layer_index_range( PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) { - bGPdata *gpd = (bGPdata *)ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; *min = 0; *max = max_ii(0, BLI_listbase_count(&gpd->layers) - 1); @@ -449,7 +449,7 @@ static const EnumPropertyItem *rna_GPencil_active_layer_itemf(bContext *C, PropertyRNA *UNUSED(prop), bool *r_free) { - bGPdata *gpd = (bGPdata *)ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; bGPDlayer *gpl; EnumPropertyItem *item = NULL, item_tmp = {0}; int totitem = 0; @@ -478,7 +478,7 @@ static const EnumPropertyItem *rna_GPencil_active_layer_itemf(bContext *C, static void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value) { - bGPdata *gpd = ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; bGPDlayer *gpl = ptr->data; char oldname[128] = ""; @@ -539,7 +539,7 @@ static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd, static void rna_GPencil_stroke_point_select_set(PointerRNA *ptr, const bool value) { - bGPdata *gpd = ptr->id.data; + bGPdata *gpd = (bGPdata *)ptr->owner_id; bGPDspoint *pt = ptr->data; bGPDstroke *gps = NULL; -- cgit v1.2.3