Fix invalid RNA path for transform orientations.

Fix T75861: Impossible to set Shortcut (hotkey) on Transform Orientation
or Pivot Point.
This commit is contained in:
Bastien Montagne 2020-04-22 15:52:15 +02:00
parent 6c9a882340
commit 28f7c80c46
Notes: blender-bot 2023-02-14 00:29:15 +01:00
Referenced by issue #77455, Scale gizmos cause complete freezes in Blender 2.83 on Intel graphics
Referenced by issue #75861, Impossible to set Shortcut (hotkey) on Transform Orientation or Pivot Point
1 changed files with 19 additions and 0 deletions

View File

@ -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 */