Lower texture size (in a configurable way) in template tool
This commit is contained in:
parent
e6575eee3a
commit
b1c2627a2f
@ -29,6 +29,12 @@
|
|||||||
<setting name="GameDirectoryPath" serializeAs="String">
|
<setting name="GameDirectoryPath" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="MaxMapTileTextureSize" serializeAs="String">
|
||||||
|
<value>0</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="TemplateToolTextureSizeMultiplier" serializeAs="String">
|
||||||
|
<value>0.5</value>
|
||||||
|
</setting>
|
||||||
</MobiusEditor.Properties.Settings>
|
</MobiusEditor.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<runtime>
|
<runtime>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;STEAMWORKS_WIN;STEAMWORKS_X64;DEVELOPER</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;STEAMWORKS_WIN;STEAMWORKS_X64</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
<DefineConstants>TRACE;STEAMWORKS_WIN;STEAMWORKS_X64;DEVELOPER</DefineConstants>
|
<DefineConstants>TRACE;STEAMWORKS_WIN;STEAMWORKS_X64</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
|
24
CnCTDRAMapEditor/Properties/Settings.Designer.cs
generated
24
CnCTDRAMapEditor/Properties/Settings.Designer.cs
generated
@ -67,5 +67,29 @@ namespace MobiusEditor.Properties {
|
|||||||
this["GameDirectoryPath"] = value;
|
this["GameDirectoryPath"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
|
public int MaxMapTileTextureSize {
|
||||||
|
get {
|
||||||
|
return ((int)(this["MaxMapTileTextureSize"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["MaxMapTileTextureSize"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("0.5")]
|
||||||
|
public double TemplateToolTextureSizeMultiplier {
|
||||||
|
get {
|
||||||
|
return ((double)(this["TemplateToolTextureSizeMultiplier"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["TemplateToolTextureSizeMultiplier"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,5 +14,11 @@
|
|||||||
<Setting Name="GameDirectoryPath" Type="System.String" Scope="User">
|
<Setting Name="GameDirectoryPath" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)" />
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="MaxMapTileTextureSize" Type="System.Int32" Scope="User">
|
||||||
|
<Value Profile="(Default)">0</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="TemplateToolTextureSizeMultiplier" Type="System.Double" Scope="User">
|
||||||
|
<Value Profile="(Default)">0.5</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
@ -30,6 +30,9 @@ namespace MobiusEditor.Tools
|
|||||||
{
|
{
|
||||||
public class TemplateTool : ViewTool
|
public class TemplateTool : ViewTool
|
||||||
{
|
{
|
||||||
|
private const int DesignResWidth = 3840;
|
||||||
|
private const int DesignTextureWidth = 256;
|
||||||
|
|
||||||
private static readonly Regex CategoryRegex = new Regex(@"^([a-z]*)", RegexOptions.Compiled);
|
private static readonly Regex CategoryRegex = new Regex(@"^([a-z]*)", RegexOptions.Compiled);
|
||||||
|
|
||||||
private readonly ListView templateTypeListView;
|
private readonly ListView templateTypeListView;
|
||||||
@ -153,8 +156,16 @@ namespace MobiusEditor.Tools
|
|||||||
.GroupBy(t => templateCategory(t)).OrderBy(g => g.Key);
|
.GroupBy(t => templateCategory(t)).OrderBy(g => g.Key);
|
||||||
var templateTypeImages = templateTypes.SelectMany(g => g).Select(t => t.Thumbnail);
|
var templateTypeImages = templateTypes.SelectMany(g => g).Select(t => t.Thumbnail);
|
||||||
|
|
||||||
var maxWidth = templateTypeImages.Max(t => t.Width);
|
Screen screen = Screen.FromHandle(mapPanel.Handle) ?? Screen.PrimaryScreen;
|
||||||
var maxHeight = templateTypeImages.Max(t => t.Height);
|
int maxSize = Properties.Settings.Default.MaxMapTileTextureSize;
|
||||||
|
if (maxSize == 0)
|
||||||
|
{
|
||||||
|
double ratio = DesignResWidth / (double)screen.Bounds.Width;
|
||||||
|
maxSize = (int)((DesignTextureWidth / ratio) * Properties.Settings.Default.TemplateToolTextureSizeMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxWidth = Math.Min(templateTypeImages.Max(t => t.Width), maxSize);
|
||||||
|
var maxHeight = Math.Min(templateTypeImages.Max(t => t.Height), maxSize);
|
||||||
|
|
||||||
var imageList = new ImageList();
|
var imageList = new ImageList();
|
||||||
imageList.Images.AddRange(templateTypeImages.ToArray());
|
imageList.Images.AddRange(templateTypeImages.ToArray());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user