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:
authorMiika Hamalainen <blender@miikah.org>2011-10-04 15:42:44 +0400
committerMiika Hamalainen <blender@miikah.org>2011-10-04 15:42:44 +0400
commite8bb972f3c04b00f6e813b61332c53213c12e8c4 (patch)
tree5d05e7c8421c5af4e034ff3a01ebe34a2d94b9ec /source/blender/editors/space_buttons
parent9e9b26b8ba54227f79f97acc87893611d61b9831 (diff)
parent019dca9c54289136b34c688a048ee009e2e852ee (diff)
Merge with trunk r40782
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index ae61dfe86a0..11ac756bfb5 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -234,7 +234,7 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture)
else if(buttons_context_path_object(path)) {
ob= path->ptr[path->len-1].data;
- if(ob && ob->type && (ob->type<OB_LAMP)) {
+ if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
ma= give_current_material(ob, ob->actcol);
RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
path->len++;
@@ -721,8 +721,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
if(ptr) {
Object *ob= ptr->data;
- if(ob && ob->type && (ob->type<OB_LAMP) && ob->totcol)
- CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, ob->mat+ob->actcol-1);
+ if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
+ /* a valid actcol isn't ensured [#27526] */
+ int matnr= ob->actcol-1;
+ if(matnr < 0) matnr= 0;
+ CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, &ob->mat[matnr]);
+ }
}
return 1;