patch for NALS facial animation using rendersubworker

This commit is contained in:
c0ffee 2024-05-03 19:47:25 -07:00
parent 6d174dbce4
commit d36c2b8314
5 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Verse;
namespace Rimworld_Animations
{
public class PawnRenderSubWorker_HideWhenAnimating : PawnRenderSubWorker
{
/* hides the entire head node don't use unless you want to do that
public override bool CanDrawNowSub(PawnRenderNode node, PawnDrawParms parms)
{
if (node.tree.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended
|| node.tree.rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended))
{
return false;
}
return base.CanDrawNowSub(node, parms);
}
*/
public override void EditMaterial(PawnRenderNode node, PawnDrawParms parms, ref Material material)
{
if (node.tree.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended
|| node.tree.rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended))
{
material.color = Color.clear;
}
}
}
}

View File

@ -29,6 +29,7 @@
<li>1.5</li>
<li IfModActive="erdelf.HumanoidAlienRaces">Patch_HumanoidAlienRaces/1.5</li>
<li IfModActive="c0ffee.SexToysMasturbation">Patch_SexToysMasturbation/1.5</li>
<li IfModActive="Nals.FacialAnimation">Patch_FacialAnimation/1.5</li>
</v1.5>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<!-- hide node when animating -->
<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationConditional">
<xpath>/Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"]/subworkerClasses</xpath>
<success>Always</success>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"]</xpath>
<value>
<subworkerClasses />
</value>
</nomatch>
</li>
<li Class="PatchOperationAdd">
<xpath>/Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"]/subworkerClasses</xpath>
<value>
<li>Rimworld_Animations.PawnRenderSubWorker_HideWhenAnimating</li>
</value>
</li>
</operations>
</Operation>
</Patch>

View File

@ -134,6 +134,7 @@
<Compile Include="1.5\Source\PawnRenderNode\TexPathVariants.cs" />
<Compile Include="1.5\Source\RenderSubWorkers\PawnRenderSubWorker_ChangeOffset.cs" />
<Compile Include="1.5\Source\Patches\RJWPatches\RJWAnimationSettings.cs" />
<Compile Include="1.5\Source\RenderSubWorkers\PawnRenderSubWorker_HideWhenAnimating.cs" />
<Compile Include="1.5\Source\Utilities\AnimationUtility.cs" />
<Compile Include="1.5\Source\Voices\VoiceDef.cs" />
<Compile Include="1.5\Source\Voices\VoiceDefOf.cs" />
@ -320,6 +321,7 @@
<Content Include="Languages\PortugueseBrazilian\DefInjected\Rimworld_Animations.AnimationDef\Animations_Multi.xml" />
<Content Include="Languages\PortugueseBrazilian\DefInjected\Rimworld_Animations.AnimationDef\Animations_vanilla.xml" />
<Content Include="LoadFolders.xml" />
<Content Include="Patch_FacialAnimation\1.5\Patches\AnimationPatch_HideHeadWhenAnimating.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="1.5\Source\Extensions\" />