PyAPI: extend save/load handlers, optionally take a filepath argument

Add a filepath argument to load/save pre/post.
Also add save_post_failed and load_post_failed handlers so it's always
possible to for the pre handlers to run a matching post action.

This makes it possible to know the filepath of the blend file mean
loaded/saved as well as supporting running an action when load/save
operations fail.

When loading and saving the startup-file, the path argument is set to
an empty string.

Details:

New RNA types were added to support storing primitive values in
PointerRNA. Primitive{String/Int/Float/Boolean}RNA. These will likely
only be used in some limited cases, in the case of BKE_callback_exec it
allows strings to be included as part of the PointerRNA **pointers
argument.

Ref !104769.
This commit is contained in:
2023-03-09 10:46:49 +11:00
parent 1cc072b1a7
commit 46be42f6b1
8 changed files with 218 additions and 28 deletions

View File

@@ -173,6 +173,7 @@ void BPY_update_rna_module(void);
// PyObject *BPY_rna_doc(void);
PyObject *BPY_rna_types(void);
PyObject *pyrna_struct_CreatePyObject_with_primitive_support(PointerRNA *ptr);
PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr);
PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop);