diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-05-25 12:42:11 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-05-25 12:42:11 +0400 |
commit | 5416f51b7a0c4e1ca23592385fbd025355cedc0e (patch) | |
tree | 36bb3048c539582e935faa0ccf041bd1adc8a126 /source/blender | |
parent | e26cc71bd0a4976c8adf8f6586a71de7ce1003d4 (diff) |
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()
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 34 |
1 files changed, 34 insertions, 0 deletions
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! */ |