workaround [#25845] Empty UI panels

- now writing to RNA is disabled when inside render() call.
- disallow calling operators when writes are disabled.

Rendering runs in a thread so running operators from the thread is not safe unless rendering becomes a blocking operator again.
This commit is contained in:
2011-02-01 00:32:50 +00:00
parent e8f7f42c1d
commit 11d61383fa
3 changed files with 21 additions and 1 deletions

View File

@@ -83,7 +83,19 @@ static int rna_id_write_error(PointerRNA *ptr, PyObject *key)
}
return FALSE;
}
#endif // USE_PEDANTIC_WRITE
#ifdef USE_PEDANTIC_WRITE
int pyrna_write_check(void)
{
return !rna_disallow_writes;
}
#else // USE_PEDANTIC_WRITE
int pyrna_write_check(void)
{
return TRUE;
}
#endif // USE_PEDANTIC_WRITE
static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
@@ -5324,8 +5336,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
PyGILState_STATE gilstate;
#ifdef USE_PEDANTIC_WRITE
const char *func_id= RNA_function_identifier(func);
/* testing, for correctness, not operator and not draw function */
const short is_readonly= strstr("draw", RNA_function_identifier(func)) || !RNA_struct_is_a(ptr->type, &RNA_Operator);
const short is_readonly= strstr("draw", func_id) || strstr("render", func_id) || !RNA_struct_is_a(ptr->type, &RNA_Operator);
#endif
py_class= RNA_struct_py_type_get(ptr->type);