Add an EditorTilesetFilter trait for filtering the actor palette based on tileset.
This commit is contained in:
@@ -155,6 +155,13 @@ namespace OpenRA.Editor
|
||||
{
|
||||
var info = Rules.Info[a];
|
||||
if (!info.Traits.Contains<RenderSimpleInfo>()) continue;
|
||||
|
||||
var etf = info.Traits.GetOrDefault<EditorTilesetFilterInfo>();
|
||||
if (etf != null && etf.ExcludeTilesets != null
|
||||
&& etf.ExcludeTilesets.Contains(tileset.Id)) continue;
|
||||
if (etf != null && etf.RequireTilesets != null
|
||||
&& !etf.RequireTilesets.Contains(tileset.Id)) continue;
|
||||
|
||||
var template = RenderUtils.RenderActor(info, tileset, palette);
|
||||
var ibox = new PictureBox
|
||||
{
|
||||
|
||||
@@ -184,6 +184,7 @@
|
||||
<Compile Include="Download.cs" />
|
||||
<Compile Include="ActorMap.cs" />
|
||||
<Compile Include="Graphics\AnimationWithOffset.cs" />
|
||||
<Compile Include="Traits\EditorTilesetFilter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
20
OpenRA.Game/Traits/EditorTilesetFilter.cs
Normal file
20
OpenRA.Game/Traits/EditorTilesetFilter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
public class EditorTilesetFilterInfo : TraitInfo<EditorTilesetFilter>
|
||||
{
|
||||
public readonly string[] RequireTilesets = null;
|
||||
public readonly string[] ExcludeTilesets = null;
|
||||
}
|
||||
|
||||
public class EditorTilesetFilter { }
|
||||
}
|
||||
Reference in New Issue
Block a user