2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-07-16 20:10:33 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* 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
|
2012-03-18 09:27:36 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-07-16 20:10:33 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2009-07-16 20:10:33 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2012-03-18 09:27:36 +00:00
|
|
|
*
|
2009-07-16 20:10:33 +00:00
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:20:01 +00:00
|
|
|
/** \file blender/makesrna/intern/rna_mesh_api.c
|
|
|
|
* \ingroup RNA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-07-16 20:10:33 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
#include "BLO_sys_types.h"
|
2009-07-16 20:10:33 +00:00
|
|
|
|
2012-07-08 06:00:27 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2011-02-09 02:28:11 +00:00
|
|
|
#include "BKE_mesh.h"
|
2009-10-22 23:22:05 +00:00
|
|
|
#include "ED_mesh.h"
|
2009-07-16 20:10:33 +00:00
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
#include "rna_internal.h" /* own include */
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
2012-09-22 14:07:55 +00:00
|
|
|
static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, bContext *C, struct Mesh *mesh2)
|
2010-10-27 02:22:55 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
const char *ret = BKE_mesh_cmp(mesh, mesh2, FLT_EPSILON * 60);
|
2010-10-27 02:22:55 +00:00
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
ret = "Same";
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2010-01-04 22:30:09 +00:00
|
|
|
|
2009-07-16 20:10:33 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
void RNA_api_mesh(StructRNA *srna)
|
|
|
|
{
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "transform", "ED_mesh_transform");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
2013-05-28 14:23:07 +00:00
|
|
|
func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Calculate vertex normals");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-29 13:44:30 +00:00
|
|
|
func = RNA_def_function(srna, "calc_tessface", "ED_mesh_calc_tessface");
|
|
|
|
RNA_def_function_ui_description(func, "Calculate face tessellation (supports editmode too)");
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "update", "ED_mesh_update");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges");
|
2012-03-02 16:05:54 +00:00
|
|
|
RNA_def_boolean(func, "calc_tessface", 0, "Calculate Tessellation", "Force recalculation of tessellation faces");
|
2009-07-16 20:10:33 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2010-10-27 02:22:55 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare");
|
2012-11-01 09:54:00 +00:00
|
|
|
RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to");
|
2010-10-27 02:22:55 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
/* return value */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison");
|
2010-10-27 02:22:55 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "validate", "BKE_mesh_validate");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "validate geometry, return True when the mesh has had "
|
2012-05-12 11:01:29 +00:00
|
|
|
"invalid geometry corrected/removed");
|
2011-05-08 10:29:40 +00:00
|
|
|
RNA_def_boolean(func, "verbose", 0, "Verbose", "Output information about the errors found");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_boolean(func, "result", 0, "Result", "");
|
2011-02-10 09:29:31 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2009-07-16 20:10:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|