mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-08-19 00:19:19 +08:00
Merge pull request #126 from Lucas7yoshi/add/world-selection-texture-save
World selection save image as
This commit is contained in:
commit
7aef6a1ec6
19
CodeWalker/World/WorldInfoForm.Designer.cs
generated
19
CodeWalker/World/WorldInfoForm.Designer.cs
generated
@ -49,6 +49,7 @@ namespace CodeWalker.World
|
||||
this.SelDrawableTexturesTreeView = new CodeWalker.WinForms.TreeViewFix();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.SaveTextureButton = new System.Windows.Forms.Button();
|
||||
this.SelTextureDimensionsLabel = new System.Windows.Forms.Label();
|
||||
this.SelTextureMipTrackBar = new System.Windows.Forms.TrackBar();
|
||||
this.SelTextureMipLabel = new System.Windows.Forms.Label();
|
||||
@ -68,6 +69,7 @@ namespace CodeWalker.World
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label25 = new System.Windows.Forms.Label();
|
||||
this.SelectionModeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SaveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||
this.SelectionTabControl.SuspendLayout();
|
||||
this.SelectionEntityTabPage.SuspendLayout();
|
||||
this.SelectionArchetypeTabPage.SuspendLayout();
|
||||
@ -313,6 +315,7 @@ namespace CodeWalker.World
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.SaveTextureButton);
|
||||
this.tabPage3.Controls.Add(this.SelTextureDimensionsLabel);
|
||||
this.tabPage3.Controls.Add(this.SelTextureMipTrackBar);
|
||||
this.tabPage3.Controls.Add(this.SelTextureMipLabel);
|
||||
@ -329,11 +332,21 @@ namespace CodeWalker.World
|
||||
this.tabPage3.Text = "Texture";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// SaveTextureButton
|
||||
//
|
||||
this.SaveTextureButton.Location = new System.Drawing.Point(346, 396);
|
||||
this.SaveTextureButton.Name = "SaveTextureButton";
|
||||
this.SaveTextureButton.Size = new System.Drawing.Size(54, 23);
|
||||
this.SaveTextureButton.TabIndex = 38;
|
||||
this.SaveTextureButton.Text = "Save...";
|
||||
this.SaveTextureButton.UseVisualStyleBackColor = true;
|
||||
this.SaveTextureButton.Click += new System.EventHandler(this.SaveTextureButton_Click);
|
||||
//
|
||||
// SelTextureDimensionsLabel
|
||||
//
|
||||
this.SelTextureDimensionsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.SelTextureDimensionsLabel.AutoSize = true;
|
||||
this.SelTextureDimensionsLabel.Location = new System.Drawing.Point(334, 400);
|
||||
this.SelTextureDimensionsLabel.Location = new System.Drawing.Point(262, 400);
|
||||
this.SelTextureDimensionsLabel.Name = "SelTextureDimensionsLabel";
|
||||
this.SelTextureDimensionsLabel.Size = new System.Drawing.Size(10, 13);
|
||||
this.SelTextureDimensionsLabel.TabIndex = 37;
|
||||
@ -348,7 +361,7 @@ namespace CodeWalker.World
|
||||
this.SelTextureMipTrackBar.Location = new System.Drawing.Point(59, 394);
|
||||
this.SelTextureMipTrackBar.Maximum = 0;
|
||||
this.SelTextureMipTrackBar.Name = "SelTextureMipTrackBar";
|
||||
this.SelTextureMipTrackBar.Size = new System.Drawing.Size(265, 31);
|
||||
this.SelTextureMipTrackBar.Size = new System.Drawing.Size(187, 31);
|
||||
this.SelTextureMipTrackBar.TabIndex = 36;
|
||||
this.SelTextureMipTrackBar.Scroll += new System.EventHandler(this.SelTextureMipTrackBar_Scroll);
|
||||
//
|
||||
@ -639,5 +652,7 @@ namespace CodeWalker.World
|
||||
private System.Windows.Forms.SplitContainer splitContainer3;
|
||||
private System.Windows.Forms.TreeView HierarchyTreeView;
|
||||
private PropertyGridFix HierarchyPropertyGrid;
|
||||
private System.Windows.Forms.Button SaveTextureButton;
|
||||
private System.Windows.Forms.SaveFileDialog SaveFileDialog;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@ -24,6 +25,7 @@ namespace CodeWalker.World
|
||||
MapSelection Selection;
|
||||
string SelectionMode = "";
|
||||
bool MouseSelectEnable = false;
|
||||
Texture currentTex; // Used by save button
|
||||
|
||||
public WorldInfoForm(WorldForm worldForm)
|
||||
{
|
||||
@ -389,6 +391,7 @@ namespace CodeWalker.World
|
||||
}
|
||||
if (tex != null)
|
||||
{
|
||||
currentTex = tex;
|
||||
int mip = 0;
|
||||
if (mipchange)
|
||||
{
|
||||
@ -423,6 +426,7 @@ namespace CodeWalker.World
|
||||
SelTextureMipTrackBar.Value = 0;
|
||||
SelTextureMipTrackBar.Maximum = 0;
|
||||
SelTextureDimensionsLabel.Text = "-";
|
||||
currentTex = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,5 +527,16 @@ namespace CodeWalker.World
|
||||
var sele = HierarchyTreeView.SelectedNode?.Tag as YmapEntityDef;
|
||||
HierarchyPropertyGrid.SelectedObject = sele;
|
||||
}
|
||||
|
||||
private void SaveTextureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (currentTex == null) return;
|
||||
string fname = currentTex.Name + ".dds";
|
||||
SaveFileDialog.FileName = fname;
|
||||
if (SaveFileDialog.ShowDialog() != DialogResult.OK) return;
|
||||
string fpath = SaveFileDialog.FileName;
|
||||
byte[] dds = DDSIO.GetDDSFile(currentTex);
|
||||
File.WriteAllBytes(fpath, dds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="SaveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
Loading…
Reference in New Issue
Block a user