[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20097] branches/ge_dev/source/blender: Implement stub for iTaSC plugin.
Benoit Bolsee
benoit.bolsee at online.be
Thu May 7 18:37:54 CEST 2009
Revision: 20097
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20097
Author: ben2610
Date: 2009-05-07 18:37:29 +0200 (Thu, 07 May 2009)
Log Message:
-----------
Implement stub for iTaSC plugin. Add ikdata field in bArmature to store IK solver temporary data. Add BIK_remove_armature() to plugin interface to clean IK solver data when removing armature and changing of solver in UI. Handle file read/write.
Modified Paths:
--------------
branches/ge_dev/source/blender/blenkernel/intern/armature.c
branches/ge_dev/source/blender/blenloader/intern/readfile.c
branches/ge_dev/source/blender/ikplugin/BIK_api.h
branches/ge_dev/source/blender/ikplugin/CMakeLists.txt
branches/ge_dev/source/blender/ikplugin/SConscript
branches/ge_dev/source/blender/ikplugin/intern/Makefile
branches/ge_dev/source/blender/ikplugin/intern/ikplugin_api.c
branches/ge_dev/source/blender/ikplugin/intern/ikplugin_api.h
branches/ge_dev/source/blender/makesdna/DNA_armature_types.h
branches/ge_dev/source/blender/src/buttons_object.c
Added Paths:
-----------
branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.cpp
branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.h
Modified: branches/ge_dev/source/blender/blenkernel/intern/armature.c
===================================================================
--- branches/ge_dev/source/blender/blenkernel/intern/armature.c 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/blenkernel/intern/armature.c 2009-05-07 16:37:29 UTC (rev 20097)
@@ -133,6 +133,7 @@
if (arm) {
/* unlink_armature(arm);*/
free_bones(arm);
+ BIK_remove_armature(arm);
}
}
@@ -206,6 +207,8 @@
copy_bonechildren (newBone, oldBone);
newBone=newBone->next;
};
+ // this is temporary data, no need to copy
+ newArm->ikdata = NULL;
return newArm;
}
Modified: branches/ge_dev/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/ge_dev/source/blender/blenloader/intern/readfile.c 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/blenloader/intern/readfile.c 2009-05-07 16:37:29 UTC (rev 20097)
@@ -1924,6 +1924,7 @@
if(arm->id.flag & LIB_NEEDLINK) {
arm->id.flag -= LIB_NEEDLINK;
}
+ arm->ikdata = NULL;
arm= arm->id.next;
}
}
Modified: branches/ge_dev/source/blender/ikplugin/BIK_api.h
===================================================================
--- branches/ge_dev/source/blender/ikplugin/BIK_api.h 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/ikplugin/BIK_api.h 2009-05-07 16:37:29 UTC (rev 20097)
@@ -36,14 +36,18 @@
struct Object;
struct bPoseChannel;
+struct bArmature;
void BIK_initialize_tree(struct Object *ob, float ctime);
void BIK_execute_tree(struct Object *ob, struct bPoseChannel *pchan, float ctime);
void BIK_release_tree(struct Object *ob, float ctime);
+void BIK_remove_armature(struct bArmature *arm);
+// number of solver available
+// 0 = iksolver
+// 1 = iTaSC
+#define BIK_SOLVER_COUNT 2
-#define BIK_SOLVER_COUNT 1
-
#ifdef __cplusplus
}
#endif
Modified: branches/ge_dev/source/blender/ikplugin/CMakeLists.txt
===================================================================
--- branches/ge_dev/source/blender/ikplugin/CMakeLists.txt 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/ikplugin/CMakeLists.txt 2009-05-07 16:37:29 UTC (rev 20097)
@@ -24,7 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC intern/*.c)
+FILE(GLOB SRC intern/*.c intern/*.cpp)
SET(INC
../../../intern/guardedalloc ../../../intern/iksolver/extern
Modified: branches/ge_dev/source/blender/ikplugin/SConscript
===================================================================
--- branches/ge_dev/source/blender/ikplugin/SConscript 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/ikplugin/SConscript 2009-05-07 16:37:29 UTC (rev 20097)
@@ -1,7 +1,7 @@
#!/usr/bin/python
Import ('env')
-sources = env.Glob('intern/*.c')
+sources = env.Glob('intern/*.c') + env.Glob('intern/*.cpp')
incs = '#/intern/guardedalloc #/intern/iksolver/extern ../makesdna ../blenlib'
incs += ' ../blenkernel ../include ../ikplugin'
Modified: branches/ge_dev/source/blender/ikplugin/intern/Makefile
===================================================================
--- branches/ge_dev/source/blender/ikplugin/intern/Makefile 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/ikplugin/intern/Makefile 2009-05-07 16:37:29 UTC (rev 20097)
@@ -31,6 +31,13 @@
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
+CFLAGS += -I$(NAN_GUARDEDALLOC)/include
+CFLAGS += -I$(NAN_IKSOLVER)/include
+CFLAGS += -I../../makesdna
+CFLAGS += -I../../blenkernel
+CFLAGS += -I../../blenlib
+CFLAGS += -I../../include
+CFLAGS += -I..
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
CPPFLAGS += -I$(NAN_IKSOLVER)/include
Modified: branches/ge_dev/source/blender/ikplugin/intern/ikplugin_api.c
===================================================================
--- branches/ge_dev/source/blender/ikplugin/intern/ikplugin_api.c 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/ikplugin/intern/ikplugin_api.c 2009-05-07 16:37:29 UTC (rev 20097)
@@ -42,6 +42,7 @@
#include "ikplugin_api.h"
#include "iksolver_plugin.h"
+#include "itasc_plugin.h"
static IKPlugin ikplugin_tab[BIK_SOLVER_COUNT] = {
@@ -49,7 +50,15 @@
{
iksolver_initialize_tree,
iksolver_execute_tree,
+ NULL,
NULL
+ },
+ /* iTaSC IK solver */
+ {
+ itasc_initialize_tree,
+ itasc_execute_tree,
+ itasc_release_tree,
+ itasc_remove_armature
}
};
@@ -98,3 +107,15 @@
if (plugin->release_tree_func)
plugin->release_tree_func(ob, ctime);
}
+
+void BIK_remove_armature(struct bArmature *arm)
+{
+ IKPlugin *plugin;
+
+ if (arm->iksolver < 0 || arm->iksolver >= BIK_SOLVER_COUNT)
+ return;
+
+ plugin = &ikplugin_tab[arm->iksolver];
+ if (plugin->remove_armature_func)
+ plugin->remove_armature_func(arm);
+}
Modified: branches/ge_dev/source/blender/ikplugin/intern/ikplugin_api.h
===================================================================
--- branches/ge_dev/source/blender/ikplugin/intern/ikplugin_api.h 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/ikplugin/intern/ikplugin_api.h 2009-05-07 16:37:29 UTC (rev 20097)
@@ -36,11 +36,14 @@
struct Object;
struct bPoseChannel;
+struct bArmature;
+
struct IKPlugin {
void (*initialize_tree_func)(struct Object *ob, float ctime);
void (*execute_tree_func)(struct Object *ob, struct bPoseChannel *pchan, float ctime);
void (*release_tree_func)(struct Object *ob, float ctime);
+ void (*remove_armature_func)(struct bArmature *arm);
};
typedef struct IKPlugin IKPlugin;
Added: branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.cpp
===================================================================
--- branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.cpp (rev 0)
+++ branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.cpp 2009-05-07 16:37:29 UTC (rev 20097)
@@ -0,0 +1,47 @@
+/**
+ * $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) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Original author: Benoit Bolsee
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "itasc_plugin.h"
+
+void itasc_initialize_tree(struct Object *ob, float ctime)
+{
+}
+
+void itasc_execute_tree(struct Object *ob, struct bPoseChannel *pchan, float ctime)
+{
+}
+
+void itasc_release_tree(struct Object *ob, float ctime)
+{
+}
+
+void itasc_remove_armature(struct bArmature *arm)
+{
+}
+
Property changes on: branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.cpp
___________________________________________________________________
Name: svn:keywords
+ Id Author Date Revision
Name: svn:eol-style
+ native
Added: branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.h
===================================================================
--- branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.h (rev 0)
+++ branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.h 2009-05-07 16:37:29 UTC (rev 20097)
@@ -0,0 +1,49 @@
+/**
+ * $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) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Original author: Benoit Bolsee
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef ITASC_PLUGIN_H
+#define ITASC_PLUGIN_H
+
+#include "ikplugin_api.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void itasc_initialize_tree(struct Object *ob, float ctime);
+void itasc_execute_tree(struct Object *ob, struct bPoseChannel *pchan, float ctime);
+void itasc_release_tree(struct Object *ob, float ctime);
+void itasc_remove_armature(struct bArmature *arm);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ITASC_PLUGIN_H
+
Property changes on: branches/ge_dev/source/blender/ikplugin/intern/itasc_plugin.h
___________________________________________________________________
Name: svn:keywords
+ Id Author Date Revision
Name: svn:eol-style
+ native
Modified: branches/ge_dev/source/blender/makesdna/DNA_armature_types.h
===================================================================
--- branches/ge_dev/source/blender/makesdna/DNA_armature_types.h 2009-05-07 14:53:40 UTC (rev 20096)
+++ branches/ge_dev/source/blender/makesdna/DNA_armature_types.h 2009-05-07 16:37:29 UTC (rev 20097)
@@ -83,6 +83,7 @@
int pathbc, pathac; /* number of frames before/after current frame of path-calculation for all bones */
int iksolver; /* ik solver to use */
int pad;
+ void *ikdata; /* depends on the IK solver */
} bArmature;
/* armature->flag */
Modified: branches/ge_dev/source/blender/src/buttons_object.c
===================================================================
--- branches/ge_dev/source/blender/src/buttons_object.c 2009-05-07 14:53:40 UTC (rev 20096)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list