Blender  V2.93
rna_timeline.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <stdlib.h>
22 
23 #include "DNA_scene_types.h"
24 
25 #include "RNA_define.h"
26 
27 #include "rna_internal.h"
28 
29 #include "WM_types.h"
30 
31 #ifdef RNA_RUNTIME
32 
33 # include "BKE_idprop.h"
34 # include "WM_api.h"
35 
36 static IDProperty *rna_TimelineMarker_idprops(PointerRNA *ptr, bool create)
37 {
38  TimeMarker *marker = ptr->data;
39 
40  if (create && marker->prop == NULL) {
41  IDPropertyTemplate val = {0};
42  marker->prop = IDP_New(IDP_GROUP, &val, "Marker ID properties");
43  }
44 
45  return marker->prop;
46 }
47 
48 static void rna_TimelineMarker_update(Main *UNUSED(bmain),
49  Scene *UNUSED(scene),
51 {
54 }
55 
56 #else
57 
59 {
60  StructRNA *srna;
61  PropertyRNA *prop;
62 
63  srna = RNA_def_struct(brna, "TimelineMarker", NULL);
64  RNA_def_struct_sdna(srna, "TimeMarker");
65  RNA_def_struct_ui_text(srna, "Marker", "Marker for noting points in the timeline");
66  RNA_def_struct_idprops_func(srna, "rna_TimelineMarker_idprops");
67 
68  /* String values */
69  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
70  RNA_def_property_ui_text(prop, "Name", "");
71  RNA_def_struct_name_property(srna, prop);
72  RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
73 
74  prop = RNA_def_property(srna, "frame", PROP_INT, PROP_TIME);
75  RNA_def_property_ui_text(prop, "Frame", "The frame on which the timeline marker appears");
76  RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
77 
78  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
79  RNA_def_property_boolean_sdna(prop, NULL, "flag", 1 /*SELECT*/);
80  RNA_def_property_ui_text(prop, "Select", "Marker selection state");
81  RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
82 
83 # ifdef DURIAN_CAMERA_SWITCH
84  prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
85  RNA_def_property_struct_type(prop, "Object");
88  RNA_def_property_ui_text(prop, "Camera", "Camera that becomes active on this frame");
89 # endif
90 }
91 
93 {
95 }
96 
97 #endif
struct IDProperty * IDP_New(const char type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: idprop.c:907
#define UNUSED(x)
@ IDP_GROUP
Definition: DNA_ID.h:101
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:297
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_ID_SELF_CHECK
Definition: RNA_types.h:218
@ PROP_TIME
Definition: RNA_types.h:133
@ PROP_NONE
Definition: RNA_types.h:113
#define NC_ANIMATION
Definition: WM_types.h:289
#define NC_SCENE
Definition: WM_types.h:279
#define ND_MARKERS
Definition: WM_types.h:333
Scene scene
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1122
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
Definition: rna_define.c:1179
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1525
static void rna_def_timeline_marker(BlenderRNA *brna)
Definition: rna_timeline.c:58
void RNA_def_timeline_marker(BlenderRNA *brna)
Definition: rna_timeline.c:92
Definition: BKE_main.h:116
void * data
Definition: RNA_types.h:52
struct IDProperty * prop
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157