Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <mail@jlucke.com>2019-08-23 10:52:12 +0300
committerJacques Lucke <mail@jlucke.com>2019-08-23 10:52:12 +0300
commita1aa4a259713f26c32a5fac4adbe0751e0479f5b (patch)
tree0737940d32513ad8e2458760c81ad7c1c61e1ce6 /source/blender/editors/interface/interface_ops.c
parent232049dd9408e15d2082181e60ddd775b375ff19 (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/editors/interface/interface_ops.c')
-rw-r--r--source/blender/editors/interface/interface_ops.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index c7ce66cfcf6..819ec4fc2d3 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -86,7 +86,7 @@ static bool copy_data_path_button_poll(bContext *C)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- if (ptr.id.data && ptr.data && prop) {
+ if (ptr.owner_id && ptr.data && prop) {
path = RNA_path_from_ID_to_property(&ptr, prop);
if (path) {
@@ -110,7 +110,7 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *op)
/* try to create driver using property retrieved from UI */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- if (ptr.id.data != NULL) {
+ if (ptr.owner_id != NULL) {
if (full_path) {
@@ -171,7 +171,7 @@ static bool copy_as_driver_button_poll(bContext *C)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- if (ptr.id.data && ptr.data && prop &&
+ if (ptr.owner_id && ptr.data && prop &&
ELEM(RNA_property_type(prop), PROP_BOOLEAN, PROP_INT, PROP_FLOAT, PROP_ENUM) &&
(index >= 0 || !RNA_property_array_check(prop))) {
path = RNA_path_from_ID_to_property(&ptr, prop);
@@ -194,12 +194,12 @@ static int copy_as_driver_button_exec(bContext *C, wmOperator *UNUSED(op))
/* try to create driver using property retrieved from UI */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- if (ptr.id.data && ptr.data && prop) {
+ if (ptr.owner_id && ptr.data && prop) {
int dim = RNA_property_array_dimension(&ptr, prop, NULL);
char *path = RNA_path_from_ID_to_property_index(&ptr, prop, dim, index);
if (path) {
- ANIM_copy_as_driver(ptr.id.data, path, RNA_property_identifier(prop));
+ ANIM_copy_as_driver(ptr.owner_id, path, RNA_property_identifier(prop));
MEM_freeN(path);
return OPERATOR_FINISHED;
}
@@ -287,7 +287,7 @@ static void UI_OT_copy_python_command_button(wmOperatorType *ot)
static int operator_button_property_finish(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->owner_id;
/* perform updates required for this property */
RNA_property_update(C, ptr, prop);
@@ -542,7 +542,7 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
/* try to reset the nominated setting to its default value */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- BLI_assert(ptr.id.data != NULL);
+ BLI_assert(ptr.owner_id != NULL);
if (all) {
index = -1;
@@ -605,7 +605,7 @@ static bool override_remove_button_poll(bContext *C)
const int override_status = RNA_property_override_library_status(&ptr, prop, index);
- return (ptr.data && ptr.id.data && prop && (override_status & RNA_OVERRIDE_STATUS_OVERRIDDEN));
+ return (ptr.data && ptr.owner_id && prop && (override_status & RNA_OVERRIDE_STATUS_OVERRIDDEN));
}
static int override_remove_button_exec(bContext *C, wmOperator *op)
@@ -619,7 +619,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
/* try to reset the nominated setting to its default value */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- ID *id = ptr.id.data;
+ ID *id = ptr.owner_id;
IDOverrideLibraryProperty *oprop = RNA_property_override_property_find(&ptr, prop);
BLI_assert(oprop != NULL);
BLI_assert(id != NULL && id->override_library != NULL);
@@ -720,7 +720,7 @@ bool UI_context_copy_to_selected_list(bContext *C,
CollectionPointerLink *link;
for (link = lb.first; link; link = link->next) {
bPoseChannel *pchan = link->ptr.data;
- RNA_pointer_create(link->ptr.id.data, &RNA_Bone, pchan->bone, &link->ptr);
+ RNA_pointer_create(link->ptr.owner_id, &RNA_Bone, pchan->bone, &link->ptr);
}
}
@@ -739,7 +739,7 @@ bool UI_context_copy_to_selected_list(bContext *C,
/* Get the node we're editing */
if (RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) {
- bNodeTree *ntree = ptr->id.data;
+ bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
bNodeSocket *sock = ptr->data;
if (nodeFindNode(ntree, sock, &node, NULL)) {
if ((path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Node)) != NULL) {
@@ -773,8 +773,8 @@ bool UI_context_copy_to_selected_list(bContext *C,
*r_lb = lb;
*r_path = path;
}
- else if (ptr->id.data) {
- ID *id = ptr->id.data;
+ else if (ptr->owner_id) {
+ ID *id = ptr->owner_id;
if (GS(id->name) == ID_OB) {
*r_lb = CTX_data_collection_get(C, "selected_editable_objects");
@@ -792,7 +792,7 @@ bool UI_context_copy_to_selected_list(bContext *C,
CollectionPointerLink *link, *link_next;
for (link = lb.first; link; link = link->next) {
- Object *ob = link->ptr.id.data;
+ Object *ob = (Object *)link->ptr.owner_id;
if (ob->data) {
ID *id_data = ob->data;
id_data->tag |= LIB_TAG_DOIT;
@@ -800,7 +800,7 @@ bool UI_context_copy_to_selected_list(bContext *C,
}
for (link = lb.first; link; link = link_next) {
- Object *ob = link->ptr.id.data;
+ Object *ob = (Object *)link->ptr.owner_id;
ID *id_data = ob->data;
link_next = link->next;
@@ -872,7 +872,7 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
if (use_path_from_id) {
/* Path relative to ID. */
lprop = NULL;
- RNA_id_pointer_create(link->ptr.id.data, &idptr);
+ RNA_id_pointer_create(link->ptr.owner_id, &idptr);
RNA_path_resolve_property(&idptr, path, &lptr, &lprop);
}
else if (path) {
@@ -982,12 +982,12 @@ static bool jump_to_target_ptr(bContext *C, PointerRNA ptr, const bool poll)
/* Find the containing Object. */
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = NULL;
- const short id_type = GS(((ID *)ptr.id.data)->name);
+ const short id_type = GS(ptr.owner_id->name);
if (id_type == ID_OB) {
- base = BKE_view_layer_base_find(view_layer, ptr.id.data);
+ base = BKE_view_layer_base_find(view_layer, (Object *)ptr.owner_id);
}
else if (OB_DATA_SUPPORT_ID(id_type)) {
- base = ED_object_find_first_by_data_id(view_layer, ptr.id.data);
+ base = ED_object_find_first_by_data_id(view_layer, ptr.owner_id);
}
bool ok = false;