Skip to content

Instantly share code, notes, and snippets.

@GRGSIBERIA
Last active January 2, 2016 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GRGSIBERIA/8358367 to your computer and use it in GitHub Desktop.
Save GRGSIBERIA/8358367 to your computer and use it in GitHub Desktop.
選択した頂点の頂点番号をCSVにて書き出すスクリプト.
// Run()関数内の処理を記述
// 外部クラスの活用などは一般形式のスクリプトコードを使用してください.
// プラグイン変数は IPERunArgs args を通して取得可能
// コードに自動的に追加されるヘッダ/フッタはメニューから有効化/確認が可能(ヘッダは標準で有効設定)
// 選択された頂点データの取得
int[] si = args.Host.Connector.View.PMDView.GetSelectedVertexIndices();
MessageBox.Show(si.Length.ToString());
// PMXEditorのパスを取得
var enc = System.Text.Encoding.GetEncoding("Shift_JIS");
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "\\" + @"data.csv";
MessageBox.Show(path);
// CSVへの書き出し
using (var sr = new StreamWriter(path, false, enc)) {
for (int i = 0; i < si.Length; i++) {
string text = si[i].ToString();
sr.WriteLine(text);
}
MessageBox.Show("end");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment