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:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-05-17 14:59:59 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-05-17 15:27:13 +0300
commit34d67601b716046cf15f3e808a92bc91d0af804f (patch)
treea6875fadf1c129513a889cba61c6627d1a76e45b /source/blender/makesrna/intern/rna_access.c
parent8b5816e76bbf18246a5e28ec64a8e4c035f15e7a (diff)
Python: Raise an error even NO_MAIN data is assigned to object
The goal is to prevent assignment of temporary or evaluated meshes to objects from the main database. Majority of the change is actually related on passing reports around. On a positive side there are more error prints which can become more visible to scripters. There are still possible further improvements in the related areas. For example, disable user counting for evaluated ID datablocks when assignment happens. But can also happen later on as a separate improvement. Reviewers: brecht, campbellbarton, mont29 Reviewed By: brecht Differential Revision: https://developer.blender.org/D4884
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index a12951d9796..b56a031f9df 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -3733,24 +3733,29 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
}
}
-void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value)
+void RNA_property_pointer_set(ReportList *reports,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ PointerRNA ptr_value)
{
PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
BLI_assert(RNA_property_type(prop) == PROP_POINTER);
/* Check types */
if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, pprop->type)) {
- printf("%s: expected %s type, not %s.\n",
- __func__,
- pprop->type->identifier,
- ptr_value.type->identifier);
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "%s: expected %s type, not %s.\n",
+ __func__,
+ pprop->type->identifier,
+ ptr_value.type->identifier);
return;
}
/* RNA */
if (pprop->set && !((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
!((prop->flag & PROP_ID_SELF_CHECK) && ptr->id.data == ptr_value.id.data)) {
- pprop->set(ptr, ptr_value);
+ pprop->set(reports, ptr, ptr_value);
}
/* IDProperty */
else if (prop->flag & PROP_EDITABLE) {
@@ -6422,7 +6427,7 @@ void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
PropertyRNA *prop = RNA_struct_find_property(ptr, name);
if (prop) {
- RNA_property_pointer_set(ptr, prop, ptr_value);
+ RNA_property_pointer_set(NULL, ptr, prop, ptr_value);
}
else {
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -7971,7 +7976,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
case PROP_POINTER: {
PointerRNA value = RNA_property_pointer_get_default(ptr, prop);
- RNA_property_pointer_set(ptr, prop, value);
+ RNA_property_pointer_set(NULL, ptr, prop, value);
return true;
}