Blender V5.3
rna_vfont.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 "RNA_define.hh"
12
13#include "rna_internal.hh"
14
15#include "WM_types.hh"
16
17#ifdef RNA_RUNTIME
18
19# include "DNA_object_types.h"
20# include "DNA_vfont_types.h"
21
22# include "BKE_library.hh"
23# include "BKE_vfont.hh"
24
25# include "DEG_depsgraph.hh"
26
27# include "WM_api.hh"
28
29namespace blender {
30
31/* Matching function in rna_ID.cc */
32static int rna_VectorFont_filepath_editable(const PointerRNA *ptr, const char ** /*r_info*/)
33{
34 VFont *vfont = id_cast<VFont *>(ptr->owner_id);
35 if (BKE_vfont_is_builtin(vfont)) {
36 return 0;
37 }
38 return PROP_EDITABLE;
39}
40
41static void rna_VectorFont_reload_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
42{
43 VFont *vf = id_cast<VFont *>(ptr->owner_id);
45
46 /* update */
49}
50
51} // namespace blender
52
53#else
54
55namespace blender {
56
58{
59 StructRNA *srna;
60 PropertyRNA *prop;
61
62 srna = RNA_def_struct(brna, "VectorFont", "ID");
63 RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects");
64 RNA_def_struct_sdna(srna, "VFont");
65 RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
66
67 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
68 RNA_def_property_string_sdna(prop, nullptr, "filepath");
70 RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable");
71 RNA_def_property_ui_text(prop, "File Path", "");
72 RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_VectorFont_reload_update");
73
74 prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
75 RNA_def_property_pointer_sdna(prop, nullptr, "packedfile");
76 RNA_def_property_ui_text(prop, "Packed File", "");
77
78 RNA_api_vfont(srna);
79}
80
81} // namespace blender
82
83#endif
Object is a sort of wrapper for general info.
#define NC_GEOM
Definition WM_types.hh:406
#define ND_DATA
Definition WM_types.hh:552
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_editable_func(PropertyRNA *prop, const char *editable)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
bool BKE_vfont_is_builtin(const VFont *vfont)
Definition vfont.cc:278
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
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_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_def_vfont(BlenderRNA *brna)
Definition rna_vfont.cc:57
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_api_vfont(StructRNA *srna)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:526
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
void BKE_vfont_data_free(VFont *vfont)
Definition vfont.cc:245
@ PROP_FILEPATH
Definition RNA_types.hh:284