[Bf-blender-cvs] [28f7c80c464] blender-v2.83-release: Fix invalid RNA path for transform orientations.

Bastien Montagne noreply at git.blender.org
Wed Apr 22 15:53:38 CEST 2020


Commit: 28f7c80c464b71911f926932f6a789efeea14c1e
Author: Bastien Montagne
Date:   Wed Apr 22 15:52:15 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB28f7c80c464b71911f926932f6a789efeea14c1e

Fix invalid RNA path for transform orientations.

Fix T75861: Impossible to set Shortcut (hotkey) on Transform Orientation
or Pivot Point.

===================================================================

M	source/blender/makesrna/intern/rna_scene.c

===================================================================

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



More information about the Bf-blender-cvs mailing list