Skip to content

Instantly share code, notes, and snippets.

@tracebox55
Created October 19, 2013 03:52
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 tracebox55/7051461 to your computer and use it in GitHub Desktop.
Save tracebox55/7051461 to your computer and use it in GitHub Desktop.
[PMDE]選択頂点を反転する
//
// 選択頂点を反転する
// [簡易形式]ReverseVertexSelection.cx
IList<int> vlist = new List<int>(); // 処理対象頂点のリスト格納用
int[] selectedMaterials = connect.View.PMDViewHelper.PartsSelect.GetCheckedMaterialIndices(); // 材質絞込み状態取得
if (selectedMaterials.Length < material.Count) // 材質絞込みがされている?
{
// 有効な頂点を記憶する
foreach (int i in selectedMaterials)
{
foreach (IPXFace f in material[i].Faces)
{
foreach (IPXVertex v in new IPXVertex[] { f.Vertex1, f.Vertex2, f.Vertex3 })
{
if (!vlist.Contains(vertex.IndexOf(v)))
{
vlist.Add(vertex.IndexOf(v));
}
}
}
}
}
else
{
// 全ての頂点を記憶する
for (int i = 0; i < vertex.Count; i++)
{
vlist.Add(i);
}
}
// 選択済み頂点を処理対象頂点リストから除外する
foreach (int i in view.GetSelectedVertexIndices())
{
if (vlist.Contains(i))
{
vlist.Remove(i);
}
}
if (vlist.Count > 0)
{
view.SetSelectedVertexIndices(vlist.ToArray<int>());
connect.View.PMDView.UpdateView();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment