Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-09-28 20:18:22 +0400
committerTon Roosendaal <ton@blender.org>2004-09-28 20:18:22 +0400
commit5ac0d4fd26e9b670d83b8e9431707f9260c66bc6 (patch)
tree928cc78886d864577dcf3279ad7d400621797edd /source/blender/src/editdeform.c
parentfc0c3a084dd20fd350ba4fe2c9e5f4d3889839f6 (diff)
Cleaned the apply deform code in Blender. Now also using the modifier code.
Right now, it works for Meshes (all deformers including Curve) and for Curve/Surfaces (only hooks). More follows.
Diffstat (limited to 'source/blender/src/editdeform.c')
-rw-r--r--source/blender/src/editdeform.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/src/editdeform.c b/source/blender/src/editdeform.c
index dfdfdf943cb..c42ea250f6d 100644
--- a/source/blender/src/editdeform.c
+++ b/source/blender/src/editdeform.c
@@ -29,12 +29,14 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
* Creator-specific support for vertex deformation groups
+ * Added: apply deform function (ton)
*/
#include <string.h>
#include "MEM_guardedalloc.h"
+#include "DNA_curve_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
@@ -44,6 +46,7 @@
#include "BKE_global.h"
#include "BKE_deform.h"
+#include "BKE_displist.h"
#include "BKE_mesh.h"
#include "BIF_editdeform.h"
@@ -645,3 +648,33 @@ void unique_vertexgroup_name (bDeformGroup *dg, Object *ob)
}
}
}
+
+/* ******************* other deform edit stuff ********** */
+
+void object_apply_deform(Object *ob)
+{
+ char *err= NULL;
+
+ if(ob->type==OB_MESH) {
+ Mesh *me= ob->data;
+ if(me->id.us>1) {
+ err= "Can't apply deformation to Mesh with other users";
+ }
+ mesh_modifier(ob, 's'); // start
+ mesh_modifier(ob, 'a'); // apply and end
+ freedisplist(&ob->disp);
+ }
+ else if (ob->type==OB_CURVE || ob->type==OB_SURF) {
+ Curve *cu= ob->data;
+ if(cu->id.us>1) {
+ err= "Can't apply deformation to Curve with other users";
+ }
+ curve_modifier(ob, 's'); // start
+ curve_modifier(ob, 'a'); // apply and end
+ freedisplist(&ob->disp);
+ }
+
+ if(err) error(err);
+
+}
+