missing texture graphics instead of error log spam

This commit is contained in:
c0ffee 2024-04-25 12:21:00 -07:00
parent 24ed24989f
commit 9290ea05c4
9 changed files with 24 additions and 5 deletions

View File

@ -197,6 +197,12 @@ namespace Rimworld_Animations {
PawnRenderNodeProperties props = animationProp.animPropProperties;
if (props.texPath.NullOrEmpty())
{
props.texPath = "AnimationProps/MissingTexture/MissingTexture";
}
//create new render node
PawnRenderNode animRenderNode = (PawnRenderNode)Activator.CreateInstance(props.nodeClass, new object[] {
this.pawn,

View File

@ -31,12 +31,10 @@ namespace Rimworld_Animations
{
//if node is animating, and is a graphic variant type of node
//and node is one with graphic variants
//and texpathvariant is set
if ((node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker)
//and node is one with graphic variants
&& (node is PawnRenderNode_GraphicVariants nodeWithGraphicVariants)
//and texpathvariant is set
&& extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick) != null)
{
Material materialVariant = GetMaterialVariant(nodeWithGraphicVariants, parms, (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick));

View File

@ -12,13 +12,14 @@ namespace Rimworld_Animations
{
protected new PawnRenderNodeProperties_GraphicVariants props;
protected Graphic missingTextureGraphic;
protected Dictionary<int, Graphic> variants;
public Graphic getGraphicVariant(int variant)
{
if (variants == null || !variants.ContainsKey(variant))
{
return null;
return missingTextureGraphic;
}
return variants[variant];
@ -49,6 +50,11 @@ namespace Rimworld_Animations
{
variants = GraphicVariantsFor(this.tree.pawn);
}
if (missingTextureGraphic == null)
{
missingTextureGraphic = GenerateMissingTextureGraphic();
}
base.EnsureMaterialsInitialized();
}
@ -75,5 +81,10 @@ namespace Rimworld_Animations
return variantGraphics;
}
protected Graphic GenerateMissingTextureGraphic()
{
return GraphicDatabase.Get<Graphic_Multi>("AnimationProps/MissingTexture");
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 KiB

View File

@ -197,6 +197,10 @@
<Content Include="1.5\Textures\AnimationProps\Banana\Banana_west.png" />
<Content Include="1.5\Textures\AnimationProps\Doggystyle\Doggy_Arms_north.png" />
<Content Include="1.5\Textures\AnimationProps\Doggystyle\Doggy_Legs_north.png" />
<Content Include="1.5\Textures\AnimationProps\MissingTexture\MissingTexture_east.png" />
<Content Include="1.5\Textures\AnimationProps\MissingTexture\MissingTexture_north.png" />
<Content Include="1.5\Textures\AnimationProps\MissingTexture\MissingTexture_south.png" />
<Content Include="1.5\Textures\AnimationProps\MissingTexture\MissingTexture_west.png" />
<Content Include="1.5\Textures\UI\MainTab.png" />
<Content Include="About\About.xml" />
<Content Include="About\Manifest.xml" />