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:
authorCampbell Barton <ideasman42@gmail.com>2012-08-03 19:03:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-03 19:03:40 +0400
commit173b998735ee30bdb4335ae2c65cf656d9249504 (patch)
treec03cfe07371927de7d1bf2a8c8d5b348c0c3f47b /source/blender/makesrna/intern/rna_vfont.c
parent07da83a3b365f0c88a1798eaef3b53dc4af974ee (diff)
fix/edits to vector font handling
- don't overwrite the font path with "<builtin>" when the font file cant be found, it caused bad problems when loading files on someone elses systems when paths couldn't be found blender would silently clobber paths (tsk tsk). - when fonts are freed their temp data is now freed too. - assigning a new filepath to a font now refreshes the object data.
Diffstat (limited to 'source/blender/makesrna/intern/rna_vfont.c')
-rw-r--r--source/blender/makesrna/intern/rna_vfont.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c
index ad9c91b3623..b65db1c809c 100644
--- a/source/blender/makesrna/intern/rna_vfont.c
+++ b/source/blender/makesrna/intern/rna_vfont.c
@@ -32,19 +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 *vf = (VFont *)ptr->data;
+ VFont *vf = ptr->id.data;
if (strcmp(vf->name, FO_BUILTIN_NAME) == 0) {
return 0;
}
-
return 1;
}
+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)
@@ -61,6 +79,7 @@ void RNA_def_vfont(BlenderRNA *brna)
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");