[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21729] branches/itasc: iTaSC: support armature constraint in GE part 1.
Benoit Bolsee
benoit.bolsee at online.be
Mon Jul 20 20:47:13 CEST 2009
Revision: 21729
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21729
Author: ben2610
Date: 2009-07-20 20:47:13 +0200 (Mon, 20 Jul 2009)
Log Message:
-----------
iTaSC: support armature constraint in GE part 1. Move pose function used by GE to BL_Armature.cpp to allow mixing with GE data.
Modified Paths:
--------------
branches/itasc/projectfiles_vc9/gameengine/converter/KX_converter.vcproj
branches/itasc/source/blender/blenkernel/BKE_action.h
branches/itasc/source/blender/blenkernel/intern/action.c
branches/itasc/source/blender/blenlib/BLI_ghash.h
branches/itasc/source/gameengine/Converter/BL_ActionActuator.cpp
branches/itasc/source/gameengine/Converter/BL_ArmatureObject.cpp
branches/itasc/source/gameengine/Converter/BL_ArmatureObject.h
branches/itasc/source/gameengine/Converter/CMakeLists.txt
branches/itasc/source/gameengine/Converter/Makefile
branches/itasc/source/gameengine/Converter/SConscript
Modified: branches/itasc/projectfiles_vc9/gameengine/converter/KX_converter.vcproj
===================================================================
--- branches/itasc/projectfiles_vc9/gameengine/converter/KX_converter.vcproj 2009-07-20 17:59:45 UTC (rev 21728)
+++ branches/itasc/projectfiles_vc9/gameengine/converter/KX_converter.vcproj 2009-07-20 18:47:13 UTC (rev 21729)
@@ -4,6 +4,7 @@
Version="9,00"
Name="KX_converter"
ProjectGUID="{F90BD995-FFA4-4B18-81E8-FA4322C939E8}"
+ RootNamespace="KX_converter"
TargetFrameworkVersion="131072"
>
<Platforms>
@@ -193,7 +194,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.6;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\makesrna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu;..\..\..\source\blender\windowmanager"
+ AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\build\msvc_9\extern\bullet\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\build\msvc_9\extern\solid\include;..\..\..\..\lib\windows\python\include\python2.6;..\..\..\source\blender;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\makesrna;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Ketsji;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\ode;..\..\..\source\gameengine\SceneGraph;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\BlenderRoutines;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\source\gameengine\rasterizer\ras_openglrasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\gameengine\soundsystem\snd_blenderwavecache;..\..\..\source\sumo\include;..\..\..\source\sumo\Fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\gpu;..\..\..\source\blender\windowmanager;..\..\..\source\blender\ikplugin"
PreprocessorDefinitions="WIN32,_LIB,_DEBUG"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -480,6 +481,10 @@
>
</File>
<File
+ RelativePath="..\..\..\source\gameengine\Converter\BL_ArmatureObject.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\source\gameengine\Converter\BL_BlenderDataConversion.cpp"
>
</File>
@@ -553,10 +558,6 @@
>
</File>
<File
- RelativePath="..\..\..\source\gameengine\Converter\BL_ArmatureObject.cpp"
- >
- </File>
- <File
RelativePath="..\..\..\source\gameengine\Converter\BL_ArmatureObject.h"
>
</File>
Modified: branches/itasc/source/blender/blenkernel/BKE_action.h
===================================================================
--- branches/itasc/source/blender/blenkernel/BKE_action.h 2009-07-20 17:59:45 UTC (rev 21728)
+++ branches/itasc/source/blender/blenkernel/BKE_action.h 2009-07-20 18:47:13 UTC (rev 21729)
@@ -149,19 +149,11 @@
/* Used for the Action Constraint */
void what_does_obaction(struct Scene *scene, struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], float cframe);
-/* exported for game engine */
-void game_blend_poses(struct bPose *dst, struct bPose *src, float srcweight/*, short mode*/); /* was blend_poses */
-void extract_pose_from_pose(struct bPose *pose, const struct bPose *src);
-
/* for proxy */
void copy_pose_result(struct bPose *to, struct bPose *from);
/* clear all transforms */
void rest_pose(struct bPose *pose);
-/* functions used by the game engine */
-void game_copy_pose(struct bPose **dst, struct bPose *src);
-void game_free_pose(struct bPose *pose);
-
#ifdef __cplusplus
};
#endif
Modified: branches/itasc/source/blender/blenkernel/intern/action.c
===================================================================
--- branches/itasc/source/blender/blenkernel/intern/action.c 2009-07-20 17:59:45 UTC (rev 21728)
+++ branches/itasc/source/blender/blenkernel/intern/action.c 2009-07-20 18:47:13 UTC (rev 21729)
@@ -588,161 +588,6 @@
}
}
-void game_copy_pose(bPose **dst, bPose *src)
-{
- bPose *out;
- bPoseChannel *pchan, *outpchan;
- GHash *ghash;
-
- /* the game engine copies the current armature pose and then swaps
- * the object pose pointer. this makes it possible to change poses
- * without affecting the original blender data. */
-
- if (!src) {
- *dst=NULL;
- return;
- }
- else if (*dst==src) {
- printf("copy_pose source and target are the same\n");
- *dst=NULL;
- return;
- }
-
- out= MEM_dupallocN(src);
- out->agroups.first= out->agroups.last= NULL;
- out->ikdata = NULL;
- out->ikparam = MEM_dupallocN(out->ikparam);
- out->flag |= POSE_GAME_ENGINE;
- BLI_duplicatelist(&out->chanbase, &src->chanbase);
-
- /* remap pointers */
- ghash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
-
- pchan= src->chanbase.first;
- outpchan= out->chanbase.first;
- for (; pchan; pchan=pchan->next, outpchan=outpchan->next)
- BLI_ghash_insert(ghash, pchan, outpchan);
-
- for (pchan=out->chanbase.first; pchan; pchan=pchan->next) {
- pchan->parent= BLI_ghash_lookup(ghash, pchan->parent);
- pchan->child= BLI_ghash_lookup(ghash, pchan->child);
- pchan->path= NULL;
- }
-
- BLI_ghash_free(ghash, NULL, NULL);
-
- *dst=out;
-}
-
-
-/* Only allowed for Poses with identical channels */
-void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/)
-{
- short mode= ACTSTRIPMODE_BLEND;
-
- bPoseChannel *dchan;
- const bPoseChannel *schan;
- bConstraint *dcon, *scon;
- float dstweight;
- int i;
-
- switch (mode){
- case ACTSTRIPMODE_BLEND:
- dstweight = 1.0F - srcweight;
- break;
- case ACTSTRIPMODE_ADD:
- dstweight = 1.0F;
- break;
- default :
- dstweight = 1.0F;
- }
-
- schan= src->chanbase.first;
- for (dchan = dst->chanbase.first; dchan; dchan=dchan->next, schan= schan->next){
- if (schan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE)) {
- /* replaced quat->matrix->quat conversion with decent quaternion interpol (ton) */
-
- /* Do the transformation blend */
- if (schan->flag & POSE_ROT) {
- /* quat interpolation done separate */
- if (schan->rotmode == PCHAN_ROT_QUAT) {
- float dquat[4], squat[4];
-
- QUATCOPY(dquat, dchan->quat);
- QUATCOPY(squat, schan->quat);
- if (mode==ACTSTRIPMODE_BLEND)
- QuatInterpol(dchan->quat, dquat, squat, srcweight);
- else {
- QuatMulFac(squat, srcweight);
- QuatMul(dchan->quat, dquat, squat);
- }
-
- NormalQuat(dchan->quat);
- }
- }
-
- for (i=0; i<3; i++) {
- /* blending for loc and scale are pretty self-explanatory... */
- if (schan->flag & POSE_LOC)
- dchan->loc[i] = (dchan->loc[i]*dstweight) + (schan->loc[i]*srcweight);
- if (schan->flag & POSE_SIZE)
- dchan->size[i] = 1.0f + ((dchan->size[i]-1.0f)*dstweight) + ((schan->size[i]-1.0f)*srcweight);
-
- /* euler-rotation interpolation done here instead... */
- // FIXME: are these results decent?
- if ((schan->flag & POSE_ROT) && (schan->rotmode))
- dchan->eul[i] = (dchan->eul[i]*dstweight) + (schan->eul[i]*srcweight);
- }
- dchan->flag |= schan->flag;
- }
- for(dcon= dchan->constraints.first, scon= schan->constraints.first; dcon && scon; dcon= dcon->next, scon= scon->next) {
- /* no 'add' option for constraint blending */
- dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight;
- }
- }
-
- /* this pose is now in src time */
- dst->ctime= src->ctime;
-}
-
-void game_free_pose(bPose *pose)
-{
- if (pose) {
- /* we don't free constraints, those are owned by the original pose */
- if(pose->chanbase.first)
- BLI_freelistN(&pose->chanbase);
-
- /* free IK solver state */
- BIK_clear_data(pose);
-
- /* free IK solver param */
- if (pose->ikparam)
- MEM_freeN(pose->ikparam);
-
- MEM_freeN(pose);
- }
-}
-
-static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan)
-{
- bConstraint *pcon, *con;
-
- VECCOPY(pchan->loc, chan->loc);
- VECCOPY(pchan->size, chan->size);
- VECCOPY(pchan->eul, chan->eul);
- QUATCOPY(pchan->quat, chan->quat);
- pchan->rotmode= chan->rotmode;
- Mat4CpyMat4(pchan->chan_mat, (float(*)[4])chan->chan_mat);
- Mat4CpyMat4(pchan->pose_mat, (float(*)[4])chan->pose_mat);
- pchan->flag= chan->flag;
-
- con= chan->constraints.first;
- for(pcon= pchan->constraints.first; pcon; pcon= pcon->next, con= con->next) {
- pcon->enforce= con->enforce;
- pcon->headtail= con->headtail;
- }
-}
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list