Skip to content

Commit

Permalink
Кнопка включения и отключения текстур вьюпорта
Browse files Browse the repository at this point in the history
  • Loading branch information
VaIeroK committed Oct 9, 2022
1 parent ac1479e commit a917574
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 60 deletions.
23 changes: 16 additions & 7 deletions OGF tool/Forms/OgfEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 20 additions & 3 deletions OGF tool/Forms/OgfEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public partial class OGF_Editor : Form
public bool ViewerWorking = false;
public Thread ViewerThread = null;
bool ViewPortAlpha = true;
bool ViewPortTextures = true;
List<bool> OldChildVisible = new List<bool>();
List<string> OldChildTextures = new List<string>();

Expand Down Expand Up @@ -891,7 +892,7 @@ private void SaveAsObj(string filename, float lod)
}
}

private void SaveMtl(string filename)
private void SaveMtl(string filename, bool with_texture = true)
{
using (StreamWriter writer = File.CreateText(filename))
{
Expand All @@ -903,7 +904,8 @@ private void SaveMtl(string filename)
writer.WriteLine("Ka 0 0 0");
writer.WriteLine("Kd 1 1 1");
writer.WriteLine("Ks 0 0 0");
writer.WriteLine("map_Kd " + Path.GetFileName(ch.m_texture) + ".png\n");
if (with_texture)
writer.WriteLine("map_Kd " + Path.GetFileName(ch.m_texture) + ".png\n");
}
writer.Close();
}
Expand Down Expand Up @@ -2389,7 +2391,22 @@ private void disableAlphaToolStripMenuItem_Click(object sender, EventArgs e)
InitViewPort(false, true, true);
}

private void SetAlphaToolStrip(bool enable)
private void DisableTexturesMenuItem_Click(object sender, EventArgs e)
{
ViewPortTextures = !ViewPortTextures;

string mtl_name = TempFolder() + "\\" + Path.GetFileName(Path.ChangeExtension(FILE_NAME, ".mtl"));
SaveMtl(mtl_name, ViewPortTextures);

if (!ViewPortTextures)
DisableTexturesMenuItem.Text = "Enable Textures";
else
DisableTexturesMenuItem.Text = "Disable Textures";

InitViewPort(false, false, true);
}

private void SetAlphaToolStrip(bool enable)
{
ViewPortAlpha = enable;
if (ViewPortAlpha)
Expand Down
112 changes: 62 additions & 50 deletions OGF tool/Forms/OgfEditor.resx
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,13 @@
<value>0</value>
</data>
<data name="AddMeshesMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
<value>169, 22</value>
</data>
<data name="AddMeshesMenuItem.Text" xml:space="preserve">
<value>Add meshes</value>
</data>
<data name="LodMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
<value>169, 22</value>
</data>
<data name="LodMenuItem.Text" xml:space="preserve">
<value>Change lod factor</value>
Expand Down Expand Up @@ -2151,30 +2151,6 @@
<data name="FileMenuItem.Text" xml:space="preserve">
<value>File</value>
</data>
<data name="OpenInObjectEditor.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 22</value>
</data>
<data name="OpenInObjectEditor.Text" xml:space="preserve">
<value>Open in Object Editor</value>
</data>
<data name="importDataFromModelToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 22</value>
</data>
<data name="importDataFromModelToolStripMenuItem.Text" xml:space="preserve">
<value>Import OGF Params</value>
</data>
<data name="recalcNormalsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 22</value>
</data>
<data name="recalcNormalsToolStripMenuItem.Text" xml:space="preserve">
<value>Recalc Normals</value>
</data>
<data name="converterToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 22</value>
</data>
<data name="converterToolStripMenuItem.Text" xml:space="preserve">
<value>Converter</value>
</data>
<data name="ToolsMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>46, 20</value>
</data>
Expand All @@ -2199,6 +2175,30 @@
<data name="CurrentFormat.Text" xml:space="preserve">
<value>Model Format: None</value>
</data>
<data name="reloadToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="reloadToolStripMenuItem1.Text" xml:space="preserve">
<value>Reload</value>
</data>
<data name="DisableTexturesMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="DisableTexturesMenuItem.Text" xml:space="preserve">
<value>Disable Textures</value>
</data>
<data name="disableAlphaToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="disableAlphaToolStripMenuItem.Text" xml:space="preserve">
<value>Disable Alpha</value>
</data>
<data name="openImageFolderToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="openImageFolderToolStripMenuItem.Text" xml:space="preserve">
<value>Open image folder</value>
</data>
<data name="viewPortToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>66, 20</value>
</data>
Expand Down Expand Up @@ -2313,6 +2313,30 @@
<data name="exitToolStripMenuItem.Text" xml:space="preserve">
<value>Exit</value>
</data>
<data name="OpenInObjectEditor.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 22</value>
</data>
<data name="OpenInObjectEditor.Text" xml:space="preserve">
<value>Open in Object Editor</value>
</data>
<data name="importDataFromModelToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 22</value>
</data>
<data name="importDataFromModelToolStripMenuItem.Text" xml:space="preserve">
<value>Import OGF Params</value>
</data>
<data name="recalcNormalsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 22</value>
</data>
<data name="recalcNormalsToolStripMenuItem.Text" xml:space="preserve">
<value>Recalc Normals</value>
</data>
<data name="converterToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 22</value>
</data>
<data name="converterToolStripMenuItem.Text" xml:space="preserve">
<value>Converter</value>
</data>
<data name="nPCCoPToSoCToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>161, 22</value>
</data>
Expand All @@ -2325,24 +2349,6 @@
<data name="nPCSoCToCoPToolStripMenuItem.Text" xml:space="preserve">
<value>NPC SoC to CoP</value>
</data>
<data name="reloadToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>173, 22</value>
</data>
<data name="reloadToolStripMenuItem1.Text" xml:space="preserve">
<value>Reload</value>
</data>
<data name="disableAlphaToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>173, 22</value>
</data>
<data name="disableAlphaToolStripMenuItem.Text" xml:space="preserve">
<value>Disable Alpha</value>
</data>
<data name="openImageFolderToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>173, 22</value>
</data>
<data name="openImageFolderToolStripMenuItem.Text" xml:space="preserve">
<value>Open image folder</value>
</data>
<data name="FileLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>28, 17</value>
</data>
Expand Down Expand Up @@ -2942,6 +2948,12 @@
<data name="&gt;&gt;importDataFromModelToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;recalcNormalsToolStripMenuItem.Name" xml:space="preserve">
<value>recalcNormalsToolStripMenuItem</value>
</data>
<data name="&gt;&gt;recalcNormalsToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;converterToolStripMenuItem.Name" xml:space="preserve">
<value>converterToolStripMenuItem</value>
</data>
Expand Down Expand Up @@ -3002,6 +3014,12 @@
<data name="&gt;&gt;openImageFolderToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;DisableTexturesMenuItem.Name" xml:space="preserve">
<value>DisableTexturesMenuItem</value>
</data>
<data name="&gt;&gt;DisableTexturesMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;FileLabel.Name" xml:space="preserve">
<value>FileLabel</value>
</data>
Expand Down Expand Up @@ -3068,12 +3086,6 @@
<data name="&gt;&gt;SaveObjDialog.Type" xml:space="preserve">
<value>System.Windows.Forms.SaveFileDialog, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;recalcNormalsToolStripMenuItem.Name" xml:space="preserve">
<value>recalcNormalsToolStripMenuItem</value>
</data>
<data name="&gt;&gt;recalcNormalsToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>OGF_Editor</value>
</data>
Expand Down

0 comments on commit a917574

Please sign in to comment.