[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49534] branches/soc-2011-tomato: svn merge ^/trunk/blender -r49531:49533
Campbell Barton
ideasman42 at gmail.com
Fri Aug 3 17:05:20 CEST 2012
Revision: 49534
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49534
Author: campbellbarton
Date: 2012-08-03 15:05:20 +0000 (Fri, 03 Aug 2012)
Log Message:
-----------
svn merge ^/trunk/blender -r49531:49533
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49531
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenkernel/BKE_font.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/depsgraph.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/font.c
branches/soc-2011-tomato/source/blender/blenlib/intern/freetypefont.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_vfont.c
branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_files.c
Property Changed:
----------------
branches/soc-2011-tomato/
branches/soc-2011-tomato/source/blender/editors/interface/interface.c
branches/soc-2011-tomato/source/blender/editors/space_outliner/
Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-49531
+ /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-49533
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_font.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_font.h 2012-08-03 15:03:40 UTC (rev 49533)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_font.h 2012-08-03 15:05:20 UTC (rev 49534)
@@ -73,12 +73,15 @@
void BKE_vfont_builtin_register(void *mem, int size);
+void BKE_vfont_free_data(struct VFont *vf);
void BKE_vfont_free(struct VFont *sc);
void BKE_vfont_free_global_ttf(void);
struct VFont *BKE_vfont_builtin_get(void);
struct VFont *BKE_vfont_load(struct Main *bmain, const char *name);
-struct TmpFont *BKE_vfont_find_tmpfont(struct VFont *vfont);
+struct TmpFont *BKE_vfont_tmpfont_find(struct VFont *vfont);
+void BKE_vfont_tmpfont_remove(struct VFont *vfont);
+
struct chartrans *BKE_vfont_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode);
int BKE_vfont_select_get(struct Object *ob, int *start, int *end);
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/depsgraph.c 2012-08-03 15:03:40 UTC (rev 49533)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/depsgraph.c 2012-08-03 15:05:20 UTC (rev 49534)
@@ -2846,6 +2846,18 @@
}
}
}
+ else if (idtype == ID_VF) {
+ /* this is weak still, should be done delayed as well */
+ for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ if (ob->type == OB_FONT) {
+ Curve *cu = ob->data;
+
+ if (ELEM4((struct VFont *)id, cu->vfont, cu->vfontb, cu->vfonti, cu->vfontbi)) {
+ ob->recalc |= (flag & OB_RECALC_ALL);
+ }
+ }
+ }
+ }
else {
/* disable because this is called on various ID types automatically.
* where printing warning is not useful. for now just ignore */
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/font.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/font.c 2012-08-03 15:03:40 UTC (rev 49533)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/font.c 2012-08-03 15:05:20 UTC (rev 49534)
@@ -63,26 +63,34 @@
static ListBase ttfdata = {NULL, NULL};
/* The vfont code */
-void BKE_vfont_free(struct VFont *vf)
+
+void BKE_vfont_free_data(struct VFont *vf)
{
- if (vf == NULL) return;
-
if (vf->data) {
while (vf->data->characters.first) {
VChar *che = vf->data->characters.first;
-
+
while (che->nurbsbase.first) {
Nurb *nu = che->nurbsbase.first;
if (nu->bezt) MEM_freeN(nu->bezt);
BLI_freelinkN(&che->nurbsbase, nu);
}
-
+
BLI_freelinkN(&vf->data->characters, che);
}
MEM_freeN(vf->data);
vf->data = NULL;
}
+
+ BKE_vfont_tmpfont_remove(vf);
+}
+
+void BKE_vfont_free(struct VFont *vf)
+{
+ if (vf == NULL) return;
+
+ BKE_vfont_free_data(vf);
if (vf->packedfile) {
freePackedFile(vf->packedfile);
@@ -115,34 +123,54 @@
}
}
+static void vfont_tmpfont_free(struct TmpFont *tf)
+{
+ if (tf->pf) {
+ freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
+ }
+ MEM_freeN(tf);
+}
+
void BKE_vfont_free_global_ttf(void)
{
- struct TmpFont *tf;
+ struct TmpFont *tf, *tf_next;
- for (tf = ttfdata.first; tf; tf = tf->next) {
- if (tf->pf) freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
- tf->pf = NULL;
- tf->vfont = NULL;
+ for (tf = ttfdata.first; tf; tf = tf_next) {
+ tf_next = tf->next;
+ vfont_tmpfont_free(tf);
}
- BLI_freelistN(&ttfdata);
+ ttfdata.first = ttfdata.last = NULL;
}
-struct TmpFont *BKE_vfont_find_tmpfont(VFont *vfont)
+struct TmpFont *BKE_vfont_tmpfont_find(VFont *vfont)
{
struct TmpFont *tmpfnt = NULL;
if (vfont == NULL) return NULL;
/* Try finding the font from font list */
- tmpfnt = ttfdata.first;
- while (tmpfnt) {
- if (tmpfnt->vfont == vfont)
+ for (tmpfnt = ttfdata.first; tmpfnt; tmpfnt = tmpfnt->next) {
+ if (tmpfnt->vfont == vfont) {
break;
- tmpfnt = tmpfnt->next;
+ }
}
+
return tmpfnt;
}
+/* assumes a VFont's tmpfont can't be in the database more then once */
+void BKE_vfont_tmpfont_remove(VFont *vfont)
+{
+ struct TmpFont *tmpfnt;
+
+ tmpfnt = BKE_vfont_tmpfont_find(vfont);
+
+ if (tmpfnt) {
+ vfont_tmpfont_free(tmpfnt);
+ BLI_remlink(&ttfdata, tmpfnt);
+ }
+}
+
static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
{
struct TmpFont *tmpfnt = NULL;
@@ -151,7 +179,7 @@
if (vfont == NULL) return NULL;
/* Try finding the font from font list */
- tmpfnt = BKE_vfont_find_tmpfont(vfont);
+ tmpfnt = BKE_vfont_tmpfont_find(vfont);
/* And then set the data */
if (!vfont->data) {
@@ -194,7 +222,11 @@
if (!pf) {
printf("Font file doesn't exist: %s\n", vfont->name);
+ /* DON'T DO THIS
+ * missing file shouldn't modifty path! - campbell */
+#if 0
strcpy(vfont->name, FO_BUILTIN_NAME);
+#endif
pf = get_builtin_packedfile();
}
}
Modified: branches/soc-2011-tomato/source/blender/blenlib/intern/freetypefont.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/intern/freetypefont.c 2012-08-03 15:03:40 UTC (rev 49533)
+++ branches/soc-2011-tomato/source/blender/blenlib/intern/freetypefont.c 2012-08-03 15:05:20 UTC (rev 49534)
@@ -296,7 +296,7 @@
struct TmpFont *tf;
/* Find the correct FreeType font */
- tf = BKE_vfont_find_tmpfont(vfont);
+ tf = BKE_vfont_tmpfont_find(vfont);
/* What, no font found. Something strange here */
if (!tf) return FALSE;
Property changes on: branches/soc-2011-tomato/source/blender/editors/interface/interface.c
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-49531
+ /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-49533
Property changes on: branches/soc-2011-tomato/source/blender/editors/space_outliner
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-49531
+ /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-49533
Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_vfont.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_vfont.c 2012-08-03 15:03:40 UTC (rev 49533)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_vfont.c 2012-08-03 15:05:20 UTC (rev 49534)
@@ -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 @@
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");
Modified: branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_files.c
===================================================================
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list