PK M遷 ョ1 ョ1 Form1.h#pragma once
#include "LoadVmd.h"
namespace VMD_Parameter_Viewer {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
///
/// Form1 の概要
///
/// 警告: このクラスの名前を変更する場合、このクラスが依存するすべての .resx ファイルに関連付けられた
/// マネージ リソース コンパイラ ツールに対して 'Resource File Name' プロパティを
/// 変更する必要があります。この変更を行わないと、
/// デザイナと、このフォームに関連付けられたローカライズ済みリソースとが、
/// 正しく相互に利用できなくなります。
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: ここにコンストラクタ コードを追加します
//
}
protected:
///
/// 使用中のリソースをすべてクリーンアップします。
///
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::DataGridView^ dataGridView1;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::Label^ label8;
private: System::Windows::Forms::Label^ label9;
private: System::Windows::Forms::Label^ label10;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ BoneName;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ FrameNo;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Location;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Rotation;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Interpolation;
private: System::Windows::Forms::MenuStrip^ menuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^ fileFToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ openOToolStripMenuItem;
private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
protected:
private:
///
/// 必要なデザイナ変数です。
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
///
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());
this->BoneName = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->FrameNo = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Location = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Rotation = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Interpolation = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->label6 = (gcnew System::Windows::Forms::Label());
this->label7 = (gcnew System::Windows::Forms::Label());
this->label8 = (gcnew System::Windows::Forms::Label());
this->label9 = (gcnew System::Windows::Forms::Label());
this->label10 = (gcnew System::Windows::Forms::Label());
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->fileFToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->openOToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
(cli::safe_cast(this->dataGridView1))->BeginInit();
this->menuStrip1->SuspendLayout();
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(86, 33);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(11, 12);
this->label1->TabIndex = 0;
this->label1->Text = L"-";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(86, 45);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(11, 12);
this->label2->TabIndex = 1;
this->label2->Text = L"-";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(86, 57);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(11, 12);
this->label3->TabIndex = 2;
this->label3->Text = L"-";
//
// dataGridView1
//
this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->dataGridView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(5) {this->BoneName,
this->FrameNo, this->Location, this->Rotation, this->Interpolation});
this->dataGridView1->Location = System::Drawing::Point(12, 75);
this->dataGridView1->Name = L"dataGridView1";
this->dataGridView1->RowTemplate->Height = 21;
this->dataGridView1->Size = System::Drawing::Size(860, 379);
this->dataGridView1->TabIndex = 3;
//
// BoneName
//
this->BoneName->HeaderText = L"BoneName";
this->BoneName->Name = L"BoneName";
//
// FrameNo
//
this->FrameNo->HeaderText = L"FrameNo";
this->FrameNo->Name = L"FrameNo";
this->FrameNo->Width = 70;
//
// Location
//
this->Location->HeaderText = L"Location";
this->Location->Name = L"Location";
//
// Rotation
//
this->Rotation->HeaderText = L"Rotation";
this->Rotation->Name = L"Rotation";
this->Rotation->Width = 130;
//
// Interpolation
//
this->Interpolation->HeaderText = L"Interpolation";
this->Interpolation->Name = L"Interpolation";
this->Interpolation->Width = 400;
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(12, 57);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(69, 12);
this->label4->TabIndex = 6;
this->label4->Text = L"Motions size";
//
// label5
//
this->label5->AutoSize = true;
this->label5->Location = System::Drawing::Point(12, 45);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(68, 12);
this->label5->TabIndex = 5;
this->label5->Text = L"Model Name";
//
// label6
//
this->label6->AutoSize = true;
this->label6->Location = System::Drawing::Point(12, 33);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(41, 12);
this->label6->TabIndex = 4;
this->label6->Text = L"Header";
//
// label7
//
this->label7->AutoSize = true;
this->label7->Location = System::Drawing::Point(325, 9);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(0, 12);
this->label7->TabIndex = 9;
//
// label8
//
this->label8->AutoSize = true;
this->label8->Location = System::Drawing::Point(325, 21);
this->label8->Name = L"label8";
this->label8->Size = System::Drawing::Size(0, 12);
this->label8->TabIndex = 8;
//
// label9
//
this->label9->AutoSize = true;
this->label9->Location = System::Drawing::Point(325, 33);
this->label9->Name = L"label9";
this->label9->Size = System::Drawing::Size(0, 12);
this->label9->TabIndex = 7;
//
// label10
//
this->label10->AutoSize = true;
this->label10->Location = System::Drawing::Point(325, 45);
this->label10->Name = L"label10";
this->label10->Size = System::Drawing::Size(0, 12);
this->label10->TabIndex = 10;
//
// menuStrip1
//
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->fileFToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(884, 24);
this->menuStrip1->TabIndex = 11;
this->menuStrip1->Text = L"menuStrip1";
//
// fileFToolStripMenuItem
//
this->fileFToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->openOToolStripMenuItem});
this->fileFToolStripMenuItem->Name = L"fileFToolStripMenuItem";
this->fileFToolStripMenuItem->Size = System::Drawing::Size(51, 20);
this->fileFToolStripMenuItem->Text = L"File(&F)";
//
// openOToolStripMenuItem
//
this->openOToolStripMenuItem->Name = L"openOToolStripMenuItem";
this->openOToolStripMenuItem->Size = System::Drawing::Size(112, 22);
this->openOToolStripMenuItem->Text = L"Open(&O)";
this->openOToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::openOToolStripMenuItem_Click);
//
// openFileDialog1
//
this->openFileDialog1->FileName = L"openFileDialog1";
this->openFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::openFileDialog1_FileOk);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(884, 455);
this->Controls->Add(this->label10);
this->Controls->Add(this->label7);
this->Controls->Add(this->label8);
this->Controls->Add(this->label9);
this->Controls->Add(this->label4);
this->Controls->Add(this->label5);
this->Controls->Add(this->label6);
this->Controls->Add(this->dataGridView1);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->menuStrip1);
this->MainMenuStrip = this->menuStrip1;
this->Name = L"Form1";
this->Text = L"VMD Parameter Viewer";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
(cli::safe_cast(this->dataGridView1))->EndInit();
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void openOToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
openFileDialog1->ShowDialog();
}
private: System::Void openFileDialog1_FileOk(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {
IntPtr ptr = System::Runtime::InteropServices::Marshal::StringToHGlobalUni(((OpenFileDialog^)sender)->FileName);
LoadVmd readVMD((LPCTSTR)ptr.ToPointer());
System::Runtime::InteropServices::Marshal::FreeHGlobal(ptr);
VmdHeader vmdHeader = readVMD.GetHeader();
vector vmdMotions = readVMD.GetMotions();
label1->Text = gcnew String(vmdHeader.vmdHeader);
label2->Text = gcnew String(vmdHeader.vmdModelName);
label3->Text = gcnew String(vmdMotions.size().ToString());
dataGridView1->RowCount = vmdMotions.size();
for (int i = 0; i < dataGridView1->RowCount; ++i) {
dataGridView1[0, i]->Value = gcnew String(vmdMotions[i].boneName);
dataGridView1[1, i]->Value = vmdMotions[i].flameNo.ToString();
dataGridView1[2, i]->Value = vmdMotions[i].location[0].ToString("F2");
for (int j = 1; j < 3; ++j) dataGridView1[2, i]->Value += gcnew String(", ") + vmdMotions[i].location[j].ToString("F2");
dataGridView1[3, i]->Value = vmdMotions[i].rotation[0].ToString("F2");
for (int j = 1; j < 4; ++j) dataGridView1[3, i]->Value += gcnew String(", ") + vmdMotions[i].rotation[j].ToString("F2");
dataGridView1[4, i]->Value = vmdMotions[i].interpolation[0].ToString("D3");
for (int j = 1; j < 16; ++j) dataGridView1[4, i]->Value += gcnew String(", ") + vmdMotions[i].interpolation[j].ToString("D3");
}
}
};
}PKY ;ョ1 ョ1 PK M遷 c c LoadVmd.cpp#include "StdAfx.h"
#include "LoadVmd.h"
LoadVmd::LoadVmd(LPCTSTR filename){
// PMDファイルからPMDデータを抽出
ifstream ifs(filename, ios::binary);
if (ifs.fail()) throw TEXT("ファイルがありません");
ifs.read((char*)&vmdHeader, sizeof(VmdHeader));
unsigned long numVmdMotion;
ifs.read((char*)&numVmdMotion, sizeof(numVmdMotion));
vmdMotions.resize(numVmdMotion);
ifs.read((char*)&vmdMotions[0], sizeof(VmdMotion)*numVmdMotion);
}
LoadVmd::~LoadVmd() {
}
VmdHeader LoadVmd::GetHeader() {
return vmdHeader;
}
vector LoadVmd::GetMotions() {
return vmdMotions;
}PKーユc c PK M遷 LoadVmd.h#pragma once
#pragma pack(push,1) //アラインメント制御をオフ
struct VmdHeader {
char vmdHeader[30];
char vmdModelName[20];
};
struct VmdMotion {
char boneName[15];
unsigned long flameNo;
float location[3];
float rotation[4];
unsigned char interpolation[64];
};
#pragma pack(pop)
class LoadVmd {
private:
VmdHeader vmdHeader;
vector vmdMotions;
public:
LoadVmd(LPCTSTR filename);
virtual ~LoadVmd();
VmdHeader GetHeader();
vector GetMotions();
};
PKヘ0ュ PK M遷
ReadMe.txtソースコードについて:
拡張子cppとhのソースコードのみです。Visual C++ 2008のプロジェクトファイルは入っていません。コンパイルするにはプロジェクト名VMD_Parameter_ViewerというWindowsフォームアプリケーションを新しく作成し、このフォルダ中の全てのh, cppファイルをプロジェクトに追加して下さい(Form1.h, stdafxは上書き)。 コンパイル、実行が出来ない場合はmasahage@solei.ocn.ne.jpにご連絡下さい。
実行ファイルについて:
VMD_Parameter_Viewer.exeです。意図的には入れていませんが如何なるバグが潜んでいても責任は取れません。PK18、 PK M遷 ッ ッ stdafx.h// stdafx.h : 標準のシステム インクルード ファイルのインクルード ファイル、または
// 参照回数が多く、かつあまり変更されない、プロジェクト専用のインクルード ファイル
// を記述します。
#pragma once
#include
#include
#include
#include
#include
#include
#include
using namespace std;
// TODO: プログラムに必要な追加ヘッダーをここで参照してください。
PK' _ッ ッ PK M遷 VMD_Parameter_Viewer.exeMZ ク @ ネ コ エ ヘ!クLヘ!This program cannot be run in DOS mode.
$ -Nトi/b擁/b擁/b謡}譌J/b謡}阯m/b謡}揺/b謡}揺/b由ichi/b PE L ソ~N
3^ @ タ 蝠 @ ( ( 、 ー 濕 \ H .text `.rdata ヌ
@ @.rsrc 、 | @ @.reloc ー @ B 0 ? S _,%PYJ (S _,Y(] Y
+( _,(K
*フ0 XX( XX(~ *フ0 オ (
*0 ) (
( &( &゙
(k ワ* A
0 ワ ュ (j Z X( ( &( ( -ン X( qO ( qO XJ(9 T゙h&('
(%
(f &
(%
(g (
(ヨ ゙&(%
(h
&゙ ,゙(i ヷ゙
(k ワ
゙
(k ワ*A| 」 ( ュ 2 , u B ^ ケ
ノ ヘ
0 (
゙
(k ワ( *A
0 ォ o( *0 i ( 7(ロ -XJoZX
*フフ0 シ
,1/ TXX( &`
゙_,_
~ XX(k ワ %X( &%JXJX1 XTX( &X`( ,゙L%JXJX( ゙ X(k ヷ X(k ヷ_,_
~ XX(k ワ*Ad ] ! ~ D K 8 h 0 @ XYXYJXJX1 XTXYX( ゙ XYX(k ワXYX( *A
" 0 / 3 XTHXG-゙( &゙
(k ワ( * A
0 G 。 (ナ (ト ,
(シ
8& (フ ,#(フ ( 4( (ツ R
8 LXJ-(ナ
8