mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-25 22:10:22 +00:00
Update placeholder textures and fill channel types by format
This commit is contained in:
parent
4e1c4a5266
commit
216d772dbb
13 changed files with 101 additions and 25 deletions
|
@ -40,8 +40,6 @@ namespace Bfres.Structs
|
|||
((FMAA)fmaa).MaterialAnim.Export(FileName, fmaa.GetResFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private void Clear(object sender, EventArgs args)
|
||||
{
|
||||
|
|
|
@ -480,9 +480,9 @@ namespace FirstPlugin
|
|||
if (TextureName == "Basic_MRA")
|
||||
ImportPlaceholderTexture(Properties.Resources.Black, TextureName);
|
||||
if (TextureName == "Basic_Bake_st0")
|
||||
ImportPlaceholderTexture(Properties.Resources.White, TextureName);
|
||||
ImportPlaceholderTexture(Properties.Resources.Basic_Bake_st0, TextureName);
|
||||
if (TextureName == "Basic_Bake_st1")
|
||||
ImportPlaceholderTexture(Properties.Resources.White, TextureName);
|
||||
ImportPlaceholderTexture(Properties.Resources.Basic_Bake_st1, TextureName);
|
||||
}
|
||||
public TextureImporterSettings LoadSettings(string name)
|
||||
{
|
||||
|
@ -724,16 +724,17 @@ namespace FirstPlugin
|
|||
int target = 0;
|
||||
if (TargetString == "NX ")
|
||||
target = 1;
|
||||
|
||||
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
BNTXEditor BNTXEditor = new BNTXEditor();
|
||||
BNTXEditor.Text = Text;
|
||||
BNTXEditor.Dock = DockStyle.Fill;
|
||||
BNTXEditor.LoadProperty(this);
|
||||
LibraryGUI.Instance.LoadDockContent(BNTXEditor, PluginRuntime.FSHPDockState);
|
||||
if (LibraryGUI.Instance.dockContent != null && !EditorIsActive(LibraryGUI.Instance.dockContent))
|
||||
{
|
||||
BNTXEditor BNTXEditor = new BNTXEditor();
|
||||
BNTXEditor.Text = Text;
|
||||
BNTXEditor.Dock = DockStyle.Fill;
|
||||
BNTXEditor.LoadProperty(this);
|
||||
LibraryGUI.Instance.LoadDockContent(BNTXEditor, PluginRuntime.FSHPDockState);
|
||||
}
|
||||
}
|
||||
public bool EditorIsActive(DockContent dock)
|
||||
{
|
||||
|
@ -1322,6 +1323,35 @@ namespace FirstPlugin
|
|||
{
|
||||
return ColorComponentSelector(image, Texture.ChannelRed, Texture.ChannelGreen, Texture.ChannelBlue, Texture.ChannelAlpha);
|
||||
}
|
||||
public static ChannelType[] SetChannelsByFormat(SurfaceFormat Format)
|
||||
{
|
||||
ChannelType[] channels = new ChannelType[4];
|
||||
|
||||
switch (Format)
|
||||
{
|
||||
case SurfaceFormat.BC5_UNORM:
|
||||
case SurfaceFormat.BC5_SNORM:
|
||||
channels[0] = ChannelType.Red;
|
||||
channels[1] = ChannelType.Green;
|
||||
channels[2] = ChannelType.Zero;
|
||||
channels[3] = ChannelType.One;
|
||||
break;
|
||||
case SurfaceFormat.BC4_SNORM:
|
||||
case SurfaceFormat.BC4_UNORM:
|
||||
channels[0] = ChannelType.Red;
|
||||
channels[1] = ChannelType.Red;
|
||||
channels[2] = ChannelType.Red;
|
||||
channels[3] = ChannelType.Red;
|
||||
break;
|
||||
default:
|
||||
channels[0] = ChannelType.Red;
|
||||
channels[1] = ChannelType.Green;
|
||||
channels[2] = ChannelType.Blue;
|
||||
channels[3] = ChannelType.Alpha;
|
||||
break;
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
public static Bitmap ColorComponentSelector(Bitmap image, ChannelType R, ChannelType G, ChannelType B, ChannelType A)
|
||||
{
|
||||
BitmapExtension.ColorSwapFilter color = new BitmapExtension.ColorSwapFilter();
|
||||
|
|
|
@ -274,16 +274,17 @@ namespace FirstPlugin
|
|||
|
||||
if (settings.MipCount == 0)
|
||||
settings.MipCount = 1;
|
||||
|
||||
|
||||
ChannelType[] channels = TextureData.SetChannelsByFormat(settings.Format);
|
||||
tex.ChannelRed = channels[0];
|
||||
tex.ChannelGreen = channels[1];
|
||||
tex.ChannelBlue = channels[2];
|
||||
tex.ChannelAlpha = channels[3];
|
||||
tex.sparseBinding = settings.sparseBinding;
|
||||
tex.sparseResidency = settings.sparseResidency;
|
||||
tex.AccessFlags = settings.AccessFlags;
|
||||
tex.ArrayLength = settings.arrayLength;
|
||||
tex.MipCount = settings.MipCount;
|
||||
tex.ChannelRed = settings.RedComp;
|
||||
tex.ChannelGreen = settings.GreenComp;
|
||||
tex.ChannelBlue = settings.BlueComp;
|
||||
tex.ChannelAlpha = settings.AlphaComp;
|
||||
tex.Depth = settings.Depth;
|
||||
tex.Dim = settings.Dim;
|
||||
tex.Flags = settings.Flags;
|
||||
|
|
|
@ -70,6 +70,26 @@ namespace FirstPlugin.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] Basic_Bake_st0 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Basic_Bake_st0", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] Basic_Bake_st1 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Basic_Bake_st1", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
|
|
|
@ -139,4 +139,10 @@
|
|||
<data name="White" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\White.dds;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Basic_Bake_st0" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Basic_Bake_st0.dds;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Basic_Bake_st1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Basic_Bake_st1.dds;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
BIN
Switch_FileFormatsMain/Resources/BakedBasic.zip
Normal file
BIN
Switch_FileFormatsMain/Resources/BakedBasic.zip
Normal file
Binary file not shown.
BIN
Switch_FileFormatsMain/Resources/Basic_Bake_st0.dds
Normal file
BIN
Switch_FileFormatsMain/Resources/Basic_Bake_st0.dds
Normal file
Binary file not shown.
BIN
Switch_FileFormatsMain/Resources/Basic_Bake_st1.dds
Normal file
BIN
Switch_FileFormatsMain/Resources/Basic_Bake_st1.dds
Normal file
Binary file not shown.
|
@ -505,6 +505,12 @@
|
|||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Basic_Bake_st0.dds" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Basic_Bake_st1.dds" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Fody.3.2.9\build\Fody.targets" Condition="Exists('..\packages\Fody.3.2.9\build\Fody.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -289,6 +289,8 @@ namespace Switch_Toolbox
|
|||
}
|
||||
if (format.UseEditMenu)
|
||||
editToolStripMenuItem.Enabled = true;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
//If magic fails, then check extensions
|
||||
|
@ -317,6 +319,8 @@ namespace Switch_Toolbox
|
|||
}
|
||||
if (format.UseEditMenu)
|
||||
editToolStripMenuItem.Enabled = true;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,26 +19,36 @@ namespace Switch_Toolbox.Library
|
|||
public static LibraryGUI Instance { get { return _instance == null ? _instance = new LibraryGUI() : _instance; } }
|
||||
|
||||
public DockPanel dockPanel;
|
||||
public DockContent dockContent;
|
||||
|
||||
public void LoadDockContent(Control control, DockState dockState)
|
||||
{
|
||||
DockContent content = new DockContent();
|
||||
content.Controls.Add(control);
|
||||
content.Show(dockPanel, dockState);
|
||||
dockContent = new DockContent();
|
||||
dockContent.Controls.Add(control);
|
||||
dockContent.Show(dockPanel, dockState);
|
||||
}
|
||||
public bool IsContentDocked(Control control)
|
||||
public UserControl GetContentDocked(UserControl control)
|
||||
{
|
||||
foreach (DockContent dockContent in dockPanel.Contents)
|
||||
{
|
||||
foreach (Control ctrl in dockContent.Controls)
|
||||
if (ctrl == control)
|
||||
return true;
|
||||
if (ctrl.GetType() == control.GetType())
|
||||
return (UserControl)ctrl;
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
public DockContent GetContentDocked(DockContent DockContent)
|
||||
{
|
||||
foreach (DockContent dock in dockPanel.Contents)
|
||||
if (dock.GetType() == DockContent.GetType())
|
||||
return dock;
|
||||
|
||||
return null;
|
||||
}
|
||||
public void LoadDockContent(DockContent DockContent, DockState dockState)
|
||||
{
|
||||
DockContent.Show(dockPanel, dockState);
|
||||
dockContent = DockContent;
|
||||
dockContent.Show(dockPanel, dockState);
|
||||
}
|
||||
public void LoadViewport(Viewport viewport)
|
||||
{
|
||||
|
@ -47,8 +57,9 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
viewport.Show(dockPanel, DockState.Document);
|
||||
}
|
||||
public bool IsContentActive(DockContent dockContent)
|
||||
public bool IsContentActive(DockContent DockContent)
|
||||
{
|
||||
dockContent = DockContent;
|
||||
return dockPanel.Contents.Contains(dockContent);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue