void ReplaceHeadPart(Actor * thisActor, BGSHeadPart * oldPart, BGSHeadPart * newPart)
	{
		BSTaskPool * taskPool = BSTaskPool::GetSingleton();
		if(!taskPool || !thisActor || !newPart)
			return;

		TESNPC* npc = DYNAMIC_CAST(thisActor->baseForm, TESForm, TESNPC);
		if(npc) {
			if(!oldPart) {
				oldPart = npc->GetCurrentHeadPartByType(newPart->type);
			}
			if(newPart->type != BGSHeadPart::kTypeMisc && oldPart && oldPart->type == newPart->type) {
				taskPool->ChangeHeadPart(thisActor, oldPart, newPart);
			}
		}
	}
	void ChangeHeadPart(Actor * thisActor, BGSHeadPart * newPart)
	{
		BSTaskPool * taskPool = BSTaskPool::GetSingleton();
		if(!taskPool || !thisActor || !newPart)
			return;

		TESNPC* npc = DYNAMIC_CAST(thisActor->baseForm, TESForm, TESNPC);
		if(npc) {
			if(newPart->type != BGSHeadPart::kTypeMisc) {
				BGSHeadPart * oldPart = npc->GetCurrentHeadPartByType(newPart->type);

				// Alters the ActorBase's HeadPart list
				CALL_MEMBER_FN(npc, ChangeHeadPart)(newPart);

				// Alters the loaded mesh
				taskPool->ChangeHeadPart(thisActor, oldPart, newPart);
			}
		}
	}
Ejemplo n.º 3
0
NiTriBasedGeom * GetHeadTriBasedGeom(Actor * actor, UInt32 partType)
{
	BSFaceGenNiNode * faceNode = actor->GetFaceGenNiNode();
	TESNPC * actorBase = DYNAMIC_CAST(actor->baseForm, TESForm, TESNPC);

	if(faceNode && actorBase) {
		BGSHeadPart * facePart = actorBase->GetCurrentHeadPartByType(partType);
		if(facePart) {
			NiAVObject * headNode = faceNode->GetObjectByName(&facePart->partName.data);
			if(headNode) {
				NiTriBasedGeom * geometry = headNode->GetAsNiTriBasedGeom();
				if(geometry)
					return geometry;
			}
		}
	}

	return NULL;
}