2009-06-18 19:48:55 +00:00
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* ***** 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
|
|
|
|
* 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,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
|
|
|
#include "RNA_types.h"
|
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
#include "BLO_sys_types.h"
|
RNA
* Mesh.add_geometry, Mesh.update and make indices editable. This
is without checking if they are valid still, no time now to
implement this.
* Also fix warnings in rna_ui.c, and a bug in CDDM_calc_edges.
Example code:
co = [0.0, 0.0, 0.0] + [1.0, 0.0, 0.0] + [0.0, 1.0, 0.0] + [1.0, 1.0, 0.0]
faces = [0, 1, 2, 0] + [1, 3, 2, 0]
mesh.add_geometry(4, 0, 2)
mesh.verts.foreach_set("co", co)
mesh.faces.foreach_set("verts", faces)
mesh.update()
2009-07-01 12:19:00 +00:00
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
#include "ED_mesh.h"
|
2009-06-28 13:29:03 +00:00
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
2009-07-02 20:46:35 +00:00
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
static void rna_Mesh_uv_texture_add(struct Mesh *me, struct bContext *C)
|
2009-08-05 12:01:42 +00:00
|
|
|
{
|
2009-09-28 14:28:45 +00:00
|
|
|
ED_mesh_uv_texture_add(C, NULL, NULL, me);
|
2009-08-05 12:01:42 +00:00
|
|
|
}
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
void RNA_api_mesh(StructRNA *srna)
|
|
|
|
{
|
RNA
* Mesh.add_geometry, Mesh.update and make indices editable. This
is without checking if they are valid still, no time now to
implement this.
* Also fix warnings in rna_ui.c, and a bug in CDDM_calc_edges.
Example code:
co = [0.0, 0.0, 0.0] + [1.0, 0.0, 0.0] + [0.0, 1.0, 0.0] + [1.0, 1.0, 0.0]
faces = [0, 1, 2, 0] + [1, 3, 2, 0]
mesh.add_geometry(4, 0, 2)
mesh.verts.foreach_set("co", co)
mesh.faces.foreach_set("verts", faces)
mesh.update()
2009-07-01 12:19:00 +00:00
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
func= RNA_def_function(srna, "transform", "ED_mesh_transform");
|
2009-06-23 17:52:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix.");
|
2009-09-22 16:35:07 +00:00
|
|
|
parm= RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix.", 0.0f, 0.0f);
|
2009-06-23 17:52:58 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
func= RNA_def_function(srna, "add_geometry", "ED_mesh_geometry_add");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
RNA
* Mesh.add_geometry, Mesh.update and make indices editable. This
is without checking if they are valid still, no time now to
implement this.
* Also fix warnings in rna_ui.c, and a bug in CDDM_calc_edges.
Example code:
co = [0.0, 0.0, 0.0] + [1.0, 0.0, 0.0] + [0.0, 1.0, 0.0] + [1.0, 1.0, 0.0]
faces = [0, 1, 2, 0] + [1, 3, 2, 0]
mesh.add_geometry(4, 0, 2)
mesh.verts.foreach_set("co", co)
mesh.faces.foreach_set("verts", faces)
mesh.update()
2009-07-01 12:19:00 +00:00
|
|
|
parm= RNA_def_int(func, "verts", 0, 0, INT_MAX, "Number", "Number of vertices to add.", 0, INT_MAX);
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
parm= RNA_def_int(func, "edges", 0, 0, INT_MAX, "Number", "Number of edges to add.", 0, INT_MAX);
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
parm= RNA_def_int(func, "faces", 0, 0, INT_MAX, "Number", "Number of faces to add.", 0, INT_MAX);
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
func= RNA_def_function(srna, "add_uv_texture", "rna_Mesh_uv_texture_add");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2009-08-13 11:14:06 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
|
2009-07-01 18:23:11 +00:00
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
func= RNA_def_function(srna, "calc_normals", "ED_mesh_calc_normals");
|
2009-07-02 20:46:35 +00:00
|
|
|
RNA_def_function_ui_description(func, "Calculate vertex normals.");
|
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
func= RNA_def_function(srna, "update", "ED_mesh_update");
|
2009-10-12 19:34:58 +00:00
|
|
|
RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges.");
|
RNA
* Mesh.add_geometry, Mesh.update and make indices editable. This
is without checking if they are valid still, no time now to
implement this.
* Also fix warnings in rna_ui.c, and a bug in CDDM_calc_edges.
Example code:
co = [0.0, 0.0, 0.0] + [1.0, 0.0, 0.0] + [0.0, 1.0, 0.0] + [1.0, 1.0, 0.0]
faces = [0, 1, 2, 0] + [1, 3, 2, 0]
mesh.add_geometry(4, 0, 2)
mesh.verts.foreach_set("co", co)
mesh.faces.foreach_set("verts", faces)
mesh.update()
2009-07-01 12:19:00 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2009-08-05 12:01:42 +00:00
|
|
|
|
2009-09-28 14:28:45 +00:00
|
|
|
func= RNA_def_function(srna, "add_material", "ED_mesh_material_add");
|
2009-08-05 12:01:42 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add a new material to Mesh.");
|
|
|
|
parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2009-06-18 19:48:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|