From 28f7c80c464b71911f926932f6a789efeea14c1e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 22 Apr 2020 15:52:15 +0200 Subject: Fix invalid RNA path for transform orientations. Fix T75861: Impossible to set Shortcut (hotkey) on Transform Orientation or Pivot Point. --- source/blender/makesrna/intern/rna_scene.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 27ebbe79085..a19bbdcc369 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2026,6 +2026,24 @@ static void rna_View3DCursor_matrix_set(PointerRNA *ptr, const float *values) BKE_scene_cursor_from_mat4(cursor, unit_mat, false); } +static char *rna_TransformOrientationSlot_path(PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->owner_id; + TransformOrientationSlot *orientation_slot = ptr->data; + + if (!ELEM(NULL, scene, orientation_slot)) { + for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) { + if (&scene->orientation_slots[i] == orientation_slot) { + return BLI_sprintfN("transform_orientation_slots[%d]", i); + } + } + } + + /* Should not happen, but in case, just return defqult path. */ + BLI_assert(0); + return BLI_strdup("transform_orientation_slots[0]"); +} + static char *rna_View3DCursor_path(PointerRNA *UNUSED(ptr)) { return BLI_strdup("cursor"); @@ -2664,6 +2682,7 @@ static void rna_def_transform_orientation_slot(BlenderRNA *brna) srna = RNA_def_struct(brna, "TransformOrientationSlot", NULL); RNA_def_struct_sdna(srna, "TransformOrientationSlot"); + RNA_def_struct_path_func(srna, "rna_TransformOrientationSlot_path"); RNA_def_struct_ui_text(srna, "Orientation Slot", ""); /* Orientations */ -- cgit v1.2.3