Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_buttons/buttons_context.c
| Show First 20 Lines • Show All 981 Lines • ▼ Show 20 Lines | if (ptr) { | ||||
| if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) { | if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) { | ||||
| /* a valid actcol isn't ensured T27526. */ | /* a valid actcol isn't ensured T27526. */ | ||||
| int matnr = ob->actcol - 1; | int matnr = ob->actcol - 1; | ||||
| if (matnr < 0) { | if (matnr < 0) { | ||||
| matnr = 0; | matnr = 0; | ||||
| } | } | ||||
| /* Keep aligned with rna_Object_material_slots_get. */ | /* 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)); | |||||
| } | } | ||||
| } | } | ||||
| return CTX_RESULT_OK; | return CTX_RESULT_OK; | ||||
| } | } | ||||
| if (CTX_data_equals(member, "texture_user")) { | if (CTX_data_equals(member, "texture_user")) { | ||||
| ButsContextTexture *ct = sbuts->texuser; | ButsContextTexture *ct = sbuts->texuser; | ||||
| ▲ Show 20 Lines • Show All 310 Lines • Show Last 20 Lines | |||||