2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-01 19:02:27 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-01 19:02:27 +00:00
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup RNA
|
2011-02-27 20:20:01 +00:00
|
|
|
*/
|
|
|
|
|
2008-12-01 19:02:27 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
|
|
#include "DNA_vfont_types.h"
|
|
|
|
|
2012-08-03 15:03:40 +00:00
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
|
2008-12-01 19:02:27 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
2012-08-03 15:03:40 +00:00
|
|
|
#include "BKE_font.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
2012-08-03 15:03:40 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
|
2012-08-03 13:03:53 +00:00
|
|
|
/* matching fnction in rna_ID.c */
|
2016-09-22 00:10:53 +02:00
|
|
|
static int rna_VectorFont_filepath_editable(PointerRNA *ptr, const char **UNUSED(r_info))
|
2012-08-03 13:03:53 +00:00
|
|
|
{
|
2012-08-03 22:12:57 +00:00
|
|
|
VFont *vfont = ptr->id.data;
|
|
|
|
if (BKE_vfont_is_builtin(vfont)) {
|
2015-10-06 21:43:04 +11:00
|
|
|
return 0;
|
2012-08-03 13:03:53 +00:00
|
|
|
}
|
2015-10-06 21:43:04 +11:00
|
|
|
return PROP_EDITABLE;
|
2012-08-03 13:03:53 +00:00
|
|
|
}
|
|
|
|
|
2012-08-03 15:03:40 +00:00
|
|
|
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);
|
2018-12-06 17:52:37 +01:00
|
|
|
DEG_id_tag_update(&vf->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
|
2012-08-03 15:03:40 +00:00
|
|
|
}
|
|
|
|
|
2008-12-01 19:02:27 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
void RNA_def_vfont(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "VectorFont", "ID");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects");
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_struct_sdna(srna, "VFont");
|
2010-01-11 05:10:57 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
|
2008-12-02 23:45:11 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "name");
|
2012-08-03 13:03:53 +00:00
|
|
|
RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable");
|
2010-06-02 17:58:28 +00:00
|
|
|
RNA_def_property_ui_text(prop, "File Path", "");
|
2012-08-03 15:03:40 +00:00
|
|
|
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_VectorFont_reload_update");
|
2008-12-02 23:45:11 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
|
|
|
|
RNA_def_property_ui_text(prop, "Packed File", "");
|
2015-02-07 22:31:00 +11:00
|
|
|
|
|
|
|
RNA_api_vfont(srna);
|
2008-12-01 19:02:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|