diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-17 15:13:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-17 16:04:36 +0400 |
commit | f5076d54cb3a95ab583cddb7de07ed746d2e2be6 (patch) | |
tree | 421505d1a20dcb53fd8bfeb97e67e9a97a30566a /source/blender/makesrna/intern | |
parent | db795b66fa865ad99bc52fb3c9b053b9bb332f9b (diff) |
'Transform' Python Function for armature, curve and lattice.
patch by Paolo Acampora with some edits.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve_api.c | 63 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_lattice.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_lattice_api.c | 63 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh_api.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_meta_api.c | 7 |
10 files changed, 163 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 9b2fc2c3c4d..a4deee5a2c3 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -103,8 +103,10 @@ set(APISRC rna_armature_api.c rna_camera_api.c rna_controller_api.c + rna_curve_api.c rna_fcurve_api.c rna_image_api.c + rna_lattice_api.c rna_main_api.c rna_material_api.c rna_mesh_api.c diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 8070ef1d814..6a25b97f4cd 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3244,7 +3244,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_constraint.c", NULL, RNA_def_constraint}, {"rna_context.c", NULL, RNA_def_context}, {"rna_controller.c", "rna_controller_api.c", RNA_def_controller}, - {"rna_curve.c", NULL, RNA_def_curve}, + {"rna_curve.c", "rna_curve_api.c", RNA_def_curve}, {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, {"rna_fluidsim.c", NULL, RNA_def_fluidsim}, @@ -3253,7 +3253,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_image.c", "rna_image_api.c", RNA_def_image}, {"rna_key.c", NULL, RNA_def_key}, {"rna_lamp.c", NULL, RNA_def_lamp}, - {"rna_lattice.c", NULL, RNA_def_lattice}, + {"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice}, {"rna_linestyle.c", NULL, RNA_def_linestyle}, {"rna_main.c", "rna_main_api.c", RNA_def_main}, {"rna_material.c", "rna_material_api.c", RNA_def_material}, diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 4b9f7ea32f6..9d4e7a1da04 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -469,6 +469,11 @@ static int rna_Armature_is_editmode_get(PointerRNA *ptr) return (arm->edbo != NULL); } +void rna_Armature_transform(struct bArmature *arm, float *mat) +{ + ED_armature_transform(arm, (float (*)[4])mat); +} + #else static void rna_def_bone_common(StructRNA *srna, int editbone) @@ -877,6 +882,7 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop) static void rna_def_armature(BlenderRNA *brna) { StructRNA *srna; + FunctionRNA *func; PropertyRNA *prop; static EnumPropertyItem prop_drawtype_items[] = { @@ -911,7 +917,12 @@ static void rna_def_armature(BlenderRNA *brna) "Armature datablock containing a hierarchy of bones, usually used for rigging characters"); RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA); RNA_def_struct_sdna(srna, "bArmature"); - + + func = RNA_def_function(srna, "transform", "rna_Armature_transform"); + RNA_def_function_ui_description(func, "Transform armature bones by a matrix"); + prop = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); + RNA_def_property_flag(prop, PROP_REQUIRED); + /* Animation Data */ rna_def_animdata_common(srna); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 74fe3c145f1..da5b6676cb9 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1292,8 +1292,7 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Curve", "Curve datablock storing curves, splines and NURBS"); RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA); RNA_def_struct_refine_func(srna, "rna_Curve_refine"); - - rna_def_animdata_common(srna); + prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "key"); @@ -1513,6 +1512,10 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Curve_is_editmode_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode"); + + rna_def_animdata_common(srna); + + RNA_api_curve(srna); } static void rna_def_curve_nurb(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c new file mode 100644 index 00000000000..b689242f68f --- /dev/null +++ b/source/blender/makesrna/intern/rna_curve_api.c @@ -0,0 +1,63 @@ +/* + * ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2009 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_curve_api.c + * \ingroup RNA + */ + + +#include <stdlib.h> +#include <stdio.h> + +#include "RNA_define.h" + +#include "BLI_sys_types.h" + +#include "BLI_utildefines.h" + +#include "ED_curve.h" + +#include "rna_internal.h" /* own include */ + +#ifdef RNA_RUNTIME +void rna_Curve_transform(Curve *cu, float *mat) +{ + ED_curve_transform(cu, (float (*)[4])mat); +} +#else + +void RNA_api_curve(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func = RNA_def_function(srna, "transform", "rna_Curve_transform"); + RNA_def_function_ui_description(func, "Transform curve by a matrix"); + parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 807fad41373..0ba30d438e9 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -256,8 +256,10 @@ void RNA_api_action(StructRNA *srna); void RNA_api_armature_edit_bone(StructRNA *srna); void RNA_api_bone(StructRNA *srna); void RNA_api_camera(StructRNA *srna); +void RNA_api_curve(StructRNA *srna); void RNA_api_drivers(StructRNA *srna); void RNA_api_image(struct StructRNA *srna); +void RNA_api_lattice(struct StructRNA *srna); void RNA_api_operator(struct StructRNA *srna); void RNA_api_macro(struct StructRNA *srna); void RNA_api_keyconfig(struct StructRNA *srna); diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 3bb00716302..2580cd9cff8 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -50,6 +50,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_lattice.h" static void rna_LatticePoint_co_get(PointerRNA *ptr, float *values) { @@ -362,6 +363,8 @@ static void rna_def_lattice(BlenderRNA *brna) /* pointers */ rna_def_animdata_common(srna); + + RNA_api_lattice(srna); } void RNA_def_lattice(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_lattice_api.c b/source/blender/makesrna/intern/rna_lattice_api.c new file mode 100644 index 00000000000..acb71b29ea8 --- /dev/null +++ b/source/blender/makesrna/intern/rna_lattice_api.c @@ -0,0 +1,63 @@ +/* + * ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2009 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_lattice_api.c + * \ingroup RNA + */ + + +#include <stdlib.h> +#include <stdio.h> + +#include "RNA_define.h" + +#include "BLI_sys_types.h" + +#include "BLI_utildefines.h" + +#include "ED_lattice.h" + +#include "rna_internal.h" /* own include */ + +#ifdef RNA_RUNTIME +void rna_Lattice_transform(Lattice *lt, float *mat) +{ + ED_lattice_transform(lt, (float (*)[4])mat); +} +#else + +void RNA_api_lattice(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func = RNA_def_function(srna, "transform", "rna_Lattice_transform"); + RNA_def_function_ui_description(func, "Transform lattice by a matrix"); + parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index fe4226839d0..34f21046a92 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -111,6 +111,11 @@ static void rna_Mesh_calc_smooth_groups(Mesh *mesh, int use_bitflags, int *r_pol r_group_total, use_bitflags); } +static void rna_Mesh_transform(Mesh *mesh, float *mat) +{ + ED_mesh_transform(mesh, (float (*)[4])mat); +} + #else void RNA_api_mesh(StructRNA *srna) @@ -118,7 +123,7 @@ void RNA_api_mesh(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - func = RNA_def_function(srna, "transform", "ED_mesh_transform"); + func = RNA_def_function(srna, "transform", "rna_Mesh_transform"); RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix"); parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); RNA_def_property_flag(parm, PROP_REQUIRED); diff --git a/source/blender/makesrna/intern/rna_meta_api.c b/source/blender/makesrna/intern/rna_meta_api.c index abf3de02aa0..7fe59bc5be6 100644 --- a/source/blender/makesrna/intern/rna_meta_api.c +++ b/source/blender/makesrna/intern/rna_meta_api.c @@ -43,7 +43,10 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -/* none */ +void rna_Meta_transform(struct MetaBall *mb, float *mat) +{ + ED_mball_transform(mb, (float (*)[4])mat); +} #else void RNA_api_meta(StructRNA *srna) @@ -51,7 +54,7 @@ void RNA_api_meta(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - func = RNA_def_function(srna, "transform", "ED_mball_transform"); + func = RNA_def_function(srna, "transform", "rna_Meta_transform"); RNA_def_function_ui_description(func, "Transform meta elements by a matrix"); parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); RNA_def_property_flag(parm, PROP_REQUIRED); |