Blender V5.3
rna_timeline.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "DNA_scene_types.h"
12
13#include "RNA_define.hh"
14
15#include "rna_internal.hh"
16
17#include "WM_types.hh"
18
19#ifdef RNA_RUNTIME
20
21# include "BKE_idprop.hh"
22# include "BKE_main.hh"
23# include "BKE_scene.hh"
24# include "BKE_screen.hh"
25
26# include "WM_api.hh"
27
28# include "DEG_depsgraph_build.hh"
29
30namespace blender {
31
32static IDProperty **rna_TimelineMarker_idprops(PointerRNA *ptr)
33{
34 TimeMarker *marker = static_cast<TimeMarker *>(ptr->data);
35 return &marker->prop;
36}
37
38static void rna_TimelineMarker_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA * /*ptr*/)
39{
42}
43
44static void rna_TimelineMarker_camera_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
45{
46 wmWindowManager *wm = bmain->wm.first();
47 Scene *scene = id_cast<Scene *>(ptr->owner_id);
48
50 WM_windows_scene_data_sync(&wm->windows, scene);
52
55 WM_main_add_notifier(NC_SCENE | NA_EDITED, scene); /* so we get view3d redraws */
56}
57
58} // namespace blender
59
60#else
61
62namespace blender {
63
65{
66 StructRNA *srna;
67 PropertyRNA *prop;
68
69 srna = RNA_def_struct(brna, "TimelineMarker", nullptr);
70 RNA_def_struct_sdna(srna, "TimeMarker");
71 RNA_def_struct_ui_text(srna, "Marker", "Marker for noting points in the timeline");
72 RNA_def_struct_system_idprops_func(srna, "rna_TimelineMarker_idprops");
73
74 /* String values */
75 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
76 RNA_def_property_ui_text(prop, "Name", "");
78 RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
79
80 prop = RNA_def_property(srna, "frame", PROP_INT, PROP_TIME);
81 RNA_def_property_ui_text(prop, "Frame", "The frame on which the timeline marker appears");
82 RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
83
84 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
85 RNA_def_property_boolean_sdna(prop, nullptr, "flag", 1 /*SELECT*/);
86 RNA_def_property_ui_text(prop, "Select", "Marker selection state");
87 RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
88
89 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
90 RNA_def_property_struct_type(prop, "Object");
93 RNA_def_property_ui_text(prop, "Camera", "Camera that becomes active on this frame");
94 RNA_def_property_update(prop, 0, "rna_TimelineMarker_camera_update");
95}
96
101
102} // namespace blender
103
104#endif
#define NC_ANIMATION
Definition WM_types.hh:401
#define NC_SCENE
Definition WM_types.hh:391
#define NA_EDITED
Definition WM_types.hh:634
#define ND_MARKERS
Definition WM_types.hh:452
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
static void rna_def_timeline_marker(BlenderRNA *brna)
void RNA_def_timeline_marker(BlenderRNA *brna)
void RNA_def_struct_system_idprops_func(StructRNA *srna, const char *system_idproperties)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:588
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void WM_windows_scene_data_sync(const ListBaseT< wmWindow > *win_lb, Scene *scene)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
bool BKE_scene_camera_switch_update(Scene *scene)
Definition scene.cc:2480
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_ID_SELF_CHECK
Definition RNA_types.hh:440
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
void DEG_relations_tag_update(Main *bmain)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
struct IDProperty * prop