Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_vfont.c')
-rw-r--r--source/blender/makesrna/intern/rna_vfont.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c
index aca25252d2e..ff9469550d9 100644
--- a/source/blender/makesrna/intern/rna_vfont.c
+++ b/source/blender/makesrna/intern/rna_vfont.c
@@ -24,7 +24,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include "RNA_define.h"
@@ -33,8 +32,37 @@
#include "DNA_vfont_types.h"
+#include "WM_types.h"
+
+
#ifdef RNA_RUNTIME
+#include "BKE_font.h"
+#include "BKE_depsgraph.h"
+#include "DNA_object_types.h"
+
+#include "WM_api.h"
+
+/* matching fnction in rna_ID.c */
+static int rna_VectorFont_filepath_editable(PointerRNA *ptr)
+{
+ VFont *vfont = ptr->id.data;
+ if (BKE_vfont_is_builtin(vfont)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void rna_VectorFont_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ VFont *vf = ptr->id.data;
+ BKE_vfont_free_data(vf);
+
+ /* update */
+ WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
+ DAG_id_tag_update(&vf->id, OB_RECALC_OB | OB_RECALC_DATA);
+}
+
#else
void RNA_def_vfont(BlenderRNA *brna)
@@ -48,9 +76,10 @@ void RNA_def_vfont(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable");
RNA_def_property_ui_text(prop, "File Path", "");
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_VectorFont_reload_update");
prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
@@ -58,4 +87,3 @@ void RNA_def_vfont(BlenderRNA *brna)
}
#endif
-