diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-08-25 14:09:44 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-08-27 12:02:58 +0300 |
commit | 6845aad1a271db9861ba54e50c97146277eead4f (patch) | |
tree | 4ded81a1b6d5fe9d2e02332f6df6bf1622dcc889 /source/blender/editors/space_buttons | |
parent | 7dba879829469de6179302147d19cf17fb9fa94b (diff) |
Fix T90907: RNA pointers for material slots are not unique across IDs
Caused by {rB1a81d268a19f}.
This caused e.g. ALT-clicking the 'Link' button to not propagate to
other selected objects (same as the 'Copy To Selected' context menu
entry).
If these are not unique across IDs, checks in ui_selectcontext_begin()
or copy_to_selected_button() could fail.
Now offset by ID pointer.
thx @JacquesLucke for clarification on the POINTER_* macros (and why
not to use them)!
Maniphest Tasks: T90907
Differential Revision: https://developer.blender.org/D12321
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 70b715e0119..bf855db07e9 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -987,7 +987,8 @@ int /*eContextResult*/ buttons_context(const bContext *C, matnr = 0; } /* Keep aligned with rna_Object_material_slots_get. */ - CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, POINTER_FROM_INT(matnr + 1)); + CTX_data_pointer_set( + result, &ob->id, &RNA_MaterialSlot, (void *)(matnr + (uintptr_t)&ob->id)); } } |