[Bf-blender-cvs] [4267c6280a4] master: Fix (unreported) missing rna_path function for BackgroundImage struct.

Bastien Montagne noreply at git.blender.org
Mon May 30 17:16:35 CEST 2022


Commit: 4267c6280a41e3f5d00ab0ce55b5a1df622903b5
Author: Bastien Montagne
Date:   Mon May 30 17:15:37 2022 +0200
Branches: master
https://developer.blender.org/rB4267c6280a41e3f5d00ab0ce55b5a1df622903b5

Fix (unreported) missing rna_path function for BackgroundImage struct.

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

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

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

diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 92df7293c2e..52ec2bee128 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -111,6 +111,20 @@ static void rna_Camera_background_images_clear(Camera *cam)
   WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
 }
 
+static char *rna_Camera_background_image_path(const PointerRNA *ptr)
+{
+  const CameraBGImage *bgpic = ptr->data;
+  Camera *camera = (Camera *)ptr->owner_id;
+
+  const int bgpic_index = BLI_findindex(&camera->bg_images, bgpic);
+
+  if (bgpic_index >= 0) {
+    return BLI_sprintfN("background_images[%d]", bgpic_index);
+  }
+
+  return NULL;
+}
+
 static void rna_Camera_dof_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
 {
   SEQ_relations_invalidate_scene_strips(bmain, scene);
@@ -179,6 +193,7 @@ static void rna_def_camera_background_image(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "CameraBGImage");
   RNA_def_struct_ui_text(
       srna, "Background Image", "Image and settings for display in the 3D View background");
+  RNA_def_struct_path_func(srna, "rna_Camera_background_image_path");
 
   RNA_define_lib_overridable(true);



More information about the Bf-blender-cvs mailing list