warn when getting a context member fails because of type mismatch

This commit is contained in:
Campbell Barton
2012-07-24 10:28:29 +00:00
parent 7949f0057f
commit 23c4026c3f

View File

@@ -370,8 +370,15 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
{
PointerRNA ptr = CTX_data_pointer_get(C, member);
if (ptr.data && RNA_struct_is_a(ptr.type, type))
return ptr;
if (ptr.data) {
if (RNA_struct_is_a(ptr.type, type)) {
return ptr;
}
else {
printf("%s: warning, member '%s' is '%s', not '%s'\n",
__func__, member, RNA_struct_identifier(ptr.type), RNA_struct_identifier(type));
}
}
return PointerRNA_NULL;
}