Blender V5.0
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
29/* Matching function in rna_ID.cc */
30static int rna_VectorFont_filepath_editable(const PointerRNA *ptr, const char ** /*r_info*/)
31{
32 VFont *vfont = (VFont *)ptr->owner_id;
33 if (BKE_vfont_is_builtin(vfont)) {
34 return 0;
35 }
36 return PROP_EDITABLE;
37}
38
39static void rna_VectorFont_reload_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
40{
41 VFont *vf = (VFont *)ptr->owner_id;
43
44 /* update */
47}
48
49#else
50
52{
53 StructRNA *srna;
54 PropertyRNA *prop;
55
56 srna = RNA_def_struct(brna, "VectorFont", "ID");
57 RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects");
58 RNA_def_struct_sdna(srna, "VFont");
59 RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
60
61 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
62 RNA_def_property_string_sdna(prop, nullptr, "filepath");
64 RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable");
65 RNA_def_property_ui_text(prop, "File Path", "");
66 RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_VectorFont_reload_update");
67
68 prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
69 RNA_def_property_pointer_sdna(prop, nullptr, "packedfile");
70 RNA_def_property_ui_text(prop, "Packed File", "");
71
72 RNA_api_vfont(srna);
73}
74
75#endif
void BKE_vfont_data_free(VFont *vfont)
Definition vfont.cc:242
bool BKE_vfont_is_builtin(const VFont *vfont)
Definition vfont.cc:277
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
Object is a sort of wrapper for general info.
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:456
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_FILEPATH
Definition RNA_types.hh:236
#define NC_GEOM
Definition WM_types.hh:393
#define ND_DATA
Definition WM_types.hh:509
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_api_vfont(StructRNA *srna)
void RNA_def_vfont(BlenderRNA *brna)
Definition rna_vfont.cc:51
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238