diff options
author | Bastien Montagne <bastien@blender.org> | 2022-06-08 18:49:40 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-06-08 19:00:42 +0300 |
commit | 8843705f651f0150d22b9f99e4cac9b7a641adbf (patch) | |
tree | 36f253ae253908dbfa00616bfe6c869d7d0640bc /source/blender/makesrna/intern/rna_camera.c | |
parent | d62e6f122575a0a8292e731fecebe663589e81ea (diff) |
Fix (unreported) missing rna path for some background image properties.
RNA camera code did not handle path for its image/movieclip users
sub-data, and moviclip RNA struct definition did not have a rna path
function at all.
Diffstat (limited to 'source/blender/makesrna/intern/rna_camera.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_camera.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index dcf0647392e..9628c6b2d65 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -125,6 +125,24 @@ static char *rna_Camera_background_image_path(const PointerRNA *ptr) return NULL; } +char *rna_CameraBackgroundImage_image_or_movieclip_user_path(const PointerRNA *ptr) +{ + const char *user = ptr->data; + Camera *camera = (Camera *)ptr->owner_id; + + int bgpic_index = BLI_findindex(&camera->bg_images, user - offsetof(CameraBGImage, iuser)); + if (bgpic_index >= 0) { + return BLI_sprintfN("background_images[%d].image_user", bgpic_index); + } + + bgpic_index = BLI_findindex(&camera->bg_images, user - offsetof(CameraBGImage, cuser)); + if (bgpic_index >= 0) { + return BLI_sprintfN("background_images[%d].clip_user", bgpic_index); + } + + return NULL; +} + static bool rna_Camera_background_images_override_apply(Main *bmain, PointerRNA *ptr_dst, PointerRNA *ptr_src, @@ -272,6 +290,7 @@ static void rna_def_camera_background_image(BlenderRNA *brna) prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "ImageUser"); RNA_def_property_pointer_sdna(prop, NULL, "iuser"); RNA_def_property_ui_text( prop, |