Restore 'writable' handling in bpy_class_call.
Refactor 1dbe94c8ac restored the 'old' proper way to directly call the
python type (i.e. use the python's implementation to create objects),
instead of using the 'specialized' type creation code.
However, the handling of the ugly `rna_disallow_writes` global was only
added later to the 'workaround' part of the code, but not to the original
'canonical' one.
This commit copies the handling of `rna_disallow_writes` back into the
now active part of the code.
This solves the `is_readonly_init` unused variable build warning.
NOTE: At some point the BPY code needs a good cleanup pass, there are
way to many pieces of codes #ifdef'ed there.
This commit is contained in:
@@ -9334,8 +9334,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
|
||||
py_class_instance = py_srna;
|
||||
|
||||
#else
|
||||
# ifdef USE_PEDANTIC_WRITE
|
||||
const int prev_write = rna_disallow_writes;
|
||||
rna_disallow_writes = true;
|
||||
rna_disallow_writes = is_readonly_init ? false :
|
||||
true; /* Only operators can write on __init__. */
|
||||
# endif
|
||||
|
||||
/* 'almost' all the time calling the class isn't needed.
|
||||
* We could just do... */
|
||||
@@ -9350,7 +9353,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
|
||||
*/
|
||||
py_class_instance = PyObject_CallOneArg(reinterpret_cast<PyObject *>(py_class), py_srna);
|
||||
|
||||
# ifdef USE_PEDANTIC_WRITE
|
||||
rna_disallow_writes = prev_write;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user