Blender  V3.3
rna_vfont_api.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2015 Blender Foundation. All rights reserved. */
3 
8 #include "DNA_packedFile_types.h"
9 
10 #include "RNA_define.h"
11 #include "RNA_enum_types.h"
12 
13 #include "BKE_packedFile.h"
14 
15 #include "rna_internal.h"
16 
17 #ifdef RNA_RUNTIME
18 
19 static void rna_VectorFont_pack(VFont *vfont, Main *bmain, ReportList *reports)
20 {
22  reports, vfont->filepath, ID_BLEND_PATH(bmain, &vfont->id));
23 }
24 
25 static void rna_VectorFont_unpack(VFont *vfont, Main *bmain, ReportList *reports, int method)
26 {
27  if (!vfont->packedfile) {
28  BKE_report(reports, RPT_ERROR, "Font not packed");
29  }
30  else {
31  /* reports its own error on failure */
32  BKE_packedfile_unpack_vfont(bmain, reports, vfont, method);
33  }
34 }
35 
36 #else
37 
39 {
40  FunctionRNA *func;
41 
42  func = RNA_def_function(srna, "pack", "rna_VectorFont_pack");
43  RNA_def_function_ui_description(func, "Pack the font into the current blend file");
45 
46  func = RNA_def_function(srna, "unpack", "rna_VectorFont_unpack");
47  RNA_def_function_ui_description(func, "Unpack the font to the samples filename");
50  func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");
51 }
52 
53 #endif
struct PackedFile * BKE_packedfile_new(struct ReportList *reports, const char *filepath, const char *basepath)
Definition: packedFile.c:177
int BKE_packedfile_unpack_vfont(struct Main *bmain, struct ReportList *reports, struct VFont *vfont, enum ePF_FileStatus how)
Definition: packedFile.c:572
@ PF_USE_LOCAL
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
#define ID_BLEND_PATH(_bmain, _id)
Definition: DNA_ID.h:559
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_MAIN
Definition: RNA_types.h:661
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
const EnumPropertyItem rna_enum_unpack_method_items[]
void RNA_api_vfont(StructRNA *srna)
Definition: rna_vfont_api.c:38
Definition: BKE_main.h:121
char filepath[1024]
struct PackedFile * packedfile