From 5416f51b7a0c4e1ca23592385fbd025355cedc0e Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 25 May 2010 08:42:11 +0000 Subject: BGE Fix for: [#22142] Armature deformation does not work in Game Engine. + parent type to modifiers doversion(). Patch by Xavier Thomas (xat) This fix the problem of not being able to play animations created with Blender 2.5 in BGE. Patch reviewed by Benoit Added also other parent to modifier conversions as requested by Joshua (aligorith). I didn't bump subversion here, but the patch should work still. If not I'm increasing subversion sooner anyways (tomorrow or by the middle of the week I hope). I was waiting to commit this one together with the Logic Editor datablock patch (converting material_name DNA properties to struct Material *). However my patch is getting too big and it's better if it's alone (easier to analyze later, eventual fixes, ...) Mitchell, this commit adds a function that can help hardware skinning - HasArmatureDeformer() --- source/blender/blenloader/intern/readfile.c | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 8dbf2682bb6..b23be6917ac 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10848,8 +10848,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + /* put 2.50 compatibility code here until next subversion bump */ { + Object *ob; bScreen *sc; for (sc= main->screen.first; sc; sc= sc->id.next) { @@ -10871,6 +10873,38 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } do_version_mdef_250(fd, lib, main); + + /* parent type to modifier */ + for(ob = main->object.first; ob; ob = ob->id.next) { + if(ob->parent) { + Object *parent= newlibadr(fd, lib, ob->parent); + if(parent->type==OB_ARMATURE && ob->partype==PARSKEL) { + ArmatureModifierData *amd; + + amd = (ArmatureModifierData*) modifier_new(eModifierType_Armature); + amd->object = ob->parent; + BLI_addtail((ListBase*)&ob->modifiers, amd); + amd->deformflag= ((bArmature *)(parent->data))->deformflag; + ob->partype = PAROBJECT; + } + else if(parent->type==OB_LATTICE && ob->partype==PARSKEL) { + LatticeModifierData *lmd; + + lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice); + lmd->object = ob->parent; + BLI_addtail((ListBase*)&ob->modifiers, lmd); + ob->partype = PAROBJECT; + } + else if(parent->type==OB_CURVE && ob->partype==PARCURVE) { + CurveModifierData *cmd; + + cmd = (CurveModifierData*) modifier_new(eModifierType_Curve); + cmd->object = ob->parent; + BLI_addtail((ListBase*)&ob->modifiers, cmd); + ob->partype = PAROBJECT; + } + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ -- cgit v1.2.3