Skip to content

Instantly share code, notes, and snippets.

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/8367735 to your computer and use it in GitHub Desktop.
Save GRGSIBERIA/8367735 to your computer and use it in GitHub Desktop.
CSVファイルから頂点INDEXを読み込んで選択する
// Run()関数内の処理を記述
// 外部クラスの活用などは一般形式のスクリプトコードを使用してください.
// プラグイン変数は IPERunArgs args を通して取得可能
// コードに自動的に追加されるヘッダ/フッタはメニューから有効化/確認が可能(ヘッダは標準で有効設定)
// ファイルの指定
var enc = System.Text.Encoding.GetEncoding("Shift_JIS");
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "\\" + @"input.csv";
var strs = new List<int>(); // 一時的な文字列
int[] select_indices = null;
// inputファイルの読み込み
using (var sr = new StreamReader(path, enc)) {
while (sr.Peek() > 0)
strs.Add(int.Parse(sr.ReadLine()));
select_indices = strs.ToArray();
}
//MessageBox.Show(select_indices.Length.ToString());
// PMDViewで頂点を選択
args.Host.Connector.View.PMDView.SetSelectedVertexIndices(select_indices);
// PMDViewの更新,最後にこれをやらないと反映されない
args.Host.Connector.View.PMDView.UpdateView();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment