WM: add tool property getter function

Matches 'ensure' functions but doesn't add data.
This commit is contained in:
2019-01-23 15:36:10 +11:00
parent 2e4f1b592f
commit 7ce38978ae
2 changed files with 16 additions and 2 deletions

View File

@@ -103,8 +103,15 @@ void WM_toolsystem_ref_properties_ensure_ex(
#define WM_toolsystem_ref_properties_ensure_from_operator(tref, ot, r_ptr) \
WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, ot, r_ptr) \
WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr) \
WM_toolsystem_ref_properties_ensure_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
bool WM_toolsystem_ref_properties_get_ex(
struct bToolRef *tref, const char *idname, struct StructRNA *type, struct PointerRNA *r_ptr);
#define WM_toolsystem_ref_properties_get_from_operator(tref, ot, r_ptr) \
WM_toolsystem_ref_properties_get_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
#define WM_toolsystem_ref_properties_get_from_gizmo_group(tref, gzgroup, r_ptr) \
WM_toolsystem_ref_properties_get_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
void WM_toolsystem_ref_properties_init_for_keymap(
struct bToolRef *tref, struct PointerRNA *dst_ptr, struct PointerRNA *src_ptr, struct wmOperatorType *ot);

View File

@@ -897,6 +897,13 @@ IDProperty *WM_toolsystem_ref_properties_ensure_idprops(bToolRef *tref)
return tref->properties;
}
bool WM_toolsystem_ref_properties_get_ex(bToolRef *tref, const char *idname, StructRNA *type, PointerRNA *r_ptr)
{
IDProperty *group = tref->properties;
IDProperty *prop = group ? IDP_GetPropertyFromGroup(group, idname) : NULL;
RNA_pointer_create(NULL, type, prop, r_ptr);
return (prop != NULL);
}
void WM_toolsystem_ref_properties_ensure_ex(bToolRef *tref, const char *idname, StructRNA *type, PointerRNA *r_ptr)
{