Core: expose ID.session_uid in RNA

This exposes the internal `ID.session_uuid` in the Python API as `ID.session_uid`.
The exposed name is not `session_uuid`, because it's not actually universally unique,
and we want to change the internal name too.

The reason for exposing this is to allow Python scripts to call operators that take the
session id as input. A fair number of operators do this as you can see when searching
for `WM_operator_properties_id_lookup`.

Pull Request: https://projects.blender.org/blender/blender/pulls/116888
This commit is contained in:
Jacques Lucke
2024-01-08 15:34:09 +01:00
parent d0ef66ddff
commit c68b22cfdf

View File

@@ -2190,6 +2190,15 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE);
prop = RNA_def_property(srna, "session_uid", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, nullptr, "session_uuid");
RNA_def_property_ui_text(
prop,
"Session UID",
"A session-wide unique identifier for the data block that remains the "
"same across renames and internal reallocations. It does change when reloading the file");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "is_evaluated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(
prop,