Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need method to easily toggle between BioMorphFace when settings menu updates #260

Open
henbagle opened this issue Jun 19, 2024 · 2 comments

Comments

@henbagle
Copy link
Owner

We have several cut unique faces for NPCs that could be restored as an option in the settings menu - except the methods for updating an NPC's appearance don't work as well as the methods just updating a material.

As far as I can tell, the UpdatePawnAppearance method can be a little glitchy. the user will see the NPC pop in and out of existence when it occurs, and I've had instances of NPCs falling through the floor. Plus I don't know what would happen if the NPC was midway through a line of dialogue. Is there some way we can develop to instantly update the morph face without triggering this method?

@henbagle
Copy link
Owner Author

Vegz to the rescue! Code snippet is below.

Class SFXSeqAct_SetMorphHead extends SequenceAction;

var(SFXSeqAct_SetMorphHead) Actor Target;
var(SFXSeqAct_SetMorphHead) BioMorphFace oMorphHead;

public static event function int GetObjClassVersion()
{
    return Super(SequenceObject).GetObjClassVersion() + 1;
}
public function Activated()
{
    local BioPawn Pawn;
    local SkeletalMesh oMesh;
    
    Pawn = BioPawn(Target);
    if (Pawn != None)
    {
        ApplyMesh(oMorphHead.m_oBaseHead, Pawn.m_oHeadMesh);
        Pawn.ApplyMaterialParameters(oMorphHead.m_oMaterialOverrides);
        Pawn.ForceUpdateComponents();
    }
}
private final function ApplyMesh(SkeletalMesh SkelMesh, SkeletalMeshComponent MeshCmpt)
{
    local int I;
    local Name nmActiveEffectsMaterial;
    
    if (SkelMesh != None && MeshCmpt != None)
    {
        nmActiveEffectsMaterial = MeshCmpt.GetEffectsMaterial();
        MeshCmpt.ClearEffectsMaterial();
        MeshCmpt.SetSkeletalMesh(SkelMesh);
        for (I = 0; I < SkelMesh.Materials.Length; I++)
        {
            MeshCmpt.SetMaterial(I, None);
            MeshCmpt.CreateAndSetMaterialInstanceConstant(I);
        }
        if (nmActiveEffectsMaterial != 'None')
        {
            MeshCmpt.SetEffectsMaterial(nmActiveEffectsMaterial);
        }
    }
}

@henbagle
Copy link
Owner Author

Re-opening this as we are having multiple issues with the current Kismet object.

@henbagle henbagle reopened this Jul 13, 2024
@henbagle henbagle modified the milestones: 1.7, 2.0 Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant