Skip to content

Commit

Permalink
Update TardisEditor.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBoxTrot committed Nov 12, 2022
1 parent 15f223c commit 30eab1c
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions code/TardisEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,14 @@ public static void RenderAllIcons()
Progress.Update( asset.Name, ++i, allClothes.Length );

var resource = asset.LoadResource<BaseDefinition>();
RenderIcon( asset, resource );


if ( token.IsCancellationRequested )
return;
}
}

private static void RenderIcon( Asset asset, BaseDefinition resource )
{
// force an icon path
var iconInfo = resource.Icon;

iconInfo.Path = $"/clothing_icons/{asset.Name}.png";
resource.Icon = iconInfo;

var Scene = new ClothingScene();
Scene.UpdateLighting();
Scene.InstallClothing( resource );
Scene.UpdateCameraPosition();

var pixelMap = new Pixmap( 256, 256 );
Scene.Camera.RenderToPixmap( pixelMap );

if ( asset.SaveToDisk( resource ) )
{
asset.Compile( false );
}

var root = asset.AbsolutePath[0..^(asset.RelativePath.Length)];
pixelMap.SavePng( root + iconInfo.Path );
}


class IconProperty : Widget
{
Expand Down Expand Up @@ -166,8 +143,8 @@ public ClothingScene()

public void InstallClothing( BaseDefinition clothing )
{
var created = BaseDefinition.DressSceneObject( Body, new BaseDefinition[] { clothing } );
TargetModel = created.FirstOrDefault();



if ( TargetModel == null )
{
Expand Down

0 comments on commit 30eab1c

Please sign in to comment.