From d00d82d45122eb982074392880fffe4da91c4eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BA=E3=82=93=E3=81=90=E3=81=84=E3=82=93?= Date: Mon, 26 Apr 2021 19:19:04 +0900 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=85=B7=E5=90=88=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- J3D_BCK_Editor/File_Edit/BCK.cs | 259 +++++------------- J3D_BCK_Editor/File_Edit/BCK_System.cs | 114 ++------ .../File_Edit/Calculation_System.cs | 53 +--- J3D_BCK_Editor/File_Edit/Plot.cs | 189 ++++--------- J3D_BCK_Editor/Form1.Designer.cs | 146 +++++----- J3D_BCK_Editor/Form1.cs | 101 ++----- 6 files changed, 235 insertions(+), 627 deletions(-) diff --git a/J3D_BCK_Editor/File_Edit/BCK.cs b/J3D_BCK_Editor/File_Edit/BCK.cs index 6ae8609..8cbb042 100644 --- a/J3D_BCK_Editor/File_Edit/BCK.cs +++ b/J3D_BCK_Editor/File_Edit/BCK.cs @@ -6,7 +6,6 @@ using System.IO; using System.Windows.Forms; using System.Globalization; -using System.Collections.Generic; using EN = System.Environment; using CS = J3D_BCK_Editor.File_Edit.Calculation_System; @@ -26,12 +25,10 @@ class BCK_State public static PictureBox pic1 = Form1.Form1Instance.pictureBox1; public static ComboBox com1 = Form1.Form1Instance.comboBox1; public static ToolStripStatusLabel tssl2 = Form1.Form1Instance.toolStripStatusLabel2; - public static List Anim_scale_str = new List(); public static List Anim_rotation_str = new List(); //▽宣言 - protected byte[] BinaryRead; //▽J3Dヘッダー protected static string Magic_1; @@ -41,13 +38,6 @@ class BCK_State protected static string Subversion; protected static string padding; - //public string Magic_1 - //{ - // set { magic_1 = value; } - // get { return magic_1; } - //} - - //▽ANK1ヘッダー protected static string Chunk_Type; protected static int Anim_Size; @@ -63,37 +53,25 @@ class BCK_State protected static int Rotation_Table_Offset; protected static int Translation_Table_Offset; protected static string Padding_Data_1; - - protected static int padnum; - protected static int padcount; - protected static string[] debugstr = { "_animtable_","__" }; protected static int debugnum = 0; - - protected static string Frame_Num_String, Start_Frame_String, Tangent_String; protected static int Frame_Num_Int, Start_Frame_Int, Tangent_Int; - protected static List> Plot_List_Rot_Combo = new List>(); - - //protected static List Plot_List_AnimNum = new List(); - - //protected static List Plot_List_AnimData = new List(); - protected static int[] rotList_Num, rotList_Start, rotList_Tangent; } class BCK:BCK_State { /// - /// BCKを読み込む - /// Filecheck(対象のファイルのパス) + /// BCKファイルを読み込む
+ /// Reader(対象のファイルのパス) ///
/// /// なし - public void Reader(string filepath) + public void Reader(string filepath) { - //初期化 + //初期化 dgv1.Rows.Clear(); dgv2.Rows.Clear(); dgv3.Rows.Clear(); @@ -101,17 +79,20 @@ public void Reader(string filepath) debugnum = 0; //★処理開始 - //★バイナリ読み込み + + //★バイナリ読み込み FileStream fs = new FileStream(filepath, FileMode.Open); BinaryReader br = new BinaryReader(fs); - //★J3Dヘッダー + + //★J3Dヘッダー Magic_1 = CS.Byte2Char(br); Magic_2 = CS.Byte2Char(br); File_Size = CS.Byte2Int(br); Chunk_Count = CS.Byte2Int(br); Subversion = CS.Byte2Char(br); padding = CS.Byte2Char(br,12); - //★ANK1ヘッダー + + //★ANK1ヘッダー Chunk_Type = CS.Byte2Char(br); Anim_Size = CS.Byte2Int(br); Roop_Mode = CS.Byte2Int(br,1); @@ -126,6 +107,7 @@ public void Reader(string filepath) Rotation_Table_Offset = CS.Byte2Int(br); Translation_Table_Offset = CS.Byte2Int(br); Padding_Data_1 = CS.Byte2Char(br,28); + //★値をテキストボックスに Txt_Roop_Mode.Text = Roop_Mode.ToString(); Txt_Bone_Num.Text = Bone_Num.ToString(); @@ -133,15 +115,15 @@ public void Reader(string filepath) Txt_Total_Frame.Text = Frame_Num.ToString(); - //★デバッガー - //j3d + //☆デバッガー + //☆j3d debug.AppendText ( "マジック1:"+ Magic_1); debug.AppendText("\r\n" + "マジック2:" + Magic_2); debug.AppendText("\r\n" + "ファイルサイズ:" + File_Size); debug.AppendText("\r\n" + "チャンクカウント:" + Chunk_Count); debug.AppendText("\r\n" + "サブバージョン:" + Subversion); debug.AppendText("\r\n" + "パディング:" + padding); - //ank1 + //☆ank1 debug.AppendText("\r\n" + "チャンクタイプ:" + Chunk_Type); debug.AppendText("\r\n" + "アニメーションサイズ:" + Anim_Size); debug.AppendText("\r\n" + "ループモード:" + Roop_Mode); @@ -157,166 +139,64 @@ public void Reader(string filepath) debug.AppendText("\r\n" + "トランスレートテーブルオフセット:" + Translation_Table_Offset); debug.AppendText("\r\n" + "paddingdata:" + Padding_Data_1); - //BCKクラスインスタンス作成 + //★BCKクラスインスタンス作成 BCK_System bcksys = new BCK_System(); - bcksys.protecttest(); - //アニメーショングリッドに書き込み - bcksys.Animation_Table_File_Reader(br); - padnum = (Bone_Num * 9 * 6); - padcount = 0; + //★アニメーショングリッドに書き込み + bcksys.Animation_Table_File_Reader(br); - //★パディング2 - bcksys.Padding(br); + //★パディング2 + bcksys.Padding(br,fs.Position); - //★scaletable + //★スケールテーブルグリッドに書き込み for (int l = 0;l m; m=m+3) - //{ - // rotfnc = dgv1.Rows[m].Cells["Frame_Num"].Value.ToString(); - // rotsfc = dgv1.Rows[m].Cells["Start_Frame"].Value.ToString(); - // rottanc = dgv1.Rows[m].Cells["Tangent_Mode"].Value.ToString(); - // rotfnn = Convert.ToInt32(rotfnc); - // rotsfn = Convert.ToInt32(rotsfc); - // rottann = Convert.ToInt32(rottanc); - // Console.WriteLine(rotfnc+"★"+rotsfc+"★"+rottanc+"チェッカー"); - - // if (rottanc == "0" && rotfnc == "1") - // { - // Console.WriteLine("if01"); - // dgv3float = Convert.ToSingle(dgv3.Rows[rotsfn].Cells["Rotation_Value"].Value.ToString()); - // dgv3float = dgv3float / 182; - // dgv3.Rows[rotsfn].Cells["Rotation_Value"].Value = dgv3float; - // } - // else if (rottanc == "0" && (rotsfn >0) && (rotfnn > 1)) - // { - // Console.WriteLine("if02"); - // Console.WriteLine(rotfnn + "★" + rotsfn + "★" + rottann + "チェッカー"); - - // for (int i = (rotsfn+1 ); (rotsfn+1 ) + (rotfnn*3) > i; i = i +3) - // { - // Console.WriteLine("if02"); - // Console.WriteLine(i+"num"); - // Console.WriteLine(rottanc + "\(^o^)/オワタ" + rotsfn + "\(^o^)/オワタ" + rotfnn+"★"+ dgv3.Rows[i].Cells["Rotation_Value"].Value.ToString()); - // dgv3float = Convert.ToSingle(dgv3.Rows[i].Cells["Rotation_Value"].Value.ToString()); - // dgv3float = dgv3float / 182; - // dgv3.Rows[i].Cells["Rotation_Value"].Value = Convert.ToSingle( dgv3float); - // dgv3.Rows[i].Cells["Rot_Element"].Value = "値_Sym"; - // } - - // } - // else if (rottanc == "1" && rotfnc != "1") - // { - // for (int j = (rotsfn + 1); (rotsfn + 1) + (rotfnn * 4) > j; j = j + 4) - // { - // Console.WriteLine(rotsfn + "\(^o^)/" + rotfnn); - // dgv3float = Convert.ToSingle(dgv3.Rows[j].Cells["Rotation_Value"].Value.ToString()); - // dgv3float = dgv3float / 182; - // dgv3.Rows[j].Cells["Rotation_Value"].Value = dgv3float; - // dgv3.Rows[j].Cells["Rot_Element"].Value = "値_Tan"; - - // } - // } - // else { Console.WriteLine(rottanc + "/(^o^)\ナンテコッタイ" + rotsfn + "\(^o^)/オワタ" + rotfnn); } - - //} - - //if (rottanc == "0" && rotfnc == "1") - //{ - - //} - - - - Console.WriteLine(padnum); - padnum = padnum + padcount+ Scale_Table_Count*4; - padcount = 0; - //★パディング4 - debug.AppendText("\r\n"); - Console.WriteLine(padnum + ((Rotation_Table_Count) * 2) + "mmmmm"); - for (int k = padnum + ((Rotation_Table_Count) * 2); (k % 32f) != 0; k++) - { - debug.AppendText(CS.Byte2Char(br, 1)); - padcount++; - } + //★パディング4 + bcksys.Padding(br,fs.Position); - //★transtable + //★トランスレートテーブルグリッドに書き込み for (int l = 0; l < Translation_Table_Count; l++) { dgv4.Rows.Add(l, string.Format("{0:f}", CS.Byte2Float(br))); - padcount = padcount + 4; - } - - - //bcksys.Mode_Checker(Bone_Num, 2, true); - - padnum = padnum + padcount; - padcount = 0; - debug.AppendText("\r\n"); - Console.WriteLine(padnum + ((Rotation_Table_Count) * 2) + "mmmmm"); - for (int k = padnum + ((Rotation_Table_Count) * 2); (k % 32f) != 0; k++) - { - debug.AppendText(CS.Byte2Char(br, 1)); - padcount++; } + //★パディング5 + bcksys.Padding(br, fs.Position); + + //★ファイルストリーム、バイナリリード終了 fs.Close(); br.Close(); + + //ステータスバー設定 + tssl2.Text = Path.GetFileName(filepath) + "を開きました"; } - public void Create() - { - - } + + /// + /// BCKファイルにエディタのデータを書き込む
+ /// Write(対象のファイルのパス) + ///
+ /// なし public void Write(string filepath) { FileStream fs = new FileStream(filepath, FileMode.Create); BinaryWriter bw = new BinaryWriter(fs); - //J3Dヘッダー + + //J3Dヘッダー書き込み bw.Write(Encoding.ASCII.GetBytes("J3D1")); bw.Write(Encoding.ASCII.GetBytes("bck1")); bw.Write(CS.StringToBytes((0).ToString("X8")));//チャンクサイズ @@ -325,61 +205,61 @@ public void Write(string filepath) bw.Write(BitConverter.GetBytes(0xFFFFFFFF)); bw.Write(BitConverter.GetBytes(0xFFFFFFFF)); bw.Write(BitConverter.GetBytes(0xFFFFFFFF)); - //チャンクヘッダー + + //チャンクヘッダー位置を保存 int Ank1_pos = Convert.ToInt32(fs.Position); + + //ANK1ヘッダー書き込み bw.Write(Encoding.ASCII.GetBytes("ANK1")); - bw.Write(BitConverter.GetBytes(0x00000000)); bw.Write(CS.StringToByte(Txt_Roop_Mode.Text));//roopmode bw.Write(CS.StringToByte(Txt_Rot_Frac.Text));//rotfrac bw.Write(CS.StringToShort_byte(Txt_Total_Frame.Text));//フレーム数 bw.Write(CS.StringToShort_byte(Txt_Bone_Num.Text));//ボーン数 - bw.Write(CS.StringToShort_byte((dgv2.Rows.Count-1).ToString()));//sca count - bw.Write(CS.StringToShort_byte((dgv3.Rows.Count-1).ToString()));//rot count - bw.Write(CS.StringToShort_byte((dgv4.Rows.Count - 1).ToString()));//tra count + bw.Write(CS.StringToShort_byte((dgv2.Rows.Count).ToString()));//sca count + bw.Write(CS.StringToShort_byte((dgv3.Rows.Count).ToString()));//rot count + bw.Write(CS.StringToShort_byte((dgv4.Rows.Count).ToString()));//tra count bw.Write(CS.StringToBytes((0x40).ToString("X8")));//anim offset bw.Write(BitConverter.GetBytes(0x00000000));//sca offset bw.Write(BitConverter.GetBytes(0x00000000));//rot offsett bw.Write(BitConverter.GetBytes(0x00000000));//tra offsett - bw.Write(Encoding.ASCII.GetBytes("This is padding data to alig")); - //anmtable - long fs_pos;// = fs.Position; + bw.Write(Encoding.ASCII.GetBytes("Made by Penguin Made by J3DB")); + + //BCK_Systemクラスのインスタンス作成 BCK_System bcksys = new BCK_System(); + + //アニメーションテーブルを書き込む bcksys.Anim_Writer(bw); - fs_pos = fs.Position; - bcksys.Padding_Writer(bw,fs_pos); + //パディングを書き込む + bcksys.Padding_Writer(bw, fs.Position); - //bw.Write(CS.Float_ToHexString()); + //スケールテーブルを書き込む int scale_pos = Convert.ToInt32(fs.Position); - //bcksys.Mode_Checker(Bone_Num, 0, false); bcksys.Scale_Trans_Writer(bw,dgv2, "Scale_Value"); - //bcksys.Mode_Checker(Bone_Num, 0, true); - fs_pos = fs.Position; - - bcksys.Padding_Writer(bw, fs_pos); + + //パディングを書き込む + bcksys.Padding_Writer(bw, fs.Position); + //ローテーションテーブルの書き込みと設定 bcksys.Mode_Checker((Int16.Parse(Txt_Bone_Num.Text)),1,false); int rotation_pos = Convert.ToInt32(fs.Position); bcksys.Rotate_Writer(bw,dgv3, "Rotation_Value"); bcksys.Mode_Checker((Int16.Parse(Txt_Bone_Num.Text)), 1, true); - fs_pos = fs.Position; - bcksys.Padding_Writer(bw, fs_pos); - + //パディングを書き込む + bcksys.Padding_Writer(bw, fs.Position); - //bcksys.Mode_Checker(Bone_Num, 2, false); + //トランスレートテーブルの書き込み int trans_pos = Convert.ToInt32(fs.Position); bcksys.Scale_Trans_Writer(bw, dgv4, "Translation_Value"); - //bcksys.Mode_Checker(Bone_Num, 2, true); - - fs_pos = fs.Position; - bcksys.Padding_Writer(bw, fs_pos); + + //パディングを書き込み + bcksys.Padding_Writer(bw, fs.Position); + //チャンク末尾を記録 int Ank_Last = Convert.ToInt32(fs.Position); - - //追記 bw.Seek(0x8,SeekOrigin.Begin); bw.Write(CS.StringToBytes((Ank_Last).ToString("X8"))); @@ -396,6 +276,9 @@ public void Write(string filepath) //書き込みの終了処理 bw.Close(); fs.Close(); + + //ステータスバー設定 + tssl2.Text = Path.GetFileName(filepath)+"を保存しました"; } diff --git a/J3D_BCK_Editor/File_Edit/BCK_System.cs b/J3D_BCK_Editor/File_Edit/BCK_System.cs index a0764d9..2901e26 100644 --- a/J3D_BCK_Editor/File_Edit/BCK_System.cs +++ b/J3D_BCK_Editor/File_Edit/BCK_System.cs @@ -35,24 +35,31 @@ public void Animation_Table_File_Reader(BinaryReader br) } } - public void Padding(BinaryReader br) + /// + /// BCKファイルのパディング分バイナリリードストリームを進めます
+ /// Padding(進めたいバイナリリード、ファイルストリームの位置(ling型)) + ///
+ /// + public void Padding(BinaryReader br,long fs) { - - for (int k = padnum + 96; (k % 32f) != 0; k++) + string ps = ""; + for (long k = fs; (k % 32f) != 0; k++) { - debug.AppendText("\n\r" + CS.Byte2Char(br, 1)); - Console.WriteLine(padcount++); - + ps += CS.Byte2Char(br, 1); } + debug.AppendText(EN.NewLine + ps); } - //以下ファイル書き込み専用 - public void Anim_Writer(BinaryWriter bw ) + /// + /// アニメーションテーブルをBCKバイナリに書き込む
+ /// Anim_Writer(バイナリライター) + ///
+ /// + public void Anim_Writer(BinaryWriter bw ) { int dgv1_row_total = dgv1.Rows.Count; - //if (dgv1_row_total % 9 == 0)return ; for (int i = 0; i < dgv1_row_total; i++) { bw.Write( @@ -61,8 +68,6 @@ public void Anim_Writer(BinaryWriter bw ) CS.StringToShort_byte(dgv1.Rows[i].Cells["Start_Frame"].Value.ToString())); bw.Write( CS.StringToShort_byte(dgv1.Rows[i].Cells["Tangent_Mode"].Value.ToString())); - - } } @@ -72,16 +77,15 @@ public void Scale_Trans_Writer(BinaryWriter bw , DataGridView dgv ,string Column for (int i = 0; i < dgv_row_total ; i++) { CS.ToHexString(dgv.Rows[i].Cells[Column_Name].Value.ToString()); - bw.Write(CS.StringToBytes( + bw.Write( + CS.StringToBytes( CS.Float_ToHexString_2( float.Parse( - - string.Format("{0:0.##########}", dgv.Rows[i].Cells[Column_Name].Value.ToString()),CultureInfo.InvariantCulture.NumberFormat) + string.Format("{0:0.##########}", dgv.Rows[i].Cells[Column_Name].Value.ToString()),CultureInfo.InvariantCulture.NumberFormat + ) ) ) ); - - } } @@ -93,14 +97,10 @@ public void Rotate_Writer(BinaryWriter bw, DataGridView dgv, string Column_Name) bw.Write(CS.StringToBytes( CS.Int16_ToHexString( Convert.ToInt16( - - dgv.Rows[i].Cells[Column_Name].Value) + dgv.Rows[i].Cells[Column_Name].Value) ) ) ); - - - } } @@ -110,11 +110,10 @@ public void Rotate_Writer(BinaryWriter bw, DataGridView dgv, string Column_Name) public void Padding_Writer(BinaryWriter bw,long bw_pos) { int i = 0; - byte[] pad = { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x74, 0x6F, 0x20, 0x61, 0x6C, 0x69, 0x67, 0x6E, 0x6D, 0x65 }; + byte[] pad = System.Text.Encoding.ASCII.GetBytes("Made by Penguin Made by J3DBCK ") ; for (long k = bw_pos; (k % 32f) != 0; k++) { bw.Write(pad[i]); - i++; } } @@ -148,7 +147,6 @@ public void Mode_Checker(int bones , int type_num , bool dgv_write ,bool plot_ com1.Items.Add(Bone_Num_And_XYZ); if (type_num == 1) { - debug.AppendText(EN.NewLine+ "Rot_" + Start_Frame_String + "__" + Frame_Num_String + "__" + Tangent_String); bool write_read = dgv_write; if (plot_reader == false) { Rot_Mode(write_read); } else @@ -162,20 +160,6 @@ public void Mode_Checker(int bones , int type_num , bool dgv_write ,bool plot_ else if (type_num == 0) { Scale_Trans_Mode(dgv_write, dgv2, "Scale_Value"); - - //if (Tangent_String == "0" && Frame_Num_String == "1") - //{ - - //} - //else if (Tangent_String == "0" && (Start_Frame_Int > 0) && (Frame_Num_Int > 1)) - //{ - - - //} - //else if (Tangent_String == "1" && Frame_Num_String != "1") - //{ - - //} } else if (type_num == 2) { @@ -184,20 +168,13 @@ public void Mode_Checker(int bones , int type_num , bool dgv_write ,bool plot_ } if (plot_reader == true) { - //rotList_Num = rotList_Num.Where(x => x != 0).ToArray(); - //rotList_Num = rotList_Num.Where(x => x != 1).ToArray(); int rc = 0; foreach (var y in rotList_Num.Select((value, index) => new { value, index })) { if ((y.value != 0)&& (y.value > 0)) { - - debug.AppendText(EN.NewLine + rotList_Start[y.index].ToString() + "__start"); - debug.AppendText(EN.NewLine + rotList_Num[y.index].ToString() + "__Num"); - debug.AppendText(EN.NewLine+rotList_Tangent[y.index].ToString()+"__tan"); Plot_List_Rot_Combo.Add(new List()); Plot_List_Rot_Combo[rc].Add(rotList_Start[y.index]); Plot_List_Rot_Combo[rc].Add(rotList_Num[y.index]); Plot_List_Rot_Combo[rc].Add(rotList_Tangent[y.index]); - debug.AppendText(EN.NewLine + string.Join(", ", Plot_List_Rot_Combo[rc][0])+"生成値"); rc++; } } @@ -207,64 +184,40 @@ public void Mode_Checker(int bones , int type_num , bool dgv_write ,bool plot_ public void Rot_Mode(bool dgv_write) { int[] rotList = new int[dgv3.Rows.Count]; - //int[] rotList_Num = new int[dgv3.Rows.Count]; - //int[] rotList_Start = new int[dgv3.Rows.Count]; - //int[] rotList_Tangent = new int[dgv3.Rows.Count]; - float dgv3float; if (Tangent_String == "0" && Frame_Num_String == "1") { rotList[Start_Frame_Int] = Start_Frame_Int ; - - //rotList_Num[Start_Frame_Int] = Frame_Num_Int; - //rotList_Start[Start_Frame_Int] =Start_Frame_Int; - //rotList_Tangent[Start_Frame_Int] = Tangent_Int; } else if (Tangent_String == "0" && (Start_Frame_Int > 0) && (Frame_Num_Int > 1)) { - //rotList_Num[Start_Frame_Int] = Frame_Num_Int; - //rotList_Start[Start_Frame_Int] = Start_Frame_Int; - //rotList_Tangent[Start_Frame_Int] = Tangent_Int; for (int i = (Start_Frame_Int +1); (Start_Frame_Int +1) + (Frame_Num_Int * 3) > i; i = i + 3) { rotList[i] = i; - } } else if (Tangent_String == "1" && Frame_Num_String != "1") { - //rotList_Num[Start_Frame_Int] = Frame_Num_Int; - //rotList_Start[Start_Frame_Int] = Start_Frame_Int; - //rotList_Tangent[Start_Frame_Int] = Tangent_Int; for (int j = (Start_Frame_Int + 1); (Start_Frame_Int + 1) + (Frame_Num_Int * 4) > j; j = j + 4) { rotList[j] = j; } } - //rotList = rotList.Where(x => x != 0).ToArray(); - //rotList_Num = rotList_Num.Where(x => ((x != 0) && (x != 1))).ToArray(); - //rotList_Tangent = rotList_Tangent.Where(x => ((rotList_Num[x] != 0) && (rotList_Num[x] != 1))).ToArray(); - //rotList_Start = rotList_Start.Where(x => ((rotList_Num[x] != 0) && (rotList_Num[x] != 1))).ToArray(); - //rotList_Num = rotList_Num.Where(x => ((x != 0) && (x != 1))).ToArray(); - debug.AppendText("_______"+ rotList_Num.Length); int frac = 1; - - for (int f = 0; f < Rotation_Frac;f++) + int from_txt_frac= Int32.Parse( Txt_Rot_Frac.Text); + for (int f = 0; f index; index++) - //{ - // if(((rotList_Start[index] == 0)&& (rotList_Num[index] == 0)&& (rotList_Tangent[index] == 0))==false) - // debug.AppendText(EN.NewLine + rotList_Start[index].ToString() + "__" + rotList_Num[index].ToString() + "__"+ rotList_Tangent[index].ToString()); - //} - - } public void Scale_Trans_Mode(bool dgv_write ,DataGridView dgv ,string cell_name) @@ -310,26 +252,20 @@ public void Scale_Trans_Mode(bool dgv_write ,DataGridView dgv ,string cell_name) } S_T_List = S_T_List.Where(x => x != 0).ToArray(); - int dgvint; foreach (int a in S_T_List) { if (dgv_write == true) { dgvfloat = float.Parse(dgv.Rows[a].Cells[cell_name].Value.ToString()); - Console.WriteLine(dgvfloat + "米"); - - //dgvint = Convert.ToInt32(dgvfloat); - //dgv.Rows[a].Cells[cell_name].Value = dgvint.ToString(); dgv.Rows[a].Cells[cell_name].Value = (string.Format("{0:f}",CS.Float_ToHexString(dgvfloat))); } else { dgvfloat = Convert.ToSingle(dgv.Rows[a].Cells[cell_name].Value.ToString()); - dgv.Rows[a].Cells[cell_name].Value = Convert.ToInt16(dgvfloat); } - debug.AppendText(EN.NewLine + a.ToString() + "リスト"); + //debug.AppendText(EN.NewLine + a.ToString() + "リスト"); } } } diff --git a/J3D_BCK_Editor/File_Edit/Calculation_System.cs b/J3D_BCK_Editor/File_Edit/Calculation_System.cs index 8b91fe6..102cd6c 100644 --- a/J3D_BCK_Editor/File_Edit/Calculation_System.cs +++ b/J3D_BCK_Editor/File_Edit/Calculation_System.cs @@ -29,32 +29,22 @@ public static float Byte2Float(BinaryReader br, int readbyte = 4) Console.WriteLine(str); int num = Convert.ToInt32(str,16); byte[] bytenum = BitConverter.GetBytes(num); - ////return Single.Parse(BitConverter.ToString(br.ReadBytes(readbyte), 0).Replace("-", "").PadLeft(readbyte, '0'),NumberStyles.Float); return BitConverter.ToSingle(bytenum, 0); - ////return float.Parse(BitConverter.ToString(br.ReadBytes(readbyte), 0).Replace("-", "").PadLeft(readbyte, '0'), NumberStyles.Float); - ////return float.Parse(); - ////return float.Parse(BitConverter.ToString(bytenum, 0)); } public static short Byte2Short_noPI(BinaryReader br) { string str = BitConverter.ToString(br.ReadBytes(2)).Replace("-", "").PadLeft(4, '0'); var i = Convert.ToInt16(str, 16); - //var i = Convert.ToInt16(str, 16); - //float j = i / 182; return Convert.ToInt16(i); } public static short Byte2Short(BinaryReader br) { - //string str = BitConverter.ToString(br.ReadBytes(2)).Replace("-", "").PadLeft(4, '0'); - //var i = Convert.ToInt16(str, 16); - //Console.WriteLine("int32" + i); var i = br.ReadInt16(); float j = i / 182; Console.WriteLine("float" + j); return Convert.ToInt16(j); - //return i; } public static byte[] StringToBytes(string str) @@ -63,7 +53,6 @@ public static byte[] StringToBytes(string str) for (int i = 0; i < str.Length / 2; i++) { bs.Add(Convert.ToByte(str.Substring(i*2, 2), 16)); - debug.AppendText(Convert.ToByte(bs[i]).ToString()); } return bs.ToArray(); } @@ -73,9 +62,7 @@ public static byte[] StringToShort_byte(string str) short sh; string str2; sh = Convert.ToInt16(str,10); - debug.AppendText(EN.NewLine + sh.ToString("X2")); str2 = sh.ToString("X4"); - debug.AppendText(EN.NewLine + str2); return StringToBytes(str2); } @@ -85,9 +72,7 @@ public static byte[] StringToByte(string str) byte bit; string str2; bit = Convert.ToByte(str, 10); - debug.AppendText(EN.NewLine + bit.ToString()); str2 = bit.ToString("X2"); - debug.AppendText(EN.NewLine + str2); return StringToBytes(str2); } @@ -106,12 +91,7 @@ public static string Float_ToHexString_2(float f) var j = Convert.ToSingle(f); var bytes = BitConverter.GetBytes(j); - //var i = BitConverter.ToString(bytes); - var i = BitConverter.ToInt32(bytes, 0); - //var i = Int32.Parse(BitConverter.ToString(bytes, 0).Replace("-",""), NumberStyles.AllowHexSpecifier); - //var i = BitConverter.ToUInt32(bytes, 0); - return i.ToString("X8"); } @@ -119,23 +99,18 @@ public static string Int16_ToHexString(Int16 sh) { var j = Convert.ToInt16(sh); var bytes = BitConverter.GetBytes(j); - //var i = BitConverter.ToInt32(bytes, 0); var i = BitConverter.ToInt16(bytes, 0); - return i.ToString("X4"); } - public static float hex2float(BinaryReader br, int readbyte = 4) { - - - //string str = string.Format("{0:}", BitConverter.ToString(br.ReadBytes(readbyte), 0).Replace("-", "").PadLeft(readbyte, '0')); + public static float hex2float(BinaryReader br, int readbyte = 4) + { string str = string.Format("{0:f3}", BitConverter.ToString(br.ReadBytes(readbyte), 0).Replace("-", "")); string hexString = str; uint num = uint.Parse(hexString, NumberStyles.AllowHexSpecifier); byte[] floatVals = BitConverter.GetBytes(num); float f = BitConverter.ToSingle(floatVals, 0); - Console.WriteLine("float convert = {0:f6}", f); return f; } @@ -145,22 +120,15 @@ public static float hex2float_2(BinaryReader br, int readbyte = 4) string hexString = str; float f; f = Convert.ToSingle(Int32.Parse(str, NumberStyles.HexNumber)); - //uint num = uint.Parse(hexString,NumberStyles.HexNumber); - //byte[] floatVals = BitConverter.GetBytes(num); - //float f = BitConverter.ToSingle(floatVals, 0); - //Console.WriteLine("float convert = {0:f6}", f); return f; } public static int hex2int(BinaryReader br, int readbyte = 4) { - - //string str = string.Format("{0:}", BitConverter.ToString(br.ReadBytes(readbyte), 0).Replace("-", "").PadLeft(readbyte, '0')); string str = string.Format("{0:X}", BitConverter.ToString(br.ReadBytes(readbyte), 0).Replace("-", "")); string hexString = str; return Int32.Parse(hexString, NumberStyles.AllowHexSpecifier); - } public static byte[] ToHexString(string str) @@ -168,7 +136,6 @@ public static byte[] ToHexString(string str) var f = float.Parse(str); var bytes = BitConverter.GetBytes(f); var i = BitConverter.ToInt32(bytes, 0); - Console.WriteLine("str→byte_"+ "0x" + i.ToString("X8")); return bytes; } @@ -178,23 +145,7 @@ public static float FromHexString(BinaryReader br) var b = br.ReadBytes(4); var b2 = b.Reverse().ToArray(); float i = BitConverter.ToSingle(b2,0); - Console.WriteLine("Binary→Float_" + i.ToString()); return i; } - - - //public static byte[] FloatString2Bytes(string str) - //{ - // List bit= new List() ; - // float.Parse(str); - // int bitnum = 0; - // foreach (byte bit2 in str) - // { - // bit.Add(bit2); - // bitnum++; - // } - // return bit; - //} - } } diff --git a/J3D_BCK_Editor/File_Edit/Plot.cs b/J3D_BCK_Editor/File_Edit/Plot.cs index d1b3741..afad4ae 100644 --- a/J3D_BCK_Editor/File_Edit/Plot.cs +++ b/J3D_BCK_Editor/File_Edit/Plot.cs @@ -15,220 +15,151 @@ namespace J3D_BCK_Editor.File_Edit { class Plot : BCK_State { - public void Draw(PictureBox pictureBox1, Chart chart1) + public void Draw(PictureBox pictureBox1) { - chart1.Series.Clear(); // ← 最初からSeriesが1つあるのでクリアします - chart1.ChartAreas.Clear(); + //宣言 + int pl_sfn, pl_cfn, pl_tan; + int dgv3_fn; + float dgv3_va, dgv3_ta, dgv3_ta2, lineF; + PointF p_line, p_line2,p0,p1,p2; //描画先とするImageオブジェクトを作成する Bitmap canvas = new Bitmap(pictureBox1.Width, pictureBox1.Height); + //ImageオブジェクトのGraphicsオブジェクトを作成する Graphics g = Graphics.FromImage(canvas); - int pl_sfn,pl_cfn,pl_tan, pl_tan2; + + //ペンの設定 + Pen penB = new Pen(Color.Blue, 1); + Pen penR = new Pen(Color.Red, 3); + penR.EndCap = LineCap.ArrowAnchor; + + //初期化 pl_sfn = Plot_List_Rot_Combo[com1.SelectedIndex][0]; pl_cfn = Plot_List_Rot_Combo[com1.SelectedIndex][1]; pl_tan = Plot_List_Rot_Combo[com1.SelectedIndex][2]; - Console.WriteLine(pl_sfn + "_" + pl_cfn + "_" + pl_tan); - int dgv3_fn; - float dgv3_va, dgv3_ta, dgv3_ta2; - + List l2pf = new List(); - Pen penB = new Pen(Color.Blue, 1); - Pen penR = new Pen(Color.Red, 3); + //デバッグ + Console.WriteLine(pl_sfn + "_" + pl_cfn + "_" + pl_tan); - penR.EndCap = LineCap.ArrowAnchor; + //曲線がないパターン(直線で一定) if (pl_cfn == 1) { - float lineF = float.Parse(string.Format("{0:0.##########}", dgv3.Rows[pl_sfn].Cells["Rotation_Value"].Value, CultureInfo.InvariantCulture.NumberFormat)); - PointF p_line = new PointF(0,lineF); - PointF p_line2 = new PointF(Int32.Parse(Txt_Total_Frame.Text),lineF); + //初期化 + lineF = float.Parse(string.Format("{0:0.##########}", dgv3.Rows[pl_sfn].Cells["Rotation_Value"].Value, CultureInfo.InvariantCulture.NumberFormat)); + p_line = new PointF(0,lineF); + p_line2 = new PointF(Int32.Parse(Txt_Total_Frame.Text),lineF); + + //ワールド設定 g.ResetTransform(); - //ワールド変換行列を下に10平行移動する g.TranslateTransform(0, canvas.Height / 2); g.ScaleTransform(3F, 0.5F); + + //線を描画 g.DrawLine(penR, new PointF(0, 0), new PointF(Int32.Parse(Txt_Total_Frame.Text), 0)); g.DrawLine(penB,p_line,p_line2); - + + //イメージをピクチャボックスに pictureBox1.Image = canvas; - //pictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipX); pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipY); + + //ステータスバー設定 tssl2.Text = com1.Text +"を描画しました。"; return; } - //pl_tan2 = Plot_List_Rot_Combo[com1.SelectedIndex][3]; - PointF[] p = { }; - List l2pf = new List(); + //曲線のあるパターン(エルミート曲線) for (int i = pl_sfn; i < pl_sfn + (pl_cfn * (3 + pl_tan)); i += (3 + pl_tan)) { - Console.WriteLine("!_!_!_!_!_!_!_!"); + //初期化 dgv3_fn = Convert.ToInt16(dgv3.Rows[i].Cells["Rotation_Value"].Value); dgv3_va =float.Parse(string.Format("{0:0.##########}", dgv3.Rows[i+1].Cells["Rotation_Value"].Value , CultureInfo.InvariantCulture.NumberFormat)); dgv3_ta = float.Parse(string.Format("{0:0.##########}", dgv3.Rows[i + 2].Cells["Rotation_Value"].Value, CultureInfo.InvariantCulture.NumberFormat)); - PointF p0 =new PointF(dgv3_fn, dgv3_va - (dgv3_ta / 92) / 3); - PointF p1 = new PointF(dgv3_fn, dgv3_va); + p0 =new PointF(dgv3_fn, dgv3_va - (dgv3_ta / 92) / 3); + p1 = new PointF(dgv3_fn, dgv3_va); - + //タンジェントモードなし if ((3 + pl_tan) == 3) { - PointF p2 = new PointF(dgv3_fn, dgv3_va + (dgv3_ta / 92) / 3); + //タンジェントモード「なし」のポイント設定&初期化 + p2 = new PointF(dgv3_fn, dgv3_va + (dgv3_ta / 92) / 3); + + //先頭と末尾だけポイント数を減らす if (pl_sfn == i) { l2pf.Add(p1); l2pf.Add(p2); - Console.WriteLine("F"); - p.Append(p1); - p.Append(p2); + Console.WriteLine("先頭"); } else if (pl_sfn + (pl_cfn * (3 + pl_tan)) - 3 > i) { l2pf.Add(p0); - l2pf.Add(p1); l2pf.Add(p2); - - Console.WriteLine("M"); - p.Append(p0); - p.Append(p1); - p.Append(p2); + Console.WriteLine("中間"); } else { l2pf.Add(p0); - l2pf.Add(p1); - - Console.WriteLine("E"); - p.Append(p0); - p.Append(p1); + Console.WriteLine("末尾"); } } + //タンジェントモードあり else if ((3 + pl_tan)==4) { - + //タンジェントモード「あり」のポイント設定&初期化 dgv3_ta2 = float.Parse(string.Format("{0:0.##########}", dgv3.Rows[i + 3].Cells["Rotation_Value"].Value, CultureInfo.InvariantCulture.NumberFormat)); - PointF p2 = new PointF(dgv3_fn, dgv3_va + (dgv3_ta2 / 92) / 3); + p2 = new PointF(dgv3_fn, dgv3_va + (dgv3_ta2 / 92) / 3); + + //先頭と末尾だけポイント数を減らす if (pl_sfn == i) { l2pf.Add(p1); l2pf.Add(p2); - Console.WriteLine("F"); - p.Append(p1); - p.Append(p2); + Console.WriteLine("タンジェント先頭"); } else if (pl_sfn + (pl_cfn * (3 + pl_tan)) - 4 > i) { l2pf.Add(p0); - l2pf.Add(p1); l2pf.Add(p2); - - Console.WriteLine("M"); - p.Append(p0); - p.Append(p1); - p.Append(p2); + Console.WriteLine("タンジェント中間"); } else { l2pf.Add(p0); - l2pf.Add(p1); - - Console.WriteLine("E"); - p.Append(p0); - p.Append(p1); + Console.WriteLine("タンジェント末尾"); } } - - - - - + //デバッグ専用 debug.AppendText(EN.NewLine + dgv3_fn); debug.AppendText(EN.NewLine + dgv3_va); debug.AppendText(EN.NewLine + dgv3_ta); } - Console.WriteLine(p.ToString()); - Console.WriteLine(p.Count()); - //PointF[] p = { - - //new PointF(0, 0), // start point of first spline - //new PointF(0,0+(227/92)/3), // first control point of first spline - - //new PointF(4-(4/3),5), // second control point of first spline - //new PointF(4,5), // endpoint of first spline and - //new PointF(4+(4/3),5), // first control point of second spline - - - //new PointF(14-(14/3),5), // second control point of first spline - //new PointF(14,5), // endpoint of first spline and - // // start point of second spline - //new PointF(14+(14/3),5 ), // first control point of second spline - - - //new PointF(179-(179/3),91-(93/92)/3), // second control point of second spline - //new PointF(179, 91)}; // endpoint of second spline - - - + //リストをポイントF配列に PointF[] point2 = l2pf.ToArray(); - Console.WriteLine(point2[0]); - //g.DrawLine(penR, p[0],p[1]); - //g.DrawLine(penR, p[8], p[9]); + + //ワールド設定 g.ResetTransform(); - //ワールド変換行列を下に10平行移動する g.TranslateTransform(0, canvas.Height /2); g.ScaleTransform(2F, 1F); - //g.RotateTransform(180F); - //フォントオブジェクトの作成 - //Font fnt = new Font("MS UI Gothic", 8); - //文字列を位置(0,0)、青色で表示 - + + //描画 g.DrawLine(penR, new PointF(0, 0), new PointF(Int32.Parse(Txt_Total_Frame.Text), 0)); - g.DrawBeziers(penB, point2); - //g.DrawString("(0,0)", fnt, Brushes.Blue, 0, 0); - //g.DrawString("(0,"+ Int32.Parse(Txt_Total_Frame.Text) + ")".ToString(), fnt, Brushes.Blue, Int32.Parse(Txt_Total_Frame.Text),0 ); + //ピクチャボックスに表示 pictureBox1.Image = canvas; - //pictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipX); pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipY); - + + //ステータスバーの設定 tssl2.Text = com1.Text + "を描画しました。"; - // Bitmap bmp = new Bitmap( - //canvas, - //canvas.Width*2, - //canvas.Height); - - //pictureBox1.Image = bmp; - //pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipY); - //pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; - // ChartにChartAreaを追加します - //////string chart_area1 = "Area1"; - //////var ch1 = chart1.ChartAreas.Add((chart_area1)); - //////ch1.AxisX.Interval = 10; - //////ch1.AxisY.Interval = 10; - //////// ChartにSeriesを追加します - //////string legend1 = "Graph1"; - //////chart1.Series.Add(legend1); - //////// グラフの種別を指定 - //////chart1.Series[legend1].ChartType = SeriesChartType.Spline; // 折れ線グラフを指定してみます - - //////chart1.Series[legend1].SetCustomProperty("LineTension", "0.1"); - - //////chart1.BorderlineWidth = 10; - //////for (int i = 0; i < p.Length; i++) - //////{ - - - ////// chart1.Series[legend1].Points.AddXY(p[i].X, p[i].Y); - //////} - - } } - - } +} diff --git a/J3D_BCK_Editor/Form1.Designer.cs b/J3D_BCK_Editor/Form1.Designer.cs index 377017f..fa403d0 100644 --- a/J3D_BCK_Editor/Form1.Designer.cs +++ b/J3D_BCK_Editor/Form1.Designer.cs @@ -29,14 +29,13 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend4 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.ファイルToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.開くToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.保存ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); @@ -75,13 +74,10 @@ private void InitializeComponent() this.Translation_Table_Num = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Translation_Value = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabPage5 = new System.Windows.Forms.TabPage(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); this.button1 = new System.Windows.Forms.Button(); - this.デバッグ = new System.Windows.Forms.TextBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.デバッグ = new System.Windows.Forms.TextBox(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -95,7 +91,6 @@ private void InitializeComponent() this.tabPage4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit(); this.tabPage5.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -105,7 +100,7 @@ private void InitializeComponent() this.ファイルToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(799, 24); + this.menuStrip1.Size = new System.Drawing.Size(909, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -137,12 +132,24 @@ private void InitializeComponent() this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1, this.toolStripStatusLabel2}); - this.statusStrip1.Location = new System.Drawing.Point(0, 431); + this.statusStrip1.Location = new System.Drawing.Point(0, 520); this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(799, 22); + this.statusStrip1.Size = new System.Drawing.Size(909, 22); this.statusStrip1.TabIndex = 1; this.statusStrip1.Text = "statusStrip1"; // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(43, 17); + this.toolStripStatusLabel1.Text = "状態:"; + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(43, 17); + this.toolStripStatusLabel2.Text = "   "; + // // groupBox1 // this.groupBox1.Controls.Add(this.label4); @@ -238,7 +245,7 @@ private void InitializeComponent() this.tabControl1.Location = new System.Drawing.Point(176, 27); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(612, 398); + this.tabControl1.Size = new System.Drawing.Size(728, 492); this.tabControl1.TabIndex = 3; // // tabPage1 @@ -249,14 +256,14 @@ private void InitializeComponent() this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(604, 372); + this.tabPage1.Size = new System.Drawing.Size(720, 466); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "アニメーションテーブル"; this.tabPage1.UseVisualStyleBackColor = true; // // BoneDelete // - this.BoneDelete.Location = new System.Drawing.Point(177, 318); + this.BoneDelete.Location = new System.Drawing.Point(143, 412); this.BoneDelete.Name = "BoneDelete"; this.BoneDelete.Size = new System.Drawing.Size(131, 48); this.BoneDelete.TabIndex = 2; @@ -266,7 +273,7 @@ private void InitializeComponent() // // Add_Bone // - this.Add_Bone.Location = new System.Drawing.Point(6, 318); + this.Add_Bone.Location = new System.Drawing.Point(6, 412); this.Add_Bone.Name = "Add_Bone"; this.Add_Bone.Size = new System.Drawing.Size(131, 48); this.Add_Bone.TabIndex = 1; @@ -288,7 +295,7 @@ private void InitializeComponent() this.dataGridView1.Location = new System.Drawing.Point(0, 0); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.RowTemplate.Height = 21; - this.dataGridView1.Size = new System.Drawing.Size(598, 312); + this.dataGridView1.Size = new System.Drawing.Size(720, 406); this.dataGridView1.TabIndex = 0; // // BoneNum @@ -324,14 +331,14 @@ private void InitializeComponent() this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(604, 372); + this.tabPage2.Size = new System.Drawing.Size(720, 466); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "スケールテーブル"; this.tabPage2.UseVisualStyleBackColor = true; // // ScaleDelete // - this.ScaleDelete.Location = new System.Drawing.Point(187, 318); + this.ScaleDelete.Location = new System.Drawing.Point(143, 412); this.ScaleDelete.Name = "ScaleDelete"; this.ScaleDelete.Size = new System.Drawing.Size(131, 48); this.ScaleDelete.TabIndex = 4; @@ -341,7 +348,7 @@ private void InitializeComponent() // // ScaleAdd // - this.ScaleAdd.Location = new System.Drawing.Point(6, 318); + this.ScaleAdd.Location = new System.Drawing.Point(6, 412); this.ScaleAdd.Name = "ScaleAdd"; this.ScaleAdd.Size = new System.Drawing.Size(131, 48); this.ScaleAdd.TabIndex = 3; @@ -360,7 +367,7 @@ private void InitializeComponent() this.dataGridView2.Location = new System.Drawing.Point(0, 0); this.dataGridView2.Name = "dataGridView2"; this.dataGridView2.RowTemplate.Height = 21; - this.dataGridView2.Size = new System.Drawing.Size(598, 312); + this.dataGridView2.Size = new System.Drawing.Size(720, 406); this.dataGridView2.TabIndex = 0; // // Table_Num @@ -381,14 +388,14 @@ private void InitializeComponent() this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Name = "tabPage3"; this.tabPage3.Padding = new System.Windows.Forms.Padding(3); - this.tabPage3.Size = new System.Drawing.Size(604, 372); + this.tabPage3.Size = new System.Drawing.Size(720, 466); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "ローテートテーブル"; this.tabPage3.UseVisualStyleBackColor = true; // // RotationDelete // - this.RotationDelete.Location = new System.Drawing.Point(168, 318); + this.RotationDelete.Location = new System.Drawing.Point(143, 412); this.RotationDelete.Name = "RotationDelete"; this.RotationDelete.Size = new System.Drawing.Size(131, 48); this.RotationDelete.TabIndex = 6; @@ -398,7 +405,7 @@ private void InitializeComponent() // // RotatinAdd // - this.RotatinAdd.Location = new System.Drawing.Point(6, 318); + this.RotatinAdd.Location = new System.Drawing.Point(6, 412); this.RotatinAdd.Name = "RotatinAdd"; this.RotatinAdd.Size = new System.Drawing.Size(131, 48); this.RotatinAdd.TabIndex = 5; @@ -417,7 +424,7 @@ private void InitializeComponent() this.dataGridView3.Location = new System.Drawing.Point(0, 0); this.dataGridView3.Name = "dataGridView3"; this.dataGridView3.RowTemplate.Height = 21; - this.dataGridView3.Size = new System.Drawing.Size(604, 312); + this.dataGridView3.Size = new System.Drawing.Size(720, 406); this.dataGridView3.TabIndex = 0; // // Rotation_Table_Num @@ -439,14 +446,14 @@ private void InitializeComponent() this.tabPage4.Location = new System.Drawing.Point(4, 22); this.tabPage4.Name = "tabPage4"; this.tabPage4.Padding = new System.Windows.Forms.Padding(3); - this.tabPage4.Size = new System.Drawing.Size(604, 372); + this.tabPage4.Size = new System.Drawing.Size(720, 466); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "トランスレートテーブル"; this.tabPage4.UseVisualStyleBackColor = true; // // TranslationDelete // - this.TranslationDelete.Location = new System.Drawing.Point(143, 318); + this.TranslationDelete.Location = new System.Drawing.Point(143, 412); this.TranslationDelete.Name = "TranslationDelete"; this.TranslationDelete.Size = new System.Drawing.Size(131, 48); this.TranslationDelete.TabIndex = 8; @@ -456,7 +463,7 @@ private void InitializeComponent() // // TranslationAdd // - this.TranslationAdd.Location = new System.Drawing.Point(6, 318); + this.TranslationAdd.Location = new System.Drawing.Point(6, 412); this.TranslationAdd.Name = "TranslationAdd"; this.TranslationAdd.Size = new System.Drawing.Size(131, 48); this.TranslationAdd.TabIndex = 7; @@ -475,7 +482,7 @@ private void InitializeComponent() this.dataGridView4.Location = new System.Drawing.Point(0, 0); this.dataGridView4.Name = "dataGridView4"; this.dataGridView4.RowTemplate.Height = 21; - this.dataGridView4.Size = new System.Drawing.Size(601, 312); + this.dataGridView4.Size = new System.Drawing.Size(720, 406); this.dataGridView4.TabIndex = 0; // // Translation_Table_Num @@ -496,87 +503,58 @@ private void InitializeComponent() this.tabPage5.Location = new System.Drawing.Point(4, 22); this.tabPage5.Name = "tabPage5"; this.tabPage5.Padding = new System.Windows.Forms.Padding(3); - this.tabPage5.Size = new System.Drawing.Size(604, 372); + this.tabPage5.Size = new System.Drawing.Size(720, 466); this.tabPage5.TabIndex = 4; this.tabPage5.Text = "グラフ(回転のみ)"; this.tabPage5.UseVisualStyleBackColor = true; // - // chart1 - // - chartArea4.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea4); - legend4.Name = "Legend1"; - this.chart1.Legends.Add(legend4); - this.chart1.Location = new System.Drawing.Point(794, 331); - this.chart1.Name = "chart1"; - series4.ChartArea = "ChartArea1"; - series4.Legend = "Legend1"; - series4.Name = "Series1"; - this.chart1.Series.Add(series4); - this.chart1.Size = new System.Drawing.Size(592, 222); - this.chart1.TabIndex = 3; - this.chart1.Text = "chart1"; - this.chart1.Visible = false; + // comboBox1 + // + this.comboBox1.Font = new System.Drawing.Font("MS UI Gothic", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(373, 331); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(196, 35); + this.comboBox1.TabIndex = 5; + this.comboBox1.Text = "選択してください"; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // button1 // - this.button1.Location = new System.Drawing.Point(459, 331); + this.button1.Location = new System.Drawing.Point(575, 331); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(139, 35); this.button1.TabIndex = 2; - this.button1.Text = "グラフ描画"; + this.button1.Text = "回転リストロード"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // - // デバッグ - // - this.デバッグ.Font = new System.Drawing.Font("メイリオ", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); - this.デバッグ.ForeColor = System.Drawing.SystemColors.WindowText; - this.デバッグ.Location = new System.Drawing.Point(790, 55); - this.デバッグ.Multiline = true; - this.デバッグ.Name = "デバッグ"; - this.デバッグ.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.デバッグ.Size = new System.Drawing.Size(592, 270); - this.デバッグ.TabIndex = 0; - this.デバッグ.Visible = false; - // // pictureBox1 // this.pictureBox1.BackColor = System.Drawing.SystemColors.ActiveCaption; this.pictureBox1.Location = new System.Drawing.Point(6, 6); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(592, 319); + this.pictureBox1.Size = new System.Drawing.Size(708, 319); this.pictureBox1.TabIndex = 4; this.pictureBox1.TabStop = false; // - // comboBox1 - // - this.comboBox1.Font = new System.Drawing.Font("MS UI Gothic", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(257, 331); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(196, 35); - this.comboBox1.TabIndex = 5; - this.comboBox1.Text = "選択してください"; - // - // toolStripStatusLabel1 - // - this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(43, 17); - this.toolStripStatusLabel1.Text = "状態:"; - // - // toolStripStatusLabel2 + // デバッグ // - this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; - this.toolStripStatusLabel2.Size = new System.Drawing.Size(43, 17); - this.toolStripStatusLabel2.Text = "   "; + this.デバッグ.Font = new System.Drawing.Font("メイリオ", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.デバッグ.ForeColor = System.Drawing.SystemColors.WindowText; + this.デバッグ.Location = new System.Drawing.Point(910, 49); + this.デバッグ.Multiline = true; + this.デバッグ.Name = "デバッグ"; + this.デバッグ.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.デバッグ.Size = new System.Drawing.Size(277, 270); + this.デバッグ.TabIndex = 0; + this.デバッグ.Visible = false; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(799, 453); - this.Controls.Add(this.chart1); + this.ClientSize = new System.Drawing.Size(909, 542); this.Controls.Add(this.tabControl1); this.Controls.Add(this.デバッグ); this.Controls.Add(this.groupBox1); @@ -602,7 +580,6 @@ private void InitializeComponent() this.tabPage4.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit(); this.tabPage5.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -657,7 +634,6 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn Rotation_Value; private System.Windows.Forms.Button button1; public System.Windows.Forms.PictureBox pictureBox1; - public System.Windows.Forms.DataVisualization.Charting.Chart chart1; public System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; public System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; diff --git a/J3D_BCK_Editor/Form1.cs b/J3D_BCK_Editor/Form1.cs index eef552f..c392b4c 100644 --- a/J3D_BCK_Editor/Form1.cs +++ b/J3D_BCK_Editor/Form1.cs @@ -64,21 +64,13 @@ private void Form1_Load(object sender, EventArgs e) { //Form1のインスタンスの作成 Form1 f = new Form1(); - //Form1Instanceに代入 Form1.Form1Instance = f; - //Form1の表示 - //f.Show(); - Form1.Form1Instance = this; - - } private void 開くToolStripMenuItem_Click(object sender, EventArgs e) { - File_Select.Dialog(); - } private void 保存ToolStripMenuItem_Click(object sender, EventArgs e) @@ -106,7 +98,6 @@ private void Add_Bone_Click(object sender, EventArgs e) private void BoneDelete_Click(object sender, EventArgs e) { - //int dgvcount = dataGridView1.Rows.Count -9; if ((dataGridView1.Rows.Count > 8)) { for (int j = 0; j < 9; j++) @@ -152,84 +143,24 @@ private void TranslationDelete_Click(object sender, EventArgs e) public void button1_Click(object sender, EventArgs e) { - Plot pt = new Plot(); - pt.Draw(pictureBox1,chart1); - // chart1.Series.Clear(); // ← 最初からSeriesが1つあるのでクリアします - // chart1.ChartAreas.Clear(); - - // //描画先とするImageオブジェクトを作成する - // Bitmap canvas = new Bitmap(pictureBox1.Width, pictureBox1.Height); - // //ImageオブジェクトのGraphicsオブジェクトを作成する - // Graphics g = Graphics.FromImage(canvas); - - // PointF[] p = { - - // new PointF(0, 0), // start point of first spline - // new PointF(0,0+(227/92)/3), // first control point of first spline - - // new PointF(4-(4/3),5), // second control point of first spline - // new PointF(4,5), // endpoint of first spline and - // new PointF(4+(4/3),5), // first control point of second spline - - - // new PointF(14-(14/3),5), // second control point of first spline - // new PointF(14,5), // endpoint of first spline and - // // start point of second spline - // new PointF(14+(14/3),5 ), // first control point of second spline - - - // new PointF(179-(179/3),91-(93/92)/3), // second control point of second spline - // new PointF(179, 91)}; // endpoint of second spline - - // Pen penB = new Pen(Color.Blue, 1); - // Pen penR = new Pen(Color.Red, 3); - - // penR.EndCap = LineCap.ArrowAnchor; - - - - - // //g.DrawLine(penR, p[0],p[1]); - // //g.DrawLine(penR, p[8], p[9]); - // g.DrawBeziers(penB,p); - - // pictureBox1.Image = canvas; - // //pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipY); - - // Bitmap bmp = new Bitmap( - //canvas, - //canvas.Width*2, - //canvas.Height); - - // pictureBox1.Image = bmp; - // pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipY); - // //pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; - // // ChartにChartAreaを追加します - // string chart_area1 = "Area1"; - // var ch1= chart1.ChartAreas.Add((chart_area1)); - // ch1.AxisX.Interval = 10; - // ch1.AxisY.Interval = 10; - // // ChartにSeriesを追加します - // string legend1 = "Graph1"; - // chart1.Series.Add(legend1); - // // グラフの種別を指定 - // chart1.Series[legend1].ChartType = SeriesChartType.Spline; // 折れ線グラフを指定してみます - - // chart1.Series[legend1].SetCustomProperty("LineTension", "0.1"); - - // chart1.BorderlineWidth = 10; - // for (int i = 0; i < p.Length; i++) - // { - - - // chart1.Series[legend1].Points.AddXY(p[i].X,p[i].Y); - // } - + if ((dataGridView1.Rows.Count ==0)|| (dataGridView2.Rows.Count == 0) || (dataGridView3.Rows.Count == 0) || (dataGridView4.Rows.Count == 0)) + { + return; + } + //★BCKクラスインスタンス作成 + BCK_System bcksys = new BCK_System(); + bcksys.Mode_Checker(Int16.Parse(Bone_Num.Text), 1, true, true); } - - - + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + if ((dataGridView1.Rows.Count == 0) || (dataGridView2.Rows.Count == 0) || (dataGridView3.Rows.Count == 0) || (dataGridView4.Rows.Count == 0)) + { + return; + } + Plot pt = new Plot(); + pt.Draw(pictureBox1); + } } }