diff options
author | Sergey Sharybin <sergey@blender.org> | 2020-09-18 17:57:33 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2020-09-21 13:25:45 +0300 |
commit | 216a2218768d005c18032df370c19c1c0f571797 (patch) | |
tree | 20ec81038b82e567fc67f225bc1f7057dcaccb1f /source/blender/makesrna/intern/rna_timeline.c | |
parent | 3791dbea1e796f96440437333e4318066f26bde2 (diff) |
Implement ID properties support for TimeMarker
Allows scripters to store additional information in the marker itself instead
of using work-around approach based on marker names and such.
Differential Revision: https://developer.blender.org/D8944
Diffstat (limited to 'source/blender/makesrna/intern/rna_timeline.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_timeline.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_timeline.c b/source/blender/makesrna/intern/rna_timeline.c index ed17a509fc2..c0bd9fd92a2 100644 --- a/source/blender/makesrna/intern/rna_timeline.c +++ b/source/blender/makesrna/intern/rna_timeline.c @@ -30,8 +30,21 @@ #ifdef RNA_RUNTIME +# include "BKE_idprop.h" # include "WM_api.h" +static IDProperty *rna_TimelineMarker_idprops(PointerRNA *ptr, bool create) +{ + TimeMarker *marker = ptr->data; + + if (create && marker->prop == NULL) { + IDPropertyTemplate val = {0}; + marker->prop = IDP_New(IDP_GROUP, &val, "Marker ID properties"); + } + + return marker->prop; +} + static void rna_TimelineMarker_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -50,6 +63,7 @@ static void rna_def_timeline_marker(BlenderRNA *brna) srna = RNA_def_struct(brna, "TimelineMarker", NULL); RNA_def_struct_sdna(srna, "TimeMarker"); RNA_def_struct_ui_text(srna, "Marker", "Marker for noting points in the timeline"); + RNA_def_struct_idprops_func(srna, "rna_TimelineMarker_idprops"); /* String values */ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); |