[SOLVED] - AnimControlCollection

As @serega-kkz said i must search forum more :slight_smile:
also as @dri said;

Idk why but using temp collection solved the problem and here the final changes;

  • used temp AnimControlCollection
  • removed “.bam” extension string from animation names
void NodeBase::loadAnimToInstance(NodePath _node, const std::string _anim, int index)
{
	const string _actual_anim_name = _node.get_name() + "-" + _anim;
	const string _anim_path = "bin/neuera/characters/anims/" + _actual_anim_name + ".bam";
	NodePath animNP = Engine::loadModelToModel(_node, _anim_path);
	AnimControlCollection tmpCol;
	auto_bind(_node.node(), tmpCol);
	PT(AnimControl) animPtr = tmpCol.get_anim(0);
	anim_control_collection.store_anim(animPtr, _actual_anim_name);
	string animName = tmpCol.get_anim_name(0);
	std::cout << animName << std::endl;
	tmpCol.unbind_anim(animName);
	animNP.detach_node();
}

void NodeBase::setLoopMotion(NodePath _node, const std::string _anim)
{
	const string _actual_anim_name = _node.get_name() + "-" + _anim;
	anim_control_collection.loop(_actual_anim_name, true);
}

void NodeBase::pushOnceMotion(NodePath _node, const std::string _anim)
{
	const string _actual_anim_name = _node.get_name() + "-" + _anim;
	anim_control_collection.play(_actual_anim_name);
}

https://streamable.com/gdq1r6

1 Like