X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscene%2Fmodel%2Fpersonality.cxx;h=60b8a987cf7bfa0c2f57cb97e22d4877aa9b7983;hb=629a4a950e2e3215cab2acfacf05247d424480e4;hp=622137e81e13b1cf852e1f094926a5633e88fabc;hpb=2866d1ace9549f75d529a799088ee6df609b17d2;p=simgear.git diff --git a/simgear/scene/model/personality.cxx b/simgear/scene/model/personality.cxx index 622137e8..60b8a987 100755 --- a/simgear/scene/model/personality.cxx +++ b/simgear/scene/model/personality.cxx @@ -2,9 +2,34 @@ * $Id$ */ -#include +#ifdef HAVE_CONFIG_H +# include +#endif #include "personality.hxx" +#include "animation.hxx" + +static int +personality_pretrav_callback(ssgEntity * entity, int mask) +{ + ((SGPersonalityBranch *)entity)->_old_current = SGAnimation::current_object; + SGAnimation::current_object = (SGPersonalityBranch *)entity; + return 1; +} + +static int +personality_posttrav_callback(ssgEntity * entity, int mask) +{ + SGAnimation::current_object = ((SGPersonalityBranch *)entity)->_old_current; + ((SGPersonalityBranch *)entity)->_old_current = 0; + return 1; +} + +SGPersonalityBranch::SGPersonalityBranch() +{ + setTravCallback(SSG_CALLBACK_PRETRAV, personality_pretrav_callback); + setTravCallback(SSG_CALLBACK_POSTTRAV, personality_posttrav_callback); +} void SGPersonalityBranch::setDoubleValue( double value, SGAnimation *anim, int var_id, int var_num ) {